/* ============================================================
   Health Portal — theme
   ============================================================ */
:root {
    --hp-accent: #0F766E;
    --hp-accent-600: #0D6961;
    --hp-accent-700: #115E59;
    --hp-accent-50: #F0FDFA;
    --hp-accent-100: #CCFBF1;
    --hp-ink: #0F172A;
    --hp-ink-2: #334155;
    --hp-muted: #64748B;
    --hp-line: #E2E8F0;
    --hp-bg: #F4F7F8;
    --hp-card: #FFFFFF;
    --hp-high: #C2410C;
    --hp-high-50: #FFF7ED;
    --hp-low: #1D4ED8;
    --hp-low-50: #EFF6FF;
    --hp-ok: #15803D;
    --hp-ok-50: #F0FDF4;
    --hp-ai: #7C3AED;
    --hp-ai-50: #F5F3FF;
    --hp-radius: 12px;
    --hp-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --hp-top-h: 56px;
    --hp-side-w: 232px;
    --hp-tabs-h: 64px;
    --bs-primary: var(--hp-accent);
    --bs-link-color: var(--hp-accent);
    --bs-link-hover-color: var(--hp-accent-700);
}

html, body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--hp-bg);
    color: var(--hp-ink);
    -webkit-text-size-adjust: 100%;
}

a { color: var(--hp-accent); text-decoration: none; }
a:hover { color: var(--hp-accent-700); text-decoration: underline; }
h1:focus { outline: none; }

.btn-primary { background: var(--hp-accent); border-color: var(--hp-accent); }
.btn-primary:hover, .btn-primary:focus { background: var(--hp-accent-700); border-color: var(--hp-accent-700); }
.form-control:focus, .form-check-input:focus { border-color: var(--hp-accent); box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .2); }
.form-check-input:checked { background-color: var(--hp-accent); border-color: var(--hp-accent); }

/* ---------- shell ---------- */
.hp-top {
    position: fixed; inset: 0 0 auto 0; height: var(--hp-top-h); z-index: 30;
    display: flex; align-items: center; gap: 12px; padding: 0 16px;
    background: var(--hp-accent); color: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.hp-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 1.1rem; white-space: nowrap; }
