:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #07111f;
  --panel: #0d1b2e;
  --card: #0d1726;
  --border: rgba(255,255,255,.10);
  --text: #f8fafc;
  --muted: #9fb0c6;
  --accent: #51e0a6;
  --accent-strong: #2dd492;
  --danger: #ff8a8a;
  --success-bg: rgba(81,224,166,.12);
  --danger-bg: rgba(255,138,138,.10);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #112743 0, var(--bg) 42%, #050b14 100%);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(440px, .95fr);
}

.brand-panel {
  padding: clamp(40px, 7vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  border-right: 1px solid var(--border);
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #042017;
  font-weight: 900;
  letter-spacing: -.04em;
}

.eyebrow {
  font-size: .75rem;
  letter-spacing: .18em;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 14px;
}
.eyebrow.compact { margin-bottom: 4px; }

h1 {
  font-size: clamp(2.6rem, 6vw, 5.7rem);
  line-height: .95;
  letter-spacing: -.055em;
  margin: 0;
  max-width: 760px;
}

.lead {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.65;
  max-width: 650px;
}
.brand-note { color: #7890aa; font-size: .9rem; }

.auth-panel { display: grid; place-items: center; padding: 32px; }
.card {
  width: min(100%, 570px);
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(13, 23, 38, .86);
  box-shadow: 0 28px 80px rgba(0,0,0,.35);
  backdrop-filter: blur(16px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 26px;
  background: rgba(255,255,255,.025);
}
.tab {
  border: 0;
  border-radius: 10px;
  padding: 11px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.tab.active { background: rgba(255,255,255,.08); color: var(--text); }

.view, .form, .setup-step { display: none; }
.view.active, .form.active, .setup-step.active { display: block; }

.field { margin-bottom: 18px; }
label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 700; }
input, select {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(3, 11, 21, .65);
  color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
select { appearance: auto; }
input:focus, select:focus {
  border-color: rgba(81,224,166,.6);
  box-shadow: 0 0 0 4px rgba(81,224,166,.09);
}
input::placeholder { color: #60728a; }

.money-input { position: relative; }
.money-input span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
  pointer-events: none;
}
.money-input input { padding-left: 32px; }

.primary, .secondary {
  width: 100%;
  border-radius: 12px;
  padding: 14px 16px;
  font-weight: 850;
  border: 0;
}
.primary { background: var(--accent); color: #052017; }
.primary:hover { background: var(--accent-strong); }
.primary:disabled, .secondary:disabled { opacity: .6; cursor: wait; }
.secondary { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--border); }

.link-button, .back, .ghost {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
}
.link-button { padding: 14px 0 0; }
.back { padding: 0 0 18px; }
.ghost { padding: 12px 4px; }

.hint, .muted { color: var(--muted); line-height: 1.55; }
.hint { font-size: .78rem; margin: 8px 0 0; }
.muted { margin-top: 0; }
h2 { margin: 0 0 10px; font-size: 1.8rem; letter-spacing: -.035em; }

.message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.45;
  background: var(--success-bg);
  border: 1px solid rgba(81,224,166,.22);
  color: #bdf7dc;
}
.message.error { background: var(--danger-bg); border-color: rgba(255,138,138,.22); color: #ffc2c2; }

.success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  background: var(--success-bg);
  border: 1px solid rgba(81,224,166,.28);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 900;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 32px auto;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.signed-in-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.signed-in-email { margin: 0; color: var(--muted); font-size: .85rem; word-break: break-all; }
.small-secondary {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-weight: 700;
}

.wizard-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 12px; }
.step-label { margin: 0 0 5px; font-size: .7rem; font-weight: 900; letter-spacing: .16em; color: var(--accent); }
.progress { display: flex; gap: 6px; padding-top: 8px; }
.progress span { width: 24px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.10); }
.progress span.active { background: var(--accent); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,.02);
  font-weight: 800;
  cursor: pointer;
}
.choice input:checked + span { border-color: rgba(81,224,166,.55); background: var(--success-bg); color: var(--text); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.item-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.add-button { margin-top: -2px; }
.item-list { display: grid; gap: 9px; margin: 16px 0; }
.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.item-row strong { display: block; font-size: .92rem; }
.item-meta { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.remove-item { border: 0; background: transparent; color: #ffaaa8; font-weight: 800; padding: 7px; }
.empty-state { padding: 14px; border: 1px dashed var(--border); border-radius: 12px; color: #71849b; font-size: .85rem; text-align: center; }

.wizard-actions { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; margin-top: 22px; }
.inline-primary { width: auto; min-width: 150px; justify-self: end; }
.truth-note { padding: 12px 14px; border-radius: 12px; background: rgba(81,224,166,.08); border: 1px solid rgba(81,224,166,.17); color: #d5f8e9; line-height: 1.5; font-weight: 700; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin: -3px 0 14px; }
.suggestions button { border: 1px solid var(--border); border-radius: 999px; padding: 7px 10px; background: rgba(255,255,255,.03); color: var(--muted); font-size: .78rem; }
.suggestions button:hover { color: var(--text); border-color: rgba(81,224,166,.35); }
.setup-summary { margin-top: 22px; display: grid; gap: 9px; }
.summary-line { display: flex; justify-content: space-between; gap: 16px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); }
.summary-line strong { color: var(--text); }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; padding: 34px 24px 28px; gap: 52px; border-right: 0; border-bottom: 1px solid var(--border); }
  h1 { font-size: clamp(2.5rem, 12vw, 4.2rem); }
  .brand-note { display: none; }
  .auth-panel { padding: 28px 18px 44px; }
  .card { padding: 24px; max-height: none; }
}

@media (max-width: 540px) {
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .wizard-head { display: block; }
  .progress { margin-bottom: 16px; }
  .inline-primary { width: 100%; min-width: 0; }
  .wizard-actions { grid-template-columns: auto 1fr; }
}

/* ==========================================================
   Phase 4 — Overview dashboard
   ========================================================== */

.shell.dashboard-mode {
  grid-template-columns: 220px minmax(0, 1fr);
}

.shell.dashboard-mode .brand-panel {
  min-height: 100vh;
  padding: 30px 24px;
  justify-content: flex-start;
  gap: 26px;
}

.shell.dashboard-mode .brand-panel h1 {
  font-size: 1.8rem;
  line-height: 1.05;
  letter-spacing: -.04em;
}

.shell.dashboard-mode .brand-panel .lead {
  display: none;
}

.shell.dashboard-mode .brand-note {
  margin-top: auto;
  line-height: 1.5;
}

.shell.dashboard-mode .auth-panel {
  display: block;
  padding: 24px 28px 44px;
}

.shell.dashboard-mode .card {
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  padding: 28px;
}

.dashboard {
  display: grid;
  gap: 22px;
}

.dashboard-head,
.section-head,
.confirm-actions,
.balance-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-head {
  align-items: flex-start;
}

.dashboard-head h2 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  margin: 2px 0 8px;
}

.dashboard-subtitle {
  margin-bottom: 0;
}

/* Dashboard date range */
.date-range-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255,255,255,.018);
}

.date-range-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.date-range-head h3 {
  margin: 3px 0 0;
  font-size: 1.16rem;
}

.range-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.range-preset {
  width: auto;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 800;
  cursor: pointer;
}

.range-preset:hover,
.range-preset.active {
  border-color: rgba(81,224,166,.45);
  background: rgba(81,224,166,.10);
  color: var(--accent);
}

