/* Triton Ops — one stylesheet for the app and the sign-in pages.
   Type: Bricolage Grotesque (headings, numbers) + Atkinson Hyperlegible (body, built for legibility in sun glare).
   Colour: deep-water ink on a cool salt background; status colours always ship with an emoji + word. */

:root {
  --ink: #0B2E33; --ink-2: #35555A; --muted: #637C80; --faint: #93A7AA;
  --bg: #F2F6F5; --surface: #FFFFFF; --surface-2: #F7FAF9; --line: #D7E2E0; --line-2: #E6EEEC;
  --brand: #0E8C9B; --brand-ink: #076572; --brand-wash: #E3F3F4;
  --card: #1E8A4C; --card-wash: #E4F4EA;
  --cash: #A86A12; --cash-wash: #FBF0DC;
  --alert: #C8432C; --alert-wash: #FBE7E2;
  --agent: #6A55C2; --agent-wash: #EEEAFB;
  --pickup: #2F6FDB; --pickup-wash: #E5EEFC;
  --drop: #D06322; --drop-wash: #FCEBDF;
  --photo: #8A4FBF;
  --radius: 14px; --radius-s: 9px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 0 rgba(11, 46, 51, .04), 0 8px 24px -12px rgba(11, 46, 51, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E3EFED; --ink-2: #B3C7C5; --muted: #8AA3A3; --faint: #5F7979;
    --bg: #071A1D; --surface: #0D2427; --surface-2: #102B2E; --line: #1F3E41; --line-2: #183336;
    --brand-ink: #6FD3DE; --brand-wash: #0E3439;
    --card: #4CC27D; --card-wash: #10331F; --cash: #E3A744; --cash-wash: #3A2B10;
    --alert: #F07A63; --alert-wash: #3D1A14; --agent: #A898F0; --agent-wash: #231D44;
    --pickup: #73A2F5; --pickup-wash: #13274A; --drop: #F09A60; --drop-wash: #3A2111; --photo: #C79AF0;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E3EFED; --ink-2: #B3C7C5; --muted: #8AA3A3; --faint: #5F7979;
  --bg: #071A1D; --surface: #0D2427; --surface-2: #102B2E; --line: #1F3E41; --line-2: #183336;
  --brand-ink: #6FD3DE; --brand-wash: #0E3439;
  --card: #4CC27D; --card-wash: #10331F; --cash: #E3A744; --cash-wash: #3A2B10;
  --alert: #F07A63; --alert-wash: #3D1A14; --agent: #A898F0; --agent-wash: #231D44;
  --pickup: #73A2F5; --pickup-wash: #13274A; --drop: #F09A60; --drop-wash: #3A2111; --photo: #C79AF0;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
a { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* --- forms & buttons --------------------------------------------------------------- */
label { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); font-weight: 400; font-size: 1rem;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-wash); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; color: var(--ink); }
label.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { min-height: 54px; font-size: 1.05rem; width: 100%; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--alert); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.pay-card { background: var(--card-wash); border-color: transparent; color: var(--card); }
.btn.pay-cash { background: var(--cash-wash); border-color: transparent; color: var(--cash); }
.btn.on { outline: 2px solid currentColor; }
.note { padding: 10px 14px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); }
.note.ok { background: var(--card-wash); border-color: transparent; color: var(--card); }
.note.bad { background: var(--alert-wash); border-color: transparent; color: var(--alert); }
.note.warn { background: var(--cash-wash); border-color: transparent; color: var(--cash); }

/* --- sign-in pages ----------------------------------------------------------------- */
.auth-body { min-height: 100vh; background:
  radial-gradient(120% 70% at 50% -10%, var(--brand-wash), transparent 60%), var(--bg); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 48px 16px 32px; }
