:root { color-scheme: light; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
#root { min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }
img, canvas { max-width: 100%; }
:root {
  --ground: #ECEFEE; --surface: #FFFFFF; --surface-2: #F5F7F6; --surface-3: #E4E9E8;
  --ink: #172126; --ink-2: #45535A; --muted: #6C7A80; --line: #D5DCDA; --line-strong: #B4BFBD;
  --accent: #F2A516; --accent-press: #DC9208; --accent-ink: #1B1405; --accent-soft: #FCEFD3; --accent-text: #8A5A00;
  --steel: #235C7D; --steel-soft: #DFEBF2;
  --good: #1B7545; --good-soft: #DDF1E5; --warn: #8F5B00; --warn-soft: #FBEBCB; --bad: #B3362E; --bad-soft: #F8E0DD;
  --toast-bg: #172126; --toast-ink: #F2F5F4; --scrim: rgba(12, 18, 21, .46);
  --series-1: #2a78d6; --series-2: #1baf7a; --grid: #E3E8E7; --meter-track: #DCE8F5; --meter-fill: #2a78d6;
  --shadow-1: 0 1px 2px rgba(23, 33, 38, .06); --shadow-2: 0 8px 28px rgba(23, 33, 38, .16);
  --r-lg: 14px; --r-md: 10px; --r-sm: 7px;
  --f-ui: "IBM Plex Sans", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-cond: "Barlow Condensed", "IBM Plex Sans", "Noto Sans Tamil", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0E1316; --surface: #161E23; --surface-2: #1B252B; --surface-3: #24313A;
    --ink: #E3E9EB; --ink-2: #AFBBC0; --muted: #85949B; --line: #29353C; --line-strong: #3B4A53;
    --accent: #F4B13A; --accent-press: #F7C35F; --accent-ink: #1B1405; --accent-soft: #3A2D12; --accent-text: #F4C46A;
    --steel: #8EC2E2; --steel-soft: #17313F;
    --good: #5CCB8F; --good-soft: #153325; --warn: #E8B75C; --warn-soft: #382C13; --bad: #F18B81; --bad-soft: #3C1D1B;
    --toast-bg: #E3E9EB; --toast-ink: #111719; --scrim: rgba(0, 0, 0, .6);
    --series-1: #3987e5; --series-2: #199e70; --grid: #253038; --meter-track: #1C3247; --meter-fill: #3987e5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 10px 30px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0E1316; --surface: #161E23; --surface-2: #1B252B; --surface-3: #24313A;
  --ink: #E3E9EB; --ink-2: #AFBBC0; --muted: #85949B; --line: #29353C; --line-strong: #3B4A53;
  --accent: #F4B13A; --accent-press: #F7C35F; --accent-ink: #1B1405; --accent-soft: #3A2D12; --accent-text: #F4C46A;
  --steel: #8EC2E2; --steel-soft: #17313F;
  --good: #5CCB8F; --good-soft: #153325; --warn: #E8B75C; --warn-soft: #382C13; --bad: #F18B81; --bad-soft: #3C1D1B;
  --toast-bg: #E3E9EB; --toast-ink: #111719; --scrim: rgba(0, 0, 0, .6);
  --series-1: #3987e5; --series-2: #199e70; --grid: #253038; --meter-track: #1C3247; --meter-fill: #3987e5;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 10px 30px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { background: var(--ground); }
body { color: var(--ink); font: 400 15px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-weight: 500; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- shell ---------- */
.app { min-height: 100%; }
.rail { display: none; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding-inline: 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-mark { flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-name { font: 700 19px/1.1 var(--f-cond); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.sync[data-s="saving"] i { background: var(--accent); }
.sync[data-s="sample"] i, .sync[data-s="local"] i { background: var(--muted); }
.sync[data-s="error"] i { background: var(--bad); }
.top-actions { display: none; gap: 8px; }

.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 14px; }
.banner strong { font-weight: 600; }
.banner .grow { flex: 1 1 240px; }

.main { max-width: 1180px; margin-inline: auto; padding-inline: 16px; padding-block: 18px calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom, 0px)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar-h); border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 500; position: relative; }
.tab svg { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px)); z-index: 31;
  width: 58px; height: 58px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: var(--shadow-2);
}
.fab svg { width: 28px; height: 28px; }
.fab:active { background: var(--accent-press); }

@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
  .rail .brand { flex: none; padding: 4px 6px 14px; }
  .rail-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border: 0; background: none; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: 14.5px; text-align: left; }
  .rail-link svg { width: 20px; height: 20px; flex: none; }
  .rail-link:hover { background: var(--surface-2); color: var(--ink); }
  .rail-link[aria-current="page"] { background: var(--steel-soft); color: var(--ink); }
  .rail-sep { height: 1px; background: var(--line); margin: 10px 6px; }
  .rail-label { font: 600 11px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; }
  .topbar .brand { display: none; }
  .topbar { justify-content: space-between; }
  .top-title { font: 600 15px/1.2 var(--f-ui); color: var(--ink-2); }
  .top-actions { display: flex; }
  .tabbar, .fab { display: none; }
  .main { padding-block: 24px 64px; padding-inline: 28px; }
}
@media (max-width: 999px) { .top-title { display: none; } }

