/* The header's account and settings menu (scripts/templates.mjs navBar accountMenu + navScript), and the account
   pages (/account/, /account/deposits/, /account/comparisons/, /account/settings/, /alerts/, /api/keys/;
   scripts/build-pages.mjs accountShell). The header button's own look is in styles.css (it is on every first screen);
   this sheet loads when the menu is about to open, or with an account page. */

/* ── Header menu ─────────────────────────────────────────────────────────── */
.nav-avatar:hover { border-color: var(--brand); color: var(--brand); }
.nav-account:not(.is-in) .nav-avatar:hover { background: var(--info-bg); }
.nav-account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 260px; max-height: calc(100dvh - 90px); overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.nav-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.nav-menu-initial { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--surface); font: 700 14px var(--font); }
.nav-account-email { margin: 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.nav-account-menu a, .nav-account-menu button { display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box; text-align: left; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; }
.nav-account-menu a:hover, .nav-account-menu button:hover, .nav-account-menu a:focus-visible, .nav-account-menu button:focus-visible { background: var(--surface-2); outline: none; }
.nav-menu-signin { flex-direction: column; align-items: flex-start !important; gap: 2px !important; margin-bottom: 4px; background: var(--info-bg) !important; color: var(--brand) !important; font-weight: 650 !important; }
.nav-menu-signin small { font-size: 12px; font-weight: 400; color: var(--ink-2); line-height: 1.4; }
.nav-menu-links { display: block; padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.nav-menu-settings { padding: 2px 0; }
.nav-sub-open .nav-sub-value { margin-left: auto; color: var(--muted); font-size: 13px; }
.nav-sub-chev { flex: none; color: var(--muted); transition: transform .15s; }
.nav-sub-open[aria-expanded="true"] .nav-sub-chev { transform: rotate(90deg); }
.nav-sub-list { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 2px solid var(--line); }
.nav-sub-item { min-height: 36px !important; font-size: 13.5px !important; }
.nav-sub-item[aria-checked="true"] { color: var(--brand) !important; font-weight: 650 !important; }
.nav-sub-item[aria-checked="true"]::after { content: "✓"; margin-left: auto; }
.nav-sub-list .lang-switch { display: none !important; }
.nav-menu-signout { border-top: 1px solid var(--line) !important; border-radius: 0 0 8px 8px !important; margin-top: 4px; color: var(--muted) !important; }
@media (max-width: 480px) { .nav-account-menu { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; } }

/* ── Account layout: a left menu and the page ───────────────────────────── */
.acc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; align-items: start; min-height: 70vh; }
.acc-side { position: sticky; top: 76px; padding: 36px 20px 24px 0; border-right: 1px solid var(--line); min-height: 60vh; }
.acc-side-title { margin: 0 0 14px 14px; font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.acc-nav { display: grid; gap: 4px; }
.acc-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; color: var(--ink-2); font-size: 15px; text-decoration: none; }
.acc-nav a svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.acc-nav a:hover { background: var(--surface-2); color: var(--ink); }
.acc-nav a[aria-current="page"] { background: var(--info-bg); color: var(--brand); font-weight: 650; }
.acc-nav a[aria-current="page"] svg { color: var(--brand); }
.acc-nav .acc-count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 650; text-align: center; }
.acc-nav .acc-count:empty { display: none; }
.acc-main { padding: 36px 0 56px 44px; min-width: 0; }
.acc-kicker { margin: 0 0 10px; font-size: 12px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
.acc-title { margin: 0 0 10px; font-size: clamp(28px, 4.2vw, 44px); line-height: 1.08; letter-spacing: -.035em; }
.acc-lead { margin: 0 0 26px; font-size: 16px; color: var(--muted); max-width: 62ch; line-height: 1.55; }
.acc-main [hidden] { display: none !important; }
.acc-main .ak-note { margin-bottom: 18px; }
.acc-main .ak-note:empty { display: none; }
@media (max-width: 860px) {
  .acc-layout { display: block; }
  .acc-side { position: static; padding: 14px 0 0; border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .acc-side-title { display: none; }
  .acc-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
  .acc-nav::-webkit-scrollbar { display: none; }
  .acc-nav { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 28px; }
  .acc-nav a { flex: none; padding: 8px 12px; font-size: 14px; white-space: nowrap; }
  .acc-nav a svg { display: none; }
  .acc-main { padding: 22px 0 44px; }
}

/* ── Shared blocks ─────────────────────────────────────────────────────── */
.acc-card { padding: 22px 24px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.acc-card h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.acc-label { margin: 0 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.acc-label strong { color: var(--ink-2); font-weight: 650; }
.acc-muted { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 6px 0; }
.acc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.acc-actions .fa-text { min-height: 40px; }
.acc-spot { position: relative; padding: 26px 28px; margin: 0 0 30px; border: 1px solid var(--good-line); border-left: 5px solid var(--good-ink); border-radius: 12px; background: var(--good-bg); }
.acc-spot .acc-kicker { font-size: 11.5px; }
.acc-spot h2 { margin: 0 0 10px; font-size: clamp(21px, 2.6vw, 27px); letter-spacing: -.025em; }
.acc-spot p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.acc-spot--info { border-color: var(--info-line); border-left-color: var(--brand); background: var(--info-bg); }
.acc-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 30px 0 14px; }
.acc-section-head h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.acc-section-head a { font-size: 15px; color: var(--brand); }
.acc-badge { flex: none; display: inline-block; padding: 5px 10px; border-radius: 6px; background: var(--info-bg); color: var(--brand); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.acc-badge--due { background: var(--warn-bg); color: var(--warn-ink); }
.acc-badge--done { background: var(--surface-2); color: var(--muted); }

/* Stat tiles */
.acc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0 0 26px; }
.acc-stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.acc-stat span { display: block; font-size: 12.5px; color: var(--muted); }
.acc-stat strong { display: block; margin-top: 6px; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.acc-stat small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.acc-stat a { color: inherit; text-decoration: none; }

/* Getting started */
.acc-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.acc-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; }
.acc-steps li.is-done { color: var(--muted); }
.acc-steps li.is-done .acc-step-text { text-decoration: line-through; text-decoration-color: var(--line); }
.acc-step-dot { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); color: var(--surface); }
.acc-step-dot svg { width: 14px; height: 14px; }
.is-done .acc-step-dot { background: var(--good-ink); border-color: var(--good-ink); }
.acc-steps a, .acc-steps button { margin-left: auto; font-size: 13.5px; }
.acc-progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.acc-progress span { display: block; height: 100%; background: var(--good-ink); border-radius: inherit; }
.acc-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.acc-link { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.acc-link:hover { border-color: var(--brand); }
.acc-link strong { display: block; font-size: 15px; }
.acc-link span { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }

/* ── My deposits ───────────────────────────────────────────────────────── */
.dep-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.dep-top .fa-button { min-height: 50px; padding: 12px 22px; font-size: 16px; border-radius: 8px; }
.dep-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.dep-tabs button { flex: none; padding: 10px 0 12px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink-2); font: 500 16px var(--font); cursor: pointer; }
.dep-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.dep-card { padding: 26px 28px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.dep-card.is-focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--info-bg); }
.dep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.dep-head h3 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.025em; }
.dep-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0 18px; }
.dep-figs span { display: block; font-size: 14px; color: var(--muted); }
.dep-figs strong { display: block; margin-top: 6px; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dep-figs small { font-size: 14px; font-weight: 600; }
.dep-meta { margin: 0; font-size: 14px; color: var(--muted); }
.dep-insight { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.dep-insight svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--brand); }
.dep-insight strong { color: var(--ink); }
.dep-insight--good { background: var(--good-bg); }
.dep-insight--good svg { color: var(--good-ink); }
.dep-review { margin: 18px 0 0; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; }
.dep-review h4 { margin: 0 0 10px; font-size: 16px; }
.dep-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.dep-option { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; line-height: 1.5; }
.dep-option strong { display: block; font-size: 15px; }
.dep-option a { display: inline-block; margin-top: 6px; color: var(--brand); }
.dep-empty { padding: 34px 24px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.dep-empty h3 { margin: 0 0 8px; font-size: 20px; }
.dep-empty p { margin: 0 auto 16px; max-width: 46ch; color: var(--muted); line-height: 1.6; }
.dep-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 22px; }

