/* Phone first. This gets opened in a truck as often as at a desk, so touch
   targets are >=44px, the layout works at 375px, and the safe-area insets are
   honoured so nothing hides under the home indicator. */
/* The 2026-10 redesign: light paper, a dark green sidebar, one deep teal
   accent used sparingly, and orange only for what needs attention. Every text
   colour here clears 4.5:1 on --panel and on --bg. `--teal` keeps its name so
   the hundred rules that already use it follow the new accent. */
:root {
  --bg: #F3F5F4;
  --panel: #FFFFFF;
  --panel-2: #EEF1F0;
  --line: #DCE2DF;
  --ink: #15211E;
  --dim: #55625E;
  --teal: #0E6B5C;
  --teal-ink: #0A4F44;
  --teal-soft: #E3F0EC;
  --amber: #8A3F05;
  --amber-soft: #FBEBDD;
  --red: #B42318;
  --side: #10201C;
  --side-ink: #C9D6D2;
  --side-on: #1E3832;
  --radius: 14px;
  --tap: 48px;
  /* Bricolage Grotesque and IBM Plex Sans are the design's faces. The CSP
     only allows this origin, so they apply once the font files are served
     from public/fonts; until then the system fonts below stand in. */
  --font-display: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input { font: inherit; }

/* ---------- sign in ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; }
.login-bg {
  position: fixed; inset: 0; z-index: -1;
  background: var(--bg) center/cover no-repeat;
}
.login-bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,32,28,.55), rgba(16,32,28,.82));
}
.card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 18px 50px rgba(16,32,28,.28);
}
.brand { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sub { margin: 2px 0 22px; color: var(--teal); font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: 12px; }
label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--dim); }
input {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
}
input:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: transparent; }
button[type=submit] {
  width: 100%; min-height: var(--tap); margin-top: 20px;
  background: var(--teal); color: #FFFFFF; border: 0; border-radius: 10px;
  font-weight: 700; cursor: pointer;
}
button[type=submit]:disabled { opacity: .55; cursor: default; }
.err {
  margin: 14px 0 0; padding: 11px 13px; border-radius: 10px;
  background: #FDECEA; border: 1px solid rgba(180,35,24,.35);
  color: #8F1D14; font-size: 14px;
}
.foot { margin: 18px 0 0; color: var(--dim); font-size: 12px; text-align: center; }
.join-for { margin: 4px 0 14px; font-size: 14px; line-height: 1.45; }

/* ---------- app shell ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(243,245,244,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.who strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--teal-soft);
  color: var(--teal-ink); border: 1px solid #9CC9BC;
}
.badge.readonly { background: var(--amber-soft); color: var(--amber); border-color: #F2C49B; }
/* There was no rule for `a` at all, so every link in the app — the settlement
   statement, a driver's W-9, a filed tax document — rendered in the browser's
   default blue with a default underline, on a dark teal palette. It looked
   like unstyled HTML because it was. */
a { color: var(--teal); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--teal-ink); }
a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
/* A link that IS the row's title keeps the row's weight and only takes the
   accent colour — an underlined title in a list reads as a broken heading. */
a.txdesc { text-decoration: none; }
a.txdesc:hover { text-decoration: underline; }

.top > .link { flex: none; white-space: nowrap; }
/* A lone × is a one-character target. Give it a thumb's worth of room, and keep
   it a fixed square so it never squeezes the row's text. */
