/* Moss Fleet Churn & CapEx. Brand: ink #373f53, green #58d100, blue #008bff (moss-finance-kpi
   shell.css). Status colors (good/warning/critical) are reserved for the churn bands and always
   carry an icon or a number, never color alone. Charts read the --series-* tokens. */

:root {
  color-scheme: light;
  --brand-ink: #373f53;
  --brand-green: #58d100;
  --brand-blue: #008bff;

  --page: #f5f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #16181d;
  --text-2: #52514e;
  --muted: #76746f;
  --border: rgba(11, 11, 11, 0.10);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --link: #1f5fae;
  --focus: #008bff;

  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --cell-g: #dcf0d6;
  --cell-y: #fde9b4;
  --cell-r: #f6c9c3;
  --cell-text: #16181d;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-0: #a9a7a0;

  --radius: 10px;
  /* Page width: wide screens get the room (tables, board cards, charts), with gutters that grow
     with the window. Prose stays narrow on its own (.lede max-width). */
  --wrap: 2000px;
  --gutter: clamp(16px, 2.2vw, 40px);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9a988f;
    --border: rgba(255, 255, 255, 0.10);
    --grid: #2c2c2a;
    --axis: #383835;
    --link: #7fb3f0;
    --cell-g: #1f3b1d;
    --cell-y: #4a3a10;
    --cell-r: #4f2321;
    --cell-text: #f0efec;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-0: #6b6a64;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #9a988f;
  --border: rgba(255, 255, 255, 0.10);
  --grid: #2c2c2a;
  --axis: #383835;
  --link: #7fb3f0;
  --cell-g: #1f3b1d;
  --cell-y: #4a3a10;
  --cell-r: #4f2321;
  --cell-text: #f0efec;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-0: #6b6a64;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 4px; }

/* Masthead: brand ink in both themes, so the on-dark logo always sits right. */
.masthead { background: var(--brand-ink); color: #fff; min-width: 0; }
.foot, .flash-host { min-width: 0; }
.mast-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { height: 24px; width: auto; display: block; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: rgba(255, 255, 255, 0.78); padding: 6px 12px; border-radius: 6px; font-size: 0.95rem; font-weight: 600; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 -2px 0 var(--brand-green); }
.mast-tools { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 2px; }
.seg a { color: rgba(255, 255, 255, 0.8); padding: 4px 10px; border-radius: 6px; font-size: 0.82rem; }
.seg a.on { background: #fff; color: var(--brand-ink); font-weight: 600; }
.seg a:hover { text-decoration: none; }
.icon-btn { background: transparent; border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; border-radius: 8px; width: 32px; height: 30px; cursor: pointer; font-size: 1rem; }

.section-top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--text-2);
}
.status-actions { display: flex; gap: 8px; align-items: center; }
.status-actions form { margin: 0; }
.fresh { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--brand-green); }
.dot.live.stale { background: var(--warning); }

.flash-host { max-width: var(--wrap); margin: 0 auto; width: 100%; padding: 0 var(--gutter); }
.flash { margin-top: 12px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.flash.ok { border-left: 4px solid var(--good); }
.flash.bad { border-left: 4px solid var(--critical); }

.page { max-width: var(--wrap); width: 100%; min-width: 0; margin: 0 auto; padding: 20px var(--gutter) 40px; flex: 1; }
.foot {
  max-width: var(--wrap); width: 100%; margin: 0 auto; padding: 16px var(--gutter) 28px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border);
}