.date-range-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.date-range-form .field { margin-bottom: 0; }
.date-range-form .range-apply { min-height: 48px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-width: 0;
  min-height: 142px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card-accent {
  border-color: rgba(81,224,166,.38);
  background: rgba(81,224,166,.085);
}

.metric-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.metric-value {
  display: block;
  margin: 13px 0 9px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1;
  letter-spacing: -.045em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-card-accent .metric-value {
  color: var(--accent);
}

.metric-note {
  min-height: 30px;
  color: #7f93aa;
  font-size: .73rem;
  line-height: 1.35;
}

.spending-allowance-card {
  border-color: rgba(81,224,166,.20);
}
.spending-allowance-head {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
}
.spending-allowance-head h3 { margin: 4px 0 6px; max-width: 780px; }
.allowance-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.025);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.allowance-switch-copy { display: grid; gap: 2px; margin-right: auto; }
.allowance-switch-copy strong { font-size: .84rem; }
.allowance-switch-copy small { color: var(--muted); font-size: .76rem; }
.allowance-switch input { position: absolute; opacity: 0; pointer-events: none; }
.allowance-switch-track {
  width: 48px;
  height: 27px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid var(--border);
  transition: .2s ease;
}
.allowance-switch-track > span {
  display: block;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #a9b7c8;
  transition: transform .2s ease, background .2s ease;
}
.allowance-switch input:checked + .allowance-switch-track {
  background: rgba(81,224,166,.24);
  border-color: rgba(81,224,166,.55);
}
.allowance-switch input:checked + .allowance-switch-track > span {
  transform: translateX(21px);
  background: var(--accent);
}
.allowance-switch:focus-within { box-shadow: 0 0 0 3px rgba(81,224,166,.12); }
.allowance-body { margin-top: 20px; display: grid; gap: 15px; }
.allowance-rule-row { display: flex; justify-content: space-between; gap: 12px; align-items: end; flex-wrap: wrap; }
.allowance-rule-title { display: block; font-size: .95rem; margin-bottom: 3px; }
.allowance-rule-help { color: var(--muted); }
.allowance-percent-group { display: grid; grid-template-columns: repeat(4,minmax(130px,1fr)); gap: 10px; }
.allowance-percent-btn, .allowance-custom {
  min-height: 86px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.025);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
.allowance-percent-btn { cursor: pointer; display: grid; gap: 7px; text-align: left; }
.allowance-percent-btn strong { font-size: 1rem; }
.allowance-percent-btn span { color: var(--accent); font-size: 1.25rem; }
.allowance-percent-btn.active { border-color: rgba(81,224,166,.60); background: rgba(81,224,166,.10); box-shadow: inset 0 0 0 1px rgba(81,224,166,.14); }
.allowance-custom { display: grid; align-content: center; gap: 8px; }
.allowance-custom > strong { font-size: .9rem; }
.allowance-custom-line { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.allowance-custom input { width: 56px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; font-weight: 900; padding: 2px 4px; text-align: center; }
.allowance-custom em { color: var(--accent); font-size: 1.05rem; font-style: normal; margin-left: auto; }
.allowance-status-card {
  display: grid;
  grid-template-columns: minmax(220px,.75fr) minmax(260px,1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(81,224,166,.38);
  background: rgba(81,224,166,.08);
}
.allowance-status-card.preview { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.025); }
.allowance-status-card.unsafe { border-color: rgba(255,126,126,.52); background: rgba(255,126,126,.09); }
.allowance-status-card > div { display: grid; gap: 5px; align-content: center; }
.allowance-status-card span, .allowance-status-card small { color: var(--muted); }
.allowance-status-card > div:first-child > strong { color: var(--accent); font-size: clamp(2rem,4vw,3.1rem); line-height: 1; letter-spacing: -.04em; }
.allowance-status-card.preview > div:first-child > strong { color: var(--text); }
.allowance-status-card.unsafe > div:first-child > strong { color: var(--danger); }
.allowance-status-copy strong { font-size: 1rem; }
.allowance-spend-form {
  display: grid;
  grid-template-columns: minmax(140px,.75fr) minmax(150px,.65fr) minmax(220px,1.2fr) auto;
  gap: 10px;
  align-items: end;
}
.allowance-spend-form .field { margin-bottom: 0; }
.allowance-spend-form .primary { min-height: 48px; width: auto; padding-inline: 20px; }
.allowance-spend-form .primary:disabled { opacity: .5; cursor: not-allowed; }
.statistics-metric-allowance { border-color: rgba(182,140,255,.34); background: rgba(182,140,255,.07); }
.statistics-metric-allowance > strong { color: #c6a7ff; }
@media (max-width: 980px) {
  .allowance-percent-group { grid-template-columns: repeat(2,minmax(130px,1fr)); }
}
@media (max-width: 900px) {
  .spending-allowance-head { flex-direction: column; }
  .allowance-switch { width: 100%; }
  .allowance-status-card { grid-template-columns: 1fr; }
  .allowance-spend-form { grid-template-columns: 1fr 1fr; }
  .allowance-note-field { grid-column: 1 / -1; }
  .allowance-spend-form .primary { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 620px) {
  .allowance-percent-group { grid-template-columns: 1fr 1fr; }
  .allowance-spend-form { grid-template-columns: 1fr; }
  .allowance-note-field, .allowance-spend-form .primary { grid-column: auto; }
}

.balance-confirm-row {
  justify-content: flex-end;
  margin-top: -7px;
}

.compact-button {
  width: auto;
  padding: 10px 14px;
}

.confirm-balance-form {
  padding: 18px;
  border: 1px solid rgba(81,224,166,.24);
  border-radius: 16px;
  background: rgba(81,224,166,.045);
}

.confirm-balance-form .field {
  margin-bottom: 0;
}

.confirm-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.status-banner {
  display: grid;
  gap: 5px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.status-banner strong {
  font-size: .95rem;
}

.status-banner span {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.status-banner.safe {
  border-color: rgba(81,224,166,.25);
  background: rgba(81,224,166,.065);
}

.status-banner.warning {
  border-color: rgba(255,199,107,.28);
  background: rgba(255,199,107,.07);
}

.status-banner.danger {
  border-color: rgba(255,138,138,.26);
  background: rgba(255,138,138,.07);
}

.dashboard-section {
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: rgba(255,255,255,.018);
}

.section-head {
  align-items: flex-end;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.section-head h3 {
  margin: 2px 0 0;
  font-size: 1.18rem;
  letter-spacing: -.02em;
}

.section-head > span {
  color: #72859b;
  font-size: .76rem;
  font-weight: 700;
}

.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .15em;
}

.breakdown {
  display: grid;
  gap: 16px;
  padding-top: 17px;
}

.breakdown-row {
  display: grid;
  gap: 8px;
}

.breakdown-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font-size: .84rem;
}

.breakdown-copy span {
  color: var(--muted);
}

.breakdown-copy strong {
  font-size: .9rem;
}

.breakdown-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
}

.breakdown-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.movement-list {
  max-height: 520px;
  overflow: auto;
}

.movement-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 2px;
  border-bottom: 1px solid rgba(255,255,255,.065);
}

.movement-row:last-child {
  border-bottom: 0;
}

.movement-date {
  color: #8296ad;
  font-size: .76rem;
  font-weight: 800;
}

.movement-copy {
  min-width: 0;
}

.movement-copy strong,
.movement-copy span {
  display: block;
}

.movement-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .88rem;
}

.movement-copy span {
  margin-top: 3px;
  color: #71849a;
  font-size: .72rem;
}

.movement-amount {
  font-size: .86rem;
  font-weight: 900;
  white-space: nowrap;
}

.money-in {
  color: var(--accent);
}

.money-out {
  color: #ffc0be;
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .shell.dashboard-mode {
    grid-template-columns: 1fr;
  }

  .shell.dashboard-mode .brand-panel {
    display: none;
  }

  .shell.dashboard-mode .auth-panel {
    padding: 14px;
  }

  .shell.dashboard-mode .card {
    padding: 20px;
    border-radius: 18px;
  }
}

@media (max-width: 620px) {
  .date-range-head { display: grid; }
  .range-presets { justify-content: flex-start; }
  .date-range-form { grid-template-columns: 1fr; }
  .date-range-form .range-apply { width: 100%; }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 118px;
  }

  .dashboard-head {
    display: grid;
  }

  .dashboard-head .small-secondary {
    width: 100%;
  }

  .movement-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .movement-amount {
    grid-column: 2;
    margin-top: -4px;
  }

  .confirm-actions {
    display: grid;
    grid-template-columns: auto 1fr;
  }
}

/* ==========================================================
   Phase 5 — Manage money
   ========================================================== */

.manage-money {
  display: grid;
  gap: 22px;
}

.manage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.manage-head h2 {
  margin: 2px 0 8px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
}

.manage-head .muted { margin-bottom: 0; }

.manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manage-card {
  min-height: 150px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.018));
  color: var(--text);
}

