:root {
  color-scheme: light;
  /* Wedding palette: dusty blue, emerald, gold on warm ivory */
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #f0ebe0;
  --border: #e6dfd0;
  --text: #1c2733;
  --text-2: #47525e;
  --muted: #646d78;
  --accent: #4f7396;        /* dusty blue */
  --accent-ink: #ffffff;
  --accent-soft: #e4ecf3;
  --emerald: #0f7f5f;
  --gold: #b58a2a;          /* fills and graphics */
  --gold-ink: #86651a;      /* gold used as text */
  --gold-soft: #f6ecd0;
  --hero-1: #4f7396; --hero-2: #3f6285; --hero-3: #0f6a50;
  --good: #0f7f5f;
  --bad: #b83a3a;
  --bad-soft: #fbe6e5;
  --income: var(--accent);
  --spent: var(--gold);
  --grid: #e9e3d5;
  --shadow: 0 1px 2px rgb(28 39 51 / .06), 0 4px 14px rgb(28 39 51 / .05);
  --radius: 14px;
  --nav-h: 64px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

:root[data-mode="dark"] {
    color-scheme: dark;
    --bg: #0f1720;
    --surface: #16212c;
    --surface-2: #1e2c3a;
    --border: #2b3b4b;
    --text: #f5f2ea;
    --text-2: #c9d0d7;
    --muted: #98a4b0;
    --accent: #8db1d6;
    --accent-ink: #0b1620;
    --accent-soft: #1f3244;
    --emerald: #3fbf94;
    --gold: #d8b45e;
    --gold-ink: #e5c677;
    --gold-soft: #3a3120;
    --hero-1: #2f4a63; --hero-2: #263b50; --hero-3: #0e4a39;
    --good: #4cc79c;
    --bad: #ff7a78;
    --bad-soft: #3a1f21;
    --grid: #243342;
    --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */

.shell { min-height: 100dvh; }
.main { padding: 0 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); max-width: 820px; margin: 0 auto; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 10px;
}
.topbar h1 { font-size: 24px; font-weight: 700; }

.sync-pill {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 4px 12px 4px 10px; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
}
.sync-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-pill[data-status="synced"]::before { background: var(--good); }
.sync-pill[data-status="syncing"]::before { background: var(--accent); animation: pulse 1s infinite alternate; }
.sync-pill[data-status="offline"]::before { background: var(--gold); }
.sync-pill[data-status="error"]::before { background: var(--bad); }
@keyframes pulse { to { opacity: .3; } }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.nav .brand { display: none; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 12px;
}
.nav-icon { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .75; }
.nav-item.active { color: var(--accent); font-weight: 600; }
.nav-item.active .nav-icon { filter: none; opacity: 1; }

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; bottom: 0; width: 220px; height: auto; flex-direction: column; justify-content: flex-start;
    border-top: 0; border-right: 1px solid var(--border); padding: 18px 12px; gap: 2px;
  }
  .nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
  .nav-item { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--accent-soft); }
  .main { margin-left: 220px; margin-right: 0; max-width: none; padding: 0 32px 64px; }
  .view { max-width: 820px; }
  .topbar { max-width: 820px; }
}

/* ---------- building blocks ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin: 0 0 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 650; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 16px; min-height: 42px; font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  font-size: 22px; line-height: 1; display: grid; place-items: center; padding-bottom: 3px;
}
.icon-btn:hover { background: var(--surface-2); }

.input {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}
.input:focus, .btn:focus-visible, .icon-btn:focus-visible, .row:focus-visible, .budget-row:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field-row { display: flex; gap: 10px; }
.field-row .grow { flex: 1; }
.icon-field { width: 76px; }
.emoji-input { text-align: center; font-size: 20px; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; min-width: 0; }
details summary { cursor: pointer; color: var(--text-2); font-size: 14px; margin: 6px 0 10px; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.form-error { color: var(--bad); font-size: 14px; }
.steps { padding-left: 18px; margin: 0; }
.steps li { margin-bottom: 6px; }
.account { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.account img { border-radius: 50%; }

.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty.small { padding: 28px 16px; }
.empty-icon { font-size: 48px; margin-bottom: 8px; }
.empty h2 { font-size: 20px; margin-bottom: 8px; color: var(--text); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- modal ---------- */

.modal {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
.modal::backdrop { background: rgb(0 0 0 / .45); }
.form { padding: 20px; }
.form h2 { font-size: 19px; margin-bottom: 16px; }
.form .amount { font-size: 24px; font-weight: 650; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; align-items: center; }
.spacer { flex: 1; }
@media (max-width: 600px) {
  .modal { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--text-2); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: -4px 0 14px; }
.emoji { border: 0; background: none; font-size: 20px; padding: 5px 0; border-radius: 8px; }
.emoji:hover { background: var(--surface-2); }

/* ---------- budget ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.month-bar { display: flex; align-items: center; gap: 6px; }
.month-label { border: 0; background: none; font-weight: 650; font-size: 17px; min-width: 150px; padding: 6px; }
.tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.tab { border: 0; background: none; padding: 7px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 14px; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 520px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .month-bar { justify-content: space-between; }
  .tabs .tab { flex: 1; }
}

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.tile-label { font-size: 13px; color: var(--text-2); }
.tile-value { font-size: 21px; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile.bad .tile-value { color: var(--bad); }

.budget-list { display: flex; flex-direction: column; }
.budget-row {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  border: 0; background: none; padding: 10px 6px; border-radius: 10px;
}
.budget-row:hover { background: var(--surface-2); }
.budget-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.budget-top { display: flex; justify-content: space-between; gap: 8px; }
.budget-top .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-top .amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.budget-sub { font-size: 12px; color: var(--muted); }
.budget-sub.bad { color: var(--bad); font-weight: 600; }
.bar { position: relative; display: block; height: 8px; background: var(--surface-2); border-radius: 4px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.bar .fill.over { background: var(--bad); }
.bar.nobudget .fill { background: var(--muted); opacity: .45; }
.bar .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; border-radius: 1px; }

.cat-icon {
  flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 19px;
}

.list { display: flex; flex-direction: column; }
.card.list { padding: 4px 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; background: none; padding: 9px 6px; border-radius: 10px;
}
.row + .row { border-top: 1px solid var(--border); border-radius: 0; }
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-amt { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-amt.pos { color: var(--good); }
.row-amt.muted { font-weight: 450; font-size: 14px; }

.filters { display: flex; gap: 8px; margin-bottom: 8px; }
.filters input { flex: 2; }
.filters select { flex: 1; min-width: 0; }
@media (max-width: 520px) { .filters { flex-direction: column; } }
.summary-line { margin: 0 0 10px; }
.day-head { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 4px 6px; }

.fab {
  position: fixed; right: 20px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 15;
  width: 58px; height: 58px; border-radius: 18px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 32px; line-height: 1; padding-bottom: 4px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25);
}
@media (min-width: 900px) { .fab { bottom: 32px; right: 32px; } }

/* ---------- chart ---------- */

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin: -4px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.income { background: var(--income); }
.sw.spent { background: var(--spent); }
.chart-wrap { position: relative; max-width: 640px; }
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .grid.base { stroke: var(--muted); opacity: .6; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .axis.current { fill: var(--text); font-weight: 700; }
.chart .bar-income { fill: var(--income); }
.chart .bar-spent { fill: var(--spent); }
.chart .col-bg { fill: var(--surface-2); opacity: 0; }
.chart .col.hover .col-bg { opacity: 1; }
.chart .hit { fill: transparent; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .15); font-size: 13px; color: var(--text-2);
}
.tooltip div { display: flex; align-items: center; gap: 6px; }
.tooltip b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.tooltip .tip-title { font-weight: 650; color: var(--text); margin-bottom: 4px; }
.tooltip .tip-net { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.table-view table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-view th, .table-view td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border); }
.table-view th:first-child, .table-view td:first-child { text-align: left; }

