/* =====================================================================
   Bright Mafaza — design system
   Ink navy + Indus teal (accent, user-customisable) + marigold for
   attention. Money is set in JetBrains Mono with tabular figures so
   ledger columns line up like a ledger book.
   ===================================================================== */
@font-face { font-family: "Jakarta"; src: url("../fonts/jakarta.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "LedgerMono"; src: url("../fonts/jbmono.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --accent: #0E7C73;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 35%, transparent);

  --ink: #16233F;          /* primary text, sidebar */
  --ink-2: #3A4863;
  --muted: #64708A;
  --paper: #F2F4F7;        /* app background */
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --line: #DFE4EC;
  --line-strong: #C9D1DD;

  --marigold: #D9902C;     /* due soon / attention */
  --marigold-soft: #FBF0DE;
  --credit: #1C7C45;       /* receivable, money in */
  --credit-soft: #E3F3E9;
  --debit: #B4352A;        /* payable, overdue, money out */
  --debit-soft: #FBE9E6;
  --info: #2F5FD0;

  --side-bg: #16233F;
  --side-ink: #C8D2E3;
  --side-ink-strong: #FFFFFF;

  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --shadow-1: 0 1px 2px rgba(22, 35, 63, .06), 0 1px 1px rgba(22, 35, 63, .04);
  --shadow-2: 0 10px 30px rgba(22, 35, 63, .14), 0 2px 6px rgba(22, 35, 63, .08);
  --font: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "LedgerMono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --side-w: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #E6ECF5; --ink-2: #C3CCDA; --muted: #8C98AE;
  --paper: #0D1424; --surface: #141D31; --surface-2: #19243B;
  --line: #24314B; --line-strong: #31405F;
  --marigold: #E8A94B; --marigold-soft: #3A2D17;
  --credit: #4CC283; --credit-soft: #15301F;
  --debit: #F07F72; --debit-soft: #3A1C19;
  --info: #7CA1FF;
  --side-bg: #0A1020; --side-ink: #93A1BA;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 14px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.money, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.muted { color: var(--muted); }
.credit { color: var(--credit); } .debit { color: var(--debit); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; }
.sidebar { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--side-ink-strong); font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--side-ink); letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--side-ink); font-weight: 560; font-size: 14.5px; position: relative; }
.nav a:hover { background: rgba(255,255,255,.06); color: var(--side-ink-strong); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.1); color: var(--side-ink-strong); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav .count { margin-left: auto; background: var(--marigold); color: #1b1300; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 19px; }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 8px; }
.side-foot { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 10px; align-items: center; font-size: 13px; }
.side-foot .who { flex: 1; min-width: 0; color: var(--side-ink-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { display: block; color: var(--side-ink); font-weight: 500; text-transform: capitalize; }
.side-foot button { background: none; border: 0; color: var(--side-ink); cursor: pointer; padding: 6px; border-radius: 8px; }
.side-foot button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.topbar .search .icon { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.net-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; background: var(--marigold-soft); color: var(--marigold); font-weight: 600; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--debit); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.menu-btn { display: none; }
.content { padding: 8px 28px 48px; max-width: 1320px; width: 100%; }

.offline-bar { display: none; align-items: center; gap: 10px; padding: 8px 28px; background: var(--marigold-soft); color: var(--ink); font-size: 13.5px; border-bottom: 1px solid color-mix(in srgb, var(--marigold) 40%, transparent); }
.offline-bar.show { display: flex; }

/* mobile navigation */
.bottom-nav { display: none; }
.fab { display: none; }

/* ---------------------------------------------------------------- page heads */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 20px; }
.page-head h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.025em; font-weight: 760; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--muted); margin-top: 10px; font-weight: 600; }
.back:hover { color: var(--ink); text-decoration: none; }
h2.section { font-size: 16px; margin: 28px 0 12px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
h2.section .actions { margin-left: auto; font-size: 14px; }
h3 { font-size: 15px; margin: 0 0 8px; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--debit); border-color: color-mix(in srgb, var(--debit) 40%, transparent); }
.btn.danger.solid { background: var(--debit); color: #fff; border-color: var(--debit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .spinner { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-1); }
.card.flat { box-shadow: none; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 .actions { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 4px; justify-content: center; }
.empty p { margin: 0 0 14px; }

/* stats */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.stat .value.money { font-size: 21px; font-weight: 500; }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.stat-strip > * { padding: 16px 18px; border-right: 1px solid var(--line); }
.stat-strip > *:last-child { border-right: 0; }
a.stat:hover { text-decoration: none; background: var(--surface-2); }

/* ---------------------------------------------------------------- the balance beam (signature) */
.beam-card { padding: 22px 24px 20px; }
.beam-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.beam-head h2 { margin: 0; font-size: 15px; color: var(--muted); font-weight: 650; }
.beam-net { font-family: var(--mono); font-size: 38px; letter-spacing: -.03em; line-height: 1.1; }
.beam-net .cur { font-size: .5em; color: var(--muted); margin-right: 6px; letter-spacing: 0; }
.beam-hint { color: var(--muted); font-size: 13.5px; }
.beam { position: relative; margin: 22px 0 12px; height: 14px; display: flex; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.beam .in { background: var(--credit); transition: flex-grow .9s var(--ease); }
.beam .out { background: var(--debit); transition: flex-grow .9s var(--ease); }
.beam-fulcrum { position: relative; height: 0; }
.beam-fulcrum span { position: absolute; top: -32px; width: 2px; height: 22px; background: var(--ink); transform: translateX(-1px); transition: left .9s var(--ease); }
.beam-fulcrum span::after { content: ""; position: absolute; left: -6px; bottom: -8px; border: 7px solid transparent; border-bottom-color: var(--ink); border-top: 0; }
.beam-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.beam-legend .side { display: flex; flex-direction: column; }
.beam-legend .side.right { text-align: right; }
.beam-legend .amt { font-family: var(--mono); font-size: 20px; }
.beam-legend .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.beam-legend .lbl i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 14px; }
.form .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--debit); font-weight: 600; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); min-height: 40px; }
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--debit); }
.input.money-input, .field input.money-input { font-family: var(--mono); text-align: right; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
fieldset.group { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; }
fieldset.group > legend { padding: 0 6px; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 5px 11px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
:root[data-theme="dark"] .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* the ledger equation (record transaction) */
.equation { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: end; gap: 10px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; }
.equation .op { font-family: var(--mono); font-size: 22px; color: var(--muted); padding-bottom: 8px; }
.equation .term .lbl { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.equation .term .fixed { font-family: var(--mono); font-size: 18px; padding: 8px 0; }
.equation .term.result .fixed { font-size: 22px; font-weight: 500; }
.equation input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-family: var(--mono); text-align: right; background: var(--surface); font-size: 16px; }

/* ---------------------------------------------------------------- badges & bits */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.todo { color: var(--muted); }
.badge.in_progress { background: color-mix(in srgb, var(--info) 12%, transparent); color: var(--info); border-color: transparent; }
.badge.review { background: var(--marigold-soft); color: var(--marigold); border-color: transparent; }
.badge.completed, .badge.paid, .badge.active { background: var(--credit-soft); color: var(--credit); border-color: transparent; }
.badge.cancelled, .badge.closed { text-decoration: line-through; }
.badge.overdue, .badge.unpaid, .badge.urgent { background: var(--debit-soft); color: var(--debit); border-color: transparent; }
.badge.partial, .badge.high, .badge.on_hold { background: var(--marigold-soft); color: var(--marigold); border-color: transparent; }
.badge.planning { background: color-mix(in srgb, var(--info) 10%, transparent); color: var(--info); border-color: transparent; }
.badge.payable { background: var(--debit-soft); color: var(--debit); border-color: transparent; }
.badge.receivable { background: var(--credit-soft); color: var(--credit); border-color: transparent; }
.prio { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--line-strong); flex: none; }
.prio.urgent { background: var(--debit); } .prio.high { background: var(--marigold); } .prio.medium { background: var(--info); } .prio.low { background: var(--line-strong); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.due.soon { color: var(--marigold); } .due.late { color: var(--debit); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 12px; font-weight: 750; flex: none; overflow: hidden; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .8s var(--ease); }
.bar.over > span { background: var(--debit); }
.ring { --p: 0; --c: var(--accent); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring::before { content: attr(data-label); width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11.5px; font-weight: 750; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.color-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; font-weight: 650; font-size: 14px; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 600; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--surface-2); }
table.data .r { text-align: right; }
table.data tfoot td { font-weight: 750; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
/* ledger-book styling: the running balance column is ruled and shaded */
table.ledger td.bal, table.ledger th.bal { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-left: 2px solid var(--accent-line); }
table.ledger tr.reversed td { color: var(--muted); }
table.ledger tr.reversed td.desc { text-decoration: line-through; }
table.ledger tr.reversal td.desc::before { content: "↺ "; color: var(--marigold); }

/* ---------------------------------------------------------------- task cards & lists */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input, .filters select { width: auto; min-width: 150px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }
.filters .search-in { flex: 1; min-width: 200px; max-width: 340px; }
.task-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.task-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row .t-title { font-weight: 650; display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-row .t-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.done .t-title span { text-decoration: line-through; color: var(--muted); }
.task-row .t-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 3px; align-items: center; }
.task-row .t-meta .icon { width: 13px; height: 13px; }
.task-row .t-side { display: flex; align-items: center; gap: 12px; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; flex: none; transition: all .15s; }
.tick:hover { border-color: var(--credit); color: var(--credit); }
.tick.on { background: var(--credit); border-color: var(--credit); color: #fff; }
.tick .icon { width: 13px; height: 13px; }
.group-head { padding: 8px 16px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.column.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.column-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; padding: 4px 6px 6px; }
.column-head .n { color: var(--muted); font-weight: 600; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab; box-shadow: var(--shadow-1); border-left: 3px solid var(--line-strong);
  transition: transform .18s var(--ease), box-shadow .18s; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.tcard.dragging { opacity: .5; }
.tcard.p-urgent { border-left-color: var(--debit); } .tcard.p-high { border-left-color: var(--marigold); } .tcard.p-medium { border-left-color: var(--info); }
.tcard .title { font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.tcard .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.animate-in > * { animation: cardIn .35s var(--ease) both; }
.animate-in > *:nth-child(2) { animation-delay: .03s; } .animate-in > *:nth-child(3) { animation-delay: .06s; }
.animate-in > *:nth-child(4) { animation-delay: .09s; } .animate-in > *:nth-child(5) { animation-delay: .12s; } .animate-in > *:nth-child(n+6) { animation-delay: .15s; }

/* project cards */
.pcard { position: relative; display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1);
  color: var(--ink); overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s; }
.pcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--pc, var(--accent)); }
.pcard .top { display: flex; gap: 12px; align-items: flex-start; }
.pcard .name { font-weight: 720; font-size: 16px; letter-spacing: -.01em; line-height: 1.3; }
.pcard .sub { font-size: 12.5px; color: var(--muted); }
.pcard .figs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; font-size: 12.5px; }
.pcard .figs b { display: block; font-size: 14px; color: var(--ink); }
.wing-card { border-left: 4px solid var(--wc, var(--accent)); }

/* ---------------------------------------------------------------- modal / sheet */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(10, 16, 32, .48); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px;
  overflow-y: auto; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 640px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); animation: pop .22s var(--ease); display: flex; flex-direction: column; max-height: none; }
