/* UPYUGO Staff Ledger — "Bahi" design system.
   Inspired by the red bahi-khata ledger: warm ruled paper, a red double margin rule, ink-dark mode,
   tabular rupee figures. Mobile-first; a side rail replaces the tab bar on wide screens. */

:root {
  /* Dark is the default theme ("demo" look). Light is opt-in from Settings. */
  --r: 18px; --r-sm: 12px; --r-xs: 8px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari",
          "Nirmala UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --tab-h: 68px; --bar-h: 58px; --rail-w: 232px;
  --bg: #12100d; --surface: #1b1814; --raised: #231f1a; --sunk: #0d0b09;
  --ink: #f2ebe0; --ink-2: #d4cabb; --muted: #a39887; --faint: #6f6658;
  --line: #2f2922; --line-2: #3d352c;
  --brand: #e5554b; --brand-2: #f06a60; --brand-ink: #1a0b09; --brand-soft: #3a1b17;
  --saffron: #f0ae4d; --saffron-soft: #3a2a12;
  --go: #5cc08a; --go-soft: #143322; --stop: #ef6b61; --stop-soft: #3b1a17;
  --info: #79a7e6; --info-soft: #172741; --done: #b4c0cd; --done-soft: #262d35;
  --rule: rgba(229, 85, 75, .5); --ruled: rgba(255, 240, 220, .045);
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .8);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5efe4; --surface: #fffcf6; --raised: #ffffff; --sunk: #ede5d6;
  --ink: #1d1914; --ink-2: #463e35; --muted: #776d61; --faint: #a59a8c;
  --line: #e5dbc9; --line-2: #d5c8b2;
  --brand: #b3261e; --brand-2: #8f1d17; --brand-ink: #fff; --brand-soft: #f6e0db;
  --saffron: #c97a12; --saffron-soft: #fbedd5;
  --go: #2b7a4b; --go-soft: #dff0e5; --stop: #b3261e; --stop-soft: #f8e0dc;
  --info: #2a5888; --info-soft: #e0eaf6; --done: #3b4a5a; --done-soft: #e5e9ee;
  --rule: rgba(179, 38, 30, .55); --ruled: rgba(120, 100, 70, .09);
  --r: 18px; --r-sm: 12px; --r-xs: 8px;
  --shadow: 0 1px 0 rgba(40, 30, 20, .04), 0 10px 30px -18px rgba(40, 30, 20, .35);
  --shadow-lg: 0 24px 60px -24px rgba(40, 30, 20, .45);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari",
          "Nirmala UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --tab-h: 68px; --bar-h: 58px;
  color-scheme: light;
}



*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden; overflow-wrap: break-word;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
}
body.no-tabs { padding-bottom: 24px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .amt { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.ic { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 18px; height: 18px; }
.ic-lg { width: 28px; height: 28px; }

/* ---------- bilingual labels */
.l { display: inline; }
.l .hi { font-family: "Noto Sans Devanagari", "Nirmala UI", var(--font); }
[data-lang="both"] .l .hi { display: block; font-size: .74em; font-weight: 500; opacity: .72; line-height: 1.25;
  letter-spacing: 0; margin-top: 1px; }
[data-lang="both"] .inline-l .l .hi, [data-lang="both"] .chip .l .hi, [data-lang="both"] .callout .l .hi,
[data-lang="both"] .disclose .l .hi, [data-lang="both"] .btn-ghost .l .hi { display: inline; margin: 0 0 0 .35em; }
[data-lang="both"] .chip .l .hi::before { content: "· "; }
[data-lang="en"] .l .hi { display: none; }
[data-lang="hi"] .l .en { display: none; }
[data-lang="hi"] .l .hi { display: inline; font-size: 1em; opacity: 1; }
.l .en:only-child { display: inline; }

/* ---------- app shell */
.appbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font: 700 20px/1 "Noto Sans Devanagari", "Nirmala UI", var(--font);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); position: relative; flex: none;
}
.mark::after { content: ""; position: absolute; inset: 4px auto 4px 5px; width: 1.5px; background: rgba(255, 255, 255, .55); }
.brand-name { font-weight: 750; letter-spacing: -.01em; display: flex; flex-direction: column; line-height: 1.05; }
.brand-name small { font-size: 10.5px; font-weight: 650; letter-spacing: .14em; color: var(--muted); }
.appbar-title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.appbar-title .l .hi { font-size: 11px; }
/* Top-bar titles stay on one line in every language mode (Hindi inline, ellipsis when long). */
[data-lang="both"] .appbar-title .l .hi { display: inline; margin-left: .4em; font-size: 12px; font-weight: 600; }
.appbar-title .l { display: inline; }
.appbar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.langsw { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; flex: none; }
.langsw button { border: 0; background: transparent; color: var(--muted); font: 700 12.5px/1 var(--font); padding: 0 9px;
  height: 32px; cursor: pointer; min-width: 36px; }