/* ---------- bank sync ---------- */

.review-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius); text-align: left;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold) 15%, var(--surface));
}
.review-go { font-weight: 650; color: var(--accent); white-space: nowrap; }
.badge.warn { background: color-mix(in srgb, var(--gold) 24%, transparent); color: var(--text); font-size: 11px; padding: 1px 7px; vertical-align: 1px; }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 0 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.rule-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px 12px; margin: 4px 0 10px; }
.rule-box .check { margin: 0 0 8px; }
.rule-box .input { min-height: 38px; background: var(--surface); }

/* ---------- period selector ---------- */

.period-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.period-select { width: auto; min-width: 150px; font-weight: 550; }
.custom-range { display: flex; gap: 10px; margin: -4px 0 14px; }
.custom-range label { flex: 1; min-width: 0; }
.custom-range span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
@media (max-width: 520px) {
  .period-row { flex-direction: column; align-items: stretch; }
  .period-select { width: 100%; }
}

/* ---------- series colors (categorical, fixed order) ---------- */
:root {
  --c1: var(--accent); --c2: var(--gold); --c3: var(--emerald); --c4: #cf6f8b; --c5: #6b5bb5; --c6: #dd6b3a; --c7: #5f7280; --c-other: #9a998f;
  --goals: var(--emerald);
}
:root[data-mode="dark"] {
    --c1: var(--accent); --c2: var(--gold); --c3: var(--emerald); --c4: #e58aa5; --c5: #a196e6; --c6: #ee8a5e; --c7: #8fa1b0; --c-other: #6b6a63;
}
.good { color: var(--good); }
.bad { color: var(--bad); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--bad); text-decoration: none; padding: 6px 8px; }
.section-title { font-size: 17px; margin: 22px 2px 10px; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.money-input { display: flex; align-items: center; gap: 6px; }
.money-input > span { color: var(--muted); font-weight: 600; }
.money-input .input { min-width: 0; }
.field .money-input { width: 100%; }

/* ---------- tabs (4) & alerts ---------- */
@media (max-width: 520px) { .tab { padding: 7px 4px; font-size: 13px; } }
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.alert-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
  background: color-mix(in srgb, var(--gold) 15%, var(--surface));
}
.alert-row.over { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }

/* ---------- plan ---------- */
.alloc { height: 12px; background: var(--surface-2); border-radius: 6px; display: flex; overflow: hidden; gap: 2px; margin: 12px 0 8px; }
.alloc-seg { display: block; height: 100%; min-width: 0; }
.alloc-seg.budget, .sw.alloc-budget { background: var(--accent); }
.alloc-seg.goals, .sw.alloc-goals { background: var(--goals); }
.alloc-legend { flex-wrap: wrap; row-gap: 4px; }
.alloc-legend .good, .alloc-legend .bad { font-weight: 650; margin-left: auto; }
.plan-tools { margin-bottom: 8px; }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.plan-row + .plan-row { border-top: 1px solid var(--border); }
.plan-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-main .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row .money-input { width: 118px; flex: none; }
.plan-row .input { text-align: right; }