.manage-card:hover {
  transform: translateY(-1px);
  border-color: rgba(81,224,166,.42);
  background: rgba(81,224,166,.055);
}

.manage-card strong {
  font-size: 1.05rem;
}

.manage-card small {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

.manage-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(81,224,166,.10);
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 900;
}

.manage-panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.018);
}

.manage-panel-head { align-items: flex-start; }
.manage-panel h3 { margin: 2px 0 0; font-size: 1.45rem; }
.manage-history { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }

.manage-back {
  order: -1;
  white-space: nowrap;
}

.shell.manage-edit-mode .progress,
.shell.manage-edit-mode .wizard-actions {
  display: none;
}

.shell.manage-edit-mode .wizard-head {
  justify-content: flex-start;
  align-items: center;
}

.shell.manage-edit-mode .wizard-head > div:nth-of-type(1) {
  flex: 1;
}

.form-actions-row,
.item-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions-row {
  margin-top: 2px;
}

.form-actions-row .add-button { margin-top: 0; }

.edit-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-weight: 800;
}

.one-off-row .item-row-actions > strong {
  min-width: 82px;
  text-align: right;
  font-size: .88rem;
}

@media (max-width: 760px) {
  .manage-grid { grid-template-columns: 1fr; }
  .manage-head { display: grid; }
  .manage-head .small-secondary { width: 100%; }
  .manage-card { min-height: 128px; }
  .shell.manage-edit-mode .wizard-head { display: grid; }
  .manage-back { width: 100%; }
  .item-row { align-items: start; }
  .item-row-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 520px) {
  .item-row {
    grid-template-columns: 1fr;
  }
  .item-row-actions {
    justify-content: flex-start;
  }
  .one-off-row .item-row-actions > strong {
    text-align: left;
  }
  .form-actions-row {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Phase 5.2 — actual-vs-projected movement confirmation */
.movement-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
}

.movement-row {
  grid-template-columns: 86px minmax(0, 1fr) auto minmax(145px, auto) minmax(150px, auto);
}

.movement-balance {
  display: grid;
  gap: 2px;
  min-width: 145px;
  text-align: right;
}

.movement-balance span {
  color: #71849a;
  font-size: .68rem;
  font-weight: 700;
}

.movement-balance strong {
  color: var(--text);
  font-size: .84rem;
  white-space: nowrap;
}

.movement-confirm-control {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.movement-confirm-control:hover {
  border-color: rgba(81,224,166,.45);
}

.movement-confirm-input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.movement-confirmed {
  background: rgba(81,224,166,.035);
}

.movement-confirmed .movement-confirm-control {
  border-color: rgba(81,224,166,.35);
  background: rgba(81,224,166,.075);
}

@media (max-width: 1180px) {
  .movement-row {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }
  .movement-balance {
    grid-column: 2;
    text-align: left;
  }
  .movement-confirm-control {
    grid-column: 3;
    grid-row: 2;
  }
}

@media (max-width: 720px) {
  .movement-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .movement-amount,
  .movement-balance,
  .movement-confirm-control {
    grid-column: 2;
  }
  .movement-confirm-control {
    grid-row: auto;
    width: fit-content;
  }
}


/* Phase 5.3 — overdue reconciliation queue + backward date review */
.needs-confirmation-section {
  border-color: rgba(255, 191, 71, .24);
  background: rgba(255, 191, 71, .025);
}

.needs-confirmation-section.is-clear {
  border-color: var(--border);
  background: var(--card);
}

.pending-movement-row {
  background: rgba(255, 191, 71, .025);
}

.pending-status-copy strong {
  color: #f0c36b;
}

.movement-actions {
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.movement-skip-button,
.movement-undo-skip {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}

.movement-skip-button:hover,
.movement-undo-skip:hover {
  color: var(--text);
  border-color: rgba(255,255,255,.28);
}

.movement-skipped {
  opacity: .7;
}

.movement-skipped .movement-copy strong {
  text-decoration: line-through;
}

.muted-amount {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .movement-actions {
    grid-column: 3;
    grid-row: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .movement-actions {
    grid-column: 2;
    grid-row: auto;
    justify-content: flex-start;
    min-width: 0;
  }
}


/* Phase 5.4 — explicit save controls */
.manage-save-note {
  display: none;
  margin: -2px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}
.shell.manage-edit-mode .manage-save-note,
.manage-save-note.always-visible { display: block; }
.manage-save-note strong,
.manage-save-summary strong { color: var(--text); }
.manage-save-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}
.save-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.save-actions > button { flex: 1 1 auto; }
.save-state {
  flex: 0 0 auto;
  min-width: 110px;
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
  text-align: right;
}
.save-state.unsaved { color: #ffd18a; }
.save-state.saved { color: #bdf7dc; }
.shell.manage-edit-mode .form-actions-row .add-button {
  background: var(--accent);
  color: #052017;
  border: 0;
}
.shell.manage-edit-mode .form-actions-row .save-state { margin-left: auto; }
@media (max-width: 640px) {
  .save-actions { display: grid; grid-template-columns: 1fr; }
  .save-state { min-width: 0; text-align: left; }
  .shell.manage-edit-mode .form-actions-row .save-state { width: 100%; margin-left: 0; }
}


/* Phase 5.5 — history + flexible living-cost frequency */
.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.living-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr) minmax(150px, .65fr);
  gap: 12px;
  align-items: end;
}

.history-page {
  display: grid;
  gap: 22px;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.history-head h2 {
  margin: 2px 0 8px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
}

.history-head .muted {
  margin-bottom: 0;
}

.history-section {
  overflow: hidden;
}

.history-list {
  display: grid;
}

.history-row {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) auto minmax(145px, auto);
  gap: 14px;
  align-items: center;
  padding: 14px 2px;
  border-bottom: 1px solid rgba(255,255,255,.065);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-date {
  color: #8296ad;
  font-size: .78rem;
  font-weight: 800;
}

.history-copy {
  min-width: 0;
}

.history-copy strong,
.history-copy span {
  display: block;
}

.history-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
}

.history-copy span {
  margin-top: 3px;
  color: #71849a;
  font-size: .74rem;
}

.history-amount {
  white-space: nowrap;
  text-align: right;
  font-size: .88rem;
  font-weight: 900;
}

.history-balance-amount {
  color: var(--text);
}

.history-status {
  justify-self: end;
  min-width: 126px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  text-align: center;
  font-size: .72rem;
  font-weight: 850;
  white-space: nowrap;
}

.history-status-confirmed {
  color: #bdf7dc;
  border-color: rgba(81,224,166,.32);
  background: rgba(81,224,166,.08);
}

.history-status-skipped {
  color: #aebdca;
  text-decoration: line-through;
}

.history-status-waiting {
  color: #f0c36b;
  border-color: rgba(240,195,107,.24);
  background: rgba(240,195,107,.045);
}

@media (max-width: 900px) {
  .living-entry-grid {
    grid-template-columns: 1fr 1fr;
  }

  .living-entry-grid .field:last-child {
    grid-column: 1 / -1;
  }

  .history-row {
    grid-template-columns: 90px minmax(0, 1fr) auto;
  }

  .history-status {
    grid-column: 2 / -1;
    justify-self: start;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .dashboard-actions {
    width: 100%;
    justify-content: stretch;
  }

  .dashboard-actions .small-secondary {
    flex: 1 1 0;
  }

  .history-head {
    display: grid;
  }

  .history-head .small-secondary {
    width: 100%;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .history-copy strong {
    white-space: normal;
  }

  .history-amount,
  .history-status {
    justify-self: start;
    text-align: left;
  }

  .history-status {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .living-entry-grid {
    grid-template-columns: 1fr;
  }

  .living-entry-grid .field:last-child {
    grid-column: auto;
  }
}

/* ==========================================================
   Phase 5.7 — Finished welcome / sign-in experience
   ========================================================== */
.brand-hero {
  display: grid;
  align-content: center;
}

.welcome-points {
  display: grid;
  gap: 12px;
  margin-top: 32px;
  max-width: 700px;
}

.welcome-point {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}

.welcome-point-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  border-radius: 10px;
  background: rgba(81,224,166,.12);
  border: 1px solid rgba(81,224,166,.22);
  color: var(--accent);
  font-weight: 900;
  font-size: .82rem;
}

.welcome-point strong,
.welcome-point span {
  display: block;
}

.welcome-point .welcome-point-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-point strong {
  color: var(--text);
  font-size: .95rem;
  margin: 1px 0 4px;
}

.welcome-point div > span {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.welcome-example {
  max-width: 700px;
  margin-top: 28px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.045), rgba(81,224,166,.035));
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}

.welcome-example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.welcome-example-head span {
  color: var(--accent);
  font-size: .68rem;
  letter-spacing: .17em;
  font-weight: 900;
}

.welcome-example-head small {
  color: #6f829a;
  font-size: .72rem;
}

.welcome-example-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.welcome-example-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  background: rgba(3,11,21,.32);
}

.welcome-example-grid span,
.welcome-example-grid strong {
  display: block;
}

.welcome-example-grid span {
  color: var(--muted);
  font-size: .72rem;
  margin-bottom: 5px;
}

.welcome-example-grid strong {
  font-size: 1.18rem;
  letter-spacing: -.03em;
}

.welcome-example-grid .safe {
  border-color: rgba(81,224,166,.25);
  background: rgba(81,224,166,.075);
}

.welcome-example-grid .safe strong { color: var(--accent); }

.auth-intro {
  padding: 2px 2px 22px;
}

.auth-intro h2 {
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  line-height: 1.05;
  max-width: 430px;
  margin-bottom: 11px;
}

.auth-intro .muted {
  max-width: 440px;
  font-size: .94rem;
  margin-bottom: 0;
}

.auth-reassurance {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: #8398b1;
  font-size: .76rem;
  line-height: 1.5;
}

.shell:not(.signed-in-mode) .card {
  border-color: rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(14,27,46,.94), rgba(9,19,33,.94));
}

.shell.signed-in-mode .welcome-only { display: none; }

@media (min-width: 881px) {
  .shell:not(.signed-in-mode) .brand-panel {
    padding-top: clamp(34px, 4.2vw, 62px);
    padding-bottom: clamp(34px, 4.2vw, 62px);
  }
  .shell:not(.signed-in-mode) .brand-panel h1 {
    font-size: clamp(3.5rem, 5.4vw, 5.8rem);
  }
  .shell:not(.signed-in-mode) .lead {
    margin-top: 22px;
    font-size: clamp(1rem, 1.25vw, 1.15rem);
  }
}

@media (max-width: 880px) {
  .welcome-points { margin-top: 24px; }
  .welcome-example { margin-top: 22px; }
}

@media (max-width: 560px) {
  .welcome-example-grid { grid-template-columns: 1fr; }
  .welcome-example-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .welcome-example-grid span { margin-bottom: 0; }
  .auth-intro { padding-bottom: 18px; }
  .auth-reassurance { display: grid; }
}

/* ==========================================================
   Phase 5.8 — Premium landing page, same SpareTally theme
   Inspired by modern finance landing-page composition while
   keeping SpareTally's own navy + mint visual identity.
   ========================================================== */

.shell:not(.signed-in-mode) {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 19%, rgba(81,224,166,.10), transparent 22%),
    radial-gradient(circle at 62% 27%, rgba(54,112,255,.10), transparent 25%),
    linear-gradient(180deg, #081321 0%, #07111f 48%, #050b14 100%);
}

.shell:not(.signed-in-mode) .brand-panel {
  min-height: auto;
  border-right: 0;
  padding: 0;
  display: block;
}

.shell:not(.signed-in-mode) > .brand-panel > .brand-mark {
  display: none;
}

.landing-nav {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(255,255,255,.075);
}

.landing-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: .78rem;
  letter-spacing: .17em;
  font-weight: 900;
}

.landing-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #042017;
  font-size: .74rem;
  letter-spacing: -.02em;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 25px;
}