.langsw button.on { background: var(--brand-soft); color: var(--brand); }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2);
  background: transparent; border: 0; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--sunk); }
.badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--brand); color: var(--brand-ink); font: 700 11px/18px var(--font); text-align: center; }

.page { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 2px 10px; }
.section-h h2 { font-size: 15px; text-transform: none; }
.section-h a { font-size: 14px; color: var(--brand); font-weight: 600; }

/* bottom tab bar */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 14px; position: relative; text-align: center; }
.tab .l .hi { font-size: 9.5px; }
.tab.on { color: var(--brand); }
.tab.on::before { content: ""; position: absolute; top: -6px; width: 22px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--brand); }
.tab-fab { justify-self: center; align-self: start; margin-top: -18px; width: 58px; height: 58px; border-radius: 20px;
  background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; box-shadow: var(--shadow-lg);
  border: 4px solid var(--bg); }
.tab-fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }

.rail { display: none; }
@media (min-width: 960px) {
  /* Desktop app shell: the rail is fixed full-height with its own scroll; only the content pane scrolls. */
  body { padding-bottom: 0; padding-left: 0; }
  body.app { height: 100vh; height: 100dvh; overflow: hidden; }
  body.app .shell { position: fixed; inset: 0 0 0 var(--rail-w); overflow-y: auto; overscroll-behavior: contain;
    padding-bottom: 32px; scrollbar-gutter: stable; }
  body:not(.app) { padding-left: 0; }
  .tabbar { display: none; }
  .rail { display: flex; flex-direction: column; gap: 4px; position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 35;
    height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); }
  .rail .brand { padding: 4px 8px 18px; }
  .rail a.navi { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2);
    font-weight: 600; font-size: 14.5px; }
  .rail a.navi:hover { background: var(--sunk); }
  .rail a.navi.on { background: var(--brand-soft); color: var(--brand); }
  .rail .rail-new { margin: 6px 0 14px; }
  .rail .grow { flex: 1; }
  .appbar .brand { display: none; }
  .page { max-width: 1080px; padding: 8px 28px 32px; }
  .page.narrow { max-width: 680px; }
  .grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
  .grid-2 > * + * { margin-top: 0 !important; }
}

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 6px 10px; justify-content: space-between; margin-bottom: 12px;
  flex-wrap: wrap; }
.card-h h2 { min-width: 0; }
.card-h h2 { display: flex; align-items: center; gap: 8px; }
.card-h .ic { color: var(--muted); }