/* ---------- goals & wedding ---------- */
.goals .card, .wedding .card { margin-bottom: 12px; }
.intro h2 { margin-bottom: 6px; }
.intro .btn { margin: 6px 8px 0 0; }
.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.starter { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 550; text-align: left; }
.starter span { font-size: 22px; }
.starter:hover { background: var(--surface-2); }
.summary-top { display: flex; align-items: center; gap: 16px; }
.summary .big { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ring { width: 92px; height: 92px; flex: none; }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--goals); stroke-width: 9; stroke-linecap: round; }
.ring-text { fill: var(--text); font-size: 17px; font-weight: 700; }
.ring-sub { fill: var(--muted); font-size: 9px; }
.afford { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.afford-row { display: flex; justify-content: space-between; gap: 8px; }
.afford p { margin: 8px 0 0; }
.goal { display: flex; flex-direction: column; gap: 10px; }
.goal-main { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 0; color: inherit; text-decoration: none; cursor: pointer; }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goal-title .name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-pct { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.goal-numbers { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.goal-line { font-size: 14px; color: var(--text-2); }
.goal.done { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.goal .btn { align-self: flex-start; }
.bar.progress { height: 10px; }
.bar.progress.big { height: 14px; border-radius: 7px; margin: 12px 0; }
.bar.progress .fill { background: var(--goals); }
.bar.progress .fill.done { background: var(--good); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.on { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); font-weight: 600; }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-weight: 600; }
.summary .streak { display: inline-block; margin-top: 6px; }
.goal-add { margin: 4px 0 8px; }
.goal-add .btn { text-decoration: none; }

.idea-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.idea-head h3 { font-size: 16px; }
.idea-icon { font-size: 22px; }
.idea-body p { margin: 0 0 8px; }
.idea > .btn { margin-top: 10px; }
.whatif { display: flex; flex-direction: column; gap: 10px; }
.slider { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.slider input { width: 100%; accent-color: var(--accent); }
.whatif-result { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.whatif-result p { margin: 0; }
.subs { list-style: none; padding: 0; margin: 10px 0 0; }
.subs li { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.subs li > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.windfall { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.windfall-result .btn { margin-top: 8px; }
.challenge-start { margin-top: 10px; flex-wrap: wrap; }
.challenge-start .input { flex: 1 1 130px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }

.detail-head { display: flex; align-items: center; gap: 12px; }
.detail-sub { font-size: 14px; margin: 16px 0 6px; color: var(--text-2); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 8px; }
.stat-grid div { display: flex; flex-direction: column; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.stat-grid b { font-variant-numeric: tabular-nums; }
.path-chart { margin: 12px 0 4px; }
.detail-whatif { margin-top: 10px; }
.helpers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; }
.modal { overflow-y: auto; }

/* line chart series */
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.req { stroke: var(--muted); stroke-dasharray: 5 4; }
.chart .line.act { stroke: var(--c1); }
.chart .line.proj { stroke: var(--c2); stroke-dasharray: 2 4; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.req { fill: var(--muted); } .chart .dot.act { fill: var(--c1); } .chart .dot.proj { fill: var(--c2); }
.sw.line-req { background: none; border-top: 2px dashed var(--muted); border-radius: 0; height: 0; width: 14px; vertical-align: middle; }
.sw.line-act { background: var(--c1); height: 3px; width: 14px; border-radius: 2px; vertical-align: middle; }
.sw.line-proj { background: none; border-top: 2px dotted var(--c2); border-radius: 0; height: 0; width: 14px; vertical-align: middle; }

/* wedding */
.wed-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
@media (max-width: 520px) { .wed-grid { grid-template-columns: 1fr 1fr; } .wed-grid .field:last-child { grid-column: 1 / -1; } }
.wed-count { margin: 0 0 10px; color: var(--text-2); }
.wed-numbers { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wed-numbers div { display: flex; flex-direction: column; }
.wed-numbers b { font-variant-numeric: tabular-nums; }
.need-box { margin: 14px 0 10px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--goals) 12%, var(--surface-2)); }
.wed-head .chips { margin: 8px 0 12px; }
.stack { display: flex; height: 14px; gap: 2px; border-radius: 7px; overflow: hidden; margin: 4px 0 12px; }
.stack-seg { min-width: 3px; }
.c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); } .c4 { background: var(--c4); }
.c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); } .other { background: var(--c-other); }
.stack-legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.stack-legend li { display: flex; align-items: center; gap: 8px; }
.stack-legend li span:nth-of-type(1) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-legend b { font-variant-numeric: tabular-nums; }
.stack-legend .sw { flex: none; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.item + .item { border-top: 1px solid var(--border); }
.item-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; border: 0; background: none; padding: 0; text-align: left; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.item-body .bar { height: 7px; }
.item-body .budget-top .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wedding .fab { z-index: 15; }

/* =====================================================================
   Wedding theme touches, drag handles, category detail, home screen
   ===================================================================== */

/* Serif for the moments that should feel special */
.topbar h1, .nav .brand span, .hero .cd-unit b, .summary .big, .wed-count b { font-family: var(--serif); }
.topbar h1 { letter-spacing: .1px; }
.topbar { border-bottom: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); margin-bottom: 14px; }
.nav .brand { text-decoration: none; color: var(--text); }
.nav-item.active { color: var(--accent); }
@media (min-width: 900px) { .nav-item.active { box-shadow: inset 3px 0 0 var(--gold); } }
.card { border-color: color-mix(in srgb, var(--gold) 16%, var(--border)); }
.btn.primary { box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 60%, transparent); }
.fab { background: var(--accent); box-shadow: 0 6px 20px rgb(28 39 51 / .28), 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent); }
.nav-item { font-size: 11px; }
@media (max-width: 420px) { .nav-item { font-size: 10.5px; } .nav-icon { font-size: 20px; } }
.link { color: var(--accent); }
.tabs .tab.active { box-shadow: var(--shadow), inset 0 -2px 0 var(--gold); }

/* ---------- drag to reorder ---------- */
.drag-handle {
  flex: none; width: 28px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 16px; letter-spacing: -3px;
  cursor: grab; touch-action: none; user-select: none; border-radius: 8px; display: grid; place-items: center; padding: 0;
}
.drag-handle:hover { background: var(--surface-2); color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.drag-handle:focus-visible { outline: 2px solid var(--accent); }
.dragging { position: relative; z-index: 40; background: var(--surface); border-radius: 12px; box-shadow: 0 10px 28px rgb(28 39 51 / .28); opacity: .96; }
.sorting .plan-row, .sorting .goal, .sorting .item { transition: none; }
.drop-before { box-shadow: 0 -3px 0 0 var(--gold); }
.drop-end { box-shadow: 0 3px 0 0 var(--gold); }
.goal { position: relative; }
.goal-grip { position: absolute; right: 8px; top: 8px; }
.goal .goal-head { padding-right: 34px; }
.plan-row { padding: 6px 0; }
.plan-row.dragging, .item.dragging { padding-left: 6px; padding-right: 6px; }
.plan-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 2px 0; text-align: left; color: inherit; border-radius: 10px; }
.plan-open:hover { background: var(--surface-2); }
.plan-open:focus-visible { outline: 2px solid var(--accent); }
.plan-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row .money-input { width: 104px; }
.item .drag-handle { height: 36px; }
.bell { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 15px; display: grid; place-items: center; padding: 0; opacity: .55; }
.bell.on { opacity: 1; background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 50%, var(--border)); }
.bell:focus-visible { outline: 2px solid var(--accent); }
.master-alert { margin-bottom: 14px; }
.detail-alert { margin: 14px 0 0; }

