/* =========================================================
   ASCENSION HQ v2 — Liquid-glass dark, warm black + gold.
   Phone-first (app column ≤520px), Bodoni Moda display,
   Jost UI. Motion 150–340ms, reduced-motion respected.
   ========================================================= */

:root {
  color-scheme: dark; /* native controls (select dropdowns, scrollbars, date pickers) render dark */
  --bg: #0C0A09;
  --surface: #1C1917;
  --surface-2: #24201D;
  --glass: rgba(28, 25, 23, 0.62);
  --line: rgba(250, 247, 242, 0.08);
  --line-gold: rgba(232, 180, 76, 0.22);
  --text: #FAF7F2;
  --muted: #A8A29E;
  --faint: #78716C;
  --gold: #E8B44C;
  --gold-soft: rgba(232, 180, 76, 0.12);
  --green: #38D07E;
  --red: #F06A6A;
  --blue: #5B8DEF;
  --r-card: 20px;
  --r-btn: 13px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --t-fast: 160ms;
  --t-med: 260ms;
  --t-sheet: 340ms;
  --tabbar-h: 64px;
  --font-ui: 'Jost', system-ui, -apple-system, sans-serif;
  --font-display: 'Bodoni Moda', 'Didot', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(232, 180, 76, 0.10), transparent 60%),
    radial-gradient(90% 50% at 85% 110%, rgba(91, 141, 239, 0.05), transparent 55%);
  pointer-events: none;
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select {
  font: inherit; color: var(--text);
  background: rgba(250, 247, 242, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  width: 100%;
  min-height: 44px;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--line-gold); background: rgba(250, 247, 242, 0.07); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23A8A29E' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background-color: #1C1917; color: #FAF7F2; }

/* ------------------------------ glass ------------------------------ */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) {
  .glass { background: var(--surface); }
}

/* ------------------------------ login ------------------------------ */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  border-radius: 28px;
  padding: 40px 28px 32px;
  text-align: center;
  animation: rise 480ms var(--ease) both;
}
.login-mark { width: 110px; height: auto; margin: 0 auto 18px; display: block; }
.login-title { font-family: var(--font-display); font-weight: 600; font-size: 34px; letter-spacing: 0.01em; }
.login-sub { color: var(--muted); font-size: 14px; margin: 6px 0 28px; letter-spacing: 0.04em; }
.login-error { color: var(--red); font-size: 14px; margin: -8px 0 12px; }
.login .field { margin-bottom: 16px; }

/* ------------------------------ shell ------------------------------ */
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: linear-gradient(rgba(12, 10, 9, 0.92), rgba(12, 10, 9, 0.75) 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: env(safe-area-inset-top) 0 0;
}
.topbar-inner { display: flex; align-items: center; gap: 9px; padding: 14px 20px 10px; }
.topbar-mark { width: 30px; height: auto; }
.topbar-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: 0.02em; }
.topbar-pill { margin-left: auto; font-size: 12.5px; color: var(--muted); letter-spacing: 0.05em; }

.view {
  padding: 8px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  outline: none;
}

/* ------------------------------ tab bar ------------------------------ */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(520px, 100%);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(18, 15, 14, 0.82);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; height: var(--tabbar-h);
  color: var(--faint); font-size: 11.5px; letter-spacing: 0.04em;
  transition: color var(--t-fast) var(--ease);
}
.tab svg { width: 22px; height: 22px; transition: transform var(--t-fast) var(--ease); }
.tab.active { color: var(--gold); }
.tab.active svg { transform: translateY(-1px); }
.tab:active svg { transform: scale(0.92); }
.tab .badge-dot { position: relative; }
.rail-brand, .rail-extra { display: none; }

/* ------------------------------ cards & sections ------------------------------ */
.card {
  border-radius: var(--r-card);
  padding: 18px;
  margin-bottom: 14px;
  animation: rise 420ms var(--ease) both;
}
.card.pressable { transition: transform var(--t-fast) var(--ease); cursor: pointer; }
.card.pressable:active { transform: scale(0.98); }
.card-gold { border-color: var(--line-gold); background: linear-gradient(160deg, rgba(232, 180, 76, 0.10), rgba(28, 25, 23, 0.62) 45%); }