.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 440px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 4px 22px 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
  position: sticky; bottom: 0; }
.modal-foot .left { margin-right: auto; }

/* toast */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--surface); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-2);
  font-size: 14px; font-weight: 550; max-width: 420px; animation: pop .22s var(--ease); }
.toast.error { background: var(--debit); color: #fff; }
.toast.ok .icon { color: #6EE7A8; }
.toast button { margin-left: 6px; background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* map / recorder / files */
.map { height: 280px; border-radius: var(--r); border: 1px solid var(--line); z-index: 0; }
.recorder { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.rec-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--debit); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.rec-btn.on { animation: pulse 1.2s ease infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--debit) 50%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.levels { display: flex; gap: 3px; align-items: center; height: 32px; flex: 1; }
.levels i { flex: 1; background: var(--accent); border-radius: 2px; min-height: 3px; transition: height .08s; max-width: 6px; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 14px; }
.file-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-item audio { height: 34px; max-width: 260px; }
.file-thumb { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r); padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* login */
.auth-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--side-bg); color: #E6ECF5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 40px; line-height: 1.08; letter-spacing: -.035em; margin: 0 0 14px; max-width: 13ch; }
.auth-art p { color: #A9B6CC; max-width: 40ch; }
.auth-ledger { font-family: var(--mono); font-size: 13.5px; color: #93A1BA; border-top: 1px solid rgba(255,255,255,.12); max-width: 420px; }
.auth-ledger div { display: grid; grid-template-columns: 1fr auto; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.auth-ledger div:last-child { color: #fff; font-size: 16px; border-bottom: 0; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }

/* lookup / caller card */
.caller { max-width: 640px; }
.caller .head { display: flex; gap: 16px; align-items: center; }
.caller .name { font-size: 24px; font-weight: 760; letter-spacing: -.02em; }

/* print */
@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .no-print, .offline-bar { display: none !important; }
  .shell { display: block; } .content { padding: 0; } body { background: #fff; }
  .card, .table-wrap { box-shadow: none; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(4, 260px); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-2); }
  .scrim { position: fixed; inset: 0; z-index: 85; background: rgba(10,16,32,.4); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .topbar .search { display: none; }
  .content { padding: 4px 16px 110px; }
  .offline-bar { padding: 8px 16px; }
  .grid.c2, .grid.c3 { grid-template-columns: 1fr; }
  .form .cols, .form .cols.c3 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; color: var(--muted); padding: 4px 0; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a:hover { text-decoration: none; }
  .fab { display: grid; place-items: center; position: fixed; z-index: 71; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px;
    background: var(--accent); color: var(--accent-ink); border: 0; box-shadow: var(--shadow-2); cursor: pointer; }
  .fab .icon { width: 26px; height: 26px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.narrow { max-width: none; border-radius: 18px 18px 0 0; max-height: 94dvh; overflow-y: auto; animation: sheet .25s var(--ease); }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .task-row { grid-template-columns: auto 1fr; }
  .task-row .t-side { grid-column: 2; justify-content: flex-start; }
  .equation { grid-template-columns: 1fr auto 1fr; }
  .equation .op:nth-of-type(3) { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 22px; }
  .auth-art h1 { font-size: 28px; }
  .auth-ledger { display: none; }
  .toasts { left: 16px; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom)); align-items: stretch; }
  .beam-net { font-size: 30px; }
  .stat-strip > * { border-right: 0; border-bottom: 1px solid var(--line); }
  .pcard .figs { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* refinements */
a.stat { color: inherit; }
.stat-strip { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.side-foot .avatar { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 860px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip > *:nth-child(odd) { border-right: 1px solid var(--line); }
  .beam-legend .amt { font-size: 16px; }
}

/* =====================================================================
   Mobile & installed-app layer (Android / iPhone / tablets)
   ===================================================================== */
html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html.standalone body { overscroll-behavior-y: contain; }
.nav a, .bottom-nav a, .tabs a, .chip, .btn, .segmented button { -webkit-user-select: none; user-select: none; }

/* Notch / Dynamic Island / home indicator safe areas */
.topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
.sidebar { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.auth-art { padding-top: calc(48px + env(safe-area-inset-top)); }
.content { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }

/* Hover lift only on devices with a real pointer (no stuck hover after a tap) */
@media (hover: none) {
  .tcard:hover, .pcard:hover { transform: none; box-shadow: var(--shadow-1); }
  .task-row:hover { background: transparent; }
  .task-row:active, .pcard:active, .tcard:active { background: var(--surface-2); }
}

/* Touch: comfortable tap targets and no iOS zoom on focus (inputs must be ≥16px) */
@media (pointer: coarse), (max-width: 860px) {
  input, select, textarea, .input { font-size: 16px !important; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 38px; padding: 7px 12px; }
  .icon-btn { width: 42px; height: 42px; }
  .chip { padding: 8px 13px; }
  .segmented button { padding: 9px 13px; }
  .tick { width: 28px; height: 28px; }
  .tabs a, .tabs button { padding: 12px 14px; }
  .check input { width: 20px; height: 20px; }
  .task-row { padding: 14px 16px; }
}

@media (max-width: 860px) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .bottom-nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .bottom-nav a { min-height: 48px; justify-content: center; }
  .modal-body { padding-left: 18px; padding-right: 18px; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .page-head .actions select { flex: 1 1 100%; }
  .filters select, .filters .input { flex: 1 1 140px; min-width: 0; }
  .filters .search-in { flex-basis: 100%; max-width: none; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 10px 12px; }
  .equation .term input { font-size: 18px !important; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .board .column { scroll-snap-align: start; }
  .map { height: 240px; }
  .recorder .levels { min-width: 0; }
  .file-item { flex-wrap: wrap; }
  .file-item audio { max-width: 100%; flex: 1 1 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  /* sheet grabber */
  .modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; }
}
/* Phones in landscape: keep the sheet usable */
@media (max-width: 960px) and (max-height: 500px) {
  .bottom-nav { grid-template-columns: repeat(5, 1fr); padding-top: 2px; }
  .bottom-nav a { flex-direction: row; gap: 6px; min-height: 40px; }
  .fab { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .modal { max-height: 100dvh !important; }
}
/* Keyboard open: get the bottom bar out of the way */
html.kb-open .bottom-nav, html.kb-open .fab, html.kb-open .install-banner { display: none !important; }
html.kb-open .content { padding-bottom: 24px; }

/* Pull to refresh */
.ptr { position: fixed; z-index: 95; top: calc(8px + env(safe-area-inset-top)); left: 50%; width: 40px; height: 40px; border-radius: 50%; background: var(--surface);
  box-shadow: var(--shadow-2); display: grid; place-items: center; color: var(--muted); transform: translate(-50%, -60px); pointer-events: none; }
.ptr.ready { color: var(--accent); }
.ptr.spin .icon { animation: spin .8s linear infinite; }

/* Install banner */
.install-banner { position: fixed; z-index: 72; left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 10px 10px 12px; box-shadow: var(--shadow-2); animation: sheet .3s var(--ease); }
.install-banner img { border-radius: 10px; flex: none; }
.install-banner div { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.install-banner b { display: block; }
.install-banner span { color: var(--muted); }
.install-banner .icon-btn { border: 0; width: 34px; height: 34px; }
html:not(.touch) .install-banner { display: none; }
@media (min-width: 861px) { .install-banner { left: auto; right: 20px; bottom: 20px; max-width: 420px; } }

/* Install sheet */
.install { display: flex; flex-direction: column; gap: 16px; }
.install-hero { display: flex; gap: 14px; align-items: center; }
.install-hero img { border-radius: 16px; box-shadow: var(--shadow-1); }
.install-hero b { display: block; font-size: 17px; }
.install-hero span { color: var(--muted); font-size: 13.5px; }
.isteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.istep { display: flex; gap: 12px; align-items: flex-start; line-height: 1.5; }
.istep-n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 750; font-size: 13px; flex: none; }
.ikey { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 650; white-space: nowrap; }
.install-cta { width: 100%; padding: 14px; font-size: 16px; }
.install-done, .install-warn { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; align-items: flex-start; }
.install-done { background: var(--credit-soft); color: var(--ink); } .install-done .icon { color: var(--credit); }
.install-warn { background: var(--marigold-soft); } .install-warn .icon { color: var(--marigold); flex: none; }
.install-warn code { overflow-wrap: anywhere; }
.install-qr { display: flex; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.install-qr p { margin: 4px 0; font-size: 13.5px; color: var(--muted); }
.install-qr code { font-size: 12px; overflow-wrap: anywhere; }
.install-more summary { cursor: pointer; font-weight: 650; }
.install-more h4 { margin: 12px 0 2px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.install-more p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 480px) { .install-qr { flex-direction: column; text-align: center; } }
/* keep the + button clear of the install banner */
html.has-banner .fab { bottom: calc(90px + var(--banner-h, 72px) + env(safe-area-inset-bottom)); transition: bottom .25s var(--ease); }
@media (max-width: 400px) {
  .install-banner span { display: none; }
  .install-banner img { width: 34px; height: 34px; }
  .install-banner { gap: 10px; }
}
/* Ledger equation as a stacked calculation on phones */
@media (max-width: 860px) {
  .equation { grid-template-columns: 1fr; gap: 0; padding: 4px 14px; }
  .equation .op { display: none !important; }
  .equation .term { display: grid; grid-template-columns: 1fr minmax(120px, 52%); align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line-strong); }
  .equation .term .lbl { margin: 0; font-size: 13.5px; }
  .equation .term .fixed { text-align: right; padding: 0; font-size: 17px; }
  .equation .term:nth-of-type(2) .lbl::before { content: "+ "; color: var(--muted); font-family: var(--mono); }
  .equation .term:nth-of-type(3) .lbl::before { content: "− "; color: var(--muted); font-family: var(--mono); }
  .equation .term.result { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: -1px; }
  .equation .term.result .lbl { font-weight: 750; color: var(--ink); font-size: 14.5px; }
  .equation .term.result .fixed { font-size: 21px; }
}
/* The + (new task) button only where it is the main action */
html:not([data-route=dashboard]):not([data-route=tasks]):not([data-route=projects]):not([data-route=learning]) .fab { display: none; }
.fab[hidden] { display: none !important; }

/* =====================================================================
   Visual refresh v2 — softer depth, richer colour, ledger-paper hero
   ===================================================================== */
:root {
  --paper: #EDF1F6;
  --surface-2: #F5F7FA;
  --line: #E1E6EE;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(20, 33, 61, .05), 0 6px 18px -10px rgba(20, 33, 61, .18);
  --shadow-2: 0 2px 6px rgba(20, 33, 61, .06), 0 22px 44px -18px rgba(20, 33, 61, .32);
  --ink-deep: #101B33;
  --t-teal: #0E7C73; --t-blue: #2F5FD0; --t-red: #C2412D; --t-green: #1C7C45; --t-amber: #C27A12; --t-violet: #6D4AC9; --t-grey: #64708A;
}
:root[data-theme="dark"] {
  --paper: #0B1222; --surface: #121B2F; --surface-2: #17223A; --line: #223050; --ink-deep: #070C18;
  --t-teal: #3CC2B4; --t-blue: #7CA1FF; --t-red: #F07F72; --t-green: #4CC283; --t-amber: #E8A94B; --t-violet: #A88BFA; --t-grey: #8C98AE;
  --shadow-1: 0 1px 2px rgba(0,0,0,.45), 0 8px 22px -12px rgba(0,0,0,.6);
}
body { background: var(--paper); }
:root:not([data-theme="dark"]) body { background:
  radial-gradient(1200px 500px at 85% -120px, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--paper); background-attachment: fixed; }

/* page entrance — once per navigation */
#main > div { animation: pageIn .32s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }

/* sidebar */
.sidebar { background: linear-gradient(180deg, #172748 0%, var(--side-bg) 38%, #111C35 100%); border-right: 1px solid rgba(255,255,255,.04); }
:root[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #0E1730 0%, #080E1C 100%); }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
  box-shadow: 0 6px 16px -6px var(--accent), inset 0 1px 0 rgba(255,255,255,.25); }
.nav a { padding: 10px 12px; border-radius: 11px; transition: background .15s, color .15s; }
.nav a .icon { opacity: .8; }
.nav a.active { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, transparent), rgba(255,255,255,.04)); color: #fff; }
.nav a.active .icon { opacity: 1; color: color-mix(in srgb, var(--accent) 55%, #fff); }
.nav a.active::before { width: 4px; box-shadow: 0 0 12px var(--accent); }
.side-foot { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; }

/* topbar */
.topbar { background: color-mix(in srgb, var(--paper) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.topbar .search input { border-radius: 12px; border-color: transparent; background: var(--surface); box-shadow: var(--shadow-1); }
.icon-btn { border-radius: 12px; border-color: transparent; box-shadow: var(--shadow-1); }

/* cards, buttons */
.card, .stat-strip, .table-wrap, .task-list, .pcard, .empty { border-color: color-mix(in srgb, var(--line) 80%, transparent); }
.card { border-radius: var(--r-lg); padding: 20px 22px; }
.card h3 { font-size: 15.5px; letter-spacing: -.01em; margin-bottom: 14px; }
.btn { border-radius: 11px; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 8px 18px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); }
.page-head h1 { font-size: 28px; letter-spacing: -.03em; }
.tabs { gap: 4px; border-bottom-color: var(--line); }
.tabs .on { border-bottom-width: 3px; }
.badge { padding: 3px 9px; }

/* tone helpers */
.tone-teal { --tone: var(--t-teal); } .tone-blue { --tone: var(--t-blue); } .tone-red { --tone: var(--t-red); } .tone-green { --tone: var(--t-green); }
.tone-amber { --tone: var(--t-amber); } .tone-violet { --tone: var(--t-violet); } .tone-grey { --tone: var(--t-grey); }
.h-ic { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); flex: none; }
.more-link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 650; }

/* ---------- dashboard hero: ledger-paper panel ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 28px; margin: 16px 0 18px; padding: 28px 30px;
  border-radius: 24px; color: #E8EEF8; overflow: hidden; isolation: isolate;
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(255,255,255,.045) 31px 32px),
    radial-gradient(600px 300px at 100% 0%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 70%),
    radial-gradient(500px 260px at 0% 100%, rgba(217,144,44,.16), transparent 70%),
    linear-gradient(135deg, #1A2B50, var(--ink-deep));
  box-shadow: 0 24px 50px -24px rgba(16, 27, 51, .55); }
.hero::after { content: ""; position: absolute; top: 0; bottom: 0; left: 64px; width: 1px; background: rgba(217, 144, 44, .35); z-index: -1; }
.hero.no-money { grid-template-columns: 1fr; }
.hero-greet { display: flex; flex-direction: column; justify-content: center; padding-left: 52px; }
.hero-date { font-size: 13px; color: #9FB0CC; font-weight: 600; }
.hero h1 { font-size: 32px; line-height: 1.12; margin: 6px 0 8px; letter-spacing: -.035em; color: #fff; font-weight: 760; }
.hero p { margin: 0; color: #B5C2D8; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.btn.ghost-light { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
.btn.ghost-light:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.24); }
.hero-money { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 20px 22px 18px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hero-label { font-size: 13px; font-weight: 700; color: #C9D4E6; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.hero-label span { font-weight: 500; color: #8FA0BD; }
.hero .beam-net { font-size: 40px; margin-top: 6px; color: #fff; }
.hero .beam-net.pos { color: #7BE3A8; } .hero .beam-net.neg { color: #FF9C8F; }
.hero .beam-net .cur { color: #8FA0BD; }
.hero .beam { background: rgba(255,255,255,.1); height: 12px; margin: 18px 0 10px; }
.hero .beam .in { background: linear-gradient(90deg, #1C9B57, #3FCB82); }
.hero .beam .out { background: linear-gradient(90deg, #E2604F, #B4352A); }
.hero .beam-fulcrum span { background: #fff; top: -28px; height: 20px; }
.hero .beam-fulcrum span::after { border-bottom-color: #fff; }
.hero .beam-legend a { color: inherit; text-decoration: none; }
.hero .beam-legend .lbl { color: #B5C2D8; }
.hero .beam-legend .lbl i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.hero .beam-legend .lbl i.in { background: #3FCB82; } .hero .beam-legend .lbl i.out { background: #E2604F; }
.hero .beam-legend .amt { color: #fff; font-size: 21px; }
.hero .beam-legend .sub { font-size: 12.5px; color: #8FA0BD; display: block; }
.hero .beam-legend .warn { color: #FFC56B; font-weight: 650; }

/* metric cards */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 16px 18px 15px; border-radius: 18px; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); box-shadow: var(--shadow-1); color: var(--ink); overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s; }
.metric::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone) 16%, transparent), transparent 70%); }
.metric:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.metric-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 8px; color: var(--tone);
  background: color-mix(in srgb, var(--tone) 13%, transparent); }
.metric-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.metric-value { font-size: 28px; font-weight: 780; letter-spacing: -.03em; line-height: 1.15; }
.metric-value.money { font-family: var(--mono); font-weight: 500; font-size: 21px; letter-spacing: -.02em; }
.tone-red .metric-value:not(.money) { color: var(--t-red); }
.metric-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.mini-bar { flex: 0 0 56px; height: 5px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: 9px; background: var(--tone, var(--accent)); }
.mini-bar.out i { background: var(--t-amber); }
.dash-row { margin-top: 14px; }

/* deadlines with calendar tiles */
.deadlines { display: flex; flex-direction: column; gap: 4px; }
.deadline { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 9px 8px; border-radius: 12px; color: var(--ink); }
.deadline:hover { background: var(--surface-2); text-decoration: none; }
.date-tile { width: 46px; border-radius: 11px; overflow: hidden; text-align: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); flex: none; }
.date-tile b { display: block; font-size: 18px; line-height: 1; padding: 7px 0 3px; letter-spacing: -.02em; }
.date-tile span { display: block; font-size: 10.5px; font-weight: 750; background: var(--accent); color: var(--accent-ink); padding: 2px 0; }
.dl-main { min-width: 0; }
.dl-title { font-weight: 650; display: flex; gap: 8px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dl-main .t-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* project progress */
.proj-progress { display: flex; flex-direction: column; gap: 6px; }
.pp { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 9px 8px; border-radius: 12px; color: var(--ink); }
.pp:hover { background: var(--surface-2); text-decoration: none; }
.pp .ring { width: 48px; height: 48px; }
.pp .ring::before { width: 38px; height: 38px; }
.pp-name { font-weight: 680; margin-bottom: 6px; }
.pp .t-meta { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.soft-empty { display: grid; place-items: center; gap: 4px; padding: 26px 10px; color: var(--muted); text-align: center; }
.soft-empty .icon { color: var(--t-green); width: 28px; height: 28px; }
.soft-empty p { margin: 0; }

/* charts */
.chart-box { position: relative; height: 240px; }
.donut-center { position: absolute; left: 0; right: 0; top: 0; bottom: 34px; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 28px; letter-spacing: -.03em; line-height: 1; }
.donut-center span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* payments due */
.due-list { display: flex; flex-direction: column; gap: 4px; }
.due-item { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 10px 8px; border-radius: 12px; color: var(--ink); }
.due-item:hover { background: var(--surface-2); text-decoration: none; }
.due-item b { display: block; font-weight: 650; }
.due-item .muted { font-size: 12.5px; }
.due-item .money { font-weight: 600; }
.due-dir { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.due-dir.payable { color: var(--t-red); background: color-mix(in srgb, var(--t-red) 13%, transparent); }
.due-dir.receivable { color: var(--t-green); background: color-mix(in srgb, var(--t-green) 13%, transparent); }

/* lists & project cards across the app */
.task-list { border-radius: 18px; box-shadow: var(--shadow-1); }
.task-row { position: relative; transition: background .15s; }
.task-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); opacity: 0; transition: opacity .15s; }
@media (hover: hover) { .task-row:hover::before { opacity: 1; } }
.tick { border-width: 2px; }
.tick.on { box-shadow: 0 4px 10px -4px var(--credit); }
.pcard { border-radius: 20px; padding: 0; gap: 0; }
.pcard::before { display: none; }
.pcard > .top { padding: 18px 18px 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--pc, var(--accent)) 12%, transparent), transparent);
  border-top: 4px solid var(--pc, var(--accent)); }
.pcard > :not(.top) { padding-left: 18px; padding-right: 18px; }
.pcard > :last-child { padding-bottom: 18px; }
.pcard > .figs { padding-top: 4px; padding-bottom: 12px; }
.pcard > div:not(.top):not(.figs) { padding-bottom: 14px; }
.pcard .ring { width: 52px; height: 52px; }
.pcard .ring::before { width: 42px; height: 42px; font-size: 12px; }
.wing-card { border-left: 0; }
.pcard.wing-card > .top { border-top-width: 4px; }
.stat-strip { border-radius: 18px; }
.ring { --c: var(--accent); }
table.data th { background: transparent; color: var(--muted); border-bottom-color: var(--line); }
table.data thead tr { background: var(--surface-2); }

/* sign-in */
.auth-art { background:
  repeating-linear-gradient(180deg, transparent 0 35px, rgba(255,255,255,.04) 35px 36px),
  radial-gradient(700px 400px at 100% 0%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
  radial-gradient(500px 300px at 0% 100%, rgba(217,144,44,.18), transparent 70%),
  linear-gradient(140deg, #1A2B50, #0C152A); }
.auth-ledger { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 8px 20px; backdrop-filter: blur(6px);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); transform: rotate(-1.5deg); }
.auth-ledger div:last-child { color: #7BE3A8; font-weight: 500; }
.auth-form form { background: var(--surface); padding: 30px 28px; border-radius: 22px; box-shadow: var(--shadow-2); border: 1px solid var(--line); }

/* responsive for the new pieces */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero { margin: 8px 0 14px; padding: 22px 18px; border-radius: 20px; gap: 20px; }
  .hero::after { left: 24px; }
  .hero-greet { padding-left: 18px; }
  .hero h1 { font-size: 26px; }
  .hero .beam-net { font-size: 32px; }
  .hero-money { padding: 16px; }
  .hero .beam-legend .amt { font-size: 16px; }
  .metrics { gap: 10px; }
  .metric { padding: 14px; border-radius: 16px; }
  .metric-value { font-size: 24px; }
  .metric-value.money { font-size: 16px; }
  .metric-sub { font-size: 11.5px; }
  .mini-bar { flex-basis: 34px; }
  .due-item { grid-template-columns: auto 1fr auto; }
  .due-item .due { grid-column: 2; grid-row: 2; }
  .due-item .money { grid-column: 3; grid-row: 1 / span 2; }
  .deadline { grid-template-columns: auto 1fr; }
  .deadline > .due { grid-column: 2; }
  .auth-form form { box-shadow: none; border: 0; padding: 8px 4px; background: transparent; }
}
@media (max-width: 380px) { .metric-value.money { font-size: 14.5px; } }
.pcard > span { display: block; padding-bottom: 14px; }
.hero .beam-legend .warn { display: block; margin-top: 2px; }
.metric::after { opacity: .7; }
.pcard .ring { --c: var(--pc, var(--accent)); }
/* filter toolbar as one panel */
.filters { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow-1); }
.filters .input, .filters select { background: var(--surface-2); border-color: transparent; border-radius: 10px; }
.filters .search-in { background-image: none; }
.filters .chip { border-color: transparent; background: var(--surface-2); }
.filters .chip.on { background: var(--ink); color: var(--surface); }
:root[data-theme="dark"] .filters .chip.on { background: var(--accent); color: #fff; }
.task-row .t-title { font-size: 15px; }
.prio { width: 9px; height: 9px; border-radius: 50%; }
@media (max-width: 860px) {
  .filters { padding: 10px; gap: 8px; }
  .filters .chips { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .filters .chips::-webkit-scrollbar { display: none; }
  .filters .chip { flex: none; }
  .filters .check { font-size: 14px; }
  .hero .beam-legend .sub { font-size: 11.5px; }
}
