/* benseddiq.com: black theme.
   1. Settings (colours, sizes)   2. Page and top bar   3. Totals
   4. Bills table                 5. Buttons and boxes  6. Add a bill
   7. Phone layout */

/* ---------------------------------------------------------------- 1 */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("vendor/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
/* the name on the login page (since 2026-11-26): Great Vibes, a script font
   from Fontsource 5.3.0, free under the SIL Open Font License (licence file
   beside it). Only the login page uses it, so only that page loads it.
   "block", not "swap" (since 2026-11-26): until the font is there the name
   stays invisible instead of showing in another font first. The login page
   preloads the file and the browser keeps it a year, so that wait is
   rarely seen at all. */
@font-face {
  font-family: "Great Vibes";
  src: url("vendor/fonts/great-vibes-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --bg: #050505;            /* the page */
  --surface: #0d0d0f;       /* cards */
  --surface-2: #131316;     /* table header, total row */
  --surface-3: #1b1b1f;     /* hover */
  --edge: rgba(255, 255, 255, 0.07);         /* card edges, table lines */
  --edge-strong: rgba(255, 255, 255, 0.14);  /* boxes you type in */
  --text: #d6d3d1;          /* all main text: "warm stone" (bright white #f4f4f5 until 2026-11-16) */
  --muted: #8b8b95;
  --faint: #4b4b53;         /* fees of 0 */
  --accent: #72b3a8;        /* muted teal: totals, buttons (bright mint #6ee7b7 until 2026-11-16) */
  --accent-rgb: 114, 179, 168;  /* the same colour as numbers, for see-through tints: rgba(var(--accent-rgb), 0.1) */
  --accent-soft: rgba(var(--accent-rgb), 0.14);
  --accent-ink: #071b18;    /* text on a teal button */
  --danger: #f87171;
  --row-h: 46px;            /* height of every table row, header included */
  --radius: 16px;
  --radius-sm: 10px;
  --width: 1240px;
  --gutter: 24px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------------------- 2 */
*, *::before, *::after { box-sizing: border-box; }

/* scrollbar-gutter: the scrollbar's strip is always kept free, so the page
   doesn't shift sideways when opening a card makes it long enough to
   scroll (or closing one makes it short again). */
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The background (since 2026-11-24): soft pools of colour behind the page,
   specks of light drifting over them, and the cards frosted on top (section 4).
   - The glows: the main one (top left) follows the money: teal while the
     current week is within budget, amber when under a quarter is left,
     red when it's overspent (site.js sets data-mood on <html> from the
     Paychecks page and remembers it for the other pages). Blue on the
     right, violet at the bottom. They drift very slowly; still when the
     phone or computer is set to reduce motion.
   - The particles (replaced the grain, which looked low-resolution):
     soft specks of light drifting upward, drawn by particles.js on the
     .bg-particles canvas. */
@property --glow-main {
  syntax: "<color>";
  inherits: true;
  initial-value: rgb(114 179 168);
}
:root { --glow-main: rgb(114 179 168); }
:root[data-mood="low"] { --glow-main: rgb(226 168 84); }
:root[data-mood="over"] { --glow-main: rgb(214 96 96); }

body::before,
.bg-particles {
  position: fixed;
  pointer-events: none;
}
body::before {
  content: "";
  inset: -15%;
  z-index: -2;
  /* first line: for browsers without color-mix (always teal) */
  background:
    radial-gradient(44% 36% at 20% 12%, rgba(114, 179, 168, 0.46), transparent 72%),
    radial-gradient(40% 44% at 88% 44%, rgba(72, 104, 214, 0.34), transparent 72%),
    radial-gradient(48% 38% at 30% 92%, rgba(138, 92, 214, 0.28), transparent 72%);
  background:
    radial-gradient(44% 36% at 20% 12%, color-mix(in srgb, var(--glow-main) 46%, transparent), transparent 72%),
    radial-gradient(40% 44% at 88% 44%, rgba(72, 104, 214, 0.34), transparent 72%),
    radial-gradient(48% 38% at 30% 92%, rgba(138, 92, 214, 0.28), transparent 72%);
  transition: --glow-main 1.5s ease;
  animation: glow-drift 90s ease-in-out infinite alternate;
  will-change: transform;
}
.bg-particles {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
@keyframes glow-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(4%, -3%, 0) scale(1.06); }
  100% { transform: translate3d(-4%, 3%, 0) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--edge);
}

.topbar-inner {
  max-width: var(--width);
  margin: 0 auto;
  padding: 12px max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* the logo (since 2026-11-25; a teal "B" tile before), in the top bar and
   on the login page. A quiet edge and a short dark shadow, with only a
   trace of the teal glow (since 2026-11-26; it was 0 4px 18px at 22%). */
.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 6px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(90, 159, 147, 0.07);
}

/* The test site (lab.benseddiq.com, since 2026-12-04): an amber LAB badge
   beside the name, so it's never mistaken for the real site. */
.lab-badge {
  margin-left: 2px;
  padding: 2px 7px;
  border: 1px solid rgba(240, 198, 116, 0.45);
  border-radius: 6px;
  background: rgba(240, 198, 116, 0.12);
  color: #f0c674;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.nav { display: flex; gap: 4px; }

.nav a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s, background-color 0.15s;
}

.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }

/* the ☰ button and the Settings link are for phones only (section 7, end) */
.menu-btn, .nav-phone-only { display: none; }

.page {
  max-width: var(--width);
  margin: 0 auto;
  padding: 44px max(var(--gutter), env(safe-area-inset-right)) 80px max(var(--gutter), env(safe-area-inset-left));
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.lede { margin: 8px 0 0; color: var(--muted); }

/* ---------------------------------------------------------------- 3 */
.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: rgba(13, 13, 15, 0.75);   /* frosted like the cards (section 4) */
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.stat-accent {
  background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.15), rgba(var(--accent-rgb), 0.03) 70%);
  border-color: rgba(var(--accent-rgb), 0.25);
}

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

/* ---------------------------------------------------------------- 4 */
/* Frosted cards (since 2026-11-24): 75% of the card colour with the glows
   blurred through it. The glass is a layer behind the card's content, not
   the card itself, because a blur set on the card would trap the notes
   windows and suggestion lists placed inside it. Table headers and rows
   that have their own colour stay solid, so numbers sit on calm ground. */
.card {
  position: relative;
  isolation: isolate;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(13, 13, 15, 0.75);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  pointer-events: none;
}

.bills {
  width: 100%;
  table-layout: fixed;   /* columns take exactly the widths below, in every table */
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

/* Tablets and small windows (wider than a phone, narrower than the table):
   the table keeps its columns and scrolls sideways inside its card, so Name
   never gets squeezed. Every table has the same smallest width, so their
   columns still line up. Phones use cards instead (section 7). */
/* (relative: hidden helpers such as the tick boxes stay inside the scroll
   area instead of widening the whole page) */
/* hidden for a moment while the page goes back to where you were (site.js) */
html.restoring body { visibility: hidden; }

/* Moving between pages (since 2026-11-26, as on noctislane.com): the old
   page fades out and the new one fades in, while the top bar stays put and
   the page's cover photo changes in place. The browser does this itself
   (Chrome, Edge, Safari, and Chrome on Android); others change page as
   before. A reload, or coming back to where you were after a save (the
   "restoring" moment above), skips it: see the pagereveal line in base.html.
   The page's content then rises gently into place. It only moves, it
   doesn't fade: fading would switch off the cards' frosted glass for a
   moment. "backwards": once it has risen, nothing is left on the page. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .topbar { view-transition-name: topbar; }
  .page-cover { view-transition-name: page-cover; }
  ::view-transition-old(root) { animation: 0.14s ease-in both page-fade-out; }
  ::view-transition-new(root) { animation: 0.24s ease-out both page-fade-in; }
  ::view-transition-group(page-cover) { animation-duration: 0.3s; }
  .page { animation: page-rise-in 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
}
@keyframes page-fade-out { to { opacity: 0; } }
@keyframes page-fade-in { from { opacity: 0; } }
@keyframes page-rise-in { from { transform: translateY(6px); } }

.table-scroll { position: relative; overflow-x: auto; overscroll-behavior-x: contain; container-type: inline-size; }
@media (min-width: 641px) {
  .bills { min-width: 1190px; }   /* the card's width on a computer */
  /* the edit panel stays in view, as wide as the card, while the row scrolls */
  .table-scroll .edit-panel {
    position: sticky;
    left: 0;
    box-sizing: border-box;
    width: 100cqw;   /* the visible width of .table-scroll (a size container) */
  }
}

/* Every row, header and Total included, is --row-h tall (a row only grows
   if a long name wraps onto two lines). */
.bills th,
.bills td {
  height: var(--row-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--edge);
  text-align: left;
  vertical-align: middle;
}

.bills thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bills tbody tr { transition: background-color 0.12s; }
.bills tbody tr:not(.editing):not(.empty):not(.error-row):hover { background: rgba(255, 255, 255, 0.025); }

/* Money columns take only the room their numbers (or their two-line header)
   need; the Name column gets the rest. */
/* Fixed column widths (since 2026-11-16), the same in the Bills and the
   Subscriptions tables so their columns line up; Name takes the rest. */
.bills .num { width: 88px; text-align: right; white-space: nowrap; }
.bills thead th { line-height: 1.3; }
.bills .name { min-width: 230px; font-weight: 600; overflow-wrap: break-word; }
.bills th:first-child,
.bills td:first-child { padding-left: 20px; }
.bills .strong { font-weight: 700; }
.bills .zero { color: var(--faint); }
.bills .accent { color: var(--accent); }

.bills .actions { width: 112px; white-space: nowrap; text-align: right; padding-left: 8px; }

.row-buttons { display: inline-flex; align-items: center; gap: 4px; }

.bills tfoot th,
.bills tfoot td {
  border-bottom: 0;
  background: var(--surface-2);
  font-weight: 700;
}

.bills tfoot th { font-size: 15px; }

.bills .empty td {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}

/* The row being edited is highlighted; its edit panel opens underneath. */
.bills tr.open td { background: rgba(var(--accent-rgb), 0.05); }

.bills tr.editing td {
  height: auto;
  padding: 0;
  background: rgba(var(--accent-rgb), 0.035);
}

.edit-panel { padding: 18px 20px 20px; }
.edit-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; }

/* Paused and canceled bills: faded, since they are not in the totals. */
.bills tr.left-out .name-text,
.bills tr.left-out .num,
.bills tr.left-out .renew-flag { opacity: 0.45; }

