/* FreeBy - one hand-written stylesheet, no build step. Tokens swap for dark mode. */
:root {
  color-scheme: light;
  --bg: #f5f6f8; --surface-1: #ffffff; --surface-2: #f0f2f5; --border: #dfe3e8; --grid: #e6e9ee;
  --text-primary: #191919; --text-secondary: #5f6670; --text-muted: #7b828c;
  --series-1: #257de0; --accent: #257de0; --accent-ink: #ffffff;
  --critical: #dc3c3d; --critical-bg: #fdecec; --critical-ink: #8f1d1e;
  --good: #0a7a1c; --good-bg: #e8f6ea; --warn-bg: #fff4dc; --warn-ink: #6b4a00;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #101113; --surface-1: #191919; --surface-2: #232427; --border: #34363b; --grid: #2b2d31;
    --text-primary: #efefef; --text-secondary: #a3a8b0; --text-muted: #8a909a;
    --series-1: #338ced; --accent: #338ced; --accent-ink: #0b0b0b;
    --critical: #ff6b6c; --critical-bg: #3a1617; --critical-ink: #ffb4b5;
    --good: #3ccf55; --good-bg: #13301a; --warn-bg: #3a2c0a; --warn-ink: #f6d68a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101113; --surface-1: #191919; --surface-2: #232427; --border: #34363b; --grid: #2b2d31;
  --text-primary: #efefef; --text-secondary: #a3a8b0; --text-muted: #8a909a;
  --series-1: #338ced; --accent: #338ced; --accent-ink: #0b0b0b;
  --critical: #ff6b6c; --critical-bg: #3a1617; --critical-ink: #ffb4b5;
  --good: #3ccf55; --good-bg: #13301a; --warn-bg: #3a2c0a; --warn-ink: #f6d68a;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text-primary); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
.tagline { margin: 0 0 .75rem; font-size: 1.05rem; font-weight: 600; color: var(--accent); } h2 { font-size: 1.15rem; margin: 0 0 .6rem; } h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--text-secondary); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }
main.wrap { padding-top: 22px; }
nav.top { background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
nav.top .wrap { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding-bottom: 0; }
nav.top .brand { font-weight: 700; margin-right: 12px; padding: 8px 0; display: inline-flex; align-items: center; gap: 9px; color: var(--text-primary); border-bottom: 0; }
nav.top a.brand:hover { border-bottom: 0; }
/* The logo artwork is transparent, so it sits directly on the page / header. The wrappers keep the same size and padding
   (borders are kept as transparent so nothing shifts); the earlier white plate is gone. */
.mark, .logo-card { background: transparent; border-radius: 10px; }
.mark { display: inline-flex; padding: 2px; border: 1px solid transparent; }
.mark img { display: block; width: 32px; height: 32px; }
.logo-card { padding: 14px 18px; border: 1px solid transparent; display: flex; justify-content: center; }
.logo-full { display: block; width: 100%; max-width: 360px; height: auto; }   /* height:auto keeps the 3:1 artwork undistorted */
/* Dark theme: swap to the white-wordmark lockup, by the same rules (OS preference, or an explicit data-theme) that pick the colour tokens above. */
.logo-full.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .logo-full:not(.logo-dark) { display: none; }
  :root:where(:not([data-theme="light"])) .logo-full.logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-full:not(.logo-dark) { display: none; }
:root[data-theme="dark"] .logo-full.logo-dark { display: block; }
.home-logo { margin: 4px 0 8px; justify-content: flex-start; padding: 10px 18px; max-width: 420px; }
/* The purpose statement sits to the right of the lockup on wide screens and wraps underneath it on narrow ones. Colours are the theme tokens only. */
.home-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; }
.home-hero .home-logo { flex: 0 1 420px; width: 100%; }
.home-hero .home-purpose { flex: 1 1 300px; margin: 0 0 4px; max-width: 560px; font-size: 1.05rem; line-height: 1.5; color: var(--text-secondary); }
@media (max-width: 760px) { .home-hero .home-purpose { padding: 0 18px 4px; } }
.login .logo-card { margin-bottom: 14px; }
.page-h { font-size: 1.6rem; margin: 10px 0 .25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
nav.top a { text-decoration: none; color: var(--text-secondary); padding: 12px 10px; border-bottom: 2px solid transparent; }
nav.top a.on, nav.top a:hover { color: var(--text-primary); border-bottom-color: var(--accent); }
nav.top form { margin-left: auto; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .k { color: var(--text-secondary); font-size: .85rem; } .tile .v { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin: 14px 0; }
.alarm { background: var(--critical-bg); border: 3px solid var(--critical); color: var(--critical-ink); border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
.alarm h2 { color: var(--critical); font-size: 1.35rem; display: flex; gap: 10px; align-items: center; margin: 0 0 8px; }
.alarm ul { margin: 0; padding: 0; list-style: none; }
.alarm li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--critical); font-size: 1.05rem; }
.alarm li b { font-size: 1.15rem; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 14px 0; background: var(--good-bg); color: var(--good); border: 1px solid var(--good); }
.flash.err, .errors { background: var(--critical-bg); color: var(--critical-ink); border: 1px solid var(--critical); }
.errors { padding: 10px 14px; border-radius: 8px; margin: 14px 0; } .errors ul { margin: 0; padding-left: 18px; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr.hl td { background: var(--surface-2); } tr.bad td { background: var(--critical-bg); color: var(--critical-ink); font-weight: 600; }
.scroll { overflow-x: auto; } .scroll.tall { max-height: 560px; overflow-y: auto; }
.pill { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); }
.pill.red { background: var(--critical-bg); color: var(--critical-ink); border-color: var(--critical); }
label { display: block; font-weight: 600; margin: 10px 0 3px; font-size: .9rem; } label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 6px 14px 6px 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select { width: 100%; max-width: 420px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); font: inherit; }
input.sm, select.sm { max-width: 150px; } .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; } .row > div { min-width: 140px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); } .btn.danger { background: transparent; color: var(--critical); border-color: var(--critical); } .btn.sm { padding: 3px 9px; font-size: .85rem; }
.hint { color: var(--text-secondary); font-size: .82rem; margin-top: 2px; } .err-text { color: var(--critical); font-size: .85rem; }
.filters { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin: 16px 0; }
.pos { color: var(--critical); } .neg { color: var(--good); }
details > summary { cursor: pointer; color: var(--accent); margin: 8px 0; }
.drag { list-style: none; margin: 0; padding: 0; } .drag li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 6px 0; display: flex; gap: 10px; align-items: center; cursor: grab; }
.drag li.over { outline: 2px dashed var(--accent); } .handle { color: var(--text-muted); }
/* charts */
.viz { position: relative; }
.viz svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz .gridline { stroke: var(--grid); stroke-width: 1; } .viz .axis-text { fill: var(--text-secondary); font-size: 11px; }
.viz .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; outline: none; } .viz .dot:focus, .viz .dot.on { r: 6; }
.viz .cross { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.18); white-space: nowrap; z-index: 3; transform: translate(-50%, -110%); }
.tip b { display: block; font-size: 1rem; } .tip .key { display: inline-block; width: 14px; height: 2px; background: var(--series-1); vertical-align: middle; margin-right: 6px; }
.bars .brow { display: grid; grid-template-columns: 150px 1fr 100px; gap: 10px; align-items: center; margin: 6px 0; font-size: .9rem; }
.bars .track { background: transparent; height: 18px; } .bars .bar { height: 14px; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; outline: none; } .bars .bar:hover, .bars .bar:focus { filter: brightness(1.15); }
@media (max-width: 640px) { .bars .brow { grid-template-columns: 100px 1fr 80px; } nav.top a { padding: 8px 6px; } }
@media (forced-colors: active) { .viz .line, .viz .dot { stroke: CanvasText; } .bars .bar { background: CanvasText; } }
.login { max-width: 380px; margin: 12vh auto; }