.link.del, .linkbtn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.linkbtn { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; padding: 0; }
.link {
  background: none; border: 0; color: var(--dim); cursor: pointer;
  min-height: var(--tap); padding: 0 4px; text-decoration: underline; text-underline-offset: 3px;
}
.view { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 780px; margin: 0 auto; }
h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.lede { margin: 0 0 20px; color: var(--dim); font-size: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 6px; font-size: 15px; }
.panel p { margin: 0; color: var(--dim); font-size: 14px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: 10px; cursor: pointer;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
}
.btn.primary { background: var(--teal); color: #FFFFFF; border-color: transparent; font-weight: 700; }
.btn.danger { color: var(--red); border-color: rgba(180,35,24,.4); }
.btn:disabled { opacity: .5; cursor: default; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.note { margin-top: 12px; font-size: 13px; color: var(--dim); }
/* `.panel p` is more specific than a bare class, so inside a panel — where
   nearly every status line lives — a failed import or a statement that does
   not add up rendered in the same grey as the help text around it. */
.ok, .panel p.ok { color: var(--teal); }
.bad, .panel p.bad { color: var(--red); }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  /* A phone shows five: Overview, Bank, Settlements, Payday and More (the
     rest are behind More — see renderTabs). Five fit 375px. Scrolling stays as
     the safety valve for a large accessibility text size: the last tab is
     always reachable, rather than pushed off the edge and cut in half. */
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
/* Only when there is genuinely more past the edge — see renderTabs. A fade on
   a bar that fits would just dim the last tab for no reason. */
@media (max-width: 759px) {
  .tabs.scrollable {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }
}
.tab {
  /* Grow to share the space when they fit, never shrink below the label. */
  flex: 1 0 auto; min-width: 44px; padding: 0 6px;
  min-height: var(--tap); border: 0; background: none; cursor: pointer;
  color: var(--dim); font-size: 11px; display: grid; gap: 2px; place-items: center;
  border-radius: 10px;
}
/* The tabs behind More, and More itself: a phone shows More, a wide screen
   shows every tab in its rail and has no need for More. */
@media (max-width: 759px) { .tab.tab-extra { display: none; } }
@media (min-width: 760px) { .tab.tab-more { display: none; } }
.tab.here { color: var(--teal-ink); background: var(--teal-soft); font-weight: 600; }
.tab[aria-selected="true"] { color: var(--teal-ink); background: var(--teal-soft); font-weight: 600; }
.tab .ico { font-size: 17px; line-height: 1; }
/* Tab labels are ONE WORD. Five tabs on a 375px phone leaves about 70px each,
   and a two-word label wraps to a second line while its neighbours do not,
   which makes the whole bar look broken rather than just that tab. Wrapping
   also passes an overflow check, so it is not caught by measuring scrollWidth —
   it has to be looked at. */
.tab > span:last-child { white-space: nowrap; }

@media (min-width: 760px) {
  .tabs {
    position: sticky; top: 0; bottom: auto; flex-direction: column; justify-content: flex-start;
    /* The bar is a vertical rail here. renderTabs still measures horizontal
       overflow and may still set .scrollable — harmless, because the fade is
       scoped to the phone layout above and this axis no longer scrolls. */
    overflow-x: visible; overflow-y: auto;
    width: 232px; height: 100dvh; border-top: 0; border-right: 0; padding-top: 14px;
  }
  body:has(#app:not([hidden])) { display: flex; }
  #app { display: flex; flex-direction: row-reverse; width: 100%; }
  #app > .top { position: fixed; left: 232px; right: 0; }
  .view { padding-top: 82px; }
  .tab { flex: none; width: 100%; grid-auto-flow: column; justify-content: start; gap: 10px; padding: 0 14px; font-size: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .panel, .card { transition: border-color .15s ease; }
}

/* ---------------- bank ---------------- */
/* Only the palette defined at the top of this file. An earlier version of this
   block invented --ok, --bad and --field with light-theme fallbacks, which put
   a white dropdown on a dark background and money in a green nobody could
   read. A var() fallback fires silently, so the bug looks like a design
   choice. */

.bal { font-size: 34px; font-weight: 700; margin: 10px 0 2px; letter-spacing: -.02em; }
.bal.in { color: var(--teal); }
.bal.out { color: var(--red); }

/* Match the input rule exactly — these are the same control to a reader. */
select, textarea {
  width: 100%; padding: 12px 14px; font: inherit;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
}
select { min-height: var(--tap); }
/* 16px, not smaller: iOS Safari zooms the whole page into any field whose text
   is under 16px, and does not zoom back out when you leave it. */
textarea { margin-top: 6px; font-size: 16px; line-height: 1.45; resize: vertical; }
select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: transparent; }

details.panel > summary, details > summary {
  cursor: pointer; font-weight: 600; list-style: none;
  min-height: var(--tap); display: flex; align-items: center; gap: 10px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+'; color: var(--teal); font-weight: 700; }
details[open] > summary::before { content: '\2212'; }
summary.sub-summary { font-size: 13px; color: var(--dim); font-weight: 500; }

/* A ledger row. Description left, amount hard right, so the column of amounts
   stays scannable however long the descriptions get. */
.tx { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.txmain { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.txdesc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txmeta { font-size: 12px; color: var(--dim); }
.txamt { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.txamt.in { color: var(--teal); }
/* The whole row is one button: full width, no chrome, left-aligned, inheriting
   type. Icon buttons beside the text squeezed the description down to four
   characters on a phone, and the description is what a ledger is scanned for. */
.txopen {
  display: block; width: 100%; padding: 0; margin: 0; text-align: left;
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
}
.txopen:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; border-radius: 8px; }
.txchev { flex: 0 0 auto; color: var(--dim); font-size: 18px; transition: transform .15s ease; }
.tx.open .txchev { transform: rotate(90deg); color: var(--teal); }

/* Import preview. Colour is never the only signal — every row carries the word
   ADD / HAVE / SKIP, because "the green ones" is not readable to everyone. */
/* overflow-x hidden on purpose: a row must never be able to push this panel
   sideways and scroll the content out of view. Anything too long truncates. */
.preview { margin-top: 10px; max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.prow { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; font-size: 13px; border-top: 1px solid var(--line); }
.pstat { flex: 0 0 42px; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--dim); }
.prow.new .pstat { color: var(--teal); }
.prow.duplicate { opacity: .55; }
.prow.skipped .pstat { color: var(--amber); }
/* Probably already here: asked about, not decided. */
.prow.likely { align-items: center; }
.prow.likely .pstat { color: var(--amber); }
.prow.replaces { align-items: center; }
.prow.replaces .pstat { color: var(--teal); }
.prow.likely:not(.chosen) .pamt { opacity: .6; }
.pdesc.wrap { white-space: normal; display: flex; flex-direction: column; gap: 2px; }
.btn.small { min-height: var(--tap); padding: 0 12px; font-size: 12px; flex: 0 0 auto; }
.pdesc { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pamt { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--dim); }

/* The file button is the one control browsers still paint themselves, and its
   default is a white chip that looks broken on a dark panel. */
input[type=file] { padding: 10px 12px; min-height: var(--tap); line-height: 1.6; color: var(--dim); }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
}
input[type=file]::file-selector-button:hover { border-color: var(--teal); color: var(--teal); }

.txwrap { border-top: 1px solid var(--line); }
.txwrap .tx { border-top: 0; }
.txedit { padding: 4px 0 16px; border-left: 2px solid var(--teal); padding-left: 14px; margin-bottom: 12px; }
.txedit label:first-child { margin-top: 4px; }

/* A row the balance cannot see. Dimmed AND labelled — dimming alone reads as a
   style choice, and this one has to read as a fact. */
.tx.outside { opacity: .5; }
.tx.outside .txamt { text-decoration: line-through; }

/* ---------------- settlements ---------------- */
.stl { padding-bottom: 14px; }
.stlhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stlhead .stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pill {
  flex: 0 0 auto; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim);
}
.pill.on { color: var(--teal); border-color: var(--teal); }

/* Gross, withheld, net — the three numbers the whole feature is about, on one
   line so the gap between gross and net is impossible to miss. */
.stlsum { display: flex; gap: 14px; margin: 14px 0 4px; flex-wrap: wrap; }
.stlsum > div { display: flex; flex-direction: column; gap: 2px; }
.stlsum .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
.stlsum .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stlsum .v.in { color: var(--teal); }
.stlsum .v.out { color: var(--red); }

.row.wrapped { flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12px; padding: 7px 11px; border-radius: 999px; cursor: pointer;
  background: var(--bg); color: var(--dim); border: 1px solid var(--line);
}
.chip:hover, .chip:focus { color: var(--teal); border-color: var(--teal); }
.deds { margin-top: 8px; }
.dedline { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.dedline input:first-child { flex: 1 1 auto; }
.dedline input:nth-child(2) { flex: 0 0 7.5rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Where to send it. Bigger than a note on purpose — this line is read off the
   screen while typing into a banking app, so it has to survive a glance. */
.payto { margin: 12px 0 4px; font-size: 15px; }
.payto .k { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.payto strong { user-select: all; }

/* Shared office and driver workspace. */
body { background: var(--bg); }
h1, h2, h3, .overview-title, .metric > strong, .overview-number { font-family: var(--font-display); }
button:focus-visible, summary:focus-visible, #page:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
#page:focus:not(:focus-visible) { outline: none; }
.btn:hover:not(:disabled) { border-color: var(--teal); }
.view { width: 100%; min-width: 0; }
.view h2 { color: var(--dim); font-size: 13px; font-weight: 500; margin-bottom: 22px; }
.overview-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 26px; }
.overview-heading > div { flex: 1; min-width: 220px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.overview-title { margin: 0 0 10px; font-size: clamp(26px, 3.5vw, 38px); line-height: 1.15; letter-spacing: -.04em; font-weight: 650; overflow-wrap: anywhere; }
.overview-heading .lede { margin: 0; max-width: 580px; }
.overview-grid { display: grid; gap: 18px; }
.overview-panel { margin: 0; padding: 24px; }
.overview-panel > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 20px; color: var(--dim); }
.overview-body > .btn { margin-top: 22px; }
.overview-number { display: block; font-size: 44px; line-height: 1.2; letter-spacing: -.04em; }
.panel .note { margin-top: 12px; }
.account-summary, .deadline-summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.account-summary:first-child, .deadline-summary:first-child { padding-top: 0; }
.account-summary strong, .deadline-summary strong { font-size: 14px; overflow-wrap: anywhere; }
.account-amount { text-align: right; display: grid; gap: 4px; flex: 0 1 50%; font-variant-numeric: tabular-nums; }
.deadline-label { font-size: 12px; white-space: nowrap; color: var(--dim); }
.deadline-label.near { color: var(--amber); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; margin-bottom: 24px; }
.metric { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.metric.accent { background: var(--teal); border-color: transparent; color: #FFFFFF; }
.metric.accent .metric-label, .metric.accent .txmeta { color: rgba(255,255,255,.9); }
.metric-label { font-size: 13px; color: var(--dim); }
.metric > strong { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric.accent > strong { color: #FFFFFF; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 22px; padding: 0 0 10px; font-size: 13px; }
.month-head + .portal-statement, .month-head + .portal-statement:first-of-type { margin-top: 0; }
.pill.new { margin-left: 8px; vertical-align: middle; }
.portal-statement { border-top: 1px solid var(--line); padding: 12px 0; }
.portal-statement:first-of-type { margin-top: 20px; }
.portal-statement > summary { gap: 12px; }
.portal-statement summary strong { font-size: 14px; }
.portal-statement .txmain strong { white-space: normal; }
.detail-line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 14px; }
.detail-line.total { border-top: 1px solid var(--line); margin-top: 8px; }
.document-download { display: block; padding: 16px 0; min-height: var(--tap); border-bottom: 1px solid var(--line); }
.year-picker { display: flex; align-items: end; gap: 12px; margin: 0 0 24px; }
.year-picker label { margin: 0; max-width: 160px; }
.year-picker label > span { display: block; margin-bottom: 6px; }
.year-picker select { min-height: var(--tap); }
.year-picker button[type=submit] { width: auto; margin: 0; padding: 0 20px; }
progress { display: block; width: 100%; height: 10px; margin: 12px 0 18px; accent-color: var(--teal); border: 0; border-radius: 8px; overflow: hidden; }
progress::-webkit-progress-bar { background: var(--panel-2); }
progress::-webkit-progress-value { background: var(--teal); }
@media (min-width: 760px) {
  #app { display: block; }
  .tabs { position: fixed; left: 0; top: 0; width: 232px; padding: 24px 14px; background: var(--side); border-top: 0; }
  .tabs .tab { color: var(--side-ink); font-size: 15px; }
  .tabs .tab:hover { color: #FFFFFF; }
  .tabs::before { content: 'GRADE & GO / OFFICE'; padding: 8px 12px 36px; font-weight: 750; font-size: 12px; letter-spacing: .09em; color: #CFE8E0; font-family: var(--font-display); }
  .tab { min-height: 50px; margin-bottom: 6px; }
  .tab[aria-selected="true"] { background: var(--side-on); color: #FFFFFF; box-shadow: inset 3px 0 #3FB29D; }
  .view { width: calc(100% - 232px); max-width: 1350px; margin: 0 0 0 232px; padding: 100px 40px 56px; }
  .top { padding-right: 36px; padding-left: 36px; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .overview-heading { margin-bottom: 22px; }
  .overview-panel, .metric { padding: 20px; }
  .who { gap: 6px; }
  .who strong { font-size: 14px; }
  .badge { font-size: 9px; padding: 3px 6px; }
  .account-summary { align-items: start; }
  .portal-statement summary { flex-wrap: wrap; }
}

/* ---------- driver language switch ---------- */
/* Beside Sign out, so it is on every portal screen without taking a row of its
   own on a phone. The current language reads as plain text, the other as a link. */
.lang-switch { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.lang-switch .link[aria-pressed="true"] { color: var(--ink); text-decoration: none; font-weight: 700; cursor: default; }
/* At 375px the switch took the room the company name needed, and "Grade & Go
   LLC" was cut to "Grade & G…". Tighter here only; the tap height stays. */
@media (max-width: 759px) {
  .top { gap: 8px; }
  .lang-switch .link { padding: 0 3px; font-size: 13px; }
}

/* ---------------- the yard ---------------- */
.park-month { justify-content: space-between; margin: 0 0 18px; }
.park-month strong { font-size: 16px; }
.park-truck { padding: 12px 0; border-bottom: 1px solid var(--line); }
.park-truck > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.park-truck > summary::-webkit-details-marker { display: none; }
/* Status in words as well as colour — a red/green pair alone is unreadable to
   the commonest colour blindness. */
.pill.park { text-transform: none; letter-spacing: 0; font-size: 12px; white-space: nowrap; }
.pill.park.paid { color: var(--teal); border-color: var(--teal); }
.pill.park.late, .pill.park.short, .pill.park.due { color: var(--amber); border-color: #F2C49B; background: var(--amber-soft); }
.pill.park.missing { color: var(--red); border-color: rgba(180,35,24,.45); }
.txmeta.bad { color: var(--red); }
.txmeta.ok { color: var(--teal); }
.park-flag { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pin-row select { flex: 1 1 200px; }
.pin-row input { flex: 0 1 120px; }
.park-form { margin-top: 10px; }
@media (max-width: 759px) {
  .park-truck > summary { flex-wrap: wrap; }
  .pill.park { white-space: normal; }
}

/* ---------------- reports ---------------- */
.report-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.report-filters > div { min-width: 0; }
.report-filters label { margin-top: 0; }
.report-filters input { min-width: 0; }
.report-filters button[type=submit] { margin-top: 0; }
.report-panel { min-width: 0; }
.report-panel h4 { margin: 20px 0 8px; font-size: 14px; }
.report-line { display: flex; align-items: baseline; gap: 12px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.report-line span { min-width: 0; overflow-wrap: anywhere; }
.report-line strong { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-group + .report-group { margin-top: 18px; border-top: 1px solid var(--line); }
.report-group h4 { overflow-wrap: anywhere; }
.report-download { display: inline-flex; align-items: center; margin-top: 12px; text-decoration: none; }
.report-periods { margin-top: 14px; }
.report-periods th, .report-periods td { white-space: nowrap; }
.report-periods th[scope=row] { text-transform: none; letter-spacing: 0; }
.report-panel .stlsum { gap: 12px 20px; }
.report-panel .stlsum .v { font-size: 16px; }
@media (min-width: 640px) {
  .report-filters { grid-template-columns: 1fr 1fr 1fr auto; }
}

/* Ported with chart.js. Keep these validated series colours: teal and orange
   separate under deuteranopia. Position and the legend also carry identity. */
:root {
  --viz-in: #17a394;
  --viz-out: #d95926;
}

.viz { position: relative; }
.viz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.viz-plot { position: relative; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }

/* Recessive chrome: hairline, solid, one step off the surface. Never dashed. */
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-axis { stroke: var(--line); stroke-width: 1; }
.viz-tick {
  fill: var(--dim); font-size: 12px;
  font-variant-numeric: tabular-nums;   /* ticks align in a column */
}
/* Values wear text tokens, never the series colour — a mid-chroma hue is
   illegible at label size. The coloured mark beside them carries identity. */
.viz-val { fill: var(--dim); font-size: 12px; font-weight: 600; }

.viz-bar.in { fill: var(--viz-in); }
.viz-bar.out { fill: var(--viz-out); }
.viz-hit { fill: transparent; cursor: default; }
.viz-hit:focus-visible { fill: rgba(16, 32, 28, .06); outline: none; }
.viz-plot:hover .viz-bar { opacity: .55; transition: opacity .12s; }
.viz-plot .viz-hit:hover ~ .viz-bar { opacity: 1; }

.viz-legend { display: flex; gap: 14px; color: var(--dim); font-size: 12.5px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.viz-dot.in { background: var(--viz-in); }
.viz-dot.out { background: var(--viz-out); }
.viz-toggle { margin-left: auto; }

.viz-tip {
  position: absolute; top: 4px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; min-width: 148px; pointer-events: none;
  box-shadow: 0 8px 24px rgba(16,32,28,.14); font-size: 12.5px; z-index: 5;
}
.viz-tip-head { color: var(--ink); font-weight: 650; margin-bottom: 4px; }
.viz-tip-row { display: flex; justify-content: space-between; gap: 14px; color: var(--dim); }
.viz-tip-row span { display: inline-flex; align-items: center; gap: 6px; }
.viz-tip-row b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.viz-table { overflow-x: auto; }

.viz-hbar { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.viz-hbar.pick { cursor: pointer; border-radius: 8px; }
.viz-hbar.pick:hover, .viz-hbar.pick:focus-visible { background: var(--panel-2); outline: none; }
.viz-hbar-name { flex: 0 0 34%; color: var(--dim); font-size: 13px; }
.viz-hbar-track { flex: 1; height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.viz-hbar-fill { height: 100%; background: var(--viz-in); border-radius: 5px; }
.viz-hbar-val {
  flex: 0 0 auto; min-width: 96px; text-align: right;
  color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .viz-hbar-name { flex-basis: 40%; }
  .viz-hbar-val { min-width: 78px; }
}

/* ---------- company switch ---------- */
/* The company name IS the switch when there is more than one, so it reads as
   the name first: same weight, no box until it is touched. */
.co-switch {
  font: inherit; font-weight: 700; font-size: 16px; color: var(--ink);
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  min-height: 40px; padding: 0 26px 0 8px; margin-left: -8px; max-width: 62vw; cursor: pointer;
  /* Drawn by us, not the platform: the native control measured itself from the
     options at normal weight and cut the last letters off the bold name. With
     appearance off, field-sizing sizes it to the name actually shown. */
  appearance: none; -webkit-appearance: none; field-sizing: content;
  text-overflow: ellipsis;
}
.co-chev { margin-left: -22px; pointer-events: none; color: var(--dim); font-size: 12px; }
#coName { overflow: visible; }
.co-switch:hover, .co-switch:focus-visible { border-color: var(--line); background: var(--panel); outline: none; }

/* ---------- Mercury payouts ---------- */
.mc-bar { margin: 14px 0 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.mc-bar .note:first-child { margin-top: 0; }
.mc-driver { padding: 12px 0; border-top: 1px solid var(--line); }
.mc-driver .row { margin-top: 8px; flex-wrap: wrap; }
.mc-driver select { flex: 1 1 220px; min-width: 0; }

/* ---------- roster: coming and going ---------- */
.roster-view { flex-wrap: wrap; margin: 0 0 14px; }
.leave-box { margin: 16px 0 6px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.leave-box .note:first-child { margin-top: 0; }

.stl-warn { margin: 8px 0; padding-left: 18px; font-size: 13px; color: var(--amber); }
.stl-warn li { margin: 4px 0; }

/* ---------- the truck's week ---------- */
.tw-controls { flex-wrap: wrap; align-items: center; }
.tw-controls select { flex: 1 1 200px; min-width: 0; }
.tw-verdict { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 28px;
  margin: 0 0 18px; padding: 22px 24px; border-radius: 18px; background: var(--teal); color: #FFFFFF; }
.tw-verdict.bad { background: var(--amber-soft, #FBEBDD); color: var(--amber); }
.tw-verdict > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.tw-verdict > div:first-child strong { font-family: var(--font-display, inherit); font-size: clamp(30px, 5vw, 44px); line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tw-verdict .metric-label, .tw-verdict .txmeta { color: inherit; opacity: .92; }
.tw-verdict-facts { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 14px; }
.tw-verdict-facts > div { display: flex; flex-direction: column; }
.tw-verdict-facts strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.tw-h { margin: 8px 0 10px; }
.tw-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; margin-bottom: 18px; }
.tw-day { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.tw-day.today { border: 2px solid #D88A45; }
.tw-day.future { background: transparent; border-style: dashed; }
.tw-dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tw-dayhead strong { font-family: var(--font-display, inherit); font-size: 20px; }
.tw-gross { font-size: 19px; font-variant-numeric: tabular-nums; }
.tw-lines { display: grid; gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; }
.tw-lines > div { display: flex; justify-content: space-between; gap: 6px; }
.tw-lines > div > span:first-child { color: var(--dim); }
.tw-lines .bad { color: var(--amber); font-weight: 600; }
.tw-fill { font-size: 12px; padding: 4px 8px; border-radius: 8px; background: var(--teal-soft, rgba(62,166,160,.12)); color: var(--teal-ink, var(--teal)); }
.tw-plan { min-height: 40px; }
tr.total th, tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.losing td { color: var(--amber); }
.tw-day > .pill { align-self: flex-start; }
.metrics.tw-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.tw-stats .metric { padding: 16px; }

/* ---------- repairs ---------- */
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
/* The same 16px floor as every other field (see textarea): a part number typed
   into a 13px box zoomed the phone in. Text that is only read stays at 13px. */
input.mono, textarea.mono { font-size: 16px; }
.inv-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 12px; }
.inv-rows { display: grid; gap: 8px; }
.inv-row { display: grid; grid-template-columns: minmax(118px, 1.2fr) minmax(140px, 2.4fr) minmax(110px, 1.2fr) 64px 96px 44px; gap: 6px; align-items: center; }
.inv-row input, .inv-row select { min-width: 0; margin: 0; }
.inv-row .unsure { border-color: var(--amber); background: var(--amber-soft, rgba(232,163,61,.12)); }
.inv-unsure { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) { .inv-row { grid-template-columns: 1fr 1fr; } .inv-row > :nth-child(2) { grid-column: 1 / -1; } }
.tw-repair { background: var(--amber-soft, rgba(232,163,61,.12)); color: var(--amber); }

/* ---------- Today: needs you, then the money ---------- */
.today-layout { display: grid; gap: 18px; align-items: start; }
@media (min-width: 1100px) { .today-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } .today-side { grid-template-columns: 1fr !important; } }
.today-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.today-h h3 { margin: 0; }
.today-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.today-item .txmain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.today-item .txmain strong { font-size: 16px; white-space: normal; }
.today-item .txmeta { white-space: normal; overflow-wrap: anywhere; }
.today-item .btn { flex: none; }
.today-kind { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; padding: 2px 8px; background: var(--teal-soft); color: var(--teal-ink); }
.today-kind.k-payday, .today-kind.k-deadline { background: var(--amber-soft); color: var(--amber); }
.today-kind.k-settlement { background: #E6EEF9; color: #1F4E8C; }
.today-kind.k-parking { background: #EFE8F7; color: #5B3A8E; }
.today-kind.k-check { background: #FDECEA; color: var(--red); }
@media (max-width: 640px) { .today-item { flex-wrap: wrap; } }

/* Receipts: the bank charge that paid each one. */
.rcpt .txmain { min-width: 0; }
.rcpt-bank { margin-top: 6px; font-size: 13px; color: var(--dim); display: grid; gap: 4px; }
.rcpt-bank.ok { color: var(--teal); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.rcpt-bank.maybe .row { gap: 10px; align-items: center; flex-wrap: wrap; }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
/* Samsara trucks: the company picker sits beside the truck, never squeezes its name. */
.tx > select.pick { flex: 0 0 auto; width: auto; max-width: 48%; }
/* Zelle by person: what came in and went out, side by side at the row's end. */
.zelle-sums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 600; white-space: nowrap; }

/* Vehicles: one line per vehicle, opened to put in miles or mark service done. */
details.veh { border-top: 1px solid var(--line); padding: 10px 0; }
details.veh > summary { font-size: 15px; color: var(--ink); cursor: pointer; }
details.veh .pill { margin-left: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--amber); border-color: #F2C49B; background: var(--amber-soft); }
details.veh .pill.bad { color: var(--red); border-color: rgba(180,35,24,.45); background: transparent; }
details.veh .row input { flex: 1 1 120px; min-width: 0; }
details.veh h4.veh-h { margin: 14px 0 4px; font-size: 13px; color: var(--dim); font-weight: 600; }
details.veh select { flex: 1 1 120px; }
details.veh .tx.fault .txdesc { color: var(--amber); }
details.veh .tx.fault.now .txdesc { color: var(--red); }

/* Settlements: dumpsettlement's weeks, a week as cards per truck */
.pill.warn { color: var(--amber); border-color: #F2C49B; background: var(--amber-soft); }
button.wkline { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; background: none; border: 0;
  border-top: 1px solid var(--line); padding: 12px 0; font: inherit; color: var(--ink); cursor: pointer; }
.wkwhen { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wkgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; margin: 12px 0; }
.wkgrid > div { display: flex; flex-direction: column; gap: 2px; }
.wkcheck { border-left: 3px solid var(--amber); padding: 4px 0 4px 10px; margin: 10px 0; }
.wkcheck.bad { border-left-color: var(--red); }
.wkcheck p { margin: 0 0 6px; }
details.wktruck > summary { cursor: pointer; display: block; }
details.wktruck > summary > div { margin-top: 2px; }
.wkline2 { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.wkline2.wksub { color: var(--dim); font-size: 13px; padding-left: 10px; }
.wkline2.tot { font-weight: 700; border-top: 1px solid var(--line); }
.wkline2.fsc { color: var(--amber); }
details.wkadd { margin-top: 8px; }
details.wkadd > summary { cursor: pointer; color: var(--teal); font-size: 14px; }
details.wkadd .row input { flex: 1 1 120px; min-width: 0; }
.linkbtn { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0 4px; }
.wkreview { border: 1px solid var(--teal); }
h3.section { margin: 24px 0 4px; font-size: 15px; }

/* Feed rows held for an answer. */
.feed-held { margin: 14px 0; padding: 14px; border: 1px solid rgba(232,163,61,.45); border-radius: var(--radius); }
.feed-held-row { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }

/* Book rows a statement did not account for, under the reconciliation line. */
.books-rows { margin: 0 0 12px; }
.books-rows > summary { cursor: pointer; font-size: 13px; color: var(--ink); padding: 6px 0; }
.books-rows .pstat { flex-basis: 56px; text-transform: none; letter-spacing: 0; }

/* Numbered steps inside a panel. */
.steps { margin: 8px 0 4px; padding-left: 20px; color: var(--dim); font-size: 14px; }
.steps li { margin: 4px 0; }

/* The rent reminder: links styled as buttons, opening Messages. */
.park-remind { margin: 10px 0; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
a.btn.primary { color: #fff; }

/* ---------------- money in / money out ---------------- */
/* The amount and the two buttons that give it its sign (moneyDir), on one
   line: the number pad has no minus key, so the buttons are how money out is
   said. The field takes what is left; the buttons never shrink or wrap. */
.money-row { display: flex; gap: 6px; align-items: center; }
.money-row input { flex: 1 1 auto; min-width: 0; }
.money-dir { display: flex; gap: 4px; flex: 0 0 auto; }
.money-dir .btn { padding: 0 10px; }
details.wkadd .row .money-row { flex: 1 1 100%; }

/* ---------------- More ---------------- */
/* The tabs that do not fit a phone's bottom bar, as a list of big rows. */
.more-list { padding: 4px 18px; }
.more-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px;
  padding: 0; background: none; border: 0; border-top: 1px solid var(--line);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.more-row:first-child { border-top: 0; }
.more-row .ico { width: 24px; text-align: center; color: var(--teal); font-size: 18px; }
.more-label { flex: 1 1 auto; font-weight: 600; }

/* The ledger's search box sits above its rows. */
#txFind { margin: 8px 0 0; }

/* A Today item about money going out wrongly (paid twice, a payout to cancel). */
.today-item.urgent { border-left: 3px solid var(--red); padding-left: 12px; }
.today-acts { margin-top: 0; flex: none; }
.txmeta.bad { color: var(--red); }
