/* ==========================================================================
   CueVue Bonus — components. Tokens live in tokens.css.
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { background: var(--paper); }
body { margin: 0; font-family: var(--font); font-size: 13px; line-height: 1.5; color: var(--ink-2); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--orange-ink); }
:focus-visible { outline: 2px solid var(--orange-ink); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s; }
.btn:hover { box-shadow: var(--sh-sm); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: linear-gradient(140deg, var(--orange-2), var(--orange-deep)); box-shadow: var(--sh-cta); color: #fff; border: 0; }
.btn-primary:hover { box-shadow: 0 18px 30px -10px rgba(233, 108, 15, .6); }
.btn-primary:active { background: var(--orange-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper); box-shadow: none; }
.btn-danger { color: var(--red-ink); border-color: var(--red-soft); }
.btn-danger:hover { background: var(--red-soft); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn-block { width: 100%; height: 46px; font-size: 14px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r2); border: 1px solid var(--line); background: var(--card); color: var(--ink-2); position: relative; text-decoration: none; }
.icon-btn:hover { color: var(--ink); box-shadow: var(--sh-sm); }
.link-btn { border: 0; background: none; padding: 0; color: var(--orange-ink); font-weight: 600; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12px; font-weight: 600; color: var(--ink); }
.hint { font-size: 11.5px; color: var(--muted-ink); }
.field-error { font-size: 11.5px; color: var(--red-ink); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 13px; border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--card); font-size: 13px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 13px; resize: vertical; }
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: none; border-color: var(--orange-ink); box-shadow: 0 0 0 4px rgba(245, 130, 30, .2); }
.input[readonly] { background: var(--paper); color: var(--ink-2); }
.input.is-invalid { border-color: var(--red-2); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .lead { position: absolute; left: 13px; color: var(--muted-ink); pointer-events: none; }
.input-wrap .lead ~ .input { padding-left: 40px; }
.input-wrap .trail { position: absolute; right: 4px; width: 36px; height: 34px; border: 0; background: transparent; border-radius: 10px; color: var(--muted-ink); display: grid; place-items: center; }
.input-wrap .trail:hover { color: var(--ink); background: var(--paper); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-2 .span { grid-column: 1 / -1; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { appearance: none; flex: none; width: 18px; height: 18px; margin: 1px 0 0; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s; }
.check input:checked { background: var(--orange); border-color: var(--orange); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check small { display: block; color: var(--muted-ink); font-size: 11.5px; }

.switch { appearance: none; flex: none; width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--line-2); position: relative; cursor: pointer; transition: background .2s var(--ease); margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(90, 55, 10, .3); transition: transform .2s var(--ease); }
.switch:checked { background: var(--mint-2); }
.switch:checked::after { transform: translateX(16px); }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--mint); color: var(--mint-ink); }
.pill.wait { background: var(--yellow); color: var(--yellow-ink); }
.pill.off { background: var(--red-soft); color: var(--red-ink); }
.pill.neutral { background: var(--paper-2); color: var(--ink-2); }


.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-ink); }

/* ---------- alerts (flash messages) ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r2); font-size: 13px; font-weight: 500; }
.alert svg.i { margin-top: 1px; }
.alert-success { background: var(--mint); color: var(--mint-ink); }
.alert-error { background: var(--red-soft); color: var(--red-ink); }
.alert-info { background: var(--card); color: var(--ink-2); border: 1px solid var(--line); }
.alert a { color: inherit; font-weight: 700; word-break: break-all; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 22px 0; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-head p { font-size: 12px; color: var(--muted-ink); }
.card-body { padding: 18px 22px 22px; }
.form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { width: 46px; height: 46px; flex: none; border-radius: var(--r2); display: grid; place-items: center; overflow: hidden; background: linear-gradient(140deg, var(--orange-2), var(--orange-deep)); box-shadow: var(--sh-cta); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.01em; line-height: 1.1; white-space: nowrap; }
.brand-name span { display: block; font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink); }

/* CueVue logo lockup: full logo with "Lead Finder" under the wordmark; the mark alone in the collapsed rail */
.brand-icon { width: 44px; height: 44px; flex: none; object-fit: contain; }
.brand-lockup { display: inline-flex; flex-direction: column; align-items: stretch; gap: 7px; min-width: 0; }
.brand-logo { display: block; height: 26px; width: auto; max-width: 100%; }
.brand-sub { padding-left: var(--cuevue-wordmark-indent); font-size: 10.5px; font-weight: 700; line-height: 1; letter-spacing: .24em; text-transform: uppercase; color: var(--cuevue-red); white-space: nowrap; }
.rail .brand { min-height: 46px; }
.rail .brand-lockup { display: none; }
.app.is-open .rail .brand-lockup { display: inline-flex; }
.app.is-open .rail .brand-icon { display: none; }
.drop .brand-mark { background: var(--card); box-shadow: none; border: 1px solid var(--line); }
.drop .brand-mark img { object-fit: contain; padding: 8px; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--gap); padding-block: var(--gap); padding-inline: max(16px, var(--gap)); }
.auth-art { position: relative; overflow: hidden; border-radius: 30px; background: linear-gradient(140deg, var(--orange-2), var(--orange-deep)); color: #fff; padding: clamp(24px, 4vw, 48px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; box-shadow: var(--sh-cta); }
.auth-art::before { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; border: 56px solid rgba(255, 255, 255, .1); }
.auth-art::after { content: ""; position: absolute; right: 40px; bottom: -160px; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.auth-art > * { position: relative; z-index: 1; }
.auth-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.auth-badge svg { width: 24px; height: 24px; padding: 5px; border-radius: 50%; background: #fff; color: var(--orange-deep); }
.auth-art h2 { color: #fff; font-family: var(--display); font-weight: 600; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.08; letter-spacing: -.02em; max-width: 15ch; }
.auth-art .lede { font-size: 15px; color: #FFF3E6; max-width: 42ch; margin-top: 14px; }
.vault { display: grid; gap: 8px; max-width: 400px; }
.vault-row { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--r2); padding: 10px 14px; }
.vault-row .k { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--orange-deep); }
.vault-row b { color: #fff; font-size: 13px; font-weight: 700; }
.vault-row small { display: block; color: #FFE9D1; font-size: 11.5px; }
.auth-form { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: clamp(8px, 3vw, 40px); }
.auth-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: clamp(24px, 3vw, 38px); }
.auth-brand { align-self: flex-start; padding-bottom: 22px; margin-bottom: 2px; border-bottom: 1px solid var(--line); width: 100%; }
.auth-brand .brand-logo { height: 30px; }
.auth-card h1 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; }
.auth-head .eyebrow { color: var(--orange-ink); }
.auth-card .receipt-note { background: var(--paper); border-color: transparent; }
.auth-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-ink); }
.auth-foot svg { width: 14px; height: 14px; }
.auth-card .sub { color: var(--muted-ink); font-size: 13.5px; margin-top: 6px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-family: var(--mono); font-size: 12px; }
.link { color: var(--orange-ink); font-weight: 600; text-decoration: none; font-size: 12.5px; }
.link:hover { text-decoration: underline; }
.receipt-note { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; font-size: 12px; color: var(--ink-2); }
.receipt-note svg { color: var(--orange-deep); margin-top: 1px; }

/* ---------- app shell & rail ---------- */
.app { display: flex; align-items: flex-start; min-height: 100vh; }
.rail { position: sticky; top: 0; z-index: 100; height: 100vh; flex: 0 0 var(--rail-collapsed); width: var(--rail-collapsed); padding: 22px 19px; display: flex; flex-direction: column; gap: 22px; background: var(--card); box-shadow: var(--sh-sm); border-radius: 0 var(--r-lg) var(--r-lg) 0; transition: width .28s var(--ease), flex-basis .28s var(--ease), padding .28s var(--ease); overflow: hidden; }
.app.is-open .rail { flex-basis: var(--rail-expanded); width: var(--rail-expanded); padding: 22px 16px; }
.rail-label, .rail .brand-name { opacity: 0; white-space: nowrap; transition: opacity .18s var(--ease); }
.app.is-open .rail-label, .app.is-open .rail .brand-name { opacity: 1; transition-delay: .08s; }
.rail-group { display: flex; flex-direction: column; gap: 4px; }
.rail-group .eyebrow { height: 16px; padding-left: 14px; font-size: 10px; white-space: nowrap; opacity: 0; transition: opacity .18s; }
.app.is-open .rail-group .eyebrow { opacity: 1; }
.rail-item { display: flex; align-items: center; gap: 13px; height: 46px; padding: 0 14px; border-radius: var(--r2); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 13px; border: 0; background: transparent; width: 100%; text-align: left; transition: background .15s, color .15s; }
.rail-item:hover { background: var(--paper); color: var(--ink); }
.rail-form { display: contents; }
button.rail-item { font: inherit; font-weight: 600; cursor: pointer; }
.rail-item[aria-current="page"] { background: var(--peach); color: var(--orange-ink-strong); }
.rail-item[aria-current="page"] svg { color: var(--orange-deep); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.rail-toggle svg { transition: transform .28s var(--ease); }
.app:not(.is-open) .rail-toggle svg { transform: rotate(180deg); }

.main { flex: 1; min-width: 0; padding-block: 22px 48px; padding-inline: max(16px, var(--gap)); display: flex; flex-direction: column; gap: var(--gap); }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .crumbs { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.search { width: min(280px, 100%); }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.me b { font-size: 12.5px; font-weight: 700; display: block; line-height: 1.2; }
.me small { font-size: 11px; color: var(--muted-ink); display: block; line-height: 1.2; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 11.5px; letter-spacing: .02em; }
.av-orange { background: linear-gradient(140deg, var(--orange-2), var(--orange-deep)); color: #fff; }
.av-lav { background: var(--lav); color: var(--lav-ink); }
.av-blue { background: var(--blue); color: var(--blue-ink); }
.av-mint { background: var(--mint); color: var(--mint-ink); }
.av-yellow { background: var(--yellow); color: var(--yellow-ink); }
.av-purple { background: var(--purple); color: var(--purple-ink); }
.av-peach { background: var(--peach); color: var(--orange-ink); }
.view { display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- page intro ---------- */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hello h2 { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 2.6vw, 30px); letter-spacing: -.02em; line-height: 1.1; }
.hello p { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.hello p strong { color: var(--orange-ink); }

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stat { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-ico { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.stat-ico.orange { background: var(--peach); color: var(--orange-deep); }
.stat-ico.lav { background: var(--lav); color: var(--lav-2); }
.stat-ico.mint { background: var(--mint); color: var(--mint-2); }
.stat-ico.yellow { background: var(--yellow); color: var(--yellow-ink); }
.stat-val { font-family: var(--display); font-weight: 600; font-size: 32px; line-height: 1; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.stat-label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.delta { font-size: 11.5px; font-weight: 600; color: var(--mint-ink); display: inline-flex; align-items: center; gap: 4px; }
.delta.flat { color: var(--muted-ink); }
.delta.warn { color: var(--yellow-ink); }
.stat.attention { box-shadow: var(--sh), inset 0 0 0 1.5px var(--yellow-2); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--gap); }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.legend-line { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted-ink); }
.legend-line b { font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--ink); display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 48px; align-items: center; gap: 12px; }
.bar-track { height: 10px; border-radius: var(--r-pill); background: var(--paper-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--orange-2), var(--orange-deep)); }
.bar-row .v { text-align: right; font-weight: 700; color: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bars-foot { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--muted-ink); }
.bars-foot b { color: var(--ink); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
table.data th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-ink); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: #FFFBF5; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th:first-child, table.data td:first-child { padding-left: 22px; }
table.data th:last-child, table.data td:last-child { padding-right: 22px; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who b { display: block; color: var(--ink); font-weight: 700; font-size: 13px; white-space: nowrap; }
.who small { display: block; color: var(--muted-ink); font-size: 11.5px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; border-radius: 10px; }
.row-actions svg.i { width: 15px; height: 15px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted-ink); }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

/* ---------- users ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 22px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 13px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); font-size: 12px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.chip .count { font-size: 11px; color: var(--muted-ink); font-variant-numeric: tabular-nums; }
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-current="true"] .count { color: #D8CDB9; }
.toolbar form.search { margin-left: auto; }
.bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 22px; background: var(--peach); color: var(--orange-ink); font-weight: 600; font-size: 12.5px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted-ink); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 12px; font-weight: 600; display: grid; place-items: center; color: var(--ink-2); text-decoration: none; }
.pager a[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager span { border-color: transparent; background: transparent; }

/* ---------- drawer & modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(36, 27, 18, .32); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 210; width: min(540px, 100%); background: var(--paper); box-shadow: -30px 0 60px -30px rgba(90, 55, 10, .4); display: flex; flex-direction: column; transform: translateX(102%); visibility: hidden; transition: transform .3s var(--ease), visibility 0s linear .3s; padding-top: env(safe-area-inset-top, 0px); }
body.drawer-open .backdrop, body.modal-open .backdrop { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: none; visibility: visible; transition: transform .3s var(--ease); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 16px; }
.drawer-head h2 { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: -.01em; }
.drawer-head p { color: var(--muted-ink); font-size: 12.5px; margin-top: 4px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
/* Sections keep their full height and the body scrolls; otherwise they squash and overlap */
.drawer-body > * { flex-shrink: 0; }
/* The page behind an open drawer or dialog doesn't scroll along */
body.drawer-open, body.modal-open { overflow: hidden; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-2); background: var(--card); }
.panel { background: var(--card); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--sh-sm); }
.panel h3 { font-size: 13.5px; font-weight: 700; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.modal { position: fixed; left: 50%; top: 50%; z-index: 220; width: min(420px, calc(100% - 32px)); transform: translate(-50%, -46%); opacity: 0; visibility: hidden; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 24px; display: flex; flex-direction: column; gap: 14px; transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s; }
body.modal-open .modal.is-active { opacity: 1; visibility: visible; transform: translate(-50%, -50%); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.modal h2 { font-family: var(--display); font-weight: 600; font-size: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.secret { display: flex; gap: 8px; }
.secret .input { font-family: var(--mono); font-size: 14px; letter-spacing: .04em; }

/* ---------- profile ---------- */
.profile { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.id-card { padding: 26px 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.id-card .avatar { width: 84px; height: 84px; font-size: 28px; font-family: var(--display); font-weight: 600; box-shadow: var(--sh-cta); }
.id-card h2 { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: -.01em; word-break: break-word; }
.kv { width: 100%; display: flex; flex-direction: column; margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.kv dt { color: var(--muted-ink); }
.kv dd { margin: 0; color: var(--ink); font-weight: 600; text-align: right; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.strength { display: flex; gap: 4px; margin-top: 2px; }
.strength i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .2s; }
.strength i.on { background: var(--mint-2); }
.session { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.session:first-child { border-top: 0; padding-top: 0; }
.session .stat-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--paper); color: var(--ink-2); }
.session b { color: var(--ink); font-size: 12.5px; display: block; }
.session small { color: var(--muted-ink); font-size: 11.5px; }
.session .end { margin-left: auto; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.tabs { padding: 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 22px; }
.tab { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r2); border: 0; background: transparent; text-align: left; width: 100%; color: var(--ink-2); text-decoration: none; }
.tab b { display: block; font-size: 13px; font-weight: 600; color: inherit; }
.tab small { display: block; font-size: 11px; color: var(--muted-ink); }
.tab:hover { background: var(--paper); }
.tab[aria-current="page"] { background: var(--peach); color: var(--orange-ink-strong); }
.tab[aria-current="page"] small { color: var(--orange-ink-strong); }
.tab .stat-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--paper); color: var(--ink-2); }
.tab[aria-current="page"] .stat-ico { background: #fff; color: var(--orange-deep); }
.section { padding: 22px; display: flex; flex-direction: column; gap: 16px; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }
.section-head h3 { font-size: 14px; font-weight: 700; }
.section-head p { font-size: 12px; color: var(--muted-ink); margin-top: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-row b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; }
.toggle-row small { display: block; color: var(--muted-ink); font-size: 11.5px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--paper); }
.drop .brand-mark { width: 52px; height: 52px; }
#logo:focus-visible + label { outline: 2px solid var(--orange-ink); outline-offset: 2px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 300; max-width: calc(100% - 32px); background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: 10px 16px 10px 12px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; box-shadow: 0 20px 40px -18px rgba(36, 27, 18, .6); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-close { flex: none; width: 26px; height: 26px; margin-left: 2px; border: 0; border-radius: 50%; background: transparent; color: rgba(255, 255, 255, .7); display: grid; place-items: center; cursor: pointer; }
.toast-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.toast-close svg { width: 14px; height: 14px; }
.toast .dot { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--mint-2); display: grid; place-items: center; }
.toast.is-error .dot { background: var(--red-2); }
.toast .dot svg { width: 13px; height: 13px; stroke-width: 3; }

/* ---------- maintenance ---------- */
.notice-page { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px; }
.notice-page .card { max-width: 460px; padding: 32px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.notice-page h1 { font-family: var(--display); font-weight: 600; font-size: 28px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .profile, .settings { grid-template-columns: 1fr; }
  .tabs { position: static; flex-direction: row; overflow-x: auto; }
  .tab { width: auto; flex: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { order: 2; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .rail, .app.is-open .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; width: 100%; flex-basis: auto; flex-direction: row; align-items: center; gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -12px 30px -18px rgba(90, 55, 10, .35); }
  .rail .brand, .rail-toggle, .rail-group .eyebrow, .rail-label { display: none; }
  .rail-group, .rail-foot { flex-direction: row; margin: 0; flex: 1; justify-content: space-around; gap: 2px; }
  .rail-item { width: auto; justify-content: center; padding: 0 14px; }
  .main { padding-bottom: 110px; width: 100%; }
  .me div { display: none; }
  .search { width: 100%; order: 3; }
  .toolbar form.search { margin-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .access-group { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
