/* EMI Dost Accounts. The look comes from the owner's Claude Design canvas ("EMI Dost Accounts screens"):
   a dark trading-terminal ground with precise type and tables. Ground #0B0E11, panels #15181D, lines #2B3139,
   ONE gold accent #F0B90B for actions and what needs the owner; green = money in / received, red = owed / overdue,
   always with a word. IBM Plex Sans, tabular figures. A light theme is kept for print and for daylight. */
@font-face { font-family: "Plex"; src: url("/fonts/IBMPlexSans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #0b0e11; --card: #15181d; --raise: #1e2329; --line: #2b3139; --line-strong: #3a424d; --text: #eaecef; --mute: #929aa5;
  --accent: #f0b90b; --accent-text: #181a20; --accent-soft: rgba(240, 185, 11, .12);
  --good: #0ecb81; --bad: #f6465d; --warn: #f0b90b; --info: #3b8cff; --focus: #f0b90b; --hover: #1e2329;
  --good-bg: rgba(14, 203, 129, .12); --bad-bg: rgba(246, 70, 93, .12); --warn-bg: rgba(240, 185, 11, .12); --mute-bg: #1e2329;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f5f5; --card: #ffffff; --raise: #f0f1f2; --line: #e3e5e8; --line-strong: #cfd3d8; --text: #181a20; --mute: #5e6673;
  --accent: #f0b90b; --accent-text: #181a20; --accent-soft: rgba(240, 185, 11, .18);
  --good: #0a8f5b; --bad: #cf304a; --warn: #8a6800; --info: #1d6fe0; --focus: #8a6800; --hover: #f0f1f2;
  --good-bg: rgba(14, 203, 129, .14); --bad-bg: rgba(246, 70, 93, .12); --warn-bg: rgba(240, 185, 11, .2); --mute-bg: #f0f1f2;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.45 "Plex", system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 24px 0 8px; }
.mute { color: var(--mute); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* shell */
#app { display: flex; height: 100%; }
.side { width: 208px; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 16px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; }
.brand img { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.nav a[data-k] { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; font-weight: 500; color: var(--mute); }
.nav svg, .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side a[data-k]:hover { background: var(--hover); color: var(--text); }
.side a.on { background: var(--raise); color: var(--text); font-weight: 600; } .side a.on svg { color: var(--accent); }
:root[data-nav="mini"] .side { width: 52px; }
:root[data-nav="mini"] .side a[data-k] span, :root[data-nav="mini"] .side .brand span { display: none; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; gap: 8px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.top input[type=search] { flex: 1; max-width: 320px; margin-right: auto; }
.brand.small { display: none; padding: 0; }
#main { flex: 1; overflow: auto; padding: 20px; outline: none; }
#main.loading { opacity: .6; }
.bottom { display: none; }
.print-head { display: none; }
.skeleton { display: grid; gap: 12px; padding-top: 8px; }
.skeleton i { display: block; height: 16px; border-radius: 4px; background: var(--line); }
.skeleton i:nth-child(odd) { width: 72%; }

/* pieces */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-actions, .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tools { margin: 0 0 12px; }
.tabs { display: flex; gap: 20px; overflow-x: auto; margin: 0 0 12px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 8px 0; white-space: nowrap; color: var(--mute); font-weight: 500; }
.tabs a.on { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; min-height: 36px; padding: 4px 14px; border-radius: 8px; border: 0; background: var(--raise); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--bad); color: #ffffff; }
.btn.ghost { border-color: transparent; background: transparent; font-weight: 500; }
.btn.ghost:hover { background: var(--hover); }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; min-width: 0; min-height: 36px; }
input::placeholder { color: var(--mute); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
.period { display: flex; gap: 8px; flex-wrap: wrap; }
/* a badge: a tinted label with a word; the word carries the meaning, the colour repeats it */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; margin-right: 6px; padding: 3px 10px; border-radius: 6px; background: var(--mute-bg); color: var(--mute); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.good { background: var(--good-bg); color: var(--good); } .chip.warn, .chip.gold { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.mute { color: var(--mute); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.kpi { display: grid; gap: 4px; align-content: start; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
a.kpi:hover { border-color: var(--accent); }
.kpi-l { color: var(--mute); font-size: 13px; font-weight: 500; }
.kpi-v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.kpi-n { color: var(--mute); font-size: 13px; }
.kpi.alert .kpi-v { color: var(--bad); }
.empty { color: var(--mute); padding: 24px 0; } .empty.bad, .bad-text { color: var(--bad); font-weight: 500; } .good-text { color: var(--good); font-weight: 500; }
.split { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
dl.facts { display: grid; grid-template-columns: auto 1fr; margin: 0 0 16px; }
dl.facts dt { color: var(--mute); padding: 8px 16px 8px 0; border-bottom: 1px solid var(--line); }
dl.facts dd { margin: 0; text-align: right; padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 500; }

/* the needs-attention list */
.todo a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.todo a:last-child { border-bottom: 0; }
.todo a:hover strong { text-decoration: underline; }
.todo strong { font-weight: 600; } .todo small { display: block; color: var(--mute); font-size: 13px; }
.todo b { font-weight: 700; font-size: 15px; } .todo b.zero { color: var(--good); font-size: 13px; font-weight: 600; }

/* tables: sticky head, right-aligned figures, totals at the foot */
.table-wrap { overflow: auto; max-height: calc(100vh - 220px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--mute); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--card); z-index: 1; }
button.th { all: unset; cursor: pointer; font: inherit; color: inherit; }
button.th:hover { color: var(--text); } button.th:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th[aria-sort] button.th { color: var(--text); }
th[aria-sort="ascending"] button.th::after { content: " ↑"; } th[aria-sort="descending"] button.th::after { content: " ↓"; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
tr.row-link { cursor: pointer; } tr.row-link:hover td { background: var(--hover); }
tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; position: sticky; bottom: 0; background: var(--card); }
tr.sub td { font-weight: 700; background: var(--hover); }
td .sm { display: block; color: var(--mute); font-size: 13px; }

/* a record opens in a panel at the side, not on a new page */
.dlg { border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; padding: 0; margin: 0 0 0 auto; background: var(--card); color: var(--text); width: min(520px, 100vw); height: 100vh; max-height: 100vh; }
.dlg.wide { width: min(960px, 100vw); }
.dlg::backdrop { background: rgba(0, 0, 0, .6); }
.dlg header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 2; }
.dlg .x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--mute); cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 6px; }
.dlg .x:hover { background: var(--hover); }
.dlg-body { padding: 16px 20px 24px; }
.dlg-body .table-wrap { max-height: none; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 500; }
.field.check { grid-template-columns: auto 1fr; align-items: center; gap: 8px; } .field.check > span { order: 2; }
.field small { color: var(--mute); font-size: 13px; }
.form-note { color: var(--mute); margin: 0 0 12px; }
.form-err { color: var(--bad); min-height: 1.2em; margin: 4px 0; font-weight: 500; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 500; padding: 8px 16px; border-radius: 6px; z-index: 99; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

/* sign in */
.signin { margin: auto; padding: 20px; width: min(380px, 100%); }
.signin .card { display: grid; gap: 4px; padding: 24px; }
.signin .logo { width: 36px; height: 36px; border-radius: 8px; margin-bottom: 8px; }
.signin .btn { margin-top: 8px; min-height: 40px; } .signin input { min-height: 40px; }
.signin p { margin: 0 0 12px; }

/* one chart */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 168px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.bars i { display: block; width: 100%; max-width: 56px; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .45; min-height: 2px; }
.bars div:last-child i { opacity: 1; }
.bars small { color: var(--mute); font-size: 12px; white-space: nowrap; }
.tree td:first-child { white-space: nowrap; }

/* phone: bottom nav, 44 px targets, tables become stacked rows with the amount on the right */
@media (max-width: 820px) {
  .side, .top .menu, .top .who { display: none; }
  .brand.small { display: flex; }
  .top { padding: 8px 12px; }
  #main { padding: 12px 12px 76px; }
  .bottom { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
  .bottom a[data-k] { flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; font-size: 11.5px; padding: 4px 2px; border-radius: 0; }
  .bottom a.on { color: var(--accent); font-weight: 600; }
  .bottom { background: var(--card); }
  .split { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; } .kpi-v { font-size: 18px; }
  .btn, input, select, .dlg .x { min-height: 44px; }
  .period input { flex: 1; }
  .toast { bottom: 72px; }
  .table-wrap { max-height: none; border: 0; background: transparent; }
  thead { position: absolute; left: -9999px; }
  table, tbody, tfoot, tr, td { display: block; }
  tbody tr, tfoot tr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin-bottom: 8px; }
  td, tbody tr:last-child td { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: normal; }
  tr td:last-child { border-bottom: 0; }
  td::before { content: attr(data-t); color: var(--mute); font-weight: 500; text-align: left; flex: none; }
  td:empty, td[data-t=""]:not(.num) { display: none; }
  tfoot td { position: static; border-top: 0; } tfoot td:not([data-t]) { display: none; }
}

/* paper: the company header on every printed page, no menus */
@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --mute: #333; --line: #bbb; --line-strong: #888; color-scheme: light; }
  .side, .top, .bottom, .tabs, .tools, .head-actions, .actions, .toast, .no-print { display: none !important; }
  #app, .col, #main { display: block; height: auto; overflow: visible; padding: 0; }
  .print-head { display: flex; gap: 12px; align-items: center; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
  .print-head img { width: 40px; height: 40px; } .print-head div { display: grid; font-size: 12px; } .print-head b { font-size: 16px; }
  .table-wrap { overflow: visible; max-height: none; border: 0; } th, tfoot td { position: static; }
  dialog.dlg[open] { position: static; width: auto; height: auto; max-height: none; border: 0; }
  body:has(dialog[open]) #app { display: none; }
}

/* home: the balance with money in and out; status tabs with counts above a table */
.balance { display: block; font-size: 38px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin: 4px 0 12px; }
.balance:hover { text-decoration: underline; }
.inout { display: flex; flex-wrap: wrap; gap: 8px 32px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.inout a { display: grid; gap: 2px; } .inout strong { font-size: 15px; font-weight: 600; }
h2.gap { margin-top: 20px; }
.seg { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 12px; scrollbar-width: none; }
.seg button { font: inherit; font-weight: 500; white-space: nowrap; min-height: 32px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--mute); cursor: pointer; }
.seg button span { margin-left: 6px; font-weight: 600; color: var(--text); }
.seg button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.seg button[aria-selected="true"] span { color: var(--accent); }
@media (max-width: 820px) { .balance { font-size: 28px; } .seg button { min-height: 44px; } }

/* EmiDost AI */
.ai-do { color: var(--accent); font-weight: 600; margin-top: -8px; }
.ask { flex: 1; min-width: 200px; }
.wide-text { width: 100%; margin-bottom: 8px; }
.top .ai-link { color: var(--accent); font-weight: 600; }
@media (min-width: 821px) { .top .ai-link { display: none; } }
@media (max-width: 820px) { .brand.small span { display: none; } .top input[type=search] { max-width: none; } }

/* ===== Premium layer (12 Nov): depth, light and motion on every piece. Same colours, same layout.
   Panels sit like machined plates: a soft gradient face, a 1px top highlight, a quiet ambient shadow.
   Motion uses one spring-like curve; nothing moves for people who ask for less motion. Screen only. ===== */
:root {
  --ease: cubic-bezier(.32, .72, 0, 1); --ease-out: cubic-bezier(.16, 1, .3, 1);
  --face: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0) 40%), var(--card);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .05);
  --lift: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -12px rgba(0, 0, 0, .45);
  --lift-hover: 0 2px 4px rgba(0, 0, 0, .25), 0 18px 40px -16px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(240, 185, 11, .22);
}
:root[data-theme="light"] {
  --face: linear-gradient(180deg, #ffffff, #fcfcfd);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --lift: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px -12px rgba(16, 24, 40, .12);
  --lift-hover: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 36px -16px rgba(16, 24, 40, .2);
  --ring: 0 0 0 3px rgba(240, 185, 11, .3);
}
@media screen {
  /* ground: a faint warm light from the top corner, fixed so it never repaints while scrolling */
  body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(900px 480px at 85% -10%, rgba(240, 185, 11, .06), transparent 60%), radial-gradient(700px 420px at -10% 110%, rgba(14, 203, 129, .035), transparent 60%); }
  :root[data-theme="light"] body::before { background: radial-gradient(900px 480px at 85% -10%, rgba(240, 185, 11, .08), transparent 60%); }
  #app { position: relative; z-index: 1; }
  ::selection { background: rgba(240, 185, 11, .3); }
  * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  h1 { font-size: 22px; letter-spacing: -.02em; }

  /* side menu: a quiet rail, the open page lifted with a gold tick */
  .side { background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent), var(--card); padding: 14px 10px; gap: 3px; }
  .brand { padding: 4px 8px 18px; letter-spacing: -.01em; }
  .brand img { box-shadow: 0 0 0 1px var(--line), 0 6px 16px -6px rgba(240, 185, 11, .45); }
  .nav a[data-k] { position: relative; transition: background-color .25s var(--ease), color .25s var(--ease); }
  .nav a[data-k] svg { transition: transform .35s var(--ease), color .25s var(--ease); }
  .side a[data-k]:hover svg { transform: translateX(1px) scale(1.06); }
  .side a.on { background: var(--raise); box-shadow: var(--hi), 0 0 0 1px var(--line); }
  .side a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px rgba(240, 185, 11, .6); }

  /* top bar: frosted glass, stays put */
  .top { position: sticky; top: 0; z-index: 4; background: color-mix(in srgb, var(--card) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
  .top input[type=search] { padding-left: 34px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23929aa5' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 11px 50%; }

  /* buttons: physical, a light top edge and a press that gives */
  .btn { border-radius: 10px; box-shadow: var(--hi), 0 0 0 1px var(--line); transition: background-color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease), color .2s var(--ease); }
  .btn:hover { background: var(--line); box-shadow: var(--hi), 0 0 0 1px var(--line-strong); }
  .btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
  .btn.primary { background: linear-gradient(180deg, #ffd24a, #f0b90b 55%, #e2ab00); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 1px #c99a00, 0 6px 18px -8px rgba(240, 185, 11, .6); }
  .btn.primary:hover { background: linear-gradient(180deg, #ffd85e, #f5c11e 55%, #e8b200); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 0 1px #c99a00, 0 10px 26px -8px rgba(240, 185, 11, .75); }
  .btn.danger { background: linear-gradient(180deg, #ff6178, #f6465d); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 1px #d43a50, 0 6px 18px -8px rgba(246, 70, 93, .6); }
  .btn.ghost { box-shadow: none; }
  .btn:focus-visible { outline: 0; box-shadow: var(--hi), 0 0 0 1px var(--accent), var(--ring); }

  /* fields: set into the surface, a soft gold ring when typing */
  input, select, textarea { background-color: var(--bg); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); transition: border-color .2s var(--ease), box-shadow .25s var(--ease); }
  :root[data-theme="light"] input, :root[data-theme="light"] select, :root[data-theme="light"] textarea { background-color: #fff; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .05); }
  input[type=checkbox] { box-shadow: none; }
  input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
  input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: var(--ring); }
  select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23929aa5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }

  /* panels and figure tiles: machined plates */
  .card, .kpi, .table-wrap { background: var(--face); box-shadow: var(--hi), var(--lift); border-color: var(--line); border-radius: 16px; }
  .card { padding: 18px 20px; }
  .kpi { position: relative; overflow: hidden; padding: 14px 18px 16px; transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s var(--ease); }
  .kpi::after { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(240, 185, 11, .55), transparent); opacity: 0; transition: opacity .4s var(--ease); }
  a.kpi:hover { transform: translateY(-2px); border-color: rgba(240, 185, 11, .45); box-shadow: var(--hi), var(--lift-hover); }
  a.kpi:hover::after { opacity: 1; }
  .kpi-l { font-size: 12px; letter-spacing: .02em; text-transform: uppercase; font-weight: 600; }
  .kpi-v { font-size: 24px; letter-spacing: -.025em; }
  .balance { font-size: 42px; letter-spacing: -.035em; }
  .inout a { padding: 6px 10px; margin: -6px -10px; border-radius: 10px; transition: background-color .25s var(--ease); }
  .inout a:hover { background: var(--hover); }

  /* needs attention: each line a quiet row, "Open" a small gold pill with an arrow */
  .todo a { padding: 8px 10px; margin: 0 -10px; border-radius: 10px; border-bottom-color: transparent; box-shadow: 0 1px 0 var(--line); transition: background-color .25s var(--ease); }
  .todo a:last-child { box-shadow: none; }
  .todo a:hover { background: var(--hover); } .todo a:hover strong { text-decoration: none; }
  .todo b.go { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 5px 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .3); white-space: nowrap; }
  :root[data-theme="light"] .todo b.go { color: var(--warn); }
  .todo b.go::after { content: "\2192"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(240, 185, 11, .18); font-size: 11px; transition: transform .35s var(--ease); }
  .todo a:hover b:not(.zero)::after { transform: translateX(2px); }
  .todo b.zero { display: inline-flex; align-items: center; gap: 6px; } .todo b.zero::before { content: "\2713"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--good-bg); font-size: 10px; }

  /* tabs: a gold underline that slides in; status filters as soft pills */
  .tabs a { position: relative; transition: color .2s var(--ease); }
  .tabs a:hover { color: var(--text); }
  .tabs a.on { box-shadow: none; }
  .tabs a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform .4s var(--ease); }
  .tabs a.on::after { transform: scaleX(1); box-shadow: 0 0 10px rgba(240, 185, 11, .5); }
  .seg button { border-radius: 999px; padding: 4px 12px; box-shadow: var(--hi); transition: background-color .25s var(--ease), border-color .25s var(--ease), color .2s var(--ease); }
  .seg button:hover { border-color: var(--line-strong); color: var(--text); }
  .seg button span { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--raise); font-size: 12px; text-align: center; }
  .seg button[aria-selected="true"] { box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .35), 0 4px 14px -8px rgba(240, 185, 11, .6); }
  .seg button[aria-selected="true"] span { background: rgba(240, 185, 11, .18); }

  /* badges: a hairline ring; overdue breathes so the eye finds it */
  .chip { border-radius: 999px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
  .chip.bad::before { animation: pulse 2.4s var(--ease) infinite; }

  /* tables: frosted header, rows that warm on hover, totals on a raised foot */
  th { background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; padding: 11px 14px; }
  td { padding: 11px 14px; transition: background-color .18s var(--ease); }
  tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .012); }
  :root[data-theme="light"] tbody tr:nth-child(even) td { background: #fafbfc; }
  tr.row-link:hover td { background: var(--hover); }
  tr.row-link:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
  tfoot td, tr.sub td { background: var(--raise); }

  /* the one chart: bars rise on load, gold deepens to the current month */
  .bars i { background: linear-gradient(180deg, rgba(240, 185, 11, .85), rgba(240, 185, 11, .25)); opacity: .55; border-radius: 6px 6px 2px 2px; transform-origin: bottom; animation: rise .9s var(--ease-out) both; transition: opacity .25s var(--ease); }
  .bars div:hover i { opacity: .9; }
  .bars div:last-child i { background: linear-gradient(180deg, #ffd24a, #f0b90b); box-shadow: 0 0 24px -4px rgba(240, 185, 11, .55); }
  .bars div:nth-child(2) i { animation-delay: .05s; } .bars div:nth-child(3) i { animation-delay: .1s; } .bars div:nth-child(4) i { animation-delay: .15s; }
  .bars div:nth-child(5) i { animation-delay: .2s; } .bars div:nth-child(6) i { animation-delay: .25s; }

  /* side panel: slides in from the right over a blurred page */
  .dlg { box-shadow: -24px 0 60px -20px rgba(0, 0, 0, .6); background: var(--face); }
  .dlg[open] { animation: panel-in .5s var(--ease); }
  .dlg::backdrop { background: rgba(5, 7, 9, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
  .dlg header { background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 14px 20px; }
  .dlg .x { border-radius: 999px; transition: background-color .2s var(--ease), transform .3s var(--ease); }
  .dlg .x:hover { transform: rotate(90deg); }
  .form-foot { padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); }

  /* toast: rises from the bottom like a card */
  .toast { border-radius: 999px; padding: 10px 18px; box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .55); animation: toast-in .5s var(--ease); }

  /* loading: a slow sheen instead of grey blocks */
  .skeleton i { background: linear-gradient(90deg, var(--line) 0%, var(--raise) 40%, var(--line) 80%); background-size: 300% 100%; animation: sheen 1.4s linear infinite; border-radius: 6px; }

  /* every screen settles in, a beat apart */
  #main > * { animation: settle .55s var(--ease-out) both; }
  #main > *:nth-child(2) { animation-delay: .04s; } #main > *:nth-child(3) { animation-delay: .08s; } #main > *:nth-child(4) { animation-delay: .12s; } #main > *:nth-child(n+5) { animation-delay: .16s; }
  .grid > .kpi { animation: settle .6s var(--ease-out) both; }
  .grid > .kpi:nth-child(2) { animation-delay: .05s; } .grid > .kpi:nth-child(3) { animation-delay: .1s; } .grid > .kpi:nth-child(4) { animation-delay: .15s; } .grid > .kpi:nth-child(5) { animation-delay: .2s; }

  /* sign in: one plate on a lit ground */
  .signin .card { padding: 28px; border-radius: 20px; box-shadow: var(--hi), 0 30px 80px -30px rgba(0, 0, 0, .7); }
  .signin .logo { box-shadow: 0 8px 24px -8px rgba(240, 185, 11, .6); }

  /* phone: bottom bar is frosted, rows are plates */
  @media (max-width: 820px) {
    .bottom { background: color-mix(in srgb, var(--card) 82%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); }
    .bottom a[data-k] { position: relative; }
    .bottom a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); box-shadow: 0 0 10px rgba(240, 185, 11, .6); }
    .table-wrap { box-shadow: none; background: transparent; }
    tbody tr, tfoot tr { background: var(--face); box-shadow: var(--hi), var(--lift); border-radius: 16px; }
    tbody tr:nth-child(even) td, tfoot td { background: transparent; }
    tr.row-link:hover td:first-child { box-shadow: none; }
    .balance { font-size: 32px; }
    .top select { flex: none; padding-right: 26px; background-position: right 8px center; }
    .bars { gap: 6px; } .bars div:not(:last-child) small:first-child { visibility: hidden; }
  }
  @media (hover: none) { .todo a:hover, .inout a:hover, tr.row-link:hover td { background: transparent; } a.kpi:hover { transform: none; } }
  :root[data-theme="light"] .top .ai-link, :root[data-theme="light"] .ai-do { color: var(--warn); }
}
@keyframes settle { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes panel-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(246, 70, 93, .5); } 60% { box-shadow: 0 0 0 4px rgba(246, 70, 93, 0); } }