.hero { margin: 4px 0 18px; }
.lede { color: var(--text-2); margin: 6px 0 0; max-width: 78ch; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--axis); }
.btn-primary { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.btn-quiet { background: transparent; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { margin-bottom: 12px; }
.card-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sub { color: var(--text-2); font-size: 0.85rem; margin: 4px 0 0; }
.fine { color: var(--muted); font-size: 0.78rem; margin: 10px 0 0; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.warn-text { color: var(--critical); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2, .card + .grid-2 { margin-top: 16px; }
.grid-2.inner { gap: 20px; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; color: var(--text); box-shadow: var(--shadow);
}
.tile:hover { text-decoration: none; border-color: var(--axis); }
.tile-label { font-size: 0.78rem; color: var(--text-2); }
.tile-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
.tile-note { font-size: 0.75rem; color: var(--muted); }

.chart { position: relative; height: 280px; }
.chart canvas { width: 100% !important; }
.table-view { margin-top: 10px; font-size: 0.85rem; }
.table-view summary { cursor: pointer; color: var(--text-2); }

.scroll { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll.tall { max-height: 70vh; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.tbl thead th { font-size: 0.75rem; color: var(--text-2); font-weight: 600; background: var(--surface); white-space: nowrap; }
.tbl tbody th { font-weight: 500; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl.compact th, .tbl.compact td { padding: 5px 6px; }
.tbl tr.total th, .tbl tr.total td { border-top: 2px solid var(--axis); font-weight: 650; }
.tbl tr.out td, .tbl tr.out th { color: var(--muted); }
.tbl.sticky thead th { position: sticky; top: 0; z-index: 1; }
.row-sub { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit { white-space: nowrap; font-weight: 600; }
.flag { color: var(--critical); font-size: 0.8rem; cursor: help; }

/* Churn cells: status tints, with the number and an icon, so color is never alone. */
.tbl.grid td.li { text-align: center; min-width: 46px; font-size: 0.8rem; color: var(--cell-text); border-left: 2px solid var(--surface); }
.tbl.grid td.li i { font-style: normal; font-size: 0.6rem; margin-left: 2px; vertical-align: 1px; }
.li.g { background: var(--cell-g); }
.li.y { background: var(--cell-y); }
.li.r { background: var(--cell-r); font-weight: 600; }
.li-head { text-align: center !important; }
.tbl.grid.single td.li { padding: 10px 6px; font-size: 0.9rem; }
.legend-line { font-size: 0.78rem; color: var(--text-2); margin: 10px 0 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.key { display: inline-flex; align-items: center; gap: 4px; }
.key::before { content: ""; width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key.g::before { background: var(--cell-g); }
.key.y::before { background: var(--cell-y); }
.key.r::before { background: var(--cell-r); }
.key.hi::before, .key.lo::before { display: none; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--text-2); }
.filters label.grow { flex: 1; min-width: 180px; }
.filters label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 6px; font-size: 0.85rem; color: var(--text); }
.filters select, .filters input[type="search"], .filters input[type="number"] {
  font: inherit; font-size: 0.88rem; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); min-width: 150px;
}
.summary { color: var(--text-2); font-size: 0.88rem; margin: 0 0 10px; }
turbo-frame[busy] .card, turbo-frame[busy] .summary { opacity: 0.55; transition: opacity 0.15s; }

.issue-list, .runs { list-style: none; margin: 0; padding: 0; }
.issue-list li a { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--grid); color: var(--text); }
.issue-list li a:hover { text-decoration: none; color: var(--link); }
.count { font-weight: 650; font-variant-numeric: tabular-nums; }
.runs li { padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 0.85rem; }
.pill { display: inline-block; font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); text-transform: lowercase; }
.pill.ok { border-color: var(--good); }
.pill.failed { border-color: var(--critical); }
.pill.live { border-color: var(--brand-blue); }
.pill.ph { border-color: var(--warning); text-transform: none; }

.unit-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.score-badge { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; }
.score-badge.g { border-left: 6px solid var(--good); }
.score-badge.y { border-left: 6px solid var(--warning); }
.score-badge.r { border-left: 6px solid var(--critical); }
.score-num { font-size: 2rem; font-weight: 700; }
.score-label { font-size: 0.78rem; color: var(--text-2); line-height: 1.35; }
.notice { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--warning); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; font-size: 0.88rem; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.drivers { display: grid; gap: 8px; margin-bottom: 14px; }
.driver { display: grid; grid-template-columns: 90px 1fr 60px; align-items: center; gap: 10px; font-size: 0.85rem; }
.driver-bar { background: var(--surface-2); border-radius: 4px; height: 12px; overflow: hidden; }
.driver-bar span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.driver-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.facts { display: grid; grid-template-columns: 1fr; margin: 0; }
.facts.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 0.86rem; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.verdict { margin: 6px 0 0; font-weight: 600; }
.verdict.replace::before { content: "▲ "; color: var(--critical); }
.verdict.keep::before { content: "✓ "; color: var(--good); }
.gap-hi, .gap-lo { font-weight: 600; }

.prose { max-width: 860px; }
.prose h2 { margin: 1.4rem 0 0.4rem; font-size: 1.1rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text); max-width: 75ch; }
.prose ul { padding-left: 20px; }

.signin { display: grid; place-items: center; background: var(--page); }
.signin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; margin: 1rem; max-width: 380px; text-align: center; }
.signin-card img { height: 26px; }
.logo-on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: inline; }
}
:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: inline; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .grid-2 > .card + .card { margin-top: 0; }
  .facts.cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 1.3rem; }
  .hide-sm { display: none; }
  .mast-inner { gap: 8px 12px; }
  .brand img { height: 20px; }
  .mast-tools { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; overflow-x: auto; flex-wrap: nowrap; margin: 0 -4px; }
  .nav a { white-space: nowrap; }
  .filters select, .filters input[type="search"], .filters input[type="number"] { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .chart { height: 240px; }
}
@media (forced-colors: active) {
  .li.g, .li.y, .li.r { border: 1px solid CanvasText; }
}
@media print {
  .masthead, .sectionbar, .filters, .foot { display: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ── Equipment Board ──────────────────────────────────────────────────────────────────────
   Ownership is identity, so it takes the validated categorical slots (Owned blue, RPO green,
   Rental orange, Unverified yellow, Off-rent magenta); "needs reconciling" is the reserved
   critical status. Utilization bands are status colors and always print their number. */
:root {
  --own-owned: var(--series-1);
  --own-rpo: var(--series-3);
  --own-rental: var(--series-2);
  --own-unver: var(--series-4);
  --own-offrent: var(--series-5);
  --flag: var(--critical);
  --good-text: #006300;
  --warn-text: #8a5a00;
  --bad-text: #b42f2f;
  --land: #e2e6e0;
  --land2: #d6dcd5;
  --water: #c9d7de;
  --road: #b9c0ba;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --good-text: #0ca30c; --warn-text: #fab219; --bad-text: #e66767; --land: #24303a; --land2: #2b3843; --water: #1e2c36; --road: #3c4a55; }
}
:root[data-theme="dark"] { --good-text: #0ca30c; --warn-text: #fab219; --bad-text: #e66767; --land: #24303a; --land2: #2b3843; --water: #1e2c36; --road: #3c4a55; }

turbo-frame { display: block; }

.sectionbar { background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.sectionbar-inner { max-width: var(--wrap); margin: 0 auto; padding: 10px var(--gutter) 0; }
.totals { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.tot { display: flex; flex-direction: column; min-width: 56px; }
.tot b { font-size: 1.45rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tot span { font-size: 0.75rem; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; vertical-align: -1px; }
.sw-owned { background: var(--own-owned); }
.sw-rpo { background: var(--own-rpo); }
.sw-rental { background: var(--own-rental); }
.sw-unver { background: var(--own-unver); }
.sw-offrent { background: var(--own-offrent); }
.sw-flag { background: var(--flag); }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 8px; }
.tabs a { padding: 8px 12px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand-green); }
.tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: var(--flag); color: #fff; font-size: 0.75rem; line-height: 18px; text-align: center; }

.board-filters { margin-bottom: 8px; }
.grow-gap { flex: 1; }
.board-legend { margin: 0 0 12px; }
.key-sw { display: inline-flex; align-items: center; gap: 5px; }
.empty { padding: 40px 0; color: var(--muted); text-align: center; }
.fine a { color: var(--link); }

/* board cards */
.cards { columns: 340px; column-gap: 14px; }
.bcard { break-inside: avoid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 14px; overflow: hidden; box-shadow: var(--shadow); }
.bcard-head { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px 8px; border-bottom: 1px solid var(--grid); color: var(--text); }
a.bcard-head:hover { text-decoration: none; background: var(--surface-2); }
.jno { font-size: 1.5rem; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.jtext { min-width: 0; }
.jname { font-weight: 600; line-height: 1.2; }
.jcity { font-size: 0.8rem; color: var(--text-2); }
.bcard-head .right { margin-left: auto; text-align: right; white-space: nowrap; }
.jcount { font-size: 1.15rem; font-weight: 700; }
.flagdot { display: inline-flex; align-items: center; gap: 4px; color: var(--bad-text); font-size: 0.8rem; font-weight: 600; }
.mix { display: flex; height: 5px; gap: 2px; background: var(--surface); }
.mix i { display: block; height: 100%; }
.own-owned { background: var(--own-owned); fill: var(--own-owned); }
.own-rpo { background: var(--own-rpo); fill: var(--own-rpo); }
.own-rental { background: var(--own-rental); fill: var(--own-rental); }
.own-unver { background: var(--own-unver); fill: var(--own-unver); }
.own-offrent { background: var(--own-offrent); fill: var(--own-offrent); }
.dropme { padding: 14px 12px; color: var(--muted); font-size: 0.85rem; }
.grp { padding: 6px 12px 8px; }
.grp + .grp { border-top: 1px dashed var(--grid); }
.grp h4 { margin: 2px 0 5px; font-size: 0.8rem; color: var(--text-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--text); max-width: 100%; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; touch-action: manipulation; }
.chip:hover { border-color: var(--axis); text-decoration: none; }
.chip.flagged { border-color: var(--flag); box-shadow: inset 0 0 0 1px var(--flag); }
.chip .bar4 { width: 5px; flex: none; border-radius: 4px 0 0 4px; }
.chip .t { padding: 3px 7px 3px 6px; display: flex; align-items: baseline; gap: 5px; }
.chip .id { font-weight: 700; font-size: 0.92rem; }
.chip .m { font-size: 0.72rem; color: var(--text-2); }
.chip .st { font-size: 0.68rem; font-weight: 700; color: var(--bad-text); }
.chip .u { font-size: 0.72rem; font-weight: 600; }
.chip.dragging { opacity: 0.3; }
.ghost { position: fixed; z-index: 70; pointer-events: none; transform: translate(-50%, -70%) rotate(-2deg); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28); }
body.isdragging, body.isdragging * { cursor: grabbing !important; user-select: none; }
.bcard.drop, .dropt.drop { outline: 3px solid var(--own-owned); outline-offset: -3px; background: var(--surface-2); }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; background: var(--surface); border-top: 2px solid var(--brand-ink); padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); max-height: 38vh; overflow-y: auto; box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.18); }
.dock h5 { margin: 0 0 8px; font-size: 0.85rem; color: var(--text-2); }
.dock .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.dropt { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: var(--surface-2); font-size: 0.78rem; line-height: 1.2; }
.dropt b { display: block; font-size: 1rem; }

/* utilization bands: number always printed */
.b-r { color: var(--bad-text); }
.b-y { color: var(--warn-text); }
.b-g { color: var(--good-text); }
.bg-r { background: var(--critical); }
.bg-y { background: var(--warning); }
.bg-g { background: var(--good); }
.ubar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 14px; }
.ubar .wk { font-size: 1.15rem; font-weight: 700; min-width: 190px; text-align: center; }
.ubar form.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.ubar label { font-size: 0.8rem; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.ubar input, .ubar select { font: inherit; font-size: 0.85rem; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.ubar input[type="number"] { width: 66px; }
.ubar .btn[aria-disabled="true"] { opacity: 0.4; }
.utiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.utile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; border-top: 4px solid var(--axis); }
.utile b { display: block; font-size: 1.8rem; line-height: 1.1; }
.utile span { font-size: 0.8rem; color: var(--text-2); }
.utile-owned { border-top-color: var(--own-owned); }
.utile-rpo { border-top-color: var(--own-rpo); }
.utile-rental { border-top-color: var(--own-rental); }
.utile-flag { border-top-color: var(--flag); }
.tblwrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tbl tr.grp-row td { background: var(--surface-2); font-weight: 600; }
.hrs-form { margin: 0; display: inline; }
input.hrs { width: 78px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--text); text-align: right; font: inherit; font-variant-numeric: tabular-nums; }
.barcell { vertical-align: middle !important; }
.ubarv { height: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; min-width: 90px; }
.ubarv i { display: block; height: 100%; }
.spark { display: block; }
.spark-low { stroke: var(--critical); stroke-width: 0.7; stroke-dasharray: 2 2; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.spark circle.b-r { fill: var(--critical); }
.spark circle.b-y { fill: var(--warning); }
.spark circle.b-g { fill: var(--good); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* map */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.mapbox { background: var(--water); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: relative; }
.mapbox svg { display: block; width: 100%; height: auto; }
.mapctl { position: absolute; top: 10px; left: 10px; display: flex; gap: 4px; }
.mapctl a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.8rem; }
.mapctl a[aria-current="true"] { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.mapbox .state { fill: var(--land); stroke: var(--road); stroke-width: 1; }
.mapbox .state.ok { fill: var(--land2); }
.mapbox .road { fill: none; stroke: var(--road); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mapbox .city { fill: var(--muted); }
.mapbox .clabel { font: 500 11px var(--font); fill: var(--text-2); }
.mapbox .dfwbox { fill: none; stroke: var(--muted); stroke-dasharray: 4 4; opacity: 0.6; }
.mapbox .pin .halo { fill: var(--surface); opacity: 0.85; }
.mapbox .pin.sel .halo { fill: var(--brand-ink); opacity: 0.3; }
.mapbox .pin .flagring { fill: none; stroke: var(--flag); stroke-width: 2.5; }
.mapbox .pin .cnt { font: 700 12px var(--font); fill: #fff; }
.mapbox .pin .plabel { font: 700 13px var(--font); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.side h3 { margin: 0 0 6px; font-size: 1.15rem; }
.side .side-sub { margin-top: 16px; font-size: 1rem; }
.side .row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--grid); font-size: 0.88rem; }
.side-job { margin: 10px 0 4px; font-weight: 600; }
.side .btn { margin-top: 10px; }

/* reconcile */
.flagsum { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.fpill { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 16px; padding: 5px 11px; font-size: 0.85rem; }
.fpill:hover { text-decoration: none; border-color: var(--axis); }
.fpill[aria-current="true"] { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.fpill-end { margin-left: auto; }
.rflags { display: flex; flex-direction: column; gap: 8px; }
.rflag { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 10px 0; align-items: center; }
.rflag .sev { align-self: stretch; border-radius: 0 3px 3px 0; }
.sev-3 { background: var(--critical); }
.sev-2 { background: var(--own-rental); }
.sev-1 { background: var(--own-unver); }
.rflag .ft { font-weight: 600; }
.rflag .fd { font-size: 0.85rem; color: var(--text-2); }
.rflag .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.rflag .acts form { margin: 0; }
.rflag.done { opacity: 0.6; }
details.review { position: relative; }
details.review summary { list-style: none; }
details.review summary::-webkit-details-marker { display: none; }
details.review[open] form { position: absolute; right: 0; top: 110%; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; display: flex; gap: 6px; box-shadow: var(--shadow); min-width: 320px; }
details.review input { flex: 1; font: inherit; font-size: 0.85rem; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }

.bar-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.tag { display: inline-block; font-size: 0.72rem; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); }
.tag.warn { border-color: var(--warning); color: var(--text); }
.log { list-style: none; padding: 4px 16px; margin: 0; }
.log li { padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 0.9rem; }
.log .when { color: var(--muted); font-size: 0.78rem; }

/* drawer: shown while the frame has content */
.drawer-wrap { display: none; }
.drawer-wrap:has(#drawer > *) { display: block; }
.drawer-wrap .scrim { position: fixed; inset: 0; background: rgba(10, 15, 20, 0.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--surface); z-index: 41; display: flex; flex-direction: column; border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18); }
.dh { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--grid); }
.dh h2 { margin: 0; font-size: 1.5rem; flex: 1; }
.db { padding: 14px 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
.df { position: sticky; bottom: -14px; margin: auto -16px -14px; padding: 12px 16px; border-top: 1px solid var(--grid); background: var(--surface); display: flex; gap: 8px; justify-content: flex-end; }
.btn-left { margin-right: auto; }
label.f { display: block; margin-bottom: 12px; font-size: 0.8rem; color: var(--text-2); font-weight: 600; }
label.f input, label.f select, label.f textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); font: inherit; font-weight: 400; color: var(--text); }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace !important; font-size: 0.82rem !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer-facts { margin: 0 0 12px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; }
.dflags { margin: 0 0 12px; padding: 0; list-style: none; }
.dflags li { font-size: 0.85rem; padding: 6px 8px; border-left: 3px solid var(--flag); background: var(--surface-2); margin-bottom: 5px; border-radius: 0 4px 4px 0; }
.form-error { color: var(--bad-text); font-weight: 600; margin: 0 0 10px; }
.check-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; font-size: 0.9rem; }
.flash .undo { display: inline; margin: 0 0 0 12px; }
.flash .undo button { background: none; border: 1px solid currentColor; color: inherit; border-radius: 4px; padding: 1px 8px; cursor: pointer; font: inherit; font-weight: 600; }
.flash-host { position: sticky; top: 0; z-index: 30; }

@media (max-width: 900px) {
  .mapgrid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .totals { gap: 12px; }
  .tot b { font-size: 1.15rem; }
  .rflag { grid-template-columns: 6px 1fr; }
  .rflag .acts { grid-column: 2; justify-content: flex-start; }
  .ubar .wk { min-width: 0; }
  details.review[open] form { min-width: 260px; }
}

.on-board { margin: 0 0 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: 0.88rem; }

/* ── Moves: every move has a reason and a name ─────────────────────────────────────────── */
.btn-danger { background: var(--critical); color: #fff; border-color: var(--critical); }
.dsub { margin: 0 0 12px; color: var(--text-2); font-size: 0.88rem; }
.fromto { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; align-items: start; }
.fromto > .f { margin-bottom: 12px; }
div.f { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--text-2); font-weight: 600; margin-bottom: 12px; }
div.f > b { margin-top: 4px; padding: 7px 9px; border: 1px dashed var(--border); border-radius: 6px; color: var(--text); font-size: 0.95rem; line-height: 1.3; }
.locline { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 8px 6px 10px; background: var(--surface-2); border-radius: 6px; }
.locline b { padding: 0; }
.req { font-weight: 600; font-size: 0.7rem; color: var(--bad-text); margin-left: 4px; text-transform: uppercase; letter-spacing: 0.03em; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.qpill { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 16px; padding: 4px 10px; font: inherit; font-size: 0.8rem; cursor: pointer; }
.qpill:hover { border-color: var(--axis); }
.dhist { margin: 4px 0 12px; border-top: 1px solid var(--grid); }
.dhist h3 { margin: 12px 0 6px; }
.mlog { list-style: none; margin: 0; padding: 0; }
.mlog li { padding: 7px 0 7px 12px; border-left: 2px solid var(--grid); position: relative; font-size: 0.86rem; }
.mlog li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-ink); }
.mlog .mr { color: var(--text-2); }
.mlog .when, .mid { color: var(--muted); font-size: 0.76rem; }
.mst { display: inline-block; font-size: 0.75rem; color: var(--text-2); }
.moves-tbl .why { min-width: 220px; max-width: 46ch; }
.moves-tbl .mst { display: block; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }

