/* CaptainCrew Plant: one stylesheet. Design plan in web/DESIGN.md.
   Phone first; ≥ 900px switches to the sidebar layout. Every colour is a variable below. */

/* ---- Type: Anek Latin (Ek Type, SIL OFL, fonts/OFL.txt), self-hosted so the PWA looks the same offline ---- */
@font-face {
  font-family: "Anek Latin"; src: url(fonts/anek-latin.woff2) format("woff2");
  font-weight: 100 800; font-stretch: 75% 125%; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Anek Latin"; src: url(fonts/anek-latin-rupee.woff2) format("woff2");
  font-weight: 100 800; font-stretch: 75% 125%; font-style: normal; font-display: swap; unicode-range: U+20B9;
}

/* ---- Tokens: light (default) ---- */
:root {
  --navy: #13284d;          /* Captain navy */
  --teal: #03AA90;          /* Neer teal */
  --bg: #eef4f6;            /* Pale water */
  --surface: #ffffff;       /* Paper */
  --surface-2: #f5f8fa;
  --surface-3: #e7eef2;
  --ink: #13213a;
  --ink-2: #33445e;
  --muted: #5a6b82;
  --line: #dbe4ea;
  --line-2: #c3d0da;
  --accent: #08806d;        /* Deep teal: buttons, links (white text passes AA) */
  --accent-hover: #066b5b;
  --accent-ink: #ffffff;
  --accent-soft: #dff3ee;
  --accent-text: #066b5b;
  --focus: #0a7f6c;
  --good: #08735f;  --good-bg: #e1f4ee;  --good-line: #9fd8c9;
  --bad: #b42318;   --bad-bg: #fdecea;   --bad-line: #f1b3ad;
  --warn: #8f5400;  --warn-bg: #fff3d9;  --warn-line: #ecc77d;  --warn-solid: #e09b1a;
  --info: #1f4f8f;  --info-bg: #e8f0fb;
  --series-1: #0a9c84; --series-2: #2f5fb3;   /* validated pair (colour-blind safe) */
  --grid: #e5ecf1; --axis: #b5c3cf;
  --bar-bg: #13284d; --bar-ink: #ffffff; --bar-muted: #b9c7de;
  --side-bg: #13284d; --side-ink: #dfe7f3; --side-muted: #93a6c6; --side-hover: rgba(255, 255, 255, .07); --side-on: rgba(3, 170, 144, .2);
  --trust-bg: #13284d; --trust-ink: #edf3fb; --trust-muted: #b6c4db; --trust-border: transparent;
  --scrim: rgba(8, 18, 36, .5);
  --float-shadow: 0 16px 44px rgba(10, 24, 48, .22), 0 2px 6px rgba(10, 24, 48, .08);
  --font: "Anek Latin", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --tap: 48px;
  --nav-h: 66px;
  --head-h: 70px;
  color-scheme: light;
}

/* ---- Tokens: dark (system setting, unless the person chose light) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1426; --surface: #121d31; --surface-2: #17243b; --surface-3: #1f2e48;
    --ink: #e8eef8; --ink-2: #c4cfe0; --muted: #93a5c2; --line: #24344f; --line-2: #33476b;
    --accent: #03AA90; --accent-hover: #12bea2; --accent-ink: #04201b; --accent-soft: rgba(3, 170, 144, .15); --accent-text: #45d3b8; --focus: #45d3b8;
    --good: #4fd3b4; --good-bg: rgba(79, 211, 180, .12); --good-line: rgba(79, 211, 180, .4);
    --bad: #f4897d; --bad-bg: rgba(244, 137, 125, .13); --bad-line: rgba(244, 137, 125, .45);
    --warn: #f3c062; --warn-bg: rgba(243, 192, 98, .13); --warn-line: rgba(243, 192, 98, .45); --warn-solid: #e8a93a;
    --info: #a4c4f0; --info-bg: rgba(120, 160, 230, .13);
    --series-1: #0fa88d; --series-2: #4f7fd6; --grid: #1e2c44; --axis: #3a4e70;
    --bar-bg: #0e1a30; --side-bg: #0e1a30; --side-hover: rgba(255, 255, 255, .06);
    --trust-bg: #0f2240; --trust-border: rgba(3, 170, 144, .4);
    --scrim: rgba(0, 0, 0, .6); --float-shadow: 0 16px 44px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1426; --surface: #121d31; --surface-2: #17243b; --surface-3: #1f2e48;
  --ink: #e8eef8; --ink-2: #c4cfe0; --muted: #93a5c2; --line: #24344f; --line-2: #33476b;
  --accent: #03AA90; --accent-hover: #12bea2; --accent-ink: #04201b; --accent-soft: rgba(3, 170, 144, .15); --accent-text: #45d3b8; --focus: #45d3b8;
  --good: #4fd3b4; --good-bg: rgba(79, 211, 180, .12); --good-line: rgba(79, 211, 180, .4);
  --bad: #f4897d; --bad-bg: rgba(244, 137, 125, .13); --bad-line: rgba(244, 137, 125, .45);
  --warn: #f3c062; --warn-bg: rgba(243, 192, 98, .13); --warn-line: rgba(243, 192, 98, .45); --warn-solid: #e8a93a;
  --info: #a4c4f0; --info-bg: rgba(120, 160, 230, .13);
  --series-1: #0fa88d; --series-2: #4f7fd6; --grid: #1e2c44; --axis: #3a4e70;
  --bar-bg: #0e1a30; --side-bg: #0e1a30; --side-hover: rgba(255, 255, 255, .06);
  --trust-bg: #0f2240; --trust-border: rgba(3, 170, 144, .4);
  --scrim: rgba(0, 0, 0, .6); --float-shadow: 0 16px 44px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 16px/1.45 var(--font); -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dim { color: var(--muted); }
.nowrap { white-space: nowrap; }
.neg { color: var(--bad); }
.strong { font-weight: 650; }
.warn-text { color: var(--warn); }

/* Figures: condensed width, tabular digits. Text stays at normal width. */
.money, .fig, .kpi-v, .tile b, .e-num, .total, .stmt-sum b, .vch-no, .vch-amt, .stock-hero b, .out-hero b,
.pill-n b, .feed-n dd, .t .n, .tick { font-stretch: 82%; font-variant-numeric: tabular-nums; }
.money { white-space: nowrap; }
.money .cur { font-weight: 450; margin-right: .04em; color: var(--muted); }
.money .paise { font-size: .74em; }
.money .dc { font-size: .74em; font-weight: 600; color: var(--muted); }
.t .money .paise, .rows .money .paise, .led-row .money .paise, .t-row .money .paise { font-size: .86em; }