/* kind-of-spending tags */
.tag { display: inline-block; font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 999px; vertical-align: 1px; white-space: nowrap; }
.tag.fixed { background: var(--accent-soft); color: var(--accent); }
.tag.essential { background: var(--surface-2); color: var(--text-2); }
.tag.flexible { background: color-mix(in srgb, var(--emerald) 16%, transparent); color: var(--good); }
.tag.avoidable { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

.trims { display: flex; flex-direction: column; margin: 4px 0 12px; }
.trim-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 4px; border: 0; background: none; text-align: left; color: inherit; border-radius: 10px; }
.trim-row + .trim-row { border-top: 1px solid var(--border); border-radius: 0; }
.trim-row:hover { background: var(--surface-2); }
.trim-save { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* category detail */
.stat-grid.three { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.stat-grid.three div { padding: 8px 10px; }
.mbars { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 8px; }
.mbar { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; gap: 8px; font-size: 14px; }
.mbar b { text-align: right; font-variant-numeric: tabular-nums; }
.mbar .mlabel { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtrack { position: relative; height: 12px; background: var(--surface-2); border-radius: 6px; }
.mfill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 6px; }
.mfill.over { background: var(--bad); }
.mbar.partial .mfill { background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 5px, color-mix(in srgb, var(--accent) 55%, var(--surface)) 5px, color-mix(in srgb, var(--accent) 55%, var(--surface)) 10px); }
.mbar.partial .mfill.over { background: repeating-linear-gradient(45deg, var(--bad), var(--bad) 5px, color-mix(in srgb, var(--bad) 55%, var(--surface)) 5px, color-mix(in srgb, var(--bad) 55%, var(--surface)) 10px); }
.mbudget { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); border-radius: 1px; }
.mlegend { text-align: right; }
.kv { display: grid; gap: 0; margin: 8px 0; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--border); }
.kv > div > span { color: var(--text-2); }
.kv > div > b { text-align: right; }
.reduce { margin: 16px 0 4px; padding: 14px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--gold); }
.reduce.fixed { border-left-color: var(--accent); }
.reduce.flexible { border-left-color: var(--emerald); }
.reduce.avoidable { border-left-color: var(--bad); }
.reduce-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.reduce p { margin: 0 0 8px; }
.reduce-save { font-size: 15px; }
.tips { margin: 6px 0 0; padding-left: 18px; }
.tips li { margin-bottom: 4px; }
.set-chips { margin-bottom: 8px; }
.set-custom { margin-top: 4px; }
.set-custom .money-input { flex: 1; }

/* ---------- home ---------- */
.hero {
  position: relative; text-align: center; padding: 22px 16px 18px; color: #fff; border: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
  background: linear-gradient(155deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 130%);
  box-shadow: 0 8px 28px rgb(28 39 51 / .18);
}
.hero::before { content: ""; position: absolute; inset: 6px; border: 1px solid color-mix(in srgb, var(--gold) 65%, transparent); border-radius: calc(var(--radius) - 5px); pointer-events: none; }

