/* SECURECORDS — website + app styles.
   Palette from the logo (navy, "RE" red, key teal) on a warm neutral base.
   System fonts only: no third-party requests (privacy; strict CSP). */

:root {
    --bg: #F6F4EF;
    --bg-2: #EFECE4;
    --surface: #FFFFFF;
    --surface-2: #FAF9F6;
    --ink: #1B2530;
    --ink-2: #5E6672;
    --ink-3: #8C8F95;
    --line: #E3DFD5;
    --line-2: #EEEBE3;
    --accent: #B03A2E;
    --accent-ink: #FFFFFF;
    --teal: #2F7F70;
    --brand: #1B2530;
    --brand-ink: #FFFFFF;
    --focus: #2F7F70;
    --band: #DCE9E3;
    --band-edge: #B7CEC4;
    --band-custom: #EEDFC0;
    --chart: #B8562E;
    --chart-2: #4F68A8;
    --normal: #2E7A64; --normal-bg: #E4F1EB; --normal-soft: #C9E3D8;
    --high: #B4611F;   --high-bg: #FCEBDD;   --high-soft: #F3D1B4;
    --low: #4A62A6;    --low-bg: #E7EBF7;    --low-soft: #C9D2EE;
    --shadow-sm: 0 1px 2px rgba(27, 37, 48, .06);
    --shadow: 0 1px 2px rgba(27, 37, 48, .05), 0 6px 20px rgba(27, 37, 48, .06);
    --shadow-lg: 0 10px 40px rgba(27, 37, 48, .14);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --sidebar-w: 248px;
    color-scheme: light;
}