.landing-nav-links a {
  color: #a8b8ca;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 750;
  transition: color .18s, border-color .18s, background .18s;
}

.landing-nav-links a:hover { color: var(--text); }

.landing-nav-links .landing-nav-cta {
  padding: 10px 14px;
  border: 1px solid rgba(81,224,166,.34);
  border-radius: 11px;
  color: #d6ffed;
  background: rgba(81,224,166,.08);
}

.shell:not(.signed-in-mode) .brand-hero {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 82px 0 68px;
  text-align: center;
  justify-items: center;
}

.landing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid rgba(81,224,166,.22);
  border-radius: 999px;
  background: rgba(81,224,166,.07);
  color: #a8f4d3;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.shell:not(.signed-in-mode) .brand-hero > .eyebrow {
  display: none;
}

.shell:not(.signed-in-mode) .brand-panel h1 {
  max-width: 900px;
  font-size: clamp(3.35rem, 7vw, 7.1rem);
  line-height: .92;
  text-wrap: balance;
}

.shell:not(.signed-in-mode) .lead {
  max-width: 760px;
  margin: 28px auto 0;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.65;
  text-wrap: balance;
}

.landing-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.landing-primary,
.landing-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 0 18px;
  border-radius: 12px;
  text-decoration: none;
  font-size: .86rem;
  font-weight: 850;
}

.landing-primary {
  background: var(--accent);
  color: #042017;
  box-shadow: 0 14px 38px rgba(81,224,166,.16);
}

.landing-primary:hover { background: var(--accent-strong); }

.landing-secondary {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
  color: var(--text);
}

.product-stage {
  position: relative;
  width: min(940px, 100%);
  min-height: 505px;
  margin: 66px auto 18px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.product-stage::before {
  content: "";
  position: absolute;
  inset: 50px 80px 20px;
  border-radius: 42px;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(135deg, rgba(19,44,72,.76), rgba(4,14,25,.58));
  background-size: 38px 38px, 38px 38px, auto;
  border: 1px solid rgba(255,255,255,.06);
  z-index: -2;
}

.product-stage-glow {
  position: absolute;
  width: 620px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(81,224,166,.20), rgba(37,93,255,.09) 43%, transparent 72%);
  filter: blur(24px);
  z-index: -1;
}

