/* =========================================================================
   Paycheck Allocator - design system
   Premium dark "money app" look: near-black canvas, layered surfaces,
   hairline borders, mint accent, large tabular numerals.
   Phone (<1024px): frosted bottom tab bar, single column.
   Laptop (>=1024px): left sidebar, Home + Settings flow into two columns.
   Every class name the JavaScript emits is kept - this file is look only.
   ========================================================================= */

:root {
  color-scheme: dark; /* native date pickers, select lists, scrollbars follow */

  /* surfaces */
  --bg: #07090d;
  --surface: #10141b;
  --surface-2: #171c26;
  --surface-3: #212838;
  --card: #10141b;            /* legacy alias - older rules/inline styles read it */

  /* lines */
  --border: #232a38;          /* solid hairline - JS reads this for chart fallbacks */
  --line: rgba(255, 255, 255, 0.07);

  /* text */
  --text: #f2f5fa;
  --muted: #8f9ab0;
  --faint: #5b6579;

  /* brand + status */
  /* Accent = one hue (Settings > Preferences > Accent color). --accent-l
     is set by applyAccentHue() in index.html so every hue keeps the same
     brightness as the original green (hue 156, ~47% lightness). */
  --accent-h: 156;
  --accent-l: 47%;
  --accent: hsl(var(--accent-h) 75% var(--accent-l));
  --accent-hover: hsl(var(--accent-h) 73% calc(var(--accent-l) + 12%));
  --accent-ink: hsl(var(--accent-h) 75% 5%);      /* text that sits ON the accent color */
  --accent-soft: hsl(var(--accent-h) 75% var(--accent-l) / 0.13);
  --accent-glow: hsl(var(--accent-h) 75% var(--accent-l) / 0.38);
  --accent-outline: hsl(var(--accent-h) 75% var(--accent-l) / 0.22); /* faint accent outlines (cards, rows, controls) */
  --danger: #ff5d73;
  --danger-soft: rgba(255, 93, 115, 0.14);

  /* shape */
  --radius-card: 22px;
  --radius-row: 14px;
  --radius-ctl: 12px;
  --sidebar-w: 248px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.006em;
  font-variant-numeric: tabular-nums; /* digits line up in columns, like a bank statement */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Soft green glow behind everything - a fixed pseudo-element rather than
   background-attachment:fixed, which iOS ignores/janks. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 460px at 50% -160px, hsl(var(--accent-h) 75% var(--accent-l) / 0.11), transparent 70%),
    radial-gradient(640px 380px at 100% 0%, rgba(90, 120, 255, 0.07), transparent 70%);
}
#app, #login-screen, #loading-screen { position: relative; z-index: 1; }

::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: #2b3445 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b3445; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ---------- brand mark ---------- */
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-hover), hsl(var(--accent-h) 82% calc(var(--accent-l) - 8%)));
  box-shadow: 0 6px 16px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ---------- loading + login ---------- */
#loading-screen { display: flex; align-items: center; justify-content: center; }
.loading-center { text-align: center; }
.loading-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 16px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#login-screen { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 28px 28px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 140px), var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
}
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto; }
.login-card .brand-mark svg { width: 28px; height: 28px; }
.login-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; margin: 16px 0 4px; }
.login-card .login-sub { margin: 0 0 18px; }
.login-card input { width: 100%; margin: 6px 0; }
.login-card button { width: 100%; margin-top: 10px; }

/* ---------- app shell: header ---------- */
/* Phones/tablets: a solid header that scrolls away with the page (not
   pinned, nothing shows through it). Laptops override this below. */
header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  /* +28px: keeps the title clear of the blur iOS adds under the status bar */
  padding-top: calc(max(12px, env(safe-area-inset-top)) + 28px); /* clears the notch / Dynamic Island in standalone mode */
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
/* Once the header scrolls away, keep page content from sliding under the
   iPhone status bar (clock/battery) in the home-screen app - a solid strip
   exactly the status bar's height. Zero height everywhere else. */
#app::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 25;
  height: env(safe-area-inset-top);
  background: var(--bg);
  pointer-events: none;
}
header h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- app shell: bottom tab bar (phones + tablets) ---------- */
#bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom)); /* clears the home-indicator bar */
  background: rgba(11, 14, 20, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 4px 2px;
  background: none;
  border: none;
  border-radius: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}
/* Every icon lives in an identical box, so all the tabs sit on the same
   baseline - this is what keeps Activity level with the rest. */
.tab-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 30px;
  border-radius: 15px;
  transition: background 0.2s ease;
}
.tab-icon svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab-label { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }
.tab-btn.active { color: var(--accent); }
.tab-btn.active .tab-icon { background: var(--accent-soft); }
.tab-btn:active .tab-icon { transform: scale(0.94); }

/* Settings gear - top right of the header (phones) / page (laptops). */
#settings-gear {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 0;
  margin-left: auto;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  background: none;
}
#settings-gear svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s ease; }
#settings-gear:hover { color: var(--text); }
#settings-gear:hover svg { transform: rotate(30deg); }
#settings-gear.active { color: var(--accent); background: var(--accent-soft); }

main {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(100px + env(safe-area-inset-bottom)); /* clears the fixed tab bar */
}

.tab-panel:not(.hidden) { animation: panelIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- cards ---------- */
.card {
  position: relative;
  margin: 0 0 16px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 130px), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 44px -24px rgba(0, 0, 0, 0.8);
}
.card h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.018em; color: var(--text); }
/* Faint accent-colored underline under card titles (follows the accent
   color) - centered and inset from both ends, so it's shorter than the
   text. The title shrinks to its text width (margin-right: auto keeps the
   collapse arrow on the right) so the inset is measured from the words. */
.card h2 { position: relative; }
.card h2::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  /* solid in the middle, fading out toward both ends */
  background: linear-gradient(90deg, transparent, hsl(var(--accent-h) 75% var(--accent-l) / 0.22) 35%, hsl(var(--accent-h) 75% var(--accent-l) / 0.22) 65%, transparent);
  pointer-events: none;
}
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2.collapse-toggle { flex: 0 1 auto; margin-right: auto; }

/* Collapse chevron: the ▾ text glyph is hidden and a drawn chevron replaces
   it, so it renders crisply and identically everywhere. */
.collapse-arrow {
  position: relative;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  padding: 12px;
  margin: -12px;
  box-sizing: content-box;
  font-size: 0;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}
.collapse-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -6px 0 0 -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
}
.card.collapsed .collapse-arrow { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card.collapsed .card-header-row { margin-bottom: 0; }
/* Tap targets: a whole collapsed card opens it; an open card's title line closes it. */
.card.collapsible.collapsed, .card.collapsible .card-header-row { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

/* Cards on every tab get a faint outline in the accent color. */
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) .card { border: 3px solid var(--accent-outline); }
/* Log out: just the button, no bubble around it. */
#tab-settings .card.logout-card { padding: 0; background: none; border: none; box-shadow: none; }
#tab-settings .card.logout-card #logout-btn { margin-top: 0; }
/* ...and the rows inside them (balances, cards, buckets) get a 1px one. */
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) .list-item { border-color: var(--accent-outline); }
/* Text boxes, dropdowns and outlined buttons there too - accent instead of
   grey. (:not(:focus) keeps the full-accent focus ring when typing.) */
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) :is(input, select):not(:focus),
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) button.secondary { border-color: var(--accent-outline); }
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) button.secondary:hover { border-color: var(--accent-glow); }

/* Pay-rate forms (Settings > Schedule): company and shift name each get a
   full-width line so what you type is readable; $/hr + break share the last. */
.rate-fields { display: flex; flex-direction: column; gap: 8px; }
.rate-fields > input { flex: none; width: 100%; }
.rate-fields-last { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.rate-fields-last input[type="number"] { flex: 0 1 130px; }
.break-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }

/* Bucket rows (Settings > Savings buckets): details across the full width,
   buttons in their own row underneath - wrapping evenly and filling the
   line - instead of squeezing the text beside them on phones. */
.list-item.bucket-row { flex-direction: column; align-items: stretch; gap: 10px; }
.list-item.bucket-row > div:first-child { flex: none; }
.list-item.bucket-row > .row-inline { flex-wrap: wrap; gap: 8px; }
.list-item.bucket-row > .row-inline > button { flex: 1 1 auto; }

/* "Pays down loan" picker on a fixed bucket row */
.loan-link { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.loan-link select { flex: 1; min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: 16px; }

/* Home > Loans: name + balance on one line, time left under it, then a
   full-width Log payment button - nothing squeezed into a thin column. */
.list-item.loan-home-row { flex-direction: column; align-items: stretch; gap: 2px; }
.loan-home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.loan-home-head > span { flex: none; font-weight: 600; white-space: nowrap; }
.list-item.loan-home-row > button { margin-top: 10px; }

/* Home notifications (recurring charges due soon) */
/* Just the notifications themselves - no surrounding box or heading.
   (Still a .card wrapper only so the Home column layout places it.) */
#tab-home .card.notifications-card { padding: 0; background: none; border: none; box-shadow: none; }
#home-notifications-list { margin: 0; }
.notification-item { box-shadow: inset 3px 0 0 var(--accent); }
.notif-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.notif-dismiss { flex: none; width: 34px; padding: 0; }

/* Small icon-only buttons (e.g. Untag) - same size/outline as the
   Recurring "..." button. */
button.icon-btn, button.small.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 28px; padding: 0 4px; border-radius: 8px; }
button.icon-btn svg { display: block; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Accent color picker (Settings > Preferences) */
.hue-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.hue-swatch { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.hue-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-height: 0;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(0 75% 55%), hsl(60 75% 50%), hsl(120 75% 45%), hsl(180 75% 45%), hsl(240 75% 62%), hsl(300 75% 58%), hsl(360 75% 55%));
  cursor: pointer;
}
input.hue-slider:focus { box-shadow: none; }
input.hue-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
input.hue-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
input.hue-slider:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Home's Account Balance is the hero: total balance big and first, accounts
   beneath. Targets the card by its key (the cards can be reordered). */
.card[data-card-key="home-balance"] {
  background:
    radial-gradient(520px 240px at 100% 0%, hsl(var(--accent-h) 75% var(--accent-l) / 0.17), transparent 70%),
    linear-gradient(180deg, #141c24, #0f151c);
  border-color: hsl(var(--accent-h) 75% var(--accent-l) / 0.2);
}
.card[data-card-key="home-balance"]:not(.collapsed) .card-body { display: flex; flex-direction: column; }
#balance-total-row {
  order: -1;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 0 18px;
  border: none;
  font-weight: 400;
}
#balance-total-row > span:first-child { font-size: 13px; font-weight: 500; color: var(--muted); }
.card[data-card-key="home-balance"] .card-body > .list { margin-bottom: 0; }
#balance-total { font-size: clamp(34px, 9.5vw, 46px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }

/* ---------- lists + rows ---------- */
.list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.list:empty { margin: 0; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid transparent;
  border-radius: var(--radius-row);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.list-item > span, .list-item > .row-inline > span { font-weight: 600; }
.meta, .list-item .meta { margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 400; }
.row-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.list-item.clickable, .allocation-line.clickable { cursor: pointer; }
.list-item.clickable:active { transform: scale(0.992); }

.allocation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--accent-outline);
  font-size: 15px;
}
.allocation-line > span:last-child, .allocation-line > .row-inline > span { font-weight: 600; }
#balance-list .list-item > div:last-child, #savings-accounts-list .list-item > div:last-child { font-weight: 600; }
.allocation-line.total { padding-top: 14px; border-bottom: none; font-size: 16px; font-weight: 700; }
.allocation-line.total > span { font-weight: 700; }
.allocation-line.total > span:last-child { letter-spacing: -0.015em; }
#overview-result .allocation-line.total > span:last-child { font-size: 24px; letter-spacing: -0.03em; }

