/* Finance module. Builds on the tokens and shell in styles.css. */
.day-head .money { text-transform: none; }
.fin-page { max-width: 1240px; }
.fin-page > * + * { margin-top: 14px; }
.fin-page > .ph { margin-bottom: 0; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.warn { color: var(--accent) !important; }
.note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-2); }
.panel > .note:first-of-type { margin-top: 10px; }

/* ---------- buttons ---------- */
.btn-ink, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #34333a; border-color: #34333a; }
.btn-ink.is-danger { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: var(--card); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-danger { background: var(--card); color: var(--accent); border-color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.sm { height: 28px; padding: 0 10px; font-size: 8.5px; }
.btn-ink:disabled, .btn-ghost:disabled, .btn-danger:disabled { opacity: .4; cursor: not-allowed; }
.btn-ink:disabled:hover { background: var(--ink); border-color: var(--ink); }
.btn-ghost:disabled:hover { background: var(--card); color: var(--ink); }
.linkbtn {
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkbtn:disabled { opacity: .4; cursor: not-allowed; }
.linkbtn.spaced { display: inline-block; margin-top: 20px; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.panel-head .linkbtn, .panel-head a { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .14em; color: var(--ink); text-transform: uppercase; }
.sq {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
.sq:hover { border-color: var(--ink); }
.sq:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- page head row ---------- */
.fhead { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.fhead:empty { display: none; }
.fnote { margin: 0; font-size: 11.5px; color: var(--ink-2); }
.fhead .fnote { max-width: 60ch; }
.pnav { display: flex; align-items: center; gap: 6px; }
.pnav-label {
  min-width: 190px;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
}
.sums { display: flex; flex-wrap: wrap; gap: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--ink-2); }
.sums b { color: var(--ink); }

/* ---------- quick entry: the ink strip ---------- */
.quick {
  display: flex;
  align-items: stretch;
  background: var(--ink);
  border: 1.5px solid var(--ink);
}
.quick-label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  border-right: 1px solid #3e3d44;
}
.quick input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  background: var(--ink);
  border: 0;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
}
.quick input::placeholder { color: #8f8d96; }
.quick input:focus { outline: none; background: #26252b; }
.quick button {
  padding: 0 18px;
  background: var(--accent);
  border: 0;
  color: #fff;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.quick button:hover { background: #5a3ed0; }

/* ---------- Overview: the today block (one ink slab, the page's loud moment) ---------- */
.today {
  padding: 18px 22px 20px;
  background: var(--ink);
  color: #fff;
  border-bottom: 4px solid var(--accent);
}
.today .cap { color: #b7b4c0; }
.today-top { display: flex; justify-content: space-between; gap: 12px; }
.today-main { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 16px; }
.today .pxm { color: #fff; }
.today .pxm small { color: #8f8d96; font-size: 11px; }
.today-label { padding-bottom: 4px; font-family: var(--mono); font-size: 10.5px; line-height: 1.5; letter-spacing: .12em; text-transform: uppercase; color: #d9d6e0; }
.today-bar { display: flex; align-items: center; gap: 14px; }
.today-bar .cellbar { max-width: none; flex: 1; }
.today-bar .cellbar i { height: 14px; border-color: #4a4950; }
.today-bar .cellbar i.on { background: #fff; border-color: #fff; }
.today-bar .cellbar.t-warn i.on { background: #b9a8f1; border-color: #b9a8f1; }
.today-bar .cellbar.t-over i, .today-bar .cellbar.is-over i { background: var(--accent); border-color: var(--accent); }
.today-bar .cap { white-space: nowrap; color: #fff; }
.today-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid #3e3d44; }
.today-kv div { display: flex; flex-direction: column; gap: 4px; }
.today-kv dt { font-family: var(--mono); font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: #8f8d96; }
.today-kv dd { margin: 0; font-family: var(--mono); font-size: 13px; font-weight: 700; color: #fff; }
.today-kv dd .is-neg { color: #c3b6f7; }
.today-note { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0; font-size: 12px; color: #d9d6e0; }
.today.is-past { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); border-bottom: 4px solid var(--ink); }
.today.is-past .cap, .today.is-past .today-label, .today.is-past .today-kv dt { color: var(--ink-2); }
.today.is-past .pxm, .today.is-past .today-kv dd { color: var(--ink); }
.today.is-past .today-kv { border-top-color: var(--line); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.today + .quick { margin-top: 0; border-top: 0; }

.sub-head { margin-top: 18px; }
.ledger { display: flex; flex-direction: column; }
.lg-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.lg-row:last-child { border-bottom: 0; }
.lg-row b { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--mono); font-size: 12px; color: var(--ink); text-align: right; }
.lg-row small { font-family: var(--sans); font-size: 10.5px; font-weight: 400; color: var(--ink-2); }
.lg-big { align-items: center; padding: 14px 0; }
.lg-big span:first-child { font-weight: 600; color: var(--ink); }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metrics.m3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--ink);
}
.metric-v { min-height: 26px; display: flex; align-items: flex-end; overflow: hidden; }
.metric-sub { margin: 0; font-size: 11px; color: var(--ink-2); }
.pxm { display: inline-flex; align-items: flex-end; gap: 5px; color: var(--ink); max-width: 100%; }
.pxm small { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--muted); line-height: 1; padding-bottom: 1px; }
.pxm.is-neg { color: var(--accent); }
.pxm .px { max-width: 100%; height: auto; }

/* ---------- panels, rows ---------- */
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.panel.flush { padding: 0; }
.panel.narrow { max-width: 640px; }
.panel-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ph-right { font-family: var(--mono); font-size: 8.5px; font-weight: 500; letter-spacing: .12em; color: var(--ink-2); }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
}
.rows > .row:last-child { border-bottom: 0; }
.row-btn { width: 100%; background: none; border-top: 0; border-left: 0; border-right: 0; text-align: left; cursor: pointer; font-family: var(--sans); font-size: 12px; }
.row-btn:hover { background: var(--paper-3); }
.row-btn.is-sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
.row.is-off { opacity: .5; }
.row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-main b { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 11px; color: var(--ink-2); overflow-wrap: anywhere; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.amt { font-family: var(--mono); font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.amt.is-in { color: var(--accent); }
.amt.is-muted { color: var(--muted); font-weight: 500; }
.amt.is-neg, .money.is-neg { color: var(--accent); }
.total-row { background: var(--paper-3); padding: 10px 8px; margin: 6px -2px 0; border-bottom: 0; }
.sw { width: 12px; height: 12px; flex: none; background: var(--sw); outline: 1px solid rgba(0, 0, 0, .12); outline-offset: -1px; }
.ext { color: var(--ink-2); text-decoration: none; }
.tenor { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  background: var(--paper-3);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-2);
}
.b-outline { background: transparent; border: 1px solid var(--line); }
.b-ok { background: var(--ink); color: #fff; }
.b-ink { background: var(--ink); color: #fff; }
.b-warn { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.b-info { background: var(--accent); color: #fff; }

/* cell bars: the shelf-share meter */
.cellbar { display: flex; gap: 1.5px; width: 100%; max-width: 360px; }
.cellbar i { flex: 1; min-width: 3px; height: 11px; background: transparent; border: 1px solid #c7c3b9; }
.cellbar i.on { background: var(--cell, var(--ink)); border-color: var(--cell, var(--ink)); }
.cellbar.t-warn i.on { background: #a18ff0; border-color: #a18ff0; }
.cellbar.t-over i.on, .cellbar.is-over i { background: var(--accent); border-color: var(--accent); }
.catbar .row-main { gap: 6px; }
.catbar .cellbar i { height: 8px; }

.empty { padding: 34px 20px; text-align: center; }
.empty b { display: block; font-size: 14px; }
.empty p { max-width: 52ch; margin: 6px auto 16px; font-size: 12px; line-height: 1.55; color: var(--ink-2); }

.callout {
  padding: 10px 14px;
  background: var(--paper-2);
  border-left: 3px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
}
.callout.is-warn { background: var(--accent-soft); border-left-color: var(--accent); }

.kv { margin: 12px 0 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-family: var(--mono); font-weight: 700; }

/* ---------- insights ---------- */
.ins-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.ins-mark.l-danger { background: var(--accent); border-color: var(--accent); color: #fff; }
.ins-mark.l-warning { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ins-mark.l-success { background: var(--ink); color: #fff; }
.ins.l-danger { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.go { font-size: 16px; color: var(--muted); }

/* ---------- setup checklist ---------- */
.setup-list { list-style: none; margin: 4px 0 0; padding: 0; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.setup-list li:last-child { border-bottom: 0; }
.setup-list li.is-done { color: var(--ink-2); }
.check-dot { display: grid; place-items: center; width: 19px; height: 19px; flex: none; border: 1.5px solid var(--ink); border-radius: 50%; font-size: 11px; }
.is-done .check-dot { background: var(--ink); color: #fff; }

/* ---------- charts ---------- */
.chart { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); letter-spacing: .04em; }
.chart .c-axis { font-size: 9px; fill: var(--muted); }
.chart .c-strong { fill: var(--ink); font-weight: 700; }
.c-grid { stroke: var(--line); stroke-dasharray: 3 3; }
.c-base { stroke: var(--ink); stroke-width: 1.5; }
.c-in { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.c-out { fill: var(--ink); }
.c-now { fill: var(--accent); }
.c-proj { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 2; }
.legend { display: flex; gap: 16px; margin-top: 6px; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; display: inline-block; }
.lg-in { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.lg-out { background: var(--ink); }
.lg-proj { background: var(--card); border: 1.2px dashed var(--ink); }

/* ---------- transactions ---------- */
.toolbar { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(120px, 1fr)); gap: 8px; }
.day + .day { border-top: 1px solid var(--line); }
.day-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: var(--paper-3);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.day .rows { padding: 0 12px; }

/* ---------- budgets ---------- */
.budget-big { display: flex; align-items: flex-end; gap: 10px; margin: 14px 0 12px; }
.bucket { padding: 12px 0 2px; }
.bucket + .bucket { border-top: 1px solid var(--line); }
.bucket-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12px; }
.bucket-top b { font-weight: 600; }
.bucket-top .muted, .bucket-top span { font-family: var(--mono); font-size: 10.5px; }
.bucket .fhelp { margin-top: 5px; }

/* ---------- goals ---------- */
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.gcard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--ink);
}
.gcard-top { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; }
.gcard-top .sw { margin-top: 3px; }
.gcard-v { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; }
.gcard .note { margin: 0; }

/* ---------- accounts ---------- */
.acards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.acard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--ink);
  box-shadow: inset 0 3px 0 var(--acc);
}
.acard.is-off { opacity: .6; }
.acard-top { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; }
.acard-top .sw { margin-top: 3px; }
.acard-bal { padding: 6px 0 2px; }
.acard-actions { display: flex; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- bill planner ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.cal-dow { padding: 0 4px 2px; font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.cal-day { display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 84px; padding: 4px; background: var(--card); border: 1px solid var(--line); }
.cal-day.is-weekend { background: var(--paper); }
.cal-day.is-pad { background: transparent; border-color: transparent; }
.cal-day.is-today { border: 1.5px solid var(--ink); box-shadow: inset 0 3px 0 var(--accent); }
.cal-n { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--ink-2); }
.is-today .cal-n { color: var(--accent); }
.cal-chip {
  position: relative;
  display: block;
  width: 100%;
  padding: 2px 4px;
  background: var(--card);
  border: 1px solid var(--ink);
  font: 600 10px/1.35 var(--sans);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.cal-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip:hover { box-shadow: 2px 2px 0 var(--ink); }
.cal-chip.s-paid { background: var(--ink); color: #fff; }
.cal-chip.s-overdue { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-chip.s-soon { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cal-chip.s-auto, .cal-chip.s-before, .cal-chip.s-paylater { border-style: dashed; color: var(--ink-2); }
.cal-legend { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; margin-left: 8px; border: 1px solid var(--ink); background: var(--card); }
.cal-legend i.s-paid { background: var(--ink); }
.cal-legend i.s-overdue { background: var(--accent); border-color: var(--accent); }
.bill-row { align-items: flex-start; padding: 10px 2px; }
.bill-row .row-end { gap: 6px; }
.bill-tags { display: flex; margin-top: 3px; }
.bill-acts { display: flex; align-items: center; gap: 4px; }
.bill-row.s-overdue { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
.bill-row.s-paid .row-main b::before { content: '✓ '; }
.due-strip { box-shadow: inset 3px 0 0 var(--accent); }
.row-sub.warn { font-weight: 600; }

/* ---------- reconciliation ---------- */
.clr {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.5px solid var(--ink);
  font-size: 10px;
  line-height: 1;
  color: var(--ink);
}
.clr.is-rec { background: var(--ink); color: #fff; }
.acard-rec { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.acard-rec a { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
a.tab { display: inline-block; color: var(--ink); text-decoration: none; }
a.tab.is-active { color: #fff; }
.rec-row { cursor: pointer; }
.rec-row input { width: 16px; height: 16px; flex: none; margin: 0; accent-color: var(--ink); }
.rec-row.is-on { background: var(--paper-3); }
.rec-row:hover { background: var(--paper-3); }
.rec-date { width: 48px; flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); }
.rec-all { display: inline-flex; gap: 14px; text-transform: none; letter-spacing: 0; }
.rec-all .linkbtn { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.day.is-later .rows { opacity: .7; }
.rec-fields { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.rec-side .btn-ink { width: 100%; margin-top: 12px; }
.clr-checks { display: flex; flex-direction: column; gap: 8px; }
.clr-checks [hidden], .dlg .check[hidden] { display: none; }

/* ---------- bank statement import ---------- */
.imp-cleared { align-self: end; min-height: 38px; }
.imp-map { border: 1px solid var(--line); background: var(--card); }
.imp-map summary { padding: 10px 12px; cursor: pointer; font-weight: 700; color: var(--ink); }
.imp-map[open] summary { border-bottom: 1px solid var(--line); }
.imp-map .fgrid { padding: 12px; }
.imp-sum { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.imp-sum b { color: var(--ink); font-weight: 600; }
.imp-scroll { max-height: 46vh; overflow: auto; border: 1px solid var(--line); background: var(--card); }
.imp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.imp-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  background: var(--paper-3);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: left;
  text-transform: uppercase;
}
.imp-table td { padding: 6px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.imp-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ink); }
.imp-table .num { text-align: right; white-space: nowrap; }
.imp-table .nowrap { white-space: nowrap; }
.imp-table small { color: var(--muted); font-size: 10px; }
.imp-table tr.is-off td { opacity: .45; }
.imp-table tr.is-off td:first-child { opacity: 1; }
.imp-desc { min-width: 220px; overflow-wrap: anywhere; }
.imp-desc .badge { margin-left: 4px; }
.in.sm-in { height: 30px; min-width: 150px; padding: 0 8px; font-size: 11.5px; }

/* ---------- categories ---------- */
.cgroup + .cgroup { margin-top: 14px; }
.cgroup > .cap { display: block; margin: 12px 0 8px; font-weight: 700; color: var(--ink); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cgrid.one { grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
.ccard {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.ccard:hover { border-color: var(--ink); }
.ccard .edit { color: var(--muted); }

/* ---------- subscriptions ---------- */
.datebox {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 38px;
  flex: none;
  padding: 3px 0;
  border: 1.5px solid var(--ink);
  font-family: var(--mono);
  line-height: 1.1;
}
.datebox small { font-size: 7.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.datebox b { font-size: 14px; }

/* ---------- PayLater ---------- */
.tabs { display: flex; flex-wrap: wrap; border: 1.5px solid var(--ink); }
.tab { padding: 7px 14px; background: var(--card); border: 0; border-right: 1px solid var(--ink); font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.tab:last-child { border-right: 0; }
.tab.is-active { background: var(--ink); color: #fff; }
.bill-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bill-name { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.bill-total { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.bill-total.is-late .pxm { color: var(--accent); }
.bill-due { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.bill-group { padding-top: 14px; }
.bill-group > .cap { display: block; margin-bottom: 4px; font-weight: 700; color: var(--ink); }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; padding-bottom: 0; }
.setrow b { font-size: 12.5px; font-weight: 600; }
.setrow .fhelp { max-width: 56ch; }
.inrow { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 6px; }
.in.narrow-in { width: 90px; flex: none; }
.mini { display: flex; flex-direction: column; gap: 4px; width: 84px; }
.mini .cap { font-size: 8px; }
.save-row { display: flex; }
/* Finance settings: label on the left, its control in one column on the right */
.fin-settings .setrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 28px; }
.fin-settings .setrow > div { min-width: 0; }
.fin-settings .setrow b { display: block; margin-bottom: 3px; }
.fin-settings .setrow.is-stacked { grid-template-columns: minmax(0, 1fr); align-items: start; }
.fin-settings .setrow.is-stacked > :last-child { justify-self: start; }
.fin-settings .inrow { justify-content: flex-end; align-items: flex-end; }
.fin-settings .is-stacked .inrow { justify-content: flex-start; }
.fin-settings .mini .in, .fin-settings form .btn-ghost { height: 36px; }
.inrow.nowrap { flex-wrap: nowrap; }
.in.date-in { width: 168px; flex: none; }
.set-unit { align-self: center; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.set-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-bottom: 3px solid var(--ink); }
.panel.danger { border-color: var(--accent); }
.panel.danger .panel-head { color: var(--accent); }
.file-btn { position: relative; }

/* ---------- form controls ---------- */
.in {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
}
textarea.in { height: auto; padding: 8px 10px; resize: vertical; }
select.in {
  appearance: none;
  padding-right: 28px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231c1b1f' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  cursor: pointer;
}
.in:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.in:disabled { opacity: .55; }
.in-amount { height: 52px; font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.ffield { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ffield > .cap { font-weight: 600; color: var(--ink); }
.ffield[hidden] { display: none; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fgrid .wide { grid-column: 1 / -1; }
.fhelp { margin: 0; font-size: 10.5px; line-height: 1.5; color: var(--ink-2); }
.fhelp .neg, .fhelp b.neg { color: var(--accent); }
.ferr { margin: -6px 0 0; font-family: var(--mono); font-size: 10px; color: var(--accent); }
/* styles.css draws .check as the planogram's round tick; here it is a label with a checkbox */
.check { display: flex; align-items: center; gap: 8px; width: auto; height: auto; border: 0; border-radius: 0; font-size: 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.ofn { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 16px; }
.ofn .in { width: 70px; text-align: center; }

.seg { display: flex; border: 1.5px solid var(--ink); }
.seg-btn { flex: 1; position: relative; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--ink); }
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn span {
  display: block;
  padding: 9px 6px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}
.seg-btn input:checked + span { background: var(--ink); color: #fff; }
.seg-btn input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -4px; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swp { position: relative; cursor: pointer; }
.swp input { position: absolute; opacity: 0; }
.swp span { display: block; width: 26px; height: 26px; background: var(--sw); border: 2px solid var(--card); outline: 1px solid var(--line); }
.swp input:checked + span { outline: 2px solid var(--ink); }
.swp input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- dialogs ---------- */
.dlg-back {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 7vh 16px 24px;
  overflow-y: auto;
  background: rgba(28, 27, 31, .38);
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.dlg {
  width: 100%;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(28, 27, 31, .9);
  animation: rise .18s cubic-bezier(.3, .7, .2, 1);
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 12px; border-bottom: 2px solid var(--ink); }
.dlg-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.dlg-body { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.dlg-text { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.dlg-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; background: var(--paper-2); border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 14px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  box-shadow: 0 10px 24px rgba(28, 27, 31, .25);
  transform: translate(-50%, calc(100% + 30px)); /* fully below the edge, shadow included */
  transition: transform .2s cubic-bezier(.3, .7, .2, 1);
}
#toast.show { transform: translate(-50%, 0); }
#toast button { padding: 4px 9px; background: var(--accent); border: 0; color: #fff; font: inherit; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }

/* hide amounts from anyone looking at the screen */
.money { transition: filter .28s ease; }
body.is-masked .money { filter: blur(7px); user-select: none; }

/* toast: a bar that runs out with it */
#toast .toast-bar { position: absolute; left: 0; bottom: 0; width: 100%; height: 2px; background: var(--accent); transform-origin: left; animation: toast-run linear forwards; }
@keyframes toast-run { to { transform: scaleX(0); } }

/* buttons lift under the pointer and press down when clicked */
.btn-ink, .btn-ghost, .btn-danger { transition: background .12s, color .12s, transform .12s ease, box-shadow .12s ease; }
.btn-ink:not(:disabled):hover, .btn-ghost:not(:disabled):hover, .btn-danger:not(:disabled):hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--accent); }
.btn-ink:not(:disabled):active, .btn-ghost:not(:disabled):active, .btn-danger:not(:disabled):active { transform: translate(1px, 1px); box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  .money, .btn-ink, .btn-ghost, .btn-danger { transition: none; }
  #toast .toast-bar { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .cols.wide-left { grid-template-columns: minmax(0, 1fr); }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .metrics, .metrics.m3, .fgrid { grid-template-columns: minmax(0, 1fr); }
  .today { padding: 16px; }
  .today-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .toolbar { grid-template-columns: minmax(0, 1fr); }
  .quick { flex-wrap: wrap; }
  .quick-label { width: 100%; padding: 8px 12px; border-right: 0; border-bottom: 1px solid #3e3d44; }
  .setrow { flex-direction: column; align-items: flex-start; gap: 10px; }
  .fin-settings .setrow { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .fin-settings .inrow { justify-content: flex-start; }
  .set-actions { flex-direction: column; align-items: stretch; }
  .row { flex-wrap: wrap; }
  .pnav-label { min-width: 0; }
  .dlg-back { padding-top: 16px; }
  .rec-cols > .rec-side { order: -1; }
  /* phone calendar: a coloured mark per bill, names in the list below */
  .cal { gap: 2px; }
  .cal-dow { padding: 0; font-size: 7.5px; letter-spacing: .04em; text-align: center; }
  .cal-day { min-height: 44px; padding: 3px; gap: 2px; }
  .cal-chip { height: 7px; padding: 0; }
  .cal-chip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cal-legend i { margin-left: 4px; }
}

.panel-head .money { text-transform: none; letter-spacing: .02em; }

/* Supabase tables not created yet */
.sync-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1500;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  box-shadow: 6px 6px 0 rgba(28, 27, 31, .85);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
}
.sync-banner b { font-weight: 600; }
.sync-banner code { padding: 1px 5px; background: var(--card); font-family: var(--mono); font-size: 11px; }