/* the bahi margin: two thin red rules + faint ruled paper */
.ledger {
  position: relative; overflow: hidden; padding-left: 30px;
  background:
    linear-gradient(90deg, transparent 15px, var(--rule) 15px, var(--rule) 16.5px, transparent 16.5px,
                    transparent 19px, var(--rule) 19px, var(--rule) 20.5px, transparent 20.5px),
    repeating-linear-gradient(180deg, transparent 0, transparent 31px, var(--ruled) 31px, var(--ruled) 32px),
    var(--surface);
}
.hero { padding: 18px 18px 18px 32px; }
.hero .label { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.amt-xl { font-size: 40px; font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin-top: 4px; }
.amt-lg { font-size: 26px; font-weight: 760; letter-spacing: -.02em; }
.amt-md { font-size: 18px; font-weight: 720; }
.cur { font-size: .62em; font-weight: 650; vertical-align: .32em; margin-right: 2px; opacity: .8; }
.paise { font-size: .55em; font-weight: 600; opacity: .7; }
.tone-stop { color: var(--stop); } .tone-go { color: var(--go); } .tone-warn { color: var(--saffron); }
.tone-info { color: var(--info); }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--line-2); }
.hero-split .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.hero-split .v { font-size: 18px; font-weight: 720; margin-top: 2px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--saffron-soft); color: var(--ink); font-size: 14px; }
.callout .ic { color: var(--saffron); margin-top: 1px; }
.callout.info { background: var(--info-soft); } .callout.info .ic { color: var(--info); }
.callout.stop { background: var(--stop-soft); } .callout.stop .ic { color: var(--stop); }
.callout.go { background: var(--go-soft); } .callout.go .ic { color: var(--go); }

/* KPI tiles */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 960px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; min-height: 104px; position: relative; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.stat .v { font-size: 22px; font-weight: 770; letter-spacing: -.02em; margin-top: auto; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat.accent { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.stat.accent .k, .stat.accent .s { color: color-mix(in srgb, var(--brand-ink) 78%, transparent); }
.stat .dot { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); }

/* ---------- lists */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  overflow: hidden; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px 14px;
  min-height: 64px; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; border-top: 1px solid var(--line); }