/* Settings account rows stack their controls under the account info.
   The three-class selectors are deliberate: the phone rules further down
   (.list-item { align-items:center }, .list-item > .row-inline { nowrap })
   would otherwise centre the title and force the controls off the edge. */
.list-item.account-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; gap: 10px; }
.list-item.account-row > .account-row-controls { width: 100%; flex-wrap: wrap; flex-shrink: 1; }
.account-row-controls select { flex: 1 1 140px; min-width: 0; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.row label { flex: 1 1 100%; font-size: 13px; color: var(--muted); }

.muted { color: var(--muted); font-size: 13px; }
.card-body > p:empty { display: none; } /* e.g. the empty sync-status line - it was leaving a gap under the hero balance */
.card-body > p.muted:last-child { margin-bottom: 0; }
.error-text { color: var(--danger); font-size: 13px; }
.error-text:empty { margin: 0; } /* an empty note still has default <p> margin - that was dead space at a card's bottom */

/* Waiting paychecks: payer name on its own line (no more three-line wraps),
   then date on the left with amount + Untag on the right. */
#paycheck-list .list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name name" "date amount";
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
}
#paycheck-list .list-item > div:first-child { grid-area: name; min-width: 0; overflow-wrap: anywhere; }
#paycheck-list .list-item > .meta { grid-area: date; margin: 0; white-space: nowrap; }
#paycheck-list .list-item > .row-inline { grid-area: amount; flex-wrap: nowrap; justify-content: flex-end; }

/* Paycheck calculator rows: job name on its own line; hours, rate and
   Remove share the next one instead of Remove wrapping alone. */
.job-row .job-name { flex: 1 1 100%; }
.job-row .job-hours, .job-row .job-rate { flex: 1 1 0; min-width: 0; }
.job-row .remove-job-btn { flex: none; }

/* ---------- badges + chips ---------- */
.flag-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}
.tag-badge {
  display: inline-block;
  margin: 2px 0 2px 4px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
}
.toggle-chip {
  display: inline-block;
  margin: 4px 0 0 4px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  min-height: 0;
}
.toggle-chip.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- form controls ---------- */
input, select {
  flex: 1;
  min-width: 0;     /* flex items default to their content's width; a select sizes itself to its LONGEST option, which pushed whole forms off-screen */
  max-width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-ctl);
  color: var(--text);
  font-family: inherit;
  /* 16px minimum - iOS Safari auto-zooms the whole page on focus for any
     input under 16px. */
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  -webkit-appearance: none;
  appearance: none;
  text-overflow: ellipsis; /* long option text truncates instead of widening the select */
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f9ab0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
input[type="date"], input[type="time"], input[type="file"] { min-width: 0; }
input[type="file"] { max-width: 100%; }

button {
  min-height: 46px;
  padding: 11px 18px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.005em;
  border: none;
  border-radius: var(--radius-ctl);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: default; transform: none; }
button:focus-visible, .tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -12px var(--accent-glow);
}
button.secondary {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
}
button.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
button.small.secondary { margin-top: 0; }

/* Shows which savings account a transaction is currently assigned to -
   tap the same one again to un-assign, tap a different one to swap. */
button.savings-selected {
  border: 2px solid var(--accent) !important;
  background: var(--accent-soft) !important;
  color: var(--accent);
  font-weight: 700;
}

/* Transaction row actions - one dropdown, revealed on tap, on its own
   line under the transaction so the name + amount stay readable. */
.list-item.txn-row {
  flex-wrap: wrap;
  /* Skip rendering rows that are off-screen - Activity can list hundreds,
     which made it sluggish on iPhone. ~66px is a collapsed row's height. */
  content-visibility: auto;
  contain-intrinsic-size: auto 66px;
}
.txn-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.txn-actions select { flex: 1 1 200px; min-height: 42px; padding-top: 9px; padding-bottom: 9px; }
.txn-actions select.savings-selected { border-color: var(--accent); background-color: var(--accent-soft); }
.txn-action-status { margin-top: 0; flex: 0 1 auto; }
.txn-action-status:empty { display: none; }

/* Custom checkbox - all screen sizes. The native one renders inconsistently
   (chunky on iOS), so this replaces it everywhere. Every box-model property
   is repeated identically on :checked: iOS reverts toward native rendering
   once checked, shifting size/position, unless the whole box is pinned on
   both states. !important throughout since the JS also sets inline
   width/height on some checkboxes. Only colors + the tick change on check. */
input[type="checkbox"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  border: 1.5px solid #3b475c !important;
  border-radius: 6px !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  vertical-align: middle !important;
  cursor: pointer;
}
input[type="checkbox"]:checked {
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 6px !important;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.6 9.4l2.8 2.8 6-6.4' fill='none' stroke='%2303150d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat !important;
  border: 1.5px solid var(--accent) !important;
  outline: none !important;
  box-shadow: none !important;
}
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft) !important; }

/* ---------- sub-nav (Activity: All Transactions / Needs Review) ---------- */
.sub-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
}
.sub-tab-btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 14px;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.sub-tab-btn.active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }

/* ---------- bucket pie chart (rendered as a donut) ---------- */
.pie-chart-row { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; margin-bottom: 18px; }
.pie-chart {
  flex-shrink: 0;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: var(--accent-outline); /* shows through as "unallocated" when total < 100% */
  -webkit-mask: radial-gradient(circle, transparent 53%, #000 54%);
  mask: radial-gradient(circle, transparent 53%, #000 54%);
}
.pie-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.pie-legend-item { display: flex; align-items: center; gap: 8px; }
.pie-legend-swatch { width: 10px; height: 10px; flex-shrink: 0; border-radius: 3px; }

/* ---------- modals (bottom sheet on phones, centered dialog on laptops) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 4, 8, 0.64);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease both;
}
.modal-panel {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@supports (height: 100dvh) { .modal-panel { max-height: 86dvh; } }
.modal-panel::before { content: ""; display: block; width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- dropdown menu (Recurring list "...") ---------- */
.popup-menu {
  position: fixed;
  z-index: 25;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--surface-3);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
  animation: popIn 0.14s ease both;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.popup-menu .menu-label { padding: 8px 12px 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.popup-menu .menu-divider { height: 1px; margin: 6px 4px; background: var(--line); }
.popup-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}
.popup-menu button:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
.popup-menu button.danger { color: var(--danger); }
.popup-menu .menu-check { color: var(--accent); font-weight: 700; }

/* ---------- yearly-payment reminder banner ---------- */
.reminder-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: calc(100% - 24px);
  max-width: 560px;
  padding: 14px 16px 14px 18px;
  background: rgba(20, 27, 38, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid hsl(var(--accent-h) 75% var(--accent-l) / 0.38);
  border-radius: 16px;
  box-shadow: inset 4px 0 0 var(--accent), 0 16px 44px rgba(0, 0, 0, 0.55);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.reminder-banner.show { opacity: 1; }
.reminder-banner .reminder-line + .reminder-line { margin-top: 6px; }

/* ---------- Schedule ---------- */
#schedule-prev-week-btn, #schedule-next-week-btn { position: relative; width: 40px; min-width: 40px; padding: 0; font-size: 0; } /* hides the ◀ ▶ text glyphs */
#schedule-prev-week-btn::after, #schedule-next-week-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 1px;
}
#schedule-prev-week-btn::after { margin: -5px 0 0 -3px; transform: rotate(135deg); }
#schedule-next-week-btn::after { margin: -5px 0 0 -7px; transform: rotate(-45deg); }
#schedule-days { margin-top: 16px; }
#schedule-days .list-item button.small { background: none; border-color: transparent; color: var(--muted); }

/* ---------- Recurring list ---------- */
#refresh-recurring-btn { margin: 4px 0 16px; }
#recurring-list .list-item { align-items: flex-start; gap: 12px; padding: 16px; }
#recurring-list .recurring-body { flex: 1 1 0; min-width: 0; }
#recurring-list .recurring-name { font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -0.015em; word-break: break-word; }
#recurring-list .recurring-tag { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
#recurring-list .recurring-due { margin-top: 5px; font-size: 14px; font-weight: 650; }
#recurring-list .recurring-due.is-soon { color: var(--accent); }
#recurring-list .recurring-due.is-late { color: var(--muted); font-weight: 500; }
#recurring-list .recurring-detail { margin-top: 3px; color: var(--muted); font-size: 13px; font-weight: 400; }
#recurring-list .flag-badge { display: block; width: fit-content; max-width: 100%; margin-top: 10px; font-size: 12px; line-height: 1.35; border-radius: 10px; }
#recurring-list .recurring-menu-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding: 0 10px; }
#recurring-list .recurring-menu-btn svg { display: block; fill: currentColor; }
#recurring-list .recurring-menu-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* ---------- hover (mouse devices only, so touch never gets a stuck hover) ---------- */
@media (hover: hover) {
  .list-item.clickable:hover { background: rgba(255, 255, 255, 0.065); border-color: var(--line); }
  .allocation-line.clickable:hover { color: var(--accent); }
  .tab-btn:hover:not(.active) { color: var(--text); }
  button.primary:hover { background: var(--accent-hover); }
  button.secondary:hover { background: rgba(255, 255, 255, 0.09); }
  button.small:not(.primary):hover { border-color: rgba(255, 255, 255, 0.16); }
  .sub-tab-btn:not(.active):hover { color: var(--text); }
  .popup-menu button:hover { background: rgba(255, 255, 255, 0.07); }
  .collapse-arrow:hover { color: var(--text); }
  #schedule-days .list-item button.small:hover { color: var(--danger); background: var(--danger-soft); }
}

/* ---------- phones: row-alignment fixes (unchanged in purpose) ---------- */
@media (max-width: 767px) {
  .allocation-line { align-items: center; }
  .row-inline { align-items: center; }
  /* The amount+checkbox side of a Total Waiting row must never wrap onto its
     own line (that pushed a fixed bucket's checkbox under its amount), and
     the label side wraps its OWN text/badges without squeezing the right
     side, so a "Checked" badge appearing doesn't reflow anything else. */
  .allocation-line { flex-wrap: nowrap; }
  .allocation-line > div:first-child { flex: 1 1 auto; min-width: 0; }
  .allocation-line > .row-inline { flex-wrap: nowrap; flex-shrink: 0; }
  /* Same fix for a checkbox next to a dollar amount inside a plain list row
     (e.g. Credit Card Debt's "mark statement paid" checkbox). */
  .list-item { flex-wrap: nowrap; align-items: center; }
  .list-item > div:first-child { flex: 1 1 auto; min-width: 0; }
  .list-item > .row-inline { flex-wrap: nowrap; flex-shrink: 0; }
}

/* Very narrow phones (iPhone SE/mini class and smaller): a row whose right
   side holds several buttons (e.g. Log payment / Edit balance / Remove) drops
   them onto their own line rather than running off the card. Rows with just
   an amount + checkbox are untouched. */
@media (max-width: 380px) {
  .list-item:has(> .row-inline > button + button) { flex-wrap: wrap; }
  .list-item > .row-inline:has(> button + button) { flex: 1 1 100%; flex-wrap: wrap; }
}

/* ---------- tablets and up: dialogs center instead of sliding up ---------- */
@media (min-width: 768px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .modal-panel { max-width: 560px; padding: 26px; border-bottom: 1px solid var(--line); border-radius: 24px; }
  .modal-panel::before { display: none; }
}

/* ---------- laptops: sidebar + two-column dashboard ---------- */
@media (min-width: 1024px) {
  header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 21;
    width: var(--sidebar-w);
    height: 84px;
    padding: 0 24px;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: none;
  }
  header h1 { font-size: 16px; }

  #bottom-nav {
    top: 0;
    right: auto;
    bottom: 0;
    width: var(--sidebar-w);
    flex-direction: column;
    gap: 4px;
    padding: 92px 14px 24px;
    background: rgba(12, 15, 21, 0.7);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: none;
    border-right: 1px solid var(--line);
  }
  .tab-btn { flex: none; flex-direction: row; justify-content: flex-start; gap: 14px; width: 100%; min-height: 46px; padding: 0 16px; }
  .tab-icon, .tab-btn.active .tab-icon { width: 24px; height: 24px; background: none; border-radius: 0; }
  .tab-label { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
  .tab-btn.active { background: var(--accent-soft); }

  main { max-width: none; margin: 0 0 0 var(--sidebar-w); padding: 72px 48px 64px; } /* top room for the gear */
  #settings-gear { position: fixed; top: 20px; right: 28px; z-index: 22; width: 40px; height: 40px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
  #settings-gear.active { background: var(--accent-soft); border-color: transparent; }
  .tab-panel { max-width: 780px; margin: 0 auto; }
  /* Cards are placed into these two columns by balanceDashboardColumns()
     in app.js - not CSS multi-column, which re-laid-out every card on
     each keystroke and made typing lag. */
  #tab-home, #tab-settings { max-width: 1140px; }
  .mc-row { display: flex; align-items: flex-start; gap: 24px; }
  .mc-col { flex: 1 1 0; min-width: 0; }

  .reminder-banner { left: calc(50% + var(--sidebar-w) / 2); }

  /* On a wide screen the hero's accounts read better as stat tiles than as
     full-width rows: name above, balance big beneath. */
  #balance-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  #balance-list .list-item { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; padding: 16px 18px; }
  #balance-list .list-item > div:first-child { font-size: 14px; font-weight: 500; color: var(--muted); }
  #balance-list .list-item > div:last-child { font-size: 22px; font-weight: 650; letter-spacing: -0.025em; }
}

/* ---------- respect reduced-motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* =========================================================================
   2026-11-17 LOOK: banking-app finish (layout untouched)
   Everything below only restyles - same elements, same order, same places.
   Delete this whole block to get the previous look back.
   ========================================================================= */
:root {
  --bg: #0a0d12;
  --surface: #11161e;
  --surface-2: #18202b;
  --surface-3: #202936;
  --card: #11161e;
  --line: rgba(255, 255, 255, 0.065);
  --muted: #8b96a8;
  --faint: #667186;
  --danger: #ff6b7f;
  --danger-soft: rgba(255, 107, 127, 0.14);
  --radius-card: 24px;
  --hair: rgba(255, 255, 255, 0.065);
}
html, body { overflow-x: clip; } /* nothing can ever push the page sideways on a phone */
body::before { background: radial-gradient(900px 420px at 50% -220px, hsl(var(--accent-h) 75% var(--accent-l) / 0.07), transparent 70%); }
/* faster taps: no double-tap-to-zoom wait on anything you can press */
button, a, select, label, .clickable, .collapse-toggle, .collapse-arrow, .tab-btn, .sub-tab-btn { touch-action: manipulation; }

/* ---- header ---- */
header { border-bottom: none; padding-bottom: 10px; }
header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
#settings-gear { width: 44px; height: 44px; background: var(--surface); border: 1px solid var(--hair); }

/* ---- cards: hairline edge instead of the thick green outline ---- */
.card,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) .card {
  background: var(--surface);
  border: 1px solid var(--hair);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
#tab-home .card.notifications-card, #tab-settings .card.logout-card { border: none; background: none; box-shadow: none; }
.card[data-card-key="home-balance"],
#tab-home .card[data-card-key="home-balance"] {
  background:
    radial-gradient(420px 200px at 100% 0%, hsl(var(--accent-h) 75% var(--accent-l) / 0.1), transparent 70%),
    var(--surface);
  border: 1px solid hsl(var(--accent-h) 75% var(--accent-l) / 0.2);
}
/* card titles: small grey labels, like a banking app */
.card h2 { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.065em; }
.card h2::after { display: none; }
.card-header-row { min-height: 32px; margin-bottom: 10px; }
.modal-header h2 { text-transform: none; letter-spacing: -0.02em; color: var(--text); font-size: 18px; }