.hero-eyebrow { font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; color: #ecd9a4; margin-bottom: 10px; }
.hero-empty { margin: 4px 0 14px; color: #f3f6f9; }
.hero-btn { background: #fff; color: #2f4d69; border-color: transparent; text-decoration: none; }
.hero .cd-units { display: flex; justify-content: center; gap: 10px; }
.hero .cd-unit { min-width: 62px; display: flex; flex-direction: column; align-items: center; padding: 8px 6px; border-radius: 12px; background: rgb(255 255 255 / .12); }
.hero .cd-unit b { font-size: 32px; line-height: 1.1; font-weight: 600; font-variant-numeric: tabular-nums; color: #fff; }
.hero .cd-unit span { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: #ecd9a4; }
.hero .cd-note { margin-top: 12px; font-family: var(--serif); font-style: italic; font-size: 17px; color: #fff; }
.hero .cd-date { margin-top: 2px; font-size: 13px; color: #d9e3ec; }
.hero-fund { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: 14px; color: #fff; text-decoration: none; font-size: 14px; }
.hero-bar { display: block; width: min(320px, 90%); height: 6px; border-radius: 3px; background: rgb(255 255 255 / .22); overflow: hidden; }
.hero-bar > span { display: block; height: 100%; background: #e5c677; border-radius: 3px; }
@media (max-width: 380px) { .hero .cd-unit { min-width: 54px; } .hero .cd-unit b { font-size: 27px; } }
.home .card a.link, .home .card-head .link { font-size: 14px; text-decoration: none; }
.home-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-bottom: 12px; }
.home-money div { display: flex; flex-direction: column; }
.home-money b { font-size: 20px; font-variant-numeric: tabular-nums; }
.home-note { margin: 8px 0 0; }
.home .alerts { margin-top: 12px; }
.home a.alert-row, .home a.review-banner { text-decoration: none; color: inherit; }
.home .review-banner { margin: 10px 0 0; }
.mini-goals { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mini-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.mini-top > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* large-purchase alerts & delete */
.alert-row.big { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.detail-big { margin-top: 12px; }
.form-actions .btn.danger { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

/* Drag grip: two lines (looks draggable, not like a menu button) */
.drag-handle { font-size: 0; letter-spacing: 0; }
.drag-handle::before { content: ""; box-sizing: border-box; width: 18px; height: 8px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; border-radius: 1px; }
.drag-handle { color: color-mix(in srgb, var(--muted) 85%, var(--text)); }
.grip-inline { display: inline-block; box-sizing: border-box; width: 14px; height: 7px; border-top: 2px solid var(--muted); border-bottom: 2px solid var(--muted); vertical-align: 1px; margin: 0 2px; }

/* Category names you can tap */
.name-link { color: var(--accent); font-weight: 650; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.plan-open:hover .name-link, .trim-row:hover .name-link { text-decoration-color: var(--accent); }
.chev { flex: none; color: var(--accent); font-size: 24px; line-height: 1; margin-left: 2px; }

/* ---------- palettes (Wedding is the default, defined at the top) ---------- */
:root[data-palette="rose"] {
  --bg: #fbf4f2;
  --surface: #fffdfc;
  --surface-2: #f4e9e6;
  --border: #ead8d3;
  --text: #2b2226;
  --text-2: #57494f;
  --muted: #75666c;
  --accent: #a4576b;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3e8;
  --emerald: #4f7a5a;
  --gold: #b58a2a;
  --gold-ink: #86651a;
  --gold-soft: #f6ecd0;
  --good: #3f7a52;
  --bad-soft: #fbe6e5;
  --grid: #efe1dd;
  --hero-1: #a4576b;
  --hero-2: #8c4658;
  --hero-3: #4f7a5a;
}
:root[data-palette="rose"][data-mode="dark"] {
  --bg: #1c1418;
  --surface: #261b21;
  --surface-2: #33252c;
  --border: #4a3640;
  --text: #f7efe9;
  --text-2: #d8c9cd;
  --muted: #ac9aa1;
  --accent: #e59ab0;
  --accent-ink: #2a1119;
  --accent-soft: #4a2833;
  --emerald: #8fc39b;
  --gold: #d8b45e;
  --gold-ink: #e5c677;
  --gold-soft: #3a3120;
  --good: #8fd0a0;
  --bad-soft: #3a1f21;
  --grid: #3a2b33;
  --hero-1: #7b3d4f;
  --hero-2: #64313f;
  --hero-3: #2f5138;
}
:root[data-palette="sage"] {
  --bg: #f4f5ee;
  --surface: #fdfdf9;
  --surface-2: #eaece0;
  --border: #dcdfcf;
  --text: #1f2a22;
  --text-2: #46524a;
  --muted: #60695f;
  --accent: #4f7a5a;
  --accent-ink: #ffffff;
  --accent-soft: #e2ede4;
  --emerald: #3f7d6d;
  --gold: #b0703a;
  --gold-ink: #87521f;
  --gold-soft: #f3e4d6;
  --good: #2e7a55;
  --bad-soft: #fbe6e5;
  --grid: #e3e6d6;
  --hero-1: #4f7a5a;
  --hero-2: #3f6649;
  --hero-3: #2f5a55;
}
:root[data-palette="sage"][data-mode="dark"] {
  --bg: #131a15;
  --surface: #1b241d;
  --surface-2: #253027;
  --border: #34423a;
  --text: #eef3ea;
  --text-2: #c5d0c6;
  --muted: #98a79a;
  --accent: #9cc7a6;
  --accent-ink: #10190f;
  --accent-soft: #24382a;
  --emerald: #7fcbb7;
  --gold: #e0a070;
  --gold-ink: #efb98d;
  --gold-soft: #3b2c1f;
  --good: #7fd1a5;
  --bad-soft: #3a1f21;
  --grid: #2a3a2f;
  --hero-1: #34523c;
  --hero-2: #2a4331;
  --hero-3: #245049;
}
:root[data-palette="lavender"] {
  --bg: #f6f4fa;
  --surface: #fdfcff;
  --surface-2: #ece8f4;
  --border: #ddd7ea;
  --text: #221e30;
  --text-2: #4b4560;
  --muted: #675f7d;
  --accent: #6a5bb5;
  --accent-ink: #ffffff;
  --accent-soft: #e8e4f6;
  --emerald: #157a6e;
  --gold: #b58a2a;
  --gold-ink: #86651a;
  --gold-soft: #f6ecd0;
  --good: #157a6e;
  --bad-soft: #fbe6e5;
  --grid: #e6e0f0;
  --hero-1: #6a5bb5;
  --hero-2: #574a9c;
  --hero-3: #157a6e;
}
:root[data-palette="lavender"][data-mode="dark"] {
  --bg: #16131f;
  --surface: #1f1b2b;
  --surface-2: #2a2538;
  --border: #3c3550;
  --text: #f3f0fa;
  --text-2: #cfc9df;
  --muted: #a39bba;
  --accent: #b5a9f0;
  --accent-ink: #17122b;
  --accent-soft: #2f2848;
  --emerald: #5fd0c0;
  --gold: #d8b45e;
  --gold-ink: #e5c677;
  --gold-soft: #3a3120;
  --good: #5fd0c0;
  --bad-soft: #3a1f21;
  --grid: #332d45;
  --hero-1: #4a3f86;
  --hero-2: #3b326d;
  --hero-3: #125b52;
}
:root[data-palette="classic"] {
  --bg: #f6f6f4;
  --surface: #fcfcfb;
  --surface-2: #efefec;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #66655f;
  --accent: #2570cc;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefb;
  --emerald: #0a7d3b;
  --gold: #c2571f;
  --gold-ink: #a3450f;
  --gold-soft: #fdeadf;
  --good: #0a7d3b;
  --bad-soft: #fbe6e5;
  --grid: #e7e6e1;
  --hero-1: #2570cc;
  --hero-2: #1c5aa8;
  --hero-3: #0a7d3b;
}
:root[data-palette="classic"][data-mode="dark"] {
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #252523;
  --border: #30302d;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #97968e;
  --accent: #6aa6ee;
  --accent-ink: #0b1620;
  --accent-soft: #1b2b40;
  --emerald: #4cc27a;
  --gold: #ff9a6b;
  --gold-ink: #ffb48f;
  --gold-soft: #3a2418;
  --good: #4cc27a;
  --bad-soft: #3a1f21;
  --grid: #2a2a27;
  --hero-1: #1f4d8a;
  --hero-2: #183e70;
  --hero-3: #0e5a34;
}
:root[data-palette="graphite"] {
  --bg: #f5f5f4;
  --surface: #fdfdfc;
  --surface-2: #ececea;
  --border: #dddcd8;
  --text: #1a1d21;
  --text-2: #454a50;
  --muted: #5f656c;
  --accent: #3d4a57;
  --accent-ink: #ffffff;
  --accent-soft: #e4e7ea;
  --emerald: #0f7f5f;
  --gold: #8c7a2e;
  --gold-ink: #6b5d1f;
  --gold-soft: #f0ead0;
  --good: #0f7f5f;
  --bad-soft: #fbe6e5;
  --grid: #e4e3df;
  --hero-1: #3d4a57;
  --hero-2: #2f3a45;
  --hero-3: #3f4d5a;
}
:root[data-palette="graphite"][data-mode="dark"] {
  --bg: #0f1113;
  --surface: #171a1d;
  --surface-2: #202428;
  --border: #30353a;
  --text: #f2f3f4;
  --text-2: #c4c9ce;
  --muted: #98a0a8;
  --accent: #aab8c6;
  --accent-ink: #0e1216;
  --accent-soft: #232c35;
  --emerald: #4cc79c;
  --gold: #cfbf6a;
  --gold-ink: #e0d184;
  --gold-soft: #37331c;
  --good: #4cc79c;
  --bad-soft: #3a1f21;
  --grid: #262b30;
  --hero-1: #2f3a45;
  --hero-2: #252e37;
  --hero-3: #2c3a44;
}

/* =====================================================================
   Bolder theme, phone plan rows, text size, high contrast, swatches
   ===================================================================== */

/* Header band in the palette's main color, with a gold rule */
.topbar {
  margin: 0 -16px 14px; padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff;
  border-bottom: 3px solid var(--gold);
}
.topbar h1 { color: #fff; }
.topbar .sync-pill { background: rgb(255 255 255 / .14); color: #fff; border-color: rgb(255 255 255 / .38); }
@media (min-width: 900px) { .topbar { max-width: none; margin: 0 -32px 16px; padding-left: 32px; padding-right: 32px; } }

/* Gold marker on the active navigation item */
.nav-item.active { box-shadow: inset 0 3px 0 var(--gold); }
@media (min-width: 900px) { .nav-item.active { box-shadow: inset 3px 0 0 var(--gold); } }
.nav .brand img { border-radius: 7px; }

/* Phone plan rows: emoji back, budget box on its own line under the name */
.mi-label { display: none; }
@media (max-width: 480px) {
  .plan-main .name, .plan-main .small { white-space: normal; overflow: visible; text-overflow: clip; }
  .plan-row {
    display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "grip open bell" "grip input input";
    column-gap: 6px; row-gap: 2px; align-items: center; padding: 8px 0;
  }
  .plan-row .drag-handle { grid-area: grip; align-self: stretch; height: auto; min-height: 40px; width: 24px; }
  .plan-row .plan-open { grid-area: open; }
  .plan-row .bell { grid-area: bell; width: 32px; height: 32px; font-size: 14px; }
  .plan-row .money-input { grid-area: input; justify-self: start; margin-left: 48px; width: auto; gap: 6px; }
  .plan-row .money-input .input { width: 112px; min-height: 40px; }
  .plan-row .mi-label { display: inline; font-size: 12px; font-weight: 500; }
}

/* Text size (Settings → Appearance) */
body { font-size: calc(15px * var(--fs-scale, 1)); }
.small, .row-sub, .budget-sub, .tile-sub, .tile-label, .field > span, .plan-main .small, .home-note, .muted.small { font-size: calc(13px * var(--fs-scale, 1)); }
.badge, .chip, .tag, .mlabel, .mi-label { font-size: calc(12px * var(--fs-scale, 1)); }
.tab, .btn.sm, .mbar, .mini-top, .kv, .check { font-size: calc(14px * var(--fs-scale, 1)); }
.tile-value { font-size: calc(21px * var(--fs-scale, 1)); }
.input { font-size: calc(16px * var(--fs-scale, 1)); }

/* High contrast */
:root[data-contrast="high"] { --text: #000; --text-2: #1a1a1a; --muted: #333; --border: #6b6b6b; --grid: #8f8f8f; }
:root[data-contrast="high"][data-mode="dark"] { --text: #fff; --text-2: #f2f2f2; --muted: #dcdcdc; --border: #a3a3a3; --grid: #777; }
:root[data-contrast="high"] .card, :root[data-contrast="high"] .tile, :root[data-contrast="high"] .input,
:root[data-contrast="high"] .btn, :root[data-contrast="high"] .alert-row, :root[data-contrast="high"] .review-banner { border-color: var(--border); border-width: 2px; }
:root[data-contrast="high"] a, :root[data-contrast="high"] .link { text-decoration: underline; }
:root[data-contrast="high"] :focus-visible { outline: 3px solid var(--text) !important; outline-offset: 2px; }
:root[data-contrast="high"] .bar, :root[data-contrast="high"] .mtrack { outline: 1px solid var(--border); }

/* Theme swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.swatch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); text-align: left; color: var(--text); }
.swatch:hover { background: var(--surface-2); }
.swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch .dots { display: inline-flex; }
.swatch .dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -6px; }
.swatch .dots i:first-child { margin-left: 0; }
.sw-name { font-weight: 600; font-size: calc(14px * var(--fs-scale, 1)); }

/* ---------- privacy (hide amounts) and demo mode ---------- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.eye-btn {
  width: 34px; height: 34px; border-radius: 50%; padding: 0; font-size: 16px; line-height: 1; display: grid; place-items: center;
  background: rgb(255 255 255 / .14); color: #fff; border: 1px solid rgb(255 255 255 / .38);
}
.eye-btn:hover { background: rgb(255 255 255 / .24); }
.eye-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.eye-btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }

/* Numbers typed into amount boxes show as dots until you tap into them */
.hide-amounts input[inputmode="decimal"]:not(:focus) { -webkit-text-security: disc; text-security: disc; }

.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; padding: 10px 14px;
  border-radius: var(--radius); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 65%, transparent); color: var(--text);
}
.demo-card { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.demo-on .real-only { display: none; }
.sync-pill[data-status="sandbox"]::before { background: var(--gold); }
.topbar .sync-pill[data-status="sandbox"] { border-color: var(--gold); }

/* =====================================================================
   Undo bar, swipe rows, category menu, bell, calendar, bills, subscriptions, quick add, weekly card
   ===================================================================== */

/* ---------- undo bar ---------- */
.undo-bar {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: 0 10px 28px rgb(0 0 0 / .3);
  transform: translate(-50%, 200%); opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .3s;
}
.undo-bar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.undo-msg { font-size: 14px; }
.undo-btn { border: 0; background: rgb(128 128 128 / .25); color: inherit; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; font-size: 13px; padding: 9px 14px; border-radius: 8px; text-decoration: underline; text-underline-offset: 3px; }
.undo-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@media (min-width: 900px) { .undo-bar { bottom: 28px; left: calc(50% + 110px); } }
@media (prefers-reduced-motion: reduce) { .undo-bar { transition: opacity .2s; } }

/* ---------- swipe rows (transactions) ---------- */
.swipe { position: relative; overflow: hidden; }
.swipe + .swipe .row { border-top: 1px solid var(--border); }
.swipe .row { position: relative; background: var(--surface); touch-action: pan-y; transition: transform .2s ease-out; }
.swipe.swiping .row { transition: none; }
.swipe-bg { position: absolute; inset: 0; display: none; align-items: center; padding: 0 20px; font-weight: 700; color: #fff; gap: 8px; }
.swipe-bg.right { background: var(--accent); justify-content: flex-start; color: var(--accent-ink); }
.swipe-bg.left { background: var(--bad); justify-content: flex-end; }
.swipe.swiping[data-dir="right"] .swipe-bg.right { display: flex; }
.swipe.swiping[data-dir="left"] .swipe-bg.left { display: flex; }
.swipe.armed .swipe-bg { filter: brightness(1.12); }
.swipe.armed .swipe-bg span { transform: scale(1.12); }
.swipe-bg span { transition: transform .15s; font-size: 15px; }
.card.list { overflow: hidden; }

/* ---------- category menu ---------- */
.cat-menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; max-height: 50vh; overflow-y: auto; }
.cat-choice { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; color: var(--text); }
.cat-choice:hover { background: var(--surface-2); }
.cat-choice.current { border-color: var(--accent); background: var(--accent-soft); }
.cat-choice:focus-visible { outline: 2px solid var(--accent); }
.cat-choice .cat-icon { width: 30px; height: 30px; font-size: 16px; flex: none; }
.tx-summary { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); margin: 0 0 8px; font-size: 14px; }

/* ---------- notification bell ---------- */
.top-bell { position: relative; width: 34px; height: 34px; border-radius: 50%; padding: 0; font-size: 16px; line-height: 1; display: grid; place-items: center; background: rgb(255 255 255 / .14); color: #fff; border: 1px solid rgb(255 255 255 / .38); }
.top-bell:hover { background: rgb(255 255 255 / .24); }
.top-bell:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.top-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--hero-1); }
.notif-list { display: flex; flex-direction: column; margin: 8px 0 4px; max-height: 60vh; overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 11px 6px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; width: 100%; color: inherit; border-radius: 0; }
.notif:first-child { border-top: 0; }
.notif.unread { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.notif-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 17px; }
.notif-body { min-width: 0; display: flex; flex-direction: column; }
.notif-title { font-weight: 650; }
.notif-time { font-size: 12px; color: var(--muted); }

/* ---------- calendar ---------- */
.cal-tabs { margin-bottom: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { font-size: 18px; font-family: var(--serif); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.cal-day { min-height: 56px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 4px 5px; text-align: left; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text); overflow: hidden; }
.cal-day.blank { border-color: transparent; background: none; pointer-events: none; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent-soft); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.auto { background: var(--accent); }
.dot.due { background: var(--gold); }
.dot.paid { background: var(--good); }
.dot.late { background: var(--bad); }
.dot.wed { background: var(--gold); width: auto; height: auto; border-radius: 0; background: none; font-size: 12px; line-height: 1; }
.cal-pill { display: none; }
@media (min-width: 700px) {
  .cal-day { min-height: 86px; }
  .cal-dots.compact { display: none; }
  .cal-pill { display: block; font-size: 11px; padding: 1px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface-2); }
  .cal-pill.auto { background: var(--accent-soft); color: var(--accent); }
  .cal-pill.due { background: var(--gold-soft); color: var(--gold-ink); }
  .cal-pill.paid { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
  .cal-pill.late { background: var(--bad-soft); color: var(--bad); }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin: 10px 2px 4px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bill { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.bill + .bill { border-top: 1px solid var(--border); }
.bill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; border: 0; background: none; padding: 0; color: inherit; }
.bill-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st { display: inline-block; font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.st.auto { background: var(--accent-soft); color: var(--accent); }
.st.due { background: var(--gold-soft); color: var(--gold-ink); }
.st.soon { background: color-mix(in srgb, var(--gold) 28%, transparent); color: var(--gold-ink); }
.st.paid { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.st.late { background: var(--bad-soft); color: var(--bad); }
.day-detail { margin-top: 14px; }
.day-detail h3 { font-size: 15px; margin-bottom: 4px; }

/* ---------- subscriptions ---------- */
.sub-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.sub-summary div { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.sub-summary b { font-size: 19px; font-variant-numeric: tabular-nums; }
.sub-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.sub-card + .sub-card { border-top: 1px solid var(--border); }
.sub-top { display: flex; align-items: center; gap: 12px; }
.sub-name { font-weight: 650; }
.sub-price { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.chg { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.chg.up { background: var(--bad-soft); color: var(--bad); }
.chg.down { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.price-trail { font-size: 13px; color: var(--text-2); }
.sub-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- quick add & weekly summary (home) ---------- */
.quick-row { display: flex; gap: 8px; margin-bottom: 10px; }
.quick-row .money-input { width: 150px; flex: none; }
.quick-row .input { min-width: 0; }
.quick-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.qcat { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 8px 13px; color: var(--text); font-size: 14px; }
.qcat:hover { background: var(--surface-2); border-color: var(--accent); }
.qcat:focus-visible { outline: 2px solid var(--accent); }
.week-delta.up { color: var(--bad); font-weight: 650; }
.week-delta.down { color: var(--good); font-weight: 650; }
.upcoming { display: flex; flex-direction: column; }
.upcoming .bill { padding: 8px 0; }

/* =====================================================================
   Calendar: multiple calendars, filters, status, agenda, tasks, notes, free time
   ===================================================================== */

.hero-compact { padding: 14px 12px 12px; margin-bottom: 12px; }
.hero-compact .cd-unit b { font-size: 24px; }
.hero-compact .cd-unit { min-width: 52px; padding: 6px 4px; }
.hero-compact .cd-note { margin-top: 8px; font-size: 15px; }
.cal-tabs { overflow-x: auto; scrollbar-width: none; }
.cal-tabs .tab { white-space: nowrap; flex: 1 0 auto; }
.sub-tabs { margin-bottom: 12px; }

.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--pc, var(--muted)); color: #fff; font-size: 12px; font-weight: 700; margin-left: -6px; border: 2px solid var(--surface); flex: none; }
.avatar:first-child { margin-left: 0; }

/* status strip */
.status-strip { padding: 10px 12px; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px; border-radius: 999px; background: color-mix(in srgb, var(--pc) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pc) 45%, transparent); font-size: 14px; }
.status-chip b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pc); color: #fff; font-size: 12px; }

/* calendar filters */
.cal-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.fchip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--cc, var(--border)); background: color-mix(in srgb, var(--cc, var(--accent)) 13%, var(--surface)); color: var(--text); font-size: 14px; }
.fchip .fdot { width: 10px; height: 10px; border-radius: 50%; background: var(--cc, var(--muted)); }
.fchip.off { background: var(--surface); border-color: var(--border); color: var(--muted); }
.fchip.off .fdot { background: transparent; border: 1.5px solid var(--muted); }
.fchip.mine { --cc: var(--accent); }
.fchip.add { border-style: dashed; border-color: var(--border); background: none; color: var(--text-2); }
.fchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dot.task { background: none; border: 2px solid var(--accent); width: 8px; height: 8px; }
.cal-pill.ev { background: color-mix(in srgb, var(--cc) 16%, transparent); color: var(--text); border-left: 3px solid var(--cc); border-radius: 4px; }

/* agenda */
.agenda-item { display: flex; align-items: center; gap: 10px; padding: 9px 0 9px 10px; border-left: 4px solid var(--cc, var(--muted)); margin: 6px 0; border-radius: 4px; background: color-mix(in srgb, var(--cc, #888) 7%, transparent); }
.agenda-item.done .agenda-title { text-decoration: line-through; color: var(--muted); }
.agenda-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; border: 0; background: none; padding: 0; color: inherit; }
.agenda-time { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.agenda-title { font-weight: 600; }
.agenda-who { display: inline-flex; align-items: center; padding-left: 6px; }
.turn { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); vertical-align: 1px; }
.turn.mine { background: color-mix(in srgb, var(--gold) 28%, transparent); color: var(--gold-ink); }
.check-circle { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); background: none; color: #fff; font-size: 14px; line-height: 1; display: grid; place-items: center; padding: 0; }
.check-circle.on { background: var(--good); border-color: var(--good); }
.check-circle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* tasks */
.task { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.task + .task { border-top: 1px solid var(--border); }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-title { text-align: left; border: 0; background: none; padding: 0; color: inherit; font-weight: 600; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn.handoff { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.task-add { flex-wrap: wrap; }
.task-add .input:first-child { flex: 1 1 200px; }
.task-add select { flex: 0 0 auto; width: auto; }

/* notes */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.note { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.note.pinned { border-color: var(--gold); box-shadow: var(--shadow), inset 0 3px 0 var(--gold); }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-title { flex: 1; text-align: left; border: 0; background: none; padding: 0; font-weight: 700; color: inherit; font-family: var(--serif); font-size: 16px; }
.pin { border: 0; background: none; font-size: 15px; opacity: .35; padding: 4px; }
.pin.on { opacity: 1; }
.note-body { text-align: left; border: 0; background: none; padding: 0; color: var(--text-2); white-space: pre-wrap; max-height: 9em; overflow: hidden; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.checklist label { display: flex; align-items: center; gap: 10px; flex: 1; padding: 5px 0; cursor: pointer; }
.checklist input { width: 18px; height: 18px; accent-color: var(--emerald); flex: none; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.add-item { min-height: 38px; }

/* free time */
.free-people { margin: 10px 0; }
.free-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.free-day { padding: 8px 0; border-top: 1px solid var(--border); }
.free-date { font-weight: 650; margin-bottom: 4px; }
.free-win { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 10px; border-radius: 10px; margin: 4px 0; background: var(--surface-2); }
.free-win.date { background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); }
.free-win .btn { margin-left: auto; }

/* pickers inside forms */
.picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; }
.pick input { width: 16px; height: 16px; accent-color: var(--accent); }
.pick .avatar { margin: 0; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.cswatch input { position: absolute; opacity: 0; pointer-events: none; }
.cswatch i { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.cswatch input:checked + i { box-shadow: 0 0 0 3px var(--text); }
.cswatch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 3px; }
.dow-row { display: flex; gap: 6px; margin-top: 6px; }
.dow input { position: absolute; opacity: 0; pointer-events: none; }
.dow span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; background: var(--surface); }
.dow input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dow input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.cal-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-left: 5px solid var(--cc); border-radius: 12px; background: var(--surface); text-align: left; color: inherit; }
.cal-row .fdot { display: none; }
.cal-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
textarea.input { resize: vertical; min-height: 60px; font-family: inherit; }
@media (max-width: 480px) { .free-opts { grid-template-columns: 1fr 1fr; } .free-opts .field:first-child { grid-column: 1 / -1; } .task { align-items: flex-start; } }

.cal-day.outside { opacity: .5; background: none; }
.cal-day.outside.selected { opacity: .8; background: var(--accent-soft); }
.picks.dim .pick { opacity: .55; }
.cal-day { user-select: none; }

/* ---------- calendar: the month grid is the focus ---------- */
.cal-pill { display: block; font-size: 10px; line-height: 15px; padding: 0 3px; border-radius: 3px; overflow: hidden; text-overflow: clip; white-space: nowrap; background: var(--surface-2); }
.cal-pill.auto { background: var(--accent-soft); color: var(--accent); }
.cal-pill.due { background: var(--gold-soft); color: var(--gold-ink); }
.cal-pill.paid { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.cal-pill.late { background: var(--bad-soft); color: var(--bad); }
.cal-pill.ev { background: var(--cc); color: #fff; border-left: 0; border-radius: 3px; }
.cal-pill.task { background: none; color: var(--muted); }
.cal-pill.more { background: none; color: var(--muted); }
.cal-dots.compact { display: none; }
.cal-full .cal-grid { gap: 0; }
.cal-full .cal-day { min-height: 90px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: 3px 1px; gap: 2px; font-size: 11px; }
.cal-full .cal-day.outside { opacity: .45; }
.cal-full .cal-day.today { box-shadow: none; }
.cal-full .cal-day.selected { background: var(--accent-soft); opacity: 1; }
.cal-full .cal-day .dn { text-align: center; font-size: 12px; width: 22px; height: 22px; line-height: 22px; margin: 0 auto; border-radius: 50%; }
.cal-full .cal-day.today .dn { background: var(--accent); color: #fff; }
.cal-full .cal-dow { padding: 4px 0; }
@media (max-width: 699px) {
  .cal-full { padding: 8px 0 6px; margin-inline: -8px; border-radius: 0; border-left: 0; border-right: 0; }
  .cal-full .cal-head { padding: 0 12px; }
  .cal-full .cal-legend { padding: 0 12px; }
  .cal-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
  .cal-filters::-webkit-scrollbar { display: none; }
  .fchip { flex: none; padding: 5px 11px; font-size: 13px; }
  .cal-tabs { margin-bottom: 8px; }
}
@media (min-width: 700px) { .cal-full .cal-day { min-height: 110px; } .cal-pill { font-size: 11px; } }

/* status button in the top bar, next to the bell */
.top-status { display: inline-flex; align-items: center; gap: 6px; max-width: 46vw; height: 34px; padding: 0 10px; border-radius: 999px; background: rgb(255 255 255 / .14); color: #fff; border: 1px solid rgb(255 255 255 / .38); font-size: 13px; }
.top-status:hover { background: rgb(255 255 255 / .24); }
.top-status .ts-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-status .ts-partner { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.top-status .ts-partner b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; color: #fff; }
@media (max-width: 520px) { .top-status .ts-text { max-width: 90px; } }
@media (max-width: 520px) {
  .topbar h1 { font-size: 20px; }
  .top-actions { gap: 6px; min-width: 0; }
  .top-status { max-width: 34vw; padding: 0 8px; gap: 4px; }
  .top-status .ts-text { max-width: 64px; }
}