/* Dark theme: follows the system unless the user picked Light/Dark in Settings (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0F151C;
        --bg-2: #141C25;
        --surface: #17202A;
        --surface-2: #1B2530;
        --ink: #E8ECF0;
        --ink-2: #A8B1BB;
        --ink-3: #7D8792;
        --line: #26313C;
        --line-2: #212B35;
        --accent: #E0685A;
        --teal: #5FB8A4;
        --brand: #0B1117;
        --focus: #5FB8A4;
        --band: #1F3A32;
        --band-edge: #2D5347;
        --band-custom: #4A3C22;
        --chart: #E68A5E;
        --chart-2: #8AA2E6;
        --normal: #6CC7A8; --normal-bg: #16302A; --normal-soft: #22493E;
        --high: #F0A265;   --high-bg: #382517;   --high-soft: #5A3B22;
        --low: #97AEF0;    --low-bg: #1E2640;    --low-soft: #2E3A63;
        --shadow-sm: none;
        --shadow: 0 1px 0 rgba(255, 255, 255, .03);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
        --bg: #0F151C;
        --bg-2: #141C25;
        --surface: #17202A;
        --surface-2: #1B2530;
        --ink: #E8ECF0;
        --ink-2: #A8B1BB;
        --ink-3: #7D8792;
        --line: #26313C;
        --line-2: #212B35;
        --accent: #E0685A;
        --teal: #5FB8A4;
        --brand: #0B1117;
        --focus: #5FB8A4;
        --band: #1F3A32;
        --band-edge: #2D5347;
        --band-custom: #4A3C22;
        --chart: #E68A5E;
        --chart-2: #8AA2E6;
        --normal: #6CC7A8; --normal-bg: #16302A; --normal-soft: #22493E;
        --high: #F0A265;   --high-bg: #382517;   --high-soft: #5A3B22;
        --low: #97AEF0;    --low-bg: #1E2640;    --low-soft: #2E3A63;
        --shadow-sm: none;
        --shadow: 0 1px 0 rgba(255, 255, 255, .03);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
        color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1:focus { outline: none; }
p { margin: 0 0 .75rem; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.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; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.optional { color: var(--ink-3); font-weight: normal; }
.icon { width: 18px; height: 18px; flex: none; }
.cat-icon { width: 18px; height: 18px; flex: none; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
    width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink); min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
@media (max-width: 640px) { input, select, textarea { font-size: 16px; } } /* prevents iOS zoom */
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 .6rem; }
label > input, label > select, label > textarea, label > .input-unit { margin-top: .3rem; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); font-weight: normal; }
label.check input { width: auto; min-height: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: .75rem; margin: 0 0 .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
legend { font-size: 13px; font-weight: 600; padding: 0 .3rem; }
.input-unit { display: flex; align-items: center; gap: .4rem; }
.input-unit > span { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px;
    padding: .55rem 1rem; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer;
    text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { min-height: 34px; padding: .35rem .75rem; font-size: 13px; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
.btn-muted { background: var(--bg-2); color: var(--ink); }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-outline:hover, .btn-outline.is-on { border-color: var(--ink-3); }
.btn-outline.is-on { background: var(--bg-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-warn { background: var(--high-bg); color: var(--high); }
.btn-warn-solid { background: var(--high); color: #fff; }
.push-right { margin-left: auto; }
.icon-btn, .link-btn { background: none; border: 0; cursor: pointer; color: var(--ink-2); padding: 0; display: inline-flex; align-items: center; gap: .35rem; }
.link-btn { font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- status ---------- */
.status-normal { --st: var(--normal); --st-bg: var(--normal-bg); }
.status-high { --st: var(--high); --st-bg: var(--high-bg); }
.status-low { --st: var(--low); --st-bg: var(--low-bg); }
.status-chip {
    display: inline-flex; align-items: center; gap: .3rem; font-size: 12px; font-weight: 600; line-height: 1;
    padding: .3rem .55rem; border-radius: 999px; color: var(--st, var(--ink-2)); background: var(--st-bg, var(--bg-2)); white-space: nowrap;
}
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip + .status-chip { margin-left: .3rem; }

/* ---------- website chrome ---------- */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); }
.brand img { height: 44px; width: auto; display: block; border-radius: 6px; }
.site-nav { display: flex; gap: 1.25rem; align-items: center; }
.site-nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-main { padding: 0 clamp(1rem, 4vw, 3rem) 3rem; max-width: 1120px; margin: 0 auto; }
.site-foot { border-top: 1px solid var(--line); padding: 1.5rem clamp(1rem, 4vw, 3rem); color: var(--ink-3); font-size: 13px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .5rem; }
.site-foot a { color: var(--ink-2); }
@media (max-width: 560px) { .brand img { height: 34px; } .site-nav a:not(.btn) { display: none; } }
.hero-site { padding: 3.5rem 0 2rem; max-width: 760px; }
.hero-site h1 { font-size: clamp(2.1rem, 5vw, 3.25rem); margin: 0 0 1rem; letter-spacing: -.02em; }
.lede { font-size: 1.1rem; color: var(--ink-2); }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 2rem 0; }
.features article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.features h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.fine { font-size: 13px; color: var(--ink-3); }
.prose { max-width: 720px; padding: 1rem 0; }
.prose h1 { margin-bottom: 1rem; }
.prose h2 { margin: 1.5rem 0 .5rem; font-size: 1.2rem; }
.draft-banner { background: var(--high-bg); color: var(--high); padding: .6rem .9rem; border-radius: var(--r-sm); font-family: var(--mono); font-size: 12px; }

/* ---------- auth pages ---------- */
.auth { max-width: 460px; margin: 2rem auto 3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.25rem, 4vw, 2rem); box-shadow: var(--shadow); }
.auth h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.auth form { display: grid; gap: .1rem; margin-top: 1rem; }
.auth-alt { font-size: 13px; color: var(--ink-3); margin-top: 1rem; }
.form-error { background: var(--high-bg); color: var(--high); border-radius: var(--r-sm); padding: .55rem .75rem; font-size: 13px; margin: .5rem 0; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: .5rem 0 0; }
.recovery { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; }
.recovery h2 { margin-bottom: .5rem; }
.recovery-key { display: block; font-family: var(--mono); font-size: 15px; letter-spacing: .03em; word-break: break-all; background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--r-sm); padding: .75rem; margin: .75rem 0; user-select: all; }
.reading-form-row, .rform-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: none; flex-direction: column; gap: 1.25rem;
    background: var(--brand); color: #D6DCE2; padding: 1.25rem 1rem;
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.sidebar-brand img { border-radius: 8px; }
.wordmark { font-weight: 800; letter-spacing: .04em; font-size: 15px; color: #fff; }
.wordmark b { color: #E0685A; font-weight: 800; }
.sidebar-nav { display: grid; gap: .2rem; margin-top: .5rem; }
.sidebar-nav a { display: flex; align-items: center; gap: .7rem; padding: .65rem .75rem; border-radius: var(--r-sm); color: #C3CAD2; text-decoration: none; font-weight: 500; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 #E0685A; }
.sidebar-lock { margin-top: auto; display: flex; gap: .6rem; font-size: 12px; color: #9AA5B1; background: rgba(255, 255, 255, .04); border-radius: var(--r-sm); padding: .75rem; }
.sidebar-lock .icon { color: #5FB8A4; }
.sidebar-foot { display: flex; gap: .9rem; font-size: 12px; padding: 0 .25rem; }
.sidebar-foot a { color: #9AA5B1; }

.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 1rem; background: var(--brand); color: #fff;
}
.topbar-lock { display: inline-flex; align-items: center; gap: .35rem; font-size: 12px; color: #9FD6BC; }
.topbar-lock .icon { width: 15px; height: 15px; }

.tabbar {
    position: fixed; z-index: 20; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(3, 1fr);
    background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
}
.tabbar a { display: grid; justify-items: center; gap: .15rem; padding: .35rem; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-decoration: none; border-radius: var(--r-sm); }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.shell-main { padding: 1.25rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) {
    .sidebar { display: flex; }
    .topbar, .tabbar { display: none; }
    .shell-main { margin-left: var(--sidebar-w); padding: 2rem clamp(1.5rem, 3vw, 3rem) 3rem; }
}

/* ---------- page scaffolding ---------- */
.page { max-width: 1320px; margin: 0 auto; }
.page--narrow { max-width: 860px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); letter-spacing: -.01em; }
.page-sub { color: var(--ink-3); font-size: 13.5px; margin: .25rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: .2rem; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; margin-bottom: .75rem; }
.back-link:hover { color: var(--ink); }
.loading { color: var(--ink-3); padding: 3rem 0; text-align: center; display: flex; gap: .6rem; align-items: center; justify-content: center; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footnote { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 2rem auto 0; max-width: 640px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 .4rem; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm); margin-bottom: 1rem; min-width: 0; }
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; gap: .45rem; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-title-row .panel-title { margin: 0; }
.panel h2 { font-size: 1rem; }
.panel h3 { font-size: .9rem; margin: 1rem 0 .3rem; }

/* ---------- dashboard ---------- */
.summary { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1.25rem; }
@media (min-width: 700px) { .summary { grid-template-columns: repeat(3, 1fr); } .summary .tile-pheno { grid-column: 1 / -1; } }
@media (min-width: 1280px) { .summary { grid-template-columns: 2fr 1fr 1fr 1fr; } .summary .tile-pheno { grid-column: auto; } }

.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); text-align: left; min-width: 0; }
.tile-eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); display: flex; align-items: center; gap: .5rem; }
.tag { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; text-transform: none; padding: .15rem .45rem; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.tile-hint { color: var(--ink-2); font-size: 13.5px; margin: .5rem 0 .75rem; }
.tile-fine { font-size: 11.5px; color: var(--ink-3); margin: .75rem 0 0; }
.tile-stat { display: grid; align-content: start; gap: .15rem; border-top: 3px solid var(--st, var(--line)); cursor: default; }
button.tile-stat { cursor: pointer; transition: box-shadow .15s, transform .1s; }
button.tile-stat:hover { box-shadow: var(--shadow); }
.tile-stat.is-active { box-shadow: 0 0 0 2px var(--st) inset, var(--shadow); }
.stat-num { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--st, var(--ink)); line-height: 1.1; }
.stat-num--sm { font-size: 1.25rem; line-height: 1.6; }
.stat-label { font-weight: 700; }
.stat-hint { font-size: 12px; color: var(--ink-3); }

.tile-pheno { background: linear-gradient(135deg, #1B2530, #22313F); color: #E7ECF1; border-color: transparent; }
.tile-pheno .tile-eyebrow { color: #9AA5B1; }
.tile-pheno .tag { background: rgba(255, 255, 255, .08); color: #C9D1D9; }
.tile-pheno .tile-hint { color: #C9D1D9; }
.tile-pheno .tile-fine { color: #8D99A6; }
.tile-pheno a { color: #F0B98A; }
.pheno-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .6rem; margin-top: .4rem; }
.pheno-value { font-size: 2.8rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: #fff; }
.pheno-unit { color: #9AA5B1; font-weight: 600; }
.pheno-delta { font-size: 13px; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; }
.pheno-delta.is-lower { color: #9FD6BC; background: rgba(159, 214, 188, .14); }
.pheno-delta.is-higher { color: #F0B98A; background: rgba(240, 185, 138, .14); }
.pheno-contrib { font-size: 12.5px; color: #B4BDC7; margin-top: .5rem; }
.pheno-progress { height: 8px; background: rgba(255, 255, 255, .1); border-radius: 999px; overflow: hidden; margin-top: .75rem; }
.pheno-progress > div { height: 100%; background: linear-gradient(90deg, #5FB8A4, #9FD6BC); border-radius: 999px; }
.pheno-inputs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.pheno-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: 12px; padding: .25rem .55rem; border-radius: 999px; background: rgba(255, 255, 255, .07); color: #DCE2E8 !important; text-decoration: none; }
.pheno-chip:hover { background: rgba(255, 255, 255, .14); }
.pheno-chip i { width: 7px; height: 7px; border-radius: 50%; background: #5B6672; }
.status-dot-normal i { background: #6CC7A8; }
.status-dot-high i { background: #F0A265; }
.status-dot-low i { background: #97AEF0; }

.empty-state { text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 2.5rem 1.25rem; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.empty-state p { color: var(--ink-2); max-width: 520px; margin: 0 auto 1rem; }
.empty-state .page-actions { justify-content: center; }

.toolbar { display: grid; gap: .75rem; grid-template-columns: 1fr auto; align-items: center; margin-bottom: 1.25rem; }
.toolbar .chips { grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: .15rem; }
.toolbar-group { display: flex; gap: .5rem; align-items: center; }
@media (max-width: 640px) { .toolbar { grid-template-columns: 1fr; } }
.search { position: relative; margin: 0; }
.search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 2.3rem; margin: 0; }
.search--block { margin-top: .75rem; }
.select { margin: 0; }
.select select { margin: 0; min-width: 190px; }
.segmented { display: inline-flex; background: var(--bg-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: .45rem .6rem; border-radius: 6px; cursor: pointer; color: var(--ink-3); display: inline-flex; min-height: 36px; align-items: center; }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented--text button { font-size: 13px; font-weight: 600; min-height: 32px; padding: .3rem .65rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .45rem .75rem; min-height: 36px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.chip b { font-weight: 700; color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-on b { color: inherit; opacity: .7; }
.filter-note { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); }

.group { margin-bottom: 1.5rem; }
.group-head { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; }
.group-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.group-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.group-toggle > .icon { transition: transform .15s; width: 16px; height: 16px; }
.group-toggle[aria-expanded="false"] > .icon { transform: rotate(-90deg); }
.group-head .status-chip { text-transform: none; letter-spacing: 0; }
.group--quiet .group-head { color: var(--ink-3); }
.chip-link { color: var(--ink-2); }

/* cards */
.card-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); }
.card-list { display: grid; gap: .5rem; }
.mcard-wrap { position: relative; min-width: 0; }
.mcard {
    display: grid; grid-template-rows: auto 1fr auto auto; gap: .35rem; height: 100%;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem 1rem .8rem;
    color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s;
    border-top: 3px solid var(--edge, var(--line));
}
.mcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--ink-3); border-top-color: var(--edge, var(--ink-3)); }
.status-edge-normal { --edge: var(--normal); }
.status-edge-high { --edge: var(--high); }
.status-edge-low { --edge: var(--low); }
.mcard-head { display: flex; align-items: center; gap: .45rem; padding-right: 1.8rem; min-width: 0; }
.mcard-icon { color: var(--ink-3); }
.mcard-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard-chart { min-height: 64px; display: flex; align-items: center; }
.mcard-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.mcard-value { font-family: var(--mono); font-size: 17px; font-weight: 600; white-space: nowrap; }
.mcard-value small { font-size: 11px; color: var(--ink-3); font-weight: 400; margin-left: .2rem; }
.mcard-foot { font-size: 12px; color: var(--ink-3); }
.pin-btn {
    position: absolute; top: .55rem; right: .55rem; width: 32px; height: 32px; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--ink-3);
}
.pin-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.pin-btn:hover { background: var(--bg-2); color: var(--ink); }
.pin-btn.is-pinned { color: #D69A1E; }
.pin-btn.is-pinned svg { fill: currentColor; }
@media (hover: hover) { .mcard-wrap:not(:hover):not(:focus-within) .pin-btn:not(.is-pinned) { opacity: 0; } }

/* list view */
.mcard-wrap.is-list .mcard {
    grid-template-rows: none; grid-template-columns: minmax(150px, 1.4fr) minmax(90px, 1fr) auto; align-items: center; gap: 1rem;
    padding: .55rem 3rem .55rem .9rem; border-top-width: 1px; border-left: 4px solid var(--edge, var(--line)); border-radius: var(--r);
}
.mcard-wrap.is-list .mcard:hover { transform: none; }
.mcard-wrap.is-list .mcard-head { padding: 0; }
.mcard-wrap.is-list .mcard-chart { min-height: 0; max-width: 240px; }
.mcard-wrap.is-list .mcard-chart .chart--compact { height: 36px; }
.mcard-wrap.is-list .mcard-foot { display: none; }
.mcard-wrap.is-list .pin-btn { top: 50%; transform: translateY(-50%); }
@media (max-width: 560px) {
    .mcard-wrap.is-list .mcard { grid-template-columns: 1fr auto; }
    .mcard-wrap.is-list .mcard-chart { display: none; }
}

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart--compact { height: 64px; }
.chart-empty { min-height: 10rem; display: grid; place-items: center; font-size: 13px; color: var(--ink-3); background: var(--surface-2); border-radius: var(--r); }
.chart-empty.is-compact { min-height: 64px; width: 100%; background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--line-2) 6px 7px); }
.chart-grid line { stroke: var(--line-2); stroke-width: 1; }
.chart-axis { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.chart-band { fill: var(--normal); fill-opacity: .12; }
.chart-band--1 { fill: var(--low); fill-opacity: .09; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line--1 { stroke: var(--chart-2); }
.chart-dot { fill: var(--surface); stroke: var(--chart); stroke-width: 2.5; cursor: pointer; }
.chart-dot--1 { stroke: var(--chart-2); }
.chart--compact .chart-dot { cursor: default; stroke: var(--surface); stroke-width: 2; }
.chart--compact .chart-dot.status-normal { fill: var(--normal); }
.chart--compact .chart-dot.status-high { fill: var(--high); }
.chart--compact .chart-dot.status-low { fill: var(--low); }
.chart--full .chart-dot.status-high { fill: var(--high-soft); }
.chart--full .chart-dot.status-low { fill: var(--low-soft); }
.chart-dot.is-selected { fill: var(--ink); stroke: var(--surface); }
.chart-dot:focus-visible { outline: none; stroke: var(--focus); stroke-width: 4; }
.chart-legend { display: flex; gap: 1rem; font-size: 12.5px; color: var(--ink-2); margin-top: .5rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--chart); }
.legend-swatch--1 { background: var(--chart-2); }

/* ---------- detail page ---------- */
.detail-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.detail-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--accent); }
.detail-icon .cat-icon { width: 28px; height: 28px; }
.detail-title { flex: 1; min-width: 200px; }
.detail-title h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.01em; }
.detail-grid { display: flex; flex-direction: column; }
/* Phone/tablet: one column, same sequence as desktop (latest, average, add, then trend, table, range, about). */
.detail-main, .detail-side { display: contents; }
.area-latest { order: 1; } .area-average { order: 2; } .area-add { order: 3; } .area-trend { order: 4; }
.area-table { order: 5; } .area-range { order: 6; } .area-about { order: 7; }
/* Desktop: two independent columns, so neither leaves gaps beside the other. */
@media (min-width: 1100px) {
    .detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 0 1rem; align-items: start; }
    .detail-main, .detail-side { display: block; min-width: 0; }
}
.table-more { display: flex; justify-content: center; margin-top: .75rem; }
.latest-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .6rem; }
.latest-value { font-family: var(--mono); font-size: 2.3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.latest-unit { color: var(--ink-3); font-weight: 600; }
.area-latest > .muted { margin: .3rem 0 .5rem; font-size: 13px; }

.rdiagram { margin: 1rem 0 .25rem; }
.rdiagram figcaption { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.rdiagram-zones { position: relative; display: flex; height: 30px; border-radius: 8px; overflow: visible; margin-top: 1.6rem; }
.zone { display: grid; place-items: center; font-size: 11px; font-weight: 600; overflow: hidden; white-space: nowrap; min-width: 0; }
.zone span { padding: 0 .35rem; overflow: hidden; text-overflow: ellipsis; }
.zone-low { background: var(--low-bg); color: var(--low); border-radius: 8px 0 0 8px; }
.zone-normal { background: var(--normal-bg); color: var(--normal); box-shadow: inset 1px 0 var(--band-edge), inset -1px 0 var(--band-edge); }
.zone-normal.is-custom { background: var(--band-custom); }
.zone-high { background: var(--high-bg); color: var(--high); border-radius: 0 8px 8px 0; }
.rdiagram-tick { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; background: var(--ink-3); opacity: .45; border-radius: 2px; }
.rdiagram-marker { position: absolute; top: -8px; bottom: -8px; width: 3px; margin-left: -1.5px; background: var(--st); border-radius: 3px; }
.rdiagram-marker b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 2px; font-family: var(--mono); font-size: 12px; color: var(--st); background: var(--surface); padding: 0 .25rem; border-radius: 4px; white-space: nowrap; }
.rdiagram-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: 11.5px; color: var(--ink-3); margin-top: .1rem; }
.rdiagram-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.legend-latest { width: 3px; height: 12px; background: var(--ink-2); border-radius: 2px; }
.legend-tick { width: 2px; height: 10px; background: var(--ink-3); opacity: .5; }
.gauge-labels { position: relative; height: 18px; margin-top: 4px; }
.gauge-labels span { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

.rform-grid { display: grid; gap: 0 .75rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.confirm { font-size: 14px; margin: .25rem 0; }
.table-wrap { overflow-x: auto; margin: 0 -.25rem; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rtable th, .rtable td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.rtable thead th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); border-bottom-color: var(--line); white-space: nowrap; }
.rtable thead th small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rtable .num { text-align: right; }
.rtable td.num { font-size: 14.5px; font-weight: 600; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable tr.is-selected { background: color-mix(in srgb, var(--teal) 7%, transparent); }
.rtable .actions { text-align: right; width: 1%; }
.rtable .note-cell { max-width: 220px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtable .edit-row td { background: var(--surface-2); padding: .9rem; }
.rtable .edit-row:hover { background: none; }
.rtable--compact th[scope=row] { font-weight: 500; color: var(--ink-2); }
@media (max-width: 720px) { .hide-sm { display: none; } }
.range-edit { margin-top: .75rem; }

.about-illustration { display: flex; align-items: center; gap: 1rem; padding: 1rem; margin-bottom: 1rem; border-radius: var(--r); background: linear-gradient(135deg, var(--surface-2), var(--bg-2)); }
.about-illustration .cat-icon { width: 46px; height: 46px; color: var(--accent); stroke-width: 1.3; flex: none; }
.about-zones { flex: 1; display: grid; grid-template-columns: 1fr 1.6fr 1fr; border-radius: 8px; overflow: hidden; font-size: 11px; font-weight: 600; text-align: center; }
.about-zones span { padding: .45rem .2rem; }
.z-low { background: var(--low-bg); color: var(--low); }
.z-normal { background: var(--normal-bg); color: var(--normal); }
.z-high { background: var(--high-bg); color: var(--high); }
.about-lead { font-size: 15px; }
.about-list { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.about-list li { margin: .2rem 0; }
.formula { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; padding: .9rem 1rem; border: 1px dashed var(--line); border-radius: var(--r); font-weight: 700; }
.frac { display: inline-grid; text-align: center; font-weight: 600; font-size: 13px; }
.frac span:first-child { border-bottom: 1.5px solid currentColor; padding-bottom: .15rem; }
.frac span:last-child { padding-top: .15rem; }
.bp { font-family: var(--mono); font-size: 1.8rem; display: inline-flex; align-items: baseline; gap: .2rem; }
.bp b:first-child { color: var(--chart); }
.bp b:last-child { color: var(--chart-2); }
.bp i { color: var(--ink-3); font-style: normal; }
.bp-legend { display: grid; font-size: 12.5px; font-weight: 400; color: var(--ink-2); }

/* ---------- add menu ---------- */
.add-menu { position: relative; }
.add-menu-panel {
    position: absolute; z-index: 30; right: 0; width: min(380px, calc(100vw - 2rem)); margin-top: .5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.add-menu-search { padding: .6rem; border-bottom: 1px solid var(--line-2); }
.add-menu-search input { margin: 0; }
.add-menu-list { max-height: 20rem; overflow-y: auto; }
.add-menu-cat { padding: .6rem .8rem .2rem; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.add-menu-item { display: flex; justify-content: space-between; gap: .5rem; width: 100%; padding: .55rem .8rem; background: none; border: 0; cursor: pointer; text-align: left; font-size: 14px; }
.add-menu-item:hover, .add-menu-item:focus-visible { background: var(--surface-2); }
.add-menu-item small { font-family: var(--mono); color: var(--ink-3); }
.add-menu-empty { padding: .8rem; color: var(--ink-3); font-size: 13px; }
.add-menu-custom { width: 100%; padding: .75rem .8rem; border: 0; border-top: 1px solid var(--line-2); background: none; color: var(--accent); font-weight: 600; text-align: left; cursor: pointer; }
.custom-form { padding: .9rem; display: grid; gap: .5rem; }
.custom-form input, .custom-form textarea { margin: 0; }
.reading-form-head { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.pair { display: flex; gap: .5rem; }

/* ---------- log results ---------- */
.log-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.suggest { display: grid; margin-top: .5rem; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.suggest-item { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border: 0; border-bottom: 1px solid var(--line-2); background: var(--surface); text-align: left; cursor: pointer; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: var(--surface-2); }
.suggest-item small { margin-left: auto; color: var(--ink-3); }
.suggest .muted { padding: .6rem .75rem; }
.log-rows { display: grid; }
.log-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem 1rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line-2); }
.log-row:last-child { border-bottom: 0; }
.log-row.has-error input { border-color: var(--high); background: var(--high-bg); }
.log-name { display: grid; }
.log-name span { font-weight: 600; }
.log-name small { font-size: 12px; }
.log-inputs { display: flex; gap: .5rem; }
.log-inputs .input-unit { margin: 0; flex: 1; font-weight: 400; }
@media (max-width: 560px) { .log-row { grid-template-columns: 1fr; } }
.savebar {
    position: sticky; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 10; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: .7rem .9rem; box-shadow: var(--shadow-lg); margin-top: 1rem;
}
@media (min-width: 1024px) { .savebar { bottom: 1rem; } }
.savebar .form-error { margin: 0; }
.saved-note { color: var(--normal); font-weight: 600; font-size: 14px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: .6rem 1rem; background: #FFF8E1; color: #1B2530; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.log-inputs .input-unit > span { min-width: 3.4rem; }

/* ---------- responsive refinements ---------- */
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; margin-top: .25rem; }
.chart-foot .hint { margin: 0; }
.check--sm { font-size: 13px; margin: 0; }
@media (max-width: 699px) {
    /* Summary: PhenoAge full width, then the three stats in one compact row. */
    .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
    .summary .tile-pheno { grid-column: 1 / -1; }
    .tile-stat { padding: .7rem .6rem; }
    .stat-num { font-size: 1.5rem; }
    .stat-num--sm { font-size: .95rem; line-height: 1.5; }
    .stat-label { font-size: 12.5px; }
    .stat-hint { display: none; }
    /* Two cards per row on phones. */
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
    .mcard { padding: .75rem .75rem .65rem; }
    .mcard-name { font-size: 13.5px; }
    .mcard-value { font-size: 15px; }
    .mcard-meta .status-chip { font-size: 11px; padding: .25rem .45rem; }
    .mcard-foot { font-size: 11px; }
    /* The full chart scales down with the screen; enlarge its labels in SVG units to compensate. */
    .chart--full .chart-axis { font-size: 21px; }
    .page-head .page-actions { width: 100%; }
    .page-head .page-actions > * { flex: 1; }
    .page-head .page-actions .add-menu > .btn { width: 100%; }
}

/* =====================================================================
   Round 3: greeting, range/BMI cards, tooltips, averages, profile, settings
   ===================================================================== */

/* sidebar account section */
.sidebar-nav--account { margin-top: auto; padding-top: .75rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-nav--account + .sidebar-lock { margin-top: 0; }
.sidebar-nav a.signout { color: #E7A59C; }
.sidebar-nav a.signout:hover { background: rgba(224, 104, 90, .12); color: #FFD1CB; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.topbar-signout { color: #C3CAD2; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; }
.topbar-signout:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tabbar { grid-template-columns: repeat(4, 1fr); }

/* greeting */
.greeting {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "avatar text actions" "facts facts facts";
    gap: 1rem 1.1rem; align-items: center; margin-bottom: 1.25rem; padding: 1.25rem 1.4rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.avatar {
    grid-area: avatar; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #7C2A21); color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: .02em;
}
.avatar--lg { width: 72px; height: 72px; font-size: 1.5rem; }
.greeting-text { grid-area: text; min-width: 0; }
.greeting-date { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin: 0 0 .15rem; text-transform: uppercase; letter-spacing: .05em; }
.greeting h1 { font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.01em; }
.greeting-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--ink-2); font-size: 13.5px; margin: .3rem 0 0; }
.greeting-meta span + span::before { content: "·"; margin-right: .9rem; color: var(--ink-3); }
.greeting-actions { grid-area: actions; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.greeting-facts { grid-area: facts; display: flex; flex-wrap: wrap; gap: .75rem 2rem; padding-top: 1rem; border-top: 1px solid var(--line-2); align-items: center; }
.greeting-facts > div { display: grid; }
.fact-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.fact-value { font-weight: 700; font-size: 15px; }
.fact-sub { font-size: 12px; color: var(--ink-3); }
.greeting-facts > .fact-lock { margin-left: auto; display: flex; align-items: center; gap: .4rem; font-size: 12.5px; color: var(--teal); font-weight: 600; }
@media (max-width: 760px) {
    .greeting { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "avatar text" "facts facts" "actions actions"; padding: 1rem; }
    .avatar { width: 46px; height: 46px; font-size: 1rem; }
    .greeting-actions { justify-content: stretch; }
    .greeting-actions > * { flex: 1; }
    .greeting-actions .add-menu > .btn { width: 100%; }
    .greeting-facts { gap: .75rem 1.25rem; }
    .greeting-facts > .fact-lock { margin-left: 0; }
}

/* summary row: PhenoAge | range status | BMI */
.summary { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1.25rem; }
.summary .tile-pheno { grid-column: auto; }
@media (min-width: 760px) { .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .summary .tile-pheno { grid-column: 1 / -1; } }
@media (min-width: 1200px) {
    .summary { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); }
    .summary .tile-pheno { grid-column: auto; }
    .summary.no-pheno, .summary.no-bmi { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .summary.no-pheno.no-bmi { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 699px) { .summary { grid-template-columns: 1fr; gap: .75rem; } .summary .tile-pheno { grid-column: auto; } }

.tile-range { display: grid; align-content: start; gap: .55rem; }
.range-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-2); gap: 2px; margin: .35rem 0 .2rem; }
.range-bar .seg { background: var(--st); min-width: 0; }
.range-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: var(--r); background: var(--st-bg); }
.range-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st); }
.range-num { font-size: 1.6rem; font-weight: 800; color: var(--st); line-height: 1; min-width: 2ch; }
.range-label { font-weight: 700; line-height: 1.2; }
.range-label small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-2); }
.range-row .btn { background: var(--surface); }
.range-row .btn.btn-dark { background: var(--ink); color: var(--bg); }
.range-row .icon { width: 14px; height: 14px; }

.tile-bmi { background: linear-gradient(135deg, #17463F, #1F5A50); color: #E6F2EF; border-color: transparent; display: grid; align-content: start; }
.tile-bmi .tile-eyebrow { color: #9CC9BE; }
.tile-bmi .tag { background: rgba(255, 255, 255, .1); color: #CFE6E0; }
.tile-bmi .tile-hint { color: #CFE6E0; }
.tile-bmi .tile-fine { color: #93BDB2; }
.btn-light { background: rgba(255, 255, 255, .92); color: #17463F; justify-self: start; }
.bmi-body { color: inherit; text-decoration: none; display: grid; gap: .5rem; border-radius: var(--r); }
.bmi-body:hover .pheno-value { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tile-bmi .pheno-row { align-items: center; }
.tile-bmi .status-chip { background: rgba(255, 255, 255, .92); }
.bmi-delta { font-size: 12.5px; color: #CFE6E0; font-weight: 600; }
.bmi-facts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: 12.5px; color: #B9D8D0; }
.bmi-facts b { color: #fff; font-family: var(--mono); font-weight: 600; }
.bmi-chart .chart-band { fill: #9FD6BC; fill-opacity: .16; }
.bmi-chart .chart-line { stroke: #F0B98A; }
.bmi-chart .chart--compact .chart-dot { stroke: #1F5A50; }
.bmi-chart .chart--compact { height: 52px; }

/* chart hover tooltips (HTML overlay above the SVG) */
.chart-wrap { position: relative; }
.chart-hits { position: absolute; inset: 0; }
.chart-hit { position: absolute; top: var(--plot-top); height: var(--plot-h); padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; }
.chart-hit::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--ink-3); opacity: 0; transition: opacity .1s; }
.chart-hit:hover::before, .chart-hit:focus-visible::before, .chart-hit.is-selected::before { opacity: .55; }
.chart-hit:focus-visible { outline: none; }
.chart-tip {
    position: absolute; bottom: calc(100% - .5rem); left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none;
    display: none; flex-direction: column; gap: .15rem; min-width: 150px; max-width: 240px; padding: .55rem .7rem; text-align: left;
    background: var(--ink); color: var(--bg); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: 12.5px; line-height: 1.35;
}
.chart-hit.tip-left .chart-tip { left: auto; right: 50%; transform: translateX(14px); }
.chart-hit.tip-right .chart-tip { left: 50%; transform: translateX(-14px); }
.chart-hit:hover .chart-tip, .chart-hit:focus-visible .chart-tip { display: flex; }
.tip-date { font-weight: 700; font-size: 12px; opacity: .8; }
.tip-row { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.tip-row b { font-family: var(--mono); font-size: 14px; }
.tip-row small { opacity: .75; }
.tip-label { opacity: .8; }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); flex: none; }
.tip-note { font-style: italic; opacity: .8; white-space: normal; }
.tip-hint { font-size: 11px; opacity: .55; margin-top: .1rem; }
@media (hover: none) { .tip-hint { display: none; } .chart-hit.is-selected .chart-tip { display: flex; } }

/* average card */
.area-average .panel-title-row { align-items: flex-start; }
.area-average .segmented--text button { padding: .3rem .5rem; }
.custom-range { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .75rem 0 .25rem; }
.stat-grid > div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .45rem .55rem; }
.stat-grid dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.stat-grid dd { margin: 0; font-family: var(--mono); font-weight: 700; font-size: 15px; }
.stat-grid--4 dd { font-family: var(--font); font-size: 1.3rem; }
@media (max-width: 420px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* profile & settings */
.notice { display: flex; gap: .5rem; align-items: flex-start; font-size: 13px; color: var(--ink-2); background: color-mix(in srgb, var(--teal) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--teal) 25%, var(--line)); border-radius: var(--r); padding: .65rem .8rem; margin: 0 0 1rem; }
.notice .icon { color: var(--teal); width: 16px; height: 16px; margin-top: .1rem; }
.auth .notice { margin-top: .5rem; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.profile-head .avatar { grid-area: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.field-hint { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); margin-top: .3rem; }
.kv { display: grid; gap: .5rem; margin: 0 0 .5rem; }
.kv > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1rem; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.settings-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.settings-nav a { font-size: 13px; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; }
.settings-nav a:hover { color: var(--ink); border-color: var(--ink-3); }
.panel { scroll-margin-top: 1rem; }
.panel h3 { margin-top: 1.25rem; }
.choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; border: 0; padding: 0; margin: .75rem 0 0; }
.choice-group legend { font-size: 13px; font-weight: 700; margin-bottom: .4rem; padding: 0; }
.choice { position: relative; display: grid; gap: .1rem; margin: 0; padding: .8rem .9rem .8rem 2.4rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; color: var(--ink); font-weight: 400; }
.choice:hover { border-color: var(--ink-3); }
.choice.is-on { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; background: color-mix(in srgb, var(--teal) 5%, var(--surface)); }
.choice input { position: absolute; left: .85rem; top: .95rem; width: 16px; height: 16px; min-height: 0; margin: 0; accent-color: var(--teal); }
.choice-title { font-weight: 700; }
.choice-sub { font-size: 12.5px; color: var(--ink-3); }
.choice-example { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); margin-top: .3rem; }
.switch { display: flex; align-items: center; gap: .6rem; font-size: 14px; font-weight: 500; color: var(--ink); margin: .2rem 0 .7rem; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; min-height: 0; margin: 0; padding: 0; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(16px); }
.segmented--wide { display: flex; width: 100%; max-width: 420px; }
.segmented--wide button { flex: 1; justify-content: center; }
.segmented button:disabled { opacity: .4; cursor: default; }
.segmented--text .icon { width: 15px; height: 15px; margin-right: .25rem; }
.panel--danger { border-color: color-mix(in srgb, var(--high) 35%, var(--line)); }
.panel--danger .panel-title { color: var(--high); }

/* round 3 polish */
.chart-tip { min-width: 180px; }
.tip-date { white-space: nowrap; }
@media (max-width: 640px) {
    .toolbar-group { flex-wrap: wrap; }
    .toolbar-group .segmented--text { width: 100%; }
    .toolbar-group .segmented--text button { flex: 1; justify-content: center; }
    .toolbar-group .select { flex: 1; }
    .toolbar-group .select select { min-width: 0; }
}

/* WHO adult BMI category bands (detail-page reference bar, chips, table) */
.bmi-underweight { --bc: #4A62A6; --bc-bg: #E3E8F6; }
.bmi-normal      { --bc: #2E7A64; --bc-bg: #DDEFE7; }
.bmi-overweight  { --bc: #A87514; --bc-bg: #F8EDCF; }
.bmi-obese1      { --bc: #B4611F; --bc-bg: #F9E1CC; }
.bmi-obese2      { --bc: #A8452A; --bc-bg: #F5D3C8; }
.bmi-obese3      { --bc: #8E2F2A; --bc-bg: #EFC4C0; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .bmi-underweight { --bc: #97AEF0; --bc-bg: #1E2640; }
    :root:not([data-theme="light"]) .bmi-normal      { --bc: #6CC7A8; --bc-bg: #16302A; }
    :root:not([data-theme="light"]) .bmi-overweight  { --bc: #E8C067; --bc-bg: #3A3016; }
    :root:not([data-theme="light"]) .bmi-obese1      { --bc: #F0A265; --bc-bg: #3A2716; }
    :root:not([data-theme="light"]) .bmi-obese2      { --bc: #EE8B70; --bc-bg: #3D211A; }
    :root:not([data-theme="light"]) .bmi-obese3      { --bc: #E9746C; --bc-bg: #401B19; }
}
:root[data-theme="dark"] .bmi-underweight { --bc: #97AEF0; --bc-bg: #1E2640; }
:root[data-theme="dark"] .bmi-normal      { --bc: #6CC7A8; --bc-bg: #16302A; }
:root[data-theme="dark"] .bmi-overweight  { --bc: #E8C067; --bc-bg: #3A3016; }
:root[data-theme="dark"] .bmi-obese1      { --bc: #F0A265; --bc-bg: #3A2716; }
:root[data-theme="dark"] .bmi-obese2      { --bc: #EE8B70; --bc-bg: #3D211A; }
:root[data-theme="dark"] .bmi-obese3      { --bc: #E9746C; --bc-bg: #401B19; }

.rdiagram--bmi .zone { background: var(--bc-bg); color: var(--bc); box-shadow: inset -1px 0 color-mix(in srgb, var(--bc) 25%, transparent); font-size: 10.5px; }
.rdiagram--bmi .zone:first-child { border-radius: 8px 0 0 8px; }
.rdiagram--bmi .zone:nth-child(6) { border-radius: 0 8px 8px 0; box-shadow: none; }
.rdiagram-marker[class*="bmi-"] { background: var(--bc); }
.rdiagram-marker[class*="bmi-"] b { color: var(--bc); }
.rdiagram-source { font-size: 11px; color: var(--ink-3); margin: .35rem 0 0; }
.bmi-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: 12px; font-weight: 700; line-height: 1; padding: .3rem .6rem; border-radius: 999px; color: var(--bc); background: var(--bc-bg); white-space: nowrap; }
.bmi-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tile-bmi .bmi-chip { background: rgba(255, 255, 255, .92); }
.bmi-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--bc); margin-right: .5rem; vertical-align: -1px; }
.bmi-table { margin: .25rem 0 .5rem; }
.bmi-table th[scope=row] { font-weight: 500; color: var(--ink); }
.source { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-left: 3px solid var(--line); padding: .5rem .7rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.about-zones--bmi { grid-template-columns: repeat(6, 1fr); }
.about-zones--bmi span { background: var(--bc-bg); color: var(--bc); padding-inline: .1rem; }
.about-zones--bmi span { white-space: nowrap; font-size: 10px; letter-spacing: -.01em; overflow: hidden; text-overflow: clip; }
@media (max-width: 760px) { .greeting-meta { flex-direction: column; gap: .1rem; } .greeting-meta span + span::before { display: none; } }

/* ---------- Export as PDF ---------- */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.page--wide { max-width: 1480px; }
.report-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
    .report-layout { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); align-items: start; }
    .report-preview { position: sticky; top: 1rem; }
}
.report-options .panel { padding: .9rem 1rem; margin-bottom: .75rem; }
.report-options .panel-title { font-size: .95rem; margin-bottom: .5rem; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .75rem; }
.check-grid--1 { grid-template-columns: 1fr; }
.check-grid .check { margin: .2rem 0; font-size: 13.5px; }
.check-grid.nested { margin: .35rem 0 0 1.4rem; padding-left: .75rem; border-left: 2px solid var(--line); }
.radio-list { display: grid; gap: .1rem; margin-bottom: .5rem; }
.radio { display: flex; gap: .55rem; align-items: flex-start; margin: .25rem 0; font-size: 13.5px; color: var(--ink); font-weight: 500; cursor: pointer; }
.radio input { width: 16px; height: 16px; min-height: 0; margin: .15rem 0 0; accent-color: var(--teal); flex: none; }
.radio small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }
.pick-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .4rem .7rem; }
.pick-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: .5rem 0 .15rem; }
.pick-list .check { margin: .15rem 0; font-size: 13.5px; }
.segmented--wrap { flex-wrap: wrap; }

.report-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem; box-shadow: var(--shadow-sm); min-width: 0; }
.preview-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.preview-status { flex: 1; display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--ink-2); min-width: 160px; }
.preview-status .form-error { margin: 0; }
.notice--warn { background: color-mix(in srgb, var(--high) 8%, var(--surface)); border-color: color-mix(in srgb, var(--high) 30%, var(--line)); }
.notice--warn .icon { color: var(--high); }
.preview-frame { height: calc(100vh - 12rem); min-height: 560px; border-radius: var(--r); overflow: hidden; background: #525659; border: 1px solid var(--line); }
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #525659; }
.preview-frame .loading { color: #E5E7EB; height: 100%; }
.preview-mobile { display: none; }
@media (max-width: 760px) {
    .preview-frame { display: none; }
    .preview-mobile { display: block; }
    .preview-mobile .btn { width: 100%; }
    .check-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Life events ---------- */
.chart-events { position: absolute; left: 0; right: 0; top: var(--pin-top); height: 0; }
.event-pin {
    position: absolute; width: 14px; height: 14px; margin-left: -7px; padding: 0; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    background: var(--ev); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: pointer; z-index: 3;
}
.event-pin:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.event-pin .event-tip { transform: rotate(45deg) translateX(-50%); transform-origin: 0 0; bottom: auto; top: 18px; left: 50%; min-width: 180px; }
.event-pin.tip-left .event-tip { left: auto; right: -4px; transform: rotate(45deg) translateX(0); transform-origin: 100% 0; }
.event-pin.tip-right .event-tip { transform: rotate(45deg) translateX(-12px); }
.event-pin:hover .event-tip, .event-pin:focus-visible .event-tip { display: flex; }
@media (hover: none) { .event-pin:focus .event-tip { display: flex; } }
.ev-title { font-family: var(--font) !important; font-size: 13px !important; white-space: normal; }
.chart-toggles { display: flex; gap: .9rem; flex-wrap: wrap; }
.event-strip { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; }
.event-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: 12.5px; font-weight: 600; padding: .3rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--ev) 10%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--ev) 30%, var(--line)); }
.event-chip i, .ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); flex: none; display: inline-block; }
.event-chip small { font-weight: 400; color: var(--ink-3); }
.event-add { font-size: 12.5px; font-weight: 600; text-decoration: none; margin-left: auto; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink-2); margin: .2rem 0 .35rem; }
.cat-chips { margin-bottom: .75rem; }
.cat-chips .chip.is-on { background: color-mix(in srgb, var(--ev) 14%, var(--surface)); border-color: var(--ev); color: var(--ink); }
.cat-chips .chip .ev-dot { background: var(--ev); }
.timeline { margin-top: .5rem; }
.timeline .group-head { margin-top: 1.25rem; }
.timeline-list { list-style: none; margin: 0; padding: 0 0 0 .5rem; border-left: 2px solid var(--line); }
.timeline-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: start; padding: .7rem .8rem .7rem 1.2rem; margin: 0 0 .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.timeline-item > .ev-dot { position: absolute; left: -1.05rem; top: 1rem; width: 12px; height: 12px; border: 2px solid var(--bg); }
.timeline-title { font-weight: 700; }
.timeline-meta { font-size: 12.5px; color: var(--ink-3); }
.timeline-note { font-size: 13px; color: var(--ink-2); margin-top: .2rem; }
.timeline-actions { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Lab visits ---------- */
.visit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.visit-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.visit-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.visit-date { width: 58px; text-align: center; border-radius: var(--r); background: var(--bg-2); padding: .35rem 0; display: grid; }
.visit-day { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.visit-month { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; }
.visit-title { font-weight: 700; }
.visit-meta { font-size: 12.5px; color: var(--ink-3); margin: .1rem 0 .4rem; }
.range-bar--sm { height: 6px; margin: 0; max-width: 360px; }
.visit-counts { display: grid; gap: .3rem; justify-items: end; }
@media (max-width: 560px) { .visit-card { grid-template-columns: auto minmax(0, 1fr); } .visit-counts { grid-column: 1 / -1; display: flex; justify-content: flex-start; } }
.visit-icon { display: grid; place-items: center; align-content: center; gap: 0; }
.visit-icon span { font-size: 1.3rem; font-weight: 800; line-height: 1; color: var(--ink); }
.visit-icon small { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.btn.is-disabled { opacity: .4; pointer-events: none; }
.visit-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 120px)) minmax(0, 1fr); gap: .75rem; margin-bottom: 1rem; }
.visit-summary .tile-stat { padding: .7rem .9rem; }
.tile-compare label { margin: 0; }
.tile-compare .hint { margin-top: .4rem; }
@media (max-width: 760px) { .visit-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tile-compare { grid-column: 1 / -1; } }
.status-normal-text { color: var(--normal); }
.status-high-text { color: var(--high); }
.status-low-text { color: var(--low); }
.visit-pheno { background: linear-gradient(135deg, #1B2530, #22313F); color: #E7ECF1; border-color: transparent; }
.visit-pheno .tile-eyebrow { color: #9AA5B1; }
.visit-pheno .tag { background: rgba(255, 255, 255, .08); color: #C9D1D9; }
.visit-pheno .tile-fine { color: #8D99A6; }
.visit-pheno-value { font-size: 2.2rem; font-weight: 800; color: #fff; }
.visit-table .group-row th { background: var(--surface-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: .5rem; }
.visit-table .group-row .cat-icon { vertical-align: -3px; margin-right: .25rem; }
.visit-table th[scope=row] a { color: var(--ink); font-weight: 600; text-decoration: none; }
.visit-table th[scope=row] a:hover { text-decoration: underline; }
.status-move { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- More (phone menu) ---------- */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.more-list { display: grid; gap: .5rem; }
.more-list a { display: flex; align-items: center; gap: .9rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); text-decoration: none; font-weight: 600; }
.more-list a .icon { width: 22px; height: 22px; color: var(--ink-2); }
.more-list small { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.more-list a.more-signout { color: var(--accent); }
.more-list a.more-signout .icon { color: var(--accent); }
.more-foot { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; font-size: 13px; }

/* ---------- Help & documentation ---------- */
.help-page { max-width: 1180px; }
.help-layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .help-layout { grid-template-columns: 230px minmax(0, 1fr); align-items: start; } .help-toc { position: sticky; top: 1rem; } }
.help-toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem 1rem; }
.help-toc-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: .4rem; }
.help-toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .15rem; font-size: 13.5px; }
.help-toc a { color: var(--ink-2); text-decoration: none; }
.help-toc a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 999px) { .help-toc ol { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.help-content { min-width: 0; }
.help-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.4rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); scroll-margin-top: 1rem; line-height: 1.6; }
.help-section h2 { font-size: 1.25rem; margin-bottom: .6rem; }
.help-section h3 { font-size: 1rem; margin: 1.1rem 0 .35rem; }
.help-section ul, .help-section ol { padding-left: 1.3rem; margin: .4rem 0 .8rem; }
.help-section li { margin: .3rem 0; }
.help-section code { font-family: var(--mono); font-size: .9em; background: var(--bg-2); padding: .05rem .3rem; border-radius: 4px; }
.steps li::marker { font-weight: 700; color: var(--accent); }
.callout { background: color-mix(in srgb, var(--teal) 8%, var(--surface)); border-left: 3px solid var(--teal); padding: .7rem .9rem; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: .8rem 0 0; }
.callout--warn { background: color-mix(in srgb, var(--high) 8%, var(--surface)); border-left-color: var(--high); }
.help-dl { margin: 0; display: grid; gap: .1rem; }
.help-dl dt { font-weight: 700; margin-top: .6rem; }
.help-dl dd { margin: .15rem 0 0; color: var(--ink-2); }
.help-table { max-width: 420px; margin: .5rem 0 .75rem; }
.help-section details { border: 1px solid var(--line); border-radius: var(--r); padding: .15rem .9rem; margin: .5rem 0; background: var(--surface-2); }
.help-section summary { cursor: pointer; font-weight: 600; padding: .55rem 0; list-style-position: outside; }
.help-section details[open] summary { border-bottom: 1px solid var(--line-2); margin-bottom: .4rem; }
.help-section details p { margin: .3rem 0 .7rem; color: var(--ink-2); }

/* =====================================================================
   Marketing website
   ===================================================================== */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem .9rem; z-index: 100; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }
.site-head {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1.5rem;
    padding: .75rem clamp(1rem, 4vw, 3rem); background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand img { height: 40px; width: auto; display: block; border-radius: 6px; }
.site-nav { display: flex; gap: .25rem; align-items: center; margin-left: 1rem; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px; padding: .45rem .7rem; border-radius: 8px; }
.site-nav a:hover { color: var(--ink); background: var(--bg-2); }
.site-nav a.active { color: var(--ink); background: var(--bg-2); }
.site-actions { display: flex; gap: .5rem; margin-left: auto; align-items: center; }
@media (max-width: 900px) { .site-nav { display: none; } }
@media (max-width: 480px) { .site-actions .btn-ghost { display: none; } .brand img { height: 32px; } }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-lg { min-height: 50px; padding: .8rem 1.35rem; font-size: 15.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.site-main { max-width: 1240px; padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; margin: 0 auto; }
.center { text-align: center; }
.fine { font-size: 13px; color: var(--ink-3); }
.kicker { display: inline-block; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 .5rem; }

/* hero */
.hero-x { display: grid; gap: 2.5rem; align-items: center; padding: clamp(2.5rem, 6vw, 5rem) 0 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1080px) { .hero-x { grid-template-columns: minmax(0, .95fr) minmax(0, 1.25fr); } }
.eyebrow-pill { display: inline-flex; align-items: center; gap: .5rem; font-size: 13px; font-weight: 700; color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); padding: .35rem .8rem; border-radius: 999px; margin: 0 0 1.1rem; }
.lock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 20%, transparent); }
.hero-x h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.04; letter-spacing: -.035em; margin: 0 0 1.1rem; }
.grad { background: linear-gradient(100deg, var(--accent), #D9764A 60%, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-x .lede { font-size: 1.12rem; line-height: 1.6; color: var(--ink-2); max-width: 36rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }
.trust-row { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.tick { color: var(--teal); font-weight: 800; margin-right: .25rem; }
.hero-x-visual { position: relative; padding-bottom: 2rem; }
.hero-browser { transform: perspective(1800px) rotateY(-6deg) rotateX(2deg); transform-origin: left center; box-shadow: 0 30px 80px rgba(27, 37, 48, .22); }
.hero-phone { position: absolute; width: 27%; right: -1%; bottom: -1rem; transform: rotate(3deg); }
@media (max-width: 1079px) { .hero-browser { transform: none; } .hero-phone { width: 30%; right: 2%; } }

/* screenshot frames */
.bframe { margin: 0; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(27, 37, 48, .14); }
.bframe-bar { display: flex; align-items: center; gap: 6px; padding: .55rem .8rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.bframe-bar i { width: 10px; height: 10px; border-radius: 50%; background: #E0685A; }
.bframe-bar i:nth-child(2) { background: #E8B34B; }
.bframe-bar i:nth-child(3) { background: #5FB8A4; }
.bframe-bar span { margin: 0 auto; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); padding-right: 36px; }
.bframe img { display: block; width: 100%; height: auto; }
.bframe figcaption { font-size: 13px; color: var(--ink-3); padding: .55rem .8rem; border-top: 1px solid var(--line-2); }
.pframe { margin: 0; border-radius: 34px; padding: 9px; background: #10161D; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.pframe img { display: block; width: 100%; height: auto; border-radius: 26px; }

/* dark band: how it works */
.band { margin: 2rem calc(-1 * clamp(1rem, 4vw, 2.5rem)); padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem); }
.band--ink { background: radial-gradient(1200px 400px at 10% 0%, #25384A 0%, transparent 60%), linear-gradient(160deg, #141D26, #1B2530); color: #DCE3EA; border-radius: 28px; }
.band-inner { max-width: 1100px; margin: 0 auto; }
.band--ink .kicker { color: #F0A08F; }
.band--ink h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -.02em; color: #fff; max-width: 48rem; }
.band-lede { font-size: 1.08rem; color: #B8C3CE; max-width: 46rem; margin-top: .8rem; }
.flow { list-style: none; padding: 0; margin: 2.2rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: none; }
.flow li { position: relative; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-radius: 18px; padding: 1.3rem 1.3rem 1.2rem; }
.flow-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #E0685A, #B03A2E); color: #fff; font-weight: 800; margin-bottom: .7rem; }
.flow h3 { color: #fff; font-size: 1.1rem; margin-bottom: .35rem; }
.flow p { color: #AEB9C4; margin: 0; }
.seecant { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.seecant-col { border-radius: 18px; padding: 1.2rem 1.4rem; }
.seecant-col h3 { font-size: 1.05rem; margin-bottom: .6rem; color: #fff; }
.seecant-col ul { margin: 0; padding-left: 1.2rem; color: #C9D2DB; }
.seecant-col li { margin: .3rem 0; }
.seecant--cant { background: rgba(95, 184, 164, .12); border: 1px solid rgba(95, 184, 164, .35); }
.seecant--can { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); }
.seecant a { color: #9FD6BC; }
.band-note { margin-top: 1.6rem; color: #B8C3CE; }
.band-note a { color: #F0B98A; font-weight: 600; }

/* sections */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0 1rem; scroll-margin-top: 80px; }
.section--narrow { max-width: 900px; margin: 0 auto; }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); letter-spacing: -.02em; margin: 0 0 1.6rem; max-width: 44rem; }
.section > .kicker + .section-title, .section > .section-title { }
.why-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.why-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.why-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.why-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); margin-bottom: .8rem; }
.why-icon .icon { width: 22px; height: 22px; }
.why-card h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.why-card p { color: var(--ink-2); margin: 0; }

.showcase { display: grid; gap: 2rem; align-items: center; grid-template-columns: minmax(0, 1fr); margin: 2.5rem 0 3.5rem; }
@media (min-width: 980px) { .showcase { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 3rem; } .showcase--flip > .showcase-copy { order: 2; } }
.showcase-copy h2, .showcase-copy h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); letter-spacing: -.015em; margin-bottom: .7rem; }
.showcase-copy p { color: var(--ink-2); font-size: 1.02rem; }
.check-list { list-style: none; padding: 0; margin: .8rem 0 1.2rem; display: grid; gap: .45rem; }
.check-list li { position: relative; padding-left: 1.7rem; color: var(--ink-2); }
.check-list li::before { content: ""; position: absolute; left: 0; top: .2rem; width: 17px; height: 17px; border-radius: 50%; background: color-mix(in srgb, var(--teal) 16%, var(--surface)); }
.check-list li::after { content: ""; position: absolute; left: 5.5px; top: .42rem; width: 5px; height: 8px; border: solid var(--teal); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check-list--2col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.showcase-phones { display: grid; gap: 2rem; align-items: center; grid-template-columns: minmax(0, 1fr); margin: 2rem 0; }
@media (min-width: 980px) { .showcase-phones { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); } }
.phones { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 1.5rem; justify-content: center; }
.phones .pframe:last-child { transform: translateY(2rem); }
.shot-pair { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; margin-bottom: 2rem; }

/* pricing */
.price-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); align-items: stretch; max-width: 1080px; margin: 0 auto 1rem; }
.price-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1.6rem 1.5rem; box-shadow: var(--shadow-sm); }
.price-card h3 { font-size: 1.2rem; }
.price-card .check-list { flex: 1; }
.price-card--featured { border: 2px solid var(--accent); box-shadow: 0 20px 50px color-mix(in srgb, var(--accent) 16%, transparent); }
.price-flag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; padding: .25rem .8rem; border-radius: 999px; white-space: nowrap; }
.price { margin: .6rem 0 .2rem; }
.price .amt { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; }
.price .per { color: var(--ink-3); font-weight: 600; }
.price-sub { font-size: 13.5px; color: var(--ink-3); margin-bottom: .5rem; min-height: 2.6em; }
.check-list li.planned { color: var(--ink-3); }
.tag-planned { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: .1rem .45rem; border-radius: 999px; background: var(--bg-2); color: var(--ink-3); margin-left: .25rem; vertical-align: 1px; }
.compare { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 14px; }
.compare th, .compare td { padding: .7rem .9rem; border-bottom: 1px solid var(--line-2); text-align: center; }
.compare th[scope=row] { text-align: left; font-weight: 500; color: var(--ink-2); }
.compare thead th { font-size: 15px; font-weight: 800; background: var(--surface-2); }
.compare .is-featured { background: color-mix(in srgb, var(--accent) 5%, transparent); font-weight: 700; }
.compare thead .is-featured { color: var(--accent); }
.compare .grp th { text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--bg); }

/* faq */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .2rem 1.2rem; margin: 0 0 .6rem; }
.faq summary { cursor: pointer; font-weight: 700; padding: .9rem 0; font-size: 1.02rem; }
.faq details[open] summary { border-bottom: 1px solid var(--line-2); margin-bottom: .6rem; }
.faq details p { color: var(--ink-2); margin: .3rem 0 .9rem; }

/* cta band */
.cta-band { text-align: center; margin: 4rem 0 1rem; padding: clamp(2.5rem, 6vw, 4rem) 1.5rem; border-radius: 28px; background: radial-gradient(900px 300px at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--brand); color: #fff; }
.cta-band h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.02em; max-width: 40rem; margin: 0 auto .6rem; color: #fff; }
.cta-band p { color: #B8C3CE; margin-bottom: 1.4rem; }

/* inner pages */
.page-hero { text-align: center; max-width: 880px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 4.5rem) 0 .5rem; }
.page-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); letter-spacing: -.03em; line-height: 1.08; margin-bottom: 1rem; }
.page-hero .lede { font-size: 1.1rem; color: var(--ink-2); }
.lede-sm { color: var(--ink-2); margin-top: -1rem; margin-bottom: 1.5rem; }
.jump { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: 1.6rem; }
.jump a { font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--ink-2); padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.jump a:hover { border-color: var(--ink-3); color: var(--ink); }
.two-col { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.info-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem; }
.info-card h3 { margin-bottom: .5rem; }
.info-card p { color: var(--ink-2); }
.catalog-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.catalog-col { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; }
.catalog-col h3 { font-size: .95rem; margin-bottom: .5rem; color: var(--accent); }
.catalog-col ul { margin: 0; padding-left: 1.1rem; font-size: 14px; color: var(--ink-2); }
.catalog-col li { margin: .15rem 0; }
.plain-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plain-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem; }
.plain-card > .icon { width: 30px; height: 30px; color: var(--teal); margin-bottom: .6rem; }
.plain-card h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.plain-card p { color: var(--ink-2); margin: 0; }
.timeline-steps { list-style: none; padding: 0 0 0 1.4rem; margin: 0; border-left: 2px solid var(--line); counter-reset: step; }
.timeline-steps li { position: relative; padding: 0 0 1.4rem 1rem; counter-increment: step; }
.timeline-steps li::before { content: counter(step); position: absolute; left: -2.35rem; top: -.1rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; }
.timeline-steps h3 { font-size: 1.08rem; margin-bottom: .3rem; }
.timeline-steps p { color: var(--ink-2); margin: 0; }
.spec { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 14.5px; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: .85rem 1rem; border-bottom: 1px solid var(--line-2); }
.spec th { width: 30%; font-weight: 700; background: var(--surface-2); }
.spec td { color: var(--ink-2); }
.limits { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 1rem; }
.limits > div { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--high); border-radius: 14px; padding: 1rem 1.2rem; }
.limits h3 { font-size: 1rem; margin-bottom: .3rem; }
.limits p { color: var(--ink-2); margin: 0; font-size: 14.5px; }
.principles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.principles article { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.3rem; }
.principles h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.principles p { color: var(--ink-2); margin: 0; }
.prose { max-width: 760px; margin: 0 auto; }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 2.5rem clamp(1rem, 4vw, 3rem) 1.5rem; margin-top: 3rem; color: var(--ink-2); font-size: 14px; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); max-width: 1180px; margin: 0 auto; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-brand { grid-column: 1 / -1; } }
.foot-brand img { height: 38px; width: auto; border-radius: 6px; margin-bottom: .6rem; }
.foot-brand p { max-width: 22rem; color: var(--ink-3); }
.site-foot nav { display: grid; gap: .45rem; align-content: start; }
.site-foot nav h2 { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .2rem; }
.site-foot nav a { color: var(--ink-2); text-decoration: none; }
.site-foot nav a:hover { color: var(--accent); text-decoration: underline; }
.foot-fine { max-width: 1180px; margin: 2rem auto 0; padding-top: 1.2rem; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); }

/* site polish */
@media (min-width: 980px) { .showcase--flip { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); } }
@media (min-width: 900px) { .why-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mnav { display: none; position: relative; }
@media (max-width: 900px) { .mnav { display: block; } }
.mnav summary { list-style: none; cursor: pointer; font-weight: 700; font-size: 14px; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mnav summary::-webkit-details-marker { display: none; }
.mnav nav { position: absolute; right: 0; top: calc(100% + .5rem); display: grid; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 50; }
.mnav nav a { padding: .65rem .8rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.mnav nav a:hover { background: var(--bg-2); }

/* ---------- website: white pages (matches the logo's white background) ---------- */
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .site { --bg: #FFFFFF; --bg-2: #F3F4F6; --surface-2: #F8F9FA; --line: #E5E7EB; --line-2: #F0F1F3; } }
:root[data-theme="light"] .site { --bg: #FFFFFF; --bg-2: #F3F4F6; --surface-2: #F8F9FA; --line: #E5E7EB; --line-2: #F0F1F3; }
.site { background: var(--bg); min-height: 100vh; }
.site .why-card, .site .price-card, .site .plain-card, .site .info-card, .site .catalog-col, .site .principles article, .site .faq details, .site .help-section, .site .help-toc { box-shadow: 0 1px 3px rgba(17, 24, 39, .06); }

/* Logo (transparent, trimmed to the artwork): the same 44px everywhere on desktop — header, footer and the
   app sidebar. The header keeps its previous height at every breakpoint (77 / 65 / 61px): the larger logo takes
   the space from the padding. Below 900px the 42px "Start free" button sets the row height, so the padding is
   measured from that. */
.brand img, .foot-brand img, .brand-logo { border-radius: 0; }
.site-head { padding-top: 17px; padding-bottom: 17px; }
.site-head .brand img { height: 42px; width: auto; }
@media (max-width: 900px) { .site-head { padding-top: 11px; padding-bottom: 11px; } .site-head .brand img { height: 40px; } }
@media (max-width: 480px) { .site-head { padding-top: 9px; padding-bottom: 9px; } .site-head .brand img { height: 32px; } }
.foot-brand img { height: 42px; width: auto; }

/* hero: text always above the screenshot, headline scales to its column */
.hero-x-copy { position: relative; z-index: 2; min-width: 0; }
.hero-x-visual { z-index: 1; min-width: 0; }
.hero-x h1 { font-size: clamp(2.3rem, 4.4vw, 3.7rem); overflow-wrap: break-word; }
@media (min-width: 1080px) { .hero-browser { transform: perspective(1800px) rotateY(-6deg) rotateX(2deg) translateX(3%); } }
.site { overflow-x: clip; }
.site .help-page { padding-top: clamp(1.5rem, 4vw, 3rem); }

/* ---------- contact ---------- */
.contact-page { max-width: 720px; margin: 0 auto; padding: clamp(2.5rem, 6vw, 4.5rem) 0 1rem; }
.contact-page h1 { font-size: clamp(2.2rem, 4.6vw, 3rem); letter-spacing: -.03em; margin-bottom: .8rem; }
.contact-page .lede { color: var(--ink-2); font-size: 1.08rem; }
.contact-form { display: grid; gap: 1.1rem; margin-top: 1.5rem; }
.contact-form .field label { display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: .4rem; }
.contact-form input, .contact-form select, .contact-form textarea { width: 100%; margin: 0; }
.contact-form textarea { resize: vertical; min-height: 150px; }
.field-row { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field-hints { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .3rem; font-size: 12.5px; color: var(--ink-3); }
.validation-message { color: var(--high); font-size: 12.5px; margin-top: .3rem; }
.contact-form .invalid { border-color: var(--high); }
.contact-form button { justify-self: start; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.thanks { max-width: 560px; margin: 0 auto; text-align: center; padding: clamp(3rem, 8vw, 6rem) 0 2rem; }
.thanks-icon { width: 60px; height: 60px; margin: 0 auto 1.2rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--teal) 14%, var(--surface)); color: var(--teal); }
.thanks-icon .icon { width: 30px; height: 30px; }
.thanks h1 { font-size: 2.2rem; margin-bottom: .6rem; }
.cta-row--center { justify-content: center; }

/* ---------- admin inbox ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 .4rem; border-radius: 999px; background: #E0685A; color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.inbox-tabs { margin-bottom: 1rem; }
.inbox-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 6px; color: var(--ink-3); text-decoration: none; font-weight: 600; font-size: 13px; }
.inbox-tabs a.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.inbox-item article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.2rem; box-shadow: var(--shadow-sm); }
.inbox-item.is-open article { border-left: 4px solid var(--accent); }
.inbox-item.is-handled article { opacity: .85; }
.inbox-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; font-size: 12.5px; color: var(--ink-3); }
.inbox-reason { font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.inbox-subject { font-size: 1.05rem; margin: .4rem 0 .15rem; }
.inbox-from { font-size: 13.5px; color: var(--ink-2); margin: 0 0 .6rem; overflow-wrap: anywhere; }
.inbox-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: .75rem .9rem; font-size: 14px; color: var(--ink); }
.inbox-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; }
.inbox-actions form { margin: 0; display: inline-flex; align-items: center; gap: .5rem; }
.inbox-delete summary { list-style: none; cursor: pointer; }
.inbox-delete summary::-webkit-details-marker { display: none; }
.inbox-delete[open] { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inbox-delete[open] form span { font-size: 13px; color: var(--high); }

/* ---------------- Plans, usage & profiles ---------------- */
.notice--ok { color: var(--ink); font-weight: 600; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.plan-current { margin: .1rem 0 .25rem; color: var(--ink-2); font-size: 14px; }
.plan-badge { display: inline-block; font-weight: 800; font-size: 13px; letter-spacing: .03em; padding: .15rem .6rem; border-radius: 999px; background: var(--bg-2); color: var(--ink); margin-right: .25rem; }
.plan-badge--plus { background: color-mix(in srgb, var(--teal) 16%, var(--surface)); color: var(--teal); }
.plan-badge--pro { background: var(--brand); color: var(--brand-ink); }
.usage { display: grid; gap: .7rem; margin: .9rem 0 .5rem; }
.usage-row { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .35rem 1rem; align-items: center; }
.usage-row dt { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.usage-row dd { margin: 0; display: grid; gap: .3rem; }
.usage-num { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.usage-num b { color: var(--ink); font-family: var(--mono); font-size: 14px; }
.usage-bar { display: block; height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--teal); transition: width .4s ease; }
.usage-bar.is-near > span { background: var(--high); }
.usage-bar.is-full > span { background: var(--accent); }
.usage-bar.is-unlimited { background: repeating-linear-gradient(135deg, var(--bg-2) 0 6px, color-mix(in srgb, var(--teal) 14%, var(--bg-2)) 6px 12px); }
.usage-bar.is-unlimited > span { display: none; }
@media (max-width: 560px) { .usage-row { grid-template-columns: 1fr; } }
.plan-upgrade { border-top: 1px solid var(--line-2); margin-top: 1rem; padding-top: 1rem; }
.plan-upgrade .segmented small { font-weight: 600; color: var(--teal); margin-left: .25rem; }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin: .85rem 0 .5rem; }
.plan-option { border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .35rem; background: var(--surface-2); }
.plan-option.is-featured { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.plan-option h3 { margin: 0; font-size: 1.05rem; }
.plan-price { margin: 0; font-weight: 800; font-size: 1.15rem; }
.plan-option .check-list { margin: .25rem 0 .6rem; flex: 1; font-size: 13.5px; }
.upgrade-notice { display: flex; gap: 1rem; align-items: flex-start; }
.upgrade-notice-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); }
.upgrade-notice p { color: var(--ink-2); margin: .25rem 0 .75rem; max-width: 60ch; }
.person-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 1rem; }
.person-switcher-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-right: .15rem; }
.person-switcher-note { font-size: 12.5px; color: var(--high); margin-left: .25rem; }
.person-chip { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .2rem .7rem .2rem .25rem; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.person-chip:hover { border-color: var(--ink-3); }
.person-chip.is-on { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.avatar.avatar--xs, .avatar--xs { width: 24px; height: 24px; font-size: 10.5px; grid-area: auto; }
.people-list { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .5rem; }
.people-list li { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: var(--r); padding: .55rem .75rem; }
.people-list li.is-on { border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); background: color-mix(in srgb, var(--teal) 5%, var(--surface)); }
.people-list .avatar { width: 36px; height: 36px; font-size: 13px; grid-area: auto; }
.people-main { flex: 1; min-width: 8rem; display: grid; }
.people-main small { color: var(--ink-3); font-size: 12.5px; }
.people-list .inbox-delete > div { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; font-size: 13px; color: var(--accent); }
.add-person { border-top: 1px solid var(--line-2); padding-top: .9rem; margin-top: .5rem; }
.add-person h3 small { font-weight: 500; color: var(--ink-3); font-size: 13px; }

/* ---------------- Signup steps & one-time code ---------------- */
.auth-steps { list-style: none; display: flex; gap: .4rem; padding: 0; margin: 0 0 1.1rem; counter-reset: step; }
.auth-steps li { flex: 1; counter-increment: step; font-size: 12px; font-weight: 700; color: var(--ink-3); padding-top: .45rem; border-top: 3px solid var(--line); }
.auth-steps li::before { content: counter(step) ". "; }
.auth-steps li.is-current { color: var(--ink); border-top-color: var(--accent); }
.auth-steps li.is-done { color: var(--teal); border-top-color: var(--teal); }
.otp-input { font-family: var(--mono); font-size: 1.6rem; letter-spacing: .5em; text-align: center; padding: .55rem .6rem; }
.otp-input::placeholder { color: var(--line); }
.auth-alt .link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.auth-alt .link-btn:disabled { color: var(--ink-3); cursor: default; }

/* ---------------- Admin security page & CAPTCHA ---------------- */
.cf-turnstile { margin: .25rem 0 .9rem; min-height: 65px; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.sec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sec-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
.sec-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.sec-table tr.is-suspect td { background: color-mix(in srgb, var(--high) 8%, var(--surface)); }
.sec-table .inbox-delete[open] form { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .3rem; }
.sec-table .inbox-delete input { font-size: 12px; padding: .2rem .4rem; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.outcome { font-weight: 700; font-size: 12px; }
.outcome--ok { color: var(--normal); }
.outcome--bad { color: var(--high); }
.block-form { display: grid; grid-template-columns: 160px 1fr 1fr auto; gap: .6rem; align-items: end; margin-top: 1rem; }
@media (max-width: 720px) { .block-form { grid-template-columns: 1fr; } }

/* ---------------- Passkey unlock ---------------- */
.pk-unlock { margin: .25rem 0 .5rem; }
.pk-unlock .icon { width: 18px; height: 18px; }
.auth-or { display: flex; align-items: center; gap: .75rem; color: var(--ink-3); font-size: 12.5px; margin: .75rem 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.pk-list { list-style: none; padding: 0; margin: .75rem 0; display: grid; gap: .5rem; }
.pk-list li { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: var(--r); padding: .55rem .75rem; }
.pk-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); flex: none; }
.pk-main { flex: 1; min-width: 10rem; }
.pk-main small { display: block; color: var(--ink-3); font-size: 12.5px; }
.pk-list .inbox-delete > div { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; font-size: 13px; }
.pk-wizard { border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line)); background: color-mix(in srgb, var(--teal) 5%, var(--surface)); border-radius: var(--r); padding: .9rem 1rem; margin-top: .5rem; }
.pk-wizard h3 { margin: 0 0 .5rem; font-size: 1rem; }
.pk-points { margin: 0 0 .8rem; padding-left: 1.1rem; display: grid; gap: .35rem; font-size: 13.5px; color: var(--ink-2); }
.pk-points b { color: var(--ink); }

.panel[id] { scroll-margin-top: 76px; }

/* ---------------- App shell: light sidebar + top bar (the full logo is dark navy) ----------------
   White, like the website's pages and header where the logo already sits, with a hairline divider.
   Widened so the logo can be the same 44px as in the website header. */
:root { --sidebar-w: 296px; }
.sidebar { background: var(--surface); color: var(--ink-2); border-right: 1px solid var(--line); }
.sidebar-brand { justify-content: center; padding: .15rem 0 .35rem; margin: 0 -.75rem; } /* uses part of the side padding so the 44px logo (and its dark-theme plate) fits */
.sidebar .brand-logo { height: 42px; width: auto; display: block; }
.sidebar-head { display: grid; justify-items: center; gap: .3rem; }
.sidebar-back { font-size: 12.5px; color: var(--ink-3); text-decoration: none; }
.sidebar-back:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.sidebar-nav a { color: var(--ink-2); }
.sidebar-nav a:hover { background: var(--bg-2); color: var(--ink); }
.sidebar-nav a.active { background: var(--bg-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-nav--account { border-top-color: var(--line); }
.sidebar-nav a.signout { color: var(--accent); }
.sidebar-nav a.signout:hover { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); color: var(--accent); }
.sidebar-lock { color: var(--ink-3); background: var(--bg-2); }
.sidebar-lock .icon { color: var(--teal); }
.sidebar-foot a { color: var(--ink-3); }
.topbar { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar .brand-logo { height: 30px; width: auto; display: block; }
.topbar-signout { color: var(--ink-2); }
.topbar-signout:hover { background: var(--bg-2); color: var(--ink); }
.topbar-lock { color: var(--teal); }

/* Logo per theme: each spot carries both versions (same crop box, so nothing shifts) and CSS shows one.
   Follows the device setting, or the choice in Settings → Appearance (data-theme). */
.logo-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-light { display: none !important; }
    :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
.more-back { font-size: 13px; color: var(--ink-3); text-decoration: none; align-self: center; }
.more-back:hover { color: var(--accent); text-decoration: underline; }
