/* Bundled fonts, Latin only, woff2 only (every current browser reads it). No network requests. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('./bricolage-grotesque-latin-600-normal-nxTgbNFE.woff2') format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('./bricolage-grotesque-latin-700-normal-gtcctNPv.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('./ibm-plex-sans-latin-400-normal-CDDApCn2.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('./ibm-plex-sans-latin-500-normal-6ng42L7E.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('./ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('./ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('./ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2') format('woff2');
}
/* OpenChurn: settings beside the computed plan; pay-stub ledger; check-ink accent. Fonts are bundled (main.tsx). */
:root {
  --bg: #F2F5F3;
  --surface: #FFFFFF;
  --ink: #16201C;
  --muted: #5B6B65;
  --line: #D9E2DD;
  --accent: #2747A0;
  --accent-soft: #E3E9F8;
  --good: #1E7A4E;
  --good-soft: #DFF2E7;
  --warn: #8F5B00;
  --warn-soft: #FBEFD6;
  --bad: #B23A2E;
  --bad-soft: #F8E1DE;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
/* Dark follows the device unless the theme switch chose light; data-theme="dark" forces it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1412; --surface: #161E1B; --ink: #E6EEEA; --muted: #93A49D; --line: #2A3631;
    --accent: #8FA8F0; --accent-soft: #1F2A47; --good: #5CCB92; --good-soft: #173326;
    --warn: #E6B04A; --warn-soft: #3A2C10; --bad: #F08378; --bad-soft: #3D1C18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1412; --surface: #161E1B; --ink: #E6EEEA; --muted: #93A49D; --line: #2A3631;
  --accent: #8FA8F0; --accent-soft: #1F2A47; --good: #5CCB92; --good-soft: #173326;
  --warn: #E6B04A; --warn-soft: #3A2C10; --bad: #F08378; --bad-soft: #3D1C18;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); }
.page { max-width: 1180px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 56px max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 24px; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-left, 0px)); display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.support-note { border-top: 1px solid var(--line); margin: 0; padding: 6px max(16px, env(safe-area-inset-left, 0px)); text-align: center; font-size: 12.5px; color: var(--muted); }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 16px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--ink); }
.nav a.btn, .nav a.btn:hover { color: var(--surface); }

h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.1; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; margin: 0; }
.lede { color: var(--muted); max-width: 64ch; margin: 0; }
.label { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.chip { align-self: flex-start; font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 3px 8px; border-radius: 4px; }
.hint, .sub { font-size: 12.5px; color: var(--muted); margin: 0; }
.hint.warn { color: var(--warn); }
.sub { display: block; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.section { display: flex; flex-direction: column; gap: 10px; }

/* Forms */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.fields .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
input, select { font: inherit; font-size: 14.5px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
input[type="number"], input[type="date"] { font-family: var(--f-mono); font-size: 13.5px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }
.btn { background: var(--accent); color: var(--surface); border: 0; border-radius: 6px; padding: 9px 14px; font-weight: 600; font-size: 14px; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 600; font-size: 14px; }
.icon-btn { flex: none; width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 14px; line-height: 1; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.check input { width: auto; }
details.more summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
details.more[open] summary { margin-bottom: 10px; }

/* Planner layout */
.layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); grid-template-areas: "edit plan"; gap: 28px; align-items: start; }
.editor { grid-area: edit; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.plan { grid-area: plan; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "plan" "edit"; } }
.panel.bonus { padding: 12px 14px; }
.bonus-head { display: flex; gap: 8px; align-items: center; }
.bonus-toggle { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 0; color: var(--ink); }
.bonus-toggle b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step { font-family: var(--f-mono); font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 2px 6px; flex: none; }
.step.side { color: var(--muted); background: var(--bg); }
.bonus.off { opacity: .55; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .tiles { grid-template-columns: minmax(0, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile .v { font-family: var(--f-display); font-weight: 600; font-size: 1.75rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .s { font-size: 12.5px; color: var(--muted); }
.tile.bad .v { color: var(--bad); }
.tile.good .v { color: var(--good); }

.flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.flag { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 14px; }
.flag + .flag { border-top: 1px solid var(--line); }
.pill { font-family: var(--f-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; margin-top: 2px; }
.pill.good { color: var(--good); background: var(--good-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.pill.info { color: var(--accent); background: var(--accent-soft); }

.scroller { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.tl { min-width: 680px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.tl-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 38px; }
.tl-label { font-size: 13px; font-weight: 600; line-height: 1.25; }
.tl-label small { display: block; font-weight: 400; color: var(--muted); font-family: var(--f-mono); font-size: 11.5px; }
.tl-track { position: relative; height: 30px; border-bottom: 1px dashed var(--line); }
.tl-months { position: relative; height: 18px; }
.tl-month { position: absolute; top: 0; font-family: var(--f-mono); font-size: 11px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 4px; }
.tl-win { position: absolute; top: 8px; height: 14px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 3px; }
.tl-win.short { border-color: var(--bad); background: var(--bad-soft); }
.tl-win.side { border-style: dashed; border-color: var(--muted); background: transparent; }
.tl-dep { position: absolute; top: 9px; width: 8px; height: 12px; margin-left: -4px; background: var(--accent); border-radius: 2px; }
.tl-dep.done { background: var(--good); }
.tl-dl { position: absolute; top: 2px; height: 26px; width: 2px; margin-left: -1px; background: var(--warn); }
.tl-today { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px solid var(--ink); opacity: .35; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }

table { width: 100%; border-collapse: collapse; min-width: 480px; font-size: 13.5px; }
th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.home { color: var(--muted); }
.bar { display: block; height: 4px; border-radius: 2px; background: var(--line); margin-top: 5px; overflow: hidden; max-width: 160px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.full { background: var(--good); }

/* Live */
.notice { margin: 0; background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; max-width: 80ch; }
.notice.bad { background: var(--bad-soft); }
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.acct { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.acct-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fill { display: block; height: 100%; background: var(--accent); }
.fill.good { background: var(--good); }
.fill.warn { background: var(--warn); }
.txlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.txlist li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.txlist select { font-size: 12px; padding: 3px 6px; width: auto; }

/* Planner queue layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.strip-cell { display: flex; flex-direction: column; gap: 2px; padding: 12px 18px; border-left: 1px solid var(--line); min-width: 0; }
.strip-cell:first-child { border-left: 0; }
.strip-v { font-family: var(--f-display); font-weight: 600; font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.strip-s { font-family: var(--f-body); font-weight: 400; font-size: 13px; color: var(--muted); }
.strip-cell.bad .strip-v { color: var(--bad); }
.pay-cell { font: inherit; text-align: left; color: var(--ink); background: var(--bg); border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.pay-cell:hover, .pay-cell.open { background: var(--accent-soft); }
.pay-edit { color: var(--accent); font-size: 12px; font-weight: 600; }
@media (max-width: 760px) {
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-cell:nth-child(3) { border-left: 0; }
  .strip-cell:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.pay-extra { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pay-extra .fields { width: 100%; }
.qname .sub .paid-by { font-weight: 600; color: var(--ink); }
.fields .span2 { grid-column: span 2; }
.fields .span3 { grid-column: span 3; }
@media (max-width: 760px) {
  .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields .span3 { grid-column: span 2; }
}

.tabs-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--line); }
.tabs-bar .btn { margin-bottom: 8px; }
.tabs { display: flex; gap: 20px; }
.tab { font: inherit; font-size: 15px; font-weight: 600; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 2px; margin-bottom: -1px; color: var(--muted); cursor: pointer; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }

.qbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qrow { display: grid; grid-template-columns: 44px minmax(160px, 1.2fr) minmax(220px, 2.4fr) 140px 84px 32px; grid-template-areas: "step name track status act toggle"; gap: 16px; align-items: center; padding: 12px 18px; }
.qhead { padding-block: 10px 8px; border-bottom: 1px solid var(--line); }
.qhead > :nth-child(1) { grid-area: step; } .qhead > :nth-child(2) { grid-area: name; } .qhead > :nth-child(3) { grid-area: track; }
.qhead > :nth-child(4) { grid-area: status; } .qhead > :nth-child(5) { grid-area: act; }
.qmonths { position: relative; height: 14px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.qmonths span { position: absolute; top: 0; white-space: nowrap; }
.qitem.divided { border-top: 1px solid var(--line); }
.qitem.open { background: var(--bg); }
.qitem.off .qrow { opacity: .55; }
.qstep { grid-area: step; font-size: 18px; font-weight: 600; }
.qstep-side { grid-area: step; justify-self: start; margin-top: 0; }
.qname { grid-area: name; display: flex; flex-direction: column; min-width: 0; }
.qname b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qname .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qname .sub.live { color: var(--ink); }
.offer-link { font-weight: 600; text-decoration: none; }
.offer-link:hover { text-decoration: underline; }
.qname .sub.live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--good); vertical-align: 1px; }
.tl-dep.planned { background: var(--surface); border: 1.5px solid var(--accent); box-sizing: border-box; }
.qtrack { grid-area: track; position: relative; height: 30px; }
.qtrack .tl-win { top: 8px; }
.qtrack .tl-dep { top: 9px; }
/* Deposit marks show their date on hover, with a wider hit area than the 8px mark. */
.tl-dep[data-tip]::before { content: ""; position: absolute; inset: -9px -5px; }
.tl-dep[data-tip]:hover { z-index: 2; }
.tl-dep[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; background: var(--ink); color: var(--surface); font: 600 12px/1 var(--f-body); padding: 5px 7px; border-radius: 4px; pointer-events: none;
}
.qtrack .tl-dl { top: 2px; }
.qtrack .tl-today { top: 0; bottom: 0; }
.qstatus { grid-area: status; justify-self: start; margin-top: 0; }
.pill.quiet { color: var(--muted); background: var(--bg); }
.qact { grid-area: act; font-size: 12.5px; font-weight: 600; }
.qact.quiet { color: var(--muted); font-weight: 400; }
.qtoggle { grid-area: toggle; }
.qedit { padding: 0 18px 16px 78px; display: flex; flex-direction: column; gap: 12px; }
.qmsg { margin: 0; font-size: 13.5px; max-width: 80ch; }
.qactions { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.qactions .linkbtn { font-size: 13px; }
.linkbtn:disabled { opacity: .4; cursor: default; }
.qempty { padding: 14px 18px; }
/* Completed: one box per year, headed with the year's total */
.year-head { padding: 0 2px; }
.year-head h3 { margin: 0; font-family: var(--f-mono); font-size: 14px; font-weight: 600; }
.year-head .mono { font-weight: 600; }
@media (max-width: 760px) {
  .qhead { display: none; }
  .qrow { grid-template-columns: 32px minmax(0, 1fr) auto 32px; grid-template-areas: "step name status toggle" "track track track track" "act act act act"; row-gap: 8px; }
  .qact:empty { display: none; }
  .qedit { padding: 0 18px 16px; }
}

/* Header menus: theme switch and account (email) */
.menu { position: relative; }
.menu .icon { width: 16px; height: 16px; flex: none; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.theme-btn:hover, .theme-btn[aria-expanded="true"] { color: var(--ink); }
.acct-btn { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { color: var(--ink); }
.acct-email { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .acct-email { max-width: 130px; } }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px; display: flex; flex-direction: column; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .12); }
.menu-list a, .menu-list button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 14px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--bg); }
.menu-list form { margin: 0; }
.menu-list .check { color: var(--accent); width: 14px; height: 14px; }
@media (max-width: 520px) { .menu-list a, .menu-list button { padding-block: 11px; } }


/* OpenChurn: the plan file bar under the header. */
.filebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.filebar .path { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.filebar .notice { margin: 0; }