/* The add / edit form (inline, no modal) */
.dep-form { padding: 24px 26px; margin: 0 0 24px; border: 1px solid var(--brand); border-radius: 12px; background: var(--surface); }
.dep-form h3 { margin: 0 0 4px; font-size: 21px; }
.dep-form .acc-muted { margin: 0 0 16px; }
.dep-seg { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin: 0 0 16px; flex-wrap: wrap; }
.dep-seg label { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 550; cursor: pointer; }
.dep-seg input { position: absolute; opacity: 0; pointer-events: none; }
.dep-seg label:has(input:checked) { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.dep-seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }
.dep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.dep-grid label, .dep-terms legend { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dep-grid input, .dep-grid select { box-sizing: border-box; display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 15px var(--font); }
.dep-grid input:focus-visible, .dep-grid select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dep-wide { grid-column: 1 / -1; }
.dep-hint { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; color: var(--muted); }
.dep-terms { border: 0; padding: 0; margin: 0; }
.dep-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dep-chips label { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.dep-chips input { position: absolute; opacity: 0; pointer-events: none; }
.dep-chips label:has(input:checked) { border-color: var(--brand); background: var(--info-bg); color: var(--brand); }
.dep-chips label:has(input:focus-visible) { outline: 2px solid var(--brand); }
.dep-check { display: flex !important; align-items: flex-start; gap: 10px; font-weight: 500 !important; line-height: 1.45; }
.dep-check input { width: 18px !important; height: 18px; min-height: 0 !important; margin: 2px 0 0 !important; flex: none; accent-color: var(--brand); }
.dep-preview { margin: 18px 0 0; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.dep-preview strong { color: var(--ink); }
.dep-status { min-height: 20px; margin: 10px 0 0; font-size: 13.5px; color: var(--warn-ink); }

/* Shared plan */
.dep-shared { border: 1px solid var(--brand); }

/* ── Settings ──────────────────────────────────────────────────────────── */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 0; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; padding-top: 4px; }
.set-row h3 { margin: 0 0 4px; font-size: 16px; }
.set-row p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.set-row .dep-seg { margin: 0; flex: none; }
.set-row select { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 14px var(--font); }
.set-danger { color: var(--warn-ink) !important; border-color: var(--warn-line) !important; }
@media (max-width: 640px) {
  .dep-card, .dep-form, .acc-spot { padding: 20px 18px; }
  .dep-figs { grid-template-columns: 1fr 1fr; }
  .dep-figs strong { font-size: 20px; }
  .dep-grid { grid-template-columns: 1fr; }
  .dep-top .fa-button { flex: 1; }
  .set-row { flex-direction: column; align-items: flex-start; }
}