/* ---- hero total ---- */
#balance-total-row > span:first-child { font-size: 13px; color: var(--muted); }
#balance-total { font-size: clamp(36px, 11vw, 46px); letter-spacing: -0.045em; }

/* ---- rows: statement-style lines instead of bubbles ---- */
.list { gap: 0; }
.list-item,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) .list-item {
  padding: 13px 10px;
  margin: 0 -10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  border-radius: 12px;
}
.list > .list-item:last-child { border-bottom-color: transparent; }
.list-item.clickable:active { background: rgba(255, 255, 255, 0.04); transform: none; }
@media (hover: hover) { .list-item.clickable:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--hair); } }
.notification-item { background: var(--surface) !important; border: 1px solid var(--hair) !important; margin: 0 0 8px; }
#recurring-list .list-item { padding: 16px 10px; }

/* round icons in front of balance / card / savings rows */
#balance-list .list-item::before,
#debt-list .list-item::before,
#savings-accounts-list .list-item::before {
  content: "";
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: center / 18px no-repeat var(--accent-soft);
}
#balance-list .list-item::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5 12 4l9 5.5'/%3E%3Cpath d='M5 10v7M9.5 10v7M14.5 10v7M19 10v7'/%3E%3Cpath d='M3.5 20h17'/%3E%3C/svg%3E"); }
#debt-list .list-item::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='13' rx='2.5'/%3E%3Cpath d='M3 10.5h18M7 15h3'/%3E%3C/svg%3E"); background-color: rgba(255, 255, 255, 0.06); }
#savings-accounts-list .list-item::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11a6 5 0 0 1 11.5-2H19v3l-1.5 1.5V17h-3v-1.5h-4V17h-3v-2.2A5 5 0 0 1 5 11z'/%3E%3Ccircle cx='15.5' cy='11' r='.6'/%3E%3C/svg%3E"); }
#balance-list .list-item:last-child::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6.5' width='18' height='11' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3C/svg%3E"); } /* the Cash row is always last */

/* ---- totals + money colours ---- */
.allocation-line, :is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) .allocation-line { border-bottom-color: var(--hair); }
.allocation-line.total { font-size: 15px; }
.allocation-line.total > span:first-child { color: var(--muted); font-weight: 600; }
#debt-total { color: var(--danger); }
#overview-result .allocation-line.total > span:last-child { font-size: 28px; color: var(--accent); letter-spacing: -0.04em; }

/* ---- buttons ---- */
button.small, button.small.secondary,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) button.small.secondary {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 600;
}
button.secondary,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) button.secondary {
  background: var(--surface-2);
  border: 1px solid var(--hair);
  border-radius: 14px;
}
button.primary { border-radius: 14px; box-shadow: none; }
#tab-home #paycheck-reset-btn { background: var(--accent); color: var(--accent-ink); border: none; }
button.icon-btn, button.small.icon-btn { border-radius: 10px; min-width: 34px; min-height: 34px; }

/* ---- inputs ---- */
input, select { background-color: var(--surface-2); border-color: var(--hair); border-radius: 14px; }
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) :is(input, select):not(:focus) { border-color: var(--hair); }

/* ---- chips ---- */
.tag-badge { background: rgba(255, 255, 255, 0.07); color: #aab3c2; }

/* ---- Activity switch ---- */
.sub-nav { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; }
.sub-tab-btn { border-radius: 10px; min-height: 40px; }
.sub-tab-btn.active { background: var(--surface-3); box-shadow: none; }

/* ---- bottom tab bar ---- */
#bottom-nav { background: rgba(10, 13, 18, 0.92); border-top-color: var(--hair); }
.tab-btn { min-height: 56px; }

/* ---- dialogs ---- */
.modal-panel { background: var(--surface); border-color: var(--hair); }

/* ---- messages for bank connecting (see app.js connect flow) ---- */
.app-toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 12px);
  z-index: 200;
  width: calc(100% - 24px);
  max-width: 480px;
  padding: 14px 16px;
  transform: translate(-50%, -12px);
  background: rgba(24, 32, 43, 0.96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--hair);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.app-toast.ok { box-shadow: inset 4px 0 0 var(--accent), 0 16px 40px rgba(0, 0, 0, 0.55); }
.app-toast.err { box-shadow: inset 4px 0 0 var(--danger), 0 16px 40px rgba(0, 0, 0, 0.55); }
button.reconnect-btn { min-height: 30px; padding: 0 12px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); border: none; font-size: 12px; font-weight: 650; }


/* ---- 2026-11-17: After Debts on top + Credit Card Debt inside Account Balance ---- */
/* After Debts is the headline now, so it gets the hero treatment */
#tab-home .card[data-card-key="home-afterdebts"] {
  background:
    radial-gradient(420px 200px at 100% 0%, hsl(var(--accent-h) 75% var(--accent-l) / 0.12), transparent 70%),
    var(--surface);
  border: 1px solid hsl(var(--accent-h) 75% var(--accent-l) / 0.24);
}
/* Overview: its big total sits at the top of the card (like Account
   Balance's total), the breakdown lines underneath. Same element, just
   shown first. */
#overview-result { display: flex; flex-direction: column; }
#overview-result .allocation-line.total {
  order: -1;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 0 16px;
  border-bottom: none;
}
#overview-result .allocation-line.total > span:first-child { font-size: 13px; font-weight: 500; color: var(--muted); }
#overview-result .allocation-line.total > span:last-child { font-size: clamp(36px, 11vw, 46px); font-weight: 700; letter-spacing: -0.045em; line-height: 1.05; color: var(--accent); }
#overview-result .allocation-line:not(.total):first-of-type { border-top: 1px solid var(--hair); }
#overview-result .allocation-line:has(+ .allocation-line.total) { border-bottom: none; } /* last breakdown line: nothing under it now */
/* Account Balance is a normal card again (still a big total) */
.card[data-card-key="home-balance"],
#tab-home .card[data-card-key="home-balance"] { background: var(--surface); border: 1px solid var(--hair); }
/* the credit card part, under the accounts */
.sub-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hair); }
.sub-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 6px; }
.sub-title { margin: 0; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.065em; }
.sub-section .error-text:empty { display: none; }


/* ---- 2026-11-17 (2): balance total under the accounts, investments, checks dropdown ---- */
/* Account Balance: the total is a normal total line under the bank
   accounts now (no big number at the top) */
#balance-total-row {
  order: 0;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 0 0;
  border: none;
  font-weight: 700;
}
#balance-total-row > span:first-child { font-size: 15px; font-weight: 600; color: var(--muted); }
#balance-total { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.4; }