/* ---- App frame ---- */
.app { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px); }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px 14px; background: var(--bar-bg); color: var(--bar-ink);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font-size: 20px; font-weight: 650; font-stretch: 86%; letter-spacing: .005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { flex: none; display: block; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top .icon-btn { color: var(--bar-ink); }
.top .icon-btn.back { margin-left: -8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: var(--bar-ink); font-size: 14px; font-weight: 550; white-space: nowrap;
}
.chip.ok svg { color: #6fe3cb; }
.chip.wait { color: #ffd88a; border-color: rgba(255, 216, 138, .55); }
.chip.bad { color: #ffb8ad; border-color: rgba(255, 184, 173, .6); background: rgba(255, 120, 100, .12); }
.chip.off { color: var(--bar-muted); }

.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--teal); color: #062a24; font-weight: 700; font-size: 16px;
}
.avatar.sm { width: 34px; height: 34px; font-size: 14.5px; cursor: default; }
.avatar.lg { width: 48px; height: 48px; font-size: 20px; cursor: default; }

/* Phone: Hisaab report tabs under the app bar */
.subtabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 7px 10px; background: var(--surface); border-bottom: 1px solid var(--line);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  flex: none; display: inline-flex; align-items: center; min-height: 38px; padding: 6px 13px; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 550; white-space: nowrap;
}
.subtabs a.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }

.banner { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 14.5px; }
.banner.off { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid var(--warn-line); }
.banner.warn { background: var(--bad-bg); color: var(--bad); border-bottom: 1px solid var(--bad-line); }
.banner svg { flex: none; }

.screen { padding: 14px 14px 0; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ---- Bottom navigation (phone) ---- */
nav.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line);
}
nav.bottom a {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 550;
}
nav.bottom .pill { display: grid; font-style: normal; place-items: center; width: 54px; height: 30px; border-radius: 999px; }
nav.bottom a.on { color: var(--accent-text); font-weight: 650; }
nav.bottom a.on .pill { background: var(--accent-soft); }

/* ---- Desktop frame ---- */
.app.wide { display: grid; grid-template-columns: 248px minmax(0, 1fr); padding-bottom: 0; }
.side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-ink);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; color: #fff; text-decoration: none; }
.side-brand b { display: block; font-size: 19px; font-weight: 700; font-stretch: 84%; line-height: 1.1; }
.side-brand small { display: block; color: var(--side-muted); font-size: 12.5px; margin-top: 2px; }
.side-nav { flex: 1; padding: 4px 10px 12px; }
.side-group + .side-group { margin-top: 14px; }
.side-h { display: block; padding: 6px 10px 4px; color: var(--side-muted); font-size: 13px; font-weight: 600; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 10px; border-radius: 9px;
  color: var(--side-ink); text-decoration: none; font-size: 15px; font-weight: 500;
}
.side-nav a svg { color: var(--side-muted); flex: none; }
.side-nav a:hover { background: var(--side-hover); }
.side-nav a.on { background: var(--side-on); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--teal); }
.side-nav a.on svg { color: #6fe3cb; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--side-ink); text-align: left; cursor: pointer; }
.side-user:hover { background: var(--side-hover); }
.side-user .who small { color: var(--side-muted); }

.app.wide .topbar { background: var(--bg); }
.app.wide .top {
  min-height: var(--head-h); padding: 14px 32px 12px; background: var(--bg); color: var(--ink); border-bottom: 1px solid var(--line);
}
.app.wide .brand h1 { font-size: 28px; font-weight: 700; font-stretch: 80%; }
.app.wide .top .icon-btn { color: var(--ink-2); }
.app.wide .chip { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); }
.app.wide .chip.ok svg { color: var(--good); }
.app.wide .chip.wait { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.app.wide .chip.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.app.wide .chip.off { color: var(--muted); }
.app.wide .screen { max-width: 1240px; margin: 0; padding: 20px 32px 56px; gap: 16px; }

/* ---- Panels ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card.flush > .card-h { padding: 14px 16px 10px; margin: 0; }
.card-t { min-width: 0; }
.card-h h2 { font-size: 17.5px; font-weight: 650; line-height: 1.25; }
.card-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.card.form { display: flex; flex-direction: column; gap: 14px; }
.card.form > .card-h { margin-bottom: 0; }
.card.form.editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.total { color: var(--muted); font-size: 14.5px; white-space: nowrap; }
.list-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 2px -4px; }
.list-h h3 { font-size: 17px; font-weight: 650; }
.list-h span { font-size: 14px; color: var(--muted); }
.empty { color: var(--muted); font-size: 15px; padding: 8px 0; }
.card.flush .empty { padding: 14px 16px 18px; }
.note { font-size: 14px; color: var(--muted); }
.note.err { color: var(--bad); }
.warn-box, .info-box { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.warn-box { background: var(--warn-bg); color: var(--warn); }
.info-box { background: var(--info-bg); color: var(--info); }
.warn-box svg, .info-box svg { flex: none; margin-top: 1px; }
.loading { display: flex; flex-direction: column; gap: 12px; padding: 10px 2px; }
.loading .sk { display: block; height: 14px; border-radius: 7px; background: var(--surface-3); }

/* ---- Forms ---- */
.row { display: flex; gap: 10px; }
.row > .field { flex: 0 0 auto; }
.row > .field.grow { flex: 1 1 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 550; color: var(--ink-2); }
input, select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 16px; outline: none;
}
input[type="date"] { min-width: 150px; font-variant-numeric: tabular-nums; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--muted); opacity: .8; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
input:disabled, select:disabled { opacity: .6; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); font-size: 15px; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 650; }