.auth-wide { max-width: 720px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 800; font-size: 1.3rem; margin-bottom: 20px; }
.auth-brand img { border-radius: 10px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card h2 { margin-top: 10px; }
.auth-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 18px; }
.code-input { font-family: var(--display); font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; }
.enroll { display: grid; gap: 20px; grid-template-columns: 1fr auto; align-items: start; margin: 8px 0 18px; }
@media (max-width: 560px) { .enroll { grid-template-columns: 1fr; } }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.qr-box { display: grid; gap: 8px; justify-items: center; }
.qr-box canvas { background: #fff; border-radius: 12px; padding: 10px; border: 1px solid var(--line); width: 220px; height: 220px; }
.secret { font-size: 1rem; letter-spacing: .08em; word-break: break-all; display: block; margin-top: 6px; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { display: block; padding: 10px; text-align: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; font-size: 1.05rem; }
.checks { list-style: none; padding: 0; display: grid; gap: 4px; font-size: .92rem; }
.checks .ok { color: var(--card); } .checks .bad { color: var(--alert); font-weight: 700; }
.mono-block { white-space: pre-wrap; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); padding: 12px; border-radius: 10px; font-size: .85rem; }

/* --- app shell -------------------------------------------------------------------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; background: linear-gradient(90deg, var(--surface) 236px, var(--line) 236px, var(--line) 237px, transparent 237px); }
.rail { position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.rail .who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.rail .who img, .logo-dot { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; flex: none; }
.logo-dot { display: grid; place-items: center; background: var(--brand); color: #fff; font-family: var(--display); font-weight: 800; }
.rail .who strong { font-family: var(--display); font-size: 1.02rem; line-height: 1.15; display: block; }
.rail .who span { font-size: .8rem; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 700; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--brand-wash); color: var(--brand-ink); }
.nav .ico { width: 22px; text-align: center; font-size: 1.05rem; }
.nav .badge { margin-left: auto; }
.nav-sep { height: 1px; background: var(--line-2); margin: 10px 8px; }
.rail .foot { margin-top: auto; padding: 8px; font-size: .8rem; color: var(--muted); display: grid; gap: 8px; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--alert); color: #fff; font-size: .75rem; font-weight: 700; font-family: var(--body); }
.badge.quiet { background: var(--line); color: var(--ink-2); }
.main { min-width: 0; padding: 22px 28px 60px; max-width: 1240px; width: 100%; }
.topbar { display: none; }
.tabbar { display: none; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.sync-pill.offline { background: var(--cash-wash); color: var(--cash); border-color: transparent; }
.sync-pill.pending { background: var(--pickup-wash); color: var(--pickup); border-color: transparent; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--card); }
.sync-pill.offline .dot { background: var(--cash); } .sync-pill.pending .dot { background: var(--pickup); }

@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .rail { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
  .topbar .brandline { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; min-width: 0; }
  .topbar .brandline span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .logo-dot, .topbar img { width: 30px; height: 30px; border-radius: 8px; }
  .main { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 700; position: relative; cursor: pointer; }
  .tabbar .ico { font-size: 1.35rem; line-height: 1; }
  .tabbar a.active { color: var(--brand-ink); }
  .tabbar .badge { position: absolute; top: 0; right: 18%; min-width: 18px; height: 18px; font-size: .68rem; padding: 0 5px; }
}

/* --- page structure -------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools input[type=date], .tools input[type=time], .tools select { width: auto; min-height: 40px; padding: 6px 10px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel, .section + .section { margin-top: 16px; }
.panel h2 { font-size: 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section { margin-top: 22px; }
.section > h2 { font-size: 1.1rem; margin-bottom: 10px; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.15rem; margin-bottom: 4px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.card { background: var(--card-wash); color: var(--card); border-color: transparent; }
.chip.cash { background: var(--cash-wash); color: var(--cash); border-color: transparent; }
.chip.alert { background: var(--alert-wash); color: var(--alert); border-color: transparent; }
.chip.agent { background: var(--agent-wash); color: var(--agent); border-color: transparent; }
.chip.brand { background: var(--brand-wash); color: var(--brand-ink); border-color: transparent; }
.chip.online { background: var(--pickup-wash); color: var(--pickup); border-color: transparent; }

/* --- KPI figures (numbers lead, labels follow) ------------------------------------ */
.figures { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.fig { background: var(--surface); padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.fig .v { font-family: var(--display); font-weight: 800; font-size: 1.85rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.fig .l { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.fig .d { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.fig.hero { grid-column: span 2; background: var(--brand); border-color: var(--brand); color: #fff; }
.fig.hero .v { font-size: 2.6rem; }
.fig.hero .l, .fig.hero .d { color: rgba(255,255,255,.85); }
@media (max-width: 520px) { .fig.hero { grid-column: span 1; } .fig .v { font-size: 1.5rem; } .fig.hero .v { font-size: 2.1rem; } .figures { grid-template-columns: 1fr 1fr; } .fig.hero { grid-column: 1 / -1; } }

/* Attention row: things to do now */
.todo { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.todo a, .todo div.t { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.todo .big { grid-row: span 2; font-family: var(--display); font-weight: 800; font-size: 1.7rem; min-width: 2.2ch; text-align: center; }
.todo .what { font-weight: 700; }
.todo .why { color: var(--muted); font-size: .85rem; }
.todo .alert .big { color: var(--alert); } .todo .agent .big { color: var(--agent); } .todo .cash .big { color: var(--cash); } .todo .ok .big { color: var(--card); }

/* --- Today ------------------------------------------------------------------------- */
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav .btn { min-width: 44px; padding: 0 12px; }
.daynav .label { font-family: var(--display); font-weight: 800; font-size: 1.6rem; padding: 0 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.tide { position: relative; height: 66px; margin: 14px 0 6px; border-radius: var(--radius); background: linear-gradient(180deg, var(--brand-wash), transparent); border: 1px solid var(--line-2); overflow: hidden; }
.tide .hour { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); font-size: .7rem; color: var(--faint); padding: 2px 4px; }
.tide .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--alert); }
.tide .now::after { content: "now"; position: absolute; top: 2px; left: 4px; font-size: .68rem; font-weight: 700; color: var(--alert); }
.tide .dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--surface); background: var(--faint); cursor: pointer; padding: 0; }
.tide .dot.s-paid-card { background: var(--card); } .tide .dot.s-paid-cash { background: var(--cash); } .tide .dot.s-paid-other { background: var(--brand); }
.tide .dot.s-missing { background: var(--alert); } .tide .dot.s-agent_owed { background: var(--agent); } .tide .dot.s-no_show { background: var(--line); }
.tide .dot.s-upcoming { background: var(--surface); border-color: var(--brand); }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--ink-2); font-size: .95rem; margin: 6px 0 4px; }
.summary-strip b { font-family: var(--display); font-size: 1.15rem; color: var(--ink); margin-right: 3px; }
.slot-head { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 8px; }
.slot-head .t { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.slot-head .m { color: var(--muted); font-size: .9rem; }
.trips { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 520px) { .trips { grid-template-columns: 1fr; } }
.trip { position: relative; display: grid; gap: 8px; padding: 14px 14px 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.trip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line); }
.trip.s-upcoming::before { background: var(--brand); }
.trip.s-paid::before { background: var(--card); } .trip.s-paid.m-cash::before { background: var(--cash); }
.trip.s-missing::before { background: var(--alert); } .trip.s-agent_owed::before { background: var(--agent); }
.trip.s-no_show { opacity: .62; }
.trip .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.trip .name { font-family: var(--display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; overflow-wrap: anywhere; }
.trip .act { color: var(--ink-2); font-size: .95rem; }
.trip .meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.trip .meta a { color: inherit; }
.trip .amt { font-family: var(--display); font-weight: 800; font-size: 1.15rem; white-space: nowrap; text-align: right; }
.trip .amt small { display: block; font-family: var(--body); font-weight: 700; font-size: .75rem; color: var(--muted); }
.trip .actions { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; margin-top: 2px; }
.trip .actions .btn { min-height: 50px; border-radius: 12px; font-size: 1rem; }
.trip .actions .icon { width: 50px; padding: 0; font-size: 1.2rem; }
.trip .done { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; font-weight: 700; }
.trip .done.card { background: var(--card-wash); color: var(--card); } .trip .done.cash { background: var(--cash-wash); color: var(--cash); }
.trip .done.other { background: var(--brand-wash); color: var(--brand-ink); } .trip .done.ns { background: var(--surface-2); color: var(--muted); }
.trip .done.agent { background: var(--agent-wash); color: var(--agent); }
.trip .done > span:last-child { display: flex; gap: 4px; align-items: center; flex: none; }
.trip .queued { position: absolute; top: 8px; right: 10px; font-size: .72rem; font-weight: 700; color: var(--pickup); }

/* --- lists / tables ------------------------------------------------------------------ */
.list { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row .when { font-family: var(--display); font-weight: 700; text-align: center; min-width: 54px; line-height: 1.1; }
.row .when small { display: block; font-family: var(--body); font-weight: 400; font-size: .75rem; color: var(--muted); }
.row .main-t { font-weight: 700; overflow-wrap: anywhere; }
.row .sub-t { color: var(--muted); font-size: .86rem; }
.row .right { text-align: right; display: grid; gap: 4px; justify-items: end; }
.row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); }
.row.sel { background: var(--brand-wash); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
table.t th { font-size: .8rem; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: var(--surface-2); }
.batchbar { position: sticky; bottom: 76px; z-index: 15; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-top: 10px; border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.batchbar .btn { background: var(--surface); color: var(--ink); border-color: transparent; }
@media (min-width: 900px) { .batchbar { bottom: 12px; } }
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.searchbar input[type=search] { flex: 1 1 220px; }
.searchbar select, .searchbar input[type=date] { flex: 0 1 170px; }

/* --- bar lists & charts (single series, one hue; text in ink colours) --------------- */
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar .track { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--line-2); overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.bar.exp .fill { background: var(--drop); }
.bar .val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; text-align: right; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.chart .col { fill: var(--brand); }
.chart .col.exp { fill: var(--drop); }
.chart .col:hover, .chart .col.hl { filter: brightness(1.12); }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .82rem; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }
.pf { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.pf div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.pf b { display: block; font-family: var(--display); font-size: 1.35rem; }
.pf span { color: var(--muted); font-size: .85rem; }

/* --- tanks ----------------------------------------------------------------------------- */
.dir { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dir button { min-height: 64px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-family: var(--display); font-size: 1.2rem; font-weight: 800; cursor: pointer; color: var(--ink-2); }
.dir button.on.pickup { background: var(--pickup); border-color: var(--pickup); color: #fff; }
.dir button.on.dropoff { background: var(--drop); border-color: var(--drop); color: #fff; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tile { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.tile.has { border-color: var(--pickup); background: var(--pickup-wash); }
.mode-dropoff .tile.has { border-color: var(--drop); background: var(--drop-wash); }
.tile .tname { font-weight: 700; }
.tile .stockline { font-size: .8rem; color: var(--muted); }
.tile .ctr { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 6px; }
.tile .ctr button { height: 52px; border-radius: 14px; border: 0; font-size: 1.6rem; font-weight: 800; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.tile .ctr button.plus { background: var(--pickup); color: #fff; }
.mode-dropoff .tile .ctr button.plus { background: var(--drop); }
.tile .ctr output { text-align: center; font-family: var(--display); font-weight: 800; font-size: 2rem; }
.stock { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.stock div { background: var(--surface); padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.stock b { font-family: var(--display); font-size: 1.6rem; display: block; }
.stock b.neg { color: var(--alert); }
.stock span { font-size: .82rem; color: var(--muted); }
.savebar { position: sticky; bottom: 76px; margin-top: 14px; z-index: 10; }
@media (min-width: 900px) { .savebar { bottom: 12px; } }

/* --- modal sheet ------------------------------------------------------------------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(4, 18, 20, .45); display: grid; align-items: end; justify-items: center; animation: fade .15s ease; }
.sheet { width: min(640px, 100%); max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); animation: up .2s ease; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
.sheet .actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(24px); opacity: .6; } }
.toasts { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); display: flex; justify-content: space-between; gap: 10px; align-items: center; animation: up .2s ease; }
.toast.bad { background: var(--alert); color: #fff; }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; font-weight: 700; cursor: pointer; }

/* --- settings ------------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--brand); }
.emoji-rows { display: grid; gap: 8px; }
.emoji-row { display: grid; grid-template-columns: 72px 1fr 1fr auto; gap: 8px; align-items: center; }
.emoji-row input.e { font-size: 1.6rem; text-align: center; padding: 4px; }
@media (max-width: 560px) { .emoji-row { grid-template-columns: 60px 1fr auto; } .emoji-row select { grid-column: 2 / 3; } }
.steps-list { display: grid; gap: 12px; counter-reset: s; }
.step-card { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.step-card .n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; background: var(--surface-2); border: 1px solid var(--line); }
.step-card.done .n { background: var(--card); color: #fff; border-color: transparent; }
.step-card h3 { margin: 4px 0 4px; }
.mapping { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mapping label { font-size: .82rem; }
.src-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); align-items: center; }
.src-row:first-child { border-top: 0; }
.color-in { width: 54px; height: 46px; padding: 2px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }
.print-only { display: none; }
@media print {
  .rail, .topbar, .tabbar, .tools, .btn, .searchbar, .batchbar, .toasts { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { background: #fff; color: #000; }
  .print-only { display: block; } .panel, .table-wrap { border-color: #ccc; }
}

/* Agents & invoices */
.chip.ok { background: var(--card-wash); color: var(--card); border-color: transparent; }
.agent-block { margin-top: 18px; }
.agent-block h3 { font-size: .95rem; margin: 18px 0 8px; color: var(--muted); font-weight: 700; }
.agent-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.agent-head h2 { margin: 0; }
.inv-row { grid-template-columns: 1fr auto; align-items: center; }
.inv-row .inv-main { min-width: 0; }
.inv-row .num { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.inv-row .tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.inv-row.late { box-shadow: inset 4px 0 0 var(--alert); }
.stmt-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0; }
.stmt-totals div { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); display: grid; }
.stmt-totals b { font-family: var(--display); font-size: 1.15rem; }
.stmt-totals span { color: var(--muted); font-size: .8rem; }
.stmt-totals .hl { background: var(--agent-wash); } .stmt-totals .hl b { color: var(--agent); }
fieldset.agent-set { margin: 0 0 12px; display: grid; gap: 10px; }
@media (max-width: 600px) { .inv-row { grid-template-columns: 1fr; } .inv-row .right { justify-items: start; text-align: left; } .inv-row .tools { justify-content: flex-start; } }
table.t.rates select, table.t.rates input { min-height: 38px; padding: 6px 8px; }
table.t.rates td { vertical-align: middle; }
table.t.rates input { width: 110px; }
.todo.money a { grid-template-columns: 1fr; align-content: start; }
.todo.money .big { grid-row: auto; text-align: left; font-size: 1.6rem; }

/* Sheet sync status: grey when fresh, red when the numbers may be out of date */
.data-sync { display: block; width: 100%; margin-top: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 0; background: var(--surface-2); color: var(--muted); font: inherit; font-size: .74rem; font-weight: 700; text-align: left; cursor: pointer; }
.data-sync.stale { background: var(--alert-wash); color: var(--alert); border-color: var(--alert); }
.data-sync-bar { display: none; }
@media (max-width: 899px) { .data-sync-bar { display: block; padding: 6px 16px 0; } .data-sync-bar .data-sync { margin: 0; text-align: center; } }

/* Agent statement checks */
.t.stmt tr.flag td { background: var(--alert-wash); }
.t.stmt tr[data-bk] { cursor: pointer; }
.checks { margin: 6px 0 0 18px; padding: 0; } .checks li { cursor: pointer; margin: 2px 0; }
.paste-refs { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface-2); }
.paste-refs textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; margin: 6px 0; }
.paste-refs ul { margin: 4px 0 0 18px; padding: 0; }