/* Investments card rows get a chart icon */
#investments-list .list-item::before {
  content: "";
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: center / 18px no-repeat var(--accent-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E");
}
/* investment window */
.invest-hero { margin-bottom: 10px; }
.invest-value { font-size: clamp(32px, 9vw, 40px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; }
.invest-change { margin-top: 4px; font-size: 14px; font-weight: 600; }
.invest-change.up { color: var(--accent); }
.invest-change.down { color: var(--danger); }
.invest-chart { display: block; width: 100%; height: 190px; margin-top: 8px; }
.invest-chart-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--muted); }
.invest-chart-empty { margin: 10px 0 4px; padding: 26px 16px; border: 1px dashed var(--hair); border-radius: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.invest-section { margin: 22px 0 4px; }
.invest-note { margin-top: 16px; }

/* Paychecks: the waiting checks in a dropdown */
.checks-dropdown { margin: 0 0 8px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface-2); }
.checks-dropdown > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  list-style: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  -webkit-user-select: none;
  user-select: none;
}
.checks-dropdown > summary::-webkit-details-marker { display: none; }
.checks-dropdown > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin: -4px 2px 0 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.checks-dropdown[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.checks-dropdown-sum { margin-left: auto; color: var(--accent); }
.checks-dropdown > .list { margin: 0; padding: 0 14px 6px; }
.checks-dropdown.is-empty > summary { cursor: default; color: var(--muted); font-weight: 500; }
.checks-dropdown.is-empty > summary::after { display: none; }

/* Account Balance total in the accent green */
#balance-total { color: var(--accent); }


/* ---- 2026-11-17 (3): Settings tidy-up + same-rate shift groups ---- */
/* small GREEN buttons (Tag as paycheck, Save...) keep their fill - the
   pill style for small buttons had turned them dark on dark */
button.small.primary,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule) button.small.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
}
button.tag-paycheck-btn { flex: none; white-space: nowrap; }

/* Connected Accounts: the role picker on its own line, then the buttons
   sharing one even row underneath */
.list-item.account-row > .account-row-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.account-row-controls > select { order: -1; flex: 1 1 100%; min-height: 44px; }
.account-row-controls > button { flex: 1 1 0; min-height: 40px; margin: 0; }
.account-row-controls > button[data-move] { flex: 0 0 48px; padding: 0; }
.due-date-row { justify-content: space-between; flex-wrap: nowrap !important; }
.due-date-row > label { font-size: 13px !important; }
.due-date-row > input[type="date"] { flex: 0 1 170px; max-width: 170px !important; min-height: 40px; padding-top: 8px; padding-bottom: 8px; }

/* Home Layout + pay rates: name on the left, its buttons on the right of
   the same line (a narrow-phone rule was dropping them underneath) */
#home-layout-list .list-item { flex-wrap: nowrap !important; }
#home-layout-list .list-item > .row-inline { flex: 0 0 auto !important; flex-wrap: nowrap !important; }
#home-layout-list .list-item > .row-inline > button { width: 44px; padding: 0; }
.rate-row-head { flex-wrap: nowrap !important; align-items: center; }
.rate-row-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.rate-row-head > .row-inline { flex: 0 0 auto; flex-wrap: nowrap !important; }

/* positions paid the same rate, grouped */
.rate-group { margin: 0 0 8px; border: 1px solid var(--hair); border-radius: 14px; background: var(--surface-2); }
.rate-group > summary {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 14px;
  list-style: none; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.rate-group > summary::-webkit-details-marker { display: none; }
.rate-group > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: -4px 2px 0 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.2s ease;
}
.rate-group[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.rate-group-name { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600; }
.rate-group-name .meta { display: block; margin-top: 2px; font-weight: 400; }
.rate-group-rate { flex: none; font-weight: 700; color: var(--accent); }
.rate-group-list { margin: 0 !important; padding: 0 14px 6px; }

/* phones: one consistent rhythm in Settings */
@media (max-width: 767px) {
  #tab-settings .card-body > p.muted { margin: 0 0 12px; line-height: 1.45; }
  #tab-settings .row { gap: 8px; margin-bottom: 8px; }
  #tab-settings input:not([type="checkbox"]):not([type="range"]), #tab-settings select { min-height: 46px; }
  /* main buttons (Add, Save, Download backup, Clear all shifts, Connect,
     Log out) fill the width instead of each being its own size */
  #tab-settings .card-body > button:not(.small),
  #tab-settings .row > button:only-child,
  #logout-btn { width: 100%; min-height: 48px; margin-top: 4px; }
  #tab-settings .row > button.primary:not(:only-child) { flex: 0 0 auto; min-width: 88px; }
  /* label above its field instead of squeezed beside it */
  #tab-settings .row > label[style] { flex: 1 1 100% !important; align-self: auto !important; margin-bottom: -2px; }
  #tab-settings .row > input[type="date"] { flex: 1 1 100%; }
  #tab-settings .row-inline > label { font-size: 15px; line-height: 1.4; }
  #tab-settings .list-item .meta { font-size: 13px; }
}


/* ---- 2026-11-17 (4): investments inside Account Balance, simple investment window, bucket emoji ---- */
.invest-sub { margin-top: 14px; }
.invest-row-right { text-align: right; font-weight: 600; }
.invest-pnl { margin-top: 2px; font-size: 12px; font-weight: 650; }
.invest-pnl.up, .invest-stat-value.up, .invest-stat-sub.up { color: var(--accent); }
.invest-pnl.down, .invest-stat-value.down, .invest-stat-sub.down { color: var(--danger); }
.invest-stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.invest-stat { padding: 14px 16px; border: 1px solid var(--hair); border-radius: 16px; background: var(--surface-2); text-align: left; }
.invest-stat-btn { width: 100%; min-height: 0; color: var(--text); font: inherit; cursor: pointer; }
.invest-stat-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); }
.invest-edit { color: var(--accent); font-weight: 650; }
.invest-stat-value { margin-top: 4px; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.invest-stat-sub { margin-top: 2px; font-size: 14px; font-weight: 600; }
#investments-list .list-item::before {
  content: "";
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: center / 18px no-repeat var(--accent-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d3dae5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E");
}
/* bucket emoji */
button.emoji-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; min-height: 0; margin: 0 8px 0 0; padding: 0;
  border: 1px solid var(--hair); border-radius: 10px; background: var(--surface-2);
  font-size: 18px; line-height: 1; vertical-align: middle;
}
button.emoji-btn.empty { color: var(--muted); font-size: 18px; font-weight: 500; border-style: dashed; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
button.emoji-choice { min-height: 48px; padding: 0; border: 1px solid var(--hair); border-radius: 12px; background: var(--surface-2); font-size: 24px; }
button.emoji-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.emoji-custom-row { margin-bottom: 8px; }
#emoji-clear { width: 100%; }


/* ---- 2026-11-17 (5): no gap above Investments; Settings sub-sections ---- */
/* Investments follow straight on from the bank accounts */
.invest-sub { margin-top: 0; padding-top: 0; border-top: none; }
.invest-sub .sub-head-row { min-height: 0; margin: 0; padding: 10px 0 2px; }
/* Settings: a section inside another card (Add a Check, Buckets) */
.settings-sub { margin-top: 20px; }
.settings-sub-first .sub-head-row, .settings-sub .sub-head-row { margin-bottom: 8px; }
#buckets-section { margin-bottom: 12px; }
@media (max-width: 767px) {
  #tab-settings :is(.sub-section, .settings-sub-first) > button:not(.small) { width: 100%; min-height: 48px; margin-top: 4px; }
  #tab-settings :is(.sub-section, .settings-sub-first) > p.muted { margin: 0 0 12px; line-height: 1.45; }
}

/* investments read as more rows of Account Balance: no heading, same
   row style, a hairline between the last bank row and the first one */
.card[data-card-key="home-balance"].has-invest #balance-list > .list-item:last-child { border-bottom-color: var(--hair); }
#investments-list .list-item > div:last-child { font-weight: 600; }
.invest-sub .error-text:empty { display: none; }

/* a bucket's emoji on Home: tap it to change it */
button.emoji-inline { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 30px; margin: -4px 4px -4px -4px; padding: 0 3px; border: none; border-radius: 8px; background: transparent; font-size: 17px; line-height: 1; vertical-align: middle; cursor: pointer; }
button.emoji-inline:active { background: rgba(255, 255, 255, 0.08); }

/* Bottom tab bar sits lower: on an iPhone its padding below the icons is
   the home-bar area minus 14px (never less than 6px), so the bar moves
   down while the labels still stay clear of the home bar. */
@media (max-width: 1023px) {
  #bottom-nav { padding-top: 6px; padding-bottom: max(6px, calc(env(safe-area-inset-bottom) - 14px)); }
  main { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* phones: every page is at least a screen tall, so even a short page can
   open scrolled past the header */
@media (max-width: 1023px) {
  .tab-panel:not(.hidden) { min-height: 100vh; }
  @supports (height: 100dvh) { .tab-panel:not(.hidden) { min-height: 100dvh; } }
}


/* ---- 2026-11-17 (6): one Refresh button in the top bar ---- */
.old-refresh, [hidden].old-refresh { display: none !important; }
#refresh-all-btn {
  flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px; min-height: 0;
  margin-left: auto; padding: 0;
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--hair);
  font-size: 18px; line-height: 1;
}
#refresh-all-btn + #settings-gear { margin-left: 8px; }
#refresh-all-btn:disabled { opacity: 1; }
#refresh-all-btn.busy .refresh-emoji { animation: spin 0.9s linear infinite; }
.refresh-emoji { display: block; }
#refresh-all-btn { color: var(--muted); }
#refresh-all-btn.busy { color: var(--accent); }
@media (min-width: 1024px) {
  #refresh-all-btn { position: fixed; top: 20px; right: 76px; z-index: 22; width: 40px; height: 40px; background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
  #refresh-all-btn + #settings-gear { margin-left: 0; }
}


/* savings account emoji on Home: sits in the round icon spot */
#savings-accounts-list .list-item.has-emoji::before { display: none; }
.row-emoji { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); font-size: 18px; line-height: 1; }
#savings-accounts-list .list-item > .row-emoji + div { flex: 1 1 auto; min-width: 0; }


/* ---- savings account icons (line icons, not emojis) ---- */
.row-emoji { color: var(--accent); }
button.row-icon-btn { min-height: 0; padding: 0; border: none; cursor: pointer; transition: box-shadow 0.15s ease; }
button.row-icon-btn:active { box-shadow: 0 0 0 3px var(--accent-soft); }
button.icon-pick-btn {
  display: inline-grid; place-items: center; vertical-align: middle;
  width: 34px; height: 34px; min-height: 0; margin: 0 10px 0 0; padding: 0;
  border: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
}
.icon-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
button.icon-choice { display: grid; place-items: center; min-height: 52px; border-radius: 50%; aspect-ratio: 1; background: var(--surface-2); color: var(--muted); }
button.icon-choice.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
@media (hover: hover) { button.icon-choice:hover { color: var(--text); } }


