/* Personal health: scoped styles, independent of the legacy score dashboard. */
#healthView { --hd-green:#238760; --hd-purple:#7753ca; --hd-amber:#a36a16; }
[data-theme="dark"] #healthView { --hd-green:#74e3bb; --hd-purple:#b5a1ff; --hd-amber:#f4c377; }
.health-dashboard { max-width:1360px; margin:auto; padding:28px 30px 48px; color:var(--text); font-family:var(--font-body,system-ui); }
.hd-header { display:flex; justify-content:space-between; align-items:center; gap:24px; margin-bottom:24px; }
.hd-eyebrow { display:block; font-size:10px; font-weight:700; letter-spacing:.16em; color:var(--muted); line-height:1.5; }
.hd-header h2 { font-size:clamp(25px,2.7vw,38px); letter-spacing:-.045em; line-height:1.15; margin:9px 0 10px; }
.hd-header p { font-size:13px; color:var(--muted); line-height:1.6; max-width:680px; }
.hd-live-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--hd-green); margin:0 0 5px 12px; }
.health-dashboard button { cursor:pointer; color:inherit; font:inherit; }
.health-dashboard button:focus-visible,.health-dashboard input:focus-visible,.hd-chart-point:focus-visible { outline:2px solid var(--hd-green); outline-offset:3px; }
.hd-refresh,.hd-goals button { border:1px solid var(--line-strong); background:var(--surface); border-radius:10px; min-height:42px; padding:10px 15px; font-size:12px!important; white-space:nowrap; }
.hd-toolbar { display:flex; align-items:center; gap:18px; flex-wrap:wrap; margin-bottom:16px; }
.hd-period { display:flex; background:var(--surface-2); border:1px solid var(--line); padding:4px; border-radius:11px; gap:3px; }
.hd-period button { background:transparent; padding:8px 14px; min-height:36px; border-radius:7px; color:var(--muted); font-size:12px; }
.hd-period button[aria-pressed="true"] { color:var(--text); background:var(--surface); box-shadow:0 1px 5px #0001; }
.hd-date { display:flex; align-items:center; gap:10px; font-size:12px; color:var(--muted); }
.hd-date input { color:var(--text); background:var(--surface); border:1px solid var(--line-strong); border-radius:8px; padding:9px; font:inherit; color-scheme:light dark; }
.hd-link { background:none; color:var(--hd-green)!important; font-size:12px!important; min-height:36px; }
.hd-freshness { display:flex; flex-wrap:wrap; gap:6px 18px; font-size:11px; line-height:1.6; color:var(--muted); padding:0 0 20px; }
.hd-freshness span:first-child { color:var(--text); font-weight:600; }
.hd-freshness.is-warning { color:var(--hd-amber); }
.hd-hero { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:30px; border:1px solid var(--line-strong); border-radius:18px; background:linear-gradient(110deg,color-mix(in srgb,var(--hd-green) 9%,var(--surface)),var(--surface) 75%); margin-bottom:18px; }
.hd-hero h3 { font-size:clamp(23px,2.2vw,32px); line-height:1.2; letter-spacing:-.035em; margin:10px 0; }
.hd-hero p { font-size:14px; color:var(--text-soft); line-height:1.6; }
.hd-tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.hd-tags span,.hd-badge { display:inline-block; color:var(--muted); font-size:10px; padding:5px 8px; border:1px solid var(--line); border-radius:6px; line-height:1.5; }
.hd-primary { background:var(--text); color:var(--surface)!important; border-radius:10px; padding:13px 17px; font-size:12px!important; white-space:nowrap; min-height:44px; }
.hd-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.hd-kpi { text-align:left; padding:22px; min-width:0; background:var(--surface); border:1px solid var(--line); border-radius:14px; }
.hd-kpi[aria-pressed="true"] { border-color:var(--hd-green); }
.hd-kpi>span { display:block; font-size:10px; font-weight:700; letter-spacing:.09em; margin-bottom:17px; }
.hd-kpi>strong { display:block; font-size:clamp(23px,2.3vw,35px); line-height:1.2; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.hd-kpi strong small { color:var(--muted); font-size:12px; font-weight:500; letter-spacing:0; }
.hd-kpi p { margin:12px 0 0; font-size:12px; color:var(--text-soft); line-height:1.6; }
.hd-kpi>small { color:var(--muted); font-size:10px; display:block; margin-top:6px; }
.hd-purple>span { color:var(--hd-purple); }.hd-green>span { color:var(--hd-green); }.hd-amber>span { color:var(--hd-amber); }
.hd-meter { height:4px; border-radius:4px; background:var(--surface-3); margin-top:18px; overflow:hidden; }.hd-meter i { display:block; height:100%; background:var(--hd-purple); border-radius:4px; }.hd-amber .hd-meter i { background:var(--hd-amber); }
.hd-panel { padding:24px; border:1px solid var(--line); border-radius:16px; background:var(--surface); min-width:0; margin-bottom:18px; }
.hd-panel-head { display:flex; justify-content:space-between; align-items:center; gap:15px; margin-bottom:20px; }
.hd-panel h3 { font-size:20px; line-height:1.3; letter-spacing:-.025em; margin:5px 0 0; }.hd-trend-value { font-size:26px; font-variant-numeric:tabular-nums; white-space:nowrap; }.hd-trend-value small { font-size:12px; color:var(--muted); }
.hd-metric-tabs { display:flex; gap:6px; overflow-x:auto; padding:3px 2px 14px; scrollbar-width:thin; }
.hd-metric-tabs button { white-space:nowrap; font-size:11px; min-height:34px; background:var(--surface-2); border:1px solid var(--line); border-radius:7px; padding:7px 10px; color:var(--muted); }
.hd-metric-tabs button[aria-pressed="true"] { color:var(--text); border-color:var(--hd-green); background:color-mix(in srgb,var(--hd-green) 8%,var(--surface)); }
.hd-plot { width:100%; height:auto; display:block; overflow:visible; }.hd-plot text { fill:var(--muted); font:11px system-ui; }.hd-gridline { stroke:var(--line); stroke-width:1; }
.hd-chart-point { cursor:crosshair; }.hd-chart-point:hover,.hd-chart-point:focus { fill-opacity:.8; stroke:var(--surface); stroke-width:2px; }
.hd-tooltip { display:block; min-height:30px; padding:5px 0 9px; font-size:12px; color:var(--text-soft); }
.hd-chart-legend { display:flex; flex-wrap:wrap; gap:10px 22px; font-size:11px; color:var(--muted); line-height:1.6; }.hd-chart-legend i { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:6px; }
.hd-note { font-size:11px; color:var(--muted); line-height:1.7; margin:13px 0 0; }.hd-chart-empty { min-height:190px; display:grid; align-content:center; justify-items:center; text-align:center; gap:12px; color:var(--muted); font-size:14px; }.hd-chart-empty small { font-size:11px; }
.hd-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }.hd-sleep-times { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }.hd-sleep-times small { display:block; color:var(--muted); font-size:11px; margin-bottom:8px; }.hd-sleep-times strong { font-size:22px; font-weight:600; }
.hd-sleep-bar { height:26px; display:flex; overflow:hidden; border-radius:7px; gap:3px; margin:26px 0 16px; }.hd-stage-deep { background:#7954d1; }.hd-stage-core { background:#b09be5; }.hd-stage-rem { background:#d6caf5; }
.hd-stage-legend { display:flex; justify-content:space-between; flex-wrap:wrap; gap:12px; font-size:11px; color:var(--muted); }.hd-stage-legend i { display:inline-block; width:7px; height:7px; border-radius:2px; margin-right:5px; }.hd-stage-legend strong { display:block; color:var(--text); font-size:13px; margin:8px 0; }
.hd-insights article+article { margin-top:16px; padding-top:16px; border-top:1px solid var(--line); }.hd-insights h4 { margin:0 0 6px; font-size:13px; }.hd-insights p { font-size:12px; line-height:1.7; color:var(--muted); margin:0; }
.hd-calendar { display:grid; grid-template-columns:repeat(15,minmax(0,1fr)); gap:6px; }.hd-calendar button { min-height:54px; border-radius:7px; display:grid; align-content:center; gap:6px; color:var(--text); border:1px solid transparent; }.hd-calendar button:hover { border-color:var(--text); }.hd-calendar small { font-size:10px; opacity:.7; }.hd-calendar strong { font-size:12px; }.hd-calendar .is-missing { background:var(--surface-2); border:1px dashed var(--line-strong); color:var(--muted); }.hd-calendar .is-short { background:color-mix(in srgb,var(--hd-amber) 20%,var(--surface)); }.hd-calendar .is-mid { background:color-mix(in srgb,var(--hd-purple) 16%,var(--surface)); }.hd-calendar .is-long { background:color-mix(in srgb,var(--hd-purple) 40%,var(--surface)); }
.hd-correlation { display:grid; grid-template-columns:1.2fr 1fr; gap:36px; align-items:center; }.hd-correlation strong { font-size:22px; line-height:1.35; letter-spacing:-.025em; }.hd-correlation p { font-size:12px; line-height:1.7; color:var(--muted); }
.hd-vitals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }.hd-vitals button { padding:18px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2); text-align:left; }.hd-vitals span { display:block; font-size:11px; color:var(--muted); min-height:30px; }.hd-vitals strong { font-size:24px; display:block; margin:12px 0; }.hd-vitals small { font-size:11px; font-weight:400; }.hd-vitals p { color:var(--muted); font-size:11px; }
.hd-method summary { cursor:pointer; font-size:13px; font-weight:600; min-height:24px; }.hd-method-content { padding-top:16px; font-size:12px; line-height:1.8; color:var(--muted); }.hd-method-content p { margin:0 0 12px; }
.hd-goals { display:flex; flex-wrap:wrap; align-items:end; gap:16px; margin:22px 0 8px; }.hd-goals label { display:grid; gap:6px; }.hd-goals input { width:150px; padding:10px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--text); font:inherit; }
.hd-footer { text-align:center; color:var(--muted); font-size:10px; padding:15px 0; letter-spacing:.04em; }.hd-error { padding:14px; margin-bottom:14px; border:1px solid var(--hd-amber); border-radius:9px; font-size:13px; }.hd-error button { background:none; text-decoration:underline; }.hd-empty { padding:40px 15px; }.hd-empty h2 { font-size:28px; margin:15px 0; }.hd-empty p { color:var(--muted); }.hd-empty button { padding:12px; background:var(--surface-2); border-radius:8px; margin-top:16px; }
@media(min-width:1500px){.hd-plot{max-height:320px;}}
@media(max-width:1100px){.health-dashboard{padding:24px 20px;}.hd-kpi{padding:18px;}.hd-calendar{grid-template-columns:repeat(10,minmax(0,1fr));}}
@media(max-width:700px){.health-dashboard{padding:18px 14px 40px;}.hd-header{align-items:flex-start;gap:12px;}.hd-header h2{font-size:27px;}.hd-header p{font-size:12px;}.hd-refresh{font-size:0!important;padding:10px;}.hd-refresh::first-letter{font-size:22px;}.hd-hero{padding:20px;display:block;}.hd-hero .hd-primary{margin-top:20px;}.hd-kpis{grid-template-columns:1fr;gap:9px;}.hd-kpi{display:grid;grid-template-columns:1fr 1fr;gap:6px 14px;}.hd-kpi>span{margin:0;align-self:center;}.hd-kpi>strong{text-align:right;font-size:26px;}.hd-kpi .hd-meter{grid-column:1/-1;margin:4px 0;}.hd-kpi p{grid-column:1/-1;margin:2px 0;}.hd-kpi>small{grid-column:1/-1;}.hd-grid,.hd-correlation{grid-template-columns:1fr;gap:0;}.hd-correlation{gap:18px;}.hd-panel{padding:18px 14px;}.hd-panel h3{font-size:19px;}.hd-calendar{grid-template-columns:repeat(7,minmax(0,1fr));gap:5px;}.hd-vitals{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}.hd-vitals button{padding:12px;}.hd-vitals strong{font-size:21px;}.hd-date input{font-size:16px;max-width:160px;}.hd-toolbar{gap:10px 16px;}.hd-plot{min-height:170px;}.hd-plot text{font-size:13px;}.hd-period button{min-height:40px;}.hd-goals input{font-size:16px;}.hd-trend-value{font-size:21px;}.hd-sleep-times strong{font-size:20px;}}
@media(prefers-reduced-motion:reduce){.health-dashboard *{scroll-behavior:auto!important;transition:none!important;}}