.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; gap: 8px; align-items: center; }
.line select { flex: 1 1 auto; min-width: 0; }
.line input { flex: 0 0 110px; text-align: right; font-stretch: 82%; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }

button.primary {
  min-height: 52px; width: 100%; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 650; cursor: pointer;
}
button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { background: var(--surface-3); color: var(--muted); cursor: default; }
button.primary.sticky { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); box-shadow: var(--float-shadow); }
button.primary.sticky:disabled { box-shadow: none; }
button.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border-radius: 10px;
  border: 1px dashed var(--line-2); background: transparent; color: var(--accent-text); font-size: 15px; font-weight: 600; cursor: pointer;
}
button.ghost.more { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
button.ghost.danger { color: var(--bad); border-style: solid; border-color: var(--bad-line); }
button.mini {
  min-height: 36px; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--accent); background: transparent;
  color: var(--accent-text); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
button.mini.danger { border-color: var(--bad); color: var(--bad); }
button.link { border: 0; background: none; color: var(--accent-text); font-size: 14.5px; font-weight: 600; padding: 8px 6px; min-height: 40px; cursor: pointer; }
button.link.danger { color: var(--bad); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.confirm { display: inline-flex; align-items: center; gap: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; text-align: center;
}
.btn.primary-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.link-btn { display: inline-flex; align-items: center; min-height: 36px; font-size: 14.5px; font-weight: 600; color: var(--accent-text); text-decoration: none; white-space: nowrap; }
.link-btn:hover, .ledger-link:hover { text-decoration: underline; }

.typeahead { position: relative; }
.typeahead .matched { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border-radius: 6px; padding: 1px 7px; }
.suggest { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--float-shadow); }
.suggest li { padding: 12px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--accent-soft); }
.suggest small { color: var(--muted); margin-left: 6px; }