/* ---- investment chart (stock style) ---- */
.invest-chart-box { margin: 0 0 12px; padding: 14px 14px 10px; border: 1px solid var(--hair); border-radius: 16px; background: var(--surface-2); }
.chart-readout { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.chart-readout-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.chart-readout-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
.chart-readout-sub.up { color: var(--accent); }
.chart-readout-sub.down { color: var(--danger); }
.chart-wrap { position: relative; touch-action: none; cursor: crosshair; }
.invest-chart { height: 180px; margin-top: 0; }
.chart-ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 5; opacity: 0.7; }
.chart-ref-key { font-size: 11px; }
.chart-cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid rgba(255, 255, 255, 0.25); pointer-events: none; }
.chart-dot { position: absolute; left: -6px; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; border: 2.5px solid var(--accent); background: var(--surface); }
.chart-ranges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 10px; padding: 3px; border-radius: 12px; background: var(--surface); }
button.chart-range { min-height: 34px; padding: 0; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
button.chart-range.on { background: var(--surface-3); color: var(--text); }


/* bucket -> investment account picker (Settings > Buckets) */
.invest-link { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.invest-link select { flex: 1 1 auto; min-height: 40px !important; padding-top: 8px; padding-bottom: 8px; font-size: 15px; }

/* Fixed colours, whatever the accent colour is set to: the Account
   Balance total is always green, the credit card debt total always red. */
#balance-total-row > span, #balance-total-row > span:first-child, #balance-total { color: #2fd39a !important; }
.debt-total-line > span, .debt-total-line > span:first-child, #debt-total { color: #ff6b7f !important; }


/* ---- Stocks tab ---- */
.stocks-mode { font-size: 11px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.stocks-mode.paper { background: var(--accent-soft); color: var(--accent); }
.stocks-mode.live { background: var(--danger-soft); color: var(--danger); }
.stocks-cmd { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px !important; word-break: break-all; }
.stocks-source-note { margin: 12px 0 6px !important; }
.stock-side { display: inline-block; min-width: 38px; margin-right: 8px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 750; text-align: center; vertical-align: 1px; }
.stock-side.buy { background: var(--accent-soft); color: var(--accent); }
.stock-side.sell { background: var(--danger-soft); color: var(--danger); }
button.stocks-approve { width: 100%; min-height: 50px; margin-top: 12px; }
#tab-stocks button.stocks-approve.live { background: var(--danger); color: #fff; }
#tab-stocks #stocks-holdings .list-item > div:last-child, #tab-stocks #stocks-plan .list-item > div:last-child { text-align: right; font-weight: 600; }


/* Stocks: ranked portfolios */
.rank-periods { margin: 0 0 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
button.rank-row { width: 100%; min-height: 0; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
button.rank-row.on { background: var(--accent-soft) !important; }
.rank-num { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 700; }
button.rank-row.on .rank-num { background: var(--accent); color: var(--accent-ink); }
.rank-name { flex: 1 1 auto; min-width: 0; font-size: 15px; }
.rank-ret { flex: none; font-weight: 700; }
.rank-ret.up { color: var(--accent); }
.rank-ret.down { color: var(--danger); }
.rank-note { margin: 8px 0 14px !important; }
#stocks-current { margin: 0 0 10px; }


/* ---- Stocks: easier to read, stock-app style ---- */
.rank-ret { padding: 5px 9px; border-radius: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-ret.up { background: var(--accent-soft); }
.rank-ret.down { background: var(--danger-soft); }
button.rank-row { padding-top: 11px !important; padding-bottom: 11px !important; }
.rank-name { font-weight: 600; }

.hold-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 12px; }
.hold-summary > div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hair); }
.hold-summary b { display: block; font-size: 17px; font-weight: 750; letter-spacing: -0.02em; }
.hold-summary span { font-size: 11px; color: var(--muted); }
input.hold-search { width: 100%; margin: 0 0 10px; }
.hold-head { display: grid; grid-template-columns: minmax(0, 1fr) 96px 54px; gap: 8px; padding: 0 2px 6px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--hair); }
.hold-head span:nth-child(n+2) { text-align: right; }
.hold-list { display: flex; flex-direction: column; }
.hold-row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 96px 54px; gap: 8px; align-items: center;
  padding: 10px 2px; border-bottom: 1px solid var(--hair);
  content-visibility: auto; contain-intrinsic-size: auto 54px;
}
.hold-row[hidden] { display: none; }
.hold-bar { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 6px; background: var(--accent-soft); opacity: 0.55; pointer-events: none; }
.hold-sym, .hold-px, .hold-w { position: relative; }
.hold-sym { min-width: 0; display: flex; flex-direction: column; }
.hold-sym b { font-size: 15px; font-weight: 750; letter-spacing: 0.01em; }
.hold-sym span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: capitalize; }
.hold-px { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.hold-px .px { font-size: 14px; font-weight: 600; }
.hold-px .chg { font-size: 12px; font-weight: 650; }
.hold-px .chg.up { color: var(--accent); }
.hold-px .chg.down { color: var(--danger); }
.hold-w { text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hold-row.copied .hold-sym b::after, .copied-dot { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 2px 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.copied-dot { margin: 0 4px 1px 0; }
.hold-foot { margin-top: 10px !important; }
/* plan + orders read like a ticket */
#stocks-plan .list-item > div:first-child { font-weight: 650; }
.stock-side { letter-spacing: 0.04em; text-transform: uppercase; }
#stocks-account .allocation-line > span:last-child { font-variant-numeric: tabular-nums; }


/* ---- portfolio + stock pop-ups ---- */
#pf-modal .modal-header, #stock-modal .modal-header { align-items: flex-start; }
#stock-modal { z-index: 110; } /* opens on top of the portfolio pop-up */
.pf-section { margin: 22px 0 10px; }
.alloc-line { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.alloc-line span { min-width: 3px; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.alloc-key { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--hair); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; }
button.alloc-key { cursor: pointer; }
.alloc-key i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.alloc-key b { color: var(--muted); font-weight: 700; }
.hold-row { cursor: pointer; }
@media (hover: hover) { .hold-row:hover { background: rgba(255, 255, 255, 0.03); } }
.chg-day { margin-bottom: 14px; }
.chg-date { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
button.chg-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 9px 2px; border: none; border-bottom: 1px solid var(--hair); border-radius: 0; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.chg-tag { padding: 3px 7px; border-radius: 6px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.chg-tag.up { background: var(--accent-soft); color: var(--accent); }
.chg-tag.down { background: var(--danger-soft); color: var(--danger); }
.chg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.chg-detail { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sk-stat { padding: 10px 12px; border: 1px solid var(--hair); border-radius: 12px; background: var(--surface-2); }
.sk-stat span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.sk-stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.sk-stat b.up { color: var(--accent); }
.sk-stat b.down { color: var(--danger); }

#stock-modal { z-index: 120; }
.hold-row.no-tap { cursor: default; }
#invest-modal .hold-row .hold-w { min-width: 70px; }
#invest-modal .hold-head, #invest-modal .hold-row { grid-template-columns: minmax(0, 1fr) 86px 78px; }

.chart-ranges { display: flex; }
.chart-ranges > .chart-range { flex: 1 1 0; }


/* ---- "the portfolio you copy changed" alert ---- */
#tab-home .card.stocks-alert-card { margin-bottom: 14px; }
.stocks-alert-inline { margin-bottom: 14px; }
.stocks-alert {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; align-items: start;
  padding: 14px 14px 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid hsl(var(--accent-h) 75% var(--accent-l) / 0.35);
  box-shadow: inset 4px 0 0 var(--accent);
}
.stocks-alert-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.stocks-alert-text { font-size: 14px; line-height: 1.45; }
.stocks-alert-btns { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.stocks-alert-btns .primary { min-width: 96px; }
/* red dot on the Stocks tab while there's an alert */
.tab-btn.has-alert .tab-icon { position: relative; }
.tab-btn.has-alert .tab-icon::after { content: ""; position: absolute; top: 2px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }

.stocks-waiting { margin-bottom: 14px; padding: 12px; border: 1px dashed var(--hair); border-radius: 14px; }


/* ---- Investors on Stocktwits ---- */
.social-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.social-you { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 2px; }
.social-row .rank-ret { text-align: right; }
.social-sub { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.social-add { display: flex; gap: 8px; margin-top: 12px; }
.social-add input { flex: 1 1 auto; min-width: 0; }
.social-add button { flex: none; }
.social-bears { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.social-post { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.social-post:last-child { border-bottom: none; }
.social-post-head { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.social-post-head .chg-tag:not(.up):not(.down) { background: var(--surface-3); color: var(--muted); }
.social-link { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.social-syms { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
button.social-sym { min-height: 0; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
button.social-sym .up { color: var(--accent); font-weight: 700; }
button.social-sym .down { color: var(--danger); font-weight: 700; }
.social-body { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2, var(--text)); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.social-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 18px; }
.social-actions button.social-remove { color: var(--danger); }

.order-waiting { color: var(--warning, #ffb547); font-weight: 600; }

/* ---- "needs a real-money Alpaca key" notice ---- */
.stocks-live-banner { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 14px; padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid rgba(255, 181, 71, 0.4); box-shadow: inset 4px 0 0 #ffb547; font-size: 14px; line-height: 1.45; }
.stocks-live-banner.hidden { display: none; }
.stocks-live-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 181, 71, 0.16); color: #ffb547; }
.stocks-live-text { margin-top: 2px; color: var(--muted); }
.stocks-live-banner .stocks-cmd { margin-top: 6px; overflow-wrap: anywhere; }

/* ---- phones ---- */
@media (max-width: 767px) {
  main { padding-left: 14px; padding-right: 14px; }
  .card { padding: 18px; margin-bottom: 14px; }
}
/* ---- laptops: hero accounts as tiles keep their icon on top ---- */
@media (min-width: 1024px) {
  #balance-list { gap: 12px; }
  #balance-list .list-item { margin: 0; padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 16px; }
  #balance-list .list-item:last-child { border-color: var(--hair); }
  header h1 { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .app-toast { transition: none; } }


/* =========================================================================
   2026-11-20 LOOK: Figma redesign ("Paycheck Allocator - Dark Redesign",
   iBank kit style). Restyle only - same cards, same order. Delete this
   whole block (and the theme-color script in index.html) to
   get the previous look back.
   ========================================================================= */
:root {
  --bg: #07090d;
  --surface: #10141b;
  --surface-2: #171c25;
  --surface-3: #1f2632;
  --card: #10141b;
  --hair: #1d2330;
  --line: #1d2330;
  --muted: #8f9ab0;
  --faint: #5b6579;
  --danger: #ff5d73;
  --danger-soft: rgba(255, 93, 115, 0.14);
  --radius-card: 22px;
  --accent-deep: hsl(var(--accent-h) 68% 13%);
}
/* green header band at the top of the page (scrolls with it) */
body::before { background: none; }
/* the page edge Safari tints its frosted top bar from: same green as the
   band, so the bar blends in instead of showing as a dark strip (green
   only at the top - the bottom edge stays dark under the tab bar) */
html { background: linear-gradient(180deg, var(--accent-deep) 50%, var(--bg) 50%); }
body { background-color: var(--bg); }
#app {
  background: linear-gradient(180deg, var(--accent-deep) 0, hsl(var(--accent-h) 45% 7%) 210px, var(--bg) 380px) no-repeat;
  min-height: 100vh;
}
/* solid strip under the status bar - at least 1px tall, so iOS always has a
   solid fixed bar at the top to take its colour from (instead of blurring
   the page under it). Green at the top of the page, page colour once scrolled. */
#app::before { height: max(1px, env(safe-area-inset-top)); background: var(--bg); transition: background-color 0.2s ease; }
html.at-top #app::before { background: var(--accent-deep); }
header { background: transparent; border-bottom: none; padding-bottom: 14px; }
header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
header .brand-mark { width: 44px; height: 44px; border-radius: 22px; box-shadow: 0 8px 20px -8px var(--accent-glow); }
header .brand-mark svg { width: 22px; height: 22px; }
#refresh-all-btn, #settings-gear {
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hair);
  color: var(--text);
}
#settings-gear.active { background: var(--accent-soft); border-color: var(--accent-outline); color: var(--accent); }

/* ---- cards ---- */
.card,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 22px;
  box-shadow: none;
}
#tab-home .card.notifications-card, #tab-settings .card.logout-card { border: none; background: none; }
/* titles: white, sentence case, like the design's card headings */
.card h2 { font-size: 17px; font-weight: 650; color: var(--text); text-transform: none; letter-spacing: -0.015em; }
.sub-title { font-size: 15px; font-weight: 650; color: var(--text); text-transform: none; letter-spacing: -0.01em; }

/* ---- hero: Overview becomes the green balance card ---- */
#tab-home .card[data-card-key="home-afterdebts"] {
  position: relative;
  overflow: hidden;
  border: none;
  background:
    radial-gradient(circle at 92% -8%, rgba(255, 255, 255, 0.16) 0 104px, transparent 105px),
    radial-gradient(circle at 104% 78%, rgba(255, 255, 255, 0.10) 0 70px, transparent 71px),
    linear-gradient(135deg, hsl(var(--accent-h) 76% calc(var(--accent-l) + 7%)), hsl(var(--accent-h) 82% calc(var(--accent-l) - 15%)));
  box-shadow: 0 16px 34px -12px var(--accent-glow);
}
#tab-home .card[data-card-key="home-afterdebts"],
#tab-home .card[data-card-key="home-afterdebts"] :is(h2, span, div, p, .collapse-arrow) { color: var(--accent-ink) !important; }
#tab-home .card[data-card-key="home-afterdebts"] h2 { opacity: 0.85; }
#tab-home .card[data-card-key="home-afterdebts"] .allocation-line { border-color: rgba(3, 20, 10, 0.14) !important; }
#tab-home .card[data-card-key="home-afterdebts"] .allocation-line:not(.total) > span:first-child { opacity: 0.78; }
#overview-result .allocation-line:not(.total):first-of-type { border-top-color: rgba(3, 20, 10, 0.14); }


/* ---- rows ---- */
:is(#balance-list, #debt-list, #savings-accounts-list, #investments-list) .list-item { border-bottom-color: transparent; }
/* colored rounded-square badges, one color per kind of account */
#balance-list .list-item::before,
#debt-list .list-item::before,
#savings-accounts-list .list-item::before,
#investments-list .list-item::before {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background-position: center;
  background-size: 20px;
  background-repeat: no-repeat;
}
#balance-list .list-item::before { background-color: rgba(76,141,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234C8DFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5 12 4l9 5.5'/%3E%3Cpath d='M5 10v7M9.5 10v7M14.5 10v7M19 10v7'/%3E%3Cpath d='M3.5 20h17'/%3E%3C/svg%3E"); }
#balance-list .list-item:last-child::before { background-color: rgba(255,184,77,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFB84D' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6.5' width='18' height='11' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3C/svg%3E"); }
#debt-list .list-item::before { background-color: rgba(255,111,168,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF6FA8' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='13' rx='2.5'/%3E%3Cpath d='M3 10.5h18M7 15h3'/%3E%3C/svg%3E"); }
#savings-accounts-list .list-item:nth-child(3n+1)::before { background-color: rgba(63,220,151,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233FDC97' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11a6 5 0 0 1 11.5-2H19v3l-1.5 1.5V17h-3v-1.5h-4V17h-3v-2.2A5 5 0 0 1 5 11z'/%3E%3Ccircle cx='15.5' cy='11' r='.6'/%3E%3C/svg%3E"); }
#savings-accounts-list .list-item:nth-child(3n+2)::before { background-color: rgba(155,123,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B7BFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11a6 5 0 0 1 11.5-2H19v3l-1.5 1.5V17h-3v-1.5h-4V17h-3v-2.2A5 5 0 0 1 5 11z'/%3E%3Ccircle cx='15.5' cy='11' r='.6'/%3E%3C/svg%3E"); }
#savings-accounts-list .list-item:nth-child(3n)::before { background-color: rgba(255,184,77,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFB84D' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11a6 5 0 0 1 11.5-2H19v3l-1.5 1.5V17h-3v-1.5h-4V17h-3v-2.2A5 5 0 0 1 5 11z'/%3E%3Ccircle cx='15.5' cy='11' r='.6'/%3E%3C/svg%3E"); }
#investments-list .list-item::before { background-color: rgba(155,123,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B7BFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8'/%3E%3Cpath d='M15 7h6v6'/%3E%3C/svg%3E"); }

/* ---- buttons ---- */
button.primary, #tab-home #paycheck-reset-btn { border-radius: 16px; min-height: 50px; font-weight: 600; }

/* ---- Activity switch: green pill for the active side ---- */
.sub-nav { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--hair); border-radius: 16px; padding: 4px; }
.sub-tab-btn { border-radius: 12px; }
.sub-tab-btn.active { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* ---- bottom tab bar (phones/tablets): rounded top, solid surface ---- */
@media (max-width: 1023px) {
  #bottom-nav {
    background: rgba(16, 20, 27, 0.96);
    border-top: 1px solid var(--hair);
    border-radius: 26px 26px 0 0;
  }
}
/* laptops: smaller header in the sidebar; the band still sits behind the page */
@media (min-width: 1024px) {
  #app { background: linear-gradient(180deg, var(--accent-deep) 0, hsl(var(--accent-h) 45% 7%) 200px, var(--bg) 420px) no-repeat; }
  header h1 { font-size: 17px; }
  header .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  #bottom-nav { background: rgba(10, 13, 18, 0.55); border-right-color: var(--hair); }
  #balance-list .list-item::before { display: none; } /* they're stat tiles there */
}

/* ---- 2026-11-20 (2): no extra space under the last row of a card (Loans etc.) ---- */
.card .card-body > .list:last-child,
.card .card-body > :last-child { margin-bottom: 0; }
.card .list > .list-item:last-child,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .card .list > .list-item:last-child { padding-bottom: 4px; }


/* ---- 2026-11-20 (3): simpler Settings on phones/tablets (see the m-settings
   script in index.html). Only applies while #tab-settings has .m-settings,
   which the script sets below laptop width. ---- */
.m-back { display: none; }
.card-header-row .m-sub { display: none; } /* summaries: phone layout only */
.m-sheet { display: none; }
#tab-settings.m-settings .card[data-card-key],
#tab-settings.m-settings .card.logout-card { box-shadow: none; }

/* list of sections: each closed card is one row, grouped like the design */
#tab-settings.m-settings:not(.m-open) .card[data-card-key] {
  margin: 0;
  padding: 0;
  border-radius: 0;
  border-top-width: 0;
  overflow: visible;
}
#tab-settings.m-settings:not(.m-open) .card[data-m-group] { margin-top: 34px; border-top-width: 1px; border-radius: 20px 20px 0 0; }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-accounts"] { margin-top: 26px; }
/* Loans is the last row of Money now (it sits after Shifts) */
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-bigloans"],
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-preferences"] { border-radius: 0 0 20px 20px; }
#tab-settings.m-settings:not(.m-open) .card[data-m-group]::before {
  content: attr(data-m-group);
  position: absolute;
  top: -24px;
  left: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
#tab-settings.m-settings:not(.m-open) .card-header-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 1px;
  align-items: center;
  min-height: 0;
  margin: 0;
  padding: 12px 14px 12px 14px;
  cursor: pointer;
}
#tab-settings.m-settings:not(.m-open) .card-header-row::before {
  content: "";
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: center / 19px no-repeat var(--accent-soft);
}
#tab-settings.m-settings:not(.m-open) .card-header-row h2 { grid-column: 2; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
#tab-settings.m-settings:not(.m-open) .card-header-row .m-sub { grid-column: 2; grid-row: 2; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-settings.m-settings:not(.m-open) .card-header-row .collapse-arrow { grid-column: 3; grid-row: 1 / 3; transform: rotate(-90deg); opacity: 0.6; }
#tab-settings.m-settings .card-header-row .m-sub { display: none; }
#tab-settings.m-settings:not(.m-open) .card-header-row .m-sub { display: block; }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-accounts"] .card-header-row::before { background-color: rgba(76,141,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234C8DFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5 12 4l9 5.5'/%3E%3Cpath d='M5 10v7M9.5 10v7M14.5 10v7M19 10v7'/%3E%3Cpath d='M3.5 20h17'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-paycheck-sources"] .card-header-row::before { background-color: rgba(63,220,151,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233FDC97' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2.5'/%3E%3Cpath d='M9 7V5.5A1.5 1.5 0 0 1 10.5 4h3A1.5 1.5 0 0 1 15 5.5V7'/%3E%3Cpath d='M3 12.5h18'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-buckets"] .card-header-row::before { background-color: rgba(155,123,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B7BFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11a6 5 0 0 1 11.5-2H19v3l-1.5 1.5V17h-3v-1.5h-4V17h-3v-2.2A5 5 0 0 1 5 11z'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-schedule"] .card-header-row::before { background-color: rgba(255,111,168,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF6FA8' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-backup"] .card-header-row::before { background-color: rgba(76,141,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234C8DFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='7' height='7' rx='1.5'/%3E%3Crect x='13.5' y='3.5' width='7' height='7' rx='1.5'/%3E%3Crect x='3.5' y='13.5' width='7' height='7' rx='1.5'/%3E%3Crect x='13.5' y='13.5' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-bigloans"] .card-header-row::before { background-color: rgba(255,184,77,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFB84D' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 16.5V12l1.8-4.6A2 2 0 0 1 8.7 6h6.6a2 2 0 0 1 1.9 1.4L19 12v4.5'/%3E%3Cpath d='M3.5 12h17v4.5h-17z'/%3E%3Cpath d='M7 19v-2.5M17 19v-2.5'/%3E%3C/svg%3E"); }
#tab-settings.m-settings:not(.m-open) .card[data-card-key="settings-preferences"] .card-header-row::before { background-color: rgba(155,123,255,.16); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239B7BFF' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h10M18 7h2M4 17h4M12 17h8'/%3E%3Ccircle cx='16' cy='7' r='2'/%3E%3Ccircle cx='10' cy='17' r='2'/%3E%3C/svg%3E"); }
/* log out: its own red row */
#tab-settings.m-settings:not(.m-open) .card.logout-card { margin-top: 26px; padding: 0; border: 1px solid var(--hair); border-radius: 20px; background: var(--surface); overflow: hidden; }
#tab-settings.m-settings .card.logout-card #logout-btn { width: 100%; justify-content: flex-start; min-height: 58px; padding: 0 16px; border: none; border-radius: 0; background: none; color: var(--danger); font-weight: 600; text-align: left; }
#tab-settings.m-settings.m-open .card.logout-card { display: none; }

/* one section open: the others hide, a back button shows, the card reads as the page */
#tab-settings.m-settings.m-open .card[data-card-key]:not(.m-active) { display: none; }
#tab-settings.m-settings.m-open .m-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  margin: -6px 0 4px -6px;
  padding: 0 8px 0 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
}
#tab-settings.m-settings .m-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tab-settings.m-settings.m-open .card.m-active { margin: 0; padding: 0; border: none; background: none; }
#tab-settings.m-settings.m-open .card.m-active > .card-header-row { margin: 0 0 16px; pointer-events: none; }
#tab-settings.m-settings.m-open .card.m-active > .card-header-row h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text); opacity: 1; }
#tab-settings.m-settings.m-open .card.m-active > .card-header-row .collapse-arrow { display: none; }
/* inside an open section: sub-sections become their own cards */
#tab-settings.m-settings.m-open .card.m-active .card-body > * + * { margin-top: 0; }
#tab-settings.m-settings.m-open .card.m-active :is(.settings-sub-first, .sub-section, .settings-sub) {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--hair);
  border-radius: 20px;
  background: var(--surface);
}
#tab-settings.m-settings.m-open .card.m-active .card-body { display: flex; flex-direction: column; }

/* "+ Add ..." forms behind a button */
.m-addbtn { display: none; }
#tab-settings.m-settings .m-addbtn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 0;
  padding: 0 14px;
  border: 1px dashed var(--accent-outline);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
}
#tab-settings.m-settings .m-addbtn.m-on { border-style: solid; }
#tab-settings.m-settings .m-addform:not(.m-show) { display: none; }
#tab-settings.m-settings .m-addform.m-show { margin-top: 12px; }

/* bucket rows: just the name, amount and where it goes; tap for the rest */
#tab-settings.m-settings :is(#buckets-list, #fixed-buckets-list) > .bucket-row {
  position: relative;
  padding-right: 34px;
  cursor: pointer;
}
#tab-settings.m-settings :is(#buckets-list, #fixed-buckets-list) > .bucket-row::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: center / 18px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6579' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}
#tab-settings.m-settings :is(#buckets-list, #fixed-buckets-list) > .bucket-row :is(.toggle-chip, label.invest-link, .row-inline, .tag-badge) { display: none; }
#tab-settings.m-settings :is(#buckets-list, #fixed-buckets-list) > .bucket-row > div:first-child > div:first-child { font-weight: 600; }

/* the sheet */
#tab-settings.m-settings ~ .m-sheet, body .m-sheet.m-show {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.55);
}
.m-sheet:not(.m-show) { display: none !important; }
.m-sheet-panel {
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--hair);
  border-radius: 28px 28px 0 0;
  animation: mSheetIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes mSheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.m-grab { width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--faint); }
.m-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.m-sheet-head > div { flex: 1; min-width: 0; }
.m-sheet-title { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.m-sheet-sub { font-size: 13px; color: var(--muted); }
.m-sheet-done { min-height: 34px; padding: 0 14px; border: none; border-radius: 999px; background: var(--surface-2); color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; }
.m-sheet-body { display: flex; flex-direction: column; gap: 10px; }
.m-sheet-item { padding: 12px 14px; border: 1px solid var(--hair); border-radius: 16px; background: var(--bg); }
.m-sheet-item label.invest-link { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; margin: 0; font-size: 15px; color: var(--text); }
.m-sheet-item label.invest-link select { max-width: 60%; }
.m-sheet-item .toggle-chip { width: 100%; min-height: 40px; }
.m-sheet-item.m-actions { padding: 0; border: none; background: none; }
.m-sheet-item.m-actions .row-inline { display: grid !important; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-sheet-item.m-actions button { width: 100%; min-height: 46px; border-radius: 14px; }
.m-sheet-item.m-actions button[data-id] { grid-column: 1 / -1; background: var(--danger-soft) !important; color: var(--danger) !important; border: none !important; }
html.m-sheet-open, html.m-sheet-open body { overflow: hidden; }

/* Preferences: switches + color dots */
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .row-inline {
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: 14px;
  margin: 0 !important;
  padding: 13px 16px;
  border: 1px solid var(--hair);
  border-bottom-width: 0;
  background: var(--surface);
}
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .row-inline:first-child { border-radius: 18px 18px 0 0; }
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .row-inline:nth-child(3) { border-bottom-width: 1px; border-radius: 0 0 18px 18px; margin-bottom: 16px !important; }
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .row-inline label { font-size: 15px; }
#tab-settings.m-settings [data-card-key="settings-preferences"] input[type="checkbox"] {
  position: relative !important;
  width: 51px !important;
  height: 31px !important;
  min-width: 51px !important;
  min-height: 31px !important;
  max-width: 51px !important;
  max-height: 31px !important;
  border: 1px solid var(--hair) !important;
  border-radius: 16px !important;
  background: var(--surface-2) !important;
  background-image: none !important;
  transition: background-color 0.2s ease !important;
}
#tab-settings.m-settings [data-card-key="settings-preferences"] input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}
#tab-settings.m-settings [data-card-key="settings-preferences"] input[type="checkbox"]:checked { background: var(--accent) !important; border-color: var(--accent) !important; }
#tab-settings.m-settings [data-card-key="settings-preferences"] input[type="checkbox"]:checked::before { transform: translateX(20px); }
#tab-settings.m-settings [data-card-key="settings-preferences"] input[type="checkbox"]::after { display: none !important; content: none !important; }
.m-swatches { display: none; }
#tab-settings.m-settings .m-swatches { display: flex; justify-content: space-between; gap: 6px; margin: 10px 0 12px; }
.m-swatch { width: 38px; height: 38px; min-height: 0; padding: 0; border: 2px solid transparent; border-radius: 50%; }
.m-swatch.m-on { border-color: var(--text); box-shadow: inset 0 0 0 3px var(--bg); }
/* the add-bucket form inside the sheet */
.m-sheet-item.m-form { padding: 14px; }
.m-sheet-item.m-form .m-addform { margin: 0; }
.m-sheet-item.m-form .row { flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.m-sheet-item.m-form .row > :is(input, select) { flex: 1 1 140px; max-width: none !important; min-height: 46px; }
.m-sheet-item.m-form .row-inline { margin: 0 0 10px !important; }
.m-sheet-item.m-form #add-bucket-btn { flex: 1 1 100%; min-height: 50px; }
.m-sheet-item.m-form #bucket-total-warning:empty { display: none; }

/* ---- 2026-11-20 (4): rows read the same everywhere ----
   Every row in every list gets the same space above and below its text, and
   the thin curved line only goes BETWEEN rows - never under the last one (so
   a single loan, the Cash row, etc. have no line under them). */
.list > .list-item,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .list > .list-item,
.card .list > .list-item:last-child,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .card .list > .list-item:last-child,
#recurring-list .list-item {
  padding-top: 13px;
  padding-bottom: 13px;
}
.list > .list-item:last-child,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .list > .list-item:last-child,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) :is(#balance-list, #debt-list, #savings-accounts-list, #investments-list) .list-item:last-child { border-bottom-color: transparent; }
/* the rows in Account Balance / Savings had their lines turned off - give
   them the same line between rows as everywhere else */
:is(#balance-list, #debt-list, #savings-accounts-list, #investments-list) .list-item:not(:last-child) { border-bottom-color: var(--hair); }
/* Account Balance: when Investments follow the bank accounts, the last
   account (Cash) gets the same curved line + spacing as any other row, and
   the investments start right under it like the next rows */
#tab-home .card[data-card-key="home-balance"].has-invest #balance-list > .list-item:last-child { border-bottom-color: var(--hair); }
#tab-home .card[data-card-key="home-balance"] .invest-sub { margin-top: 0; padding-top: 0; border-top: none; }

/* ---- 2026-11-20 (5): Connected accounts + Money moved button ---- */
/* empty statement-due box: "Add Date" instead of a blank / mm/dd/yyyy */
.date-wrap { position: relative; display: inline-flex; align-items: center; }
.date-wrap .date-ph { display: none; }
.date-wrap.is-empty input[type="date"]:not(:focus) { color: transparent; }
.date-wrap.is-empty input[type="date"]:not(:focus)::-webkit-datetime-edit { color: transparent; }
.date-wrap.is-empty input[type="date"]:not(:focus) + .date-ph {
  display: block;
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.account-row-controls { flex-wrap: wrap; gap: 8px; }
.account-row-controls .toggle-chip { order: 9; flex: 1 1 auto; min-height: 34px; white-space: nowrap; } /* after Rename / Remove; takes the next line if they fill this one */
/* Money moved: a full-width button at the bottom of Paychecks, the
   "last moved" time centred under it */
#tab-home #paycheck-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin: 16px 0 0;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 650;
  box-shadow: 0 10px 24px -14px var(--accent-glow);
}
#tab-home #paycheck-reset-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#tab-home #paycheck-reset-btn:active { transform: scale(0.985); }
#tab-home #paycheck-reset-btn.hidden + #paycheck-last-moved { margin-top: 12px; }
#tab-home #paycheck-last-moved { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---- 2026-11-20 (6): Paychecks ---- */
/* a line under "Remaining Balance" and its amount */
/* Remaining Balance: the words and the amount are each underlined (not the
   space between); the normal grey line under the row stays */
#paycheck-breakdown .allocation-line.remaining-line > span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* the savings account a bucket goes to: just its icon, no bubble */
.bucket-acct-icon { display: inline-flex; vertical-align: -3px; margin-right: 6px; color: var(--accent); } /* in front of the bucket's name */
.bucket-acct-icon svg { display: block; }

/* ---- 2026-11-20 (7): statement-due date box - smaller, "Add Date" in the
   same colour as a picked date ---- */
.due-date-row { align-items: center; gap: 10px; }
.due-date-row input[type="date"] {
  max-width: 132px !important;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
}
.date-wrap.is-empty input[type="date"]:not(:focus) + .date-ph { left: 10px; color: var(--text); font-size: 13px; font-weight: 500; }
/* ↑ ↓ Rename Remove View only - all on one line under the account type */
.list-item.account-row > .account-row-controls { gap: 6px; }
.account-row-controls > button,
.account-row-controls > .toggle-chip {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 0 8px;
  font-size: 12.5px;
  white-space: nowrap;
}
.account-row-controls > button[data-move] { order: 0; flex: 0 0 36px; padding: 0; }
.account-row-controls > .toggle-chip { order: 2; }
.list-item.account-row .due-date-row input[type="date"] { height: 34px !important; min-height: 34px !important; max-height: 34px !important; padding-top: 0 !important; padding-bottom: 0 !important; }

/* ---- 2026-11-20 (8): Schedule's Edit is a pencil in the top bar, beside
   refresh + settings (only on the Schedule tab) ---- */
#hdr-edit-btn { display: none; }
#app:has(#tab-schedule:not(.hidden)) #hdr-edit-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  margin-left: auto;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hair);
  color: var(--text);
}
#app:has(#tab-schedule:not(.hidden)) #refresh-all-btn { margin-left: 8px; }
#hdr-edit-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#tab-schedule #schedule-edit-btn { display: none; }
@media (min-width: 1024px) {
  #app:has(#tab-schedule:not(.hidden)) #hdr-edit-btn { position: fixed; top: 20px; right: 124px; z-index: 22; width: 40px; height: 40px; margin: 0; border-radius: 12px; }
  #app:has(#tab-schedule:not(.hidden)) #refresh-all-btn { margin-left: 0; }
}

/* ---- 2026-11-20 (9): a little less space between the last credit card /
   investment and the total under it ---- */
#tab-home #debt-list, #tab-home #investments-list, #tab-home #balance-invest-section { margin-bottom: 0; }

/* ---- 2026-11-20 (10): bucket / loan forms ---- */
/* repeats dropdown wide, its date box small - like the statement-due date */
#new-bucket-recurrence-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
#new-bucket-recurrence-row #new-bucket-recurrence { flex: 1 1 auto !important; min-width: 0; }
#new-bucket-recurrence-row #new-bucket-anchor-date {
  flex: 0 0 132px !important;
  width: 132px; max-width: 132px !important;
  height: 34px !important; min-height: 34px !important; max-height: 34px !important;
  padding: 0 10px !important; border-radius: 10px; font-size: 13px;
}
/* the add-loan form in the bottom sheet */
.m-sheet-item.m-form #add-loan-btn { flex: 1 1 100%; width: 100%; min-height: 50px; }
/* external bucket icon: muted, not the accent */
.bucket-acct-icon.is-external { color: var(--muted); }
/* Savings Accounts: "Total Savings" a little closer to the last account */
#tab-home #savings-accounts-list { margin-bottom: 0; }
/* Loans: a small green "+ Log payment" pill instead of a full-width button */
button.loan-log-btn,
:is(#tab-home, #tab-settings) button.small.secondary.loan-log-btn,
.list-item.loan-home-row > button.loan-log-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  width: auto;
  min-height: 30px;
  height: 30px;
  margin-top: 8px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--accent-outline);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
button.loan-log-btn svg { flex: none; }
/* Settings > Paychecks: "Add a Check" is just the "+ Add a check" button on
   phones (the form opens in the sheet, like the other adds) */
#tab-settings.m-settings.m-open .card.m-active #add-check-section { padding: 0; border: none; background: none; }
#tab-settings.m-settings #add-check-section > .sub-head-row { display: none; }
#tab-settings.m-settings #add-check-section > .m-addbtn { margin-top: 0; }
.m-sheet-item.m-form #add-custom-paycheck-btn { width: 100%; min-height: 50px; margin-top: 4px; }
.m-sheet-item.m-form .m-addform > p.muted { margin: 0 0 10px; }

/* ---- 2026-11-20 (11): Preferences - "Only review transactions from" and
   its date side by side, the date box the same small size as the others ---- */
.row:has(> #setting-review-start-date) { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; }
.row:has(> #setting-review-start-date) > label { flex: 1 1 auto !important; min-width: 0; margin: 0; }
.row > #setting-review-start-date {
  flex: 0 0 132px !important;
  width: 132px; max-width: 132px !important;
  height: 34px !important; min-height: 34px !important; max-height: 34px !important;
  padding: 0 10px !important; border-radius: 10px; font-size: 13px;
}
/* a bucket that adds to an investment account: a small chart icon (violet,
   like the investment rows on Home) instead of the name bubble */
.bucket-acct-icon.is-invest { color: var(--accent); } /* same green as the savings icons */
/* Home > Loans: "Log payment" beside the time-left line, and a tighter card */
#tab-home .list-item.loan-home-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: center; }
#tab-home .list-item.loan-home-row > .loan-home-head { grid-column: 1 / -1; }
#tab-home .list-item.loan-home-row > .meta { grid-column: 1; }
#tab-home .list-item.loan-home-row > button.loan-log-btn { grid-column: 2; grid-row: 2; margin-top: 0; }
#tab-home .card[data-card-key="home-bigloans"] { padding: 14px 16px; }
#tab-home .card[data-card-key="home-bigloans"] .card-header-row { margin-bottom: 4px; }

/* ---- 2026-11-20 (12): top-bar buttons (edit / refresh / settings) closer
   together on phones - 6px apart instead of 18px ---- */
@media (max-width: 1023px) {
  #refresh-all-btn + #settings-gear,
  #app:has(#tab-schedule:not(.hidden)) #refresh-all-btn { margin-left: -4px; }
}
/* ---- 2026-11-20 (13): Log payment pill a little smaller ---- */
button.loan-log-btn,
:is(#tab-home, #tab-settings) button.small.secondary.loan-log-btn,
.list-item.loan-home-row > button.loan-log-btn { min-height: 26px; height: 26px; padding: 0 10px 0 8px; gap: 4px; font-size: 12px; }
button.loan-log-btn svg { width: 12px; height: 12px; }

/* ---- 2026-11-20 (14) ---- */
/* Settings > Loans: Log payment, Edit balance and Remove all the same height */
#tab-settings .loan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#tab-settings .loan-actions > button,
#tab-settings .loan-actions > button.small.secondary.loan-log-btn {
  height: 32px !important;
  min-height: 32px !important;
  margin: 0 !important;
  padding: 0 12px;
  font-size: 12.5px;
  align-self: center;
}
/* every "add" in Settings looks like "+ Add loan": a soft green dashed button */
#tab-settings #connect-btn,
#tab-settings .tag-paycheck-btn {
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--accent-outline) !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  box-shadow: none;
  font-weight: 600;
}
#tab-settings #connect-btn { width: 100%; min-height: 48px; justify-content: flex-start; padding: 0 14px; border-radius: 14px; font-size: 15px; }
#tab-settings .tag-paycheck-btn { gap: 5px; height: 30px; min-height: 30px; padding: 0 11px 0 9px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; }
/* Home > Loans: Log payment a little smaller, still in line with the time left */
#tab-home .list-item.loan-home-row > button.loan-log-btn { height: 22px; min-height: 22px; padding: 0 8px 0 7px; gap: 3px; font-size: 11px; align-self: center; }
#tab-home .list-item.loan-home-row > button.loan-log-btn svg { width: 10px; height: 10px; }


/* ==== 2026-11-20 tweaks ==== */
/* Connected Accounts: up/down arrows drawn as icons, centred in their buttons */
.account-row-controls > button.move-btn { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.account-row-controls > button.move-btn svg { display: block; flex: none; }

/* Paychecks: Skip Fixed + Remove side by side under each check */
.source-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.source-actions .toggle-chip { margin: 0; display: inline-flex; align-items: center; height: 34px; padding: 0 14px; font-size: 13px; border-radius: 999px; box-sizing: border-box; } /* same height as Remove */
.source-actions > button.small { flex: 0 0 auto; }

/* Preferences: "Only review transactions from" is a row in the toggle group,
   the calendar on the right where the switches are */
.review-from-row { flex-direction: row-reverse; justify-content: space-between; flex-wrap: nowrap; }
.review-from-row input[type="date"] { flex: 0 0 auto; width: auto; min-width: 0; max-width: 150px !important; height: 34px; min-height: 34px; padding: 0 10px; font-size: 14px; }
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .row-inline:nth-child(3) { border-bottom-width: 0; border-radius: 0; margin-bottom: 0 !important; }
#tab-settings.m-settings [data-card-key="settings-preferences"] .card-body > .review-from-row { border-bottom-width: 1px; border-radius: 0 0 18px 18px; margin-bottom: 16px !important; }

/* Preferences: accent colour is just the dots - the last one is a colour wheel */
#tab-settings .hue-row { display: none !important; }
#tab-settings .m-swatches { display: flex; justify-content: space-between; gap: 6px; margin: 10px 0 12px; }
.m-swatch.m-wheel { position: relative; display: inline-block; flex: none; overflow: hidden; cursor: pointer; box-sizing: border-box;
  background: conic-gradient(from 0deg, #ff4d4d, #ffd84d, #6bff4d, #4dfff0, #4d6bff, #d84dff, #ff4d4d); }
.m-wheel-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }

/* Home - Account Balance: the square icons in the accent colour (same shape) */
#tab-home #balance-list .list-item::before,
#tab-home #investments-list .list-item::before,
#balance-list .list-item::before,
#investments-list .list-item::before { background-color: var(--accent-soft) !important; background-image: var(--ico-bank) !important; }
#tab-home #balance-list .list-item:last-child::before,
#balance-list .list-item:last-child::before { background-image: var(--ico-cash) !important; }
#tab-home #investments-list .list-item::before,
#investments-list .list-item::before { background-image: var(--ico-invest) !important; }

/* Home - Savings Accounts: a little less space under Total Savings */
#tab-home .card[data-card-key="home-savings"] { padding-bottom: 10px; }
#tab-home .card[data-card-key="home-savings"] #savings-error-note:empty { display: none; }

/* Schedule: the four totals (hours / pay this week and month) a bit tighter */
#tab-schedule .card[data-card-key="schedule-week"] .card-body > .allocation-line.total { padding-top: 8px !important; padding-bottom: 7px !important; }

/* ==== 2026-11-20 (2) ==== */
/* fixed bucket due in under 5 days: the date goes red */
.allocation-line .meta .due-soon { color: var(--danger); font-weight: 600; }
/* "Use Savings" in place of the checkbox when there's no paycheck */
.use-savings-btn { height: 28px; min-height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--accent-outline) !important; background: var(--accent-soft) !important; color: var(--accent) !important; box-shadow: none; }
/* nothing to move: the Reset button becomes the dashed "No money to move" note */
#paycheck-reset-btn.no-money,
#tab-home #paycheck-reset-btn.no-money {
  border: 1px dashed var(--accent-outline) !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: default;
  font-weight: 600;
}
#usesav-modal select, #usesav-modal input { width: 100%; box-sizing: border-box; }

/* ==== 2026-11-20 (3) ==== */
/* Paychecks with no check waiting: a small gap under "No unallocated checks" */
#paycheck-breakdown.no-check { margin-top: 10px; }
#paycheck-breakdown.no-check > .allocation-line:first-child { border-top: 0; }
/* Home > Loans: the loan's icon on the left of its name and estimate */
#tab-home .list-item.loan-home-row { grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: 12px; }
#tab-home .list-item.loan-home-row > .row-emoji { grid-column: 1; grid-row: 1 / 3; align-self: center; }
#tab-home .list-item.loan-home-row > .loan-home-head { grid-column: 2 / -1; grid-row: 1; }
#tab-home .list-item.loan-home-row > .meta { grid-column: 2; grid-row: 2; }
#tab-home .list-item.loan-home-row > button.loan-log-btn { grid-column: 3; grid-row: 2; }
.row-emoji svg { display: block; }
/* the "6 yrs 1 mo left" estimate: a small clock, tidy and quiet */
.meta.loan-left { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.meta.loan-left svg { flex: none; opacity: 0.7; }

/* ==== flatter look (both themes) - FinWise-style: no glows, no gradient cards ==== */
:root { --accent-glow: transparent; }
#tab-home .card[data-card-key="home-afterdebts"] { background: var(--accent); box-shadow: none; }
header .brand-mark { box-shadow: none; }
button.primary, #tab-home #paycheck-reset-btn { box-shadow: none; }
/* Preferences: Appearance (Light / Dark) */
.appearance-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 4px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.seg button { min-height: 0; height: 32px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; box-shadow: none; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }


/* ==== Depth: "3D but minimal" (after the FinWise / Figma Make references) ====
   Same dark look and layout; surfaces are lifted with a faint light top edge
   and a soft shadow below, the balance card is glossy, buttons are slightly
   beveled and press down when tapped, fields sit pressed into their card,
   and the phone tab bar floats. */
:root {
  --accent-glow: hsl(var(--accent-h) 75% var(--accent-l) / 0.38);
  --lift: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 0 rgba(0, 0, 0, 0.5), 0 14px 30px -14px rgba(0, 0, 0, 0.75);
  --lift-sm: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 4px 10px -4px rgba(0, 0, 0, 0.6);
  --press: inset 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* cards: lifted off the page */
.card,
:is(#tab-home, #tab-settings, #tab-transactions, #tab-recurring, #tab-schedule, #tab-stocks) .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 60%), var(--surface);
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: var(--lift);
}
#tab-home .card.notifications-card, #tab-settings .card.logout-card { box-shadow: none; background: none; }

/* the balance card: accent, glossy, with real depth */
#tab-home .card[data-card-key="home-afterdebts"] {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, hsl(var(--accent-h) 76% calc(var(--accent-l) + 6%)), hsl(var(--accent-h) 72% calc(var(--accent-l) - 12%)));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -12px 26px rgba(0, 0, 0, 0.14),
    0 2px 0 hsl(var(--accent-h) 70% calc(var(--accent-l) - 22%)),
    0 22px 40px -18px var(--accent-glow);
}

/* icon tiles: small raised chips */
:is(#balance-list, #debt-list, #savings-accounts-list, #investments-list) .list-item::before,
.row-emoji,
#tab-settings.m-settings:not(.m-open) .card-header-row::before { box-shadow: var(--lift-sm); }

/* buttons: slight bevel, they press down when tapped */
button.primary,
#tab-home #paycheck-reset-btn:not(.no-money) {
  background: linear-gradient(180deg, hsl(var(--accent-h) 76% calc(var(--accent-l) + 6%)), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 0 hsl(var(--accent-h) 70% calc(var(--accent-l) - 22%)), 0 10px 20px -10px var(--accent-glow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
button.secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)), var(--surface-2);
  box-shadow: var(--lift-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
:is(button.primary, button.secondary, #paycheck-reset-btn):not(:disabled):active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* fields: pressed into the card */
:is(input:not([type="checkbox"]):not([type="range"]):not([type="color"]), select, textarea) {
  background-color: var(--bg);
  box-shadow: var(--press);
}

/* phones: the tab bar floats as a lifted pill */
@media (max-width: 1023px) {
  #bottom-nav {
    left: 12px;
    right: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 26px;
    background: rgba(18, 22, 30, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 36px -12px rgba(0, 0, 0, 0.8);
  }
  .tab-btn.active .tab-icon { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px -4px var(--accent-glow); }
}
