/* ---------- Tokens ---------- */
:root {
  --bg: #eef2f5; --surface: #fff; --surface-2: #f5f8fa; --text: #14202b; --muted: #637381; --border: #e1e7ec;
  --brand: #0b5c6e; --brand-2: #0e7490; --brand-soft: #e0f1f5; --on-brand: #fff;
  --in: #0a6fb4; --out: #b4300f; --ok: #0b6b3a; --ok-bg: #e3f6ec; --err: #b42318; --err-bg: #fde8e6;
  --info: #1d4f91; --info-bg: #e6f0fb;
  --radius: 14px; --dock-h: 62px; --side-w: 232px;
  --shadow: 0 2px 10px rgba(16, 40, 56, .08);
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0c1317; --surface: #151e24; --surface-2: #1b262d; --text: #e8eef2; --muted: #93a3af; --border: #263540;
  --brand: #0e3f4c; --brand-2: #14788f; --brand-soft: #123642; --on-brand: #e8f6fa;
  --in: #4db3f0; --out: #ff8a6b; --ok: #6ee7a0; --ok-bg: #12301f; --err: #ffb4ab; --err-bg: #3a1714;
  --info: #9cc6f5; --info-bg: #13283d; --shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1317; --surface: #151e24; --surface-2: #1b262d; --text: #e8eef2; --muted: #93a3af; --border: #263540;
    --brand: #0e3f4c; --brand-2: #14788f; --brand-soft: #123642; --on-brand: #e8f6fa;
    --in: #4db3f0; --out: #ff8a6b; --ok: #6ee7a0; --ok-bg: #12301f; --err: #ffb4ab; --err-bg: #3a1714;
    --info: #9cc6f5; --info-bg: #13283d; --shadow: 0 2px 10px rgba(0, 0, 0, .4);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.auth { display: grid; place-items: center; min-height: 100vh; }
body.auth .container { width: 100%; padding: 1rem; }
a { color: var(--brand-2); }
h1 { font-size: 1.35rem; margin: .25rem 0 .5rem; }
h2 { font-size: .95rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hint { color: var(--muted); font-size: .8rem; margin: 0 0 .75rem; }
.num { font-variant-numeric: tabular-nums; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; }

/* ---------- Shell (mobile first) ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 14px); }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: calc(.55rem + env(safe-area-inset-top)) .9rem .55rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--on-brand);
}
.topbar .title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.topbar strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar small { opacity: .8; font-size: .75rem; }
.actions { display: flex; gap: .15rem; }
.iconbtn { background: none; border: 0; color: inherit; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.iconbtn:active { background: rgba(255, 255, 255, .18); }

.container { max-width: 760px; margin: 0 auto; padding: .75rem; }

/* ---------- Summary card ---------- */
.summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .65rem .9rem .8rem; margin-bottom: .6rem; }
.summary-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.summary-head span { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.summary-head strong { font-size: 1.25rem; }
.summary-body { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; padding-top: .55rem; }
.stat { display: flex; flex-direction: column; flex: 1; }
.stat small { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.stat b { font-size: 1.15rem; }
.stat.in { color: var(--in); } .stat.out { color: var(--out); align-items: flex-end; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 46px; }
.bars i { width: 14px; border-radius: 3px; display: block; min-height: 4px; }
.b-in { background: var(--in); } .b-out { background: var(--out); }

.networth { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .6rem; }
.networth div { background: var(--surface); border-radius: 12px; padding: .45rem .65rem; box-shadow: var(--shadow); }
.networth small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.networth b { font-size: .98rem; }

/* ---------- Compact account groups ---------- */
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .6rem; overflow: hidden; }
.group > header { display: flex; justify-content: space-between; align-items: center; padding: .4rem .9rem; background: var(--surface-2); }
.group h2 { margin: 0; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.group > header .num { font-size: .8rem; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: 0 .9rem; min-height: 42px; border-top: 1px solid var(--border); }
.row .name { font-size: .95rem; } .row .sub { display: block; font-size: .72rem; color: var(--muted); }
.row .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.row .amt.neg { color: var(--out); }
.empty-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .9rem; color: var(--muted); font-size: .85rem; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; color: var(--brand-2); cursor: pointer; white-space: nowrap; }

/* ---------- Cards, forms, buttons ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem; margin: 0 0 .75rem; }
.two-col { display: grid; gap: .75rem; }
.auth-card { max-width: 400px; margin: 0 auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.auth-card h1 { margin-top: 0; }

label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .7rem; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
input[type=checkbox] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
textarea { resize: vertical; min-height: 3.2rem; }
.btn { display: inline-block; padding: .65rem 1.1rem; font-weight: 600; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-height: 42px; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.block { display: block; width: 100%; margin: .4rem 0 .9rem; }

.flash { padding: .6rem .85rem; border-radius: 10px; margin-bottom: .7rem; font-size: .9rem; }
.flash.success { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); color: var(--info); }

/* ---------- Bottom dock (mobile) ---------- */
.dock {
  position: fixed; z-index: 30; left: .6rem; right: .6rem; bottom: calc(.5rem + env(safe-area-inset-bottom));
  display: flex; height: var(--dock-h); background: var(--surface); border-radius: 22px;
  box-shadow: 0 6px 24px rgba(10, 30, 45, .22); border: 1px solid var(--border); max-width: 560px; margin: 0 auto;
}
.dock a, .dock button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: none; border: 0; color: var(--muted); font-size: .66rem; letter-spacing: .02em; text-decoration: none; cursor: pointer; border-radius: 18px;
}
.dock .ic { width: 24px; height: 24px; }
.dock .active { color: var(--brand-2); font-weight: 700; }
.dock .in { color: var(--in); } .dock .out { color: var(--out); }
.dock a:active, .dock button:active { background: var(--surface-2); }

/* ---------- More sheet ---------- */
.sheet { border: 0; padding: .6rem .8rem calc(1rem + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border); margin: 0 auto .7rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.sheet-grid a, .sheet-grid button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: .6rem .2rem; font-size: .72rem; background: none; border: 0; border-radius: 12px; color: var(--text); text-decoration: none; cursor: pointer; width: 100%; }
.sheet-grid a:active, .sheet-grid button:active { background: var(--surface-2); }
.sheet-grid form { display: contents; }
.sheet-grid .ic { color: var(--brand-2); width: 24px; height: 24px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 1.4rem + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); background: #14202b; color: #fff; padding: .5rem .9rem; border-radius: 999px; font-size: .85rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); padding: .9rem .7rem; }
  .logo { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem 1rem; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.1rem; }
  .mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
  .sidebar nav, .side-foot { display: flex; flex-direction: column; gap: 2px; }
  .side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: .5rem; }
  .sidebar a, .sidebar button { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .7rem; border: 0; background: none; border-radius: 10px; color: var(--text); text-decoration: none; font-size: .93rem; cursor: pointer; text-align: left; }
  .sidebar a:hover, .sidebar button:hover { background: var(--surface-2); }
  .sidebar a.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
  .sidebar .soon { color: var(--muted); }
  .main { padding-bottom: 1.5rem; }
  .topbar { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); padding: .7rem 1.5rem; }
  .topbar small { color: var(--muted); opacity: 1; }
  .iconbtn:active { background: var(--surface-2); }
  .container { max-width: 980px; padding: 1.25rem 1.5rem; }
  .dock { display: none; }
  .two-col { grid-template-columns: 1fr 1fr; }
  #toast { bottom: 1.5rem; }
}

/* ---------- Segment 2: accounts, groups, categories, books ---------- */
.neg { color: var(--out) !important; }
.topbar small .bookswitch { color: inherit; text-decoration: none; }
a.row { color: inherit; text-decoration: none; }
a.row:active { background: var(--surface-2); }
.group-foot { padding: .35rem .9rem .5rem; border-top: 1px solid var(--border); }
.footlinks { text-align: center; font-size: .85rem; color: var(--muted); margin: .5rem 0 1rem; }
.chip.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.chip.danger { color: var(--out); }
.chip:disabled { opacity: .4; cursor: default; }
a.chip { text-decoration: none; display: inline-block; }

.form .two, .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.two > * { min-width: 0; }
input[type=date], input[type=time], input[type=file] { min-width: 0; max-width: 100%; }
.form h2 { margin-bottom: .6rem; }
.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 1rem; }
.btnrow form { display: contents; }
.btn { text-decoration: none; text-align: center; }
[data-only] { display: none; }
[data-only].show { display: block; }

.bigbal { font-size: 1.9rem; font-weight: 700; padding: .35rem 0 .15rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-top: 1px solid var(--border); font-size: .9rem; }
.kv:first-of-type { border-top: 0; }
.kv span { color: var(--muted); } .kv b { text-align: right; font-weight: 600; }
.meter { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: .2rem 0 .6rem; }
.meter i { display: block; height: 100%; background: var(--brand-2); }