a.row:active, a.row:hover { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
.row .t { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s.wrap, .row .t.wrap { white-space: normal; overflow-wrap: anywhere; }
.row .end .small { white-space: nowrap; }
[data-lang="both"] .row .chip .l .hi { display: none; }
.row .mid { min-width: 0; }
.row .end { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .end .amt { font-weight: 720; font-size: 15.5px; }
.glyph { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--sunk);
  color: var(--ink-2); flex: none; }
.glyph.brand { background: var(--brand-soft); color: var(--brand); }
.glyph.go { background: var(--go-soft); color: var(--go); }
.glyph.warn { background: var(--saffron-soft); color: var(--saffron); }
.glyph.info { background: var(--info-soft); color: var(--info); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 13.5px/1 var(--font);
  background: var(--brand-soft); color: var(--brand); flex: none; letter-spacing: .02em; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .glyph { margin: 0 auto 10px; width: 52px; height: 52px; border-radius: 18px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.chip .l .hi { font-weight: 600; }
.chip-warn { background: var(--saffron-soft); color: var(--saffron); }
.chip-go { background: var(--go-soft); color: var(--go); }
.chip-stop { background: var(--stop-soft); color: var(--stop); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-done { background: var(--done-soft); color: var(--done); }
.chip-outline { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* tabs / filters */
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 650; }
.pill.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill .l .hi { display: none !important; }

/* request type tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
  display: flex; flex-direction: column; gap: 12px; min-height: 108px; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease; }
.tile:hover { border-color: var(--line-2); } .tile:active { transform: scale(.98); }
.tile .glyph { width: 42px; height: 42px; }
.tile .name { font-weight: 680; font-size: 14.5px; line-height: 1.25; }
.tiles-big .tile { min-height: 124px; }
@media (min-width: 720px) { .tiles-big { grid-template-columns: repeat(4, 1fr); } }
.other-types { align-items: center; gap: 8px; }
.other-types .pill { gap: 6px; }
.row .progress { display: block; margin: 6px 0 4px; max-width: 220px; }
.tile:nth-child(8n+1) .glyph { background: var(--brand-soft); color: var(--brand); }
.tile:nth-child(8n+2) .glyph { background: var(--saffron-soft); color: var(--saffron); }
.tile:nth-child(8n+3) .glyph { background: var(--info-soft); color: var(--info); }
.tile:nth-child(8n+4) .glyph { background: var(--go-soft); color: var(--go); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 14px; border: 1px solid transparent; font: 680 15.5px/1.15 var(--font); cursor: pointer;
  background: var(--sunk); color: var(--ink); text-align: center; transition: filter .12s, transform .08s; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn .l .hi { font-size: 11px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 8px 18px -10px var(--brand); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-go { background: var(--go); color: #fff; }
:root:not([data-theme="light"]) .btn-go { color: #08140d; }
.btn-outline { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-stop { background: transparent; border-color: color-mix(in srgb, var(--stop) 45%, transparent); color: var(--stop); }
.btn-ghost { background: transparent; color: var(--brand); padding: 0 10px; }
.btn-sm { min-height: 38px; padding: 0 12px; border-radius: 11px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; } .btn-row > * { flex: 1; }
.sticky-cta { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); z-index: 20;
  margin-top: 16px; }
body.no-tabs .sticky-cta { bottom: calc(env(safe-area-inset-bottom) + 12px); }
@media (min-width: 960px) { .sticky-cta { bottom: 16px; } }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 13px; border: 1.5px solid var(--line-2);
  background: var(--raised); color: var(--ink); font: 500 16px/1.3 var(--font); appearance: none; -webkit-appearance: none;
}
textarea.input { min-height: 84px; resize: vertical; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 38px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.input.err, .field.err .input { border-color: var(--stop); }
select.input.input-compact { min-height: 38px; width: auto; padding: 6px 34px 6px 12px; font-size: 16px;
  background-position: calc(100% - 18px) 16px, calc(100% - 12px) 16px; }
.bal .t { display: block; font-weight: 650; font-size: 15px; } .bal .s { display: block; }
.bal .mid { min-width: 0; }
.input-xl { font-size: 26px; font-weight: 700; letter-spacing: .04em; text-align: center; min-height: 64px; }
.input-otp { font: 700 30px/1 var(--mono); letter-spacing: .42em; text-align: center; min-height: 68px; padding-left: .42em; }
.prefix { position: relative; } .prefix > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 650; } .prefix .input { padding-left: 44px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.form-error { color: var(--stop); font-size: 14px; font-weight: 600; }
.check-line { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14.5px; min-height: 44px; }
.check-line input { width: 22px; height: 22px; accent-color: var(--brand); }
/* on/off switch (same tokens as the rest of the design) */
.switch { width: 50px; height: 30px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--sunk);
  position: relative; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; flex: none; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { background: var(--go); border-color: var(--go); }
.switch.on .knob { transform: translateX(20px); background: #fff; }
.switch[disabled] { opacity: .4; cursor: not-allowed; }
.person-row .end { flex-direction: row; align-items: center; gap: 10px; }
.person-row .end .small { min-width: 58px; text-align: left; }

/* segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px;
  background: var(--sunk); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { min-height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 680; font-size: 14.5px; color: var(--muted); cursor: pointer; text-align: center; padding: 4px 6px; }
.seg label .l .hi { font-size: 10.5px; }
.seg input:checked + label { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent); }
[data-when] { display: none; } [data-when].show { display: block; } .field[data-when].show { display: flex; }

/* ---------- request detail */
.req-head { display: flex; gap: 14px; align-items: flex-start; }
.req-head .glyph { width: 46px; height: 46px; border-radius: 15px; }
.req-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin-top: 14px; }
.req-meta dt { color: var(--muted); font-weight: 600; } .req-meta dd { margin: 0; font-weight: 600; min-width: 0;
  overflow-wrap: anywhere; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; font-size: 14px; }
.who { background: var(--sunk); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.who small { display: block; font-size: 11px; color: var(--muted); font-weight: 650; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow > .ic { color: var(--faint); }
.party { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.party .k { font-size: 11.5px; color: var(--muted); font-weight: 650; } .party .v { font-weight: 740; }
.money-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.money-grid > div { background: var(--sunk); border-radius: 12px; padding: 10px; }
.money-grid .k { font-size: 11.5px; color: var(--muted); font-weight: 650; }
.money-grid .v { font-weight: 740; font-size: 16px; margin-top: 2px; }

.checklist { display: flex; flex-direction: column; }
.ck { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; }
.ck + .ck { border-top: 1px solid var(--line); }
.ck .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2);
  color: transparent; }
.ck.ok .dot { background: var(--go); border-color: var(--go); color: #fff; }
.ck.waived .dot { background: var(--saffron); border-color: var(--saffron); color: #fff; }
.ck .ic { width: 15px; height: 15px; stroke-width: 3; }
.ck .t { font-weight: 640; font-size: 14.5px; }
.progress { height: 6px; border-radius: 4px; background: var(--sunk); overflow: hidden; margin: 4px 0 6px; }
.progress > span { display: block; height: 100%; background: var(--go); border-radius: 4px; transition: width .3s; }

.item { padding: 13px 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.item + .item { border-top: 1px solid var(--line); }
.item .desc { font-weight: 640; } .item .calc { font-size: 13px; color: var(--muted); }
.item .amt { font-weight: 730; text-align: right; }
.item.rejected .desc, .item.rejected .amt { text-decoration: line-through; text-decoration-color: var(--stop); color: var(--muted); }
.item.removed { opacity: .5; }
.item .why { grid-column: 1 / -1; font-size: 13px; color: var(--stop); }
.item .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.item details { grid-column: 1 / -1; }
.item-total { display: flex; justify-content: space-between; padding-top: 12px; margin-top: 4px;
  border-top: 2px solid var(--ink); font-weight: 760; font-size: 17px; }
details > summary { list-style: none; cursor: pointer; } details > summary::-webkit-details-marker { display: none; }
.disclose { color: var(--brand); font-weight: 650; font-size: 14px; display: inline-flex; gap: 6px; align-items: center;
  min-height: 36px; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sunk);
  border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .tag { position: absolute; left: 6px; bottom: 6px; right: 6px; display: flex; justify-content: space-between;
  gap: 4px; font: 700 10.5px/1 var(--font); color: #fff; white-space: nowrap; }
.photo .tag .ic { width: 12px; height: 12px; stroke-width: 2.4; vertical-align: -2px; }
@media (max-width: 380px) { .photo .tag { font-size: 9.5px; left: 4px; right: 4px; bottom: 4px; } .photo .tag span { padding: 3px 4px; } .photo .tag .ic { width: 10px; height: 10px; } }
.photo .tag span { background: rgba(0, 0, 0, .58); padding: 4px 6px; border-radius: 6px; backdrop-filter: blur(4px); }
.photo-add { display: grid; place-items: center; text-align: center; color: var(--brand); border: 1.5px dashed var(--line-2);
  background: transparent; font-size: 12.5px; font-weight: 700; gap: 4px; padding: 8px; }
.photo-add .ic { width: 26px; height: 26px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 14px; font-size: 13.5px; }
.tl::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-2); }
.tl.k-go::before { border-color: var(--go); background: var(--go); }
.tl.k-stop::before { border-color: var(--stop); background: var(--stop); }
.tl.k-money::before { border-color: var(--info); background: var(--info); }
.tl .what { font-weight: 650; } .tl .when { color: var(--muted); font-size: 12.5px; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.bar { height: 9px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.bar-row:nth-child(2) .bar > span { background: var(--saffron); }
.bar-row:nth-child(3) .bar > span { background: var(--info); }
.bar-row:nth-child(4) .bar > span { background: var(--go); }
.bar-row:nth-child(n+5) .bar > span { background: var(--faint); }
.spark { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 118px; padding-top: 8px; }
.spark .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.spark .b { width: 100%; max-width: 40px; border-radius: 8px 8px 4px 4px; background: var(--brand-soft); min-height: 4px; }
.spark .col:last-child .b { background: var(--brand); }
.spark .m { font-size: 11.5px; color: var(--muted); font-weight: 650; }

/* table-ish rows for balances */
.bal { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.bal + .bal { border-top: 1px solid var(--line); }
.bal .nums { display: flex; gap: 14px; text-align: right; }
.bal .nums .k { font-size: 11px; color: var(--muted); font-weight: 650; }
.bal .nums .v { font-weight: 720; font-size: 14.5px; }

/* toasts */
.toasts { position: fixed; top: calc(var(--bar-h) + env(safe-area-inset-top) + 8px); left: 0; right: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; overflow-wrap: anywhere; padding: 13px 16px; border-radius: 14px; font-weight: 620;
  font-size: 14.5px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease-out; }
.toast-error { background: var(--stop); color: #fff; }
.toast-success { background: var(--go); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* sheets (dialog) */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; background: var(--surface);
  color: var(--ink); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(10, 8, 6, .5); backdrop-filter: blur(2px); }
dialog.sheet[open] { animation: sheet-up .22s ease-out; }
.sheet-in { padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-in::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2);
  margin: 0 auto 14px; }
@media (min-width: 720px) { dialog.sheet { margin: auto; border-radius: 22px; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }

/* auth */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px; max-width: 440px;
  margin: 0 auto; }
.auth-card { padding: 26px 22px 22px 40px; }
.auth .mark { width: 54px; height: 54px; font-size: 32px; border-radius: 16px; margin-bottom: 18px; }
.auth h1 { font-size: 28px; }
.auth .lede { color: var(--muted); margin: 8px 0 22px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.lang-switch { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }

/* camera */
body.camera { background: #000; color: #fff; padding: 0; }
.cam { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #000; }
.cam-top { padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; display: flex; gap: 10px; align-items: center;
  background: linear-gradient(#000c, #0000); position: absolute; inset: 0 0 auto 0; z-index: 2; }
.cam-top .icon-btn { color: #fff; background: rgba(255, 255, 255, .12); }
.cam-title { font-weight: 700; } .cam-title .l .hi { opacity: .8; }
.cam-view { flex: 1; position: relative; overflow: hidden; }
.cam-view video, .cam-view canvas, .cam-view img { width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; inset: 14% 7% 22%; border: 2px solid rgba(255, 255, 255, .75); border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .28); pointer-events: none; }
.cam-hint { position: absolute; left: 16px; right: 16px; bottom: 25%; text-align: center; font-size: 13.5px;
  font-weight: 600; text-shadow: 0 1px 3px #000; }
.cam-bar { padding: 18px 20px calc(env(safe-area-inset-bottom) + 18px); display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px; background: #000; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer;
  box-shadow: 0 0 0 3px #000 inset; }
.shutter:active { transform: scale(.94); }
.cam-meta { font-size: 12px; opacity: .85; display: flex; gap: 6px; align-items: center; }
.cam-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; }
.cam-review { display: none !important; } .cam.reviewing .cam-review { display: grid !important; }
.cam.reviewing .cam-live { display: none !important; }
.cam-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam.reviewing img.cam-shot { display: block !important; }
.cam.failed .cam-frame, .cam.failed .cam-hint, .cam.failed .shutter, .cam.failed .cam-meta { visibility: hidden; }
.cam-sub { display: block; opacity: .8; font-weight: 500; }
.btn-on-dark { color: #fff; border-color: rgba(255, 255, 255, .4); }
.cam-review.cam-bar { grid-template-columns: 1fr 1fr; }

.bell .badge[hidden] { display: none; }
.bell.ring { animation: ring .6s ease-in-out 2; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(14deg); } 75% { transform: rotate(-14deg); } }
.notif.unread .t { color: var(--ink); } .notif.unread .glyph { background: var(--brand-soft); color: var(--brand); }

/* help assistant bubble + panel */
.chat-fab { position: fixed; right: 0; top: 42%; z-index: 45;
  min-width: 54px; min-height: 64px; border-radius: 16px 0 0 16px; border: 1px solid var(--line-2); background: var(--raised); color: var(--brand);
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; padding: 6px 8px;
  box-shadow: var(--shadow-lg); cursor: pointer; }
.chat-fab .ic { width: 26px; height: 26px; }
.chat-fab-label { font-size: 12px; font-weight: 700; }
.chat-fab[aria-expanded="true"] { background: var(--brand); color: var(--brand-ink); }
.chat-panel { position: fixed; z-index: 46; left: 0; right: 0; bottom: 0; height: min(78dvh, 640px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-up .2s ease-out; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head .mark { width: 32px; height: 32px; font-size: 18px; border-radius: 10px; }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.chat-title .l .hi { display: inline; margin-left: .35em; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.chat-msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.chat-msg.bot { align-self: flex-start; } .chat-msg.me { align-self: flex-end; align-items: flex-end; }
.chat-bubble { padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-line;
  overflow-wrap: anywhere; }
.chat-msg.bot .chat-bubble { background: var(--raised); border: 1px solid var(--line); border-top-left-radius: 6px; }
.chat-msg.me .chat-bubble { background: var(--brand-soft); color: var(--ink); border-top-right-radius: 6px; }
.chat-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-choices .pill { height: 34px; font-size: 13.5px; cursor: pointer; }
.chat-choices.used .pill { opacity: .45; pointer-events: none; }
.chat-link { align-self: flex-start; }
.chat-typing { display: flex; gap: 4px; padding: 0 18px 8px; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.chat-typing span:nth-child(2) { animation-delay: .2s; } .chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-input { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-input .input { min-height: 46px; }
.chat-input .btn { min-height: 46px; padding: 0 14px; }
body.chat-open .sticky-cta { visibility: hidden; }
body.app .page { padding-bottom: 84px; }   /* last rows can scroll clear of the help bubble */
@media (min-width: 720px) {
  .chat-panel { left: auto; right: 20px; bottom: 90px; width: 380px; height: min(70vh, 600px); border-radius: 20px; }
}
@media (min-width: 960px) { .chat-panel { bottom: 88px; right: 22px; } }

/* OTP / vendor */
.snapshot { border-radius: var(--r); background: var(--raised); border: 1px solid var(--line); overflow: hidden; }
.snapshot .row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 11px 14px; font-size: 15px; }
.snapshot .row2 + .row2 { border-top: 1px solid var(--line); }
.snapshot .tot { background: var(--sunk); font-weight: 800; font-size: 18px; }
.big-total { font-size: 44px; font-weight: 800; letter-spacing: -.03em; text-align: center; margin: 6px 0 2px; }

/* misc */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.hstack { display: flex; gap: 10px; align-items: center; } .hstack.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.right { text-align: right; } .center { text-align: center; }
.mt0 { margin-top: 0 !important; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.hide { display: none !important; }
.greet { margin: 10px 2px 14px; } .greet .muted { font-size: 14px; }
.menu .row { min-height: 58px; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
table.t tr.bad td { background: var(--stop-soft); }
/* Phones: tables turn into stacked cards (each cell shows its column name). */
@media (max-width: 719px) {
  .table-wrap.cards-sm { overflow: visible; margin: 0; padding: 0; }
  table.t.cards-sm, table.t.cards-sm tbody, table.t.cards-sm tr, table.t.cards-sm td { display: block; width: 100%; }
  table.t.cards-sm thead { display: none; }
  table.t.cards-sm tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.t.cards-sm tr.bad { background: var(--stop-soft); }
  table.t.cards-sm tr.bad td { background: transparent; }
  table.t.cards-sm td { display: grid; grid-template-columns: 38% 1fr; gap: 8px; padding: 3px 0; border: 0; overflow-wrap: anywhere; }
  table.t.cards-sm td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; }
  table.t.cards-sm td:empty, table.t.cards-sm td.blank { display: none; }
}
.err-list { color: var(--stop); font-weight: 600; font-size: 12.5px; }
.hash { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; color: var(--ink-2); }
.qr-thumb { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.notice-imported { border-left: 4px solid var(--saffron); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
