:root {
  --bg: #f4f6f8; --surface: #ffffff; --text: #111827; --muted: #5f6b7a; --line: #d9dee5; --grid: #e2e6eb;
  --accent: #0f766e; --accent-text: #fff; --accent-soft: #e3f4f1;
  --head: #f1f3f5; --sel: #cfe8e4; --cur: #0f766e;
  --ok: #0f7b4b; --ok-bg: #e3f5ea; --warn: #8a5300; --warn-bg: #fff2d6; --bad: #b3261e; --bad-bg: #fdeceb;
  --auto: #8a96a3; --ghost: #9aa5b1;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #171b21; --text: #e7ecf2; --muted: #9aa7b5; --line: #2b323c; --grid: #262d36;
    --accent: #3fc1b0; --accent-text: #06201c; --accent-soft: #143430;
    --head: #1d232b; --sel: #1d4440; --cur: #3fc1b0;
    --ok: #57d496; --ok-bg: #12301f; --warn: #ffc15e; --warn-bg: #3a2b0c; --bad: #ff8c85; --bad-bg: #3b1816;
    --auto: #6f7b88; --ghost: #6f7b88;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
a { color: var(--accent); }

input, select, button, textarea { font: inherit; color: inherit; }
input[type=email], input[type=password], input[type=search], input[type=text], input[type=date], input[type=month], select {
  min-height: 36px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .55; cursor: default; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.login-card input { width: 100%; }
.logo { width: 48px; height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.login h1 { font-size: 22px; margin-bottom: 4px; }
.login label { display: block; margin: 12px 0 4px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin-top: 16px; }
.error { color: var(--bad); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; color: var(--accent); }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.page { padding: 16px; max-width: 1500px; margin: 0 auto; }
.page.full { max-width: none; padding: 0; }
.toast { position: fixed; bottom: 52px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-weight: 600; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }

/* cards / panels */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card .sub { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.card .row { display: flex; justify-content: space-between; padding: 3px 0; border-top: 1px dashed var(--grid); }
.card .row a { text-decoration: none; }
.card.stale { border-color: var(--warn); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.panel > h3 { margin-bottom: 10px; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.spacer { flex: 1; }

/* plain tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; background: var(--surface); }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.tbl th { background: var(--head); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); position: sticky; top: 0; cursor: default; }
.tbl th.sort { cursor: pointer; } .tbl th.sort:hover { color: var(--text); }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--accent-soft); }
.tbl tfoot td { font-weight: 700; background: var(--head); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* ---------- Excel-like sheet ---------- */
/* sheet page: app fills the window exactly, whatever the top bar height (zoom / wrapped menu) */
#app.fixed { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
#app.fixed > .page { flex: 1; min-height: 0; }
.sheet { display: flex; flex-direction: column; height: 100%; }
.sheet-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-bar .count { font-size: 13px; }
.save-state { font-size: 12px; min-width: 70px; }
.grid-scroll { flex: 1; overflow: auto; position: relative; background: var(--surface); outline: none; }
.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; user-select: none; }
.grid th, .grid td { height: 27px; padding: 0 6px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid thead th { position: sticky; top: 0; z-index: 3; background: var(--head); font-weight: 600; font-size: 12px; text-align: left; color: var(--muted); }
.grid thead th.tagh { color: var(--accent); }
.grid td.rn, .grid th.rn { position: sticky; left: 0; z-index: 2; background: var(--head); color: var(--muted); text-align: right; font-size: 11px; }
.grid thead th.rn { z-index: 4; }
.grid td.tag { background: var(--surface); cursor: cell; font-weight: 600; }
.grid tr.auto td { color: var(--auto); }
.grid tr.auto td.tag { font-weight: 400; font-style: italic; cursor: default; }
.grid tr.day td { border-top: 2px solid var(--line); }
.grid td.sel { background: var(--sel) !important; }
.grid td.cur { outline: 2px solid var(--cur); outline-offset: -2px; }
.grid td.ghost { color: var(--ghost); font-style: italic; font-weight: 400; }
.grid td.st-ok { color: var(--ok); } .grid td.st-bad { color: var(--bad); font-weight: 600; } .grid td.st-otp { color: var(--warn); font-weight: 600; } .grid td.st-empty { color: var(--bad); }
.grid tr.pend td.rn { box-shadow: inset 3px 0 0 var(--bad); }
.grid tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--warn-bg); } to { background: transparent; } }
.cell-editor { position: absolute; z-index: 10; border: 2px solid var(--cur); padding: 0 5px; font: 600 13px system-ui, sans-serif; background: var(--surface); color: var(--text); outline: none; }
.tabs { display: flex; gap: 2px; padding: 4px 8px 0; background: var(--head); border-bottom: 1px solid var(--line); overflow-x: auto; flex-shrink: 0; }
.tabs .lbl { align-self: center; font-size: 12px; color: var(--muted); padding: 0 6px 4px 2px; }
.tabs a { padding: 6px 14px; text-decoration: none; color: var(--text); font-size: 13px; font-weight: 600; border: 1px solid transparent; border-bottom: 0; white-space: nowrap; border-radius: 6px 6px 0 0; }
.tabs a:hover { background: var(--surface); }
.tabs a.on { background: var(--surface); border-color: var(--line); color: var(--accent); font-weight: 700; margin-bottom: -1px; }
.tabs a .n { color: var(--bad); font-weight: 700; margin-left: 4px; font-size: 11px; }
.help { font-size: 12px; color: var(--muted); padding: 4px 12px; background: var(--surface); border-top: 1px solid var(--line); }
kbd { font: 11px ui-monospace, monospace; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--head); }

/* upload */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; background: var(--surface); cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.file { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.file .meta { font-size: 13px; color: var(--muted); }
.file ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

@media (max-width: 700px) {
  .page { padding: 12px; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .who span { display: none; }
  .tbl th, .tbl td { padding: 6px; }
  .hide-sm { display: none; }
}

/* ---------- operations pages (limits / account / drivers) ---------- */
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; margin: 8px 0 12px; }
.formgrid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input { width: 100%; color: var(--text); }
.drivercard { align-self: end; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.chip { min-height: 38px; padding: 0 16px; border-radius: 999px; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.triptotal { font-weight: 700; margin: 0 0 10px; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 14px; }
.tile .big { font-size: 22px; font-weight: 700; margin: 4px 0; }
.tbl tr.cmsrow td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.vhead h3 { margin-bottom: 6px; }
@media (max-width: 700px) { .formgrid { grid-template-columns: 1fr 1fr; } .formgrid.small { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- limit sheet / vehicle account split / phones ---------- */
.nav a .n { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.lim-scroll { height: calc(100vh - 260px); min-height: 360px; border: 1px solid var(--line); border-radius: 8px; }
.grid tr.ro td { color: var(--text); }   /* other people's lines: same dark text (only your own editable cells are bold) */
.grid tr.cancel td { text-decoration: line-through; color: var(--ghost); }
.grid td.draft { background: var(--warn-bg) !important; color: var(--warn); }
.grid .lim-cancel { min-height: 22px; padding: 0 6px; font-size: 12px; }
.savebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }
.old { text-decoration: line-through; color: var(--muted); }
.dsl { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin: 6px 0 10px; }
.va-split { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.va-split .panel { overflow-x: auto; }
.va-split td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 160px; }
.nw { white-space: nowrap; }
.va-split th { white-space: nowrap; }
.va-split tr.wait td { background: var(--warn-bg); }
.small { font-size: 12px; }
.lcards { display: flex; flex-direction: column; gap: 8px; }
.lcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.lcard.mine { border-left: 4px solid var(--accent); }
.lcard.cancel { opacity: .55; }
.lcard .l1, .lcard .l2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lcard .l1 .amt { font-size: 16px; }
.lcard .l2 { font-size: 12px; margin-top: 2px; }
.lcard .l3 { margin: 6px 0 2px; font-size: 13px; word-break: break-word; }
.lcard .bar { margin: 8px 0 0; }
.lcard .lform { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
@media (max-width: 1000px) { .va-split { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .bar > input[type=search] { flex: 1 1 100%; }
  .chip { min-height: 42px; }
  .lcard .btn.small { min-height: 38px; padding: 0 14px; }
  .va-split .tbl th, .va-split .tbl td { padding: 6px 4px; font-size: 13px; }
}

@media (max-width: 700px) { input, select, textarea { font-size: 16px; } }  /* stops phones zooming in when a box is tapped */
@media (max-width: 700px) {   /* phones: brand + sign out on one line, the menu as one swipeable row under it */
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .topbar .who { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
}

.others { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.other-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; max-width: 520px; }
.other-row input { width: 100%; }
.formgrid > * { min-width: 0; }
.field input[type=date] { min-width: 0; }
@media (max-width: 700px) { .formgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .formgrid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* bank check */
.tbl tr.dupwarn td { background: var(--warn-bg); }
.small { font-size: 12px; }

/* admin: who can see this page */
.infobtn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-size: 16px; cursor: pointer; }
.infopanel { position: fixed; top: 56px; right: 16px; z-index: 60; width: min(560px, calc(100vw - 32px)); max-height: 75vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.infopanel th { width: 34%; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); position: static; }

.drivercard .warnline { color: var(--warn); font-size: 13px; margin-top: 4px; }
.drivercard .error { font-size: 13px; margin-top: 4px; }

.mobwrap { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mobwrap input { flex: 1; min-width: 140px; }
.mobfixed { display: flex; gap: 8px; align-items: center; min-height: 38px; }
.mobfixed[hidden], .mobwrap [hidden] { display: none !important; }
.warnline { color: var(--warn); }
.bankrow td { background: var(--accent-soft); }

.grid thead th { position: sticky; }
.grid th .rz { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 5; }
.grid th .rz:hover { background: var(--accent-soft); }
.lim-scroll .grid td, .lim-scroll .grid th { height: var(--rh, 27px); }
.pump-balance { margin: 8px 0 4px; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 15px; }
.pump-split .panel { overflow-x: auto; }

/* new-limit form: denser rows on a laptop */
.formgrid.small.tight { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.dslline { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: end; }
.dslline > .formgrid { margin: 4px 0; grid-template-columns: repeat(2, 104px); }
.dslline > .formgrid.dslsplit { grid-template-columns: repeat(4, 104px); }
.dslline > .formgrid.dslrow { grid-template-columns: 104px minmax(150px, 220px) 104px 116px; }
.dslline .drivercard { align-self: end; }
@media (max-width: 700px) {
  .formgrid.small.tight { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dslline { display: block; }
  .dslline > .formgrid, .dslline > .formgrid.dslrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dslline > .formgrid.dslsplit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.setbox { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* phone: a wide table shown as one card per line (label | value) */
@media (max-width: 760px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack tr { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
  table.stack tr.dupwarn { border-left: 4px solid var(--warn); }
  table.stack td { display: flex; gap: 10px; border: 0 !important; padding: 3px 0 !important; text-align: left !important; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; min-width: 96px; flex: none; }
  table.stack td:empty { display: none; }
  table.stack td[data-label="Check"] { flex-wrap: wrap; }
  table.stack td input { flex: 1; min-width: 0; }
}

/* CMS sheet on a phone: cards, a top bar that wraps, account tabs that slide */
.cms-cards { padding: 8px; }
.lcard.cms-empty, .lcard.cms-problem { border-left: 4px solid var(--bad); }
.lcard.cms-otp { border-left: 4px solid var(--warn); }
@media (max-width: 760px) {
  .sheet-bar > select, .sheet-bar > input[type=search] { flex: 1 1 100%; width: 100% !important; }
  .sheet-bar .count { flex-basis: 100%; }
  .sheet-bar .spacer { display: none; }
  .tabs { overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

/* the app's own Yes / No box */
.askov { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.askbox { background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 440px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.askmsg { white-space: pre-wrap; font-size: 16px; line-height: 1.45; margin-bottom: 14px; max-height: 60vh; overflow: auto; }
.askinp { width: 100%; font-size: 16px; padding: 10px; margin-bottom: 14px; box-sizing: border-box; }
.askbtns { display: flex; gap: 10px; justify-content: flex-end; }
.askbtns .btn { min-width: 96px; min-height: 44px; font-size: 16px; }

/* limits sheet: row shade deepens with each change; top scrollbar; one-line "changes" note */
.grid tr.ed1 td:not(.draft):not(.rn) { background: #fff8e6; }
.grid tr.ed2 td:not(.draft):not(.rn) { background: #ffedc2; }
.grid tr.ed3 td:not(.draft):not(.rn) { background: #ffdc8f; }
.lcard.ed1 { background: #fff8e6; } .lcard.ed2 { background: #ffedc2; } .lcard.ed3 { background: #ffdc8f; }
.hbar { overflow-x: auto; overflow-y: hidden; height: 16px; margin: 4px 0 2px; }
.hbar > div { height: 1px; }
.lim-scroll::-webkit-scrollbar, .hbar::-webkit-scrollbar { height: 14px; width: 14px; }
.lim-scroll::-webkit-scrollbar-thumb, .hbar::-webkit-scrollbar-thumb { background: #a9b3bf; border-radius: 7px; border: 3px solid var(--surface); }
.lim-scroll::-webkit-scrollbar-track, .hbar::-webkit-scrollbar-track { background: var(--head); }
.chg-mini { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; font-size: 13px; }
@media (prefers-color-scheme: dark) {
  .grid tr.ed1 td:not(.draft):not(.rn), .lcard.ed1 { background: #3a3220; } .grid tr.ed2 td:not(.draft):not(.rn), .lcard.ed2 { background: #4a3c1c; } .grid tr.ed3 td:not(.draft):not(.rn), .lcard.ed3 { background: #5c4614; }
}

/* New limit form: this vehicle's last 5 limits (left) and last 5 CMS fills (right) */
.lasthist { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.lasthist:empty { display: none; }
.lh-col { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 8px 10px; min-width: 0; font-size: 12.5px; }
.lh-head { font-weight: 600; margin-bottom: 6px; }
.lh-item { padding: 4px 0; border-top: 1px dashed var(--line, #ddd); }
.lh-item:first-of-type { border-top: 0; }
.lh-l1 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.lh-l2 { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .lasthist { grid-template-columns: 1fr; } }
.histsw { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 8px; cursor: pointer; }

/* Confirm helper (driver has taken it): CMS lines to tick, Confirm / Partial */
.askbox.cfbox { max-width: 620px; max-height: 92vh; overflow: auto; }
.cf-title { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.cf-parts { margin: 10px 0; padding: 8px 10px; border-radius: 8px; background: rgba(217,119,6,.10); font-size: 14px; }
.cf-pend { font-weight: 700; margin-top: 4px; }
.cf-cms { margin: 12px 0; font-size: 14px; }
.cf-head { margin-bottom: 6px; }
.cf-sugg { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: rgba(22,163,74,.12); font-weight: 600; }
.cf-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }
.cf-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; border: 1px solid var(--line, #ddd); border-radius: 8px; cursor: pointer; }
.cf-row input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
.cf-row.sugg { border-color: #16a34a; background: rgba(22,163,74,.08); }
.cf-row.used { opacity: .7; }
.cf-rtxt { min-width: 0; }
.cf-l1 { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cf-amt { margin-bottom: 12px; }
.cf-amt input { font-size: 16px; }
.small { font-size: 12px; }
.chg-new td { font-weight: 600; }
.panel table tr.muted td { opacity: .6; }
.btn.partial { background: #d97706; color: #fff; border-color: #d97706; }
.btn.partial:hover { background: #b45309; }

/* Excel-style column filters + sum of selected cells */
.grid th .fbtn { float: right; margin-left: 4px; padding: 0 3px; font-size: 11px; color: var(--muted); cursor: pointer; border-radius: 3px; }
.grid th .fbtn:hover { background: var(--sel); color: var(--text); }
.grid th.fon { background: var(--warn-bg); }
.grid th.fon .fbtn { color: var(--warn); font-weight: 700; }
.fmenu { position: fixed; z-index: 120; width: 260px; background: var(--surface); color: var(--text); border: 1px solid var(--grid); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 8px; font-size: 13px; }
.fmenu input[type=search] { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.fm-all { display: block; padding: 3px 2px; border-bottom: 1px solid var(--grid); font-weight: 600; }
.fm-list { max-height: 260px; overflow: auto; margin: 4px 0; }
.fm-item { display: flex; gap: 6px; align-items: center; padding: 2px; white-space: nowrap; }
.fm-item span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
.fm-btns { display: flex; gap: 6px; justify-content: flex-end; border-top: 1px solid var(--grid); padding-top: 6px; }
.sumbar { min-height: 22px; padding: 3px 8px; font-size: 13px; text-align: right; color: var(--text); font-weight: 600; background: var(--head); border-top: 1px solid var(--grid); }
.sumbar:empty::before { content: "Select cells (drag or Shift+click) to see their sum"; color: var(--muted); font-weight: 400; }
.va-split.va-one { grid-template-columns: 1fr; }

.shchips { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; } .shchips input { flex: 1; min-width: 60px; } .shchips .chip { min-height: 34px; padding: 0 12px; } .shnote { font-size: 12px; margin-top: 2px; } .shnote.warn { color: var(--bad); font-weight: 600; }
/* wide sheets scroll inside the grid (the page itself must not grow wider than the window) */
#app.fixed > .page { min-width: 0; width: 100%; } .sheet, .sheet > .grid-scroll { min-width: 0; max-width: 100%; }
td.warn { color: var(--warn); font-weight: 600; }
