:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #fff;
  --ink: #1d1d1f;
  --muted: #86868b;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.13);
  --accent: #ff375f;
  --accent-dark: #e62149;
  --accent-wash: rgba(255, 55, 95, 0.1);
  --blue: #2997ff;
  --violet: #8944ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03), 0 8px 24px rgba(0,0,0,.045);
  --shadow-lg: 0 24px 80px rgba(0,0,0,.09);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display:none!important; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden;
  background: radial-gradient(circle at 15% 7%,rgba(137,68,255,.08),transparent 26rem), radial-gradient(circle at 88% 28%,rgba(41,151,255,.07),transparent 28rem), var(--page);
  color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button,input,textarea,select { font: inherit; }
button,a,summary,input,textarea,select { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
a { color: inherit; text-decoration: none; }
h1,h2,p { margin: 0; }
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible { outline: 3px solid rgba(41,151,255,.35); outline-offset: 3px; }
::selection { background: rgba(255,55,95,.18); }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.page-glow { position:fixed;z-index:-1;width:26rem;height:26rem;border-radius:50%;filter:blur(70px);opacity:.15;pointer-events:none; }
.glow-one { top:16rem;left:-18rem;background:#ff375f; }
.glow-two { top:72rem;right:-18rem;background:#2997ff; }

/* Navigation */
.site-nav { position:sticky;z-index:50;top:0;border-bottom:1px solid rgba(0,0,0,.05);background:rgba(245,245,247,.76);backdrop-filter:saturate(180%) blur(22px);-webkit-backdrop-filter:saturate(180%) blur(22px); }
.nav-inner { width:min(1180px,calc(100% - 40px));height:58px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;gap:28px; }
.nav-brand { display:inline-flex;align-items:center;gap:9px;font-size:.92rem;font-weight:650;letter-spacing:-.01em;white-space:nowrap; }
.brand-symbol { display:grid;width:29px;height:29px;place-items:center;border-radius:9px;background:var(--ink);color:#fff;box-shadow:inset 0 0 0 1px rgba(255,255,255,.14); }
.brand-symbol svg { width:19px;height:19px; }
.dashboard-nav { min-width:0;display:flex;flex:1;align-items:center;justify-content:flex-end;gap:22px; }
.nav-links { display:flex;align-items:center;gap:clamp(18px,3vw,34px);margin-left:auto;color:#515154;font-size:.78rem; }
.nav-links button { cursor:pointer;background:none;color:inherit;font-size:inherit;transition:color 180ms ease; }
.nav-links button:hover,.nav-links button.active { color:#000; }
.status-cluster { min-width:136px;display:flex;align-items:flex-end;flex-direction:column;gap:2px; }
.status-badge { display:inline-flex;align-items:center;gap:7px;border-radius:999px;padding:5px 10px;background:rgba(0,0,0,.05);color:#59595d;font-size:.72rem;font-weight:650;line-height:1;transition:background 220ms ease,color 220ms ease; }
.status-badge .dot { width:6px;height:6px;border-radius:50%;background:currentColor; }
.status-badge.running { background:rgba(48,209,88,.13);color:#168a36; }
.status-badge.running .dot { animation:status-pulse 1.5s ease-out infinite; }
.status-badge.done { background:rgba(41,151,255,.12);color:#0875d1; }
.status-badge.error { background:rgba(255,69,58,.12);color:#cf2f27; }
.session-id { max-width:150px;overflow:hidden;color:var(--muted);font-family:var(--mono);font-size:.6rem;text-overflow:ellipsis;white-space:nowrap; }
.account-cluster { min-width:0;display:flex;align-items:center;gap:8px;padding-left:18px;border-left:1px solid var(--hairline); }
.admin-link { padding:6px 8px;border-radius:8px;background:rgba(0,0,0,.055);color:#515154;font-size:.65rem;font-weight:650;transition:background 170ms ease,color 170ms ease; }
.admin-link:hover { background:rgba(0,0,0,.1);color:#111; }
.account-avatar { width:29px;height:29px;display:grid;flex:none;place-items:center;border-radius:50%;background:var(--ink);color:#fff;font-size:.68rem;font-weight:700;text-transform:uppercase; }
.account-email { max-width:150px;overflow:hidden;color:#515154;font-size:.69rem;text-overflow:ellipsis;white-space:nowrap; }
.icon-button { width:32px;height:32px;display:grid;flex:none;cursor:pointer;place-items:center;border-radius:9px;background:transparent;color:#75757a;transition:background 170ms ease,color 170ms ease; }
.icon-button svg { width:18px;height:18px; }
.icon-button:hover:not(:disabled) { background:rgba(255,69,58,.09);color:#cf3028; }

/* Authentication */
.auth-view { min-height:calc(100vh - 59px);display:grid;place-items:center;padding:52px 20px 70px; }
.auth-loading { display:flex;align-items:center;justify-content:center;flex-direction:column;gap:13px;color:var(--muted);font-size:.76rem; }
.loading-spinner { width:28px;height:28px;border:2px solid rgba(0,0,0,.1);border-top-color:var(--ink);border-radius:50%;animation:spin 750ms linear infinite; }
.auth-content { width:min(100%,430px);animation:reveal-up 520ms cubic-bezier(.22,1,.36,1) both; }
.auth-heading { margin-bottom:24px;text-align:center; }
.auth-heading h1 { margin-top:9px;color:#09090b;font-size:3.15rem;font-weight:700;letter-spacing:0;line-height:1; }
.auth-heading p { margin-top:12px;color:var(--muted);font-size:.84rem; }
.auth-panel { padding:8px 26px 27px;border-radius:24px;background:rgba(255,255,255,.9);box-shadow:var(--shadow-lg); }
.auth-tabs { display:grid;grid-template-columns:1fr 1fr;gap:3px;margin:0 -18px 24px;padding:4px;border-radius:13px;background:rgba(0,0,0,.055); }
.auth-tab { min-height:39px;cursor:pointer;border-radius:10px;background:transparent;color:var(--muted);font-size:.75rem;font-weight:650;transition:background 170ms ease,color 170ms ease,box-shadow 170ms ease; }
.auth-tab.active { background:#fff;color:var(--ink);box-shadow:0 1px 5px rgba(0,0,0,.09); }
.auth-form { display:flex;flex-direction:column;gap:17px; }
.auth-field { display:flex;flex-direction:column;gap:7px;color:#535358;font-size:.71rem;font-weight:650; }
.auth-field>input,.password-field input { width:100%;height:49px;border:1px solid var(--hairline-strong);border-radius:12px;outline:none;background:#fafafa;color:var(--ink);padding:0 14px;font-size:.83rem;font-weight:450;transition:border-color 170ms ease,background 170ms ease,box-shadow 170ms ease; }
.auth-field>input::placeholder,.password-field input::placeholder { color:#a1a1a6; }
.auth-field>input:hover,.password-field input:hover { border-color:rgba(0,0,0,.22); }
.auth-field>input:focus,.password-field input:focus { border-color:rgba(41,151,255,.55);background:#fff;box-shadow:0 0 0 4px rgba(41,151,255,.1); }
.auth-field>input.input-error,.password-field input.input-error { border-color:rgba(255,69,58,.65);box-shadow:0 0 0 4px rgba(255,69,58,.08); }
.password-field { position:relative;display:block; }
.password-field input { padding-right:48px; }
.password-toggle { position:absolute;top:50%;right:7px;width:36px;height:36px;display:grid;cursor:pointer;place-items:center;border-radius:9px;background:transparent;color:#8e8e93;transform:translateY(-50%); }
.password-toggle:hover,.password-toggle.visible { background:rgba(0,0,0,.05);color:#4d4d52; }
.password-toggle svg { width:19px;height:19px; }
.password-requirement { margin-top:-8px;color:var(--muted);font-size:.64rem;line-height:1.5; }
.auth-message { padding:10px 12px;border-radius:10px;font-size:.7rem;line-height:1.45; }
.auth-message.error { background:rgba(255,69,58,.09);color:#b92b25; }
.auth-submit { width:100%;min-height:49px;margin-top:2px;border-radius:12px; }
.auth-notice { margin-top:16px;color:#23733a;font-size:.7rem;text-align:center; }
.auth-notice.error { color:#b92b25; }
.global-notice { position:fixed;z-index:100;top:72px;right:20px;max-width:min(360px,calc(100% - 40px));padding:11px 14px;border:1px solid rgba(255,255,255,.65);border-radius:11px;background:rgba(29,29,31,.94);color:#fff;font-size:.72rem;line-height:1.45;box-shadow:0 12px 36px rgba(0,0,0,.18);backdrop-filter:blur(16px); }
.global-notice.error { background:rgba(155,35,31,.96); }

/* Page typography */
.page-shell { width:min(1180px,calc(100% - 40px));margin:0 auto;padding:82px 0 44px; }
.hero-copy { max-width:940px;margin:0 auto 70px;text-align:center; }
.eyebrow,.section-kicker { color:var(--accent);font-size:.69rem;font-weight:750;letter-spacing:.14em; }
.hero-copy h1 { margin-top:13px;color:#050505;font-size:clamp(3.5rem,9vw,7.2rem);font-weight:720;letter-spacing:-.075em;line-height:.94; }
.hero-copy h1 span { background:linear-gradient(105deg,#ff2d55 5%,#af52de 48%,#2997ff 96%);background-clip:text;-webkit-background-clip:text;color:transparent; }
.hero-description { max-width:610px;margin:26px auto 0;color:#6e6e73;font-size:clamp(1.08rem,2.2vw,1.42rem);font-weight:430;letter-spacing:-.025em;line-height:1.5; }
.hero-points { display:flex;align-items:center;justify-content:center;gap:25px;margin-top:25px;color:#6e6e73;font-size:.78rem; }
.hero-points span { display:inline-flex;align-items:center;gap:8px; }
.hero-points i { width:5px;height:5px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px var(--accent-wash); }
.section-block,.chart-panel,.insight-grid,.summary-panel,.event-panel { margin-top:30px; }
.section-heading { display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin:0 4px 20px; }
.section-heading h2,.chart-title-row h2,.panel-title-row h2,.event-panel summary h2 { margin-top:6px;font-size:clamp(1.55rem,3vw,2.15rem);font-weight:680;letter-spacing:-.045em;line-height:1.08; }
.section-heading>p,.chart-title-row>div>p { color:var(--muted);font-size:.82rem; }
.panel,.metric-card { border:1px solid rgba(255,255,255,.72);background:var(--surface);box-shadow:var(--shadow-sm);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px); }
.panel { border-radius:var(--radius-xl); }
.view-switcher { display:none;grid-template-columns:repeat(4,1fr);gap:3px;margin-bottom:24px;padding:4px;border-radius:12px;background:rgba(0,0,0,.055); }
.view-button { min-height:38px;cursor:pointer;border-radius:9px;background:transparent;color:var(--muted);font-size:.76rem;font-weight:650; }
.view-button.active { background:#fff;color:var(--ink);box-shadow:0 1px 5px rgba(0,0,0,.08); }
.dashboard-view { display:none; }.dashboard-view.active { display:block; }
.history-layout { display:grid;grid-template-columns:minmax(280px,.72fr) minmax(0,1.28fr);gap:18px; }
.history-list-panel,.history-detail-panel,.trend-panel { padding:24px; }
.history-list { display:flex;flex-direction:column;gap:8px; }
.history-item { width:100%;display:grid;grid-template-columns:1fr auto;gap:5px 15px;cursor:pointer;padding:15px;border:1px solid var(--hairline);border-radius:8px;background:rgba(255,255,255,.65);color:var(--ink);text-align:left; }
.history-item:hover,.history-item.active { border-color:rgba(255,55,95,.35);background:var(--accent-wash); }
.history-item strong { overflow:hidden;font-size:.78rem;text-overflow:ellipsis;white-space:nowrap; }.history-item span { color:var(--muted);font-size:.68rem; }.history-item .history-status { color:var(--accent-dark);font-weight:650; }
.history-pager { display:flex;align-items:center;justify-content:space-between;margin-top:18px;color:var(--muted);font-size:.7rem; }
.view-empty { padding:48px 10px;color:var(--muted);font-size:.82rem;text-align:center; }
.detail-heading { display:flex;align-items:center;justify-content:space-between;gap:15px; }.detail-heading h2 { margin-top:5px;font-size:1.55rem; }
.detail-metrics { display:grid;grid-template-columns:repeat(4,1fr);gap:1px;margin:22px 0;background:var(--hairline); }.detail-metrics div { padding:13px;background:#fff; }.detail-metrics span { display:block;color:var(--muted);font-size:.65rem; }.detail-metrics strong { display:block;margin-top:4px;font-size:1.15rem; }
#historyChart,#trendChart { width:100%;height:240px;border-bottom:1px solid var(--hairline); }
.detail-summary { margin:20px 0;color:#57575c;font-size:.78rem;line-height:1.7; }.history-detail-panel h3 { margin:20px 0 10px;font-size:.85rem; }
.detail-advice { max-height:190px;margin:0;padding:0;overflow:auto;list-style:none; }.detail-advice li { padding:10px 0;border-bottom:1px solid var(--hairline);color:#57575c;font-size:.72rem;line-height:1.5; }
.trend-totals { display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px; }.trend-total { min-height:110px;padding:20px;border-radius:8px;background:#fff;box-shadow:var(--shadow-sm); }.trend-total span { color:var(--muted);font-size:.7rem; }.trend-total strong { display:block;margin-top:8px;font-size:1.75rem; }
.trend-legend { display:flex;justify-content:flex-end;gap:18px;margin-bottom:10px;color:var(--muted);font-size:.7rem; }.trend-legend span { display:flex;align-items:center;gap:6px; }.trend-legend i { width:16px;height:3px;border-radius:2px; }.trend-hr { background:var(--accent); }.trend-zone { background:var(--blue); }
/* Profile and account */
.profile-layout { display:grid;grid-template-columns:minmax(0,1.2fr) minmax(300px,.8fr);gap:18px; }
.profile-panel,.account-panel { padding:clamp(24px,4vw,38px); }
.profile-panel-heading { padding-bottom:22px;border-bottom:1px solid var(--hairline); }
.profile-panel-heading h3 { margin:0;color:var(--ink);font-size:1.15rem; }
.profile-panel-heading p { margin-top:7px;color:var(--muted);font-size:.72rem;line-height:1.5; }
.profile-fieldset { margin:25px 0 0;padding:0;border:0; }
.profile-fieldset legend,.profile-field>span { margin-bottom:9px;color:#59595e;font-size:.7rem;font-weight:650; }
.segmented-options { display:grid;grid-template-columns:repeat(3,1fr);gap:7px; }
.segmented-options label { cursor:pointer; }
.segmented-options input { position:absolute;opacity:0;pointer-events:none; }
.segmented-options span { display:flex;min-height:42px;align-items:center;justify-content:center;border:1px solid var(--hairline-strong);border-radius:9px;background:#fafafa;color:#606065;font-size:.75rem;font-weight:620;transition:border-color 160ms ease,background 160ms ease,color 160ms ease; }
.segmented-options input:checked+span { border-color:rgba(41,151,255,.45);background:rgba(41,151,255,.1);color:#116dbd;box-shadow:inset 0 0 0 1px rgba(41,151,255,.08); }
.segmented-options input:focus-visible+span { outline:3px solid rgba(41,151,255,.28);outline-offset:2px; }
.profile-input-grid { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:25px; }
.profile-field { display:flex;min-width:0;flex-direction:column; }
.unit-input { display:flex;height:46px;align-items:center;border:1px solid var(--hairline-strong);border-radius:9px;background:#fafafa;transition:border-color 160ms ease,box-shadow 160ms ease; }
.unit-input:focus-within { border-color:rgba(41,151,255,.55);box-shadow:0 0 0 4px rgba(41,151,255,.1); }
.unit-input input { min-width:0;flex:1;border:0;outline:0;background:transparent;padding:0 14px;color:var(--ink);font-size:.84rem; }
.unit-input small { flex:none;padding-right:13px;color:var(--muted);font-size:.65rem; }
.profile-message { min-height:18px;margin-top:18px;color:var(--muted);font-size:.68rem; }
.profile-message.success { color:#198b37; }.profile-message.error { color:#cf3028; }
.profile-save { margin-top:8px; }
.account-facts { margin:0; }
.account-facts div { padding:18px 0;border-bottom:1px solid var(--hairline); }
.account-facts dt { color:var(--muted);font-size:.65rem; }
.account-facts dd { overflow:hidden;margin:6px 0 0;color:#36363a;font-size:.78rem;font-weight:620;text-overflow:ellipsis;white-space:nowrap; }
.account-actions { margin-top:24px; }
.account-action { display:flex;width:100%;min-height:62px;align-items:center;justify-content:space-between;cursor:pointer;border-top:1px solid var(--hairline);background:transparent;padding:12px 3px;color:var(--ink);text-align:left; }
.account-action:first-child { border-top:0; }
.account-action span { display:flex;flex-direction:column;gap:4px; }
.account-action strong { font-size:.75rem; }.account-action small { color:var(--muted);font-size:.64rem; }
.account-action b { display:grid;width:28px;height:28px;place-items:center;border-radius:8px;background:rgba(0,0,0,.05);font-size:.9rem;font-weight:500; }
.account-action:hover:not(:disabled) b { background:rgba(41,151,255,.1);color:#0875d1; }
.account-action.danger { color:#c5312a; }.account-action.danger:hover:not(:disabled) b { background:rgba(255,69,58,.1);color:#c5312a; }
.account-action:disabled { cursor:not-allowed;opacity:.45; }
.admin-account-notice { margin-top:20px;padding:12px;border-radius:9px;background:rgba(0,0,0,.045);color:var(--muted);font-size:.66rem;line-height:1.5; }
/* Coach composer */
.coach-card { position:relative;overflow:hidden;padding:clamp(24px,4vw,42px);background:linear-gradient(135deg,rgba(255,255,255,.95),rgba(255,255,255,.73)),var(--surface);box-shadow:var(--shadow-lg); }
.coach-card::before { position:absolute;top:-110px;right:-100px;width:320px;height:250px;border-radius:50%;background:radial-gradient(circle,rgba(137,68,255,.12),transparent 68%);content:"";pointer-events:none; }
.coach-heading,.panel-title-row,.summary-title-line { display:flex;align-items:center;justify-content:space-between;gap:20px; }
.coach-heading h2 { margin-top:7px;font-size:clamp(1.8rem,4vw,2.7rem);font-weight:690;letter-spacing:-.055em; }
.coach-badge { display:inline-flex;align-items:center;gap:7px;flex:none;padding:8px 12px;border:1px solid rgba(137,68,255,.13);border-radius:999px;background:rgba(137,68,255,.07);color:#7441c7;font-size:.72rem;font-weight:650; }
.coach-badge svg { width:17px;height:17px; }
.prompt-shell { position:relative;margin-top:30px; }
textarea { display:block;width:100%;min-height:108px;resize:vertical;border:1px solid var(--hairline-strong);border-radius:22px;outline:none;background:rgba(250,250,250,.82);color:var(--ink);padding:22px 24px 38px;font-size:clamp(1rem,2vw,1.18rem);letter-spacing:-.015em;line-height:1.55;transition:border-color 180ms ease,background 180ms ease,box-shadow 180ms ease; }
textarea:hover { border-color:rgba(0,0,0,.2); }
textarea:focus { border-color:rgba(41,151,255,.55);background:#fff;box-shadow:0 0 0 4px rgba(41,151,255,.1); }
textarea.input-error { border-color:rgba(255,69,58,.7);box-shadow:0 0 0 4px rgba(255,69,58,.1); }
.prompt-hint { position:absolute;right:18px;bottom:13px;color:#a0a0a5;font-family:var(--mono);font-size:.62rem; }
.preset-row { display:flex;align-items:center;gap:8px;margin-top:14px;flex-wrap:wrap; }
.preset-label { margin-right:3px;color:var(--muted);font-size:.72rem; }
.preset-chip { cursor:pointer;padding:7px 11px;border:1px solid var(--hairline);border-radius:999px;background:rgba(255,255,255,.7);color:#57575c;font-size:.7rem;transition:all 160ms ease; }
.preset-chip:hover { transform:translateY(-1px);border-color:rgba(255,55,95,.25);background:var(--accent-wash);color:var(--accent-dark); }
.coach-actions { display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-top:24px; }
.advanced-options { flex:1;min-width:0; }
.advanced-options summary { width:fit-content;display:flex;align-items:center;gap:8px;cursor:pointer;list-style:none;color:#5b5b60;font-size:.78rem;font-weight:600;user-select:none; }
.advanced-options summary::-webkit-details-marker,.event-panel>summary::-webkit-details-marker { display:none; }
.settings-icon { display:grid;width:27px;height:27px;place-items:center;border-radius:9px;background:rgba(0,0,0,.05); }
.settings-icon svg { width:16px;height:16px; }
.chevron { color:var(--muted);transition:transform 180ms ease; }
.advanced-options[open] .chevron { transform:rotate(180deg); }
.options-grid { display:grid;grid-template-columns:minmax(180px,1fr) minmax(145px,.8fr) 110px 110px;gap:12px;margin-top:14px; }
.switch,.num-field { min-height:58px;display:flex;align-items:center;border:1px solid var(--hairline);border-radius:15px;background:rgba(250,250,250,.75); }
.switch { gap:11px;padding:10px 13px;cursor:pointer; }
.switch input { position:absolute;opacity:0;pointer-events:none; }
.track { position:relative;width:37px;height:22px;flex:none;border-radius:999px;background:#d1d1d6;transition:background 180ms ease; }
.track::after { position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.22);content:"";transition:transform 180ms ease; }
.switch input:checked+.track { background:#34c759; }
.switch input:checked+.track::after { transform:translateX(15px); }
.switch input:focus-visible+.track { outline:3px solid rgba(41,151,255,.28);outline-offset:2px; }
.switch-copy { display:flex;min-width:0;flex-direction:column;gap:1px; }
.switch-copy strong,.num-field>span { color:#454549;font-size:.71rem;font-weight:650; }
.switch-copy small { color:var(--muted);font-size:.61rem;white-space:nowrap; }
.num-field { justify-content:space-between;gap:8px;padding:9px 10px 9px 13px; }
.num-field input { width:54px;border:0;border-radius:9px;outline:none;background:#fff;color:var(--ink);padding:7px 5px;font-family:var(--mono);font-size:.73rem;text-align:center;box-shadow:inset 0 0 0 1px var(--hairline); }
.source-field select { min-width:0;width:86px;border:0;outline:0;background:transparent;color:#3d3d42;font-size:.68rem;font-weight:620; }
.num-field input:focus { box-shadow:inset 0 0 0 1px var(--blue),0 0 0 3px rgba(41,151,255,.1); }
.device-bridge-state { display:flex;min-height:34px;align-items:center;gap:8px;margin-top:10px;color:var(--muted);font-size:.66rem; }
.device-dot { width:7px;height:7px;border-radius:50%;background:#a1a1a6;box-shadow:0 0 0 4px rgba(0,0,0,.04); }
.device-bridge-state[data-status="waiting"] .device-dot,.device-bridge-state[data-status="waiting_setup"] .device-dot { background:var(--orange); }
.device-bridge-state[data-status="connected"] .device-dot { background:var(--green);animation:status-pulse 1.4s ease-out infinite; }
.device-bridge-state[data-status="completed"] .device-dot { background:var(--blue); }
.device-bridge-state[data-status="disconnected"] .device-dot { background:var(--accent); }
.button-group { display:flex;align-items:center;gap:10px;flex:none; }
.primary-button,.secondary-button,.ghost-button { display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-weight:650;transition:transform 170ms ease,opacity 170ms ease,background 170ms ease,box-shadow 170ms ease; }
.primary-button { min-width:142px;min-height:48px;gap:9px;padding:0 20px;border-radius:999px;background:var(--ink);color:#fff;font-size:.84rem;box-shadow:0 8px 20px rgba(0,0,0,.13); }
.primary-button svg { width:17px;height:17px;transition:transform 170ms ease; }
.primary-button:hover:not(:disabled) { transform:translateY(-2px);background:#000;box-shadow:0 12px 25px rgba(0,0,0,.18); }
.primary-button:hover:not(:disabled) svg { transform:translateX(2px); }
.secondary-button { min-height:45px;gap:8px;padding:0 15px;border-radius:999px;background:rgba(0,0,0,.055);color:#4d4d52;font-size:.76rem; }
.secondary-button:hover:not(:disabled) { background:rgba(255,69,58,.1);color:#d52c24; }
.stop-icon { width:8px;height:8px;border-radius:2px;background:currentColor; }
button:disabled,input:disabled,textarea:disabled { cursor:not-allowed;opacity:.42; }
.primary-button[aria-busy="true"] svg { width:15px;height:15px;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:spin 700ms linear infinite; }
.primary-button[aria-busy="true"] svg path { display:none; }
/* Metric bento */
.metric-grid { display:grid;grid-auto-flow:dense;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px; }
.metric-card { position:relative;min-height:184px;overflow:hidden;border-radius:var(--radius-lg); }
.heart-card { grid-column:span 6;grid-row:span 2;min-height:384px;display:flex;align-items:flex-end;justify-content:space-between;padding:clamp(28px,4vw,46px);border:1px solid rgba(255,255,255,.08);background:radial-gradient(circle at 76% 30%,rgba(255,55,95,.22),transparent 27%),radial-gradient(circle at 89% 60%,rgba(137,68,255,.18),transparent 29%),linear-gradient(145deg,#1e1e22,#09090b 68%);color:#fff;box-shadow:0 24px 65px rgba(0,0,0,.2);isolation:isolate; }
.heart-card-copy { position:relative;z-index:3;max-width:52%; }
.metric-label { display:flex;align-items:center;gap:7px;color:#74747a;font-size:.76rem;font-weight:620; }
.light-label { color:rgba(255,255,255,.64); }
.live-indicator { width:7px;height:7px;border-radius:50%;background:#74747a;box-shadow:0 0 0 4px rgba(255,255,255,.07); }
.heart-card.live .live-indicator { background:#ff375f;animation:status-pulse 1.2s ease-out infinite; }
.heart-value-row { display:flex;align-items:baseline;gap:11px;margin-top:10px; }
.heart-value-row strong { font-size:clamp(4.5rem,9vw,7rem);font-weight:650;letter-spacing:-.08em;line-height:.92; }
.heart-value-row .metric-unit { color:rgba(255,255,255,.55);font-size:.78rem;font-weight:650;letter-spacing:.08em; }
.heart-card-copy>p { max-width:280px;margin-top:18px;color:rgba(255,255,255,.48);font-size:.78rem;line-height:1.55; }
.heart-orbit { position:absolute;z-index:2;top:50%;right:clamp(14px,4vw,42px);width:min(44%,235px);aspect-ratio:1;transform:translateY(-50%); }
.orbit,.orbit-glow,.heart-glyph { position:absolute;top:50%;left:50%;transform:translate(-50%,-50%); }
.orbit { border-radius:50%;border-style:solid;transform-origin:center;transition:border-color 300ms ease,box-shadow 300ms ease; }
.orbit-one { width:100%;height:100%;border-width:1px;border-color:rgba(255,255,255,.08); }
.orbit-two { width:76%;height:76%;border-width:1px;border-color:rgba(255,55,95,.2); }
.orbit-three { width:51%;height:51%;border-width:2px;border-color:rgba(255,55,95,.48);box-shadow:inset 0 0 30px rgba(255,55,95,.08),0 0 28px rgba(255,55,95,.1); }
.orbit-glow { width:35%;height:35%;border-radius:50%;background:radial-gradient(circle,rgba(255,70,107,.26),rgba(255,55,95,.02) 68%,transparent 70%);filter:blur(2px); }
.heart-glyph { z-index:2;width:17%;color:#ff4f73;filter:drop-shadow(0 0 14px rgba(255,55,95,.55)); }
.heart-card.live .orbit-one { animation:orbit-turn 12s linear infinite;border-top-color:rgba(41,151,255,.55); }
.heart-card.live .orbit-two { animation:orbit-turn 8s linear infinite reverse;border-right-color:rgba(137,68,255,.8); }
.heart-card.live .orbit-three,.heart-card.live .heart-glyph { animation:heart-beat var(--beat-speed,.9s) ease-in-out infinite; }
.heart-grid { position:absolute;z-index:0;inset:0;opacity:.17;background-image:linear-gradient(rgba(255,255,255,.06) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.06) 1px,transparent 1px);background-size:42px 42px;mask-image:linear-gradient(to right,rgba(0,0,0,.75),transparent 78%); }
.standard-card { grid-column:span 3;display:flex;flex-direction:column;justify-content:flex-end;padding:22px;transition:transform 220ms ease,box-shadow 220ms ease,border-color 220ms ease; }
.standard-card:hover { transform:translateY(-3px);border-color:rgba(255,255,255,.95);box-shadow:0 15px 42px rgba(0,0,0,.08); }
.compact-card { grid-column:span 2; }
.metric-icon { position:absolute;top:20px;right:20px;display:grid;width:36px;height:36px;place-items:center;border-radius:12px; }
.metric-icon svg { width:20px;height:20px; }
.metric-icon.pink { background:rgba(255,55,95,.1);color:var(--accent); }
.metric-icon.violet { background:rgba(137,68,255,.1);color:var(--violet); }
.metric-icon.blue { background:rgba(41,151,255,.1);color:var(--blue); }
.metric-icon.green { background:rgba(48,209,88,.11);color:#21a943; }
.metric-icon.orange { background:rgba(255,159,10,.11);color:#d98100; }
.standard-card strong { display:block;max-width:100%;overflow:hidden;margin-top:9px;color:var(--ink);font-size:clamp(1.85rem,4vw,2.8rem);font-weight:650;letter-spacing:-.06em;line-height:1;text-overflow:ellipsis;white-space:nowrap; }
.compact-card strong { font-size:clamp(1.65rem,3.5vw,2.35rem); }
.standard-card .metric-unit { margin-top:7px;color:#96969b;font-size:.65rem; }
.metric-unit.in-zone { color:#1c9a3b; }
.metric-unit.off-zone { color:#d07a00; }

/* Chart */
.chart-panel { padding:clamp(24px,4vw,36px); }
.chart-title-row { align-items:flex-end; }
.chart-title-row>div>p { margin-top:7px; }
.chart-legend { display:flex;align-items:center;gap:18px;color:var(--muted);font-size:.68rem; }
.key { display:inline-flex;align-items:center;gap:7px; }
.key-line { width:20px;height:3px;border-radius:999px;background:linear-gradient(90deg,#ff375f,#af52de); }
.key-band { width:20px;height:9px;border:1px solid rgba(48,209,88,.18);border-radius:3px;background:rgba(48,209,88,.1); }
.chart-wrap { position:relative;min-height:285px;margin-top:24px;overflow:hidden;border:1px solid var(--hairline);border-radius:22px;background:linear-gradient(180deg,rgba(255,255,255,.93),rgba(250,250,250,.8)),#fff; }
#hrChart { display:block;width:100%;height:285px;overflow:visible; }
.chart-empty { position:absolute;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px;color:var(--muted);text-align:center;pointer-events:none; }
.empty-chart-icon { display:grid;width:58px;height:58px;margin-bottom:6px;place-items:center;border-radius:19px;background:var(--accent-wash);color:var(--accent); }
.empty-chart-icon svg { width:35px;height:35px; }
.chart-empty strong { color:#55555a;font-size:.82rem; }
.chart-empty>span:last-child { font-size:.68rem; }
.chart-tooltip { position:absolute;z-index:5;display:none;min-width:125px;padding:10px 12px;border:1px solid rgba(255,255,255,.15);border-radius:13px;background:rgba(29,29,31,.92);color:rgba(255,255,255,.7);font-size:.66rem;line-height:1.5;box-shadow:0 12px 34px rgba(0,0,0,.2);backdrop-filter:blur(12px);pointer-events:none; }
.tt-value { margin-bottom:3px;color:#fff;font-size:.78rem;font-weight:650; }
.tt-row { display:flex;align-items:center;gap:6px; }
.tt-key.band { width:8px;height:8px;border-radius:3px;background:rgba(48,209,88,.6); }
/* Advice and progress */
.insight-grid { display:grid;grid-template-columns:1.25fr .75fr;gap:16px; }
.advice-panel,.progress-panel { min-height:270px;padding:clamp(24px,4vw,34px); }
.panel-title-row h2 { font-size:clamp(1.35rem,2.5vw,1.8rem); }
.chip,.panel-meta { display:inline-flex;align-items:center;justify-content:center;flex:none;min-height:27px;padding:5px 10px;border-radius:999px;background:rgba(0,0,0,.05);color:#67676c;font-size:.65rem;font-weight:650; }
.chip.accent { background:rgba(41,151,255,.1);color:#1376ca; }
.chip.good { background:rgba(48,209,88,.12);color:#198b37; }
.chip.warn { background:rgba(255,159,10,.12);color:#ae6800; }
.chip.danger { background:rgba(255,69,58,.11);color:#cf3028; }
.advice-content { position:relative;display:flex;min-height:148px;align-items:center;margin-top:18px;overflow:hidden;border-radius:20px;background:radial-gradient(circle at 100% 0,rgba(137,68,255,.13),transparent 45%),linear-gradient(135deg,rgba(255,55,95,.07),rgba(137,68,255,.05));padding:30px 34px; }
.quote-mark { position:absolute;top:-22px;left:15px;color:rgba(255,55,95,.09);font-family:Georgia,serif;font-size:8rem;line-height:1; }
.advice-content p { position:relative;z-index:1;color:#36363a;font-size:clamp(1rem,2.2vw,1.28rem);font-weight:520;letter-spacing:-.025em;line-height:1.55; }
.progress-panel { display:flex;flex-direction:column; }
.progress-visual { margin-top:auto;padding-top:38px; }
.progress-track { height:9px;overflow:hidden;border-radius:999px;background:rgba(0,0,0,.07); }
.progress-bar { width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,#ff375f,#bf5af2,#2997ff);box-shadow:0 0 18px rgba(191,90,242,.28);transition:width 500ms cubic-bezier(.22,1,.36,1); }
.progress-pct { margin-top:11px;color:#4d4d52;font-size:.72rem;font-weight:620; }
.progress-note { margin-top:16px;color:var(--muted);font-size:.66rem;line-height:1.5; }

/* Summary */
.summary-panel { overflow:hidden;background:radial-gradient(circle at 92% 4%,rgba(41,151,255,.09),transparent 24rem),var(--surface); }
.summary-copy { padding:clamp(28px,5vw,46px) clamp(28px,5vw,50px) 30px; }
.summary-title-line { align-items:flex-start;margin-top:9px; }
.summary-title-line h2 { max-width:720px;font-size:clamp(1.8rem,4.5vw,3.5rem);font-weight:680;letter-spacing:-.06em;line-height:1.05; }
.summary-copy>p { max-width:720px;margin-top:18px;color:#77777c;font-size:.87rem;line-height:1.65; }
.summary-grid { display:grid;grid-template-columns:repeat(5,minmax(0,1fr));border-top:1px solid var(--hairline); }
.summary-grid>div { min-width:0;padding:25px clamp(16px,3vw,28px) 28px;border-right:1px solid var(--hairline); }
.summary-grid>div:last-child { border-right:0; }
.summary-grid span { display:block;color:var(--muted);font-size:.67rem; }
.summary-grid strong { display:inline-block;margin-top:10px;color:#252528;font-size:clamp(1.7rem,4vw,2.7rem);font-weight:630;letter-spacing:-.055em;line-height:1; }
.summary-grid small { margin-left:5px;color:#a0a0a5;font-size:.58rem; }

/* Event log */
.event-panel { overflow:hidden; }
.event-panel>summary { display:flex;align-items:center;justify-content:space-between;cursor:pointer;list-style:none;padding:24px clamp(24px,4vw,34px);user-select:none; }
.event-panel summary h2 { display:flex;align-items:center;gap:9px;font-size:1.25rem; }
.event-count { display:grid;min-width:22px;height:22px;place-items:center;border-radius:999px;background:rgba(0,0,0,.06);color:var(--muted);font-family:var(--mono);font-size:.58rem;font-weight:500; }
.log-toggle { display:inline-flex;align-items:center;gap:8px;color:var(--muted);font-size:.68rem; }
.log-toggle i { font-style:normal;transition:transform 180ms ease; }
.event-panel[open] .log-toggle i { transform:rotate(180deg); }
.event-panel-body { border-top:1px solid var(--hairline);padding:20px clamp(24px,4vw,34px) 30px; }
.event-toolbar { display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:14px; }
.event-toolbar p,.event-log-empty { color:var(--muted);font-size:.68rem; }
.ghost-button { padding:7px 10px;border-radius:10px;background:rgba(0,0,0,.05);color:#6d6d72;font-size:.66rem; }
.ghost-button:hover { background:rgba(255,69,58,.09);color:#d2332b; }
.event-log { max-height:310px;margin:0;overflow-y:auto;padding:0;list-style:none;scrollbar-color:#c8c8cc transparent;scrollbar-width:thin; }
.event-log li { display:grid;grid-template-columns:78px 100px minmax(0,1fr);gap:12px;padding:11px 4px;border-bottom:1px solid rgba(0,0,0,.055);color:#68686d;font-size:.69rem;line-height:1.45; }
.event-log li:last-child { border-bottom:0; }
.log-time { color:#a1a1a6;font-family:var(--mono);font-size:.61rem; }
.log-type { color:#3e3e42;font-weight:650; }
.event-log-empty { padding:16px 3px 4px; }
.page-footer { display:flex;align-items:center;justify-content:center;gap:8px;padding:42px 0 4px;color:#9b9ba0;font-size:.66rem; }
.footer-mark { color:var(--accent); }

/* Motion */
.reveal { animation:reveal-up 700ms cubic-bezier(.22,1,.36,1) both; }
.coach-card { animation-delay:80ms; }.section-block { animation-delay:140ms; }.chart-panel { animation-delay:200ms; }.insight-grid { animation-delay:240ms; }.summary-panel { animation-delay:280ms; }.event-panel { animation-delay:320ms; }
@keyframes status-pulse { 0%{box-shadow:0 0 0 0 currentColor}70%{box-shadow:0 0 0 6px transparent}100%{box-shadow:0 0 0 0 transparent} }
@keyframes heart-beat { 0%,100%{transform:translate(-50%,-50%) scale(1)}18%{transform:translate(-50%,-50%) scale(1.09)}34%{transform:translate(-50%,-50%) scale(.99)}48%{transform:translate(-50%,-50%) scale(1.05)} }
@keyframes orbit-turn { from{transform:translate(-50%,-50%) rotate(0)}to{transform:translate(-50%,-50%) rotate(360deg)} }
@keyframes reveal-up { from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:translateY(0)} }
@keyframes spin { to{transform:rotate(360deg)} }
/* Responsive */
@media (max-width:960px) {
  .nav-links { display:none; }
  .view-switcher { display:grid; }
  .page-shell { padding-top:66px; }
  .heart-card { grid-column:span 12;grid-row:auto;min-height:360px; }
  .standard-card { grid-column:span 6; }
  .compact-card { grid-column:span 4; }
  .insight-grid { grid-template-columns:1fr; }
  .profile-layout { grid-template-columns:1fr; }
  .advice-panel,.progress-panel { min-height:240px; }
}
@media (max-width:760px) {
  .nav-inner,.page-shell { width:min(100% - 24px,1180px); }
  .status-cluster { min-width:0; }
  .session-id { display:none; }
  .dashboard-nav { gap:12px; }
  .account-cluster { padding-left:12px; }
  .account-email { max-width:110px; }
  .page-shell { padding-top:54px; }
  .hero-copy { margin-bottom:48px; }
  .hero-points { gap:14px; }
  .coach-heading,.section-heading,.chart-title-row,.summary-title-line { align-items:flex-start;flex-direction:column; }
  .coach-badge { position:absolute;top:22px;right:22px; }
  .coach-heading>div { max-width:calc(100% - 90px); }
  .coach-actions { align-items:stretch;flex-direction:column; }
  .button-group { justify-content:flex-end; }
  .options-grid { grid-template-columns:1fr 1fr; }
  .switch { grid-column:1/-1; }
  .summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .summary-grid>div { border-bottom:1px solid var(--hairline); }
  .summary-grid>div:nth-child(2n) { border-right:0; }
  .summary-grid>div:last-child { grid-column:1/-1;border-bottom:0; }
  .chart-legend { align-self:flex-start; }
}
@media (max-width:560px) {
  :root { --radius-xl:25px;--radius-lg:21px; }
  .site-nav { background:rgba(245,245,247,.86); }
  .nav-inner { height:54px; }
  .nav-brand { font-size:.82rem; }
  .brand-symbol { width:27px;height:27px; }
  .nav-inner { gap:10px; }
  .dashboard-nav { gap:8px; }
  .account-cluster { gap:4px;padding-left:8px; }
  .account-email { display:none; }
  .admin-link { padding:6px;font-size:.61rem; }
  .auth-view { min-height:calc(100vh - 55px);padding:38px 12px 52px; }
  .auth-heading { margin-bottom:20px; }
  .auth-heading h1 { font-size:2.5rem; }
  .auth-panel { padding:8px 18px 21px;border-radius:20px; }
  .auth-tabs { margin-right:-10px;margin-left:-10px; }
  .hero-copy h1 { font-size:clamp(3.1rem,18vw,4.8rem); }
  .hero-description { font-size:1rem; }
  .hero-points { font-size:.68rem; }
  .hero-points i { display:none; }
  .coach-card { padding:23px 18px 20px; }
  .coach-badge { padding:7px 9px;font-size:.64rem; }
  textarea { min-height:124px;padding:18px 17px 36px; }
  .prompt-hint { right:14px; }
  .preset-row { gap:6px; }
  .preset-label { width:100%; }
  .coach-actions { gap:18px; }
  .button-group { display:grid;grid-template-columns:.9fr 1.1fr; }
  .primary-button,.secondary-button { width:100%;min-width:0; }
  .metric-grid { gap:12px; }
  .heart-card { min-height:405px;align-items:flex-end;padding:25px; }
  .heart-card-copy { max-width:100%; }
  .heart-orbit { top:39%;right:50%;width:205px;transform:translate(50%,-50%); }
  .heart-value-row strong { font-size:4.8rem; }
  .heart-card-copy>p { display:none; }
  .standard-card,.compact-card { grid-column:span 6;min-height:164px;padding:18px; }
  .metric-icon { top:17px;right:17px;width:32px;height:32px; }
  .standard-card strong,.compact-card strong { font-size:clamp(1.55rem,9vw,2.15rem); }
  .section-heading>p,.chart-title-row>div>p { display:none; }
  .chart-panel,.advice-panel,.progress-panel { padding:22px 18px; }
  .chart-wrap,#hrChart { min-height:235px;height:235px; }
  .chart-legend { width:100%;justify-content:space-between; }
  .advice-content { min-height:145px;padding:25px 22px; }
  .summary-copy { padding:27px 21px 26px; }
  .summary-grid>div { padding:21px; }
  .event-panel>summary,.event-panel-body { padding-right:20px;padding-left:20px; }
  .log-toggle span { display:none; }
  .event-toolbar { align-items:flex-start; }
  .event-log li { grid-template-columns:70px minmax(0,1fr);gap:6px 10px; }
  .event-log li>span:last-child:nth-child(3) { grid-column:1/-1;padding-left:80px; }
  .history-layout { grid-template-columns:1fr; }
  .trend-totals,.detail-metrics { grid-template-columns:repeat(2,1fr); }
  .view-switcher { overflow-x:auto;grid-template-columns:repeat(4,minmax(86px,1fr)); }
  .profile-input-grid { grid-template-columns:1fr; }
  .profile-panel,.account-panel { padding:22px 18px; }
}
@media (max-width:400px) {
  .status-cluster { display:none; }
  .account-cluster { margin-left:auto;border-left:0; }
}
@media (prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  *,*::before,*::after { animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important; }
}