/* ── Phones ────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* 16px inputs: smaller ones make iOS zoom in on focus. */
  input, select, textarea, label.f input, label.f select, label.f textarea { font-size: 16px !important; }
  .btn { min-height: 40px; padding: 8px 14px; }
  .qpill { padding: 7px 12px; }
  /* Section totals and tabs: one swipeable row each instead of a tall block. */
  .totals { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .totals .tot { flex: none; }
  .tot span { white-space: nowrap; }
  .totals::-webkit-scrollbar, .tabs::-webkit-scrollbar, .nav::-webkit-scrollbar { display: none; }
  .tabs { scrollbar-width: none; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .tabs a { padding: 10px 12px; }
  .nav { scrollbar-width: none; }
  .nav a { padding: 8px 12px; }
  .section-top { font-size: 0.8rem; }
  /* Board chips: bigger to tap and hold. */
  .chip .t { padding: 6px 9px 6px 7px; }
  .chip .id { font-size: 1rem; }
  .cards { columns: 1; }
  .board-filters .btn { flex: 1 1 auto; justify-content: center; }
  .board-legend { font-size: 0.78rem; display: flex; flex-wrap: wrap; gap: 4px 10px; }
  /* Drawer: the whole screen, with the actions in thumb reach. */
  .drawer { width: 100%; border-left: 0; }
  .dh h2 { font-size: 1.25rem; }
  .fromto, .two { grid-template-columns: 1fr; gap: 0; }
  .df .btn { flex: 1; justify-content: center; }
  .df .btn-left { flex: 0 0 auto; }
  /* Operational tables become one card per row. */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody { display: block; }
  .tbl.stack tr { display: flex; flex-direction: column; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
  .tbl.stack td { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; justify-content: flex-end; padding: 2px 0; border: 0; text-align: right; }
  .tbl.stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.78rem; text-align: left; flex: none; margin-right: auto; }
  .tbl.stack td:empty { display: none; }
  .tbl.stack td.stack-head { order: -1; font-size: 1.05rem; padding-bottom: 4px; }
  .tbl.stack td.stack-head::before { content: none; }
  .tbl.stack td.why { display: block; text-align: left; min-width: 0; max-width: none; padding: 4px 0; }
  .tbl.stack td.why::before { display: block; }
  .tblwrap.scroll:has(.tbl.stack) { overflow-x: visible; }
}

/* ── Live Telematics: livetel's pages in a frame that fills the window under the tabs ───── */
body.tel-body { height: 100vh; height: 100dvh; min-height: 0; }
body.tel-body .page { max-width: none; padding: 0; display: flex; flex-direction: column; min-height: 0; }
body.tel-body .foot { display: none; }
.telframe { flex: 1; display: block; width: 100%; min-height: 0; border: 0; background: var(--page); }
.tel-empty { max-width: var(--wrap); width: 100%; margin: 0 auto; padding: 24px var(--gutter); }
.tel-pre { margin: 0; white-space: pre-wrap; font: 0.8rem/1.45 ui-monospace, Menlo, Consolas, monospace; max-height: 60vh; overflow: auto; }