/* ---------- page furniture ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { font: 700 30px/1.05 var(--f-cond); letter-spacing: .005em; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin: -4px 0 10px -6px; padding: 6px 8px; border: 0; background: none; color: var(--steel); font-weight: 500; border-radius: 8px; }
.back svg { width: 18px; height: 18px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { font: 700 20px/1.1 var(--f-cond); letter-spacing: .01em; }
.section-head .link { font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 16px; }
.link { color: var(--steel); background: none; border: 0; padding: 0; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--steel); }
.btn-ghost:hover { background: var(--steel-soft); }
.btn-danger { color: var(--bad); border-color: var(--line-strong); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* chips & tags */
.tag { display: inline-flex; align-items: center; gap: 4px; font: 700 12px/1 var(--f-cond); letter-spacing: .08em; text-transform: uppercase; padding: 4px 7px 3px; border-radius: 5px; white-space: nowrap; }
.tag-out { background: var(--accent-soft); color: var(--accent-text); }
.tag-in { background: var(--steel-soft); color: var(--steel); }
.tag-gst { background: var(--steel-soft); color: var(--steel); }
.tag-plain { background: var(--surface-3); color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip-paid { background: var(--good-soft); color: var(--good); }
.chip-part { background: var(--warn-soft); color: var(--warn); }
.chip-unpaid { background: var(--bad-soft); color: var(--bad); }
.chip-cancelled { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.chip-low { background: var(--warn-soft); color: var(--warn); }
.chip-lock { background: var(--surface-3); color: var(--ink-2); }

/* filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.filters .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.filters .seg::-webkit-scrollbar { display: none; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); font-weight: 600; }
.search { flex: 1 1 200px; min-width: 0; max-width: 360px; position: relative; }
.search input { width: 100%; height: 40px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--muted); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 0; background: none; text-align: left; min-height: 60px; }
button.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub2 { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.row-end { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font: 700 15px/1 var(--f-cond); letter-spacing: .04em; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty .btn-row { justify-content: center; margin-top: 14px; }

/* challan "ticket" rows: a stub with the number, like a challan book */
.ticket { display: flex; align-items: stretch; width: 100%; border: 0; background: none; text-align: left; padding: 0; }
button.ticket:hover { background: var(--surface-2); }
.ticket-stub { flex: none; width: 108px; padding: 12px 10px 12px 14px; border-right: 1.5px dashed var(--line-strong); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ticket-no { font: 500 12px/1.2 var(--f-mono); color: var(--ink-2); word-break: break-all; }
.ticket-body { flex: 1; min-width: 0; padding: 12px 16px 12px 14px; display: flex; gap: 10px; align-items: center; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi-value { font-size: 23px; font-weight: 600; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hero { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, var(--ink) 8px 16px); opacity: .9; }
.hero-label { font-size: 14px; color: var(--ink-2); }
.hero-value { font-size: 48px; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; }
.hero-sub { font-size: 13.5px; color: var(--muted); }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* chart */
.chart-card { padding: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin: 2px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .bars { transition: opacity .15s; }
.chart .bars.on { opacity: .78; }
.chart .hit { cursor: default; outline: none; }
.chart .hit:focus-visible { outline: 2px solid var(--steel); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); border-radius: 10px; padding: 8px 10px; font-size: 13px; min-width: 150px; }
.tip b { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip-row span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip-row span::before { content: ""; width: 12px; height: 2px; background: var(--k); }
.tip-row strong { font-variant-numeric: tabular-nums; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.mini-table th, .mini-table td { padding: 5px 6px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { color: var(--muted); font-weight: 500; }

/* meters */
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 16px; align-items: center; }
.meter-row + .meter-row { border-top: 1px solid var(--line); }
.meter-name { font-weight: 500; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-nums { font-size: 13px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--meter-track); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--meter-fill); border-radius: 4px 4px 4px 4px; }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl .strike td { color: var(--muted); text-decoration: line-through; }

/* key-value */
.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* forms */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form .seg { flex-wrap: wrap; max-width: 100%; }
.form .seg button { white-space: normal; text-align: center; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.err-text { font-size: 12.5px; color: var(--bad); }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 15px; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: 2px solid var(--steel); outline-offset: 0; border-color: var(--steel); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.input.bad { border-color: var(--bad); }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 > .wide-sm { grid-column: 1 / -1; } }
.money-in { position: relative; }
.money-in::before { content: "₹"; position: absolute; left: 12px; top: 11px; color: var(--muted); }
.money-in .input { padding-left: 26px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--steel); }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: grid; gap: 12px; }
.fieldset-title { font: 700 17px/1 var(--f-cond); letter-spacing: .02em; }

/* quantity lines in challans */
.qlines { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.qline { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 6px 10px; align-items: center; padding: 10px 12px; }
.qline + .qline { border-top: 1px solid var(--line); }
.qline.ret { grid-template-columns: minmax(0, 1fr) repeat(3, 72px); }
.qline-name { font-weight: 600; font-size: 14.5px; min-width: 0; }
.qline-meta { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.qline .input { min-height: 40px; text-align: right; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.qline-head { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 72px); gap: 10px; padding: 8px 12px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.qline-head span:not(:first-child) { text-align: right; }
.qline .warn { grid-column: 1 / -1; font-size: 12.5px; color: var(--warn); }
@media (max-width: 440px) { .qline.ret { grid-template-columns: repeat(3, minmax(0, 1fr)); } .qline.ret .qline-name { grid-column: 1 / -1; } .qline-head { display: none; } .qline.ret .input::placeholder { color: var(--muted); } }

/* bill preview in the form */
.preview { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.preview .tbl td, .preview .tbl th { padding: 8px 10px; font-size: 13.5px; }
.totals { display: grid; gap: 4px; padding: 12px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.totals .grand { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line-strong); padding-top: 8px; margin-top: 4px; }
.totals .subgrand { font-weight: 700; border-top: 1px solid var(--line-strong); padding-top: 8px; margin-top: 4px; }
.totals .grand.balance { border-top-style: dashed; }
.callout.good { background: var(--good-soft); border-color: transparent; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 36px; gap: 8px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.icon-btn svg { width: 18px; height: 18px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink-2); }
.presets button:hover { border-color: var(--steel); color: var(--steel); }
.callout { padding: 10px 12px; border-radius: 9px; font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }
.callout.bad { background: var(--bad-soft); border-color: transparent; color: var(--ink); }

/* sheet (form overlay) */
.sheet-scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { width: 100%; max-height: 100%; height: 100%; display: flex; flex-direction: column; background: var(--ground); animation: rise .22s ease; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font: 700 22px/1.1 var(--f-cond); letter-spacing: .01em; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px); background: var(--surface); border-top: 1px solid var(--line); }
.sheet-foot .grow { flex: 1; display: flex; align-items: center; font-size: 13.5px; color: var(--ink-2); min-width: 0; }
@media (min-width: 760px) {
  .sheet-scrim { align-items: center; padding: 24px; }
  .sheet { max-width: 760px; height: auto; max-height: min(92vh, 980px); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-2); }
  .sheet.narrow { max-width: 520px; }
  .sheet-head { padding-top: 12px; }
  .sheet-foot { padding-bottom: 12px; }
}
@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* action sheet & dialog */
.actions-list { display: grid; gap: 8px; }
.action { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; }
.action:hover { border-color: var(--line-strong); }
.action .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.action .ic svg { width: 22px; height: 22px; }
.action b { display: block; font-size: 15.5px; }
.action span { color: var(--muted); font-size: 13px; }

/* toasts */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom, 0px)); z-index: 70; display: grid; justify-items: center; gap: 8px; padding-inline: 16px; pointer-events: none; }
@media (min-width: 1000px) { .toast-root { bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 560px; width: 100%; padding: 12px 12px 12px 16px; border-radius: 12px; background: var(--toast-bg); color: var(--toast-ink); box-shadow: var(--shadow-2); font-size: 14px; animation: rise .2s ease; }
.toast .grow { flex: 1; min-width: 0; }
.toast button { flex: none; border: 0; border-radius: 8px; padding: 7px 11px; font-weight: 600; font-size: 13.5px; background: var(--accent); color: var(--accent-ink); }
.toast button.plain { background: transparent; color: inherit; opacity: .8; }

/* document preview */
.doc-pages { display: grid; gap: 14px; justify-items: center; }
.doc-pages img { width: 100%; max-width: 820px; background: #fff; border-radius: 4px; box-shadow: var(--shadow-2); }
.doc-pages.zoom img { width: 820px; max-width: none; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--steel); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { min-height: 70vh; display: grid; place-items: center; text-align: center; color: var(--muted); gap: 12px; }

/* detail pages */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.site-card + .site-card { margin-top: 12px; }
.site-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.site-head h3 { font-size: 16px; }
.qty-list { list-style: none; margin: 0; padding: 6px 16px 10px; }
.qty-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.qty-list li + li { border-top: 1px dashed var(--line); }
.stat-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); }
.stat-line b { color: var(--ink); font-weight: 600; }
.balance-big { font-size: 30px; font-weight: 600; }
.more-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.more-tile { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); text-align: left; min-height: 116px; }
.more-tile svg { width: 26px; height: 26px; color: var(--steel); }
.more-tile b { font-size: 16px; }
.more-tile span { font-size: 13px; color: var(--muted); }
.steps { display: grid; gap: 10px; counter-reset: s; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step::before { counter-increment: s; content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--steel-soft); color: var(--steel); font-weight: 700; font-size: 13px; }

.row-title, .row-sub, .row-sub2 { display: block; }
.row-hit { flex: 1; min-width: 0; display: block; border: 0; background: none; text-align: left; padding: 0; }
.row-hit:hover .row-title { color: var(--steel); }
.doc-pages { overflow-x: auto; }
.doc-pages canvas { display: block; width: 100%; max-width: 820px; height: auto; background: #fff; border-radius: 4px; box-shadow: var(--shadow-2); }
.doc-pages.zoom { justify-items: start; }
.doc-pages.zoom canvas { width: 820px; max-width: none; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.only-narrow { display: block; }
.only-wide { display: none; }
@media (min-width: 700px) { .only-narrow { display: none; } .only-wide { display: block; } }
.line-list { list-style: none; margin: 0; padding: 0; }
.line-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 16px; }
.line-list li + li { border-top: 1px solid var(--line); }
.line-list .ln-desc { font-weight: 600; font-size: 14.5px; }
.line-list .ln-amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.line-list .ln-sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tbl-report td { white-space: nowrap; }
.doc-pages.roll canvas { max-width: 330px; }
.doc-pages.roll.zoom canvas { width: 560px; }
.qline .note-ok { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-2); }
/* ---- online edition: branches, login ---- */
.scope-box { display: flex; align-items: center; min-width: 0; }
.scope-pick, .scope-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); max-width: 44vw; }
.scope-pick svg, .scope-label svg { width: 17px; height: 17px; flex: none; color: var(--steel); }
.scope-pick select { border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); padding: 6px 8px; font-weight: 600; font-size: 13.5px; max-width: 100%; min-width: 0; }
.scope-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-branch { background: var(--surface-3); color: var(--ink-2); vertical-align: 1px; }
.acct-block + .acct-block { border-top: 1px dashed var(--line); }
.acct-branch { display: flex; align-items: center; gap: 6px; padding: 10px 16px 0; font-size: 12.5px; font-weight: 600; color: var(--steel); text-transform: uppercase; letter-spacing: .05em; }
.acct-branch svg { width: 15px; height: 15px; }
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--ground); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow-1); }
.auth-card h1 { font: 700 28px/1.1 var(--f-cond); margin: 14px 0 4px; }
.auth-card .brand-mark { width: 44px; height: 44px; border-radius: 11px; }
.auth-card .brand-mark svg { width: 28px; height: 28px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 14px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.people li + li { border-top: 1px solid var(--line); }
.people .grow { flex: 1; min-width: 0; }
@media (max-width: 520px) { .top-title { display: none; } .scope-pick select { max-width: 38vw; } }
@media (max-width: 520px) { .topbar:has(.scope-pick) .brand-sub { display: none; } }
@media (max-width: 400px) { .sync #sync-t { display: none; } .sync { padding: 7px; } }
.setup-steps { margin: 12px 0 14px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.auth-card textarea.mono { font-size: 12.5px; }
.qline.quote, .qline-head.quote { grid-template-columns: minmax(0, 1fr) 78px 92px; }
.qline-head.quote { display: grid; }
.rr-row { grid-template-columns: 22px minmax(0, 1fr) auto; cursor: pointer; }
.rr-row input { width: 20px; height: 20px; accent-color: var(--steel); }
.rr-row b { font-variant-numeric: tabular-nums; }
.rent-calc .rc-item td { font-weight: 600; padding-top: 12px; border-top: 1px solid var(--line-strong); }
.rent-calc .rc-total td { background: var(--surface-2); font-weight: 600; }
.ref-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ref-chips:empty { display: none; }
.ref-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: 13px; }
.ref-chip .muted { font-family: var(--f-sans, inherit); font-size: 12px; }
.ref-chip button { border: 0; background: transparent; color: var(--ink-2); padding: 3px; border-radius: 999px; display: inline-flex; }
.ref-add { display: flex; gap: 8px; }
.ref-add .input { flex: 1; min-width: 0; }
#bf-mode { margin-bottom: 2px; }
.passbook .pb-row[data-open] { cursor: pointer; }
.passbook .pb-dr { color: var(--bad); }
.passbook .pb-cr { color: var(--good); }
.passbook td, .passbook th { padding-left: 10px; padding-right: 10px; }
.cust-code { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); vertical-align: 1px; }
.cust-id-field .input { max-width: 220px; }
.cust-go { margin-bottom: 14px; display: grid; gap: 6px; }
.passbook-card .pb-dr { color: var(--bad); }
.passbook-card .pb-cr { color: var(--good); }
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff !important; }
  #print-area { display: block; }
  #print-area img { display: block; width: 100%; break-after: page; page-break-after: always; }
  #print-area img:last-of-type { break-after: auto; page-break-after: auto; }
}

/* v2.11 */
.tbl-tight th, .tbl-tight td { padding: 6px 6px; font-size: 13px; }
.tbl-tight th { font-size: 10.5px; letter-spacing: .03em; }
.tbl-tight td:first-child { min-width: 96px; }