/* ===== Section redesign (12 Nov): section headers, figure strips, names with marks, pill tabs, the AI hero,
   the two-panel sign-in, higher text contrast, and 4K scaling. ===== */

/* text that reads easily: brighter body text and labels (all well above WCAG AA on their panels) */
:root { --text: #f5f6f8; --mute: #b3bac5; }
:root[data-theme="light"] { --text: #0f1115; --mute: #454d58; }
body { font-size: 15px; line-height: 1.5; }
th { color: var(--mute); }
.kpi-l { font-size: 12.5px; color: var(--mute); }
.kpi-n, td .sm, .todo small, .field small { font-size: 13.5px; }
.chip { font-size: 13px; }
.mute { color: var(--mute); }

@media screen {
  th { font-size: 12px; }
  td { vertical-align: middle; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  /* section header: an icon tile, the name, and one line on what the section is for */
  .head { margin-bottom: 18px; align-items: flex-end; }
  .head-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
  .head-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex: none; color: var(--accent);
    background: linear-gradient(180deg, rgba(240, 185, 11, .16), rgba(240, 185, 11, .05)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(240, 185, 11, .28), 0 8px 22px -10px rgba(240, 185, 11, .5); }
  :root[data-theme="light"] .head-icon { color: #9a7400; }
  .head-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .head h1 { font-size: 26px; line-height: 1.15; }
  .head-sub { margin: 3px 0 0; color: var(--mute); font-size: 14.5px; }

  /* figure strip: four tiles under the header */
  .pulse { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
  .kpi.ghost { gap: 10px; min-height: 96px; }
  .kpi.ghost i { display: block; height: 12px; width: 55%; border-radius: 6px; background: linear-gradient(90deg, var(--line) 0%, var(--raise) 40%, var(--line) 80%); background-size: 300% 100%; animation: sheen 1.4s linear infinite; }
  .kpi.ghost i + i { height: 22px; width: 75%; }

  /* names carry a small round mark with their first letters */
  .who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
  .who > i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; font-style: normal; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
    color: var(--accent); background: linear-gradient(180deg, rgba(240, 185, 11, .2), rgba(240, 185, 11, .07)); box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .3); }
  :root[data-theme="light"] .who > i { color: #8a6800; }
  .who > span { font-weight: 600; min-width: 0; } .who small { display: block; color: var(--mute); font-weight: 400; font-size: 13px; }

  /* empty: a quiet mark and one line, centred in a dashed plate */
  .empty-state { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; margin-bottom: 16px; border: 1px dashed var(--line-strong); border-radius: 16px; text-align: center; }
  .empty-state .empty { padding: 0; }
  .empty-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--raise); color: var(--mute); box-shadow: var(--hi), 0 0 0 1px var(--line); }
  .empty-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

  /* tabs: a pill track; the open tab is a raised pill */
  .tabs { display: flex; width: max-content; max-width: 100%; gap: 2px; padding: 4px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--bg) 70%, var(--card)); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
  :root[data-theme="light"] .tabs { background: #eceef1; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06); }
  .tabs a { padding: 7px 14px; border-radius: 9px; font-weight: 600; transition: background-color .25s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease); }
  .tabs a::after { display: none; }
  .tabs a:hover { background: var(--hover); }
  .tabs a.on { background: var(--face); color: var(--text); box-shadow: var(--hi), 0 0 0 1px var(--line-strong), 0 4px 12px -6px rgba(0, 0, 0, .5); }
  :root[data-theme="light"] .tabs a.on { background: #fff; box-shadow: 0 0 0 1px var(--line), 0 2px 6px -2px rgba(16, 24, 40, .15); }

  /* facts lists inside a card read as clean rows */
  .card dl.facts { margin: 0; }
  .card dl.facts dt, .card dl.facts dd { padding: 12px 0; }
  .card dl.facts dt:last-of-type, .card dl.facts dd:last-of-type { border-bottom: 0; }
  dl.facts dd { color: var(--text); font-weight: 600; }

  /* EmiDost AI: a lit hero with the question box and ready questions */
  .ai-hero { position: relative; overflow: hidden; display: grid; gap: 10px; padding: 32px; margin-bottom: 16px; border-radius: 20px; border: 1px solid rgba(240, 185, 11, .28);
    background: radial-gradient(600px 260px at 100% 0%, rgba(240, 185, 11, .14), transparent 70%), radial-gradient(500px 240px at 0% 100%, rgba(14, 203, 129, .07), transparent 70%), var(--face);
    box-shadow: var(--hi), var(--lift); }
  .ai-orb { position: absolute; right: 36px; top: 28px; width: 88px; height: 88px; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle at 35% 30%, #fff3c4, #f0b90b 45%, rgba(240, 185, 11, 0) 72%); filter: blur(1px); opacity: .85; animation: orb 6s var(--ease) infinite alternate; }
  .ai-hero h2 { font-size: 28px; letter-spacing: -.02em; line-height: 1.15; max-width: 70%; }
  .ai-hero > p { margin: 0 0 6px; font-size: 15.5px; }
  .eyebrow { justify-self: start; display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .3); }
  :root[data-theme="light"] .eyebrow { color: #8a6800; }
  .ai-ask { display: flex; gap: 8px; max-width: 760px; }
  .ai-ask input { flex: 1; min-height: 48px; font-size: 15.5px; border-radius: 12px; padding: 4px 16px; }
  .ai-ask .btn { min-height: 48px; padding: 4px 22px; border-radius: 12px; }
  .ai-sugg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
  .btn.pill { border-radius: 999px; font-weight: 500; min-height: 34px; padding: 4px 14px; background: transparent; }
  .btn.pill:hover { background: var(--hover); }
  .btn.gold-soft { border-radius: 999px; min-height: 34px; padding: 4px 14px; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(240, 185, 11, .4); }
  :root[data-theme="light"] .btn.gold-soft { color: #8a6800; }
  .ai-out { min-height: 120px; } .ai-out h2 { font-size: 17px; margin-bottom: 8px; } .ai-out p { font-size: 15.5px; line-height: 1.6; margin: 0 0 8px; }
  .small-print { font-size: 13.5px; }

  /* sign in: the story on the left, the form on a plate on the right */
  .signin { width: min(1040px, 100%); min-height: 100dvh; display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center; padding: 40px 24px; }
  .signin-story { display: grid; gap: 22px; }
  .signin-big { margin: 0; font-size: 46px; font-weight: 700; line-height: 1.08; letter-spacing: -.035em; }
  .signin-big em { font-style: normal; color: var(--accent); }
  :root[data-theme="light"] .signin-big em { color: #9a7400; }
  .signin-story ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
  .signin-story li { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 15.5px; }
  .signin-story li::before { content: "\2713"; display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; font-size: 12px; font-weight: 700; color: var(--good); background: var(--good-bg); }
  .signin h1 { font-size: 22px; }

  @media (max-width: 1100px) { .pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 820px) {
    .head { align-items: flex-start; }
    .head-icon { width: 38px; height: 38px; border-radius: 11px; } .head h1 { font-size: 22px; } .head-sub { font-size: 13.5px; }
    .tabs { width: auto; overflow-x: auto; }
    .table-wrap { border: 0; border-radius: 0; }
    .tabs a { flex: none; }
    .ai-hero { padding: 22px 18px; } .ai-hero h2 { font-size: 23px; max-width: 75%; } .ai-orb { width: 56px; height: 56px; right: 18px; top: 18px; }
    .ai-ask { flex-direction: column; } .ai-ask .btn, .ai-ask input { min-height: 48px; }
    .signin { grid-template-columns: 1fr; gap: 24px; padding: 24px 16px; align-content: center; }
    .signin-story { gap: 12px; } .signin-big { font-size: 30px; } .signin-story ul { display: none; }
    .who > i { width: 26px; height: 26px; font-size: 10.5px; }
  }
}
@keyframes orb { from { transform: translate(0, 0) scale(1); } to { transform: translate(-10px, 8px) scale(1.08); } }

/* 4K and other very large screens: the whole app scales up so text and figures keep their size on the glass */
@media screen and (min-width: 2200px) { html { zoom: 1.25; } }
@media screen and (min-width: 2880px) { html { zoom: 1.6; } }
@media screen and (min-width: 3600px) { html { zoom: 2; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