.tabs { display: flex; gap: .3rem; background: var(--surface); padding: .25rem; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: .6rem; }
.tabs a { flex: 1; text-align: center; padding: .45rem; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a.on { background: var(--brand-2); color: #fff; }
.addcat { display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .7rem; }
.addcat select { grid-column: 1; } .addcat .btn { grid-row: 1 / span 2; grid-column: 2; }

.inline { display: flex; align-items: center; gap: .4rem; margin: 0; }
.grow { flex: 1; min-width: 0; }
.row.manage { padding: .45rem .9rem; flex-wrap: wrap; }
.row.manage input, .inline input { margin: 0; padding: .35rem .5rem; font-size: .95rem; background: transparent; border-color: transparent; font-weight: 600; min-width: 0; }
.row.manage input:focus, .inline input:focus { background: var(--surface-2); border-color: var(--border); }
.row.manage .sub { flex-basis: 100%; }
.row.manage .inline.grow { flex-wrap: wrap; }
.is-archived { opacity: .6; }
.cat { padding: 0 .9rem; }
.cat.sub { padding-left: 2rem; }
.cat summary { cursor: pointer; padding: .55rem 0; list-style: none; }
.cat summary::-webkit-details-marker { display: none; }
.cat details form { padding-bottom: .5rem; }
.cat.sub summary { font-size: .92rem; color: var(--muted); }

/* Compact net-worth strip and header add-button */
.networth { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.networth .nw { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; }
.networth .nw b { font-size: 1.3rem; }
.networth b { overflow-wrap: anywhere; }
.group > header { gap: .6rem; }
.group > header h2 { flex: 1; }
.addlink { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); text-decoration: none; font-weight: 700; line-height: 1; }
.dock { left: 0; right: 0; margin-left: .6rem; margin-right: .6rem; }
/* clip (not hidden) so the page itself stays the scroller: 'hidden' on html+body breaks touch scrolling on phones */
body { overflow-x: clip; }

.note { background: var(--brand-soft); color: var(--text); border-radius: 10px; padding: .6rem .8rem; font-size: .85rem; margin-bottom: .8rem; }
.note ul { margin: .3rem 0 0; padding-left: 1.1rem; }
[hidden] { display: none !important; }

.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-2); text-decoration: underline; cursor: pointer; font: inherit; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.row .badge { white-space: nowrap; }
.row.manage select { margin: 0; padding: .3rem .4rem; font-size: .85rem; max-width: 9rem; }
.auth-card form.note { margin: .8rem 0 0; }
.kv b { max-width: 65%; font-weight: 500; font-size: .82rem; }

/* ---------- Segment 3: transactions, settings ---------- */
.monthnav { display: inline-flex; align-items: center; gap: .55rem; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.monthnav a { color: var(--muted); text-decoration: none; }
.monthnav a:first-child, .monthnav a:last-child, .monthnav .dim { font-size: 1.15rem; line-height: 1; }
.monthnav .dim { opacity: .3; }
.pos { color: var(--in); }
.row.txn .amt { text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.row.txn .amt .sub { font-weight: 400; }
.row .name .sub { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayhead { display: flex; justify-content: space-between; padding: .35rem .9rem; background: var(--surface-2); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; background: var(--surface-2); padding: .25rem; border-radius: 12px; margin-bottom: .9rem; }
.seg label { margin: 0; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; }
.seg span { display: block; text-align: center; padding: .5rem; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--surface); box-shadow: var(--shadow); }
.seg input[value="income"]:checked + span { color: var(--in); }
.seg input[value="expense"]:checked + span { color: var(--out); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-2); }
.bigamount input { font-size: 1.6rem; font-weight: 700; text-align: right; padding: .5rem .7rem; }
.hintbox { background: var(--brand-soft); border-radius: 10px; padding: .55rem .75rem; font-size: .85rem; margin-bottom: .8rem; }
.filters summary { cursor: pointer; padding: .55rem .9rem; font-size: .85rem; color: var(--muted); list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters .form { padding: 0 .9rem .7rem; }
.filters input, .filters select { padding: .45rem .55rem; font-size: .9rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0 0 .6rem; }
.chips a { text-decoration: none; }
.chip.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.totals { display: flex; justify-content: space-between; font-size: .85rem; padding: .5rem .9rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .6rem; }

a.setrow { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; min-height: 50px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; background: none; width: 100%; text-align: left; font: inherit; cursor: pointer; border-left: 0; border-right: 0; border-bottom: 0; }
button.setrow { border-top: 1px solid var(--border); }
.setrow .ic { color: var(--brand-2); }
.setrow .t { flex: 1; min-width: 0; }
.setrow .t b { display: block; font-weight: 600; font-size: .95rem; }
.setrow .t small { color: var(--muted); font-size: .78rem; }
.setrow .chev { width: 18px; height: 18px; color: var(--muted); }
.setrow:active { background: var(--surface-2); }
.group > header + .setrow { border-top: 0; }
.attach { display: block; max-width: 100%; border-radius: 10px; margin-top: .5rem; border: 1px solid var(--border); }

/* ---------- searchable pick-lists ---------- */
.combo { position: relative; }
.combo-input { margin-top: .25rem; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40; margin: 0; padding: .25rem 0; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(10, 30, 45, .22);
  max-height: min(55vh, 340px); overflow-y: auto; }
.combo-list[hidden] { display: none; }
.combo-group { padding: .35rem .8rem .15rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.combo-opt { display: flex; justify-content: space-between; gap: .6rem; padding: .55rem .8rem; font-size: .95rem; cursor: pointer; font-weight: 400; }
.combo-opt small { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.combo-opt.active { background: var(--brand-soft); }
.combo-opt.sel { font-weight: 700; }
.combo-opt.create { color: var(--brand-2); font-weight: 600; }
.combo-empty { padding: .6rem .8rem; color: var(--muted); font-size: .9rem; }

/* ---------- intent banner + account actions ---------- */
.intent { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; padding: .6rem .8rem; border-radius: 12px; margin-bottom: .7rem; font-size: .85rem; background: var(--brand-soft); }
.intent b { font-size: 1rem; }
.intent span { color: var(--muted); flex: 1 1 14rem; }
.intent a { font-size: .8rem; }
.intent.in b { color: var(--in); } .intent.out b { color: var(--out); }
.hintbox { white-space: pre-line; }
.acts { display: grid; gap: .5rem; margin-bottom: .75rem; }
.acts h3 { margin: 0; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.acts .row-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.actbtn { flex: 1 1 auto; text-align: center; text-decoration: none; padding: .55rem .8rem; border-radius: 12px; font-weight: 600; font-size: .88rem; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.actbtn.in { color: var(--in); } .actbtn.out { color: var(--out); }
.actbtn:active { background: var(--surface-2); }

/* ---------- reports, sharing ---------- */
.sharebar { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 .6rem; }
.sharebar .btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .8rem; min-height: 40px; font-size: .9rem; }
.sharebar .ic { width: 18px; height: 18px; }
.sharehint { margin-top: -.2rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem; margin: .5rem 0 .75rem; }
.kpi { background: var(--surface); border-radius: 12px; padding: .5rem .75rem; box-shadow: var(--shadow); min-width: 0; }
.kpi small { display: block; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi b { font-size: 1rem; overflow-wrap: anywhere; }
.kpi b.pos { color: var(--in); } .kpi b.neg { color: var(--out); }
.tbl-title { font-size: .95rem; margin: .8rem 0 .3rem; }
.tablewrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.rtable { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rtable th { background: var(--brand); color: var(--on-brand); text-align: left; padding: .45rem .6rem; font-weight: 600; white-space: nowrap; }
.rtable td { padding: .4rem .6rem; border-top: 1px solid var(--border); vertical-align: top; }
.rtable .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rtable tr.group td { background: var(--brand-soft); font-weight: 700; }
.rtable tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
.rtable td.neg { color: var(--out); } .rtable td.pos { color: var(--in); } .rtable td.muted { color: var(--muted); }

/* ---------- credit cards, collapsible share box, contact prompt ---------- */
.pill { display: inline-block; font-size: .7rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; margin-left: .4rem; vertical-align: middle; letter-spacing: .02em; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: #fff1d6; color: #8a5a00; }
.pill.bad { background: var(--err-bg); color: var(--err); }
:root[data-theme="dark"] .pill.warn { background: #3b2d0c; color: #ffd27a; }
.meter.mid i { background: #d99a1c; } .meter.hi i { background: var(--out); }
a.cardrow { display: block; color: inherit; text-decoration: none; }
.cardrow-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.cardrow .kv:first-of-type { border-top: 0; }
.plan { padding: .55rem 0; border-top: 1px solid var(--border); }
.plan:first-of-type { border-top: 0; }
.plan.done { opacity: .65; }
.plan-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .92rem; }
.plan-sub { font-size: .8rem; color: var(--muted); }
.addplan summary, .stmt-history summary, .sharebox summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: .9rem; padding: .4rem 0; list-style: none; }
.addplan summary::-webkit-details-marker, .stmt-history summary::-webkit-details-marker, .sharebox summary::-webkit-details-marker { display: none; }
.sharebox { padding: .35rem .9rem; }
.sharebox summary { display: flex; align-items: center; gap: .5rem; color: var(--text); }
.sharebox summary .ic { color: var(--brand-2); }
.sharebox summary small { color: var(--muted); font-weight: 400; margin-left: auto; }
.sharebox[open] summary { border-bottom: 1px solid var(--border); margin-bottom: .4rem; }
.contactprompt { border: 1px dashed var(--brand-2); box-shadow: none; }
.contactprompt .hint { margin-bottom: .6rem; }

/* ---------- budgets, goals, schedules ---------- */
.budget { padding: .6rem .9rem; border-top: 1px solid var(--border); }
.budget:first-of-type { border-top: 0; }
.budget-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .92rem; align-items: baseline; }
.budget-sub { font-size: .78rem; color: var(--muted); margin-top: .25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; }
a.budgetstrip { display: block; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .55rem .9rem; margin-bottom: .6rem; color: inherit; text-decoration: none; }
a.budgetstrip .meter { margin: .3rem 0 .15rem; }
.goal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.goal .kv:first-of-type { border-top: 0; }
.schedbox { border: 1px dashed var(--border); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .8rem; }
.schedbox h3 { margin: 0 0 .5rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.accpick { border: 1px solid var(--border); border-radius: 12px; padding: .5rem .8rem; margin: 0 0 .8rem; }
.accpick legend { font-size: .82rem; font-weight: 600; padding: 0 .3rem; }
.accpick label.check { margin-bottom: .45rem; align-items: flex-start; }
.accpick label.check span { display: flex; flex-direction: column; font-weight: 500; }

/* ---------- gold record ---------- */
.goldsum .bigbal { color: #a87a00; }
:root[data-theme="dark"] .goldsum .bigbal { color: #f1c453; }

/* ---------- charts ---------- */
.chartcard h2 { margin-bottom: .3rem; }
svg.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { stroke: var(--muted); stroke-width: 1; }
.ch-ylabel, .ch-xlabel { fill: var(--muted); font-size: 9px; }
.ch-in { fill: var(--in); } .ch-out { fill: var(--out); }
.ch-line { fill: none; stroke: var(--brand-2); stroke-width: 2; stroke-linejoin: round; }
.ch-area { fill: var(--brand-2); opacity: .12; }
.ch-dot { fill: var(--surface); stroke: var(--brand-2); stroke-width: 2; }
.ch-slice { stroke-linecap: butt; }
.legend { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: .5rem; }
.legend .sw.in { background: var(--in); margin-left: 0; } .legend .sw.out { background: var(--out); }
/* category palette: stroke for ring slices, fill for dots and bars */
.ch-c0 { stroke: #0e7490; background: #0e7490; } .ch-c1 { stroke: #d9822b; background: #d9822b; } .ch-c2 { stroke: #5b8c3a; background: #5b8c3a; }
.ch-c3 { stroke: #8b5cf6; background: #8b5cf6; } .ch-c4 { stroke: #d6456b; background: #d6456b; } .ch-c5 { stroke: #2f7de1; background: #2f7de1; }
.ch-c6 { stroke: #b08900; background: #b08900; } .ch-c7 { stroke: #8795a1; background: #8795a1; }
.catwrap { display: grid; gap: .8rem; grid-template-columns: 1fr; align-items: center; }
.ring { position: relative; max-width: 190px; margin: 0 auto; width: 100%; }
.ring svg.chart { transform: none; }
.ringtotal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 22%; }
.ringtotal small { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ringtotal b { font-size: .78rem; overflow-wrap: anywhere; }
.catrow > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto auto; gap: .1rem .5rem; align-items: center; padding: .35rem 0; }
.catrow > summary::-webkit-details-marker { display: none; }
.catrow .dot { width: 10px; height: 10px; border-radius: 3px; stroke: none; }
.catrow .cname { font-size: .9rem; } .catrow .cpct { font-size: .75rem; color: var(--muted); } .catrow .camt { font-size: .88rem; font-weight: 600; }
.cbar { grid-column: 1 / -1; height: 5px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 4px; stroke: none; }
.cmore { padding: 0 0 .5rem 1rem; }
.cmore .row { min-height: 34px; font-size: .85rem; padding: 0; border-top: 0; }
@media (min-width: 700px) { .catwrap { grid-template-columns: 200px 1fr; } }

/* ---------- responsive layouts: phone (default) -> tablet -> desktop ---------- */
.steps { margin: .4rem 0 0; padding-left: 1.2rem; font-size: .9rem; } .steps li { margin: .25rem 0; }
.cols2, .dash, .chartgrid { display: block; }

@media (min-width: 700px) {                      /* tablet */
  .container { max-width: 900px; }
  .dash-main { columns: 2; column-gap: .9rem; }
  .dash-main .group { break-inside: avoid; }
  .chartgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
  .chartgrid .card { margin-bottom: 0; }
  .chartgrid + .card { margin-top: .75rem; }
}
@media (min-width: 1000px) {                     /* desktop */
  .container { max-width: 1240px; }
  .dash { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
  .dash-side { order: 2; position: sticky; top: 4.75rem; }
  .dash-main { order: 1; columns: 2; }
  .cols2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
  .col > :last-child { margin-bottom: 0; }
  .row .name .sub { max-width: 34rem; }
  .container > form.card, .container > form.card.form { max-width: 680px; }
  .tablewrap { max-width: 100%; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .topbar { position: sticky; }
}
@media (min-width: 1500px) { .container { max-width: 1400px; } .dash { grid-template-columns: minmax(0, 1fr) 400px; } }

/* installed app: no browser chrome, so keep content clear of the notch and home bar */
@media (display-mode: standalone) { .topbar { padding-top: calc(.55rem + env(safe-area-inset-top)); } }

/* printing a report page */
@media print {
  .sidebar, .dock, .topbar, .sharebar, .sharebox, .btnrow, .chips, #toast, .filters { display: none !important; }
  .shell { display: block; } body { background: #fff; color: #000; padding: 0; }
  .container { max-width: none; padding: 0; } .card, .group, .summary, .kpi { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---------- group colours + favourites ---------- */
.group.gc > header { border-left: 4px solid var(--gc); background: var(--surface-2); }
.group.gc > header h2 { color: var(--gc); }
@supports (background: color-mix(in srgb, red 10%, white)) {
  .group.gc > header { background: color-mix(in srgb, var(--gc) 11%, var(--surface-2)); }
}
:root[data-theme="dark"] .group.gc > header h2, :root[data-theme="dark"] .gtag { color: color-mix(in srgb, var(--gc) 55%, #fff); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .group.gc > header h2, :root:not([data-theme="light"]) .gtag { color: color-mix(in srgb, var(--gc) 55%, #fff); } }
.gtag { color: var(--gc); font-weight: 700; }
.gtag::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gc); margin-right: .4rem; vertical-align: .05em; }
.fav { color: #d9a000; font-size: .85em; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.colorpick summary { list-style: none; cursor: pointer; } .colorpick summary::-webkit-details-marker { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: .35rem; padding: .45rem 0 .2rem; align-items: center; }
.swatches .sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches .sw.on { border-color: var(--text); }

/* gold: physical vs digital */
.seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.goldtot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .7rem; padding-top: .6rem; border-top: 1px solid rgba(127,127,127,.25); }
.goldtot small { display: block; font-size: .72rem; opacity: .75; }
.goldtot b { font-size: .98rem; overflow-wrap: anywhere; }
.goldforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .7rem 0; }
.goldcard { --gc: #b8860b; display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid rgba(127,127,127,.25); border-top: 4px solid var(--gc); border-radius: 14px; padding: .7rem .8rem; box-shadow: var(--shadow); }
.goldcard.digital { --gc: #2563eb; }
.goldcard.on { outline: 2px solid var(--gc); }
.goldcard header { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; }
.goldcard h2 { margin: 0; font-size: .95rem; color: var(--gc); }
.goldcard .big { font-size: 1.2rem; font-weight: 700; margin-top: .3rem; overflow-wrap: anywhere; }
.goldcard dl { margin: .5rem 0 0; display: grid; gap: .2rem; }
.goldcard dl div { display: flex; justify-content: space-between; gap: .4rem; font-size: .82rem; }
.goldcard dt { opacity: .75; }
.goldcard dd { margin: 0; font-weight: 600; }
.goldtabs { display: flex; gap: .3rem; background: var(--surface-2); padding: .25rem; border-radius: 12px; margin: .3rem 0 .5rem; }
.goldtabs a { flex: 1; text-align: center; padding: .45rem; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); text-decoration: none; }
.goldtabs a.on { background: var(--surface); box-shadow: var(--shadow); color: inherit; }
.fbadge { display: inline-block; font-size: .65rem; font-weight: 700; padding: .05rem .4rem; border-radius: 99px; background: #b8860b22; color: #b8860b; vertical-align: middle; }
.fbadge.digital { background: #2563eb22; color: #2563eb; }
@media (max-width: 360px) { .goldforms { grid-template-columns: minmax(0, 1fr); } }

/* account page: accounts pane (desktop) + quick entry */
.acctnav { display: none; }
.quickbar { margin-bottom: .8rem; }
.quickbar h2 { margin: 0 0 .5rem; font-size: .95rem; }
.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.qgrid label { margin: 0; min-width: 0; }
.qamt, .qdesc, .qcat { grid-column: 1 / -1; }
.qbtns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .6rem; }
.qbtns .btn { justify-content: center; font-weight: 700; }
.qin { background: color-mix(in srgb, var(--in) 14%, var(--surface)); color: var(--in); }
.qout { background: color-mix(in srgb, var(--out) 14%, var(--surface)); color: var(--out); }
.qbtns .btn:only-child { grid-column: 1 / -1; }
@media (min-width: 1000px) {
  .acctshell { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .acctnav { display: block; position: sticky; top: 4.75rem; max-height: calc(100vh - 6rem); overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: .3rem 0; }
  .acctnav h3 { display: flex; justify-content: space-between; gap: .5rem; margin: 0; padding: .45rem .8rem; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--gc); background: color-mix(in srgb, var(--gc) 10%, var(--surface)); }
  .acctnav a { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .8rem; text-decoration: none; color: inherit; font-size: .88rem; border-left: 3px solid transparent; }
  .acctnav a:hover { background: var(--surface-2); }
  .acctnav a.on { background: color-mix(in srgb, var(--gc) 14%, var(--surface)); border-left-color: var(--gc); font-weight: 700; }
  .acctnav .neg { color: var(--out); }
  .qgrid { grid-template-columns: 1fr 2fr 1fr 1fr; }
  .qamt { grid-column: auto; } .qdesc { grid-column: span 1; }
  .qcat { grid-column: span 4; }
}

/* ledger rows: compact on a phone, a real table on a desktop (like a bank statement) */
.lhead, .c-date, .c-kind, .c-bal { display: none; }
@media (min-width: 1000px) {
  .cols2 { display: flex; flex-direction: column; gap: .9rem; }
  .cols2 > * { margin: 0; order: 0; }
  .cols2 > .ledger { order: 10; }
  .cols2 > .quickbar { order: 11; position: sticky; bottom: .6rem; z-index: 6; box-shadow: 0 -6px 18px rgba(0,0,0,.12), var(--shadow); }
  .cols2 > .ledger ~ * { order: 12; }
  .acts { display: flex; flex-wrap: wrap; gap: .5rem 2rem; }
  .ledger .lhead, .ledger .row.txn { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 8rem 8.5rem 9rem; gap: .75rem; align-items: center; padding: 0 1rem; }
  .ledger .lhead { min-height: 34px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); }
  .ledger .lhead span:nth-child(n+4), .ledger .c-bal, .ledger .row.txn .amt { text-align: right; justify-self: end; }
  .ledger .row.txn { min-height: 48px; }
  .ledger .row.txn:hover { background: var(--surface-2); }
  .ledger .c-date { display: block; font-size: .85rem; } .ledger .c-date small { display: block; color: var(--muted); font-size: .72rem; }
  .ledger .c-kind { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .ledger .c-bal { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
  .ledger .m-only { display: none; }
  .ledger .row .name .sub { max-width: none; }
  .ledger .row.txn .amt { flex-direction: row; }
  .quickbar h2, .quickbar > .hint { display: none; }
  .quickbar { padding: .6rem .8rem; display: block; }
  .quickbar .qgrid { grid-template-columns: 9rem minmax(8rem, 1fr) 13rem 9.5rem 6.5rem; align-items: end; }
  .quickbar .qgrid .qamt, .quickbar .qgrid .qdesc, .quickbar .qgrid .qcat { grid-column: auto; }
  .quickbar .qbtns { margin: .5rem 0 0; grid-template-columns: repeat(2, minmax(0, 9rem)); justify-content: end; }
  .quickbar .qbtns .btn { min-height: 2.4rem; }
}

/* security pages */
.keybox { font-size: 1.25rem; font-weight: 700; letter-spacing: .06em; padding: .8rem 1rem; background: var(--surface-2); border-radius: 12px; text-align: center; user-select: all; overflow-wrap: anywhere; }
.codes { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.codes li { font-size: 1.05rem; font-weight: 700; text-align: center; padding: .6rem; background: var(--surface-2); border-radius: 10px; letter-spacing: .05em; }
.pin { text-align: center; font-size: 1.6rem; letter-spacing: .5rem; }
.inline-form { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }

/* notes */
.searchbar { display: flex; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap; }
.searchbar input { flex: 1 1 10rem; margin: 0; min-width: 0; }
.notegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.notecard { display: block; text-decoration: none; color: inherit; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: .8rem .9rem; border-top: 3px solid transparent; min-width: 0; }
.notecard.pinned { border-top-color: #d9a400; }
.notecard p { margin: .3rem 0; font-size: .88rem; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }

/* ====================================================================================================
   Desktop workspace (Accounts + account pages): accounts pane | account panel, like a banking desktop app.
   Phones and narrow windows keep the single-column layout; none of this applies below 1100px.
   ==================================================================================================== */
.acctpane, .wshead, .menubtn, .sidebook, .sideplan, .topsearch, .tbtn { display: none; }
.flashes:empty { display: none; }
.wstotals { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem .85rem; margin: .7rem 0; font-size: .85rem; }
.wstotals > div { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; justify-content: space-between; padding: .15rem 0; }
.wstotals .lab { font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); }

@media (min-width: 1000px) {
  .sidebook { display: block; padding: .5rem .7rem .7rem; text-decoration: none; color: var(--text); }
  .sidebook b { display: block; font-size: 1.05rem; }
  .sidebook small { color: var(--muted); font-size: .75rem; }
  .topsearch { display: block; margin-right: auto; }
  .topsearch input { margin: 0; width: min(22rem, 28vw); padding: .45rem .8rem; border-radius: 10px; background: var(--surface-2); }
  .tbtn { display: inline-flex; align-items: center; padding: .45rem .9rem; border-radius: 10px; font-weight: 600; font-size: .88rem; text-decoration: none; background: var(--brand-soft); color: var(--brand-2); white-space: nowrap; }
  .tbtn:hover { filter: brightness(.96); }
  .topbar .actions { display: flex; align-items: center; gap: .6rem; flex: 1; justify-content: flex-end; }
  .topbar .actions .iconbtn { display: none; }
}

@media (min-width: 1100px) {
  body.ws { overflow: hidden; }
  body.ws .shell { height: 100vh; }
  body.ws .main { height: 100vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
  body.ws .topbar { position: static; flex: none; }
  body.ws .container { flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; display: grid;
                       grid-template-columns: 22rem minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  body.ws .flashes { grid-column: 1 / -1; padding: 0 1rem; }
  body.ws .flashes .flash { margin: .5rem 0 0; }

  /* accounts pane */
  body.ws .acctpane { display: flex; flex-direction: column; grid-row: 2; grid-column: 1; min-height: 0; background: var(--surface); border-right: 1px solid var(--border); }
  .acctpane > header { flex: none; display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; }
  .acctpane > header a { color: inherit; text-decoration: none; font-size: 1.4rem; line-height: 1; padding: 0 .3rem; }
  .acctpane .plist { overflow-y: auto; flex: 1; min-height: 0; }
  .pgroup h3 { display: flex; justify-content: space-between; gap: .5rem; margin: 0; padding: .5rem 1rem; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--gc); background: color-mix(in srgb, var(--gc) 9%, var(--surface-2)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .pgroup > a { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .62rem 1rem; text-decoration: none; color: var(--text); font-size: .95rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); border-left: 4px solid transparent; }
  .pgroup > a .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pgroup > a .num { font-weight: 600; white-space: nowrap; }
  .pgroup > a .neg { color: var(--out); }
  .pgroup > a:hover { background: var(--surface-2); }
  .pgroup > a.on { background: var(--brand-soft); border-left-color: var(--brand-2); font-weight: 700; }

  /* panel */
  body.ws .wspane { position: relative; grid-row: 2; grid-column: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); overflow: hidden; }
  body.ws .wshead { display: flex; align-items: center; gap: 1rem; flex: none; padding: .8rem 1.1rem; background: var(--brand); color: var(--on-brand); }
  .wshead h1 { margin: 0; flex: 1; font-size: 1.2rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wshead h1 small { font-size: .8rem; font-weight: 500; opacity: .8; margin-left: .3rem; }
  .wshead .wsbal { font-size: 1.1rem; font-weight: 700; }
  .wshead .wsbal.neg { color: #ffc9c9; }
  body.ws .menubtn { display: inline-block; background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .45); border-radius: 8px; padding: .35rem .85rem; font: inherit; font-weight: 600; cursor: pointer; }
  .menubtn:hover { background: rgba(255, 255, 255, .12); }

  body.ws .wspane > .summary { display: none; }
  body.ws .wspane > .btnrow { margin: 0; padding: .5rem 1rem; flex: none; border-bottom: 1px solid var(--border); }
  body.ws .acts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.6rem; flex: none; margin: 0; padding: .5rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
  body.ws .acts > div { display: flex; align-items: center; gap: .5rem; }
  body.ws .acts h3 { margin: 0; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  body.ws .cardwrap { flex: none; max-height: 38%; overflow-y: auto; padding: .6rem 1rem 0; }
  body.ws .contactprompt { margin: .6rem 1rem 0; flex: none; }

  /* ledger fills the panel and scrolls on its own */
  body.ws .ledger { flex: 1 1 12rem; min-height: 12rem; overflow-y: auto; margin: 0; border-radius: 0; box-shadow: none; }
  body.ws .ledger > header { display: none; }
  body.ws .ledger .lhead { position: sticky; top: 0; z-index: 2; }
  body.ws .wstotals { order: 80; flex: none; margin: 0; border-radius: 0; box-shadow: none; background: var(--surface-2); border-top: 1px solid var(--border); padding: .35rem 1rem; align-items: flex-end; }
  body.ws .wstotals > div { justify-content: flex-end; gap: .5rem; }
  body.ws .wstotals .lab { margin-right: .4rem; }

  /* the entry bar is pinned to the bottom of the panel: description / amount / Income, then date / time / category / Expense */
  body.ws .quickbar { order: 90; flex: none; margin: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--border); padding: .7rem 1rem;
                      display: grid; gap: .5rem .6rem; grid-template-columns: 9.5rem 7rem minmax(0, 1fr) 11rem 9rem;
                      grid-template-areas: "desc desc desc amt in" "date time cat cat out"; }
  body.ws .quickbar .qgrid, body.ws .quickbar .qbtns { display: contents; }
  body.ws .quickbar label { margin: 0; min-width: 0; }
  body.ws .quickbar .qdesc { grid-area: desc; } body.ws .quickbar .qamt { grid-area: amt; }
  body.ws .quickbar .qdate { grid-area: date; } body.ws .quickbar .qtime { grid-area: time; } body.ws .quickbar .qcat { grid-area: cat; }
  body.ws .quickbar .qin { grid-area: in; } body.ws .quickbar .qout { grid-area: out; }
  body.ws .quickbar .qamt input { text-align: right; font-weight: 600; }
  body.ws .quickbar .btn { min-height: 2.5rem; margin: 0; }
  body.ws .quickbar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.ws .quickbar .qhint { display: none; }

  /* secondary things live in the Menu panel */
  body.ws .menupanel { display: none; position: absolute; top: 3.5rem; right: .8rem; width: 28rem; max-width: calc(100% - 1.6rem); max-height: calc(100% - 4.5rem); overflow-y: auto; z-index: 40;
                       padding: .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 38px rgba(0, 0, 0, .28); }
  body.ws .menupanel.open { display: block; }
  body.ws .menupanel .card { box-shadow: none; border: 1px solid var(--border); }

  /* the overview page uses the same shell: totals and charts on the right, accounts in the pane */
  body.ws .dash { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 1.1rem 1.4rem; }
  body.ws .dash-main { display: none; }
  body.ws .dash-side { position: static; max-width: 58rem; }
}
.sidebar a.sidebook { flex-direction: column; align-items: flex-start; gap: .1rem; padding: .5rem .7rem .8rem; }

.wsonly { display: none; }
@media (min-width: 1100px) { body.ws .wsonly { display: block; } }
.morelink { font-size: .8rem; text-decoration: none; }

/* matching heading bars, and the account chooser in the entry bar */
.qacct { grid-column: 1 / -1; }
@media (min-width: 1100px) {
  body.ws { --wsh: 3.6rem; }
  body.ws .acctpane > header, body.ws .wshead { height: var(--wsh); box-sizing: border-box; padding: 0 1.1rem; display: flex; align-items: center; }
  body.ws .wshead { gap: 1rem; }
  body.ws .quickbar { grid-template-columns: 9.5rem 7rem minmax(0, 1fr) 13rem 9rem;
                      grid-template-areas: "desc desc desc amt in" "date time cat acct out"; }
  body.ws .quickbar .qacct { grid-area: acct; }
}

.pgroup a .n .est { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); }

.combo-list.up { top: auto; bottom: calc(100% + 2px); }
@media (min-width: 1100px) {
  body.ws .quickbar .combo-list { min-width: 18rem; }
  body.ws .quickbar .qacct .combo-list { left: auto; right: 0; }
}

/* notifications */
.bell { position: relative; }
.bellcount { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #e5484d; color: #fff; font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center; }
.bellcount[hidden] { display: none; }
@media (min-width: 1000px) { .topbar .actions .iconbtn.bell { display: grid; } }
.notifbar { align-items: center; margin-bottom: .6rem; }
.notifbar .muted { flex: 1; }
.row.notif { gap: .7rem; padding-top: .6rem; padding-bottom: .6rem; align-items: flex-start; }
.row.notif .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: .4rem; background: #8aa0ad; }
.row.notif.overdue .dot { background: #e5484d; } .row.notif.today .dot { background: #f08c00; } .row.notif.soon .dot { background: #2f8fd8; }
.row.notif .name { flex: 1; min-width: 0; } .row.notif .name .sub { white-space: normal; max-width: none; }
.row.notif.unread .name { font-weight: 700; }

/* ===== every page gets the same heading bar on a wide screen; the transaction list is a table like the account ledger ===== */
.pagebar, .deskonly { display: none; }
.wsnav { display: none; }
@media (min-width: 1100px) {
  body.hasshell { overflow: hidden; }   /* only the signed-in layout scrolls inside itself; public pages scroll normally */
  .shell { height: 100vh; }
  .main { height: 100vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
  .topbar { position: static; flex: none; }
  .topbar .title { display: none; }
  .pagebar { display: flex; align-items: center; flex: none; height: var(--wsh, 3.6rem); box-sizing: border-box; padding: 0 1.5rem; background: var(--brand); color: var(--on-brand); }
  .pagebar h1 { margin: 0; font-size: 1.2rem; }
  body.ws .pagebar { display: none; }
  .scroller { flex: 1; min-height: 0; overflow-y: auto; }
  body.ws .scroller { display: flex; flex-direction: column; overflow: hidden; }
  body.ws .main { height: 100vh; }
  body.ws .deskonly { display: block; }

  /* transactions */
  body.wp .container { grid-template-columns: minmax(0, 1fr); }
  body.wp .wspane { grid-column: 1; }
  .wsnav { display: inline-flex; align-items: center; gap: .9rem; }
  .wsnav a { color: var(--on-brand); text-decoration: none; font-size: .85rem; opacity: .9; }
  .wsnav a.arr { font-size: 1.5rem; line-height: 1; }
  .wsnav a:hover { opacity: 1; }
  body.wp .wspane > .summary { display: none; }
  .wstoolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; flex: none; padding: .55rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
  .wstoolbar .chips { margin: 0; }
  .wstoolbar .filters { flex: 1; min-width: 0; margin: 0; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
  .wstoolbar .filters summary { display: none; }
  .wstoolbar .filters .form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; padding: 0; }
  .wstoolbar .filters .form .two { display: contents; }
  .wstoolbar .filters label { margin: 0; font-size: .7rem; }
  .wstoolbar .filters input, .wstoolbar .filters select { margin: 0; }
  .wstoolbar .filters .btnrow { margin: 0; }
  .txlist { flex: 1 1 12rem; min-height: 12rem; overflow-y: auto; }
  .txlist .lhead, .txlist .row.txn { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 13rem 8rem 9rem; gap: .75rem; align-items: center; padding: 0 1rem; }
  .txlist .lhead { position: sticky; top: 0; z-index: 2; min-height: 34px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
  .txlist .lhead span:last-child, .txlist .row.txn .amt { text-align: right; justify-self: end; }
  .txlist .group { margin: 0; border-radius: 0; box-shadow: none; }
  .txlist .dayhead { display: none; }
  .txlist .row.txn { min-height: 48px; }
  .txlist .row.txn:hover { background: var(--surface-2); }
  .txlist .c-date { display: block; font-size: .85rem; } .txlist .c-date small { display: block; color: var(--muted); font-size: .72rem; }
  .txlist .c-acct { display: block; font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .txlist .c-kind { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .txlist .m-only { display: none; }
  .txlist .row .name .sub { max-width: none; }
  .txlist .row.txn .amt { flex-direction: row; }
  .txlist > .footlinks, .txlist > .card { margin: .8rem 1rem; }
  body.wp .menupanel .filters { display: block; }
}
@media (max-width: 1099px) { .txlist .c-date, .txlist .c-acct, .txlist .c-kind, .txlist .lhead { display: none; } }

/* group pages inside Accounts */
.gname { color: inherit; text-decoration: none; }
.gname:hover { text-decoration: underline; }
@media (min-width: 1100px) {
  body.ws .wsbody { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.25rem; }
  .pgroup h3 .gname { flex: 1; min-width: 0; }
  .pgroup h3 .gplus { text-decoration: none; color: var(--gc); font-size: 1.2rem; line-height: 1; padding: 0 .25rem; }
}

.pacts { display: inline-flex; align-items: center; gap: .6rem; }
.pacts .ic { width: 20px; height: 20px; }
.acctpane > header .pacts a { display: inline-flex; align-items: center; }

/* printing: the workspace is a fixed-height app on screen; on paper it is one flowing page */
@media print {
  body, body.ws { overflow: visible !important; height: auto !important; }
  .shell, .main, .scroller, body.ws .container, .wspane, .wsbody, .ledger, .txlist, .plist { height: auto !important; max-height: none !important; overflow: visible !important; display: block !important; }
  .acctpane, .quickbar, .menupanel, .menubtn, .pagebar, .acts, .wstoolbar, .wsnav, .topbar, .sidebar, .dock { display: none !important; }
  .wshead { display: block !important; background: none !important; color: #000 !important; padding: 0 0 .4rem !important; border-bottom: 2px solid #000; }
  .wshead h1 { color: #000 !important; }
  .wsbal { display: inline !important; color: #000 !important; }
  .ledger .lhead, .txlist .lhead { position: static !important; }
  .row, .ledger .row.txn, .txlist .row.txn { break-inside: avoid; }
  .wstotals { display: block !important; background: none !important; border-top: 1px solid #000 !important; }
}

/* bulk selection on the transaction list */
#sel-toggle.on { background: var(--brand-2); color: #fff; border-color: var(--brand-2); }
.txlist.selecting a.row.txn { cursor: pointer; position: relative; padding-left: 2.2rem; }
.txlist.selecting a.row.txn::before { content: ""; position: absolute; left: .75rem; top: 50%; width: 16px; height: 16px; margin-top: -8px; border: 2px solid var(--muted); border-radius: 4px; }
.txlist.selecting a.row.txn.picked { background: var(--brand-soft); }
.txlist.selecting a.row.txn.picked::before { background: var(--brand-2); border-color: var(--brand-2); box-shadow: inset 0 0 0 2px var(--brand-soft); }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--surface); border-top: 2px solid var(--brand-2); box-shadow: 0 -6px 18px rgba(0,0,0,.12); position: sticky; bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 6px); z-index: 20; }
.bulkbar[hidden] { display: none; }
.bulkbar .bcount { margin-right: auto; font-size: .9rem; }
.bulkbar select { margin: 0; max-width: 12rem; }
@media (min-width: 1000px) { .bulkbar { bottom: 0; } .txlist.selecting a.row.txn { padding-left: 2.2rem; } }
@media (min-width: 1100px) { body.wp .bulkbar { flex: none; order: 85; position: static; box-shadow: none; } }

.pacts button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; }
.moverow { display: flex; gap: .3rem; justify-content: flex-end; padding: 0 .9rem .4rem; border-bottom: 1px solid var(--border); }
.moverow .chip[disabled] { opacity: .35; cursor: default; }

/* time shows in full */
.qgrid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
@media (min-width: 1100px) {
  body.ws .quickbar { grid-template-columns: 9.5rem 9rem minmax(0, 1fr) 13rem 9rem; }
}

/* category picker: a full-screen list on phones */
.combo-add, .combo-close { display: none; }
body.noscroll { overflow: hidden; }
@media (max-width: 699px) {
  .combo.sheet-open::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3.5rem; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 300; }
  .combo.sheet-open .combo-input { position: fixed; top: .35rem; left: .6rem; right: 6rem; height: 2.8rem; margin: 0; z-index: 302; font-size: 1rem; }
  .combo.sheet-open .combo-list { position: fixed; top: 3.5rem; left: 0; right: 0; bottom: 0; max-height: none; border: 0; border-radius: 0; box-shadow: none; z-index: 301; padding-bottom: 4rem; }
  .combo.sheet-open .combo-opt { padding: .8rem 1rem; font-size: 1rem; }
  .combo.sheet-open .combo-group { padding: .6rem 1rem .25rem; }
  .combo.sheet-open .combo-add, .combo.sheet-open .combo-close { display: grid; place-items: center; position: fixed; top: .35rem; width: 2.8rem; height: 2.8rem; z-index: 303; border: 0; border-radius: 10px; font-size: 1.5rem; line-height: 1; cursor: pointer; }
  .combo.sheet-open .combo-add { right: 3.1rem; background: var(--brand-2); color: #fff; }
  .combo.sheet-open .combo-close { right: .4rem; background: var(--surface-2); color: var(--text); font-size: 1.1rem; }
}

/* phone: no category field on new entries; a sheet asks for it after Save / Income / Expense */
@media (max-width: 699px) {
  .catpick, .quickbar .qcat { display: none !important; }
}
.catsheet-back { position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; }
.catsheet { width: 100%; height: calc(100% - 3.2rem); background: var(--surface); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.catsheet header { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem .6rem; }
.catsheet .ctitle { flex: 1; font-size: 1.35rem; font-weight: 700; }
.catsheet .ctitle small { font-weight: 400; font-size: .95rem; color: var(--muted); }
.catsheet .cskip { background: none; border: 0; color: var(--brand-2); font-size: 1.05rem; cursor: pointer; padding: .3rem .4rem; }
.catsheet .cplus { background: none; border: 0; color: var(--brand-2); font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.catsheet .csearch { margin: .2rem 1.2rem .6rem; width: auto; padding: .75rem 1rem; border-radius: 14px; background: var(--surface-2); border: 0; font-size: 1rem; }
.catsheet ul { list-style: none; margin: 0; padding: 0 0 2rem; overflow-y: auto; flex: 1; }
.catsheet li { display: flex; flex-direction: column; justify-content: center; padding: .8rem 1.4rem; font-size: 1.05rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); cursor: pointer; }
.catsheet li:active { background: var(--brand-soft); }
.catsheet li small { font-size: .75rem; color: var(--muted); letter-spacing: .03em; }
.catsheet li.cnone { color: var(--muted); }

/* ---------- action menus: a tidy list of rows; on phones and tablets it opens as a sheet from the bottom ---------- */
.menulist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin: .6rem 0; }
.menulist form { display: contents; }
.mrow { display: flex; align-items: center; gap: .85rem; width: 100%; padding: .8rem 1rem; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); text-decoration: none; font: inherit; font-size: .95rem; text-align: left; cursor: pointer; box-sizing: border-box; }
.menulist > .mrow:last-child, .menulist > form:last-child .mrow { border-bottom: 0; }
.mrow:hover, .mrow:active { background: var(--surface-2); }
.mrow span small { display: block; margin-top: .05rem; font-size: .74rem; color: var(--muted); }
.mrow .ic { flex: none; width: 21px; height: 21px; color: var(--brand-2); }
.mrow .star { flex: none; width: 21px; text-align: center; font-size: 1.15rem; line-height: 1; color: #d9a400; }
.mrow.danger, .mrow.danger .star { color: var(--out); }
@media (max-width: 1099px) {
  .wshead:has(.menubtn) { display: flex; justify-content: flex-end; padding: 0 0 .5rem; }
  .wshead h1, .wshead .wsbal, .wshead .wsnav { display: none; }
  .wshead .menubtn { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--brand-2); background: var(--surface); color: var(--brand-2); border-radius: 999px; padding: .4rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; }
  .menupanel { display: none; }
  .menupanel.open { display: block; position: fixed; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; z-index: 400; box-sizing: border-box;
                    background: var(--bg, var(--surface-2)); border-radius: 22px 22px 0 0; padding: 1.1rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .menupanel.open::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px; background: var(--border); margin: -.5rem auto .8rem; }
  .menupanel .card { box-shadow: none; border: 1px solid var(--border); margin: .6rem 0; }
}

/* a tapped transaction opens in place */
a.row.txn.open { background: var(--brand-soft); }
.rowacts { padding: .7rem 1rem .9rem; background: var(--brand-soft); border-bottom: 1px solid var(--border); }
.rowacts[hidden] { display: none; }
.rowacts .rowwhen { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.rowacts .rowdesc { margin: 0 0 .55rem; overflow-wrap: anywhere; }
.rowbtns { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rowbtns form { display: inline; margin: 0; }
.rowbtns .chip { padding: .4rem .95rem; font-size: .85rem; }
.rowbtns .chip.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.chip.danger { color: var(--out); border-color: color-mix(in srgb, var(--out) 40%, var(--border)); }
.qsave[hidden], .qcancel[hidden] { display: none; }
.quickbar.editing { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-2); }
@media (min-width: 1100px) {
  body.ws .quickbar .qsave { grid-area: in; }
  body.ws .quickbar .qcancel { grid-area: out; }
}
.menuhead { margin: .9rem .3rem .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.menupanel > .menuhead:first-child { margin-top: 0; }

.mapgrid { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .6rem; }
.maprow { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.maprow .n { min-width: 0; } .maprow select { margin: 0; max-width: 55%; }

.d-only { display: none; }
@media (min-width: 1000px) { .ledger .d-only { display: inline; } }

/* one strip of context under the header: party status + settle, or card usage + statement + pay buttons */
.infostrip { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; padding: .55rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .88rem; }
.infostrip .is-main { flex: 1 1 14rem; min-width: 0; }
.infostrip .meter { flex: 0 0 7rem; margin: 0; }
.infostrip .chip { padding: .35rem .85rem; }
.infostrip .chip.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
@media (max-width: 1099px) { .infostrip { border: 1px solid var(--border); border-radius: 14px; margin: .6rem 0; } }
@media (min-width: 1100px) { body.ws .infostrip { flex: none; } }
@media (min-width: 1100px) {
  body.ws .quickbar { grid-template-columns: 9.5rem 9rem minmax(0, 1fr) 13rem 12.5rem; }
  body.ws .quickbar .btn { white-space: nowrap; font-size: .85rem; padding-left: .5rem; padding-right: .5rem; }
}

/* live link: the public page and the sharing controls */
body.pub { background: var(--bg, #eef2f5); }
.pubwrap { max-width: 640px; margin: 0 auto; padding: 1rem; }
.pubhead { text-align: center; padding: .6rem 0 1rem; }
.pubco { font-size: 1.3rem; font-weight: 700; }
.pubinfo { color: var(--muted); font-size: .85rem; white-space: pre-line; }
.sharelink { padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.sharelink input { width: 100%; margin: 0 0 .3rem; font-size: .85rem; }
.mrow-form { padding: .8rem 1rem; }
.mrow-form label { margin: .4rem 0; }
.menulist form.mrow-form { display: block; }

/* ---- statement view (account statement, like the Defter / bank statement layout): small, dense, calm ---- */
body.rpt .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: .4rem 0 .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
body.rpt .kpi { border-radius: 0; box-shadow: none; padding: .35rem .5rem; border-right: 1px solid var(--border); }
body.rpt .kpi:last-child { border-right: 0; }
body.rpt .kpi small { font-size: .56rem; letter-spacing: .05em; }
body.rpt .kpi b { font-size: .8rem; font-weight: 700; }
body.rpt .ledgertbl { font-size: .72rem; line-height: 1.25; }
body.rpt .tablewrap:has(.ledgertbl) { box-shadow: none; border: 1px solid var(--border); border-radius: 8px; }
body.rpt .ledgertbl th { background: transparent; color: var(--muted); font-size: .6rem; letter-spacing: .05em; text-transform: uppercase; padding: .35rem .4rem; border-bottom: 2px solid var(--text); }
body.rpt .ledgertbl td { padding: .26rem .4rem; border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
body.rpt .ledgertbl td small.sub { font-size: .62rem; color: var(--muted); display: block; line-height: 1.2; }
body.rpt .ledgertbl tr.open td { background: var(--surface-2); font-weight: 700; text-transform: uppercase; }
body.rpt .ledgertbl tr.open td:first-child { font-weight: 400; color: var(--muted); text-transform: none; }
body.rpt .ledgertbl tr.month td { background: var(--surface-2); font-size: .66rem; text-transform: uppercase; }
body.rpt .ledgertbl tr.total td { border-top: 2px solid var(--text); font-size: .76rem; }
body.rpt .ledgertbl tr.total td b.num, body.rpt .ledgertbl tr.total b { font-size: .82rem; }
body.rpt .hint { font-size: .66rem; }
@media (max-width: 560px) {
  body.rpt .container { padding-left: .5rem; padding-right: .5rem; }
  body.rpt .ledgertbl { font-size: .6rem; line-height: 1.2; }
  body.rpt .ledgertbl th { font-size: .52rem; letter-spacing: .02em; }
  body.rpt .ledgertbl td, body.rpt .ledgertbl th { padding: .2rem .2rem; }
  body.rpt .ledgertbl td:first-child, body.rpt .ledgertbl th:first-child { white-space: nowrap; }
  body.rpt .ledgertbl td small.sub { font-size: .54rem; }
  body.rpt .ledgertbl tr.total td b { font-size: .68rem; }
  body.rpt .ledgertbl tr.month td.r, body.rpt .ledgertbl tr.total td.r { white-space: normal; font-size: .56rem; }
  body.rpt .ledgertbl tr.total td.r b { font-size: .68rem; }
  body.rpt .ledgertbl td:first-child, body.rpt .ledgertbl th:first-child { white-space: normal; }
}
body.rpt .ledgertbl tr.total td, body.rpt .ledgertbl tr.total td b { font-family: inherit; }

/* the opening balance line at the oldest end of an account's list */
.row.txn.opening { background: var(--surface-2); cursor: default; }
.row.txn.opening .name { font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .03em; }
.row.txn.opening .c-date, .row.txn.opening .c-kind { color: var(--muted); }
body.rpt .rptsettings { padding: .5rem .8rem; margin: .5rem 0; }
body.rpt .rptsettings summary { cursor: pointer; font-size: .85rem; }
body.rpt .rptsettings form { margin-top: .6rem; }
body.rpt .kpi b { white-space: nowrap; font-size: clamp(.62rem, 2.6vw, .8rem); }
body.rpt .kpi small { white-space: nowrap; }
body.rpt .sharebar { gap: .3rem; margin: .3rem 0 .4rem; }
body.rpt .sharebar .btn { padding: .3rem .55rem; min-height: 32px; font-size: .74rem; border-radius: 8px; }
body.rpt .sharebar .ic { width: 14px; height: 14px; }
body.rpt .sharehint { font-size: .6rem; margin: 0 0 .3rem; }
body.rpt > .shell .container > p.muted, body.rpt .main > .scroller p.muted:first-of-type { font-size: .7rem; margin: .2rem 0; }

/* language switch on the public pages (landing, sign in, register...) */
.langpill { position: fixed; z-index: 30; right: .8rem; bottom: calc(.8rem + env(safe-area-inset-bottom)); display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(11, 92, 110, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); font-size: .78rem; }
.langpill a { color: #fff; text-decoration: none; padding: .25rem .65rem; border-radius: 999px; opacity: .85; }
.langpill a.on { background: #fff; color: #0b5c6e; font-weight: 700; opacity: 1; }

/* ---- undo bar, simple home, wizards, help, tour ---- */
.undo-bar form { display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.simplehome { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .5rem 0 .8rem; }
.sh-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; padding: .6rem .3rem; border-radius: 12px; text-decoration: none; color: var(--text); text-align: center; background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.sh-btn span { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; line-height: 1; color: #fff; }
.sh-btn b { font-size: .72rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.sh-btn.in span { background: #1f7a45; } .sh-btn.out span { background: #b3321f; } .sh-btn.credit span { background: #b7791f; } .sh-btn.stmt span { background: #2b6cb0; }
.simple-ask p { margin: 0 0 .6rem; }
.wizard { max-width: 34rem; margin: 0 auto; }
.wiz-dots { display: flex; gap: .4rem; justify-content: center; margin: .4rem 0 .8rem; }
.wiz-dots i { width: .7rem; height: .7rem; border-radius: 50%; background: var(--border); display: block; }
.wiz-dots i.on { background: var(--brand-2); transform: scale(1.25); } .wiz-dots i.done { background: var(--in, #1f7a45); }
.wiz-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.wiz-card h2 { margin: 0 0 .9rem; font-size: 1.25rem; }
.wiz-choices { display: grid; gap: .55rem; max-height: 55vh; overflow-y: auto; }
.wiz-choice { text-align: left; padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.02rem; }
.wiz-choice.on { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-2) inset; }
.wiz-input { width: 100%; box-sizing: border-box; font-size: 1.6rem; padding: .7rem .8rem; }
.wiz-input.bad { outline: 2px solid var(--out, #b3321f); }
.wiz-words { margin-top: .5rem; color: var(--muted); min-height: 1.3rem; }
.wiz-nav { display: flex; gap: .6rem; margin-top: 1rem; justify-content: flex-end; flex-wrap: wrap; }
.wiz-nav .btn { min-width: 6rem; padding: .8rem 1.1rem; font-size: 1.02rem; }
.wiz-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.wiz-link { text-decoration: none; color: inherit; }
.helpsteps { list-style: none; margin: .6rem 0; padding: 0; display: grid; gap: .7rem; }
.helpsteps li { display: flex; gap: .8rem; align-items: flex-start; font-size: 1.02rem; }
.helpsteps .n { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-weight: 700; }
.iconbtn.help b { font-size: 1.1rem; }
.tour-spot { position: fixed; z-index: 90; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); pointer-events: none; transition: all .2s; }
.tour-tip { position: fixed; z-index: 91; left: 50%; transform: translateX(-50%); width: min(92vw, 24rem); background: var(--surface); color: var(--text); border-radius: 14px; padding: 1rem; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.tour-tip p { margin: 0 0 .8rem; font-size: 1.02rem; }
.tour-nav { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; }
.tour-nav small { margin-right: auto; color: var(--muted); }

.langpill select { background: #fff; color: #0b5c6e; border: 0; border-radius: 999px; padding: .3rem .7rem; font: inherit; font-weight: 700; }

/* ================================================================= Business tools */
.bizbar { display: flex; gap: .3rem; overflow-x: auto; margin: 0 0 .8rem; padding: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; scrollbar-width: none; }
.bizbar::-webkit-scrollbar { display: none; }
.bizbar a { flex: none; padding: .45rem .8rem; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .86rem; white-space: nowrap; }
.bizbar a.on { background: var(--brand-soft); color: var(--brand-2); }
.bizbar a:hover { color: var(--text); }

.biz-grid { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 .8rem; }
.biz-grid .kpi { padding: .7rem .8rem; }
.biz-grid .kpi small { font-size: .7rem; }
.biz-grid .kpi b { font-size: 1.15rem; display: block; margin-top: .15rem; }
.biz-grid .kpi .sub2 { display: block; color: var(--muted); font-size: .72rem; margin-top: .1rem; }
@media (min-width: 760px) { .biz-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.biz-tiles { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 .8rem; }
.biz-tiles a { display: flex; flex-direction: column; gap: .15rem; padding: .8rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.biz-tiles a b { font-size: .95rem; }
.biz-tiles a small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.biz-tiles a:hover { border-color: var(--brand-2); }
@media (min-width: 760px) { .biz-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.biz-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.biz-table th { text-align: left; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: .4rem .5rem; border-bottom: 2px solid var(--text); white-space: nowrap; }
.biz-table td { padding: .45rem .5rem; border-top: 1px solid var(--border); vertical-align: top; }
.biz-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.biz-table tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
.biz-table td.neg, .biz-table .neg { color: var(--out); }
.biz-table td.warn { color: #b7791f; }
.biz-table small { color: var(--muted); display: block; }
.tablewrap .biz-table { min-width: 0; }
.tablewrap .biz-table.wide { min-width: 34rem; }
.pillrow { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .8rem; }
.pillrow a, .pillrow span { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 600; }
.pillrow a.on { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-2); }
.bar-list { display: grid; gap: .45rem; }
.bar-list .bl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .6rem; font-size: .85rem; }
.bar-list .bl i { grid-column: 1 / -1; display: block; height: 6px; border-radius: 4px; background: var(--brand-soft); position: relative; overflow: hidden; }
.bar-list .bl i::after { content: ""; position: absolute; inset: 0; width: var(--w, 0%); background: var(--brand-2); border-radius: 4px; }
.chip.warn { background: #fff4d6; color: #7a5200; border-color: #f0d28a; }
.stockbadge { display: inline-block; padding: .05rem .45rem; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--ok-bg); color: var(--ok); }
.stockbadge.low { background: #fff4d6; color: #7a5200; }
.stockbadge.out { background: var(--err-bg); color: var(--err); }

/* line editor shared by invoices, quotations, bills and recurring invoices */
.lines { display: grid; gap: .7rem; margin: .4rem 0 .6rem; }
.lines-head { display: none; }
.line { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem .5rem; padding: .6rem .6rem .5rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.line label, .line .f-amt { margin: 0; min-width: 0; }
.line .lb { display: block; font-size: .66rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: .15rem; }
.line input { width: 100%; padding: .55rem .6rem; font-size: 1rem; }
.line .f-desc { grid-column: 1 / -1; }
.line .f-unit, .line .f-qty, .line .f-rate { grid-column: span 2; }
.line .f-disc, .line .f-amt { grid-column: span 3; }
.line .f-amt { display: flex; flex-direction: column; justify-content: flex-end; }
.line .line-amt { font-size: 1.05rem; padding: .35rem 0; }
.line .line-amt.neg { color: var(--out); }
.line-del { position: absolute; top: .3rem; right: .4rem; width: 2rem; height: 2rem; border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 8px; }
.line-del:hover { background: var(--err-bg); color: var(--err); }
.line .f-desc .lb { padding-right: 2rem; }
@media (min-width: 560px) {
  .line { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.5fr); }
  .line .f-desc { grid-column: 1 / -1; }
  .line .f-unit, .line .f-qty, .line .f-rate, .line .f-disc, .line .f-amt { grid-column: auto; }
  .line .f-amt { align-items: flex-end; text-align: right; }
}
.doc-totals { margin: .8rem 0 .4rem auto; max-width: 24rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.doc-totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; font-size: .92rem; }
.doc-totals > div[hidden] { display: none; }
.doc-totals .grand { border-top: 2px solid var(--text); margin-top: .3rem; padding-top: .45rem; font-size: 1.15rem; font-weight: 800; }
.doc-totals .words { margin: .4rem 0 0; color: var(--muted); font-size: .8rem; font-style: italic; text-align: right; }
.doc-card { padding: 0; overflow: hidden; }
.doc-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .9rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.doc-head h2 { margin: 0; font-size: 1.1rem; }
.doc-body { padding: .8rem 1rem 1rem; }
.doc-body .biz-table td:first-child { width: 42%; }
.form-help { color: var(--muted); font-size: .8rem; margin: .1rem 0 .6rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; align-items: center; }
.actions-row form { display: inline; }
.empty-state { text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
.empty-state b { display: block; color: var(--text); margin-bottom: .2rem; font-size: 1rem; }
.doc-body .tablewrap .biz-table { min-width: 0; font-size: .82rem; }
.doc-body .biz-table th, .doc-body .biz-table td { padding-left: .35rem; padding-right: .35rem; }
.doc-body .biz-table td:first-child { width: auto; }
.biz-table .ph { display: none; }
@media (max-width: 699px) { .biz-table .bk { display: none; } .biz-table .ph { display: table-cell; } .tablewrap .biz-table.aging { min-width: 0; } }

/* ---- pricing and billing ---- */
.pricing { max-width: 64rem; margin: 0 auto; }
.pricing-public { padding: 5.2rem 1rem 3rem; }
.pricing-head { text-align: center; margin: .4rem 0 1rem; }
.pricing-head h1 { margin: 0 0 .3rem; font-size: 1.7rem; }
.pricing-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); margin-top: .7rem; }
.pricing-tabs a { padding: .45rem 1.3rem; border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 600; }
.pricing-tabs a.on { background: var(--brand-2); color: #fff; }
.plancard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; display: flex; flex-direction: column; gap: .5rem; border: 2px solid transparent; }
.plancard.feat { border-color: var(--brand-2); }
.plancard.current { background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); }
.plancard h2 { margin: 0; font-size: 1.1rem; }
.planprice b { font-size: 1.7rem; }
.tablewrap { overflow-x: auto; }
.pricing-note { text-align: center; }

/* pricing: cards (1, 2 or 4 columns) and the comparison table */
.plans { display: grid; gap: .9rem; grid-template-columns: 1fr; margin: 1.1rem 0; align-items: stretch; }
.plans.n2 { max-width: 46rem; margin-inline: auto; }
@media (min-width: 640px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .plans.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.plancard { position: relative; }
.plancard ul { margin: .3rem 0 .8rem; padding: 0; list-style: none; flex: 1; align-content: start; }
.plancard li { position: relative; padding: .28rem 0 .28rem 1.45rem; line-height: 1.35; }
.plancard li::before { content: "\2713"; position: absolute; left: 0; top: .28rem; color: var(--brand-2); font-weight: 700; }
.plancard .btn, .plancard .pill { align-self: stretch; text-align: center; }
.plancard .pill { padding: .45rem .8rem; margin-left: 0; }
.plancard .tag { position: absolute; top: -.7rem; right: 1rem; background: var(--brand-2); color: #fff; font-size: .7rem; font-weight: 700; padding: .2rem .65rem; border-radius: 999px; letter-spacing: .03em; }
.cmp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; min-width: 40rem; }
.cmp th, .cmp td { padding: .65rem .75rem; text-align: center; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cmp thead th { background: var(--brand-2); color: #fff; font-weight: 700; position: sticky; top: 0; }
.cmp thead th:first-child { border-top-left-radius: 10px; text-align: left; }
.cmp thead th:last-child { border-top-right-radius: 10px; }
.cmp th:first-child, .cmp td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); font-weight: 600; min-width: 12rem; }
.cmp thead th:first-child { background: var(--brand-2); }
.cmp tbody tr:nth-child(even) td { background: var(--surface-2); }
.cmp tbody tr:nth-child(even) td:first-child { background: var(--surface-2); }
.cmp td.hl { background: color-mix(in srgb, var(--brand-2) 10%, var(--surface)); font-weight: 600; }
.cmp .tick { color: #1f7a45; font-weight: 800; font-size: 1.15rem; }
.cmp .cross { color: var(--muted); font-size: 1.1rem; }
.tablewrap { overflow-x: auto; border-radius: 12px; }

.plancard li.no { color: var(--muted); opacity: .6; text-decoration: line-through; }
.plancard li.no::before { content: "\2013"; color: var(--muted); }
.plancard ul { font-size: .93rem; }
@media (max-width: 699px) {
  /* on a phone each row of the comparison becomes a small card: the feature on top, then one line per plan */
  .pricing .tablewrap { box-shadow: none; background: none; overflow: visible; }
  .cmp, .cmp tbody, .cmp tr, .cmp td { display: block; width: 100%; min-width: 0; }
  .cmp thead { display: none; }
  .cmp tr { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 .6rem; overflow: hidden; background: var(--surface); }
  .cmp td, .cmp tbody tr:nth-child(even) td { border: 0; background: transparent; }
  .cmp td:first-child, .cmp tbody tr:nth-child(even) td:first-child { position: static; min-width: 0; box-shadow: none; background: var(--surface-2); font-weight: 700; padding: .55rem .85rem; text-align: left; }
  .cmp td:not(:first-child) { display: flex; justify-content: space-between; align-items: center; gap: .8rem; text-align: right; padding: .45rem .85rem; border-top: 1px solid var(--border); font-size: .9rem; }
  .cmp td:not(:first-child)::before { content: attr(data-l); color: var(--muted); font-weight: 500; text-align: left; }
  .cmp td.hl { background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); }
}

/* admin: a left menu on wide screens, a scrolling row on phones */
.adminshell { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.adminnav { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .2rem; }
.adminnav a, .adminnav .soon { flex: none; padding: .5rem .85rem; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; white-space: nowrap; }
.adminnav a:hover { background: var(--surface-2); }
.adminnav a.on { background: var(--brand-2); color: #fff; }
.adminnav .soon { color: var(--muted); opacity: .65; cursor: default; }
.adminmain { min-width: 0; }
@media (min-width: 900px) {
  .adminshell { grid-template-columns: 12.5rem minmax(0, 1fr); align-items: start; }
  .adminnav { flex-direction: column; position: sticky; top: 1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; overflow: visible; }
}
.statgrid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin: .5rem 0 1rem; }

.badge { display: inline-block; min-width: 1.2rem; padding: 0 .4rem; border-radius: 999px; background: #b3321f; color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.3rem; }
.payto { background: var(--surface-2); border-radius: 12px; padding: .8rem 1rem; margin: .5rem 0; }
.payto .big { font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; letter-spacing: .02em; }
.proofthumb { max-width: 9rem; max-height: 9rem; border-radius: 8px; border: 1px solid var(--border); }

/* admin data tables */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 38rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: .7rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table td small { display: block; margin-top: .1rem; }
.table td a { font-weight: 600; text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.table .num, .table td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.act, .table th.act { text-align: right; }
.table td.empty { text-align: center; padding: 2rem 1rem; }
.table form.inline { display: inline; margin: 0; }
.pill.off { background: var(--surface-2); color: var(--muted); }
.pill.info { background: #dcecf7; color: #124e75; }
:root[data-theme="dark"] .pill.info { background: #1a3347; color: #9fd0f0; }
.table .pill { margin-left: 0; font-size: .76rem; padding: .15rem .65rem; white-space: nowrap; }
.founding { display: grid; gap: .8rem 1.2rem; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 700px) { .founding { grid-template-columns: 12rem 1fr auto; } }
.founding .btn { white-space: nowrap; }
.pricing-tabs.wrapnav { flex-wrap: wrap; border-radius: 16px; }
.vbox { margin-top: .6rem; }
.vrow { display: flex; gap: .5rem; margin-top: .3rem; }
.vrow input { flex: 1; min-width: 0; text-transform: uppercase; }

.lockchip { display: inline-block; font-size: .66rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }

/* a settings row that switches something on/off: same look as the other rows, with its state where the arrow is */
.setform { margin: 0; }
.setstate { flex: none; font-size: .78rem; font-weight: 700; padding: .12rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.setstate.on { background: var(--ok-bg); color: var(--ok); }
.setform .setrow { display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; min-height: 50px; border: 0; border-top: 1px solid var(--border); color: inherit; background: none; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.setform .setrow:active { background: var(--surface-2); }

/* a month's money in, out and net, between the entries of the account ledger (like a printed ledger) */
.ledger .monthsum { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; justify-content: flex-end; padding: .4rem 1rem; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .85rem; font-variant-numeric: tabular-nums; }
.ledger .monthsum .lab { font-size: .7rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin-right: .3rem; }

/* "Are you sure?" box next to a button */
.askpop { position: absolute; z-index: 1000; min-width: 12rem; max-width: min(20rem, calc(100vw - 1rem)); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: .7rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: .8rem .9rem; font-size: .9rem; }
.askpop .asksub { margin: .3rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.askpop .askbtns { display: flex; gap: .5rem; margin-top: .7rem; }
.askpop button { border: 0; border-radius: .45rem; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; cursor: pointer; color: #fff; background: var(--brand-2); }
.askpop .askyes.danger { background: #b83a2a; }
.askpop .askno { background: #0f7f72; }
.askpop button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media print { .askpop { display: none !important; } }

/* an amount is never turned into capitals by a heading (Rs 1,320,000, not RS1,320,000) */
.num { text-transform: none; }

/* the plan and the days left, under the book name: in the top bar on phones and the app, in the sidebar once the sidebar shows (900px and wider) */
.topbar small.planline a { color: inherit; text-decoration: none; font-weight: 600; }
.topbar small.planline.trial a, .topbar small.planline.expired a, .topbar small.planline.soon a { color: #f6c453; }
@media (min-width: 900px) {
  .sidebar a.sideplan { display: block; width: auto; gap: 0; padding: 0 .7rem; margin: -.35rem 0 .7rem; border-radius: 0; font-size: .75rem; font-weight: 600; line-height: 1.3; color: var(--brand-2); }
  .sidebar a.sideplan:hover { background: none; text-decoration: underline; }
  .sidebar a.sideplan.trial { color: #b7791f; }
  .sidebar a.sideplan.expired, .sidebar a.sideplan.soon { color: var(--out); }
  .sidebar a.sideplan.free { color: var(--muted); font-weight: 500; }
  .topbar small.planline { display: none; }
}