/* monthly cycle */
.stage-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin: 14px 0; }
.stage-title { font-size: 1.3rem; margin: 2px 0 6px; } .stage-why { margin: 0 0 12px; color: var(--text-secondary); }
.btn.big { padding: 12px 22px; font-size: 1.05rem; border-radius: 10px; } .btn[disabled] { opacity: .45; cursor: not-allowed; }
.stepper { list-style: none; display: flex; gap: 6px; margin: 0 0 14px; padding: 0; }
.stepper .step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); font-weight: 600; font-size: .9rem; min-width: 0; }
.stepper .dot { display: inline-flex; width: 24px; height: 24px; flex: none; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-1); border: 1px solid var(--border); font-size: .8rem; }
.stepper .step.done { color: var(--good); } .stepper .step.done .dot { background: var(--good); border-color: var(--good); color: var(--surface-1); }
.stepper .step.current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .stepper .step.current .dot { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
@media (max-width: 640px) { .stepper .lbl { font-size: .75rem; } .stepper .step { padding: 6px; gap: 4px; } .stepper .dot { width: 20px; height: 20px; } }
.checklist td { vertical-align: middle; } .checklist tr.row-paid td { background: var(--good-bg); } .checklist tr.row-skipped td { background: var(--surface-2); color: var(--text-secondary); }
.trophies { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* users + app settings */
.field { width: 100%; max-width: 640px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); font: inherit; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .inline-form input.sm, .inline-form select.sm { max-width: 150px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px 16px; } .swatch { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 4px 0; cursor: pointer; }
.swatch .chip { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); display: inline-block; } .swatch .chip + .chip { margin-left: -10px; }
.logo-preview { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 10px; display: inline-block; margin: 4px 0 8px; } .logo-preview img { display: block; width: 100%; max-width: 280px; height: auto; }

/* belongs-to tags, filters, plan notes */
.pill.tag { background: var(--surface-2); color: var(--text-primary); font-weight: 600; margin-left: 4px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chipbtn { text-decoration: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); font-weight: 600; font-size: .9rem; }
.chipbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .chipbtn.on .muted { color: inherit; opacity: .85; }
.subtotals { margin: 4px 0 10px; font-size: 1rem; }
.plan-sentence { margin: 8px 0 4px; font-weight: 600; }

/* Users screen: the Role dropdown and its Save button stay on one line, button immediately to the right, vertically centred. */
.inline-form.role-form { flex-wrap: nowrap; align-items: center; }
.inline-form.role-form select { width: auto; flex: 0 1 auto; }
.inline-form.role-form .btn { flex: none; }

/* Monthly interest: always visible in the header, right side, just before Log out. Deliberately hard to ignore.
   The badge and Log out sit in one group so they never get separated when the header has to wrap. */
nav.top .nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
nav.top .nav-right form { margin-left: 0; }

/* interest by category, wins, progress */
.cats td { vertical-align: middle; } .cats td .small { margin-top: 2px; }
.bar-line { display: flex; align-items: center; gap: 8px; } .bar-track { flex: 1; max-width: 260px; height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; background: var(--series-1); border-radius: 999px; }
.pill.good { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.win-row { display: flex; gap: 14px; padding: 6px 0; border-top: 1px solid var(--border); } .win-row:first-of-type { border-top: 0; }
.switcher { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; } .chipbtn.big { padding: 10px 18px; font-size: 1.02rem; }
.big-numbers .tile .v { font-size: 2.1rem; } .big-numbers .tile .k { font-size: .95rem; }
.chart-card .viz svg { max-height: 460px; } .chart-card h2 { font-size: 1.3rem; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 8px; font-size: .9rem; color: var(--text-secondary); } .legend .key { display: inline-block; width: 28px; vertical-align: middle; margin-right: 6px; border-top: 3px solid var(--series-1); }
.legend .key.dotted { border-top-style: dotted; } .legend .key.dashed { border-top-style: dashed; border-top-color: var(--text-muted); }
.viz .proj { fill: none; stroke: var(--series-1); stroke-width: 2.5; stroke-dasharray: 1 6; stroke-linecap: round; } .viz .tgt { stroke: var(--text-secondary); stroke-width: 2; stroke-dasharray: 10 7; }
.viz .tgt-label { fill: var(--text-secondary); font-size: 11px; }
.print-only { display: none; }
@media print {
  html:root, html:root[data-theme="dark"] { color-scheme: light; --bg: #fff; --surface-1: #fff; --surface-2: #f3f4f6; --border: #c9ced6; --grid: #dcdfe5; --text-primary: #111; --text-secondary: #444; --text-muted: #666; --series-1: #1d5fb0; --accent: #1d5fb0; }
  nav.top, .no-print, .flash, .errors, .btn, details, .tip { display: none !important; }
  .logo-full.logo-dark { display: none !important; } .logo-full:not(.logo-dark) { display: block !important; }   /* print is always the light theme */
  .print-only { display: block !important; }
  body { background: #fff; font-size: 12px; } main.wrap { padding: 0; max-width: none; }
  .card, .tile { box-shadow: none; break-inside: avoid; } .chart-card { page-break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Progress: single-debt picker under the category switcher */
.debt-picker { margin: 0 0 16px; } .debt-picker label { margin: 0 0 4px; } .debt-picker select { max-width: 360px; }

/* Header "Admin" dropdown */
nav.top .nav-dd { position: relative; }
nav.top .nav-dd-btn { background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; color: var(--text-secondary); padding: 12px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
nav.top .nav-dd-btn:hover, nav.top .nav-dd-btn.on, nav.top .nav-dd.open .nav-dd-btn { color: var(--text-primary); border-bottom-color: var(--accent); }
nav.top .nav-dd-btn:focus-visible, nav.top .nav-dd-menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
nav.top .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform .12s; }
nav.top .nav-dd.open .caret { transform: rotate(180deg); }
nav.top .nav-dd-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 170px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.16); padding: 6px; z-index: 30; }
nav.top .nav-dd.open .nav-dd-menu { display: block; }
nav.top .nav-dd-menu a { display: block; padding: 8px 12px; border-bottom: 0; border-radius: 6px; white-space: nowrap; }
nav.top .nav-dd-menu a:hover, nav.top .nav-dd-menu a:focus { background: var(--surface-2); color: var(--text-primary); border-bottom: 0; }
nav.top .nav-dd-menu a.on { color: var(--text-primary); font-weight: 700; background: var(--surface-2); }
/* Without JavaScript the group still opens on hover / keyboard focus so nothing becomes unreachable. */
html:not(.js) nav.top .nav-dd:hover .nav-dd-menu, html:not(.js) nav.top .nav-dd:focus-within .nav-dd-menu { display: block; }

/* Plan step: form + lock on the left (~40%), strategy comparison on the right (~60%); stacked, form first, on narrow screens. */
.plan-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin: 16px 0; }
.plan-cols .filters, .plan-cols .card { margin: 0; }
.plan-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; } .plan-right { min-width: 0; }
@media (min-width: 1100px) {
  .plan-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}
@media (min-width: 1100px) {
  /* a little tighter inside the 60% column so all columns fit without side-scrolling */
  .plan-right table { font-size: .82rem; } .plan-right th, .plan-right td { padding: 6px 6px; } .plan-right th { font-size: .68rem; letter-spacing: 0; }
  .plan-right .card { padding: 12px 12px; }
}

/* Plan step, left column: the four fields in two rows of two, Update comparison right under them, small note text. */
.plan-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; }
.plan-fields > div { min-width: 0; } .plan-fields select, .plan-fields input.sm { max-width: none; width: 100%; }
.plan-update { margin-top: 12px; }
.plan-note { font-weight: 400; margin: 8px 0 0; } .notice.plan-note { padding: 7px 10px; }
@media (max-width: 420px) { .plan-fields { grid-template-columns: 1fr; } }
/* Plan step, right column: earlier steps as slim rows (name, done badge, summary). */
.steps-compact h3 { margin: 0 0 4px; font-size: .95rem; }
.step-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); } .step-row:first-of-type { border-top: 0; }
.step-row > b, .step-row > .pill { flex: none; white-space: nowrap; } .step-row > .small { flex: 1 1 0; min-width: 0; }   /* name + badge, then the summary on the same row */
.plan-right { display: flex; flex-direction: column; gap: 16px; }