/* ---- Badges, marks ---- */
.badge { display: inline-block; padding: 1px 8px; margin-left: 6px; border-radius: 999px; font-size: 12.5px; font-weight: 600; vertical-align: 1px; white-space: nowrap; }
.badge.pending, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--surface-3); color: var(--muted); }
.match { display: inline-flex; align-items: center; gap: 3px; font-size: 13.5px; font-weight: 600; vertical-align: -2px; }
.match.ok { color: var(--good); }
.match.bad { color: var(--warn); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
.t th { font-size: 13.5px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 0 7px; white-space: nowrap; }
.t td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.t .n { text-align: right; padding-left: 12px; white-space: nowrap; }
.t .c { text-align: center; }
.t a { color: var(--ink); text-decoration: none; font-weight: 550; }
.t a:hover { color: var(--accent-text); text-decoration: underline; }
.sub-line { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit { color: var(--muted); font-size: .85em; }

/* data tables inside flush panels */
.data-t th, .data-t td { padding: 9px 12px; }
.data-t th:first-child, .data-t td:first-child { padding-left: 16px; }
.data-t th:last-child, .data-t td:last-child { padding-right: 16px; }
.data-t thead th { background: var(--surface-2); border-bottom: 1px solid var(--line); padding-top: 9px; padding-bottom: 9px; }
.data-t tbody tr:first-child td { border-top: 0; }
.data-t tr.click { cursor: pointer; }
.data-t tr.click:hover td { background: var(--surface-2); }
.data-t tr.cancelled td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.data-t tr.cancelled .badge { text-decoration: none; }
.data-t tr.bad-row td { background: var(--warn-bg); }
.compact-t { margin-top: 14px; font-size: 14px; }
.compact-t td { padding: 7px 0; }

/* accounting totals: a rule above, a double rule below */
.t tfoot td { font-weight: 650; }
.t tfoot tr.sub-total td { border-top: 2px solid var(--line-2); }
.t tfoot tr.diff-row td { background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.t tfoot tr.grand td, .totals .grand { border-top: 1.5px solid var(--ink-2); border-bottom: 3px double var(--ink-2); font-weight: 700; }
.data-t tr.open-row td { background: var(--surface-2); font-weight: 600; }

/* Trial balance groups (desktop) */
.report-t td { padding: 9px 12px; }
.report-t th { padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.report-t th:first-child, .report-t td:first-child { padding-left: 4px; }
.grp-tr { cursor: pointer; }
.grp-tr:hover td { background: var(--surface-2); }
.tr-toggle { display: inline-flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 650; font-size: 15px; cursor: pointer; text-align: left; }
.tr-toggle small { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.chev { display: inline-block; width: 12px; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .15s ease; }
.grp-tr.open .chev { transform: rotate(90deg); }
.sub-tr td { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.sub-tr td:first-child { padding-left: 30px; }
.led-tr td { font-size: 14.5px; }
.led-tr td:first-child { padding-left: 30px; }
.led-tr.deep td:first-child { padding-left: 46px; }

/* Collapsible groups (phone) */
.grp-list { border-top: 1px solid var(--line); margin: 0 -16px; }
.grp { border-bottom: 1px solid var(--line); }
.grp-h {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 10px 16px 10px 12px;
  border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.grp-chev { flex: none; color: var(--muted); transition: transform .15s ease; }
.grp.open > .grp-h .grp-chev, .t-item.open .grp-chev { transform: rotate(90deg); }
.grp-t { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; }
.grp-t small { margin-left: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.grp-v { font-weight: 650; }
.grp-b { padding: 0 16px 12px 36px; }
.sub + .sub { margin-top: 6px; }
.sub-h { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0 3px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.led-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; font-size: 14.5px; }
.led-row + .led-row { border-top: 1px solid var(--surface-3); }
.led-row .money { flex: none; }
.ledger-link { color: var(--ink); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.totals { margin-top: 14px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.totals dt { color: var(--ink-2); }
.totals dd { font-weight: 650; }
.totals .diff-row { background: var(--surface-2); margin: 0 -16px; padding: 8px 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 14px; }

/* ---- Two-sided reports (Trading, P&L, Balance Sheet) ---- */
.t-acc + .t-acc { margin-top: 22px; }
.t-title { font-size: 16px; font-weight: 650; margin: 2px 0 10px; color: var(--ink-2); }
.t-sides { display: flex; flex-direction: column; gap: 12px; }
.t-acc.wide .t-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
.t-side { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.t-acc.wide .t-side:first-child { border-radius: 12px 0 0 12px; }
.t-acc.wide .t-side:last-child { border-left: 0; border-radius: 0 12px 12px 0; }
.t-head { display: flex; justify-content: space-between; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted); }
.t-items { flex: 1; }
.t-item + .t-item { border-top: 1px solid var(--line); }
.t-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 10px 14px;
  border: 0; background: none; color: var(--ink); text-align: left; text-decoration: none; font-size: 15px;
}
button.t-row { cursor: pointer; }
button.t-row:hover, a.t-row:hover { background: var(--surface-2); }
.t-label { flex: 1; min-width: 0; font-weight: 550; }
.t-amt { font-weight: 650; }
a.t-row .t-label { color: var(--accent-text); }
.t-item.result-good .t-row { background: var(--good-bg); color: var(--good); }
.t-item.result-bad .t-row { background: var(--bad-bg); color: var(--bad); }
.t-item.result-good .t-label, .t-item.result-bad .t-label { font-weight: 700; }
.t-item.diff .t-row { background: var(--surface-2); color: var(--ink-2); }
.t-item.plain .t-label { font-weight: 500; color: var(--ink-2); }
.t-note { padding: 0 14px 10px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.t-detail { padding: 0 14px 10px 37px; }
.t-total { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border-top: 1.5px solid var(--ink-2); background: var(--surface-2); font-weight: 700; }
.stock-line .ledger-link { color: var(--accent-text); }

/* ---- Money panels ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.kpi.link:hover { border-color: var(--line-2); }
.kpi-l { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 550; color: var(--ink-2); }
.kpi-v { font-size: clamp(18px, 5.4vw, 24px); font-weight: 650; line-height: 1.2; }
.kpi-s { font-size: 12.5px; color: var(--muted); }
.kpi.good .kpi-v { color: var(--good); }
.kpi.bad .kpi-v { color: var(--bad); }
.kpi.good .money .cur, .kpi.bad .money .cur { color: inherit; opacity: .75; }

/* ---- The Tally seal (the one loud element) ---- */
.trust {
  display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--trust-bg); color: var(--trust-ink);
  border: 1px solid var(--trust-border);
}
.trust-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.trust-ico {
  flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--teal); color: #062a24; box-shadow: 0 0 0 4px rgba(3, 170, 144, .28), 0 0 0 9px rgba(3, 170, 144, .1);
}
.trust-t { font-size: 18px; font-weight: 650; font-stretch: 88%; line-height: 1.2; }
.trust-s { font-size: 14px; color: var(--trust-muted); }
.trust-s b { color: var(--trust-ink); font-weight: 600; }
.trust-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 14px; }
.fact b { font-size: 18px; font-weight: 700; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.fact.ok { background: rgba(3, 170, 144, .22); color: #8af0da; }
.fact.bad { background: rgba(243, 182, 72, .2); color: #ffd58a; }
.trust-note { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; color: var(--trust-muted); }
.trust-note svg { flex: none; margin-top: 2px; }
.trust.warn .trust-ico { background: #f3b648; color: #2b1a00; box-shadow: 0 0 0 4px rgba(243, 182, 72, .3), 0 0 0 9px rgba(243, 182, 72, .1); }
.trust.compact { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; }
.trust.compact .trust-ico { width: 36px; height: 36px; box-shadow: 0 0 0 3px rgba(3, 170, 144, .25); }
.trust.compact .trust-ico svg { width: 19px; height: 19px; }
.trust-c { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.trust.compact .fact { display: block; padding: 0; background: none; font-size: 14.5px; font-weight: 550; line-height: 1.3; }
.trust.compact .fact svg { vertical-align: -3px; margin-right: 4px; }
.trust.compact .fact.ok { color: #8af0da; }
.trust.compact .fact.bad { color: #ffd58a; }
.trust.compact .fact b { font-size: 17px; }
.trust.compact .trust-s { font-size: 13px; }
.company { font-size: 14px; color: var(--muted); margin: -6px 2px 0; }

/* ---- Accounts layout ---- */
.acc { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.acc.refreshing .card:not(.filters), .acc.refreshing .type-sum, .acc.refreshing .stmt-sum { opacity: .55; transition: opacity .2s; }
.acc-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.reports { display: flex; flex-direction: column; margin: 0 -4px; }
.report { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 9px 4px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.report:first-child { border-top: 0; }
.report:hover b { color: var(--accent-text); }
.report-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.report b { display: block; font-size: 15.5px; font-weight: 600; }
.report small { display: block; font-size: 13px; color: var(--muted); }
.report-go { margin-left: auto; flex: none; color: var(--muted); }

.filters { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row > * { flex: 1 1 220px; min-width: 0; }
.filter-row > button.link { flex: 0 0 auto; }
.filter-row.pad { padding: 0 16px 12px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }
.filter-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14.5px; color: var(--muted); }
.filter-meta b { color: var(--ink); font-stretch: 82%; font-variant-numeric: tabular-nums; }
.filter-meta .money { color: var(--ink); font-weight: 600; }
.filter-meta .warn-text { display: inline-flex; align-items: center; gap: 4px; }

.range { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.presets::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; min-height: 38px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); font-size: 14.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.chip-btn.warn { color: var(--warn); border-color: var(--warn-line); }
.chip-btn.warn.on { background: var(--warn-bg); color: var(--warn); }
.range-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.range-dates label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.range-dates span { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.range-dates input { min-width: 0; }

/* Lists of rows (phone accounts) */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 10px 16px; color: var(--ink); text-decoration: none; }
a.row-link:active { background: var(--surface-2); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main b { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.row-main small { font-size: 13px; color: var(--muted); }
.row-main small.neg { color: var(--bad); }
.row-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; text-align: right; font-weight: 600; }
.row-amt small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.row-amt .match { margin-top: 1px; }
.rows li.with-action { display: flex; align-items: stretch; }
.rows li.with-action .row-link { flex: 1; min-width: 0; }
.call { flex: none; display: grid; place-items: center; width: 54px; color: var(--accent-text); border-left: 1px solid var(--line); }
.rows li.open-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--surface-2); }
.rows li.cancelled .row-main b { text-decoration: line-through; color: var(--muted); }
.stmt-rows .dr { color: var(--ink); }
.stmt-rows .cr { color: var(--accent-text); }
.day-h { display: flex; justify-content: space-between; padding: 8px 16px 6px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.day-h span { font-weight: 500; color: var(--muted); }
.day-groups section:first-child .day-h { border-top: 0; }

.type-sum { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.type-sum::-webkit-scrollbar { display: none; }
.type-chip {
  flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 128px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer;
}
.type-chip b { font-size: 14.5px; font-weight: 650; }
.type-chip span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.type-chip.on { border-color: var(--accent); background: var(--accent-soft); }

/* Ledger statement */
.stmt-head { display: flex; flex-direction: column; gap: 14px; }
.stmt-name { font-size: 24px; font-weight: 700; font-stretch: 84%; line-height: 1.15; overflow-wrap: anywhere; }
.stmt-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 14.5px; color: var(--muted); }
.stmt-meta a { font-weight: 600; text-decoration: none; }
.tel { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.stmt-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stmt-sum > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 11px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.stmt-sum > div > span { font-size: 13.5px; color: var(--muted); }
.stmt-sum b { font-size: clamp(17px, 4.8vw, 21px); font-weight: 650; }
.stmt-sum .closing { border-color: var(--accent); }
.stmt-sum small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; margin-top: 2px; }
.stmt-sum small.ok { color: var(--good); }
.stmt-sum small.bad { color: var(--warn); }
.stmt-sum small .money { font-weight: 600; }

/* Voucher */
.vch-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.vch-type { font-size: 14.5px; font-weight: 600; color: var(--accent-text); }
.vch-no { font-size: 28px; font-weight: 700; line-height: 1.1; }
.vch-date { font-size: 14.5px; color: var(--muted); margin-top: 2px; }
.vch-amt { font-size: clamp(20px, 6vw, 28px); font-weight: 700; text-align: right; }
.vch-tags:not(:empty) { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vch-tags .badge { margin-left: 0; }
.vch-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.vch-facts:empty { display: none; }
.vch-facts dt { font-size: 13px; color: var(--muted); }
.vch-facts dd { font-size: 15px; overflow-wrap: anywhere; }
.src-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 5px; padding: 5px 8px; border-radius: 8px; background: var(--info-bg); color: var(--info); font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.src-note svg { flex: none; margin-top: 1px; }
.src-note.bad { background: var(--warn-bg); color: var(--warn); }
.data-t tr.has-note td { border-bottom: 0; }
.data-t tr.note-tr td { border-top: 0; padding-top: 0; }

/* Stock */
.stock-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px 12px;
  padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.stock-hero > div > span { display: block; font-size: 13.5px; color: var(--muted); }
.stock-hero b { display: block; font-size: clamp(19px, 5.6vw, 30px); font-weight: 700; line-height: 1.15; }
.stock-hero .main b { color: var(--accent-text); }
.stock-hero .flow { color: var(--muted); }
.stock-note { grid-column: 1 / -1; font-size: 13.5px; color: var(--muted); }
.grp-total { font-weight: 650; font-size: 16px; }
.stock-t td { font-size: 14.5px; }

/* Lena / dena */
.out-hero { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.out-hero > span { font-size: 14.5px; color: var(--ink-2); font-weight: 550; }
.out-hero b { font-size: clamp(26px, 8vw, 36px); font-weight: 700; line-height: 1.15; }
.out-hero small { font-size: 13.5px; color: var(--muted); }

/* Data from Nexvia */
.explain { display: flex; gap: 14px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.explain svg { flex: none; color: var(--accent-text); }
.explain h2 { font-size: 19px; font-weight: 650; }
.explain p { margin-top: 4px; font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 12px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.feed-h .badge { margin-left: 0; }
.feed-s { font-size: 13.5px; color: var(--muted); }
.feed-n { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.feed-n dt { font-size: 12.5px; color: var(--muted); }
.feed-n dd { font-size: 18px; font-weight: 650; }
.recon-t td, .recon-t th { padding-left: 0; }

/* ---- Home ---- */
.dash { display: flex; flex-direction: column; gap: 14px; }
.hello { font-size: 15px; font-weight: 550; color: var(--ink-2); margin: 0 2px -4px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; min-width: 0; padding: 12px 12px 11px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.tile-l { font-size: 13.5px; font-weight: 550; color: var(--ink-2); line-height: 1.2; }
.tile b { display: block; margin-top: 4px; font-size: clamp(26px, 8.4vw, 40px); font-weight: 700; line-height: 1.05; }
.tile b small { font-size: .5em; color: var(--muted); font-weight: 600; }
.tile-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quick .btn { padding: 8px 6px; font-size: 14px; flex-direction: column; gap: 2px; line-height: 1.2; }
.sync-card {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--good-line); background: var(--good-bg); color: var(--good); font-size: 15px; font-weight: 550; text-align: left; cursor: pointer;
}
.sync-card svg { flex: none; }
.sync-card small { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.sync-card.wait { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.sync-card.bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.dash-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.mini-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini-kpis a { display: flex; flex-direction: column; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.mini-kpis a > span { font-size: 13px; color: var(--muted); }
.mini-kpis b { font-size: 17px; font-weight: 650; }
.trust-mini { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--good); }
.trust-mini.warn { color: var(--warn); }

/* ---- Entry lists (Production, Dispatch) ---- */
.split, .single { display: flex; flex-direction: column; gap: 14px; }
.split-form, .split-list { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.entries { list-style: none; margin: 0; padding: 0; }
.entries > li { padding: 10px 0; border-top: 1px solid var(--line); }
.entries > li:first-child { border-top: 0; padding-top: 0; }
.e-main { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.e-main b { font-weight: 600; }
.e-num { font-weight: 700; font-size: 20px; }
.e-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: 14px; color: var(--muted); }
.e-sub .actions { margin-left: auto; display: inline-flex; align-items: center; }
.e-sub .badge { margin-left: 0; }
.sublines { list-style: none; margin: 6px 0 2px; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.sublines li { display: flex; justify-content: space-between; font-size: 14.5px; padding: 2px 0; }
.sublines li span:last-child { font-stretch: 82%; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- Attendance ---- */
.att-screen { display: flex; flex-direction: column; gap: 14px; }
.att-sum { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.pill-n { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.pill-n b { font-size: 18px; font-weight: 700; }
.pill-n.p b { color: var(--good); }
.pill-n.a b { color: var(--bad); }
.pill-n.hd b { color: var(--warn); }
.att-sum .dim { margin-left: auto; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.att { list-style: none; margin: 0; padding: 0; }
.att li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.att li:first-child { border-top: 0; padding-top: 0; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pah { display: flex; gap: 6px; flex: none; }
.st {
  width: 50px; height: 46px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-weight: 700; font-size: 16px; font-stretch: 85%; cursor: pointer;
}
.st:disabled { cursor: default; }
.st.p.on { background: var(--good); border-color: var(--good); color: var(--surface); }
.st.a.on { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.st.hd.on { background: var(--warn-solid); border-color: var(--warn-solid); color: #241600; }

/* ---- Users ---- */
.users { list-style: none; margin: 0; padding: 0; }
.users li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.users li:first-child { border-top: 0; padding-top: 0; }
.users .who b, .users .who small { white-space: normal; overflow-wrap: anywhere; }
.users .seen { font-size: 12.5px; }
.users .badge { margin-left: 8px; }
.role-pick { grid-column: 2; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.role-pick select { width: 160px; flex: none; }
.role-pick small { font-size: 12.5px; color: var(--muted); }

/* ---- Chart ---- */
.chart { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw.s1, .key.s1 { background: var(--series-1); }
.sw.s2, .key.s2 { background: var(--series-2); }
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .bar.s1 { fill: var(--series-1); }
.chart .bar.s2 { fill: var(--series-2); }
.chart .hover-col { fill: var(--surface-3); }
.chart rect[tabindex]:focus { outline: none; }
.chart rect[tabindex]:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.tip {
  position: absolute; top: -4px; transform: translate(-50%, -100%); z-index: 3; display: flex; flex-direction: column; gap: 3px; min-width: 132px;
  padding: 8px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--float-shadow); pointer-events: none;
}
.tip-h { font-size: 12.5px; color: var(--muted); }
.tip-r { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tip-r b { font-size: 14.5px; color: var(--ink); font-stretch: 82%; font-variant-numeric: tabular-nums; }
.key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }

/* ---- Sheets, menu, toast ---- */
.sheet-bg { position: fixed; inset: 0; z-index: 20; background: var(--scrim); display: flex; align-items: flex-end; }
.sheet {
  width: 100%; max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet > .card-h { margin-bottom: 0; align-items: center; }
.grab { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin-top: 4px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-bg { animation: scrim-in .2s ease-out; }
@keyframes scrim-in { from { background: transparent; } }
.outbox { list-style: none; margin: 0; padding: 0; }
.outbox li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.outbox li > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.outbox li small { color: var(--muted); white-space: nowrap; }
.outbox li.failed b { color: var(--bad); }
.outbox .btns { display: flex; gap: 8px; }
.ok-line { display: flex; align-items: center; gap: 6px; color: var(--good); }
.acct { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.me-card { display: flex; align-items: center; gap: 12px; }
.me-card .who small { white-space: normal; }
.menu-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; border: 0; background: none;
  color: var(--ink); text-decoration: none; font-size: 15.5px; font-weight: 550; text-align: left; cursor: pointer;
}
.menu-list > :is(a, button) + :is(a, button) { border-top: 1px solid var(--line); }
.menu-list span { flex: 1; }
.menu-list svg { color: var(--muted); flex: none; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); z-index: 30;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--surface);
  font-weight: 600; font-size: 15px; box-shadow: var(--float-shadow); animation: toast-in .18s ease-out;
}
.toast.err { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Gates (login, approval, blocked) ---- */
.app.gated { padding-bottom: 0; }
.gate-wrap { display: grid; justify-items: center; padding: 12vh 16px 32px; }
.gate {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; width: 100%; max-width: 420px;
  padding: 30px 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.gate h2 { font-size: 23px; font-weight: 700; font-stretch: 86%; }
.gate p { color: var(--ink-2); }
.gate.inline { margin: 8vh auto 0; }
.gate.inline svg { color: var(--accent-text); }

/* ---- Wider screens ---- */
@media (min-width: 600px) {
  .stmt-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .vch-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vch-facts .wide { grid-column: 1 / -1; }
  .feed-n { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .users li { grid-template-columns: auto minmax(0, 1fr) auto; }
  .role-pick { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 3px; margin-top: 0; }
}
@media (min-width: 900px) {
  .sheet-bg { align-items: center; justify-content: center; }
  .sheet { width: min(520px, 92vw); border-radius: 16px; padding: 10px 20px 20px; animation: sheet-pop .18s ease-out; }
  .grab { display: none; }
  @keyframes sheet-pop { from { transform: translateY(8px) scale(.98); } to { transform: none; } }
  .toast { left: auto; right: 28px; bottom: 28px; transform: none; animation: none; }
  button.primary.sticky { bottom: 16px; }
  .table-wrap { overflow: visible; }
  .t.sticky thead th { position: sticky; top: var(--head-h); z-index: 2; }
  .card.flush:has(.t.sticky) { overflow: visible; }
  .card.flush:has(.t.sticky) .data-t thead th:first-child { border-top-left-radius: 0; }

  .hello { display: none; }
  .tiles { gap: 14px; }
  .tile { padding: 16px 18px; }
  .tile-l { font-size: 15px; }
  .quick { display: flex; gap: 10px; }
  .quick .btn { flex-direction: row; padding: 10px 18px; font-size: 15px; }
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid .span-2 { grid-column: span 2; }
  .dash-grid .span-3 { grid-column: 1 / -1; }

  .split { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .split-form { position: sticky; top: calc(var(--head-h) + 16px); }
  .single { max-width: 860px; }
  .single.narrow { max-width: 760px; }
  .att-screen { max-width: 860px; }
  .att { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
  .att li:nth-child(2) { border-top: 0; padding-top: 0; }

  .kpi-grid, .kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .kpi-v { font-size: 25px; }
  .acc-grid { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
  .acc-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .trust { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 16px 20px; }
  .trust-facts { justify-content: flex-end; }
  .trust-note { grid-column: 1 / -1; }
  .range { flex-direction: row; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
  .range-dates { grid-template-columns: 170px 170px; }
  .filter-row > select { flex: 0 1 280px; }
  .stmt-head { flex-direction: row; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
  .stmt-name { font-size: 30px; }
  .stock-hero { padding: 20px 24px; }
  .out-hero { padding: 20px 24px; }
  .data-t td { font-size: 14.5px; }
  .card-h h2 { font-size: 18px; }
}

/* Reduced motion: nothing moves on its own or on open */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Print: reports only */
@media print {
  .side, nav.bottom, .top-actions, .subtabs, .banner, .toast, .filters, .range, .type-sum, button.ghost.more { display: none !important; }
  .app, .app.wide { display: block; padding: 0; }
  html, body { background: #fff; }
  .card, .kpi, .trust { break-inside: avoid; }
}
.bs-note { margin-top: 14px; }

/* ---- Compatibility aliases (older module CSS uses these names) ---- */
:root { --panel: var(--surface); --panel2: var(--surface-2); --red: var(--bad); --amber: var(--warn); --teal-ink: var(--accent-ink); --radius: 14px; }

/* ---- More menu (all module screens) ---- */
.more { display: flex; flex-direction: column; gap: 14px; }
.more-q { width: 100%; }
.more-g h3 { margin: 4px 2px 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.more-g ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.more-g li + li { border-top: 1px solid var(--line); }
.more-g a { display: flex; flex-direction: column; gap: 2px; padding: 13px 16px; color: var(--ink); text-decoration: none; }
.more-g a small { color: var(--muted); font-size: 12.5px; }
.more-g a:active { background: var(--surface-2); }
.brand .back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--bar-ink); background: rgba(255,255,255,.1); }
.app.wide .brand .back { color: var(--ink); background: var(--surface-3); }

/* ---- Brand (Captain Crew) ---- */
.logo { display: inline-flex; align-items: center; justify-content: center; background: var(--navy); flex: 0 0 auto; overflow: hidden; }
.logo img { display: block; height: auto; }
.gate.login { padding-top: 9vh; }
.login-logo { width: min(240px, 70vw); height: auto; }
.tagline { margin: -4px 0 0; color: var(--muted); letter-spacing: .04em; }
.brand-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.brand-chip { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }

/* ---- Live app additions ---- */
/* Shell: group tabs under the app bar (phone) */
.subtabs .subtab-back { flex: none; display: inline-grid; place-items: center; width: 38px; min-height: 38px; padding: 0; border-radius: 10px; color: var(--muted); background: var(--surface-2); }
/* More screen (#/more): search + grouped menu lists */
.more .search input { background: var(--surface); }
.more-g h3 { margin: 2px 2px 8px; }
.more-g .menu-list { list-style: none; margin: 0; padding: 0; background: var(--surface); }
.more-g .menu-list li + li { border-top: 1px solid var(--line); }
.more-g .menu-list a { flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; min-height: 54px; }
.more-g .menu-list a > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.more-g .menu-list a b { font-weight: 600; }
.more-g .menu-list a small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.more-g .menu-list a:hover { background: var(--surface-2); }
.menu-list a > svg:first-child { color: var(--accent-text); }
/* Home */
.dash .dash-hero { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 0; background: var(--bar-bg); color: var(--bar-ink); }
.dash .dash-hero img { width: 84px; height: auto; border-radius: 8px; flex: none; display: block; }
.dash .dash-hero .h-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dash .dash-hero .h-txt small { color: var(--bar-muted); font-size: 13px; }
.dash .dash-hero .h-txt b { font-size: 18px; font-weight: 650; font-stretch: 88%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash .dash-hero .h-txt .tag { color: var(--bar-muted); font-size: 13px; letter-spacing: 0; }
.alerts { display: flex; flex-wrap: wrap; gap: 8px; }
.alert {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 12px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; text-align: left; background: var(--surface-2); color: var(--ink-2);
}
.alert svg { flex: none; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.ok { background: var(--good-bg); color: var(--good); cursor: default; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile .tile-s em { font-style: normal; font-weight: 600; }
.tile .tile-s em.good { color: var(--good); }
.tile .tile-s em.neg { color: var(--bad); }
.tile b.fig { font-size: clamp(22px, 7vw, 32px); }
.brand-bars { display: flex; flex-direction: column; gap: 12px; }
.brand-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.brand-bar .nm { font-size: 15px; font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-bar .vl { font-weight: 700; text-align: right; }
.brand-bar .tk { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.brand-bar .tk i { display: block; height: 100%; border-radius: 99px; }
.brand-bar .sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: -2px; }
.note.center { text-align: center; }
.note.center .link-btn { min-height: 44px; }
.entries.top-gap { margin-top: 12px; border-top: 1px solid var(--line); }
.entries.top-gap > li:first-child { padding-top: 10px; }
.e-num small { font-size: .65em; font-weight: 600; color: var(--muted); }
.card .att-sum + .meter { margin-top: 10px; }
.card .meter + .note { margin-top: 10px; }
/* Forms */
button.btn { cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.row > .grow { flex: 1 1 0; min-width: 0; }
.row > .btn { flex: none; }
.filter-row > .seg { flex: 1 1 240px; }
.filter-row > .search { flex: 1 1 200px; }
/* Users: link / block panel */
.users li.is-blocked .who b { color: var(--muted); text-decoration: line-through; }
.users .link-panel { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.users .link-panel .btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.users .role-pick button.link { white-space: nowrap; padding: 8px 4px; }
.users .who .seen span { white-space: nowrap; }
@media (min-width: 600px) {
  .users .role-pick { flex-direction: row; align-items: center; gap: 8px; }
}
.login-logo { border-radius: 12px; }
