/* Kwenta: calm, trustworthy, numbers first. Deep ledger green with a gold rule, white paper surfaces, tabular figures.
   No web fonts are fetched: the system UI face, with tabular numerals for every amount. Light and dark are both chosen,
   not inverted. */
:root {
  color-scheme: light;
  --bg: #F3F6F5; --surface: #FFFFFF; --surface-2: #F6F8F7; --sunk: #EBF0EE; --ink: #10201B; --ink-2: #41524C; --muted: #66766F;
  --line: #DCE4E0; --line-2: #C9D4CF; --brand: #0E5E4E; --brand-ink: #FFFFFF; --brand-soft: #E3F1EC; --brand-text: #0B5143;
  --gold: #B8862A; --gold-soft: #FBF3E2; --pos: #17704A; --neg: #B42318; --warn: #A15C07; --warn-soft: #FEF4E2; --neg-soft: #FDECEA; --info-soft: #E8F1FC; --info: #1F5FAE;
  --s1: #2a78d6; --s2: #eb6834; --grid: #E6ECE9;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 32, 27, .06), 0 2px 8px rgba(16, 32, 27, .05);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --side: 248px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C1311; --surface: #131C19; --surface-2: #17221F; --sunk: #0F1715; --ink: #E6EEEA; --ink-2: #B7C5BF; --muted: #8A9A94;
  --line: #24312D; --line-2: #2F3E39; --brand: #3AA889; --brand-ink: #06110E; --brand-soft: #16302A; --brand-text: #7FD3B8;
  --gold: #E0B04A; --gold-soft: #2A2416; --pos: #4CC38A; --neg: #F0705F; --warn: #E9A23B; --warn-soft: #2B2214; --neg-soft: #2E1815; --info-soft: #14243A; --info: #7DB2F0;
  --s1: #3987e5; --s2: #d95926; --grid: #22302B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; } h2 { font-size: 18px; font-weight: 650; } h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
.num, td.n, th.n, .kpi .v { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--surface) calc(var(--side) - 1px), var(--line) calc(var(--side) - 1px), var(--line) var(--side), transparent var(--side)); }
.side { position: sticky; top: 0; height: 100vh; overflow: auto; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 4px; }
.brandrow { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; text-decoration: none; color: var(--ink); }
.brandrow svg { width: 34px; height: 34px; flex: none; }
.brandrow b { font-size: 20px; letter-spacing: -.02em; } .brandrow small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 520; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); font-weight: 650; }
.nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 4px; }
.side .foot { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 58px; }
.top .title { font-weight: 650; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .grow { flex: 1; }
.bizsw { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; max-width: 280px; min-width: 0; cursor: pointer; }
.bizsw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; font-size: 14px; }
.content { padding: 22px 24px 96px; max-width: 1240px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.tabbar { display: none; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 8px 14px; min-height: 40px; font-weight: 580; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--neg); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row > select, .row > input:not([type=checkbox]) { width: auto; max-width: 100%; }
.pagehead > .row { flex-wrap: wrap; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 560; color: var(--ink-2); min-width: 0; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=month], input:not([type]), select, textarea {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 8px 10px; min-height: 40px; width: 100%; min-width: 0; font-size: 15px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
input.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 6px 12px; font-weight: 560; font-size: 13.5px; color: var(--ink-2); cursor: pointer; min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; background: var(--surface); cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input { margin-top: 3px; accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.choice b { display: block; font-size: 15px; } .choice span { color: var(--muted); font-size: 13px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card h2 + p, .card h3 + p { margin-top: 4px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cards { display: grid; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; text-decoration: none; color: inherit; display: block; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 560; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.accent { border-top: 3px solid var(--gold); }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.dash > * { min-width: 0; }
.dash, .dash .cards { align-items: start; align-content: start; }
.qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qa .btn { justify-content: flex-start; min-height: 46px; white-space: normal; text-align: left; line-height: 1.2; }
.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.alert .ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); } .alert.warn .ic { background: var(--warn); color: #fff; }
.alert.bad { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); } .alert.bad .ic { background: var(--neg); color: #fff; }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); } .alert.info .ic { background: var(--info); color: #fff; }
.alert.ok .ic { background: var(--pos); color: #fff; }
.alert a { font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--neg-soft); color: var(--neg); }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.verify { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.sample { background: repeating-linear-gradient(135deg, var(--gold-soft) 0 12px, transparent 12px 24px); border: 1px dashed var(--gold); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.disclaimer { font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--gold); padding: 6px 12px; background: var(--surface-2); border-radius: 0 8px 8px 0; margin: 14px 0 0; }

/* tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-width: 100%; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
tr.tot td { font-weight: 700; border-top: 2px solid var(--line-2); background: var(--surface-2); }
tr.sub td { font-weight: 650; }
tr.head td { font-weight: 700; background: var(--sunk); color: var(--ink-2); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
td.ind { padding-left: 26px; }
tr.click { cursor: pointer; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; stroke: var(--line-2); fill: none; stroke-width: 1.5; }

/* form worksheet */
.ws td.no { width: 70px; font-weight: 700; color: var(--brand-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ws .calc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ws tr.strong td { font-weight: 700; background: var(--brand-soft); }
.lines td { padding: 6px; } .lines input, .lines select { min-height: 36px; font-size: 14px; padding: 6px 8px; }
.lines .del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 4px 8px; }
.totals { display: grid; grid-template-columns: auto auto; gap: 4px 18px; justify-content: end; font-variant-numeric: tabular-nums; margin-top: 12px; }
.totals div:nth-child(odd) { color: var(--muted); text-align: right; } .totals div:nth-child(even) { text-align: right; font-weight: 600; }
.totals .big { font-size: 18px; font-weight: 750; color: var(--ink); }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11.5px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 2px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow); font-variant-numeric: tabular-nums; max-width: 240px; }
.bars .bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; margin-bottom: 10px; font-size: 13.5px; }
.bars .track { grid-column: 1 / -1; height: 10px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); }

/* modal and toast */
#modal-root .back { position: fixed; inset: 0; background: rgba(8, 16, 13, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; }
.modal.wide { width: min(1000px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 90; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* setup wizard */
.wiz { max-width: 760px; margin: 0 auto; padding: 28px 18px 60px; }
.wiz .steps { display: flex; gap: 6px; margin: 16px 0 22px; }
.wiz .steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.wiz .steps i.on { background: var(--brand); }
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: center; margin-top: 10px; }
.hero h1 { font-size: 34px; letter-spacing: -.03em; }
.hero .lead { font-size: 17px; color: var(--ink-2); margin: 12px 0 18px; }
.points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.points li { padding-left: 26px; position: relative; color: var(--ink-2); }
.points li:before { content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 4px; background: var(--brand); box-shadow: inset 0 -3px 0 var(--gold); }

/* paper (print previews) */
.paper { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 6px; padding: 28px 30px; box-shadow: var(--shadow); font-size: 13px; overflow-x: auto; }
.paper h2, .paper h3 { color: #111; } .paper .muted { color: #555; }
.paper table { font-size: 12.5px; } .paper th { background: #f2f2f2; color: #333; position: static; } .paper td, .paper th { border-color: #ddd; padding: 5px 7px; }
.paper .ctr { text-align: center; } .paper .formhead { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 12px; }
.paper .box { border: 1px solid #999; padding: 6px 8px; min-height: 30px; }
.paper .stamp { display: inline-block; border: 2px solid #b8862a; color: #8a6418; font-weight: 800; padding: 2px 8px; transform: rotate(-4deg); letter-spacing: .1em; }
.sig { margin-top: 36px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
.sig div { border-top: 1px solid #333; padding-top: 4px; font-size: 11.5px; text-align: center; }
.afs h2 { text-align: center; } .afs .co { text-align: center; font-weight: 700; font-size: 15px; } .afs .per { text-align: center; color: #444; margin-bottom: 14px; }
.afs td.n { width: 140px; } .afs tr.tot td { border-top: 1px solid #111; border-bottom: 3px double #111; background: none; }

/* responsive */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 30% 0 0; z-index: 70; height: 100%; box-shadow: 0 0 40px rgba(0, 0, 0, .3); min-width: 260px; }
  .top { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .content { padding: 14px 12px 110px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border: 0; background: none; min-height: 56px; justify-content: center; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] { color: var(--brand-text); }
  .tabbar .rec { color: var(--brand-ink); }
  .tabbar .rec span.dot { background: var(--brand); border-radius: 14px; width: 44px; height: 32px; display: grid; place-items: center; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; } .kpi .v { font-size: 19px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; }
  .g4.keep2, .g3.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr); } .hero h1 { font-size: 28px; }
  h1 { font-size: 21px; }
  .card { padding: 14px; }
  .bizsw { max-width: 170px; }
  .paper { padding: 16px 14px; }
  .modal { padding: 16px; border-radius: 14px; }
  .lines thead { display: none; } .lines tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .lines td { border: 0; padding: 0; } .lines td.wide { grid-column: 1 / -1; }
  .qa { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hide-m { display: none !important; }
  .top .title { font-size: 15px; }
}
@media (max-width: 380px) { .kpi .v { font-size: 17px; } .btn { padding: 8px 11px; } }

/* print: only the paper being printed */
@media print {
  body { background: #fff; }
  #app, #modal-root, #toast { display: none !important; }
  #print-root { display: block !important; }
  #print-root .paper { border: 0; box-shadow: none; padding: 0; overflow: visible; }
  @page { margin: 14mm; }
  .pb { page-break-after: always; }
}
#print-root { display: none; }

/* columnar journals */
table.cj td:nth-child(1), table.cj td:nth-child(2) { white-space: nowrap; }
table.cj td:nth-child(3) { min-width: 180px; }

/* Premium (ui/premium.js): the star on premium items, the read-only banner for a business past the free limit */
.star { font-style: normal; color: #C99312; font-size: 12px; margin-left: auto; padding-left: 6px; }
.btn .star { margin-left: 2px; padding-left: 0; }
.robanner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 14px clamp(12px, 2.4vw, 24px) 0; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: 14px; }
.robanner > div { flex: 1 1 260px; min-width: 0; }
.premium-card { max-width: 680px; }

/* cloud backups (ui/cloud.js): the device under the date where the Device column is hidden */
.cdev-m { display: none; }
@media (max-width: 860px) { .cdev-m { display: block; } }

/* reminders (ui/reminders.js): the deadline rows, the settings checkboxes */
.rlist { display: grid; }
.rrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rrow:last-child { border-bottom: 0; }
.rrow .rmain { min-width: 0; flex: 1 1 180px; }
.rrow .ract { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.rfs { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0 0; padding: 8px 12px 10px; display: grid; gap: 4px; }
.rfs legend { font-weight: 650; font-size: 13.5px; padding: 0 4px; }
label.chk { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; font-size: 14.5px; }
label.chk input { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.nav a.tndlink { color: var(--gold); font-weight: 650; }
.tndcta { margin-top: 16px; padding: 14px; border-radius: 12px; border: 1px dashed var(--gold); background: var(--gold-soft); display: grid; gap: 10px; }
.tndcta b { display: block; } .tndcta span { color: var(--ink-2); font-size: 14px; }

/* Tindahan mode (ui/tindahan.js): big targets for cheap phones, a peso keypad, plain numbers */
.tnd { min-height: 100vh; }
.tnd-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tnd-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; flex: 1 1 160px; min-height: 48px; }
.tnd-brand svg { width: 36px; height: 36px; flex: none; }
.tnd-brand span { min-width: 0; } .tnd-brand b { display: block; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tnd-brand small { display: block; font-size: 11.5px; color: var(--muted); }
.tnd-lang button { min-height: 40px; }
.tnd-main { max-width: 980px; margin: 0 auto; padding: 14px 16px 64px; display: grid; gap: 14px; }
.tnd-main > .card + .card { margin-top: 0; }
.tnd-head { display: flex; align-items: center; gap: 10px; }
.tnd-head h1 { font-size: 24px; } .tnd-head p { margin: 2px 0 0; }
.tnd-back { min-height: 48px; padding: 6px 10px; flex: none; }
.tnd-main .btn { min-height: 48px; font-size: 15px; }
.tnd-main .btn.sm { min-height: 40px; font-size: 14px; }
.tnd-main .btn svg, .tnd-main .tbtn svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tnd-seg { display: flex; width: 100%; } .tnd-seg button { flex: 1 1 0; min-height: 46px; font-size: 15px; }
.tstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tstats > * { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: inherit; min-width: 0; box-shadow: var(--shadow); }
.tstats span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 560; }
.tstats b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstats.one { grid-template-columns: minmax(0, 1fr); } .tstats.one b { font-size: 28px; }
.tstats.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tstats .good b { color: var(--pos); } .tstats .neg b { color: var(--neg); }
.tgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tbtn { display: flex; align-items: center; gap: 12px; min-height: 92px; padding: 14px; border-radius: 16px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-left: 6px solid var(--c, var(--brand)); }
.tbtn:active { transform: translateY(1px); }
.tbtn .ti { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--brand)) 15%, transparent); color: var(--c, var(--brand)); flex: none; }
.tbtn .ti svg { width: 28px; height: 28px; }
.tbtn b { display: block; font-size: 19px; line-height: 1.15; } .tbtn small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.tb-g { --c: #17704A; } .tb-r { --c: #C2410C; } .tb-a { --c: #A15C07; } .tb-b { --c: #1F5FAE; } .tb-y { --c: #8A6418; } .tb-v { --c: #6D28D9; } .tb-n { --c: #41524C; }
:root[data-theme="dark"] .tb-g { --c: #4CC38A; } :root[data-theme="dark"] .tb-r { --c: #F08A5D; } :root[data-theme="dark"] .tb-a { --c: #E9A23B; } :root[data-theme="dark"] .tb-b { --c: #7DB2F0; } :root[data-theme="dark"] .tb-y { --c: #E0B04A; } :root[data-theme="dark"] .tb-v { --c: #B79CF5; } :root[data-theme="dark"] .tb-n { --c: #B7C5BF; }
.tlist { display: grid; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 52px; }
.trow:last-child { border-bottom: 0; }
.trow > span:first-child, .trow > a:first-child { min-width: 0; flex: 1 1 auto; text-decoration: none; color: inherit; }
.trow small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.trow b { font-variant-numeric: tabular-nums; }
.tamt { display: flex; gap: 6px; align-items: center; flex: none; }
.tnd-foot { justify-content: space-between; }
.tbenta, .tform { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.ibtn { position: relative; min-height: 64px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); text-align: left; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 2px; }
.ibtn span { font-size: 14px; font-weight: 560; line-height: 1.2; } .ibtn b { font-size: 15px; color: var(--brand-text); font-variant-numeric: tabular-nums; }
.ibtn .q { position: absolute; top: -6px; right: -6px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--brand); color: var(--brand-ink); font-style: normal; font-weight: 750; display: grid; place-items: center; font-size: 13px; padding: 0 6px; }
.kp { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.kp-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; margin-bottom: 10px; }
.kp-lab { grid-column: 1 / -1; font-size: 13px; color: var(--muted); font-weight: 600; }
.kp-amt { font-size: 34px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-c { min-width: 56px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 700; font-size: 17px; cursor: pointer; }
.kp-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kp-keys button { min-height: 58px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 25px; font-weight: 650; cursor: pointer; font-variant-numeric: tabular-nums; touch-action: manipulation; }
.kp-keys button:active, .kp-c:active { background: var(--brand-soft); }
.tadd { width: 100%; margin-top: 8px; }
.tsave { width: 100%; min-height: 56px !important; font-size: 17px !important; margin-top: 8px; white-space: normal; }
.tcart h2 { font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tq { display: flex; align-items: center; gap: 6px; } .tq b { min-width: 24px; text-align: center; } .tq .btn { min-width: 40px; padding: 4px; }
.tq .btn svg { width: 18px; height: 18px; }
.tsuki { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; } .tsuki label.f:last-child { grid-column: 1 / -1; }
.tnd-date { margin: 10px 0 4px; font-size: 14px; } .tnd-date summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .tnd-date label { margin-top: 6px; }
.chips { border: 0; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; } .chips legend { font-weight: 650; font-size: 14px; margin-bottom: 6px; padding: 0; }
.chips label { position: relative; } .chips input { position: absolute; opacity: 0; inset: 0; }
.chips span { display: inline-flex; align-items: center; min-height: 46px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 560; font-size: 14.5px; cursor: pointer; }
.chips input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chips input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.kexp p { margin: 0 0 4px; } .kbig { font-size: 18px; } .kres { font-size: 20px; font-weight: 700; min-height: 28px; }
.tper { justify-content: space-between; } .tper b { font-size: 15px; text-align: center; flex: 1; }
.tper .btn svg { width: 20px; height: 20px; }
.twords { font-size: 16.5px; line-height: 1.55; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; }
.tlinks { display: flex; flex-wrap: wrap; gap: 8px; }
.tnotes { padding-left: 18px; line-height: 1.55; font-size: 14px; display: grid; gap: 8px; margin: 8px 0; }
@media (max-width: 860px) {
  .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbenta, .tform { grid-template-columns: minmax(0, 1fr); }
  .tstats.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tnd-main { padding: 12px 16px 48px; }
}
@media (max-width: 380px) {
  .tbtn { min-height: 84px; padding: 10px; gap: 8px; } .tbtn .ti { width: 40px; height: 40px; } .tbtn b { font-size: 17px; } .tbtn small { font-size: 12px; }
  .tstats b { font-size: 16px; } .tstats > * { padding: 8px 9px; }
  .tnd-top { padding: 6px 12px; } .tnd-main { padding: 12px 12px 48px; }
}
.rbtns .btn { white-space: normal; max-width: 100%; text-align: left; }
.tbar { position: sticky; bottom: 0; z-index: 15; margin: 0 -16px; padding: 8px 16px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.tbar p:empty { display: none; }
.tbar-in { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; max-width: 980px; margin: 0 auto; }
.tbar-in small { display: block; color: var(--muted); font-size: 12px; } .tbar-in b { font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbar .tsave { margin-top: 0; }
@media (max-width: 380px) { .tbar { margin: 0 -12px; padding-left: 12px; padding-right: 12px; } }
.trow > b, .tamt b { white-space: nowrap; }