.hp-brand:hover { color: #fff; text-decoration: none; }
.hp-brand svg { width: 28px; height: 28px; }
.hp-top .hp-spacer { flex: 1; }
.hp-patient { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: rgba(255, 255, 255, .92); }
.hp-patient select { background: rgba(255, 255, 255, .15); color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; padding: 2px 6px; }
.hp-patient select option { color: var(--hp-ink); }
.hp-avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; font-size: .85rem;
}
/* top-bar ring battery badge (RingBatteryBadge.razor): ring icon + phone-style battery with the % inside */
.hp-ringbat { display: inline-flex; align-items: center; gap: 4px; color: #fff; padding: 4px 6px; border-radius: 8px; }
.hp-ringbat:hover { background: rgba(255, 255, 255, .15); color: #fff; text-decoration: none; }
.hp-ringbat svg.ring { width: 20px; height: 20px; }
.hp-ringbat svg.bat { width: 40px; height: 19px; overflow: visible; }
.hp-ringbat .lvl { fill: #22c55e; }
.hp-ringbat.mid .lvl { fill: #eab308; }
.hp-ringbat.low .lvl { fill: #ef4444; }
.hp-ringbat.na .lvl { fill: #94a3b8; }
.hp-ringbat text { font: 700 9.5px system-ui, sans-serif; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .55); stroke-width: 1.6px; }
.hp-iconbtn { background: none; border: 0; color: #fff; padding: 6px; border-radius: 8px; display: inline-flex; }
.hp-iconbtn:hover { background: rgba(255, 255, 255, .15); }

.hp-side {
    position: fixed; top: var(--hp-top-h); bottom: 0; left: 0; width: var(--hp-side-w); z-index: 20;
    background: #fff; border-right: 1px solid var(--hp-line); padding: 12px 10px; overflow-y: auto;
}
.hp-side a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--hp-ink-2); font-weight: 500; margin-bottom: 2px;
}
.hp-side a:hover { background: var(--hp-accent-50); text-decoration: none; color: var(--hp-accent-700); }
.hp-side a.active { background: var(--hp-accent-100); color: var(--hp-accent-700); }
.hp-side a svg { width: 20px; height: 20px; flex: none; }
.hp-side .hp-side-sep { border-top: 1px solid var(--hp-line); margin: 10px 4px; }
.hp-side form button {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px;
    border: 0; background: none; color: var(--hp-ink-2); font-weight: 500; text-align: left;
}
.hp-side form button:hover { background: var(--hp-accent-50); }
.hp-side form button svg { width: 20px; height: 20px; }

.hp-main {
    margin-top: var(--hp-top-h); margin-left: var(--hp-side-w);
    padding: 24px 28px 40px; min-height: calc(100vh - var(--hp-top-h));
    max-width: calc(var(--hp-side-w) + 1180px);
}
.hp-main.hp-anon { margin-left: 0; max-width: none; }

.hp-tabs { display: none; }

@media (max-width: 860px) {
    .hp-side { display: none; }
    .hp-main { margin-left: 0; padding: 16px 16px calc(var(--hp-tabs-h) + 24px); }
    .hp-patient .hp-patient-label { display: none; }
    .hp-tabs {
        display: flex; position: fixed; inset: auto 0 0 0; height: var(--hp-tabs-h); z-index: 30;
        background: #fff; border-top: 1px solid var(--hp-line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .hp-tabs a {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        color: var(--hp-muted); font-size: .7rem; font-weight: 600;
    }
    .hp-tabs a svg { width: 22px; height: 22px; }
    .hp-tabs a.active { color: var(--hp-accent); }
    .hp-tabs a:hover { text-decoration: none; }
}

/* ---------- page bits ---------- */
.hp-page-title { font-size: 1.6rem; font-weight: 600; margin: 0 0 4px; }
.hp-page-sub { color: var(--hp-muted); margin-bottom: 20px; }
.hp-back { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; margin-bottom: 10px; }
.hp-back svg { width: 18px; height: 18px; }

.hp-card {
    background: var(--hp-card); border-radius: var(--hp-radius); box-shadow: var(--hp-shadow);
    padding: 18px 20px; margin-bottom: 16px;
}
.hp-card h2, .hp-card-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.hp-card-title .hp-link { margin-left: auto; font-size: .85rem; font-weight: 500; }
.hp-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.hp-grid > .hp-card { margin-bottom: 0; }
.hp-muted { color: var(--hp-muted); }
.hp-small { font-size: .85rem; }
.hp-xs { font-size: .75rem; }
.hp-mono { font-variant-numeric: tabular-nums; }
.hp-empty { color: var(--hp-muted); padding: 24px 8px; text-align: center; }

.hp-list { list-style: none; margin: 0; padding: 0; }
.hp-list > li { padding: 12px 0; border-top: 1px solid var(--hp-line); }
.hp-list > li:first-child { border-top: 0; padding-top: 0; }
.hp-list > li:last-child { padding-bottom: 0; }
.hp-row-link { display: flex; align-items: center; gap: 14px; color: inherit; }
.hp-row-link:hover { text-decoration: none; color: inherit; }
.hp-row-link:hover .hp-row-title { color: var(--hp-accent); }
.hp-row-title { font-weight: 600; }
.hp-chev { margin-left: auto; color: #94A3B8; flex: none; }
.hp-chev svg { width: 18px; height: 18px; }

/* date block (MyChart-style) */
.hp-date {
    flex: none; width: 54px; text-align: center; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--hp-line); background: #fff; line-height: 1.1;
}
.hp-date .m { background: var(--hp-accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 0; text-transform: uppercase; letter-spacing: .04em; }
.hp-date .d { font-size: 1.3rem; font-weight: 600; padding: 3px 0 0; }
.hp-date .y { font-size: .68rem; color: var(--hp-muted); padding-bottom: 4px; }
.hp-date.past .m { background: #94A3B8; }

/* chips */
.hp-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
    font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.hp-chip.ok { background: var(--hp-ok-50); color: var(--hp-ok); border-color: #BBF7D0; }
.hp-chip.high { background: var(--hp-high-50); color: var(--hp-high); border-color: #FED7AA; }
.hp-chip.low { background: var(--hp-low-50); color: var(--hp-low); border-color: #BFDBFE; }
.hp-chip.abn { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.hp-chip.neutral { background: #F1F5F9; color: var(--hp-ink-2); border-color: var(--hp-line); }
.hp-chip.ai { background: var(--hp-ai-50); color: var(--hp-ai); border-color: #DDD6FE; }
.hp-chip.accent { background: var(--hp-accent-50); color: var(--hp-accent-700); border-color: var(--hp-accent-100); }

/* filter pills */
.hp-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.hp-pill {
    border: 1px solid var(--hp-line); background: #fff; color: var(--hp-ink-2); border-radius: 999px;
    padding: 5px 12px; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.hp-pill:hover { border-color: var(--hp-accent); color: var(--hp-accent); }
.hp-pill.on { background: var(--hp-accent); border-color: var(--hp-accent); color: #fff; }
.hp-search {
    flex: 1 1 220px; max-width: 360px; border: 1px solid var(--hp-line); border-radius: 999px;
    padding: 7px 14px; background: #fff;
}
.hp-search:focus { outline: none; border-color: var(--hp-accent); box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .15); }

/* stats */
a.hp-stat { display: block; color: inherit; }
a.hp-stat:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--hp-accent-100), var(--hp-shadow); }
.hp-inline-icon { width: 18px; height: 18px; vertical-align: -3px; }
.hp-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.hp-stat { background: #fff; border-radius: var(--hp-radius); box-shadow: var(--hp-shadow); padding: 14px 16px; }
.hp-stat .lbl { font-size: .78rem; color: var(--hp-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.hp-stat .val { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hp-stat .val small { font-size: .85rem; color: var(--hp-muted); font-weight: 500; }
.hp-stat .sub { font-size: .8rem; color: var(--hp-muted); }

/* ---------- results grid (Function-style) ---------- */
.hp-cat { margin-bottom: 18px; }
.hp-cat-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px 2px; }
.hp-cat-head h2 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.hp-cat-head .hp-xs { color: var(--hp-muted); }
.hp-tests { background: #fff; border-radius: var(--hp-radius); box-shadow: var(--hp-shadow); overflow: hidden; }
.hp-test {
    display: grid; grid-template-columns: minmax(160px, 1.6fr) minmax(110px, .9fr) minmax(150px, 1.2fr) 110px 96px 20px;
    gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--hp-line); color: inherit;
}
.hp-test:first-child { border-top: 0; }
.hp-test:hover { background: var(--hp-accent-50); text-decoration: none; color: inherit; }
.hp-test .name { font-weight: 600; }
.hp-test .name .hp-xs { display: block; font-weight: 400; color: var(--hp-muted); }
.hp-test .value { font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hp-test .value .unit { font-size: .78rem; color: var(--hp-muted); font-weight: 500; margin-left: 3px; }
.hp-test .value .hp-xs { display: block; font-weight: 400; color: var(--hp-muted); }
.hp-test .when { font-size: .8rem; color: var(--hp-muted); }
.hp-test .spark { height: 28px; width: 110px; }

@media (max-width: 860px) {
    .hp-test {
        grid-template-columns: 1fr auto; grid-template-areas: "name value" "bar bar" "meta meta";
        gap: 6px 12px; padding: 12px 14px;
    }
    .hp-test .name { grid-area: name; }
    .hp-test .value { grid-area: value; text-align: right; }
    .hp-test .rbar { grid-area: bar; }
    .hp-test .spark, .hp-test .hp-chevcell { display: none; }
    .hp-test .when { grid-area: meta; display: flex; justify-content: space-between; align-items: center; }
}

/* range bar */
.rbar { position: relative; height: 22px; }
.rbar .track { position: absolute; top: 9px; left: 0; right: 0; height: 4px; border-radius: 4px; background: #FDE7D7; }
.rbar .band { position: absolute; top: 9px; height: 4px; background: #86EFAC; border-radius: 4px; }
.rbar .dot {
    position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
    background: var(--hp-ok); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}
.rbar .dot.out { background: var(--hp-high); }
.rbar .dot.low { background: var(--hp-low); }
.rbar.none .track { background: #E2E8F0; }

/* trend detail */
.hp-trend-head { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-end; margin-bottom: 8px; }
.hp-trend-latest .v { font-size: 2.2rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.hp-trend-latest .u { color: var(--hp-muted); margin-left: 4px; }
.hp-chart-box { position: relative; height: 320px; }
@media (max-width: 860px) { .hp-chart-box { height: 260px; } }
.hp-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--hp-muted); margin-top: 8px; }
.hp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hp-legend i { display: inline-block; width: 10px; height: 10px; background: var(--hp-accent); }
.hp-legend i.c { border-radius: 50%; }
.hp-legend i.t { width: 0; height: 0; background: none; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--hp-accent); }
.hp-legend i.d { transform: rotate(45deg); width: 9px; height: 9px; }
.hp-legend i.band { width: 18px; background: #DCFCE7; border: 1px solid #86EFAC; }
.hp-legend i.ln { width: 18px; height: 0; border-top: 2px dashed #64748B; background: none; }

/* tables */
.hp-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.hp-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--hp-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--hp-line); }
.hp-table td { padding: 10px; border-bottom: 1px solid var(--hp-line); vertical-align: top; }
.hp-table tr:last-child td { border-bottom: 0; }
.hp-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hp-table tr.excluded td { color: #94A3B8; text-decoration: line-through; }
.hp-table tr.excluded td.reason { text-decoration: none; }
.hp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
    .hp-table.stack thead { display: none; }
    .hp-table.stack tr { display: block; border-bottom: 1px solid var(--hp-line); padding: 8px 0; }
    .hp-table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
    .hp-table.stack td::before { content: attr(data-label); color: var(--hp-muted); font-size: .8rem; text-align: left; }
    .hp-table.stack td.num { text-align: right; }
}

/* notes */
.hp-note-body { font-size: .95rem; line-height: 1.55; }
.hp-note-body.pre { white-space: pre-wrap; font-family: inherit; }
.hp-note-body table { border-collapse: collapse; margin: 10px 0; font-size: .88rem; display: block; overflow-x: auto; }
.hp-note-body th, .hp-note-body td { border: 1px solid var(--hp-line); padding: 5px 8px; }
.hp-note-body th { background: #F8FAFC; }
.hp-note-body h1 { font-size: 1.35rem; } .hp-note-body h2 { font-size: 1.15rem; margin-top: 1.2rem; } .hp-note-body h3 { font-size: 1rem; margin-top: 1rem; }
.hp-ai-banner { background: var(--hp-ai-50); border: 1px solid #DDD6FE; color: #5B21B6; border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; }
.hp-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--hp-muted); font-size: .88rem; margin-bottom: 14px; }
.hp-meta b { color: var(--hp-ink-2); font-weight: 600; }

/* doc viewer */
.hp-doc-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--hp-accent-50); color: var(--hp-accent-700); }
.hp-doc-icon svg { width: 20px; height: 20px; }
.hp-doc-icon.pdf { background: #FEF2F2; color: #B91C1C; }
.hp-doc-icon.img { background: #EFF6FF; color: #1D4ED8; }
.hp-viewer { width: 100%; height: 75vh; border: 1px solid var(--hp-line); border-radius: 10px; background: #fff; }
.hp-viewer-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--hp-line); }

/* login page */
.hp-auth { max-width: 420px; margin: 6vh auto 0; }
.hp-auth .hp-card { padding: 28px; }
.hp-auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--hp-accent); font-weight: 600; font-size: 1.4rem; margin-bottom: 18px; }
.hp-auth-brand svg { width: 36px; height: 36px; }

/* loading */
.hp-loading { display: flex; align-items: center; gap: 10px; color: var(--hp-muted); padding: 30px 4px; }
.hp-spinner { width: 20px; height: 20px; border: 3px solid var(--hp-accent-100); border-top-color: var(--hp-accent); border-radius: 50%; animation: hp-spin .8s linear infinite; }
@keyframes hp-spin { to { transform: rotate(360deg); } }

/* blazor defaults */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 3.7rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred."; }
#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

@media print {
    .hp-top, .hp-side, .hp-tabs, .hp-filters, .hp-back { display: none !important; }
    .hp-main { margin: 0; padding: 0; }
    .hp-card { box-shadow: none; border: 1px solid var(--hp-line); }
}
.hp-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .92rem; }
.hp-dl dt { color: var(--hp-muted); font-weight: 500; }
.hp-dl dd { margin: 0; }
.hp-card-title > svg, .hp-card h2 > svg { width: 20px; height: 20px; flex: none; color: var(--hp-accent); }
.hp-card-title .hp-link { white-space: nowrap; }
.hp-table td.hp-group { font-size: .75rem; color: var(--hp-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding-top: 14px; }
@media (max-width: 640px) { .hp-table.stack td.hp-group { display: block; text-align: left; } .hp-table.stack td.hp-group::before { content: none; } }

.hp-qr { display: inline-block; background: #fff; padding: 8px; border: 1px solid var(--hp-line); border-radius: 10px; margin: 6px 0 14px; }
.hp-qr svg { display: block; width: 200px; height: 200px; }

.hp-info h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hp-accent-700); margin: 12px 0 4px; font-weight: 700; }
.hp-info h3:first-child { margin-top: 0; }
.hp-info p { margin: 0; line-height: 1.55; }

.hp-gene { cursor: pointer; }
.hp-gene:hover { border-color: var(--hp-accent); color: var(--hp-accent-700); }
.hp-gene-info { background: var(--hp-accent-50); border: 1px solid var(--hp-accent-100); border-radius: 10px; padding: 12px 14px; margin: 6px 0; }

.hp-synopsis { border-left: 4px solid var(--hp-accent); }
.hp-synopsis p { margin: 0 0 8px; line-height: 1.6; }

.hp-visit-preview { margin-top: 4px; color: var(--hp-text, inherit); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Test Results: view switch, draw multi-select, by-draw table */
.hp-seg { display: inline-flex; border: 1px solid var(--hp-line); border-radius: 999px; overflow: hidden; background: var(--hp-card); }
.hp-seg button { border: 0; background: transparent; padding: 6px 14px; font-size: .875rem; color: var(--hp-ink-2); cursor: pointer; }
.hp-seg button.on { background: var(--hp-accent); color: #fff; }
.hp-dd { position: relative; }
.hp-dd-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 300px; max-height: 60vh; overflow: auto;
  background: var(--hp-card); border: 1px solid var(--hp-line); border-radius: var(--hp-radius); box-shadow: var(--hp-shadow); padding: 6px; }
.hp-dd-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: .9rem; }
.hp-dd-item:hover { background: var(--hp-accent-50); }
.hp-dd-all { border-bottom: 1px solid var(--hp-line); border-radius: 8px 8px 0 0; margin-bottom: 4px; font-weight: 600; }
.hp-dd-foot { display: flex; justify-content: flex-end; padding: 6px 4px 2px; }
.hp-drawwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hp-drawtable { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .9rem; }
.hp-drawtable th, .hp-drawtable td { padding: 7px 12px; border-bottom: 1px solid var(--hp-line); vertical-align: top; text-align: left; white-space: nowrap; }
.hp-drawtable thead th { position: sticky; top: 0; background: var(--hp-card); z-index: 2; font-weight: 600; }
.hp-drawtable .hp-sticky { position: sticky; left: 0; background: var(--hp-card); z-index: 1; min-width: 180px; max-width: 240px; white-space: normal; }
.hp-drawtable thead .hp-sticky { z-index: 3; }
.hp-drawtable .hp-drawcat td { background: var(--hp-accent-50); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hp-accent-700); }
.hp-drawtable td.hp-out { background: var(--hp-high-50); }
.hp-drawtable td.hp-out .v { color: var(--hp-high); font-weight: 700; }
.hp-drawtable .hp-flag { display: inline-block; margin-left: 4px; font-size: .7rem; font-weight: 700; color: var(--hp-high); }
.hp-drawtable a { color: inherit; text-decoration: none; }
.hp-drawtable a:hover { color: var(--hp-accent); text-decoration: underline; }
@media (max-width: 640px) { .hp-drawtable .hp-sticky { min-width: 130px; max-width: 150px; } .hp-dd-panel { min-width: 260px; } }

/* Immunizations */
.hp-vax-alerts { border-left: 4px solid var(--hp-high); }
.hp-vax-item { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hp-vax-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.hp-vax-ico svg { width: 18px; height: 18px; }
.hp-vax-ico.alert { background: var(--hp-high-50); color: var(--hp-high); }
.hp-vax-ico.rec { background: var(--hp-accent-50); color: var(--hp-accent-700); }
.hp-vax-ico.discuss { background: var(--hp-ai-50); color: var(--hp-ai); }
.hp-vax-group { padding: 6px 0 2px; border-top: 1px solid var(--hp-line); }
.hp-vax-group:first-of-type { border-top: 0; }
.hp-vax-group h3 { font-size: 1rem; margin: 6px 0 4px; }
.hp-dismiss { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hp-dismiss select { width: auto; }

.hp-proc-text { margin-top: 4px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hp-home-vax { border-left: 4px solid var(--hp-high); }
.hp-home-vax.calm { border-left-color: var(--hp-accent); }

.hp-click { cursor: pointer; }
.hp-stat.hp-click:hover, .hp-stat.hp-click.on { border-color: var(--hp-accent); box-shadow: 0 0 0 2px var(--hp-accent-100); }
tr.hp-click:hover td { background: var(--hp-accent-50); }

/* Camera capture only where the main pointer is a finger (phones, tablets) */
@media (pointer: fine) { .hp-touch-only { display: none !important; } }

/* Strip on every page while viewing someone else's record (avoids logging or uploading for the wrong person). */
.hp-viewing-other {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; padding: 8px 12px; border-radius: 10px;
    background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; font-size: .92rem;
}
.hp-viewing-other svg { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .hp-viewing-other { background: #422006; color: #fde68a; border-color: #b45309; } }

/* Take: quantity picker (starts at the person's usual amount). */
.hp-take { background: var(--hp-surface-2, #f8fafc); border-radius: 12px; padding: 12px; }
.hp-take-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.hp-round { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #e2e8f0; color: #0f172a; font-size: 1.7rem; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center; }
.hp-round:disabled { opacity: .35; }
.hp-take-qty { font-size: 1.3rem; font-weight: 700; min-width: 130px; text-align: center; }
@media (prefers-color-scheme: dark) { .hp-take { background: #111a2e; } .hp-round { background: #1e293b; color: #e2e8f0; } }
.hp-danger-zone { border-color: #fecaca; }

/* Tag setup wizard: one big step per screen. */
.hp-wiz { max-width: 520px; margin: 0 auto; min-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.hp-wiz-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hp-wiz-dots { display: flex; gap: 6px; }
.hp-wiz-dots span { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.hp-wiz-dots span.on { background: var(--hp-accent, #0d9488); }
.hp-wiz-body { flex: 1; display: flex; flex-direction: column; }
.hp-wiz-body h1 { font-size: 1.6rem; font-weight: 700; margin: 8px 0 10px; }
.hp-wiz-body p { font-size: 1.05rem; }
.hp-wiz-art { width: min(62vw, 240px); margin: 10px auto 6px; color: var(--hp-text, #0f172a); }
.hp-wiz-art.small { width: min(44vw, 160px); }
.hp-wiz-art svg { width: 100%; height: auto; display: block; }
.hp-wiz-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 8px 0 10px; }
.hp-wiz-person { display: flex; align-items: center; gap: 10px; padding: 14px; border: 2px solid #cbd5e1; border-radius: 14px; background: transparent;
    font-size: 1.1rem; font-weight: 600; color: inherit; text-align: left; }
.hp-wiz-person.on { border-color: var(--hp-accent, #0d9488); background: rgba(13, 148, 136, .08); }
.hp-wiz-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; display: inline-flex; align-items: center; justify-content: center; color: #0f172a; }
.hp-wiz-check { margin-left: auto; color: var(--hp-accent, #0d9488); visibility: hidden; }
.hp-wiz-person.on .hp-wiz-check { visibility: visible; }
.hp-wiz-steps { font-size: 1.05rem; padding-left: 1.3rem; } .hp-wiz-steps li { margin-bottom: 10px; }
.hp-wiz-done { width: 140px; height: 140px; margin: 30px auto 10px; border-radius: 50%; background: var(--hp-accent, #0d9488); color: #fff;
    font-size: 5rem; line-height: 140px; animation: hp-pop .45s ease-out; }
@keyframes hp-pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
.hp-wiz-sticker { animation: hp-slide 2.4s ease-in-out infinite; }
.hp-wiz-sticker.up { animation-name: hp-slide-up; }
@keyframes hp-slide { 0%, 15% { transform: translate(70px, 60px); opacity: 0; } 45%, 85% { transform: translate(0, 0); opacity: 1; } 100% { opacity: 0; } }
@keyframes hp-slide-up { 0%, 15% { transform: translate(0, -20px); opacity: 0; } 45%, 85% { transform: translate(0, 12px); opacity: 1; } 100% { opacity: 0; } }
.hp-wiz-glow { opacity: 0; transform-origin: 110px 110px; }
.pulse .hp-wiz-glow { animation: hp-glow 1.4s ease-out infinite; }
.pulse .hp-wiz-glow.d2 { animation-delay: .5s; }
@keyframes hp-glow { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.2); } }
@media (prefers-color-scheme: dark) { .hp-wiz-art { color: #e2e8f0; } .hp-wiz-avatar { background: #1e293b; color: #e2e8f0; } }
@media (prefers-reduced-motion: reduce) { .hp-wiz-sticker, .pulse .hp-wiz-glow, .hp-wiz-done { animation: none; opacity: 1; } }
.hp-take-each { display: block; font-size: .8rem; font-weight: 400; color: var(--hp-muted, #64748b); }
.hp-today-sub { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--hp-muted, #64748b); margin: 10px 0 2px; }
.hp-table-wrap { overflow-x: auto; max-height: 520px; overflow-y: auto; }
.hp-dose-table { font-size: .85rem; margin: 0; }
.hp-dose-table th { position: sticky; top: 0; background: var(--hp-card, #fff); white-space: nowrap; }
.hp-dose-table td { white-space: nowrap; }
.hp-dose-table td.miss { color: #b91c1c; } .hp-dose-table td.skip { color: var(--hp-muted, #64748b); }
.hp-weeks { display: flex; align-items: flex-end; gap: 8px; }
.hp-week { display: flex; flex-direction: column; align-items: center; font-size: .72rem; color: var(--hp-muted); min-width: 28px; }
.hp-week .bar { width: 18px; border-radius: 4px 4px 0 0; background: var(--hp-accent); }
.hp-week .n { color: var(--hp-ink); font-weight: 600; }

/* Add medication: "How do you take it?" */
.hp-mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hp-mode { text-align: left; padding: 14px; border: 2px solid var(--hp-line); border-radius: 12px; background: transparent; color: inherit; }
.hp-mode b { display: block; font-size: 1.05rem; }
.hp-mode span { font-size: .85rem; color: var(--hp-muted); }
.hp-mode.on { border-color: var(--hp-accent); background: rgba(15, 118, 110, .07); }
.hp-cat-head { flex-wrap: wrap; gap: 6px; }
.hp-gentle { background: #f1f5f9; border-radius: 10px; padding: 10px 14px; font-size: .92rem; color: #334155; }
@media (prefers-color-scheme: dark) { .hp-gentle { background: #1e293b; color: #e2e8f0; } }

/* "Scan a code": full-screen camera */
.hp-scan { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; flex-direction: column; }
.hp-scan video { flex: 1; width: 100%; object-fit: cover; }
.hp-scan-frame { position: absolute; top: 50%; left: 50%; width: min(64vw, 280px); height: min(64vw, 280px); transform: translate(-50%, -60%);
    border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
.hp-scan-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; background: rgba(0, 0, 0, .55); font-size: 1rem; }

/* Codes on a medicine: one icon per QR label / NFC sticker (tap for details / unassign). */
.hp-code-icons { display: flex; flex-wrap: wrap; gap: 12px; }
.hp-code-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border: 1px solid var(--hp-line);
    border-radius: 12px; color: var(--hp-ink); text-decoration: none; min-width: 72px; }
.hp-code-icon:hover { border-color: var(--hp-accent); color: var(--hp-accent); }
.hp-code-icon span { font-size: .78rem; font-weight: 600; }
.hp-code-svg { width: 34px; height: 34px; }
.hp-code-svg.big { width: 72px; height: 72px; color: var(--hp-accent); }

/* "Add a code" how-to: big pictures, short steps */
.hp-howto { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--hp-line); }
.hp-howto h2 { font-size: 1.15rem; margin: 0 0 6px; }
.hp-howto ol { margin: 0; padding-left: 1.2rem; } .hp-howto li { margin-bottom: 4px; }
.hp-howto-art svg { width: 100%; height: auto; color: var(--hp-ink); }
@media (max-width: 520px) { .hp-howto { grid-template-columns: 1fr; } .hp-howto-art { max-width: 220px; } }

/* Bottles on a medicine */
.hp-bottle { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border: 1px solid var(--hp-line); border-radius: 12px;
    color: var(--hp-ink); text-decoration: none; min-width: 110px; }
.hp-bottle:hover { border-color: var(--hp-accent); }
.hp-bottle-name { font-weight: 600; }
.hp-bottle-codes { display: flex; gap: 6px; align-items: center; min-height: 24px; }
.hp-code-svg.small { width: 22px; height: 22px; }

/* Measurements page */
.hp-risk-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.hp-risk-pair > section { min-width: 0; margin-bottom: 12px; }
@media (max-width: 760px) { .hp-risk-pair { grid-template-columns: 1fr; } }
.hp-risk-outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hp-risk-output { border: 1px solid var(--hp-border, #e2e8f0); border-radius: 10px; padding: 10px 12px; }
.hp-risk-output.primary { border-color: var(--hp-accent, #0F766E); }
.hp-risk-output .hp-risk-main { font-size: 1.7rem; }
.hp-risk-tiles .hp-measure .lbl { text-transform: none; letter-spacing: 0; }
.hp-risk-tiles .hp-measure { min-width: 0; }
.hp-risk-tiles .hp-chip, .hp-meta .hp-chip { white-space: normal; text-align: left; max-width: 100%; }
.hp-risk-tiles .val small { font-size: .8rem; margin-left: 4px; font-weight: 500; }
.hp-risk-main { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.hp-risk-main small { font-size: 1rem; margin-left: 2px; }
.hp-measure-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 520px) { .hp-measure-tiles { grid-template-columns: 1fr 1fr; gap: 10px; } .hp-measure { padding: 12px; } .hp-measure .val { font-size: 1.35rem; } }
.hp-measure { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--hp-card, #fff); border: 1px solid var(--hp-line, #e5e7eb);
    border-radius: 14px; color: var(--hp-ink, #0f172a); text-decoration: none; }
.hp-measure:hover { border-color: var(--hp-accent, #0F766E); }
.hp-measure .lbl { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--hp-muted, #64748b); }
.hp-measure .val { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.hp-measure .val small { font-size: .8rem; font-weight: 500; color: var(--hp-muted, #64748b); }
.hp-measure .sub { font-size: .8rem; color: var(--hp-muted, #64748b); }
.hp-ok-text { color: var(--hp-ok, #15803d); }
.hp-spark { width: 100%; height: 30px; margin-top: 6px; }
.hp-spark polyline { fill: none; stroke: var(--hp-accent, #0F766E); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.hp-measure-link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }

/* numbered how-to steps */
.hp-steps { margin: 0 0 12px; padding-left: 1.3rem; font-size: .92rem; }
.hp-steps li { margin: 3px 0; }

/* Reading source: icon + short label on phones, full name on wider screens */
.hp-src { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px 1px 5px; border-radius: 999px; background: var(--hp-chip, #f1f5f9);
    color: var(--hp-muted, #475569); font-size: .74rem; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.hp-src-ico { width: 14px; height: 14px; flex: none; }
.hp-src-long { display: none; }
@media (min-width: 760px) {
    .hp-src:not(.icon) .hp-src-short { display: none; }
    .hp-src .hp-src-long { display: inline; white-space: normal; }
}
.hp-src.full .hp-src-short { display: none; }
.hp-src.full .hp-src-long { display: inline; white-space: normal; }
.hp-src-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .74rem; color: var(--hp-muted, #64748b); margin-top: 6px; }
.hp-src-legend span { display: inline-flex; align-items: center; gap: 3px; }
.hp-src-legend .hp-src-ico { width: 13px; height: 13px; }
tr.hp-tap { cursor: pointer; }
tr.hp-tap:hover td { background: var(--hp-hover, #f8fafc); }

/* Bottom sheet with a reading's details */
.hp-sheet-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 1050; display: flex; align-items: flex-end; justify-content: center; }
.hp-sheet { background: var(--hp-card, #fff); width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 30px rgba(15, 23, 42, .18); max-height: 80vh; overflow: auto; }
@media (min-width: 760px) { .hp-sheet-back { align-items: center; } .hp-sheet { border-radius: 16px; } }
.hp-sheet h3 { font-size: 1.15rem; margin: 0 0 4px; }
.hp-sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: .9rem; }
.hp-sheet dt { color: var(--hp-muted, #64748b); font-weight: 500; }
.hp-sheet dd { margin: 0; }

.hp-src.icon-only, .hp-measure .hp-src { padding: 1px 5px; }
.hp-readings td { vertical-align: middle; }
@media (max-width: 759px) { .hp-readings th, .hp-readings td { padding: 6px 6px; } }

/* My doctors */
.hp-doctors { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.hp-doctor { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: var(--hp-card, #fff); border: 1px solid var(--hp-line, #e5e7eb);
    border-radius: 14px; color: inherit; text-decoration: none; }
.hp-doctor:hover { border-color: var(--hp-accent, #0F766E); }
.hp-doc-avatar { width: 42px; height: 42px; border-radius: 50%; background: #CCFBF1; color: var(--hp-accent, #0F766E); display: flex; align-items: center;
    justify-content: center; font-weight: 700; flex: none; }
.hp-doc-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hp-doc-loc { padding: 10px 0; border-top: 1px solid var(--hp-line, #e5e7eb); }
.hp-doc-loc:first-of-type { border-top: 0; padding-top: 0; }
.hp-doc-next { border-left: 4px solid var(--hp-accent, #0F766E); }

.hp-section-title { font-size: 1rem; font-weight: 700; color: var(--hp-muted, #475569); margin: 6px 0 10px; text-transform: uppercase; letter-spacing: .03em; }

/* Women's health */
.hp-wh-big { font-size: 1.35rem; font-weight: 700; }
.hp-wh-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hp-wh-wd { text-align: center; font-size: .72rem; color: var(--hp-muted, #64748b); font-weight: 600; text-transform: uppercase; }
.hp-wh-day { position: relative; aspect-ratio: 1; border: 1px solid transparent; border-radius: 50%; background: none; font-size: .9rem; display: flex;
    align-items: center; justify-content: center; color: inherit; padding: 0; }
.hp-wh-day.period { background: #e11d48; color: #fff; }
.hp-wh-day.spot { background: #fecdd3; }
.hp-wh-day.predicted { border: 2px dashed #e11d48; }
.hp-wh-day.fertile { background: #dbeafe; }
.hp-wh-day.fertile.ov { background: #93c5fd; }
.hp-wh-day.today { box-shadow: 0 0 0 2px var(--hp-accent, #0F766E) inset; font-weight: 700; }
.hp-wh-day.sel { outline: 2px solid var(--hp-ink, #0f172a); outline-offset: 1px; }
.hp-wh-day.future:not(.predicted):not(.fertile) { color: var(--hp-muted, #94a3b8); }
.hp-wh-day .dot { position: absolute; bottom: 12%; width: 5px; height: 5px; border-radius: 50%; background: #7c3aed; }
.hp-wh-day.period .dot { background: #fff; }
.hp-wh-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .75rem; color: var(--hp-muted, #64748b); margin-top: 8px; }
.hp-wh-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; margin-right: 3px; }
.hp-wh-legend .sw.period { background: #e11d48; } .hp-wh-legend .sw.predicted { border: 2px dashed #e11d48; } .hp-wh-legend .sw.fertile { background: #dbeafe; }
.hp-wh-legend .sw-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #7c3aed; margin-right: 3px; }
@media print {
    .hp-top, .hp-side, .hp-tabs, .hp-no-print, .hp-viewing { display: none !important; }
    .hp-wh-report .hp-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---------- Oura ring: sleep timeline, night cards, ring tiles ---------- */
.hp-ring-src { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--hp-muted, #64748b); margin-top: auto; padding-top: 6px; }
.hp-ring-src svg { width: 13px; height: 13px; }
.hp-measure.waiting .val { font-size: 1.05rem; color: var(--hp-muted, #64748b); font-weight: 600; }
.hp-measure.stale { opacity: .62; }
.hp-measure .hp-chip { align-self: flex-start; margin-top: 3px; }
.hp-ring-note { font-size: .82rem; color: var(--hp-muted, #64748b); margin: -4px 0 10px; }

.hp-tl { margin-top: 6px; }
.hp-tl-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: stretch; margin-bottom: 6px; }
@media (max-width: 520px) { .hp-tl-row { grid-template-columns: 70px 1fr; gap: 6px; } .hp-tl-lbl { font-size: .66rem !important; } }
.hp-tl-lbl { font-size: .72rem; color: var(--hp-muted, #64748b); line-height: 1.25; }
.hp-tl-lbl b { display: block; color: var(--hp-ink, #0f172a); font-size: .78rem; margin-bottom: 1px; }
.hp-tl-lane { height: 28px; line-height: 28px; text-align: right; padding-right: 2px; }
.hp-tl-plot { position: relative; min-width: 0; }
.hp-tl-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hp-tl-axis .hp-tl-plot { height: 18px; }
.hp-tl-axis .hp-tl-plot span { position: absolute; top: 0; transform: translateX(-50%); font-size: .7rem; color: var(--hp-muted, #64748b); white-space: nowrap; }
.hp-tl-grid { stroke: rgba(148, 163, 184, .25); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hp-tl-lanebg { fill: rgba(148, 163, 184, .08); }
.hp-tl-wake { stroke: #c2410c; stroke-width: 1; vector-effect: non-scaling-stroke; }
.hp-tl-gotup { stroke: #c2410c; stroke-width: 2; vector-effect: non-scaling-stroke; fill: #ea580c !important; }
.hp-tl-line { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.hp-tl-line.hr { stroke: #dc2626; } .hp-tl-dot.hr { fill: #dc2626; }
.hp-tl-line.spo2 { stroke: #0284c7; } .hp-tl-dot.spo2 { fill: #0284c7; }
.hp-tl-line.temp { stroke: #d97706; }
/* room sensor (sql/94): temperature line + humidity shading */
.hp-tl-line.room { stroke: #0f766e; } .hp-tl-room-rh { fill: rgba(56, 189, 248, .22); stroke: none; }
.hp-tl-roomkey { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: #0f766e; vertical-align: middle; margin-right: 4px; }
.hp-tl-roomkey.rh { height: 10px; background: rgba(56, 189, 248, .35); }
.hp-room-now { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.hp-room-now .big { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hp-tl-hrband { fill: rgba(220, 38, 38, .14); }
.hp-tl-hrv { fill: #7c3aed; opacity: .75; }
.hp-tl-move { fill: #64748b; }
.hp-tl-move.quiet { fill: #cbd5e1; background: #cbd5e1; } .hp-tl-move.some { fill: #94a3b8; background: #94a3b8; } .hp-tl-move.turn { fill: #475569; background: #475569; }
.hp-tl-snore { fill: #a855f7; background: #a855f7; } .hp-tl-snore-muted { fill: #cbd5e1; background: #cbd5e1; } .hp-tl-snore-tv { fill: #f59e0b; background: #f59e0b; opacity: .55; }   /* room-microphone snoring (sql/93) */
.hp-tl-dip rect { fill: #f59e0b; } .hp-tl-dip.d4 rect { fill: #b45309; } .hp-tl-dip rect.surge { fill: #dc2626; } .hp-tl-dip rect.hit { fill: transparent; }
.hp-tl-dip:hover rect:not(.hit) { fill: #7c2d12; } .hp-tl-dip:hover rect.hit { fill: rgba(180, 83, 9, .12); }
.hp-tl-dipkey.d3 { background: #f59e0b; } .hp-tl-dipkey.d4 { background: #b45309; } .hp-tl-dipkey.surge { background: #dc2626; }
.hp-tl-wakeline { stroke: #c2410c; stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: .55; pointer-events: none; }
.hp-tl-wakeline.up { stroke-width: 1.5; opacity: .9; }
.hp-tl-wakeflag { position: absolute; bottom: 1px; transform: translateX(3px); font-size: .64rem; line-height: 1.2; color: #c2410c; white-space: nowrap;
    background: var(--hp-card, #fff); border-radius: 3px; padding: 0 3px; pointer-events: auto; }
.hp-tl-wakeflag.up { font-weight: 700; }
.hp-tl-wakeflag.left { transform: translateX(calc(-100% - 3px)); }
.hp-tl-ref { stroke: #0284c7; stroke-dasharray: 5 4; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .6; }
.hp-tl-reflbl { position: absolute; right: 2px; transform: translateY(-100%); font-size: .62rem; color: #0284c7; }
.hp-tl-hover { fill: transparent; }
.hp-tl-hover:hover { fill: rgba(15, 118, 110, .10); }
.hp-tl-state.worn { fill: #5eead4; background: #5eead4; }
.hp-tl-state.charging { fill: #fbbf24; background: #fbbf24; }
.hp-tl-state.off { fill: #cbd5e1; background: #cbd5e1; }
.hp-tl-none { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .75rem; color: var(--hp-muted, #64748b);
    pointer-events: none; font-style: italic; }
.hp-tl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .74rem; color: var(--hp-muted, #64748b); margin-top: 8px; }
.hp-tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hp-tl-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }

.hp-nights { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.hp-night { display: block; padding: 14px 16px; background: var(--hp-card, #fff); border: 1px solid var(--hp-line, #e5e7eb); border-radius: 14px;
    color: var(--hp-ink, #0f172a); text-decoration: none; }
a.hp-night:hover { border-color: var(--hp-accent, #0F766E); text-decoration: none; color: inherit; }
.hp-night-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.hp-night-head b { font-size: 1.02rem; }
.hp-night-strip { display: block; width: 100%; height: 26px; margin: 8px 0 6px; border-radius: 4px; background: rgba(148, 163, 184, .10); }
.hp-night-big { font-size: 1.15rem; font-weight: 700; }
.hp-night-line { font-size: .85rem; color: var(--hp-ink-2, #334155); }
.hp-night.skeleton { border-style: dashed; color: var(--hp-muted, #64748b); }
.hp-night.skeleton .hp-night-strip { background: repeating-linear-gradient(90deg, rgba(148,163,184,.18) 0 40px, rgba(148,163,184,.08) 40px 80px); }
/* naps: small cards under the night they belong to (same day), on the night page and in the Naps view */
.hp-day { display: flex; flex-direction: column; gap: 6px; }
.hp-naps { display: flex; flex-wrap: wrap; gap: 6px 8px; padding-left: 18px; position: relative; }
.hp-naps::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 8px; border-left: 2px solid var(--hp-line, #e5e7eb); }
.hp-nap { display: flex; flex-direction: column; gap: 2px; min-width: 150px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--hp-line, #e5e7eb);
    border-radius: 12px; background: var(--hp-card, #fff); color: var(--hp-ink, #0f172a); text-decoration: none; font-size: .85rem; }
a.hp-nap:hover { border-color: var(--hp-accent, #0F766E); text-decoration: none; color: inherit; }
.hp-nap .hp-nap-t { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.hp-nap .hp-night-strip { height: 12px; margin: 4px 0 2px; }
.hp-nap-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 14px; }
.hp-nap-stats div { padding: 4px 0; border-top: 1px solid var(--hp-line, #e5e7eb); }
.hp-nap-stats .k { font-size: .72rem; color: var(--hp-muted, #64748b); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hp-nap-stats .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.hp-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; }
.hp-totals div { padding: 6px 0; border-top: 1px solid var(--hp-line, #e5e7eb); }
.hp-totals .k { font-size: .74rem; color: var(--hp-muted, #64748b); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hp-totals .v { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .hp-tl-lbl b { color: #e2e8f0; } }

/* ---------- Breathing disturbance page (ring estimates) ---------- */
.hp-bd-note { background: rgba(100, 116, 139, .08); border: 1px solid var(--hp-line, #e2e8f0); border-left: 4px solid #64748B; border-radius: 10px;
    padding: 9px 12px; font-size: .86rem; color: var(--hp-ink-2, #334155); margin: -6px 0 16px; }
.hp-bd-hero { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; margin-top: 10px; }
.hp-bd-big { font-size: 2.4rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hp-bd-big small { font-size: .95rem; font-weight: 500; color: var(--hp-muted, #64748b); }
.hp-bd-hero-side { padding-left: 18px; border-left: 1px solid var(--hp-line, #e2e8f0); }
.hp-bd-hero-side .k { font-size: .74rem; color: var(--hp-muted, #64748b); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hp-bd-hero-side .v { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hp-bd-hero-side .v small { font-size: .85rem; font-weight: 500; color: var(--hp-muted, #64748b); }
@media (max-width: 520px) { .hp-bd-hero-side { padding-left: 0; border-left: 0; } .hp-bd-big { font-size: 2rem; } }

.hp-chip.hp-odi.normal { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.hp-chip.hp-odi.mild { background: #FEFCE8; color: #854D0E; border-color: #FDE68A; }
.hp-chip.hp-odi.moderate { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }
.hp-chip.hp-odi.severe { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.hp-readings .hp-chip.hp-odi { white-space: nowrap; font-variant-numeric: tabular-nums; }

.hp-bd-scale { position: relative; padding: 26px 0 26px; margin: 4px 6px 0; }
.hp-bd-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; }
.hp-bd-bar .seg { flex: 1; display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 700; min-width: 0; }
.hp-bd-bar .seg span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.hp-bd-bar .seg + .seg { border-left: 2px solid var(--hp-card, #fff); }
.hp-bd-bar .normal, .hp-bd-swatch.normal { background: #16A34A; color: #fff; }
.hp-bd-bar .mild, .hp-bd-swatch.mild { background: #FACC15; color: #422006; }
.hp-bd-bar .moderate, .hp-bd-swatch.moderate { background: #EA580C; color: #fff; }
.hp-bd-bar .severe, .hp-bd-swatch.severe { background: #DC2626; color: #fff; }
.hp-bd-ticks { position: relative; height: 16px; margin-top: 3px; }
.hp-bd-ticks span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--hp-muted, #64748b); font-variant-numeric: tabular-nums; }
.hp-bd-ticks span:first-child { transform: none; } .hp-bd-ticks span:last-child { transform: translateX(-100%); }
.hp-bd-mark { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; font-size: .74rem;
    font-weight: 700; color: var(--hp-ink, #0f172a); white-space: nowrap; line-height: 1.1; pointer-events: none; }
.hp-bd-mark.top { top: 0; }
.hp-bd-mark.bottom { bottom: -2px; color: var(--hp-accent-700, #115E59); }
.hp-bd-mark i { font-style: normal; font-size: .8rem; }
.hp-bd-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }
.hp-bd-defs { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: .92rem; }
.hp-bd-defs dt { font-weight: 700; color: var(--hp-ink-2, #334155); }
.hp-bd-defs dd { margin: 0; }
@media (max-width: 640px) { .hp-bd-defs { grid-template-columns: 1fr; gap: 2px; } .hp-bd-defs dd { margin-bottom: 8px; } }
.hp-bd-list { margin: 0 0 8px; padding-left: 20px; font-size: .92rem; }
.hp-bd-list li { margin-bottom: 4px; }
tr.hp-bd-sel td { background: rgba(15, 118, 110, .10); }
.hp-bd-disclaimer { border: 1px solid rgba(100, 116, 139, .35); border-left: 5px solid #64748B; background: rgba(100, 116, 139, .06); }
.hp-measure.hp-measure-split { position: relative; }
.hp-measure-split .hp-stretch, .hp-measure-split .hp-stretch:hover { text-decoration: none; color: var(--hp-muted, #64748b); }
.hp-measure-split .hp-stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.hp-measure-split .hp-tile-more { position: relative; z-index: 2; font-size: .74rem; font-weight: 600; align-self: flex-start; margin-top: 4px; }
/* the portal theme is light-only; these use translucent fills so they also sit well on a dark card if one is added */

/* ---------- Night timeline rows as links + one measurement of a night (/sleep/{date}/{metric}) ---------- */
a.hp-tl-go { text-decoration: none; color: var(--hp-muted, #64748b); border-radius: 6px; }
a.hp-tl-go b::after { content: " ›"; color: var(--hp-accent, #0F766E); }
a.hp-tl-go:hover { background: rgba(15, 118, 110, .06); color: var(--hp-ink-2, #334155); }
a.hp-tl-go:hover b { color: var(--hp-accent, #0F766E); text-decoration: underline; }
.hp-tl-plot a { cursor: pointer; }
a.hp-tl-breath { display: flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 6px; background: rgba(8, 145, 178, .07);
    font-size: .74rem; color: #0e7490; text-decoration: none; }
a.hp-tl-breath:hover { background: rgba(8, 145, 178, .14); color: #155e75; }
.hp-sm-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 10px 0 2px; scrollbar-width: thin; }
.hp-sm-tabs .hp-pill { white-space: nowrap; text-decoration: none; flex: 0 0 auto; }
a.hp-pill { text-decoration: none; display: inline-block; }
.hp-sm-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px 10px; margin-bottom: 10px; border-radius: 8px;
    background: rgba(15, 118, 110, .08); color: var(--hp-accent-700, #115E59); font-size: .85rem; }
.hp-sm-pick a { font-size: .8rem; }
.hp-sm-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--hp-muted, #64748b); margin-top: 8px; }
.hp-sm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hp-sm-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.hp-sm-legend i.ln { height: 3px; border-radius: 0; }
.hp-sm-legend i.dash { height: 0; border-top: 2px dashed currentColor; background: none !important; }

/* ---- Weight & body: the weight tile's body-composition line and the stacked day timeline (BodyTimeline) ---- */
.hp-body-line { display: flex; flex-wrap: wrap; gap: 1px 10px; margin-top: 6px; font-size: .74rem; line-height: 1.35; color: var(--hp-muted, #64748b); }
.hp-body-line-h { width: 100%; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.hp-body-line b { color: var(--hp-ink-2, #334155); font-weight: 600; }
.hp-bt-band.low { fill: rgba(59, 130, 246, .08); } .hp-bt-band.ok { fill: rgba(16, 185, 129, .11); }
.hp-bt-band.high { fill: rgba(245, 158, 11, .12); } .hp-bt-band.veryhigh { fill: rgba(239, 68, 68, .10); }
.hp-bt-bandlbl { position: absolute; right: 3px; margin-top: 1px; font-size: .6rem; line-height: 1; pointer-events: none; white-space: nowrap; }
.hp-bt-bandlbl.low { color: #1d4ed8; } .hp-bt-bandlbl.ok { color: #047857; } .hp-bt-bandlbl.high { color: #b45309; } .hp-bt-bandlbl.veryhigh { color: #b91c1c; }
.hp-bt-ylbl { position: absolute; left: 3px; font-size: .6rem; line-height: 1; color: var(--hp-muted, #64748b); pointer-events: none; }
.hp-bt-ylbl.top { top: 1px; } .hp-bt-ylbl.bot { bottom: 1px; }
.hp-bt-line { fill: none; stroke: #0F766E; stroke-width: 1.4; stroke-opacity: .55; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.hp-bt-dot { fill: none; stroke-width: 7px; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.hp-bt-dot.home { stroke: #0F766E; } .hp-bt-dot.home.dressed { stroke-opacity: .45; }
.hp-bt-dot.clinic { stroke: #7c3aed; stroke-linecap: square; stroke-width: 6.5px; }
.hp-bt-latest { color: var(--hp-ink, #0f172a); font-weight: 600; }
.hp-bt-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.hp-bt-key.home { background: #0F766E; border-radius: 50%; } .hp-bt-key.clinic { background: #7c3aed; border-radius: 1px; }
.hp-bt-key.low { background: rgba(59, 130, 246, .35); } .hp-bt-key.ok { background: rgba(16, 185, 129, .4); }
.hp-bt-key.high { background: rgba(245, 158, 11, .45); } .hp-bt-key.veryhigh { background: rgba(239, 68, 68, .4); }
.hp-band-txt.low { color: #1d4ed8; } .hp-band-txt.ok { color: #047857; } .hp-band-txt.high { color: #b45309; } .hp-band-txt.veryhigh { color: #b91c1c; }
.hp-band-list { list-style: none; padding-left: 0; margin-bottom: 4px; }
.hp-band-list li { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.hp-body-sum td, .hp-body-sum th { vertical-align: top; }
@media (max-width: 520px) { .hp-body-sum { font-size: .82rem; } .hp-bt-bandlbl { font-size: .55rem; } }

/* ---- ring "About this measure" blocks (RingAbout.razor, ranges in Services/RingRanges.cs) ---- */
.hp-ra h2 { margin-bottom: 6px; }
details.hp-ra > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; list-style: revert; }
details.hp-ra > summary .hp-ra-sum-t { font-weight: 700; font-size: 1.05rem; }
details.hp-ra > summary .hp-ra-sum-v { font-size: .88rem; color: var(--hp-muted, #64748b); }
details.hp-ra[open] > summary { margin-bottom: 8px; }
.hp-ra-now { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .92rem; margin: 2px 0 4px; }
.hp-ra-now .k { color: var(--hp-muted, #64748b); font-size: .8rem; }
.hp-ra-now b { font-variant-numeric: tabular-nums; }
.hp-ra-scale.soft .hp-bd-bar { opacity: .72; }
.hp-bd-bar .hp-ra-seg { flex: 0 0 auto; }
.hp-ra-seg.good { background: #16A34A; color: #fff; }
.hp-ra-seg.typical { background: #5FB49C; color: #fff; }
.hp-ra-seg.fair { background: #FDE68A; color: #713F12; }
.hp-ra-seg.watch { background: #F59E0B; color: #422006; }
.hp-ra-seg.notable { background: #EA580C; color: #fff; }
.hp-ra-seg.low { background: #93C5FD; color: #1E3A8A; }
.hp-chip.hp-ra-chip { white-space: nowrap; }
.hp-chip.hp-ra-chip.good, .hp-chip.hp-ra-chip.normal { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.hp-chip.hp-ra-chip.typical { background: #ECFDF5; color: #0F766E; border-color: #A7F3D0; }
.hp-chip.hp-ra-chip.fair, .hp-chip.hp-ra-chip.mild { background: #FEFCE8; color: #854D0E; border-color: #FDE68A; }
.hp-chip.hp-ra-chip.watch, .hp-chip.hp-ra-chip.moderate { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }
.hp-chip.hp-ra-chip.notable, .hp-chip.hp-ra-chip.severe { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.hp-chip.hp-ra-chip.low { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
@media (prefers-color-scheme: dark) {
    .hp-chip.hp-ra-chip { background: rgba(148, 163, 184, .14) !important; color: #e2e8f0 !important; border-color: rgba(148, 163, 184, .35) !important; }
}
.hp-ra-brks { margin: 0 6px 4px; display: grid; gap: 4px; }
.hp-ra-brk .trk { position: relative; height: 9px; }
.hp-ra-brk .trk i { position: absolute; top: 0; height: 8px; border: 2px solid; border-top: 0; border-radius: 0 0 4px 4px; }
.hp-ra-brk .trk b { position: absolute; top: -1px; width: 2px; height: 10px; transform: translateX(-1px); background: #64748B; }
.hp-ra-brk.you .trk i { border-color: #0F766E; background: rgba(15, 118, 110, .10); }
.hp-ra-brk.lab .trk i { border-color: #94A3B8; border-style: dashed; }
.hp-ra-brk span { display: block; font-size: .7rem; color: var(--hp-muted, #64748b); }
.hp-ra-brk.you span { color: var(--hp-accent-700, #115E59); font-weight: 600; }
.hp-ra-src summary { cursor: pointer; color: var(--hp-muted, #64748b); }
.hp-ra-src ul { padding-left: 18px; margin-top: 4px; }
.hp-ra-src li { margin-bottom: 3px; }
.hp-ra-table td:first-child { white-space: nowrap; }
.hp-measure .hp-tile-q { position: absolute; top: 8px; right: 8px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: .78rem; font-weight: 700; text-decoration: none; color: var(--hp-muted, #64748b); border: 1px solid var(--hp-line, #e2e8f0);
    background: var(--hp-card, #fff); }
.hp-measure .hp-tile-q:hover, .hp-measure .hp-tile-q:focus-visible { color: var(--hp-accent-700, #115E59); border-color: var(--hp-accent-700, #115E59); }
.hp-measure-split .lbl { padding-right: 26px; }
.hp-ra-sub { font-size: .8rem; font-weight: 500; color: var(--hp-muted, #64748b); }
details.hp-ra > summary { list-style: none; }
details.hp-ra > summary::-webkit-details-marker { display: none; }
details.hp-ra > summary::before { content: "▸"; color: var(--hp-muted, #64748b); font-size: .9rem; width: 12px; }
details.hp-ra[open] > summary::before { content: "▾"; }

/* ---- Notifications: recent emails open to show the email ---- */
.hp-email-toggle { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hp-email-toggle:hover { color: var(--hp-accent); text-decoration: underline; }
.hp-email-toggle:focus-visible { outline: 2px solid var(--hp-accent); outline-offset: 2px; border-radius: 4px; }
.hp-email-caret { display: inline-block; width: 1em; color: var(--hp-muted); }
.hp-email-detail td { background: var(--hp-accent-50); padding: 12px 14px; }
.hp-email-body { margin: 8px 0; font-size: .92rem; }
.hp-email-body p { margin: 0 0 8px; }
.hp-email-body ul { margin: 0 0 8px; padding-left: 18px; }
.hp-email-body a { color: var(--hp-accent); }
.hp-email-error { color: var(--hp-high); background: var(--hp-high-50); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; font-size: .88rem; }
@media (max-width: 640px) { .hp-table.stack tr.hp-email-detail td { display: block; text-align: left; } .hp-table.stack tr.hp-email-detail td::before { content: none; } }
@media (prefers-color-scheme: dark) { .hp-email-detail td { background: #0f2a28; } .hp-email-error { background: #3b1d0a; color: #fdba74; } }

/* ---- Connected accounts: links to the detail page, access-ending warning ---- */
.hp-conn-link { color: inherit; text-decoration: none; }
.hp-conn-link:hover, .hp-conn-link:focus-visible { color: var(--hp-accent); text-decoration: underline; }
.hp-access-warn { color: #92400E; background: #FEF3C7; border-radius: 6px; padding: 3px 8px; display: inline-block; margin-top: 2px; }
@media (prefers-color-scheme: dark) { .hp-access-warn { color: #fde68a; background: #422006; } }
.hp-conn-dl { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 6px 16px; margin: 0; }
.hp-conn-dl dt { color: var(--hp-muted); font-weight: 500; font-size: .88rem; }
.hp-conn-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .hp-conn-dl { grid-template-columns: 1fr; gap: 2px; } .hp-conn-dl dd { margin-bottom: 8px; } }
.hp-dialog { border: 1px solid var(--hp-line); border-radius: 10px; padding: 16px; margin-top: 12px; background: var(--hp-high-50); }
@media (prefers-color-scheme: dark) { .hp-dialog { background: #2a1608; } }

/* ---------- DayBars: small clickable column chart (Sleep 30-night overview, Activity 30 days) ---------- */
.hp-bars { width: 100%; }
.hp-bars-plot { position: relative; border-bottom: 1px solid var(--hp-line, #e5e7eb); }
.hp-bars-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.hp-bars-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center;
    border-radius: 4px 4px 0 0; text-decoration: none; }
.hp-bars-col:hover, .hp-bars-col:focus-visible { background: rgba(15, 118, 110, .08); }
.hp-bars-col.sel { background: rgba(15, 118, 110, .14); }
.hp-bars-col.nolink { pointer-events: none; }
.hp-bars-stack { display: flex; flex-direction: column-reverse; width: 72%; max-width: 22px; min-height: 0; border-radius: 3px 3px 0 0; overflow: hidden; }
.hp-bars-stack b { display: block; min-height: 1px; }
.hp-bars-mark { position: absolute; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--hp-card, #fff); }
.hp-bars-empty { position: absolute; bottom: 2px; font-size: .6rem; color: var(--hp-muted, #64748b); }
.hp-bars-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #94a3b8; pointer-events: none; z-index: 1; }
.hp-bars-line span { position: absolute; right: 0; top: -15px; font-size: .64rem; color: var(--hp-muted, #64748b); background: var(--hp-card, #fff); padding: 0 3px; border-radius: 3px; }
.hp-bars-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.hp-bars-dot { position: absolute; left: 50%; width: 7px; height: 7px; margin: 0 0 -3.5px -3.5px; border-radius: 50%; border: 2px solid #ea580c;
    background: var(--hp-card, #fff); z-index: 3; pointer-events: none; }
.hp-bars.dense .hp-bars-dot { width: 5px; height: 5px; margin: 0 0 -2.5px -2.5px; border-width: 1.5px; }
.hp-bars-ax { position: absolute; top: -2px; font-size: .62rem; color: var(--hp-muted, #64748b); background: var(--hp-card, #fff); padding: 0 3px;
    border-radius: 3px; z-index: 4; pointer-events: none; font-variant-numeric: tabular-nums; }
.hp-bars-ax.l { left: 0; } .hp-bars-ax.r { right: 0; }
/* a night the column can't be trusted for (microphone muted or offline for part of it): hatched, bar in grey */
.hp-bars-col.hatch { background: repeating-linear-gradient(135deg, rgba(148, 163, 184, .30) 0 3px, transparent 3px 7px); }
.hp-bars-col.hatch:hover, .hp-bars-col.hatch:focus-visible { background: repeating-linear-gradient(135deg, rgba(148, 163, 184, .45) 0 3px, rgba(15, 118, 110, .08) 3px 7px); }
.hp-bars-hatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(148, 163, 184, .7);
    background: repeating-linear-gradient(135deg, rgba(148, 163, 184, .55) 0 2px, transparent 2px 4px); }
.hp-snore-flags { font-size: .74rem; color: var(--hp-muted, #64748b); margin-top: 4px; }
.hp-snore-sum { font-size: .85rem; margin-top: 8px; }
.hp-snore-sum b { font-variant-numeric: tabular-nums; }
.hp-bars-x { display: flex; gap: 2px; margin-top: 3px; }
.hp-bars-x span { flex: 1 1 0; min-width: 0; text-align: center; font-size: .64rem; color: var(--hp-muted, #64748b); white-space: nowrap; overflow: visible; }

/* ---------- Sleep page: last-7 summary, month list ---------- */
.hp-sum7 { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px 14px; }
.hp-sum7 > div { padding: 6px 0; border-top: 1px solid var(--hp-line, #e5e7eb); }
.hp-sum7 .k { font-size: .72rem; color: var(--hp-muted, #64748b); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hp-sum7 .v { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hp-sum7 .d { font-size: .74rem; font-variant-numeric: tabular-nums; }
.hp-sum7 .d.better { color: #15803d; } .hp-sum7 .d.worse { color: #b45309; } .hp-sum7 .d.same { color: var(--hp-muted, #64748b); }
.hp-month-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.hp-month-table td, .hp-month-table th { white-space: nowrap; }
.hp-tone { display: inline-block; min-width: 2.6em; text-align: right; padding: 0 5px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.hp-tone.good, .hp-tone.normal { background: #F0FDF4; color: #15803D; }
.hp-tone.typical { background: rgba(148, 163, 184, .14); }
.hp-tone.fair, .hp-tone.mild { background: #FEFCE8; color: #854D0E; }
.hp-tone.watch, .hp-tone.moderate, .hp-tone.low { background: #FFF7ED; color: #C2410C; }
.hp-tone.notable, .hp-tone.severe { background: #FEF2F2; color: #B91C1C; }
@media (prefers-color-scheme: dark) {
    .hp-tone.good, .hp-tone.normal { background: #052e16; color: #86efac; }
    .hp-tone.fair, .hp-tone.mild { background: #3f2d06; color: #fde68a; }
    .hp-tone.watch, .hp-tone.moderate, .hp-tone.low { background: #431407; color: #fdba74; }
    .hp-tone.notable, .hp-tone.severe { background: #450a0a; color: #fca5a5; }
    .hp-sum7 .d.better { color: #86efac; } .hp-sum7 .d.worse { color: #fdba74; }
}

/* ---------- Activity page: 24-hour strip ---------- */
.hp-act-strip { display: block; width: 100%; height: 86px; }
.hp-act-hours { display: flex; justify-content: space-between; font-size: .64rem; color: var(--hp-muted, #64748b); margin-top: 2px; }
.hp-act-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .74rem; color: var(--hp-muted, #64748b); margin-top: 8px; }
.hp-act-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hp-act-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
/* Activity score (processor v8): weekly active-minutes bar, score ring, parts */
.hp-wkbar { margin-top: 6px; }
.hp-wkbar-track { position: relative; height: 10px; border-radius: 999px; background: rgba(148, 163, 184, .25); overflow: hidden; }
.hp-wkbar.compact .hp-wkbar-track { height: 7px; }
.hp-wkbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #5FB49C; border-radius: 999px; }
.hp-wkbar-fill.met { background: #0f766e; }
.hp-wkbar-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(15, 23, 42, .45); }
.hp-wkbar-lbls { position: relative; height: 14px; font-size: .64rem; color: var(--hp-muted, #64748b); }
.hp-wkbar-lbls span { position: absolute; transform: translateX(-50%); }
.hp-ascore { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; font-size: 1.5rem; font-weight: 700;
    color: #fff; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.hp-ascore.sm { width: 40px; height: 40px; font-size: 1rem; }
.hp-aparts { display: grid; gap: 10px; margin-top: 12px; }
.hp-apart .hd { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.hp-apart .trk { height: 6px; border-radius: 999px; background: rgba(148, 163, 184, .25); margin: 4px 0 2px; overflow: hidden; }
.hp-apart .trk i { display: block; height: 100%; background: #14b8a6; border-radius: 999px; }
.hp-recover { background: rgba(99, 102, 241, .08); border: 1px solid rgba(99, 102, 241, .3); border-left: 4px solid #6366f1; border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
@media (prefers-color-scheme: dark) { .hp-wkbar-mark { background: rgba(226, 232, 240, .6); } }

/* sql/95 debug snore clips (owner only): marker on the snoring row, one block per clip on the night page */
.hp-tl-clip { fill: #0ea5e9; }
.hp-clip { border-top: 1px solid var(--bs-border-color, #e2e8f0); padding-top: 10px; }

/* bedroom TV band on the night timeline (sql/96): colour by kind of app / input; dashed line at sleep onset */
.hp-tl-tv { fill: #0ea5e9; background: #0ea5e9; }
.hp-tl-tv.live_tv { fill: #6366f1; background: #6366f1; }
.hp-tl-tv.hdmi_input, .hp-tl-tv.game { fill: #14b8a6; background: #14b8a6; }
.hp-tl-tv.home_menu, .hp-tl-tv.other, .hp-tl-tv.unknown { fill: #94a3b8; background: #94a3b8; }
.hp-tl-tv-onset { stroke: var(--hp-text, #334155); stroke-width: 1.5; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.hp-tl-legend i.hp-tl-tv { display: inline-block; }

/* sleep detail pages (snoring / TV / room): a card heading that opens the detail page */
.hp-h-link { color: inherit; text-decoration: none; }
.hp-h-link:hover { color: var(--hp-accent, #0F766E); text-decoration: underline; }

/* ---- bedroom lights on the night timeline (sql/99): one lane per light group, height + opacity = intensity ---- */
.hp-tl-lights { display: flex; flex-direction: column; gap: 2px; }
.hp-tl-light-lane { position: relative; }
.hp-tl-light-name { position: absolute; left: 2px; top: -1px; font-size: .6rem; line-height: 1; color: var(--hp-muted, #64748b); pointer-events: none;
    background: color-mix(in srgb, var(--hp-card, #fff) 70%, transparent); padding: 0 2px; border-radius: 2px; }
.hp-tl-light { fill: #f59e0b; background: #f59e0b; }
.hp-tl-light.unk { fill: #fbbf24; }
.hp-tl-legend i.hp-tl-light { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.hp-tl-legend i.hp-tl-light.unk { background: repeating-linear-gradient(45deg, #fbbf24 0 3px, rgba(251, 191, 36, .35) 3px 6px); }

/* ---- image viewer (/imaging/{study}, sql/112): toolbar, series strip, dark viewport, report card below ---- */
.hp-iv { background: #0b0f14; border-radius: var(--hp-radius); padding: 10px; margin-bottom: 16px; outline: none; color: #e2e8f0; }
.hp-iv:focus-visible { box-shadow: 0 0 0 2px var(--hp-accent); }
.hp-iv-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.hp-iv-tools .hp-seg { background: #111827; border-color: #334155; }
.hp-iv-tools .hp-seg button { color: #cbd5e1; padding: 6px 12px; }
.hp-iv-tools .hp-seg button.on { background: var(--hp-accent); color: #fff; }
.hp-iv-tools .hp-seg[hidden] { display: none; }
.hp-iv-body { display: grid; grid-template-columns: 132px 1fr; gap: 10px; height: min(78vh, 820px); }
.hp-iv-strip { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.hp-iv-thumb { display: flex; flex-direction: column; align-items: center; gap: 3px; background: #111827; border: 2px solid transparent;
    border-radius: 8px; padding: 6px 4px; color: #cbd5e1; cursor: pointer; font-size: .72rem; line-height: 1.2; text-align: center; }
.hp-iv-thumb.on { border-color: var(--hp-accent); }
.hp-iv-thumb canvas { width: 96px; height: 96px; background: #000; border-radius: 4px; }
.hp-iv-thumb small { color: #94a3b8; font-size: .66rem; }
.hp-iv-stage { position: relative; min-width: 0; min-height: 0; background: #000; border-radius: 8px; overflow: hidden; }
.hp-iv-vp { position: absolute; inset: 0 0 34px 0; touch-action: none; user-select: none; }
.hp-iv-info, .hp-iv-wl { position: absolute; top: 8px; font-size: .78rem; color: #fde68a; text-shadow: 0 1px 2px #000; pointer-events: none; }
.hp-iv-info { left: 10px; } .hp-iv-wl { right: 10px; }
.hp-iv-status { position: absolute; inset: 0 0 34px 0; display: flex; align-items: center; justify-content: center; color: #94a3b8; pointer-events: none; }
.hp-iv-status:empty { display: none; }
.hp-iv-slider { position: absolute; left: 10px; right: 10px; bottom: 8px; width: calc(100% - 20px); accent-color: var(--hp-accent); }
.hp-iv-help { margin-top: 8px; color: #94a3b8; }
@media (max-width: 860px) {
    .hp-iv { padding: 8px; margin-left: -8px; margin-right: -8px; }
    .hp-iv-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100vh - 230px); min-height: 380px; }
    .hp-iv-strip { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
    .hp-iv-thumb { flex: 0 0 auto; width: 84px; }
    .hp-iv-thumb canvas { width: 64px; height: 64px; }
    .hp-iv-help { display: none; }
}
.hp-iv-open { display: inline-flex; align-items: center; gap: 10px; background: var(--hp-accent); color: #fff; border-radius: 10px;
    padding: 10px 16px; margin: 4px 8px 16px 0; }
.hp-iv-open:hover { background: var(--hp-accent-600); color: #fff; text-decoration: none; }
.hp-iv-open svg { width: 22px; height: 22px; }
.hp-iv-open > span { display: flex; flex-direction: column; line-height: 1.25; }
.hp-iv-open .hp-muted { color: rgba(255, 255, 255, .85); }

/* Allergies & medications to avoid (Medications page) + add-medication warning */
.hp-avoid { border-left: 4px solid #B91C1C; }
.hp-avoid .hp-card-title .btn-link { margin-left: auto; font-size: .85rem; }
.hp-avoid-form { background: var(--hp-bg, #F8FAFC); border: 1px solid var(--hp-line); border-radius: 8px; padding: 12px; margin-bottom: 12px; max-width: 720px; }
.hp-avoid-warn { background: #FEF2F2; color: #7F1D1D; border: 1px solid #FECACA; border-left: 4px solid #B91C1C; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.hp-avoid-warn b { color: #991B1B; }
@media (prefers-color-scheme: dark) { .hp-avoid-warn { background: #3b1010; color: #fecaca; border-color: #7f1d1d; } .hp-avoid-warn b { color: #fca5a5; } .hp-avoid-form { background: #111a2e; } }