.foot-note { color: var(--muted); font-size: 12px; font-weight: 500; text-align: right; white-space: nowrap; }

/* Service rows: everything in regular weight (names, amounts, payment,
   tags, status pills). The Total row stays bold; the edit panel keeps its
   own look. Since 2026-11-16. */
.bills tbody tr:not(.editing) td,
.bills tbody tr:not(.editing) td * { font-weight: 400; }
/* ------------------------------------------------- 4e. Sections */
/* Bills, Subscriptions and Supplements: one card each that folds away
   (<details>). The title bar (<summary>): a coloured "+" (section 6), the
   title, the monthly cost and a chevron on the right. */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  cursor: pointer;
  list-style: none;             /* no browser triangle */
  user-select: none;
  transition: background-color 0.15s;
}
.section-head::-webkit-details-marker { display: none; }
.section-head:hover { background: rgba(255, 255, 255, 0.02); }
.section-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.section-card[open] > .section-head { border-bottom: 1px solid var(--edge); }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .section-sum { margin-left: auto; }
.section-head .add-chevron { margin-left: 4px; }
.section-sum { white-space: nowrap; font-variant-numeric: tabular-nums; }
.section-sum-value { font-size: 18px; font-weight: 700; color: var(--text); }
.section-sum-unit { color: var(--muted); font-size: 13px; }

.stat-value small { color: var(--muted); font-size: 13px; font-weight: 500; }

/* A card showing a "What if I cancel" figure: dashed teal edge, the figure
   in teal, and the real figure struck through underneath. */
.stat.whatif-on { border-style: dashed; border-color: rgba(var(--accent-rgb), 0.45); }
.stat.whatif-on .stat-num { color: var(--accent); }
.stat-was { color: var(--muted); font-size: 12px; text-decoration: line-through; font-variant-numeric: tabular-nums; }
/* the Subscriptions header and Total row while boxes are ticked */
.whatif-num { color: var(--accent); }
.bills tfoot .whatif-num { text-decoration: underline dashed rgba(var(--accent-rgb), 0.5); text-underline-offset: 4px; cursor: help; }
.section-sum .stat-was { margin-left: 8px; }

/* "What if I cancel": the last column, headed by a scissors icon, with a
   tick box on each Active or Trial subscription (both shown only with
   JavaScript); the struck-through row, and the line with the savings. */
.bills .cut-cell { width: 40px; padding-left: 4px; padding-right: 14px; text-align: center; }
.cut-head { display: none; justify-content: center; color: var(--muted); }
.js .cut-head { display: inline-flex; }
.cut-head svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cut { display: none; flex: none; position: relative; cursor: pointer; vertical-align: middle; }
.js .cut { display: inline-flex; }
.cut input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cut-mark {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--faint);
  border-radius: 5px;
  transition: border-color 0.15s, background-color 0.15s;
}
.cut:hover .cut-mark { border-color: var(--muted); }
.cut input:checked + .cut-mark {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23071b18' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / 11px;
}
.cut input:focus-visible + .cut-mark { outline: 2px solid var(--accent); outline-offset: 2px; }
.bills tr.cutting .name-text,
.bills tr.cutting .num { text-decoration: line-through; text-decoration-color: rgba(var(--accent-rgb), 0.6); opacity: 0.6; }