/* Pay checklist: unsaved rows and the sticky save bar */
.checklist tr.is-dirty td:first-child { box-shadow: inset 4px 0 0 var(--warn-ink); }
.checklist .paid-date { margin-left: 6px; padding: 3px 6px; width: auto; }
.pill.amber { background: var(--warn-bg); color: var(--warn-ink); }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); box-shadow: 0 -4px 14px rgba(0, 0, 0, .12); }
.savebar .grow { flex: 1; }
.has-changes .savebar { border-color: var(--warn-ink); }
.has-changes [data-count] { font-weight: 600; color: var(--warn-ink); }
.checklist [hidden], .savebar [hidden] { display: none !important; }   /* the hidden attribute must beat .pill / .btn display rules */

/* HELOC capacity gauge */
.gauge { height: 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.gauge-fill { height: 100%; background: var(--series-1); border-radius: 999px; }

/* Pay step: List | Calendar toggle and the month calendar */
.pay-toggle { display: none; gap: 6px; margin: 4px 0 10px; } .js .pay-toggle { display: flex; }
.cal { min-width: 700px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head > div { padding: 6px 8px; font-size: .75rem; font-weight: 600; color: var(--text-secondary); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-cell { min-height: 92px; padding: 4px 5px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; background: var(--surface-1); }
.cal-cell:nth-child(7n) { border-right: 0; } .cal-week:last-child .cal-cell { border-bottom: 0; }
.cal-cell.out { background: var(--surface-2); opacity: .55; }
.cal-cell.today { outline: 2px solid var(--series-1); outline-offset: -2px; border-radius: 4px; }
.cal-day { font-size: .75rem; color: var(--text-secondary); } .cal-cell.today .cal-day { font-weight: 700; color: var(--text-primary); }
.chip { display: block; text-decoration: none; color: var(--text-primary); font-size: .75rem; line-height: 1.25; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-1); }
.chip:hover, .chip:focus { filter: brightness(1.06); outline: 2px solid var(--series-1); outline-offset: 1px; }
.chip .chip-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .chip-amt { display: block; } .chip .chip-note { display: block; font-size: .68rem; opacity: .85; }
.chip.paid { background: var(--good-bg); border-color: var(--good); }
.chip.skipped { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.chip.overdue { background: var(--critical-bg); border-color: var(--critical); color: var(--critical-ink); }
.checklist tr.row-flash td { animation: rowflash 2.5s ease-out; }
@keyframes rowflash { 0%, 60% { box-shadow: inset 0 0 0 100px var(--warn-bg); } 100% { box-shadow: none; } }

/* ---- Header: menu, scoreboard card, mobile hamburger ---- */
nav.top .nav-toggle { display: none; }
nav.top .nav-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
nav.top .nav-logout-m { display: none; }
nav.top .nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; padding: 6px 0; }

.scoreboard { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-1); padding: 6px 12px 7px; min-width: 252px; font-size: .84rem; line-height: 1.35; }
.scoreboard .sb-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.scoreboard .sb-k { color: var(--text-secondary); white-space: nowrap; }
.scoreboard .sb-v { font-variant-numeric: tabular-nums; font-size: .98rem; font-weight: 800; white-space: nowrap; }
.scoreboard .sb-interest { color: var(--warn-ink); }
.scoreboard .sb-unit { font-size: .72rem; font-weight: 500; color: var(--text-secondary); margin-left: 1px; }
.scoreboard .sb-sub { font-size: .74rem; text-align: right; margin: -1px 0 3px; font-weight: 600; }
.scoreboard .sb-sub.good { color: var(--good); } .scoreboard .sb-sub.bad { color: var(--critical); }
.scoreboard .sb-bar { height: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 3px; }
.scoreboard .sb-fill { height: 100%; background: var(--series-1); border-radius: 999px; }

/* Wide enough for the whole menu AND the card: the card sits at the top right, left of Log out.
   Narrower than that (but still a full desktop menu) the card drops to its own row under the header instead of covering menu items. */
@media (min-width: 900px) and (max-width: 1259px) {
  nav.top .nav-right { flex: 1 0 100%; justify-content: flex-end; padding: 2px 0 8px; border-top: 1px solid var(--border); margin-top: 2px; }
}

/* Phone / small tablet: the menu collapses behind a three-line button next to the logo; the card is a full-width row under the header. */
@media (max-width: 899px) {
  nav.top .wrap { position: relative; }
  nav.top .nav-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; width: 44px; height: 44px; padding: 0; background: none; border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); cursor: pointer; }
  nav.top .nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  nav.top .nav-toggle .bars, nav.top .nav-toggle .bars::before, nav.top .nav-toggle .bars::after { display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; content: ""; position: relative; }
  nav.top .nav-toggle .bars::before { position: absolute; top: -6px; left: 0; } nav.top .nav-toggle .bars::after { position: absolute; top: 6px; left: 0; }
  nav.top .nav-panel { display: none; position: absolute; top: 100%; right: 16px; left: 16px; z-index: 40; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.2); padding: 6px; }
  nav.top.menu-open .nav-panel { display: flex; }
  nav.top .nav-panel a, nav.top .nav-panel .nav-logout-m .btn { display: block; padding: 12px 12px; border-bottom: 0; border-radius: 8px; text-align: left; }
  nav.top .nav-panel a:hover, nav.top .nav-panel a:focus { background: var(--surface-2); }
  nav.top .nav-panel a.on { background: var(--surface-2); font-weight: 700; color: var(--text-primary); }
  /* the Admin group is flat in the panel: its items are listed like every other item */
  nav.top .nav-dd-btn { display: none; }
  nav.top .nav-dd-menu { display: block; position: static; min-width: 0; border: 0; box-shadow: none; padding: 0; background: none; }
  nav.top .nav-logout-m { display: block; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
  nav.top .nav-logout-m, nav.top .nav-logout-m .btn { margin-left: 0; width: 100%; }
  nav.top .nav-logout-m .btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: .95rem; }
  nav.top .nav-logout-d { display: none; }
  nav.top .nav-right { flex: 1 0 100%; padding: 4px 0 10px; }
  .scoreboard { width: 100%; min-width: 0; }
}
/* Without JavaScript the panel simply stays open (the button could not open it). */
html:not(.js) nav.top .nav-toggle { display: none; }
@media (max-width: 899px) { html:not(.js) nav.top .nav-panel { display: flex; position: static; box-shadow: none; } }