@media(max-width:700px){.hd-header p{display:none;}.hd-header{margin-bottom:14px;}.hd-header h2{font-size:25px;}.hd-live-dot{display:none;}.hd-hero{padding:18px;}.hd-hero h3{font-size:22px;}.hd-hero p{font-size:13px;}.hd-tags{margin-top:12px;gap:5px;}.hd-tags span{font-size:9px;padding:3px 6px;}.hd-hero .hd-primary{margin-top:14px;}.hd-chart-point{r:8px;}}
/* Keep the same metric identity with sufficient contrast in the light theme. */
html:not([data-theme="dark"]) .health-dashboard [stroke="#74e3bb"]{stroke:#238760}html:not([data-theme="dark"]) .health-dashboard [fill="#74e3bb"]{fill:#238760}
html:not([data-theme="dark"]) .health-dashboard [stroke="#a99cff"]{stroke:#7753ca}html:not([data-theme="dark"]) .health-dashboard [fill="#a99cff"]{fill:#7753ca}
html:not([data-theme="dark"]) .health-dashboard [stroke="#ff9f98"]{stroke:#c75753}html:not([data-theme="dark"]) .health-dashboard [fill="#ff9f98"]{fill:#c75753}
html:not([data-theme="dark"]) .health-dashboard [stroke="#b8ee76"]{stroke:#578a25}html:not([data-theme="dark"]) .health-dashboard [fill="#b8ee76"]{fill:#578a25}
html:not([data-theme="dark"]) .health-dashboard [stroke="#f4c377"]{stroke:#a36a16}html:not([data-theme="dark"]) .health-dashboard [fill="#f4c377"]{fill:#a36a16}
html:not([data-theme="dark"]) .health-dashboard [stroke="#83cef4"]{stroke:#267ba7}html:not([data-theme="dark"]) .health-dashboard [fill="#83cef4"]{fill:#267ba7}
html:not([data-theme="dark"]) .health-dashboard [stroke="#edb2e4"]{stroke:#a35899}html:not([data-theme="dark"]) .health-dashboard [fill="#edb2e4"]{fill:#a35899}