.whatif {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--edge);
  background: rgba(var(--accent-rgb), 0.03);
  transition: background-color 0.15s;
}
.whatif[hidden],
.whatif-clear[hidden] { display: none; }  /* Clear shows only once something is ticked */
.whatif.active { background: rgba(var(--accent-rgb), 0.08); }
.whatif-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.whatif-text { flex: 1; margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.whatif-text strong { color: var(--accent); font-weight: 700; }

/* Type in the form: Bill | Subscription, a two-way switch */
.bill-form .f-kind { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
}
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: block;
  padding: 6px 16px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.seg span:hover { color: var(--text); }
.seg input:checked + span { background: rgba(var(--accent-rgb), 0.16); color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-hint { color: var(--faint); font-size: 12px; }

/* ------------------------------------------------- 4f. Supplements */

/* Supplements columns: Pharmacy and Doctor (names, grey; 150px until
   2026-11-18, narrowed to give Name more room; a long name ends in "…" and
   shows in full on hover), Duration */
.supps .where {
  width: 112px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.supps .where .none { color: var(--faint); }
.supps .duration { width: 84px; }

/* the supplement form: Name · Prescription · Pharmacy, then the two costs,
   months and the three live costs, then Payment · Notes · button */
.bill-form .f-rx,
.bill-form .f-ph,
.supp-form .f-snotes { grid-column: span 2; }
.bill-form .f-rx,
.bill-form .f-ph { position: relative; }

/* the Add card's Bill | Subscription | Supplement switch (JavaScript only;
   without it both forms show, each with its own title) */
.add-switch { display: none; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 16px; }
.js .add-switch { display: flex; }
.js .add-pane .f-kind { display: none; }  /* the switch above sets the type */
.add-pane[hidden] { display: none; }
.pane-title { margin: 22px 0 12px; font-size: 15px; font-weight: 700; }
.js .pane-title { display: none; }

/* ------------------------------------------------- 4d. Info (notes) */
.bills .info { width: 44px; padding-left: 6px; padding-right: 6px; text-align: center; white-space: nowrap; }
.info-btn { color: var(--faint); }
.info-btn.has-notes { color: var(--accent); }
.info-btn[aria-expanded="true"] { color: var(--text); background: var(--surface-3); }

/* the small window with a bill's notes (placed by site.js) */
.note-pop {
  position: fixed;
  z-index: 50;
  width: min(320px, calc(100vw - 24px));
  padding: 10px 12px 14px 14px;
  background: var(--surface-2);
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
  text-align: left;
  white-space: normal;
}
.note-pop[hidden] { display: none; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.note-pop .note-title { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.note-close { width: 28px; height: 28px; min-width: 28px; }
.note-body {
  max-height: 240px;
  margin-bottom: 12px;
  overflow-y: auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;        /* keep the line breaks as typed */
  overflow-wrap: anywhere;
}
.note-body.empty { color: var(--faint); }
.note-pop .btn { font-weight: 600; }
/* a week's window on Tracking: its notes in a box, and Save */
.note-form { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; margin: 0; }
.note-form .notes-input { width: 100%; min-height: 96px; }

/* the Notes box in the form */
.notes-input {
  height: auto;
  min-height: 42px;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}
/* Notes in the forms (bills, supplements, cards): 50% taller, 42 to 63px
   (since 2026-11-25) */
.bill-form textarea.notes-input { height: 63px; min-height: 63px; }

/* ------------------------------------------------- 4c. Status, auto-renew */
.bills .status-cell { width: 108px; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.bills .renew { width: 56px; padding-left: 8px; padding-right: 8px; white-space: nowrap; text-align: center; }

/* Payment method: quiet grey text; "—" when not set. "Payment · " is only
   shown on a phone, where there's no header. */
.bills .payment { width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; font-weight: 500; }
.bills .payment .none { color: var(--faint); }
.pay-word { display: none; }
.bills tr.left-out .payment { opacity: 0.45; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 9px;
  border: 1px solid var(--st-edge);
  border-radius: 999px;
  background: var(--st-bg);
  color: var(--st);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.status::before {           /* the coloured dot */
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-active   { --st: var(--accent); --st-bg: rgba(var(--accent-rgb), 0.10); --st-edge: rgba(var(--accent-rgb), 0.28); }
/* Trial: fuchsia (blue until 2026-11-16; blue now marks temporary payments) */
.status-trial    { --st: #f0abfc; --st-bg: rgba(240, 171, 252, 0.10); --st-edge: rgba(240, 171, 252, 0.28); }
/* Finished: a temporary payment after its last month (worked out from Ends) */
.status-finished { --st: var(--muted); --st-bg: rgba(255, 255, 255, 0.04); --st-edge: rgba(255, 255, 255, 0.12); }
.status-paused   { --st: #fcd34d; --st-bg: rgba(252, 211, 77, 0.10);  --st-edge: rgba(252, 211, 77, 0.28); }
.status-canceled { --st: #fca5a5; --st-bg: rgba(248, 113, 113, 0.10); --st-edge: rgba(248, 113, 113, 0.30); }

/* Auto-renew in the table: an icon on a computer (the words stay for
   screen readers), the words "Auto-renew On" on a phone. */
.renew-flag { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; vertical-align: middle; }
.renew-flag.on { color: var(--accent); }
.renew-flag.off { color: var(--faint); }
.renew-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.renew-text {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

form.inline { display: inline; margin: 0; }

/* "Paid through": a small tag with the service's name; "Direct" faded. */
.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  color: #a6d4cc;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* In the bills table the tag sits in the name cell, pushed to the right
   (margin-left: auto); the name, and in Subscriptions the "what if" tick
   box before it, stay on the left. */
.name-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
}
.name-line .name-text { min-width: 0; }
.name-line .tag { flex: none; max-width: 50%; margin-left: auto; }
.name-line .tag + .tag { margin-left: 0; }  /* two tags: together on the right */
.via-word { font-weight: 500; opacity: 0.75; } /* "via" a little lighter than the name */

/* Temporary payment (Ends set): a light blue tag, an hourglass and "until
   Mar 2027"; "ended Mar 2027" in grey once finished. */
.tag-ends {
  gap: 5px;
  border-color: rgba(147, 197, 253, 0.26);
  background: rgba(147, 197, 253, 0.09);
  color: #93c5fd;
}
.bills tr.left-out .tag-ends { border-color: var(--edge); background: none; color: var(--faint); }
/* a paused supplement: an amber "Paused" tag (the Paused pill's colours) */
.tag-paused {
  border-color: rgba(252, 211, 77, 0.28);
  background: rgba(252, 211, 77, 0.10);
  color: #fcd34d;
}
.bills tr.left-out .where { opacity: 0.45; }
.tag-icon {
  flex: none;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* in a section's title bar: "$45.00 / mo ends by Mar 2027" */
.section-ending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: #93c5fd;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.section-ending + .section-sum { margin-left: 14px; }
.label-soft { color: var(--faint); font-weight: 400; }

.hint { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 5 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--edge-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(248, 113, 113, 0.1); }

.icon-btn .confirm-text { display: none; }
.icon-btn.armed { padding: 0 12px; color: var(--danger); background: rgba(248, 113, 113, 0.14); }
.icon-btn.armed svg { display: none; }
.icon-btn.armed .confirm-text { display: inline; }

.btn:focus-visible,
.icon-btn:focus-visible,
.nav a:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field::placeholder { color: var(--faint); }
.field:hover { border-color: rgba(255, 255, 255, 0.22); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.num-input { text-align: right; font-variant-numeric: tabular-nums; }

/* Dropdown (Status): the browser's own arrow replaced by a thin chevron. */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' 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 11px center;
  background-size: 16px;
  cursor: pointer;
}
.select option { background: var(--surface-2); color: var(--text); }
/* Touch screens (since 2026-11-25): Android draws the date and month boxes'
   button as a down arrow hard against the right edge, whatever the padding.
   There it's replaced by the same chevron as the other boxes (11px in);
   a tap still opens the date picker. Computers keep their calendar icon. */
@media (pointer: coarse) {
  form.bill-form input[type="month"],
  form.bill-form input[type="date"] {
    /* Android's arrow is part of the box's own drawing (hiding the picker
       button left two arrows), so the box isn't drawn by Android at all */
    -webkit-appearance: none;
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' 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 11px center;
    background-size: 16px;
  }
  .bill-form input[type="month"]::-webkit-calendar-picker-indicator,
  .bill-form input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
}

/* "Paid through" suggestions (site.js): a chevron in the box, and the
   list of names already in use dropping down underneath. */
.bill-form .f-via,
.bill-form .f-pay { position: relative; }
.field.has-suggest {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' 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 11px center;
  background-size: 16px;
}
.suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 6px;
  padding: 4px;
  max-height: 232px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.suggest[hidden] { display: none; }
/* a list opened inside a table's edit panel floats above the page (site.js) */
.suggest.floating { position: fixed; right: auto; margin-top: 0; z-index: 60; }
.suggest-item {
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.suggest-item:hover,
.suggest-item.active { background: var(--surface-3); color: var(--accent); }

/* Status dropdown (site.js): the box shows the chosen status as its pill;
   the list shows all four, with a tick beside the chosen one. */
.bill-form .f-status { position: relative; }
.pick-button { display: flex; align-items: center; text-align: left; cursor: pointer; }
.pick-button:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.pick-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; }
/* Paid through / Payment lists: the box's current name also gets the tick */
.suggest-item.chosen { display: flex; align-items: center; justify-content: space-between; }
.suggest-item.chosen::after,
.pick-item[aria-selected="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2372b3a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.pick-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; pointer-events: none;
}

/* Payment methods (since 2026-11-24): the Payment box's dropdown (site.js),
   where a method can also be added (+ New payment method) or removed (×). */
.bill-form .f-pay { position: relative; }
.pay-button { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pay-button.pay-unset { color: var(--faint); font-weight: 400; }
.pay-box { max-height: 320px; }
.pay-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; min-height: 36px; }
.pay-item .pay-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-item.pay-none .pay-name { color: var(--muted); font-weight: 400; }
.pay-item.chosen::after { order: 1; }
.pay-kind { flex: none; color: var(--faint); font-size: 11.5px; font-weight: 500; }
.pay-item:hover .pay-kind { color: var(--muted); }
.pay-remove { flex: none; order: 2; width: 26px; height: 26px; opacity: 0.45; }
.pay-remove svg { width: 14px; height: 14px; }
.pay-item:hover .pay-remove, .pay-remove:focus-visible { opacity: 1; }
.pay-remove:hover { color: var(--danger, #e06c6c); }
.pay-remove.confirming { width: auto; padding: 0 8px; opacity: 1; color: var(--danger, #e06c6c); font-size: 12px; font-weight: 700; }
.pay-add {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 0; border-top: 1px solid var(--edge); border-radius: 0 0 7px 7px; background: none;
  color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.pay-add:hover { background: var(--surface-3); }
.pay-add svg, .payment-add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.method-new { display: grid; gap: 8px; margin-top: 4px; padding: 10px 8px 8px; border-top: 1px solid var(--edge); }
.method-new .field { height: 36px; font-size: 14px; min-width: 0; }
.method-new-row { display: flex; gap: 6px; }
.method-new-row .select { flex: 1; }
.method-new-row .btn { flex: none; height: 36px; }
.method-note { margin: 4px 6px 6px; color: var(--danger, #e06c6c); font-size: 12.5px; line-height: 1.4; }
.method-note[hidden] { display: none; }

/* Week payments: × takes a card out of them; + Card puts one in. */
.payment-entry { position: relative; }
.payment-remove { flex: none; width: 28px; height: 28px; opacity: 0.4; }
.payment-remove svg { width: 14px; height: 14px; }
.payment-entry:hover .payment-remove, .payment-remove:focus-visible { opacity: 1; }
.payment-remove.confirming { opacity: 1; color: var(--danger, #e06c6c); background: rgba(224, 108, 108, 0.12); }
.payment-add { position: relative; padding: 0 18px 14px; }
.payment-add .btn { display: inline-flex; align-items: center; gap: 6px; }
.weekly-box, .weekly-box.floating { width: 280px !important; right: auto; }   /* (wider than its button) */
.pay-box { min-width: 240px; }
.week-note { margin: 0 18px 12px; }

/* The Guide page (since 2026-11-25): one folding card per topic, plain text. */
.guide-card + .guide-card { margin-top: 14px; }
.page-head + .guide-card { margin-top: 18px; }

/* Page covers (since 2026-11-25): the page's photo above its title, framed
   like the cards, a little dimmed so it sits with the dark background. */
/* --cover-top: the gap above, a little smaller than the one below so they
   look the same (the menu bar's soft edge makes the top one look bigger) */
.page { --cover-h: 300px; --cover-gap: 26px; --cover-top: 23px; }
.page-cover {
  /* the gap above it (from the menu bar): the page's top padding (44px;
     28px on phones) pulled back to --cover-top */
  position: relative; height: var(--cover-h); margin: calc(var(--cover-top) - 44px) 0 var(--cover-gap); overflow: hidden;
  border: 1px solid var(--edge); border-radius: var(--radius);
}
/* 75% solid like the cards, so the glows behind show through the same way;
   a little dimmed. Darker toward the bottom left, behind the title. */
.page-cover img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.75; filter: brightness(0.8) saturate(0.82); }
.page-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(90% 120% at 0% 100%, rgba(5, 5, 5, 0.55), rgba(5, 5, 5, 0) 60%),
    linear-gradient(180deg, rgba(5, 5, 5, 0) 45%, rgba(5, 5, 5, 0.5) 100%);
}
/* The page's title sits on its cover, at the bottom left (since 2026-11-25):
   the title block is pulled up over the photo. Pages without a cover keep
   their title as before. */
.page-cover + .page-head {
  position: relative; z-index: 1;
  height: var(--cover-h); margin-top: calc(-1 * (var(--cover-h) + var(--cover-gap)));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 30px 24px; pointer-events: none;
}
/* the same gap under the cover on every page (it was 18 to 30px, from each
   page's first section): Paychecks' 26px, 20px on phones */
.page-cover + .page-head + * { margin-top: var(--cover-gap); }
.page-cover + .page-head h1 { color: #f5f5f4; text-shadow: 0 1px 14px rgba(0, 0, 0, 0.5); }
.page-cover + .page-head .lede { color: rgba(245, 245, 244, 0.78); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5); }
@media (max-width: 640px) {
  .page { --cover-h: 200px; --cover-gap: 20px; --cover-top: 18px; }   /* (150px tall until 2026-11-25) */
  .page-cover { margin-top: calc(var(--cover-top) - 28px); }
  .page-cover + .page-head { padding: 0 18px 16px; }
  .page-cover + .page-head .lede { display: none; }   /* the title alone on a phone's cover */
}

/* Settings > Page covers: upload, the photos, and each page's choice. */
.covers-card .list-hint-body { margin-bottom: 4px; }
/* The upload box (since 2026-11-26): a dashed drop area to drop photos on
   or tap, then the optional name. With site.js (class is-live) there is no
   Upload button: choosing or dropping starts the upload. */
.cover-upload { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 16px; margin: 0; }
.cover-drop {
  position: relative;
  flex: 1 1 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 104px;
  padding: 16px;
  border: 1.5px dashed rgba(var(--accent-rgb), 0.35);
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.04);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.cover-drop:hover,
.cover-drop:focus-within { border-color: rgba(var(--accent-rgb), 0.6); background: rgba(var(--accent-rgb), 0.07); }
.cover-drop.is-over { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); transform: scale(1.005); }
.cover-drop-icon { width: 24px; height: 24px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.cover-drop.is-over .cover-drop-icon { transform: translateY(-3px); }
.cover-drop-text strong { color: var(--text); font-weight: 600; }
.cover-drop-link { color: var(--accent); }
.cover-drop-types { color: var(--faint); font-size: 12px; }
/* the real file field: invisible over the box, so a tap anywhere opens it,
   and still reachable with Tab */
.cover-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cover-upload .field { flex: 1 1 180px; min-width: 0; height: 38px; font-size: 14px; }
.cover-upload .btn { flex: none; height: 38px; }
.cover-upload.is-live .cover-send { display: none; }
.cover-note { padding: 0 20px; margin: -6px 0 10px; color: var(--muted); font-size: 12.5px; }
.cover-note.is-ok { color: #a6d4cc; }
.cover-note.is-error { color: #fecaca; }
.cover-note[hidden],
.cover-grid[hidden],
.cover-pages[hidden],
.cover-empty[hidden] { display: none; }
/* a photo on its way up: dimmed, with a thin bar along its bottom edge;
   a new one fades in; one that failed turns red, then fades away */
.cover-item { position: relative; transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.35s ease; }
.cover-item.is-uploading img { opacity: 0.45; filter: saturate(0.6); }
.cover-progress { position: absolute; left: 0; right: 0; top: 80px; height: 4px; background: rgba(0, 0, 0, 0.45); }
.cover-progress span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 0.25s ease; }
.cover-item.is-new { animation: cover-in 0.5s ease; border-color: rgba(var(--accent-rgb), 0.45); }
@keyframes cover-in { from { opacity: 0.4; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.cover-item.is-failed { border-color: rgba(248, 113, 113, 0.45); }
.cover-item.is-failed img { opacity: 0.3; filter: grayscale(1); }
.cover-item.is-failed .cover-used { color: #fca5a5; white-space: normal; }
.cover-item.is-leaving { opacity: 0; transform: scale(0.96); }
.cover-item.is-deleting { opacity: 0.5; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .cover-item, .cover-drop, .cover-drop-icon, .cover-progress span { transition: none; }
  .cover-item.is-new { animation: none; }
}
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 4px 20px 16px; }
.cover-item { margin: 0; border: 1px solid var(--edge); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.cover-item img { display: block; width: 100%; height: 84px; object-fit: cover; }
.cover-item figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; font-size: 12.5px; }
.cover-item .cover-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cover-item .cover-used { display: block; color: var(--faint); font-size: 11.5px; }
.cover-pages { border-top: 1px solid var(--edge); margin: 0; padding: 12px 20px 18px; }
.cover-page { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) 120px; align-items: center; gap: 10px; padding: 6px 0; }
.cover-page .cover-page-name { color: var(--text); font-size: 14px; font-weight: 600; }
.cover-page .field { height: 36px; font-size: 14px; }
.cover-page label { display: flex; flex-direction: column; gap: 2px; color: var(--faint); font-size: 11.5px; }
.cover-page input[type="range"] { width: 100%; accent-color: var(--accent); }
.cover-preview { height: 40px; border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.cover-preview img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.75; filter: brightness(0.8) saturate(0.82); }
.cover-preview img[hidden] { display: none; }
.cover-save { display: flex; justify-content: flex-end; padding-top: 10px; }
@media (max-width: 640px) {
  .cover-page { grid-template-columns: 1fr 1fr; row-gap: 6px; padding: 10px 0; border-top: 1px solid var(--edge); }
  .cover-page:first-child { border-top: 0; }
  .cover-page .cover-page-name { grid-column: 1 / -1; }
  .cover-preview { grid-column: 1 / -1; height: 56px; }
}
.guide-card > .section-head .add-chevron { margin-left: auto; }
.guide-card > .section-head .list-count { margin-left: auto; }
.guide-card > .section-head .list-count + .add-chevron { margin-left: 0; }
.guide-body { padding: 4px 24px 20px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.guide-body p { margin: 10px 0 4px; }
.guide-body ul, .guide-body ol { margin: 8px 0 0; padding-left: 22px; }
.guide-body li + li { margin-top: 6px; }
.guide-body li::marker { color: var(--faint); }
.guide-body strong { color: var(--text); font-weight: 600; }
.guide-body em { color: var(--text); font-style: normal; }
.guide-body a { color: var(--accent); text-decoration: none; }
.guide-body a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .guide-body { padding: 2px 16px 16px; font-size: 14px; }
  .guide-card .list-count { display: none; }   /* the title alone on phones */
  .guide-card > .section-head .list-count + .add-chevron { margin-left: auto; }
}

/* Settings > Payment methods: type, and the Weekly switch for credit. */
.method-kind { flex: none; color: var(--faint); font-size: 12px; white-space: nowrap; }
.method-weekly { flex: none; width: 62px; display: flex; justify-content: center; }
.weekly-toggle {
  flex: none; padding: 3px 8px; border: 1px solid var(--edge); border-radius: 999px; background: none;
  color: var(--faint); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.weekly-toggle.on { border-color: rgba(var(--accent-rgb), 0.5); color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.method-add .method-add-kind { flex: none; width: 150px; }
/* phones and narrow columns: the name on its own line, its details under it */
@media (max-width: 1100px) {
  .method-row { flex-wrap: wrap; row-gap: 0; padding-top: 6px; padding-bottom: 6px; border-top: 1px solid var(--edge); }
  .method-row:first-child { border-top: 0; }
  .method-row .choice-rename { flex: 1 1 100%; }
  .method-row .method-kind { flex: 1; padding-left: 8px; }
  .method-add { flex-wrap: wrap; }
  .method-add .field[name="name"] { flex: 1 1 100%; }
  .method-add .method-add-kind { flex: 1; width: auto; }
}

/* Switch (Auto-renew): a real checkbox, drawn as a sliding switch with
   "On" / "Off" beside it. Sits in a box the same height as the others. */
.bill-form label.switch,
.switch {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--edge-strong);
  transition: background-color 0.15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background-color 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); box-shadow: none; }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--accent-ink); }
.switch-state::before { content: "Off"; color: var(--muted); font-size: 14px; font-weight: 600; }
.switch input:checked ~ .switch-state::before { content: "On"; color: var(--text); }
.switch:has(input:focus-visible) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }

.errors {
  list-style: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  color: #fecaca;
  font-size: 14px;
}

/* ---------------------------------------------------------------- 6 */
/* Add a bill folds away (<details>): the title bar opens and closes it. */
.add-card { overflow: visible; }

.add-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;            /* no browser triangle */
  user-select: none;
  transition: background-color 0.15s;
}
.add-summary::-webkit-details-marker { display: none; }
.add-summary:hover { background: rgba(255, 255, 255, 0.02); }
.add-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.add-card[open] .add-summary { border-radius: var(--radius) var(--radius) 0 0; }

.add-summary h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* the "+" on the left of a foldable card turns into a "×" when open. Its
   colour: teal for Add, amber for Bills, blue for Subscriptions, violet for
   Supplements (--plus, and --plus-bg behind it). */
.add-plus {
  --plus: var(--accent);
  --plus-bg: var(--accent-soft);
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--plus-bg);
  transition: transform 0.2s;
}
.add-plus.plus-bill         { --plus: #fcd34d; --plus-bg: rgba(252, 211, 77, 0.14); }
.add-plus.plus-subscription { --plus: #93c5fd; --plus-bg: rgba(147, 197, 253, 0.14); }
.add-plus.plus-supplement   { --plus: #c4b5fd; --plus-bg: rgba(196, 181, 253, 0.14); }
.add-plus::before,
.add-plus::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  margin: -1px 0 0 -6px;
  border-radius: 1px;
  background: var(--plus);
}
.add-plus::after { transform: rotate(90deg); }
details[open] > summary .add-plus { transform: rotate(45deg); }

/* the chevron on the right points up when open */
.add-chevron {
  width: 18px;
  height: 18px;
  margin-left: auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s;
}
details[open] > summary .add-chevron { transform: rotate(180deg); }

.add-body { padding: 4px 24px 24px; }

/* The bill form (Add a bill, and the edit panel under a row), in rows:
     Name (2) · Paid through (2) · Payment (2)
     Status · Auto-renew · Monthly fee · Annual fee · Monthly cost · Weekly cost
     buttons (2, on the right)                                           */
.bill-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.bill-form label,
.bill-form .f-renew,
.bill-form .preview { display: flex; flex-direction: column; min-width: 0; }
.bill-form .f-name,
.bill-form .f-via,
.bill-form .f-pay { grid-column: span 2; }
.bill-form .f-card-bill { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.f-card-bill .label { margin-bottom: 0; }
.card-bill-flag { display: inline-flex; flex: none; color: var(--accent); }
.card-bill-flag svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.available-tile small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.available-pop .available-breakdown { display: flex; flex-direction: column; gap: 10px; }
.available-pop small, .available-pop p { font-size: 12px; line-height: 1.6; color: var(--muted); }
.available-pop p { margin: 0; }
.fsa-setting .fsa-covered { display: none; flex: 0 1 180px; }
.fsa-setting:has(input[name="fsa_funded"]:checked) .fsa-covered { display: flex; }
.fsa-setting .seg-hint { flex: 1 1 260px; }
.fsa-covered .label { margin-bottom: 6px; }
.f-buttons { grid-column: 5 / 7; display: flex; gap: 10px; }
.bill-form .f-notes { grid-column: 1 / 5; }
/* third row of the bill form: Ends · Notes (3) · buttons (2) */
.bill-form .f-ends + .f-notes { grid-column: 2 / 5; }
/* supplement form, third row: Status · Payment · Notes (2) · buttons (2) */
.supp-form .f-pay { grid-column: span 1; }
.bill-form input[type="month"] { color-scheme: dark; }
.f-buttons .btn { flex: 1; }

.label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.preview-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------- 6b. Login, log out */
.logout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 0 auto;
}

.who { color: var(--muted); font-size: 13px; font-weight: 600; }
/* the gear at the top right (Settings); highlighted while you're there */
.settings-link[aria-current="page"] { color: var(--text); background: var(--surface-3); }

/* ------------------------------------------------- 6c. Settings page */
/* Four name lists (Paid through, Payment, Doctor, Pharmacy) and Account,
   two cards a row on a computer, one on a phone. */
.settings-grid,
.covers-card,
.flash:first-of-type { margin-top: 26px; }
.flash + .settings-grid,
.flash + .covers-card { margin-top: 0; }
/* Page covers sits on top, full width (since 2026-11-26): the usual 20px
   under it, the same as between the cards below; the columns end with
   20px too, as the cover card did when it was last. (A page cover's own
   gap, .page-cover + .page-head + *, still sets the space above.) */
.covers-card + .settings-grid { margin-top: 0; }
.settings-grid { margin-bottom: 20px; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.settings-grid .card { margin-bottom: 0; }
/* each column is its own stack, 20px between cards, so cards never leave
   holes beside each other and folding one only moves the ones below it */
.settings-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.list-count { color: var(--muted); font-size: 13px; font-weight: 500; }
.list-hint-body { margin: 0; padding: 12px 20px 4px; }
.list-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--edge); }
.list-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.list-hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.list-hint strong { color: var(--text); font-weight: 600; }
.choice-list { list-style: none; margin: 0; padding: 6px 0; }
.choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 14px;
}
.choice-rename { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; margin: 0; }
/* the name looks like plain text until you point at it or click into it */
.choice-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  font-size: 14px;
}
.choice-input:hover { border-color: var(--edge); }
.choice-input:focus { border-color: var(--accent); background: var(--surface-2); }
/* the tick (save) shows only while the name is being changed */
/* (opacity, not hidden, so a click on it still counts as focus moves away) */
.choice-save { opacity: 0; color: var(--accent); transition: opacity 0.15s; }
.choice-rename:focus-within .choice-save,
.choice-save:focus-visible { opacity: 1; }
.choice-uses { flex: none; min-width: 64px; color: var(--muted); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.choice-uses.unused { color: var(--faint); }
.choice-empty { padding: 10px 22px; color: var(--faint); font-size: 14px; }
.choice-add { display: flex; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--edge); margin: 0; }
.choice-add .field { flex: 1; min-width: 0; height: 36px; font-size: 14px; }
.choice-add .btn { flex: none; height: 36px; }
.account-actions { padding: 16px 20px 20px; margin: 0; }


/* the message after adding, renaming or deleting */
.flash {
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.flash-ok { color: #a6d4cc; background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.25); }
.flash-error { color: #fecaca; background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.25); }

@media (max-width: 760px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------- 6d. Tracking page */
/* The weeks table: Friday, Income, Weekly Cost, Debt Budget (teal), Spent,
   Paid off, Saved, Info and the buttons. Fixed column widths (the <colgroup> in
   tracking.html) spread them evenly across the card; month names are
   divider rows. On narrow screens it scrolls sideways inside its card. */
.track-card { margin-top: 26px; overflow: hidden; }
/* Safe to Spend (purchases since 2026-11-22): what's left (big) and the
   Week box on top; under them the spent bar, "+ Purchase" or its form, and
   the week's purchases (folds). On phones everything stacks. */
.safe-spend-card { margin-top: 26px; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: 18px; }
.safe-spend-card > :not(.safe-spend-main):not(.safe-spend-week) { grid-column: 1 / -1; }
.safe-spend-card + .track-card { margin-top: 0; }
.safe-spend-card h2 { margin: 0 0 8px; font-size: 16px; }
.safe-spend-value { display: block; color: var(--accent); font-size: 32px; font-variant-numeric: tabular-nums; }
.safe-spend-value.short { color: var(--danger); }
.safe-spend-of { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.safe-spend-carry { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.safe-spend-carry[hidden] { display: none; }
.spend-breakdown { display: none; }  /* phones only (section 7) */
.safe-spend-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.safe-spend-week { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; max-width: 100%; }
.spend-bar { height: 6px; margin-top: 14px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.spend-bar[hidden] { display: none; }
.spend-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.spend-bar.over span { background: var(--danger); }
.spend-actions { margin-top: 14px; }
.spend-actions[hidden], .purchase-form[hidden] { display: none; }
.spend-add { height: 42px; gap: 6px; padding: 0 18px; }
.spend-add svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.purchase-form {
  margin-top: 14px; padding: 14px; border: 1px solid var(--edge-strong); border-radius: var(--radius-sm);
  display: grid; grid-template-columns: 140px minmax(0, 1fr) 170px auto; gap: 10px 12px; align-items: end;
}
.purchase-form h3 { grid-column: 1 / -1; margin: 0; font-size: 14px; }
.purchase-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; }
.purchase-form .field { min-width: 0; }
.purchase-form .pf-amount .field { text-align: right; font-variant-numeric: tabular-nums; }
.pf-buttons { display: flex; gap: 8px; }
.pf-buttons .btn { height: 42px; }
.purchase-error { grid-column: 1 / -1; margin: 0 !important; color: var(--danger) !important; font-size: 13px !important; }
.spend-list { margin-top: 14px; border-top: 1px solid var(--edge); }
.spend-list[hidden] { display: none; }
.spend-list summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; font-size: 14px; }
.spend-list summary::-webkit-details-marker { display: none; }
.spend-list summary small { color: var(--muted); font-size: 12px; }
.spend-list summary b { margin-left: auto; font-variant-numeric: tabular-nums; }
.spend-chevron { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s ease; }
.spend-list[open] .spend-chevron { transform: rotate(180deg); }
.spend-list ul { list-style: none; margin: 0; padding: 0; }
.spend-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 46px; border-top: 1px solid var(--edge); font-size: 14px; }
.spend-date { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.spend-what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-what.blank { color: var(--faint); }
.spend-amount { font-variant-numeric: tabular-nums; text-align: right; }
.spend-row .row-buttons { display: inline-flex; gap: 2px; }
.spend-empty { padding: 12px 0 4px; border-top: 1px solid var(--edge); color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  /* Phones: no explanation texts (personal site). Right of the title and
     the big number, a small table (Budget, Spent, Last week): its top row
     lines up with the title; with all three rows, the last lines up with
     the bottom of the number. Without Last week, the two rows stay together. */
  .desktop-only { display: none; }
  .safe-spend-card { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
  .safe-spend-main { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; }
  .safe-spend-main h2, .safe-spend-value { grid-column: 1; }
  .safe-spend-value { line-height: 1.2; }
  .safe-spend-info { grid-column: 2; grid-row: 1 / 3; display: flex; justify-content: flex-end; }
  .safe-spend-of, .safe-spend-carry, .safe-spend-carry[hidden] { display: none; }
  .spend-breakdown:not([hidden]) {
    display: flex; flex-direction: column; justify-content: space-between;
    margin: 0; padding: 1px 0 2px; font-size: 13px; line-height: 20px;
  }
  /* as wide as its longest row: labels and amounts sit close together */
  .spend-breakdown > div { display: flex; justify-content: space-between; gap: 12px; }
  .spend-breakdown > div[hidden] { display: none; }
  .spend-breakdown:has(> div[hidden]) { justify-content: flex-start; gap: 4px; }
  .spend-breakdown dt { color: var(--muted); }
  .spend-breakdown dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
  .safe-spend-week .field { width: 100%; }
  .spend-add { width: 100%; height: 48px; font-size: 15px; }
  .purchase-form { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); }
  .purchase-form .pf-date .field { padding: 0 8px; }
  .purchase-form .pf-what { grid-column: 1 / -1; order: 3; }
  .purchase-form .pf-buttons { grid-column: 1 / -1; order: 4; }
  .purchase-form .purchase-error { order: 5; }
  .pf-buttons .btn { flex: 1; height: 46px; }
  /* 16px stops iPhones from zooming in on the box */
  .purchase-form .field { font-size: 16px; height: 46px; }
  .spend-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "what amount buttons" "date amount buttons"; row-gap: 0; padding: 6px 0; }
  .spend-row .spend-what { grid-area: what; }
  .spend-row .spend-date { grid-area: date; }
  .spend-row .spend-amount { grid-area: amount; }
  .spend-row .row-buttons { grid-area: buttons; }
}
/* the smallest phones: a narrower table so it keeps clear of the title */
@media (max-width: 360px) {
  .safe-spend-main { column-gap: 12px; }
  .spend-breakdown:not([hidden]) { font-size: 12px; }
  .spend-breakdown > div { gap: 10px; }
}
.safe-spend-inline { display: flex; justify-content: space-between; gap: 8px; }
.safe-spend-inline b { color: var(--accent); font-variant-numeric: tabular-nums; }
.safe-spend-inline b.short { color: var(--danger); }
.flash + .track-card { margin-top: 0; }
.track {
  width: 100%;
  min-width: 1000px;   /* (900 until 2026-11-25: "Weekly Cost" didn't fit its column) */
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
/* phones scroll it sideways anyway, so its columns get more room there */
@media (max-width: 640px) { .track { min-width: 1120px; } }
.track col.c-day { width: 13%; }
.track col.c-money { width: 10%; }   /* seven: Income to Saved (2026-11-25) */
.track col.c-info { width: 6%; }
.track col.c-actions { width: 11%; }
.track .t-info { padding-left: 4px; padding-right: 4px; text-align: center; }
.track th,
.track td {
  height: var(--row-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--edge);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.track th:first-child,
.track td:first-child { padding-left: 20px; }
.track th:last-child,
.track td:last-child { padding-right: 16px; }
.track thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.track .num { text-align: right; }
/* Spending and Debt (since 2026-11-25): small headings over their columns,
   a thin line before each group, and the amounts centred in their columns
   so the gaps between them are even whatever the label's length. */
.track thead .group-row .t-group {
  height: 30px; padding: 0 8px; text-align: center; color: var(--text);
  border-left: 1px solid var(--edge-strong); border-bottom: 1px solid var(--edge);
}
.track thead .sub-row th { height: 34px; padding: 0 8px; }
.track thead .group-row th[rowspan] { vertical-align: bottom; padding-bottom: 11px; }
.track .g-start { border-left: 1px solid var(--edge-strong); }
/* and one after Debt, before Info, so both groups are framed alike */
.track .t-info { border-left: 1px solid var(--edge-strong); }
.track .t-income, .track .t-cost, .track .t-budget, .track .t-spent,
.track .t-available, .track .t-paid, .track .t-saved { text-align: center; padding-left: 8px; padding-right: 8px; }
.track td.t-income .cell-input { margin: 0 auto; text-align: center; }
.track .t-budget.short, .track .t-spent.short { color: var(--danger); }
.track .zero { color: var(--faint); }
.track .none { color: var(--faint); }
.track .t-year { color: var(--faint); font-weight: 500; }
/* the month's name: a slim divider row above its weeks ("Next paycheck"
   above the row that adds one) */
.track tr.month-row th {
  height: 30px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: 1px solid var(--edge-strong);
}
.track tr.month-row .t-year { letter-spacing: 0; }
.track tr.next-label th { color: var(--muted); }
.track tbody tr.month-row:hover th { background: rgba(255, 255, 255, 0.025); }
.track .t-day { color: var(--muted); }
.track .t-day .cell-input { width: 100%; max-width: 150px; }
/* the amount boxes sit at the right of their column, as wide as a number */
.track .num .cell-input { display: block; width: 100%; max-width: 130px; margin-left: auto; }
.track .t-available { color: var(--accent); font-weight: 700; }
.track .t-available.short { color: var(--danger); }
.track .t-actions { text-align: right; }
.track .t-actions .row-buttons { justify-content: flex-end; }
.track tbody tr:not(.empty):hover td { background: rgba(255, 255, 255, 0.02); }
.track tr.empty td { padding: 36px 16px; color: var(--muted); text-align: center; white-space: normal; }
.track tfoot tr { background: var(--surface-2); }
.track .plan { color: var(--muted); }
.track .t-cost { font-weight: 600; }
.track [data-week-paid] { color: var(--accent); }
.track .t-income .cell-input[readonly] { pointer-events: none; }
.track tr.week-edit-open .t-income .cell-input:not([aria-invalid="true"]) { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.16); }
.track .t-actions:has(.armed) [data-week-edit] { display: none; }
/* The row owns its inputs, while Save and Cancel stay in the open panel. */
.track .row-save { display: none; }
/* "Delete?" (after the first click on the bin) is wider than the bin: the
   Update button steps aside meanwhile, so it fits the column without a
   scrollbar */
.track .t-actions { padding-left: 6px; }
.track .t-actions:has(.armed) .row-tools:not(:has(.armed)) { display: none; }
.track tr.dirty td { background: rgba(var(--accent-rgb), 0.05); }
.track tr[hidden] { display: none; }
/* the "Add week" button, alone on its row until clicked */
.track .add-open td { height: 52px; padding-left: 16px; }
.add-week-btn { display: inline-flex; align-items: center; gap: 6px; }
.add-week-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.track tfoot .t-available.plan { color: var(--accent); }

/* The card payments editor sits inside the week being added or edited. */
.track .week-panel td { height: auto; padding: 0 20px 18px; white-space: normal; background: rgba(var(--accent-rgb), 0.035); }
/* The motion wrapper includes this gap when the existing week's editor slides. */
.track .week-panel:not(.week-panel-new) td { padding-top: 18px; }
.track .week-panel:hover td { background: rgba(var(--accent-rgb), 0.035); }
.week-panel-body { border: 1px solid var(--edge); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.week-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.week-panel-head h3 { margin: 0; font-size: 16px; }
.week-panel-body > .list-hint { padding: 4px 18px 0; margin: 0; }
.week-panel-body a { color: var(--accent); }
.payment-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--edge); }
.payment-flow > div { display: flex; flex-direction: column; gap: 5px; padding: 13px 15px; border: 1px solid var(--edge); border-radius: var(--radius-sm); background: var(--surface-2); }
.payment-flow span { color: var(--muted); font-size: 12px; }
.payment-flow strong { color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
.payment-flow .payment-saved { border-color: rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.07); }
.payment-flow .payment-saved strong { color: var(--accent); }
.payment-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; padding: 16px 18px; }
.payment-entry { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--text); font-size: 13px; }
.payment-entry span { overflow-wrap: anywhere; }
.payment-entry small { color: var(--muted); font-size: 11px; }
.payment-entry .field { width: 100%; text-align: right; }
.payment-empty { margin: 0; color: var(--muted); font-size: 13px; }
.week-panel-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--edge); }
@media (max-width: 860px) {
  .payment-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .payment-flow { grid-template-columns: 1fr; }
  .payment-fields { grid-template-columns: 1fr; }
}

/* a value you can change in place: looks like text until pointed at */
.cell-form { margin: 0; }
.cell-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}
.cell-input.num-input { text-align: right; }
.cell-input:hover { border-color: var(--edge); }
.cell-input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.track tfoot .cell-input { border-color: var(--edge); background: var(--bg); }
/* Weekly Checks uses the shared collapsible section header. */
.track-hint { margin: 0; padding: 12px 20px 14px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--edge); }

/* ------------------------------------------------- 6e. Tools page */
/* Each tool is a folding card (called the Rent page until 2026-11-21).
   Rent: Rent, Xfinity, PG&E, then three tiles (Total, Roommate's half in
   teal, Check to landlord), then the Check and Envelope blocks. */
.tool-card { margin-top: 26px; }
.tool-card .list-count { font-weight: 500; }
.tool-block {
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tool-block h3 { margin: 0; padding: 14px 20px 0; font-size: 15px; font-weight: 700; }
.rent-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  padding: 20px 20px 4px;
}
.rent-form label { display: flex; flex-direction: column; min-width: 0; }
.rent-split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
}
.split-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.split-tile.accent { border-color: rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.07); }
.split-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.split-tile.accent .split-value { color: var(--accent); }

/* under it: what to write on the check and the envelope */
.rent-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 20px;
  align-items: start;
}
.rent-notes .card { margin-bottom: 0; }
.write-down { margin: 0; padding: 14px 20px 18px; }
.write-down > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--edge); }
.write-down > div:last-child { border-bottom: 0; }
.write-down dt { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.write-down dd { margin: 0; color: var(--text); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.envelope { display: flex; flex-direction: column; gap: 4px; font-style: normal; color: var(--text); font-size: 17px; font-weight: 600; line-height: 1.45; }

@media (max-width: 640px) {
  .rent-form, .rent-split, .rent-notes { grid-template-columns: minmax(0, 1fr); }
}
/* House Payments and Buffers side by side; each keeps its own height
   (Notes, the third card, was removed on 2026-11-24). */
.track-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.track-side .card { margin-bottom: 0; }
/* the Buffers title bar: nothing between the title and the arrow */
.buffers-card > .section-head .add-chevron { margin-left: auto; }
.buffer-list { list-style: none; margin: 0; padding: 8px 0; }
.buffer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 6px;
  padding: 6px 12px 6px 14px;
}
.buffer-form { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.buffer-name { flex: 1; font-weight: 600; }
.buffer-field { display: flex; align-items: center; gap: 2px; flex: none; }
.buffer-field span { color: var(--faint); font-size: 12px; }
/* the amount starts right after its label (Now 1600, Target 1000) */
.buffer-field .cell-input { width: 84px; padding: 0 6px; text-align: left; }
.buffer-form:focus-within .choice-save { opacity: 1; }
.buffer-goal { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 2px 8px 4px; }
.goal-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.goal-text { flex: none; color: var(--muted); font-size: 12.5px; }
.buffer-add .buffer-amount { flex: 0 0 110px; text-align: right; }

@media (max-width: 860px) {
  .track-side { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: each buffer is the name (with the ✓ that shows while editing
   beside it, not on a blank line of its own), then Now / Target and the
   trash, then the progress bar; a thin line between buffers. */
@media (max-width: 640px) {
  .buffer-list { padding: 4px 0; }
  .buffer-row { row-gap: 2px; padding: 10px 12px 10px 14px; }
  .buffer-row + .buffer-row { border-top: 1px solid var(--edge); }
  .buffer-form { flex-wrap: wrap; row-gap: 0; }
  .buffer-name { flex: 1 1 calc(100% - 50px); }
  .buffer-form .choice-save { order: 1; }
  .buffer-field { order: 2; }
  .buffer-row > form.inline { align-self: end; }
  .buffer-goal { padding: 4px 8px 0; }
}

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 190px);
}

.auth-card {
  width: min(400px, 100%);
  padding: 34px 30px 30px;
  background: rgba(13, 13, 15, 0.75);   /* frosted like the cards (section 4) */
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--edge);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

/* The top of the login card (since 2026-11-26): the logo on the left and
   "Benseddiq" in Great Vibes beside it, centred on the logo (measured: the
   letters' middle is within 1.5px of the logo's). --auth-name-shift moves
   the name up (−) or down (+) if it ever needs a nudge. */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 26px;
  --auth-name-shift: 6px;   /* (0 until 2026-11-26, then 3px: 6px lower looked better) */
}
.auth-brand .brand-mark { width: 58px; height: 58px; border-radius: 14px; flex: none; }
.auth-name {
  margin: 0;
  font-family: "Great Vibes", cursive;
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  color: var(--text);
  transform: translateY(var(--auth-name-shift));
}
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; }
.auth-form .btn { width: 100%; margin-top: 6px; }

/* ---------------------------------------------------------------- 7 */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }  /* six cards: three rows of two */
  .bill-form { grid-template-columns: 1fr 1fr; }
  .f-buttons { grid-column: 1 / -1; }
  .bill-form .f-notes,
  .bill-form .f-ends + .f-notes { grid-column: 1 / -1; }
}

/* Phones: each bill becomes a small card: name and buttons on top, the
   three amounts in a row underneath, each with its own label. */
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .page { padding-top: 28px; }
  .topbar-inner { gap: 18px; }
  .who { display: none; }
  .auth { min-height: 0; padding-top: 12px; }
  .auth-card { padding: 28px 20px 22px; }
  .stats { gap: 10px; margin-top: 22px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
  .field { font-size: 16px; } /* 16px stops iPhones zooming into the box */
  .add-summary { padding: 14px 16px; }
  .add-body { padding: 4px 16px 18px; }
  .bill-form .f-name,
  .bill-form .f-via,
  .bill-form .f-pay,
  .bill-form .f-rx,
  .bill-form .f-ph,
  .supp-form .f-snotes { grid-column: 1 / -1; }
  .edit-panel { padding: 16px; }

  .bills thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  }

  .bills tbody tr,
  .bills tfoot tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--edge);
  }

  .bills tfoot tr { background: var(--surface-2); border-bottom: 0; }

  .bills th,
  .bills td,
  .bills tfoot th,
  .bills tfoot td,
  .bills tr.editing td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    background: none;
  }

  .bills th:first-child,
  .bills td:first-child { padding-left: 0; }

  .bills .name,
  .bills tfoot th { grid-column: 1 / 4; grid-row: 1; align-self: center; font-size: 16px; }

  .bills .actions { grid-column: 4; grid-row: 1; width: auto; padding: 0; }

  /* the notes icon sits on the top line, just left of edit and delete */
  .bills tbody .name { grid-column: 1 / 3; min-width: 0; } /* (230px is for computers) */
  /* the "via" tag goes on its own line under the name, so the name keeps
     the whole width */
  .bills .name-line { flex-wrap: wrap; row-gap: 5px; }
  .bills .name-line .name-text { flex: 1 1 0; min-width: 0; }
  .bills .name-line .tag { flex-basis: auto; max-width: 100%; margin-left: 0; order: 3; }
  /* a section's "… ends by …" goes on its own line under the title */
  .section-head { flex-wrap: wrap; row-gap: 6px; }
  .section-ending { order: 5; flex-basis: 100%; margin-left: 38px; }
  .section-ending + .section-sum { margin-left: auto; }
  /* (only while the card is open, since 2026-11-25: folded, just the title) */
  details:not([open]) > .section-head .section-ending { display: none; }
  /* Icons level with the name (since 2026-11-25): the name and the icons
     start at the top of the row (a one-line name used to drop 2.5px), and
     the 34px icons rise 5px to centre on its first 24px line. */
  /* (not the Cards page's tables, which place their icons themselves) */
  .bills:not(.cards-table) tbody tr:not(.editing) td.name,
  .bills:not(.cards-table) tbody tr:not(.editing) td.info,
  .bills:not(.cards-table) tbody tr:not(.editing) td.actions { align-self: start; }
  .bills:not(.cards-table) tbody tr:not(.editing) td.info,
  .bills:not(.cards-table) tbody tr:not(.editing) td.actions { margin-top: -5px; }
  /* the explanation under the Add form, smaller */
  #add .hint { font-size: 11.5px; line-height: 1.5; }
  /* the card icon right after the name (the name used to fill the line,
     leaving a 33px gap before it), since 2026-11-25 */
  .bills .name-line .name-text { flex: 0 1 auto; }
  /* Ends: smaller text, so the month and the calendar icon both fit */
  .bill-form input[type="month"] { padding-left: 10px; font-size: 14px; }
  .bills .name-line .card-bill-flag { margin-left: -2px; }   /* 10px from the name */
  /* drawn at 19px, its top and bottom line up with the icons on the right */
  .bills .name-line .card-bill-flag svg { width: 19px; height: 19px; }
  .bills .name-line::after { content: ""; order: 2; flex-basis: 100%; height: 0; }

  /* "What if I cancel" on a phone: bottom-right of the card, with words */
  .bills .cut-cell { grid-row: 4; grid-column: 3 / 5; width: auto; padding: 0; text-align: right; }
  .bills tbody .cut-cell:empty { display: none; }
  .bills .status-cell,
  .bills .renew { padding: 0; } /* (the 8px is for computers) */

  /* Supplements on a phone: Pharmacy and Prescription on the third line,
     each with a small label; the empty Total cells are left out. */
  .supps .where { grid-row: 3; width: auto; white-space: normal; overflow-wrap: anywhere; }
  .supps td.where:nth-child(2) { grid-column: 1 / 3; }
  .supps td.where:nth-child(3) { grid-column: 3 / 5; text-align: right; }
  .supps td.where::before { content: attr(data-short) " · "; color: var(--faint); }
  .supps tfoot .where,
  .supps tfoot .duration { display: none; }

  /* Bills (no fee columns): Cost / mo and Cost / wk share the line */
  .no-fees .true-cost { grid-column: 1 / 3; }
  .no-fees .weekly { grid-column: 3 / 5; }
  .bills.no-fees .payment { grid-column: 1 / -1; }  /* no "what if" box beside it */
  .bills.supps .cut::before { content: "What if I stop"; }
  .bills .cut { align-items: center; gap: 8px; }
  .bills .cut::before { content: "What if I cancel"; order: -1; color: var(--faint); font-size: 12px; }
  .bills .info { grid-column: 3; grid-row: 1; width: auto; padding: 0; text-align: right; align-self: start; }

  /* Four amounts in a row: Monthly, Annual, True / mo, Weekly. */
  .bills .num { grid-row: 2; width: auto; text-align: left; white-space: nowrap; font-size: 14px; }
  .bills .weekly { text-align: right; }

  .bills .num::before {
    content: attr(data-short);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  /* the tiny labels on a service card: medium, not bold */
  .bills tbody tr:not(.editing) .num::before { font-weight: 500; }

  .bills tfoot .foot-note { grid-row: 3; grid-column: 1 / -1; text-align: left; white-space: normal; }
  .bills tfoot .foot-note:empty { display: none; }

  /* Third line of each card: status on the left, auto-renew on the right. */
  .bills .status-cell { grid-row: 3; grid-column: 1 / 3; width: auto; }
  .bills .renew { grid-row: 3; grid-column: 3 / 5; width: auto; text-align: right; align-self: center; }
  /* Fourth line: "Payment · Chase Credit" (left out when not set). */
  .bills .payment { grid-row: 4; grid-column: 1 / 3; width: auto; white-space: normal; }
  .bills tbody .payment:has(.none) { display: none; }
  .pay-word { display: inline; color: var(--faint); }

  .renew-icon { display: none; }
  .renew-text { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .renew-flag.on .renew-text { color: var(--text); }
  .renew-word { margin-right: 5px; color: var(--muted); font-weight: 500; }

  .bills tr.open { background: rgba(var(--accent-rgb), 0.05); }
  .bills tr.editing { display: block; padding: 0; background: rgba(var(--accent-rgb), 0.035); }

  .bills tr.empty,
  .bills tr.error-row { display: block; }
  .bills tr.empty td { padding: 44px 16px; }
  .bills tr.error-row { padding: 14px 16px 0; background: rgba(var(--accent-rgb), 0.035); }
}

/* Review is independent of the amount: a checked bank can have a zero payment. */
.payment-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--payment-rows), auto); grid-auto-flow: column; }
.payment-entry { flex-direction: row; align-items: center; padding: 8px; border: 1px solid var(--edge); border-radius: var(--radius-sm); }
.payment-entry .field { width: 130px; flex-shrink: 0; }
.payment-check { flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; color: var(--text); font: inherit; cursor: pointer; padding: 4px; }
.payment-check small { display: block; }
.review-mark { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border: 1px solid var(--edge); border-radius: 50%; color: transparent; }
.payment-check[aria-pressed="true"] .review-mark { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.payment-check:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.track .t-saved { color: var(--accent); font-weight: 700; }
.track .t-saved.short, .payment-flow strong.short { color: var(--danger); }
@media (max-width: 800px) { .payment-fields { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; } }

/* A new week is entered as a complete form, with Income in the summary. */
.new-week-head { padding-bottom: 8px; }
.week-date { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.week-date .field { width: auto; color-scheme: dark; }
.new-week-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.new-week-summary > div { min-height: 100px; justify-content: center; }
.new-week-summary label { color: var(--muted); font-size: 12px; }
.new-week-summary strong { font-size: 26px; }
.income-tile:focus-within { border-color: var(--accent); }
.income-tile input { width: 100%; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.income-tile input::placeholder { color: var(--faint); }
.track .week-panel-new td { padding-top: 18px; }
@media (max-width: 640px) {
  .new-week-head { align-items: flex-start; flex-direction: column; }
  .new-week-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Invalid week amounts stay visible until corrected. */
.track input[aria-invalid="true"] { border: 1px solid var(--danger); box-shadow: 0 0 0 2px rgba(239, 68, 68, .16); color: var(--danger); }
.week-panel-new .income-tile:has([aria-invalid="true"]) { border-color: var(--danger); }
.week-field-error { color: var(--danger); padding: 12px 18px 0; margin: 0; font-size: 13px; }

.weekly-cost-label, .available-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.weekly-cost-label .icon-btn, .available-label .available-info-icon { width: 28px; height: 28px; color: var(--accent); }
.weekly-cost-tile [data-refresh-error] { color: var(--danger); font-size: 12px; }
.edit-week-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .edit-week-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Independent house payments: half-width beside Buffers. */
.house-table-wrap { overflow-x: auto; }
.house-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.house-table th, .house-table td { height: var(--row-h); padding: 0 8px; border-bottom: 1px solid var(--edge); text-align: left; vertical-align: middle; }
.house-table th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.house-table th:first-child, .house-table td:first-child { padding-left: 18px; }
.house-table .house-number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.house-year { color: var(--muted); font-weight: 600; }
.house-table .house-actions { white-space: nowrap; width: 80px; padding-right: 12px; }
.house-actions .icon-btn { width: 32px; height: 32px; }
.house-table .house-info { width: 36px; padding-left: 4px; padding-right: 4px; text-align: center; }
.house-empty { padding: 18px; color: var(--muted); font-size: 13px; }
.house-editor { border-top: 1px solid var(--edge); }
.house-editor > summary { padding: 15px 18px; cursor: pointer; color: var(--accent); font-size: 13px; }
.house-form { padding: 0 18px 18px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.house-form label { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.house-form .field { width: 100%; }
.house-form .house-wide { grid-column: 1 / -1; }
.house-form .house-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.house-form [aria-invalid="true"] { border-color: var(--danger); color: var(--danger); }
.house-error { color: var(--danger); font-size: 12px; margin: 0; }

/* House Payments positions chosen in the temporary layout editor.
   Anchors are percentages of the row width, including the cell contents. */
.house-table { display: block; width: 100%; min-width: 520px; }
.house-table thead, .house-table tbody { display: block; width: 100%; }
.house-table tr { display: block; position: relative; height: var(--row-h); border-bottom: 1px solid var(--edge); }
.house-table thead tr { background: var(--surface-2); }
.house-table th, .house-table td { display: flex; align-items: center; position: absolute; top: 0; height: 100%; width: max-content; padding: 0; border: 0; white-space: nowrap; }
.house-table th:first-child, .house-table td:first-child { padding: 0; }
.house-table th:nth-child(1), .house-table td:nth-child(1) { left: 4.8%; }
.house-table th:nth-child(2), .house-table td:nth-child(2) { left: 14.9%; }
.house-table th:nth-child(3), .house-table td:nth-child(3) { left: 45%; transform: translateX(-100%); }
.house-table th:nth-child(4), .house-table td:nth-child(4) { left: 65.7%; transform: translateX(-100%); }
.house-table .house-info { left: 77%; width: max-content; padding: 0; transform: translateX(-50%); }
.house-table th:last-child, .house-table .house-actions { left: 95.7%; width: max-content; padding: 0; transform: translateX(-100%); }
.house-table .house-actions { gap: 4px; }
.house-table .house-actions:has(.armed) > a { display: none; }
.house-count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tracking-request-error { margin: 12px 18px; color: var(--danger); font-size: 13px; }
/* Alternate month groups; undated continuation rows inherit their month. */
.house-table tbody .house-band-0 { background: var(--surface); }
.house-table tbody .house-band-1 { background: var(--surface-2); }

/* Weeks: the arrow on the right ("Paid off so far" was removed 2026-11-25) */
.track-card > .section-head .add-chevron { margin-left: auto; }
/* House Payments the same way: title, "13 payments" and the arrow on one
   line, the arrow last (it used to drop under the icon at 360px). The
   smallest phones show the number alone. */
@media (max-width: 640px) {
  .house-card > .section-head { flex-wrap: nowrap; gap: 10px; }
  .house-card > .section-head h2 { white-space: nowrap; }
}
@media (max-width: 340px) {
  .house-count-word { display: none; }
}

/* ------------------------------------------------- 6f. Cards page */
/* (since 2026-11-21) Credit cards sorted by APR, debit cards, Add a card.
   The tables reuse the bills table's look (rows, header, Total, edit panel,
   phone cards); only the columns differ. */
.add-plus.plus-credit { --plus: #fca5a5; --plus-bg: rgba(248, 113, 113, 0.14); }
.add-plus.plus-debit  { --plus: #93c5fd; --plus-bg: rgba(147, 197, 253, 0.14); }

/* Columns: 6px on each side of every cell. Lock, Info and the buttons in
   both tables keep these widths; the Credit cards widths are set below. */
.cards-table th,
.cards-table td { padding-left: 6px; padding-right: 6px; }
.cards-table .num { width: auto; }
.cards-table .c-lock { width: 48px; text-align: center; white-space: nowrap; }
.cards-table .info { width: 44px; }
.cards-table .actions { width: 80px; padding-right: 14px; }
/* "Delete?" (after the first click on the bin) is wider than the bin: the
   pen steps aside meanwhile, so the row fits without a scrollbar (as on
   Paychecks and House Payments) */
.cards-table .actions:has(.armed) .row-buttons > a { display: none; }

/* Credit cards column widths, chosen with the column tuner on 2026-11-22
   (they add up to 1190px, the card's width on a computer). The tags
   ([12% to Jan 30], [Line]) sit 16px from the right edge of Name. To add a
   column, add a width here and take it from the others. */
@media (min-width: 641px) {
  .cards-table:not(.debit-table) thead th:nth-child(1)  { width: 382px; }  /* Name */
  .cards-table:not(.debit-table) thead th:nth-child(2)  { width: 90px; }   /* Balance */
  .cards-table:not(.debit-table) thead th:nth-child(3)  { width: 84px; }   /* Limit */
  .cards-table:not(.debit-table) thead th:nth-child(4)  { width: 74px; }   /* Used */
  .cards-table:not(.debit-table) thead th:nth-child(5)  { width: 74px; }   /* APR */
  .cards-table:not(.debit-table) thead th:nth-child(6)  { width: 79px; }   /* Monthly Interest */
  .cards-table:not(.debit-table) thead th:nth-child(7)  { width: 67px; }   /* Due */
  .cards-table:not(.debit-table) thead th:nth-child(8)  { width: 65px; }   /* Auto Pay */
  .cards-table:not(.debit-table) thead th:nth-child(9)  { width: 85px; }   /* Updated */
  .cards-table:not(.debit-table) thead th:nth-child(10) { width: 50px; }   /* Lock */
  .cards-table:not(.debit-table) thead th:nth-child(11) { width: 47px; }   /* Info */
  .cards-table:not(.debit-table) thead th:nth-child(12) { width: 93px; }   /* buttons */
  .cards-table:not(.debit-table) tbody td.name { padding-right: 16px; }
}

/* the highest APR you owe on (the card to pay off first), light red */
.apr-top { color: #fca5a5; }
/* Auto pay: a check mark, green when on, red when off */
.autopay { display: inline-grid; place-items: center; vertical-align: middle; }
.autopay svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.autopay.on { color: #86efac; }
.autopay.off { color: #fca5a5; }
/* the name never wraps; if a window is too narrow, the tags shrink first
   (ending in "…"), then the name (full name on mouse-over) */
@media (min-width: 641px) {
  /* every column but Name centred, titles and figures alike (2026-11-22) */
  .cards-table th:not(:first-child),
  .cards-table td:not(:first-child) { text-align: center; }
  .cards-table .name-line { flex-wrap: nowrap; }
  .cards-table .name-line .name-text { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cards-table .name-line .tag { flex: 0 10 auto; min-width: 0; max-width: none; }
}
.cards-table .none,
.stat .none { color: var(--faint); }
@media (min-width: 641px) {
  .bills.debit-table { min-width: 0; }   /* four columns: no need to scroll */
}
/* the last 4 digits: right after the name (pulled 6px into the 12px gap);
   on a phone they go to the second line, with the tags (section 7 below) */
.last4 { flex: none; margin-left: -6px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.04em; white-space: nowrap; }
.cards-table tr.left-out .last4 { opacity: 0.45; }

/* the top card you owe on: a teal edge on its left */
.tag-line { border-color: rgba(196, 181, 253, 0.26); background: rgba(196, 181, 253, 0.09); color: #c4b5fd; }
.tag-promo { border-color: rgba(147, 197, 253, 0.26); background: rgba(147, 197, 253, 0.09); color: #93c5fd; }
.tag-promo-soon { border-color: rgba(252, 211, 77, 0.28); background: rgba(252, 211, 77, 0.10); color: #fcd34d; }

/* Used: teal up to 30%, amber to 50%, red above */
.used-ok { color: var(--accent); }
.used-mid { color: #fcd34d; }
.used-high { color: #fca5a5; }
.cards-table .interest { color: #fca5a5; }
.due-soon { color: #fcd34d; }
.stale { color: #fcd34d; }
/* (td only: the Updated header keeps the same size as the others) */
.cards-table td.c-upd { font-size: 13px; color: var(--muted); }
.cards-table .c-upd .stale { color: #fcd34d; }

/* Lock: just an icon (since 2026-11-22). Unlocked: a blue open padlock;
   Locked: a yellow closed one. A click switches it. */
.lock-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #93c5fd;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.15s, color 0.15s;
}
.lock-btn:hover { background: rgba(147, 197, 253, 0.12); color: #bfdbfe; }
.lock-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lock-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lock-btn.is-locked { color: #fcd34d; }
.lock-btn.is-locked:hover { background: rgba(252, 211, 77, 0.12); color: #fde68a; }

/* Cards: four tiles in a row on a computer, two by two on smaller screens
   (five until 2026-11-25, when Locked was removed; Minimums went 11-22) */
@media (min-width: 861px) {
  .stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* the tiles: Highest APR shows a bank's name (a long name ends in "…"
   instead of widening the tile and the page) */
.stats > .stat { min-width: 0; }
.stat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.stat-sub { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-first { border-color: rgba(var(--accent-rgb), 0.25); }
.stat-first .stat-name { color: var(--accent); }

/* the card form: Type, then Name (3) · Last 4 · Locked · Due day, then
   Balance · Limit · APR · Promo APR · Promo ends · Interest, then Notes and
   the buttons. A debit card hides the money boxes. */
.bill-form .f-lock { display: flex; flex-direction: column; min-width: 0; }
.card-form .f-name { grid-column: span 2; }   /* Name · Last 4 · Locked · Auto pay · Due day */
@media (max-width: 860px) {
  .card-form .f-name { grid-column: 1 / -1; }   /* the form has two columns here */
}
.card-form:is([data-kind="debit"], [data-kind="checking"]) .credit-only { display: none; }
#debit > .section-head .add-chevron { margin-left: auto; }   /* (no count beside it since 2026-11-25) */
.card-form input[type="date"] { color-scheme: dark; }

@media (max-width: 640px) {
  /* Phone cards: name, lock, notes and buttons on top (the lock and the
     notes icon share the third column); Balance, Used, APR and Interest on
     the second line; Limit, Due and Updated on the third. */
  .cards-table th,
  .cards-table td,
  .cards-table .actions { padding: 0; }
  .cards-table .c-limit,
  .cards-table .c-due,
  .cards-table .c-auto,
  .cards-table .c-upd { grid-row: 3; }
  .cards-table .num,
  .cards-table .c-upd { width: auto; text-align: left; }
  .cards-table tbody .c-lock { grid-row: 1; grid-column: 3; justify-self: start; align-self: start; width: auto; }
  .cards-table tbody .info { justify-self: end; }
  .cards-table .lock-btn { width: 28px; height: 28px; margin: -2px 0 0 -4px; }
  /* Credit cards: the name takes the top line up to edit/delete (one line
     for names like "American Express Credit"); the third line is Limit,
     Due, Auto pay and Updated; lock and notes sit at the right of a fourth. */
  .cards-table:not(.debit-table) tbody .name { grid-column: 1 / 4; }
  .cards-table:not(.debit-table) tbody .c-lock { grid-row: 4; grid-column: 4; align-self: center; }
  .cards-table:not(.debit-table) tbody .info { grid-row: 4; grid-column: 4; align-self: center; }
  .cards-table:not(.debit-table) .lock-btn { margin: 0 0 0 -4px; }
  /* a long label ("Monthly interest") wraps onto two lines; the figures
     sit at the bottom of their cells, so they stay level with each other */
  .cards-table .num::before { white-space: normal; }
  .cards-table .num { align-self: end; }
  /* the last 4 digits start the second line, before the tags */
  .cards-table .name-line .last4 { order: 3; margin-left: 0; line-height: 1.6; }
  .cards-table tfoot .c-blank { display: none; }
  .cards-table tfoot .foot-note { grid-row: 4; }
  .cards-table td.c-upd { font-size: 14px; }
  /* The icons line up (since 2026-11-25): each sits at the right edge of
     the last column, moved left in steps of 38px (a 34px icon and the 4px
     gap between the pen and the bin), so they share one grid of positions.
     Credit cards: lock under the pen, notes under the bin. Debit cards and
     accounts: lock, notes, pen and bin in one even row. */
  .cards-table tbody td.actions { width: auto; justify-self: end; align-self: start; }
  .cards-table tbody .c-lock,
  .cards-table tbody .info { justify-self: end; width: auto; }
  .cards-table td.c-lock .lock-btn { width: 34px; height: 34px; margin: 0; }
  .cards-table:not(.debit-table) tbody .c-lock { margin-right: 38px; }
  .debit-table tbody .c-lock,
  .debit-table tbody .info { grid-row: 1; grid-column: 4; align-self: start; }
  .debit-table tbody .c-lock { margin-right: 114px; }
  .debit-table tbody .info { margin-right: 76px; }
  /* level with the name: its first line is 24px tall, the icons 34px */
  .cards-table tbody td.actions,
  .debit-table tbody .c-lock,
  .debit-table tbody .info { margin-top: -5px; }
  /* Debit & accounts: each icon placed by eye with a tuner on the phone
     (2026-11-25), right of its even 38px step, and all 0.5px lower */
  .debit-table tbody .lock-btn { transform: translate(4px, 0.5px); }
  .debit-table tbody .info-btn { transform: translate(8px, 0.5px); }
  .debit-table tbody td.actions a.icon-btn { transform: translate(6px, 0.5px); }
  .debit-table tbody td.actions button.icon-btn { transform: translate(1px, 0.5px); }
  /* Promo ends: the date and the calendar icon fit side by side */
  .card-form input[type="date"] { font-size: 14px; padding-left: 8px; padding-right: 6px; }
  /* Add a card: the four types in two rows, inside the card */
  .card-form .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .card-form .seg span { text-align: center; padding: 7px 6px; }
}

/* Small phones: the Credit cards bar shows the amount without "owed". */
@media (max-width: 480px) {
  .owed-unit { display: none; }
  .card-form .seg span { white-space: nowrap; }
}

/* Phones (since 2026-11-24): a ☰ menu. The bar shows the logo and the
   button; the pages, Settings included, drop down under the bar. */
@media (max-width: 640px) {
  .topbar-inner { gap: 12px; }
  .logout { display: none; }
  .menu-btn {
    display: inline-grid; place-items: center; margin-left: auto;
    width: 42px; height: 42px; padding: 0; border: 1px solid var(--edge); border-radius: var(--radius-sm);
    background: transparent; color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .menu-btn[aria-expanded="true"] { background: var(--surface-3); }
  .menu-btn .menu-close-icon, .menu-btn[aria-expanded="true"] .menu-open-icon { display: none; }
  .menu-btn[aria-expanded="true"] .menu-close-icon { display: block; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px;
    padding: 8px max(var(--gutter), env(safe-area-inset-right)) 14px max(var(--gutter), env(safe-area-inset-left));
    background: var(--bg); border-bottom: 1px solid var(--edge-strong);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  }
  .topbar.menu-open .nav { display: flex; animation: menu-drop 0.16s ease-out; }
  .nav a { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 16px; }
  .nav a.nav-phone-only { display: block; }
}
@keyframes menu-drop { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .topbar.menu-open .nav { animation: none; } }