.mini-dashboard {
  width: min(470px, 76vw);
  padding: 20px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(16,32,52,.98), rgba(8,18,31,.98));
  box-shadow: 0 34px 90px rgba(0,0,0,.48), 0 0 0 7px rgba(3,10,18,.28);
  text-align: left;
  transform: none;
}

.mini-dashboard-top,
.mini-dashboard-title,
.mini-metrics,
.mini-movement-list,
.mini-confirm-row { position: relative; }

.mini-dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.mini-logo { display: flex; align-items: center; gap: 9px; }
.mini-logo span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #052017;
  font-size: .65rem;
  font-weight: 950;
}
.mini-logo strong { font-size: .83rem; }
.mini-status {
  color: var(--accent);
  font-size: .57rem;
  letter-spacing: .13em;
  font-weight: 900;
}

.mini-dashboard-title { padding: 21px 0 16px; }
.mini-dashboard-title span,
.mini-dashboard-title strong,
.mini-dashboard-title small { display: block; }
.mini-dashboard-title span { color: #b7c7d8; font-size: .78rem; }
.mini-dashboard-title strong { margin: 3px 0 2px; font-size: 2.6rem; letter-spacing: -.055em; color: var(--accent); }
.mini-dashboard-title small { color: #71869f; font-size: .67rem; }

.mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 15px;
}
.mini-metrics > div {
  padding: 11px 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.mini-metrics span,
.mini-metrics strong { display: block; }
.mini-metrics span { color: #7790a9; font-size: .62rem; margin-bottom: 3px; }
.mini-metrics strong { font-size: .95rem; }

.mini-movement-list {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
}
.mini-movement-list > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 11px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: .68rem;
}
.mini-movement-list > div:last-child { border-bottom: 0; }
.mini-movement-list span { color: #a7b7c8; }
.mini-movement-list b { display: inline-block; width: 44px; color: #6e849d; font-weight: 700; }
.mini-movement-list strong { font-size: .69rem; }
.money-in { color: var(--accent); }
.money-out { color: #ffabab; }

.mini-confirm-row {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid rgba(81,224,166,.14);
  border-radius: 12px;
  background: rgba(81,224,166,.055);
}
.mini-check {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(81,224,166,.14);
  color: var(--accent);
  font-weight: 950;
}
.mini-confirm-row strong,
.mini-confirm-row small { display: block; }
.mini-confirm-row strong { font-size: .67rem; }
.mini-confirm-row small { margin-top: 2px; color: #7590a7; font-size: .57rem; }

.float-card {
  position: absolute;
  z-index: 3;
  width: 168px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 15px;
  background: rgba(12,26,43,.92);
  box-shadow: 0 18px 45px rgba(0,0,0,.34);
  backdrop-filter: blur(12px);
  text-align: left;
}
.float-card span,
.float-card strong,
.float-card small { display: block; }
.float-card span { color: #8fa4bb; font-size: .64rem; }
.float-card strong { margin: 3px 0 2px; font-size: 1.28rem; letter-spacing: -.04em; }
.float-card small { color: #627993; font-size: .58rem; line-height: 1.35; }
.float-safe { right: 3%; top: 27%; border-color: rgba(81,224,166,.22); }
.float-safe strong { color: var(--accent); }
.float-bank { left: 3%; top: 22%; }
.float-bill { right: 6%; bottom: 13%; }

.shell:not(.signed-in-mode) .welcome-points {
  grid-template-columns: repeat(3, minmax(0,1fr));
  max-width: 940px;
  width: 100%;
  margin: 40px auto 0;
  text-align: left;
}

.landing-trust-strip {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(255,255,255,.075);
  border-bottom: 1px solid rgba(255,255,255,.075);
}
.landing-trust-strip span {
  padding: 22px 14px;
  text-align: center;
  color: #7389a2;
  font-size: .63rem;
  letter-spacing: .14em;
  font-weight: 900;
  border-right: 1px solid rgba(255,255,255,.06);
}
.landing-trust-strip span:last-child { border-right: 0; }

.feature-story {
  width: min(1080px, calc(100% - 40px));
  margin: 98px auto;
  min-height: 430px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 62px;
  align-items: center;
  padding: clamp(34px, 6vw, 72px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 32px;
  background:
    radial-gradient(circle at 75% 30%, rgba(81,224,166,.08), transparent 30%),
    linear-gradient(135deg, rgba(18,37,60,.88), rgba(7,17,31,.92));
  box-shadow: 0 30px 90px rgba(0,0,0,.24);
}
.feature-story-copy h2 {
  max-width: 560px;
  margin: 7px 0 17px;
  font-size: clamp(2.25rem, 4.2vw, 4.3rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.feature-story-copy > p:last-of-type {
  max-width: 560px;
  margin: 0;
  color: #9fb0c6;
  font-size: 1rem;
  line-height: 1.7;
}
.feature-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.feature-badges span {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  color: #a6b7c9;
  background: rgba(255,255,255,.025);
  font-size: .7rem;
  font-weight: 750;
}

.feature-visual {
  padding: 20px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  background: rgba(4,13,24,.58);
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}
.feature-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 13px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: #94a7bc;
  font-size: .83rem;
}
.feature-line strong { color: var(--text); }
.feature-line.tight {
  margin: 7px 0;
  border: 1px solid rgba(81,224,166,.18);
  border-radius: 12px;
  background: rgba(81,224,166,.06);
  color: #c7f7e3;
}
.feature-line.tight strong { color: var(--accent); }
.feature-safe {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 15px;
  border-radius: 13px;
  background: var(--accent);
  color: #052017;
  font-size: .77rem;
  font-weight: 850;
}
.feature-safe strong { font-size: 1.25rem; letter-spacing: -.04em; }

.shell:not(.signed-in-mode) .auth-panel {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(420px, .65fr);
  align-items: center;
  gap: clamp(44px, 8vw, 120px);
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto 110px;
  padding: clamp(34px, 6vw, 72px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(9,23,39,.96), rgba(5,13,24,.96));
}

.auth-section-copy h2 {
  max-width: 510px;
  margin: 8px 0 15px;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.auth-section-copy > p:last-child {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.shell:not(.signed-in-mode) .auth-panel .card {
  width: 100%;
  max-width: 520px;
  justify-self: end;
  max-height: none;
  background: linear-gradient(180deg, rgba(16,32,52,.96), rgba(8,19,33,.97));
}

.shell:not(.signed-in-mode) .brand-note {
  width: min(1080px, calc(100% - 40px));
  margin: -72px auto 48px;
  text-align: center;
  color: #61768e;
}

@media (max-width: 960px) {
  .landing-nav-links a:not(.landing-nav-cta) { display: none; }
  .product-stage { min-height: 470px; }
  .float-card { width: 150px; }
  .float-bank { left: 0; }
  .float-safe { right: 0; }
  .shell:not(.signed-in-mode) .welcome-points { grid-template-columns: 1fr; max-width: 680px; }
  .landing-trust-strip { grid-template-columns: 1fr 1fr; }
  .landing-trust-strip span:nth-child(2) { border-right: 0; }
  .landing-trust-strip span:nth-child(-n+2) { border-bottom: 1px solid rgba(255,255,255,.06); }
  .feature-story { grid-template-columns: 1fr; gap: 34px; }
  .shell:not(.signed-in-mode) .auth-panel { grid-template-columns: 1fr; gap: 32px; }
  .shell:not(.signed-in-mode) .auth-panel .card { justify-self: stretch; max-width: none; }
}

@media (max-width: 680px) {
  .landing-nav { width: min(100% - 28px, 1180px); }
  .landing-logo { font-size: .7rem; }
  .landing-nav-links { gap: 8px; }
  .landing-nav-links .landing-nav-cta { padding: 9px 11px; }
  .shell:not(.signed-in-mode) .brand-hero { width: min(100% - 28px, 1180px); padding: 56px 0 42px; }
  .shell:not(.signed-in-mode) .brand-panel h1 { font-size: clamp(3rem, 15vw, 4.7rem); }
  .product-stage { min-height: 520px; margin-top: 44px; align-items: center; }
  .product-stage::before { inset: 42px 0 25px; }
  .mini-dashboard { width: min(100%, 410px); padding: 17px; }
  .float-card { width: 140px; padding: 10px 11px; }
  .float-bank { top: 2%; left: 2%; }
  .float-safe { top: auto; bottom: 1%; right: 2%; }
  .float-bill { display: none; }
  .landing-trust-strip { width: min(100% - 28px, 1180px); }
  .feature-story { width: min(100% - 28px, 1080px); margin: 64px auto; padding: 28px 20px; border-radius: 24px; }
  .feature-story-copy h2 { font-size: clamp(2.2rem, 11vw, 3.2rem); }
  .shell:not(.signed-in-mode) .auth-panel { width: min(100% - 28px, 1080px); margin-bottom: 70px; padding: 25px 18px; border-radius: 24px; }
  .auth-section-copy h2 { font-size: clamp(2.2rem, 11vw, 3.1rem); }
  .shell:not(.signed-in-mode) .brand-note { width: min(100% - 28px, 1080px); margin: -38px auto 34px; }
}

/* Signed-in application stays on the existing SpareTally layout. */
.shell.signed-in-mode .landing-nav,
.shell.signed-in-mode .landing-kicker,
.shell.signed-in-mode .landing-actions,
.shell.signed-in-mode .product-stage,
.shell.signed-in-mode .landing-trust-strip,
.shell.signed-in-mode .feature-story,
.shell.signed-in-mode .auth-section-copy {
  display: none !important;
}

/* ==========================================================
   Phase 6.0 — Welcome motion + Security + About
   ========================================================== */

/* Demo number motion */
.demo-count {
  font-variant-numeric: tabular-nums;
}
.demo-count-main.demo-count-pulse {
  animation: demoValuePulse 900ms ease-out both;
}
@keyframes demoValuePulse {
  0% { text-shadow: 0 0 0 rgba(81,224,166,0); }
  45% { text-shadow: 0 0 28px rgba(81,224,166,.30); }
  100% { text-shadow: 0 0 0 rgba(81,224,166,0); }
}
.demo-movement {
  opacity: 0;
  transform: translateY(8px);
}
.product-stage.demo-animate .demo-movement {
  animation: demoRowIn 520ms cubic-bezier(.2,.8,.2,1) var(--demo-delay) forwards;
}
.demo-confirm {
  opacity: 0;
  transform: translateY(8px);
}
.product-stage.demo-animate .demo-confirm {
  animation: demoRowIn 520ms cubic-bezier(.2,.8,.2,1) 1580ms forwards;
}
.float-card {
  opacity: .01;
  transform: translateY(10px);
}
.product-stage.demo-animate .float-card {
  animation: demoCardIn 650ms cubic-bezier(.2,.8,.2,1) forwards;
}
.product-stage.demo-animate .float-bank { animation-delay: 180ms; }
.product-stage.demo-animate .float-safe { animation-delay: 520ms; }
.product-stage.demo-animate .float-bill { animation-delay: 760ms; }
@keyframes demoRowIn { to { opacity: 1; transform: translateY(0); } }
@keyframes demoCardIn { to { opacity: 1; transform: translateY(0); } }

/* Security / About sections */
.landing-info-section {
  width: min(1080px, calc(100% - 40px));
  margin: 98px auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 32px;
  background:
    radial-gradient(circle at 16% 22%, rgba(81,224,166,.07), transparent 28%),
    linear-gradient(135deg, rgba(14,31,51,.92), rgba(6,16,29,.95));
  box-shadow: 0 30px 90px rgba(0,0,0,.20);
}
.landing-info-heading {
  max-width: 780px;
  padding: clamp(34px, 6vw, 68px) clamp(28px, 6vw, 72px) 22px;
}
.landing-info-heading h2,
.about-copy h2 {
  margin: 8px 0 17px;
  font-size: clamp(2.25rem, 4.5vw, 4.35rem);
  line-height: .99;
  letter-spacing: -.055em;
}
.landing-info-heading > p:last-child,
.about-copy > p:not(.eyebrow) {
  color: #9fb0c6;
  font-size: 1rem;
  line-height: 1.75;
}
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  padding: 0 clamp(28px, 6vw, 72px) 24px;
}
.security-card {
  min-height: 190px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 20px;
  background: rgba(4,13,24,.48);
}
.security-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(81,224,166,.1);
  border: 1px solid rgba(81,224,166,.18);
  color: var(--accent);
  font-size: .66rem;
  font-weight: 950;
  letter-spacing: .08em;
}
.security-card h3 {
  margin: 18px 0 8px;
  font-size: 1.08rem;
}
.security-card p {
  margin: 0;
  color: #8fa3ba;
  line-height: 1.65;
  font-size: .86rem;
}
.security-note {
  margin: 0 clamp(28px, 6vw, 72px) clamp(30px, 6vw, 58px);
  padding: 15px 17px;
  border-left: 3px solid rgba(81,224,166,.45);
  border-radius: 0 12px 12px 0;
  background: rgba(81,224,166,.045);
  color: #8299b1;
  font-size: .78rem;
  line-height: 1.6;
}
.about-story {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 58px;
  padding: clamp(34px, 6vw, 72px);
  align-items: center;
}
.about-copy > p:not(.eyebrow) { margin: 0 0 15px; }
.about-copy > p:not(.eyebrow):last-child { margin-bottom: 0; }
.about-principles {
  display: grid;
  gap: 10px;
}
.about-principles > div {
  padding: 19px 20px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  background: rgba(5,15,27,.58);
}
.about-principles strong,
.about-principles span { display: block; }
.about-principles strong { margin-bottom: 5px; color: #dfeaf4; font-size: .9rem; }
.about-principles span { color: #8198b0; font-size: .78rem; line-height: 1.55; }

@media (max-width: 960px) {
  .security-grid { grid-template-columns: 1fr; }
  .about-story { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 680px) {
  .landing-info-section { width: min(100% - 28px, 1080px); margin: 64px auto; border-radius: 24px; }
  .landing-info-heading { padding: 28px 20px 18px; }
  .landing-info-heading h2,
  .about-copy h2 { font-size: clamp(2.15rem, 10.5vw, 3.1rem); }
  .security-grid { padding: 0 20px 20px; }
  .security-card { min-height: auto; padding: 20px; }
  .security-note { margin: 0 20px 28px; }
  .about-story { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .product-stage.demo-animate .demo-movement,
  .product-stage.demo-animate .demo-confirm,
  .product-stage.demo-animate .float-card,
  .demo-count-main.demo-count-pulse {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.shell.signed-in-mode .landing-info-section {
  display: none !important;
}


/* ==========================================================
   Phase 6.1 — Statistics
   ========================================================== */
.statistics-page {
  width: 100%;
  display: grid;
  gap: 18px;
}

.statistics-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.statistics-head h2 {
  margin: 4px 0 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -.045em;
}

.statistics-range-card { margin-bottom: 0; }

.statistics-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.statistics-metric-card {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.025);
  border-radius: 18px;
  padding: 20px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.statistics-metric-card > span,
.statistics-metric-card > small,
.statistics-key-grid span,
.statistics-key-grid small {
  color: var(--muted);
}

.statistics-metric-card > strong {
  font-size: clamp(1.65rem, 3vw, 2.7rem);
  line-height: 1;
  margin: 9px 0;
  letter-spacing: -.04em;
}

.statistics-metric-accent {
  border-color: rgba(81,224,166,.45);
  background: rgba(81,224,166,.08);
}

.statistics-metric-accent > strong { color: var(--accent); }

.statistics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr);
  gap: 14px;
}

.statistics-card { margin: 0; }
.statistics-cashflow-bars { display: grid; gap: 22px; padding-top: 10px; }
.statistics-bar-row { display: grid; gap: 9px; }
.statistics-bar-copy { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.statistics-bar-copy strong { color: var(--text); }
.statistics-bar-track { height: 20px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.055); }
.statistics-bar-track span { display: block; height: 100%; border-radius: inherit; transition: width .45s ease; }
.statistics-bar-in { background: var(--accent); }
.statistics-bar-out { background: var(--danger); }

.statistics-spend-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 26px;
  align-items: center;
  padding-top: 10px;
}

.statistics-donut {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.statistics-donut::after {
  content: "";
  position: absolute;
  width: 66%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
}
.statistics-donut > div {
  position: relative;
  z-index: 1;
  display: grid;
  text-align: center;
  gap: 3px;
}
.statistics-donut strong { font-size: 1.25rem; }
.statistics-donut span { color: var(--muted); font-size: .76rem; }
.statistics-legend { display: grid; gap: 14px; }
.statistics-legend-row { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; }
.statistics-legend-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.statistics-legend-row div { display: grid; gap: 2px; }
.statistics-legend-row small { color: var(--muted); }

.statistics-monthly-chart {
  display: flex;
  gap: 14px;
  align-items: stretch;
  overflow-x: auto;
  padding: 12px 2px 8px;
  min-height: 260px;
}
.statistics-month-column {
  flex: 1 0 104px;
  min-width: 104px;
  display: grid;
  grid-template-rows: 180px auto auto;
  gap: 7px;
  text-align: center;
}
.statistics-month-bars {
  height: 180px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 7px;
  border-bottom: 1px solid var(--border);
  padding: 0 10px;
}
.statistics-month-bars span {
  width: 28px;
  max-height: 100%;
  border-radius: 9px 9px 3px 3px;
  min-height: 3px;
  transition: height .45s ease;
}
.statistics-month-bars span {
  position: relative;
  cursor: pointer;
  outline: none;
}
.statistics-month-bars span::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  background: rgba(7, 16, 32, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: max-content;
  max-width: 180px;
  box-shadow: 0 16px 30px rgba(0,0,0,0.28);
  color: var(--text);
  font-size: .72rem;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity .16s ease, transform .16s ease;
}
.statistics-month-bars span::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%) translateY(6px);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(7, 16, 32, 0.96);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity .16s ease, transform .16s ease;
}
.statistics-month-bars span:hover::after,
.statistics-month-bars span:hover::before,
.statistics-month-bars span:focus-visible::after,
.statistics-month-bars span:focus-visible::before,
.statistics-month-bars span:active::after,
.statistics-month-bars span:active::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.statistics-month-in { background: var(--accent); }
.statistics-month-out { background: var(--danger); }
.statistics-month-column > strong { font-size: .85rem; }
.statistics-month-column > small { color: var(--muted); font-size: .72rem; line-height: 1.35; }

.statistics-key-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.statistics-key-grid > div {
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 16px;
  display: grid;
  gap: 6px;
  background: rgba(255,255,255,.02);
}
.statistics-key-grid strong { font-size: 1.35rem; }

@media (max-width: 1050px) {
  .statistics-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statistics-layout { grid-template-columns: 1fr; }
  .statistics-key-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .statistics-head { align-items: stretch; flex-direction: column; }
  .statistics-head .small-secondary { align-self: flex-start; }
  .statistics-metric-grid { grid-template-columns: 1fr 1fr; }
  .statistics-metric-card { padding: 15px; min-height: 112px; }
  .statistics-metric-card > strong { font-size: clamp(1.35rem, 7vw, 2rem); }
  .statistics-spend-layout { grid-template-columns: 1fr; justify-items: center; }
  .statistics-legend { width: 100%; }
  .statistics-key-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-actions { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .statistics-metric-grid, .statistics-key-grid { grid-template-columns: 1fr; }
}

.statistics-range-preset {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.035);
  color: var(--muted);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: .82rem;
  font-weight: 800;
}
.statistics-range-preset:hover,
.statistics-range-preset.active {
  color: var(--text);
  border-color: rgba(81,224,166,.38);
  background: rgba(81,224,166,.09);
}


/* ==========================================================
   Phase 6.2 — Dashboard statistics summary
   ========================================================== */
.dashboard-statistics-summary {
  padding: 20px;
  background:
    radial-gradient(circle at 88% 8%, rgba(81,224,166,.08), transparent 32%),
    rgba(255,255,255,.018);
}

.dashboard-statistics-head { align-items: center; }
.dashboard-statistics-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.dashboard-statistics-head-actions > span {
  color: #72859b;
  font-size: .76rem;
  font-weight: 700;
}

.dashboard-statistics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr) minmax(230px, .62fr);
  gap: 13px;
  padding-top: 16px;
}

.dashboard-statistics-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 16px;
  background: rgba(255,255,255,.022);
}

.dashboard-statistics-panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}
.dashboard-statistics-panel-title > div { display: grid; gap: 4px; }
.dashboard-statistics-panel-title span,
.dashboard-statistic-highlight span { color: var(--muted); font-size: .76rem; font-weight: 800; }
.dashboard-statistics-panel-title strong { font-size: 1.35rem; letter-spacing: -.025em; }
.dashboard-statistics-panel-title > small { color: #70849a; font-size: .7rem; line-height: 1.35; text-align: right; }

.dashboard-statistics-bars { display: grid; gap: 15px; }
.dashboard-statistics-bar-row { display: grid; gap: 7px; }
.dashboard-statistics-bar-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .78rem;
}
.dashboard-statistics-bar-row strong { color: var(--text); }
.dashboard-statistics-bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.055);
}
.dashboard-statistics-bar-track > span { display: block; height: 100%; border-radius: inherit; transition: width .4s ease; }
.dashboard-statistics-bar-in { background: var(--accent); }
.dashboard-statistics-bar-out { background: var(--danger); }

.dashboard-statistics-spend-body {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.dashboard-statistics-donut {
  width: 106px;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
}
.dashboard-statistics-donut::after {
  content: "";
  position: absolute;
  inset: 27%;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
}
.dashboard-statistics-legend { display: grid; gap: 10px; min-width: 0; }
.dashboard-statistics-legend-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.dashboard-statistics-legend-row > span { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.dashboard-statistics-legend-row > div { display: grid; gap: 1px; min-width: 0; }
.dashboard-statistics-legend-row strong { font-size: .78rem; }
.dashboard-statistics-legend-row small { color: var(--muted); font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dashboard-statistics-highlights {
  padding: 0;
  overflow: hidden;
  display: grid;
  align-content: stretch;
}
.dashboard-statistic-highlight {
  padding: 16px;
  display: grid;
  gap: 5px;
  align-content: center;
}
.dashboard-statistic-highlight + .dashboard-statistic-highlight { border-top: 1px solid var(--border); }
.dashboard-statistic-highlight strong { font-size: 1.45rem; letter-spacing: -.03em; }
.dashboard-statistic-highlight small { color: #72859b; font-size: .7rem; }
.dashboard-statistic-highlight:first-child strong { color: var(--accent); }

@media (max-width: 1180px) {
  .dashboard-statistics-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-statistics-highlights { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .dashboard-statistic-highlight + .dashboard-statistic-highlight { border-top: 0; border-left: 1px solid var(--border); }
}

@media (max-width: 760px) {
  .dashboard-statistics-head { align-items: flex-start; }
  .dashboard-statistics-head-actions { align-items: flex-end; flex-direction: column; }
  .dashboard-statistics-grid { grid-template-columns: 1fr; }
  .dashboard-statistics-highlights { grid-column: auto; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .dashboard-statistics-summary { padding: 15px; }
  .dashboard-statistics-head { align-items: stretch; flex-direction: column; }
  .dashboard-statistics-head-actions { align-items: stretch; }
  .dashboard-statistics-head-actions > span { text-align: left; }
  .dashboard-statistics-head-actions .small-secondary { width: 100%; }
  .dashboard-statistics-spend-body { grid-template-columns: 92px minmax(0, 1fr); }
  .dashboard-statistics-donut { width: 92px; }
  .dashboard-statistics-highlights { grid-template-columns: 1fr; }
  .dashboard-statistic-highlight + .dashboard-statistic-highlight { border-left: 0; border-top: 1px solid var(--border); }
}

/* ==========================================================
   Phase 6.3 — Language + currency preferences
   ========================================================== */
.preference-controls,
.signed-in-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preference-select {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.035);
  color: var(--text);
}
.preference-select select {
  width: auto;
  min-width: 78px;
  border: 0;
  padding: 7px 22px 7px 4px;
  background-color: transparent;
  color: var(--text);
  font-size: .76rem;
  font-weight: 760;
  box-shadow: none;
}
.preference-select select:focus { outline: none; }
.preference-select option { color: #0b1726; background: #fff; }
.preference-select.compact { min-height: 36px; }
.preference-select.compact select { font-size: .72rem; min-width: 70px; }
.preference-icon { font-size: .82rem; line-height: 1; }

html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .landing-nav,
html[dir="rtl"] .signed-in-bar,
html[dir="rtl"] .wizard-head,
html[dir="rtl"] .dashboard-head,
html[dir="rtl"] .section-head,
html[dir="rtl"] .date-range-head,
html[dir="rtl"] .movement-row,
html[dir="rtl"] .history-row { direction: rtl; }
html[dir="rtl"] .brand-hero,
html[dir="rtl"] .landing-info-section,
html[dir="rtl"] .feature-story,
html[dir="rtl"] .auth-panel,
html[dir="rtl"] .card,
html[dir="rtl"] .dashboard,
html[dir="rtl"] .manage-money { text-align: right; }
html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] .metric-value,
html[dir="rtl"] .money-in,
html[dir="rtl"] .money-out,
html[dir="rtl"] .demo-count,
html[dir="rtl"] .demo-fixed-money,
html[dir="rtl"] .demo-plain-money { direction: ltr; unicode-bidi: isolate; text-align: left; }
html[dir="rtl"] .money-input { direction: ltr; }

@media (max-width: 960px) {
  .landing-nav-links { flex-wrap: wrap; justify-content: flex-end; }
  .landing-preferences { order: -1; }
}
@media (max-width: 680px) {
  .landing-nav { align-items: flex-start; padding: 12px 0; }
  .landing-nav-links { max-width: 70%; }
  .landing-nav-links .landing-nav-cta { display: none; }
  .preference-select { min-height: 34px; padding: 0 5px; }
  .preference-select select { min-width: 62px; font-size: .68rem; padding-right: 17px; }
  .signed-in-bar { align-items: flex-start; }
  .signed-in-actions { flex-wrap: wrap; justify-content: flex-end; }
}


/* Phase 6.4 — signed-in dashboard recovery */
.dashboard-entry-btn { white-space: nowrap; }
.signed-in-recovery {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(245,184,92,.45);
  background: rgba(245,184,92,.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.signed-in-recovery[hidden] { display: none !important; }
.signed-in-recovery > div { display: grid; gap: 3px; }
.signed-in-recovery strong { color: var(--text); }
.signed-in-recovery span { color: var(--muted); font-size: .82rem; }
@media (max-width: 720px) {
  .signed-in-recovery { align-items: stretch; flex-direction: column; }
  .signed-in-actions { flex-wrap: wrap; }
}

/* Phase 6.6 — one-question-at-a-time safe spending flow */
.allowance-flow-card { overflow: hidden; }
.allowance-flow-head { align-items: flex-start; }
.allowance-restart { flex: 0 0 auto; }
.allowance-flow-progress { margin-top: 18px; display: grid; gap: 8px; }
.allowance-flow-progress-copy { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .78rem; }
.allowance-flow-progress-copy span:first-child { color: var(--accent); font-weight: 900; }
.allowance-flow-progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.allowance-flow-progress-track > span { display: block; height: 100%; width: 16.66%; border-radius: inherit; background: var(--accent); transition: width .24s ease; }
.allowance-flow-body { margin-top: 18px; }
.allowance-flow-step { min-height: 255px; border: 1px solid var(--border); border-radius: 18px; padding: clamp(20px, 3vw, 30px); background: rgba(255,255,255,.018); display: grid; align-content: start; gap: 12px; }
.allowance-flow-step[hidden] { display: none !important; }
.allowance-flow-step h4 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.55rem); max-width: 760px; }
.allowance-flow-big-value { display: block; width: fit-content; color: var(--accent); font-size: clamp(2.8rem, 7vw, 4.8rem); line-height: .95; letter-spacing: -.05em; margin: 4px 0 2px; }
.allowance-flow-committed { color: var(--text); }
.allowance-flow-explain { color: var(--muted); line-height: 1.6; max-width: 820px; margin: 0; }
.allowance-flow-actions { margin-top: auto; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.allowance-flow-actions .primary, .allowance-flow-actions .secondary { width: auto; min-width: 180px; }
.allowance-flow-actions-bottom { margin-top: 4px; padding-top: 0; }
.allowance-flow-percent-group { margin-top: 4px; }
.allowance-selection-preview { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 4px 18px; border: 1px solid rgba(81,224,166,.26); background: rgba(81,224,166,.06); border-radius: 16px; padding: 16px 18px; }
.allowance-selection-preview > span { color: var(--muted); font-size: .8rem; grid-column: 1 / -1; }
.allowance-selection-preview > strong { color: var(--accent); font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.allowance-selection-preview > small { color: var(--muted); align-self: center; }
.allowance-flow-result-card { margin-top: 2px; min-height: 190px; }
.allowance-flow-result-card.safe { border-color: rgba(81,224,166,.48); background: rgba(81,224,166,.09); }
.allowance-flow-result-card.unsafe { border-color: rgba(255,126,126,.52); background: rgba(255,126,126,.09); }
.allowance-flow-result-card > div:first-child > strong { font-size: clamp(2.6rem, 7vw, 4.6rem); }
.allowance-flow-spend-form { margin-top: 4px; }

@media (max-width: 760px) {
  .allowance-flow-head { flex-direction: column; }
  .allowance-restart { width: 100%; }
  .allowance-flow-step { min-height: 0; padding: 18px; }
  .allowance-flow-actions .primary, .allowance-flow-actions .secondary { width: 100%; min-width: 0; }
  .allowance-selection-preview { grid-template-columns: 1fr; }
  .allowance-selection-preview > span { grid-column: auto; }
}

/* Phase 6.6.1: one-off form clarity fix */
#returnFields[hidden] {
  display: none !important;
}