.greet { padding: 18px 6px 4px; }
.greet-hi { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.15; }
.greet-date { color: var(--muted); font-size: 14px; letter-spacing: 0.06em; margin-top: 3px; }

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 22px 6px 10px;
}
.section-label svg { width: 15px; height: 15px; color: var(--gold); }
.section-label .count {
  margin-left: auto; background: var(--gold-soft); color: var(--gold);
  border-radius: 999px; padding: 1px 9px; font-size: 12px; letter-spacing: 0;
}

/* ------------------------------ goal card ------------------------------ */
.goal-num { font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1.05; }
.goal-num small { font-size: 19px; color: var(--muted); font-family: var(--font-ui); font-weight: 400; }
.goal-caption { color: var(--muted); font-size: 13.5px; margin-top: 2px; letter-spacing: 0.03em; }
.goal-bar { height: 7px; border-radius: 999px; background: rgba(250, 247, 242, 0.08); margin: 14px 0 8px; overflow: hidden; }
.goal-fill {
  height: 100%; width: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #C89135, var(--gold));
  transform: scaleX(var(--p, 0)); transform-origin: left;
  transition: transform 600ms var(--ease);
}
.goal-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.goal-split { display: flex; gap: 10px; margin-top: 14px; }
.goal-mini { flex: 1; background: rgba(250, 247, 242, 0.04); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.goal-mini b { display: block; font-size: 17px; font-weight: 600; }
.goal-mini span { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }

/* ------------------------------ money stat grid ------------------------------ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  animation: rise 420ms var(--ease) both;
}
.stat-label { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.stat-num { font-family: var(--font-display); font-size: 25px; font-weight: 600; line-height: 1.1; margin: 3px 0 2px; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 12px; display: block; }

/* ------------------------------ rows ------------------------------ */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(250, 247, 242, 0.05);
  min-height: 52px;
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 500; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row.pressable { cursor: pointer; transition: background var(--t-fast); border-radius: 10px; }
.row.pressable:active { background: rgba(250, 247, 242, 0.04); }

/* ------------------------------ chips & badges ------------------------------ */
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  border-radius: 999px;
  padding: 3px 11px;
  white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.chip-plain::before { display: none; }

.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.chiprow .chip { cursor: pointer; padding: 7px 14px; font-size: 13px; flex-shrink: 0; min-height: 34px; transition: background var(--t-fast), border-color var(--t-fast); }
.chiprow .chip.on { background: color-mix(in srgb, var(--c) 24%, transparent); border-color: var(--c); }

.quiet-tag { font-size: 12px; color: var(--red); letter-spacing: 0.02em; }
.snooze-tag { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.card.snoozed { opacity: 0.5; animation: none; }
.card.snoozed:active { opacity: 0.72; }

/* ------------------------------ buttons ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: var(--r-btn);
  font-weight: 600; font-size: 15px; letter-spacing: 0.02em;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast), opacity var(--t-fast);
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; }
.btn-gold { background: linear-gradient(160deg, #F0C060, var(--gold) 60%); color: #221A08; box-shadow: 0 6px 22px rgba(232, 180, 76, 0.22); }
.btn-ghost { background: rgba(250, 247, 242, 0.06); border: 1px solid var(--line); color: var(--text); }
.btn-danger-ghost { background: rgba(240, 106, 106, 0.10); border: 1px solid rgba(240, 106, 106, 0.3); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn[disabled] { opacity: 0.45; cursor: default; }

.iconbtn {
  width: 44px; height: 44px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(250, 247, 242, 0.06); border: 1px solid var(--line);
  color: var(--text);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast);
}
.iconbtn:active { transform: scale(0.92); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn.gold { color: var(--gold); border-color: var(--line-gold); background: var(--gold-soft); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

/* ------------------------------ draft cards ------------------------------ */
.draft-reason { display: flex; align-items: center; gap: 8px; color: var(--gold); font-size: 13px; font-weight: 500; letter-spacing: 0.03em; margin-bottom: 8px; }
.draft-reason svg { width: 15px; height: 15px; flex-shrink: 0; }
.draft-to { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.draft-preview {
  font-size: 14px; color: var(--muted);
  background: rgba(250, 247, 242, 0.045);
  border: 1px solid rgba(250, 247, 242, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-line;
}

/* ------------------------------ sheet ------------------------------ */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(5, 4, 3, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity var(--t-med) var(--ease);
}
.sheet-scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 95;
  width: min(520px, 100%);
  max-height: 90dvh;
  background: #171412;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  transform: translate(-50%, 104%);
  transition: transform var(--t-sheet) var(--ease);
  display: flex; flex-direction: column;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.5);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-grab { width: 42px; height: 4px; border-radius: 999px; background: rgba(250, 247, 242, 0.16); margin: 10px auto 0; flex-shrink: 0; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(250, 247, 242, 0.07);
  display: grid; place-items: center;
}
.sheet-close svg { width: 16px; height: 16px; color: var(--muted); }
.sheet-body { padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin-bottom: 2px; padding-right: 40px; }
.sheet-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* ------------------------------ stage picker ------------------------------ */
.stagepick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stagepick .chip { cursor: pointer; padding: 8px 13px; min-height: 36px; }
.stagepick .chip.on { background: color-mix(in srgb, var(--c) 26%, transparent); border-color: var(--c); }

/* ------------------------------ timeline ------------------------------ */
.timeline { margin-top: 6px; }
.tl-item { display: flex; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-gold); margin-top: 7px; flex-shrink: 0; }
.tl-text { color: var(--muted); }
.tl-ts { color: var(--faint); font-size: 12px; }

/* ------------------------------ empty states ------------------------------ */
.empty {
  text-align: center; padding: 34px 22px;
  color: var(--muted); font-size: 14.5px;
  border: 1px dashed rgba(250, 247, 242, 0.14);
  border-radius: var(--r-card);
  margin-bottom: 14px;
}
.empty svg { width: 30px; height: 30px; color: var(--faint); margin-bottom: 10px; }
.empty b { color: var(--text); font-weight: 600; display: block; margin-bottom: 4px; }

/* ------------------------------ toast ------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%) translateY(8px);
  background: #262220; border: 1px solid var(--line-gold);
  color: var(--text); font-size: 14.5px; font-weight: 500;
  border-radius: 999px; padding: 11px 22px;
  z-index: 120; opacity: 0;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  max-width: min(440px, calc(100vw - 40px));
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------ assistant (talk to HQ) ------------------------------ */
.fab {
  position: fixed;
  right: max(18px, calc(50vw - 245px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 80;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(160deg, #F0C060, var(--gold) 60%);
  color: #221A08;
  display: grid; place-items: center;
  box-shadow: 0 10px 30px rgba(232, 180, 76, 0.35);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.fab svg { width: 25px; height: 25px; }
.fab:active { transform: scale(0.92); }
.fab:hover { box-shadow: 0 12px 38px rgba(232, 180, 76, 0.5); }

.chat-log {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px; max-height: 46dvh; overflow-y: auto;
  padding: 4px 2px 10px;
  overscroll-behavior: contain;
}
.chat-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px; line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: break-word;
}
.chat-user {
  align-self: flex-end;
  background: var(--gold-soft);
  border: 1px solid var(--line-gold);
  border-bottom-right-radius: 5px;
}
.chat-ai {
  align-self: flex-start;
  background: rgba(250, 247, 242, 0.05);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.chat-action {
  align-self: flex-start;
  font-size: 12.5px; color: var(--green);
  display: flex; align-items: center; gap: 6px;
  padding: 0 4px;
}
.chat-action svg { width: 13px; height: 13px; flex-shrink: 0; }
.chat-thinking { align-self: flex-start; color: var(--faint); font-size: 13.5px; padding: 2px 4px; }
.chat-attach {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 2px 0;
}
.chat-attach .chip { max-width: 70%; overflow: hidden; text-overflow: ellipsis; }
.chat-attach .chip svg { width: 13px; height: 13px; flex-shrink: 0; }
.chat-attach .iconbtn { width: 34px; height: 34px; border-radius: 10px; }
.rec-preview { border-radius: 14px; overflow: hidden; }
.rec-preview img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); }
.confirm-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 0 4px; }
.chat-chip {
  font-size: 12.5px; color: var(--muted);
  background: rgba(250, 247, 242, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px;
  cursor: pointer; text-align: left;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chat-chip:hover { background: var(--gold-soft); border-color: var(--line-gold); color: var(--gold); }
.chat-chip:active { transform: scale(0.96); }
.chat-inputrow { display: flex; gap: 8px; margin-top: 8px; }
.chat-inputrow input { flex: 1; min-width: 0; }
.chat-inputrow .btn { min-width: 52px; padding: 0 14px; }
.chat-inputrow .iconbtn { flex-shrink: 0; height: 46px; width: 46px; }
.mic-live {
  background: rgba(240, 106, 106, 0.16) !important;
  border-color: rgba(240, 106, 106, 0.5) !important;
  color: var(--red) !important;
  animation: mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 106, 106, 0.35); }
  50% { box-shadow: 0 0 0 9px rgba(240, 106, 106, 0); }
}

/* ------------------------------ misc ------------------------------ */
.money-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.gold-text { color: var(--gold); }
.mono-snippet {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 12px; line-height: 1.55;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 12px;
  white-space: pre; overflow-x: auto;
  color: #D6CDBE;
  max-height: 300px; overflow-y: auto;
}
.hint { font-size: 13px; color: var(--faint); margin-top: 8px; line-height: 1.5; }
.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(250, 247, 242, 0.05);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 4px; margin: 4px 0 14px;
}
.seg button {
  min-height: 40px; border-radius: 10px; font-weight: 600; font-size: 14.5px;
  color: var(--muted); transition: background var(--t-fast), color var(--t-fast);
}
.seg button.on { background: var(--gold-soft); color: var(--gold); }
.fab-row { display: flex; justify-content: flex-end; margin: 2px 2px 12px; }

/* ------------------------------ sub-pages (More hub) ------------------------------ */
.pagehead {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 2px 14px;
}
.pagehead-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.1; }
.pagehead-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; letter-spacing: 0.03em; }
.hubrow { min-height: 62px; }
.hub-ic {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold-soft); color: var(--gold);
}
.hub-ic svg { width: 19px; height: 19px; }
.hub-chev { width: 17px; height: 17px; color: var(--faint); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------ desktop (≥1024px): sidebar layout ------------------------------ */
@media (min-width: 1024px) {
  .app {
    max-width: 1180px;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 8px;
  }
  .tabbar {
    grid-column: 1; grid-row: 1 / 3;
    position: sticky; top: 0; bottom: auto; left: auto;
    transform: none;
    width: auto; height: 100dvh;
    display: flex; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line);
    background: rgba(18, 15, 14, 0.5);
    padding: 26px 14px 24px;
    overflow-y: auto;
  }
  .rail-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 10px 22px;
  }
  .rail-brand img { width: 52px; height: auto; flex-shrink: 0; }
  .rail-brand-name {
    font-family: var(--font-display); font-weight: 600;
    font-size: 15px; line-height: 1.25; letter-spacing: 0.03em;
    color: var(--text);
  }
  .rail-extra { display: block; margin-top: 4px; }
  .rail-group { margin-bottom: 4px; }
  .rail-group-head {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 10px 16px 6px;
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--faint);
    transition: color var(--t-fast) var(--ease);
  }
  .rail-group-head:hover { color: var(--muted); }
  .rail-chev { width: 14px; height: 14px; transition: transform var(--t-med) var(--ease); }
  .rail-group.collapsed .rail-chev { transform: rotate(-90deg); }
  .rail-group.collapsed .rail-group-body { display: none; }
  .tab-sub { height: 42px; font-size: 14px; color: var(--faint); margin-bottom: 2px; }
  .tab-sub svg { width: 17px; height: 17px; }
  .tab-sub.active { background: var(--gold-soft); color: var(--gold); }
  /* On desktop every section lives in the grouped rail — the bottom-bar tabs are mobile-only */
  .tabbar > [data-tab="leads"],
  .tabbar > [data-tab="clients"],
  .tabbar > [data-tab="money"],
  .tabbar > [data-tab="more"] { display: none; }
  .fab {
    right: calc(50vw - 590px + 28px);
    bottom: 30px;
  }
  @media (max-width: 1260px) {
    .fab { right: 24px; }
  }
  .tab {
    flex-direction: row; justify-content: flex-start;
    gap: 13px; height: 48px; width: 100%;
    padding: 0 16px; border-radius: 13px;
    font-size: 15px; letter-spacing: 0.02em;
    transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  }
  .tab svg { width: 20px; height: 20px; }
  .tab.active { background: var(--gold-soft); }
  .tab:hover:not(.active) { background: rgba(250, 247, 242, 0.05); color: var(--muted); }
  .topbar { grid-column: 2; grid-row: 1; }
  .topbar-inner { padding: 20px 44px 12px; }
  .view {
    grid-column: 2; grid-row: 2;
    padding: 10px 44px 72px;
    max-width: 780px;
  }
  .greet-hi { font-size: 36px; }
  .goal-num { font-size: 48px; }
  .sheet {
    left: auto; right: 40px; bottom: 0;
    transform: translateY(104%);
    border-radius: 26px 26px 0 0;
  }
  .sheet.open { transform: translateY(0); }
  .toast { bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
