/* AGI Rentals — interface styles. Status colours carry meaning everywhere.
   Fonts: Barlow + Barlow Condensed, SIL Open Font License, bundled in /fonts. */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/barlow-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/barlow-condensed-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }
/* Brand: AGI navy #272264 + orange #F7941D (from the logo). Two themes: light and dark (day / night button, top right). */
:root {
  --ink: #272264; --ink-2: #353083; --ink-3: #4A44A6;
  --paper: #F3F4FA; --surface: #FFFFFF; --surface-2: #F6F7FC; --line: #E0E2EF; --line-2: #ECEEF6;
  --text: #1A1B3D; --muted: #62668A; --on-ink: #CBCDF0;
  --amber: #F7941D; --amber-d: #DD7C0A; --amber-soft: #FFF1E0; --gold: #F7941D; --gold-2: #FFC46B;
  --hire: #16A06A; --hire-soft: #E1F5EC; --down: #E0413A; --down-soft: #FDE8E7;
  --transit: #3B6FE0; --transit-soft: #E5ECFC; --off: #7A7F9E; --off-soft: #ECEDF4; --warn: #B76A00; --warn-soft: #FFF1DB;
  --art-sky: #E8EAF6; --art-ground: #CDD0E6; --art-hub: #9EA2C4;
  --card-shadow: none;
  --hero-a: #272264; --hero-b: #3D37A0; --chart-grid: #E6E8F3; --chart-text: #7A7EA0;
  --r-s: 4px; --r-m: 6px; --r-l: 8px;
  --f: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fc: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --side: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0D0E2C; --ink-2: #1B1D4C; --ink-3: #2C2F6E;
    --paper: #090A22; --surface: #121436; --surface-2: #191C45; --line: #262A5F; --line-2: #1E2152;
    --text: #EDEEFB; --muted: #9C9FC9; --on-ink: #B9BCE8;
    --amber-soft: #3B2A12; --hire: #32C98A; --hire-soft: #10342A; --down: #FF5E57; --down-soft: #3D1820;
    --transit: #6E98FF; --transit-soft: #18244D; --off: #9497BD; --off-soft: #23264F; --warn: #FFB547; --warn-soft: #3A2B12;
    --art-sky: #1A1D47; --art-ground: #262A5F; --art-hub: #5B5F99;
    --card-shadow: none;
    --hero-a: #1B1D52; --hero-b: #2E2A86; --chart-grid: #262A5F; --chart-text: #8F93C2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #0D0E2C; --ink-2: #1B1D4C; --ink-3: #2C2F6E;
  --paper: #090A22; --surface: #121436; --surface-2: #191C45; --line: #262A5F; --line-2: #1E2152;
  --text: #EDEEFB; --muted: #9C9FC9; --on-ink: #B9BCE8;
  --amber-soft: #3B2A12; --hire: #32C98A; --hire-soft: #10342A; --down: #FF5E57; --down-soft: #3D1820;
  --transit: #6E98FF; --transit-soft: #18244D; --off: #9497BD; --off-soft: #23264F; --warn: #FFB547; --warn-soft: #3A2B12;
  --art-sky: #1A1D47; --art-ground: #262A5F; --art-hub: #5B5F99;
  --card-shadow: none;
  --hero-a: #1B1D52; --hero-b: #2E2A86; --chart-grid: #262A5F; --chart-text: #8F93C2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 50; background: var(--surface); }
body { margin: 0; font: 15px/1.45 var(--f); color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; transition: background .2s, color .2s; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0 0 .6em; }
.num, .r, td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.bad-text { color: var(--down); }
.warn-text { color: var(--warn); }
.good-text { color: var(--hire); }
.danger-text { color: var(--down) !important; }
.ic { flex: none; vertical-align: -0.2em; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- boot + brand ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; background: #272264; }
.brand-m { font: 700 20px/1 var(--fc); letter-spacing: .04em; background: var(--amber); color: #1A1B3D; padding: 6px 8px 5px; border-radius: var(--r-s); display: inline-block; position: relative; }
.logo { display: block; height: auto; border-radius: 8px; }
.logo-side { width: 100%; max-width: 200px; }
.logo-mob { height: 32px; width: auto; border-radius: 6px; }
.boot .logo { width: 240px; border-radius: 14px; }
.brand-m.big { font-size: 34px; padding: 9px 13px 8px; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) var(--side), transparent var(--side)); }
.side { background: var(--ink); color: var(--on-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; z-index: 30; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-decoration: none; padding: 4px 8px 20px; }
.brand-sub { font: 600 12px/1 var(--f); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); opacity: .9; padding-left: 2px; }
.brand-t { font: 600 22px/1 var(--fc); color: #fff; letter-spacing: .01em; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-m); text-decoration: none; font-weight: 500; position: relative; transition: background .12s, color .12s; }
.nav-sec { font: 600 11px/1 var(--f); letter-spacing: .12em; text-transform: uppercase; color: var(--on-ink); opacity: .55; padding: 14px 12px 6px; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-2); color: #fff; }
.nav a.on .ic { color: var(--amber); }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; background: var(--amber); border-radius: 0 3px 3px 0; }
.nav a span:not(.pill) { flex: 1; }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--down); color: #fff; font: 600 12px/20px var(--f); text-align: center; }
.pill.soft { background: var(--amber); color: #1A1B3D; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 12px; border-top: 1px solid var(--ink-3); text-decoration: none; }
.me b { display: block; color: #fff; font-weight: 600; }
.me small { color: var(--on-ink); }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--ink-3); color: #fff; display: grid; place-items: center; font: 600 14px var(--fc); flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-r { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 10px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); }
.theme-btn:hover { border-color: var(--amber); }
.theme-btn .ic { color: var(--amber); }
.top-av { width: 36px; height: 36px; border-radius: 50%; background: var(--amber); color: #1A1B3D; display: grid; place-items: center; font: 700 14px var(--fc); text-decoration: none; margin-left: 4px; }
.top .menu-btn, .top .brand.mob { display: none; }
#page { padding: 22px 28px 60px; max-width: 1320px; width: 100%; outline: none; }
.scrim { display: none; }
.bottom { display: none; }
.demo-bar { background: var(--amber); color: #1A1B3D; text-align: center; font-weight: 600; font-size: 13px; padding: 5px 12px; }

/* ---------- global search ---------- */
.gsearch { flex: 1; max-width: 640px; position: relative; }
.gsearch label { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-m); padding: 0 14px; color: var(--muted); }
.gsearch input { border: 0 !important; background: transparent !important; box-shadow: none !important; outline: 0; padding: 10px 0; width: 100%; color: var(--text); font-size: 15px; min-height: 40px !important; }
.brand.mob, .brand.mob img { flex: none; }
.gsearch label:focus-within { border-color: var(--amber-d); box-shadow: 0 0 0 3px var(--amber-soft); }
.gres { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: 0 16px 40px rgba(15, 26, 34, .18); max-height: 70vh; overflow: auto; padding: 6px; }
.gsec > span { display: block; font-size: 12px; color: var(--muted); padding: 8px 10px 4px; }
.gsec a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-m); text-decoration: none; }
.gsec a:hover, .gsec a:focus { background: var(--surface-2); }
.gsec a > span:not(.tag):not(.badge) { flex: 1; min-width: 0; }
.gsec small { display: block; color: var(--muted); }
.gnone { padding: 14px; color: var(--muted); margin: 0; }
.bell { position: relative; }
.bell .pill { position: absolute; top: -2px; right: -4px; transform: scale(.85); }

/* ---------- page head ---------- */
.phead { margin-bottom: 18px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-weight: 500; margin-bottom: 6px; }
.back:hover { color: var(--text); }
.phead-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.phead h1 { font: 600 28px/1.05 var(--fc); letter-spacing: .005em; }
.phead .sub { color: var(--muted); margin: 6px 0 0; max-width: 72ch; }
.phead-act { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons + inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px; border-radius: var(--r-m); border: 1px solid transparent; background: var(--surface); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn.primary { background: var(--amber); color: #1A1B3D; border-color: var(--amber-d); }
.btn.primary:hover { background: #FFAE4F; }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger { background: var(--down); color: #fff; }
.btn.danger-ghost { background: var(--surface); border-color: var(--down); color: var(--down); }
.btn.danger-ghost:hover { background: var(--down-soft); }
.btn.sm { min-height: 34px; padding: 5px 11px; font-size: 14px; }
.btn.xs { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn.block { width: 100%; min-height: 48px; font-size: 16px; }
.btn:disabled, .btn.busy { opacity: .6; pointer-events: none; }
.btn.busy::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-m); border: 0; background: transparent; cursor: pointer; color: var(--muted); text-decoration: none; }
.icon-btn:hover, .icon-btn.on { background: var(--surface-2); color: var(--text); }
.icon-btn.disabled { opacity: .3; pointer-events: none; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); color: var(--text); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber-d); box-shadow: 0 0 0 3px var(--amber-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--amber-d); }

/* ---------- tags, badges, chips ---------- */
.tag { display: inline-flex; align-items: center; font: 700 14px/1 var(--fc); letter-spacing: .03em; color: #1A1B3D; background: var(--amber); padding: 4px 7px 3px; border-radius: var(--r-s); white-space: nowrap; }
.tag-x { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 2px var(--amber); }
.tag-big { font-size: 26px; padding: 7px 12px 6px; position: relative; }
.tag-big::before, .tag-big::after { content: ''; position: absolute; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: rgba(26, 27, 61, .35); }
.tag-big::before { left: 4px; } .tag-big::after { right: 4px; }
.tag-big { padding-left: 15px; padding-right: 15px; }
.mlink { text-decoration: none; display: inline-flex; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-hire { background: var(--hire-soft); color: var(--hire); }
.st-down { background: var(--down-soft); color: var(--down); }
.st-transit { background: var(--transit-soft); color: var(--transit); }
.st-off { background: var(--off-soft); color: var(--off); }
.st-warn { background: var(--warn-soft); color: var(--warn); }
.chip { display: inline-block; padding: 1px 8px; border-radius: var(--r-s); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.chip-x { border-color: var(--amber-d); color: var(--text); }
.chip-rep { background: var(--transit-soft); color: var(--transit); border-color: transparent; }
.phone { color: var(--transit); text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.count { font: 600 15px var(--f); color: var(--muted); margin-left: 4px; }

/* ---------- panels + kpis ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--card-shadow); }
.panel h2 { font: 600 21px/1.1 var(--fc); }
.panel h3 { font: 600 17px var(--fc); margin-bottom: 8px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.lnk { color: var(--transit); text-decoration: none; font-weight: 600; font-size: 14px; }
h3.sub { font: 600 17px var(--fc); margin: 16px 0 8px; }
/* Figures sit in one bordered strip; the 1px gap over a line-coloured background draws the dividers, also when the strip wraps. */
.kpis, .money, .stats, .vboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.kpi { background: var(--surface); border: 0; border-radius: 0; padding: 12px 16px; text-decoration: none; display: flex; flex-direction: column; gap: 2px; position: relative; }
.kpi span { color: var(--muted); font-size: 13.5px; }
.kpi b { font: 600 27px/1.1 var(--fc); font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.kpi.big b { color: var(--amber-d); }
.kpi.neg b { color: var(--down); }
a.kpi:hover, a.stat:hover, a.vbox:hover { background: var(--surface-2); }
.split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.split .panel { margin-bottom: 18px; }
.bigline { font: 600 30px/1.1 var(--fc); margin: 4px 0; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.callout { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--amber-soft); border: 1px solid var(--amber-d); border-radius: var(--r-l); text-decoration: none; margin-bottom: 18px; }
.callout span { flex: 1; }
.callout.soft { background: var(--surface-2); border-color: var(--line); }
.meter { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; margin: 4px 0 10px; }
.meter span { display: block; height: 100%; background: var(--hire); }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.mini-list li:first-child { border-top: 0; }
.mini-list li > span:nth-child(2) { flex: 1; min-width: 100px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty p { margin: 0; max-width: 46ch; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; justify-content: center; }
.loading .spinner { border-color: var(--line); border-top-color: var(--amber-d); }

/* ---------- fleet board ---------- */
.board-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px 12px; margin-bottom: 18px; }
.board-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.leg { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--muted); font-weight: 500; }
.leg b { font: 600 24px/1 var(--fc); color: var(--text); }
.leg:hover b { text-decoration: underline; }
.sw { width: 12px; height: 12px; border-radius: 2px; }
.leg-on_hire .sw { background: #2EA764; } .leg-breakdown .sw { background: #E2483E; } .leg-in_transit .sw { background: #3C82D3; } .leg-off_hire .sw { background: #7D8A95; }
.util { font-size: 14px; color: var(--muted); } .util b { font: 600 24px var(--fc); color: var(--text); }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
.cell { height: 36px; border-radius: var(--r-s); display: grid; place-items: center; text-decoration: none; font: 600 14px var(--fc); color: #fff; position: relative; }
.cell:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.c-on_hire { background: #2EA764; } .c-breakdown { background: #E2483E; } .c-in_transit { background: #3C82D3; } .c-off_hire { background: #56636E; }
.cell.x::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 11px 11px 0; border-color: transparent var(--amber) transparent transparent; border-top-right-radius: var(--r-s); }
.board-note { margin: 8px 0 0; color: var(--muted); }

/* ---------- breakdown cards ---------- */
.bd { border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px; margin-bottom: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.bd.open { border-left: 4px solid var(--down); }
.bd-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bd-title { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.bd-title .muted { font-size: 13.5px; }
.bd-desc { margin: 10px 0 8px; }
.bd-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 8px 0; }
.bd-meta dt { font-size: 12.5px; color: var(--muted); }
.bd-meta dd { margin: 0; font-weight: 600; }
.bd-diag, .bd-parts { font-size: 14px; margin: 6px 0; }
.partlist { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; font-size: 14px; }
.partlist .chip { margin-right: 6px; }
.bd-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0 14px; }
.steps { list-style: none; display: flex; padding: 0; margin: 10px 0; gap: 0; counter-reset: s; }
.steps li { flex: 1; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; position: relative; padding-right: 6px; }
.steps li::before { content: ''; position: absolute; top: 8px; left: 18px; right: 0; height: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); position: relative; z-index: 1; display: grid; place-items: center; color: #fff; }
.steps li.done { color: var(--text); } .steps li.done .dot { background: var(--hire); border-color: var(--hire); }
.steps li.done::before { background: var(--hire); }
.steps li.now { color: var(--text); font-weight: 600; } .steps li.now .dot { border-color: var(--amber-d); background: var(--amber); }

/* ---------- feed ---------- */
.feed { list-style: none; padding: 0; margin: 0; }
.ev { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.ev:first-child { border-top: 0; }
.ev-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.ev-down .ev-ic { background: var(--down-soft); color: var(--down); } .ev-hire .ev-ic { background: var(--hire-soft); color: var(--hire); }
.ev-transit .ev-ic { background: var(--transit-soft); color: var(--transit); } .ev-off .ev-ic { background: var(--off-soft); color: var(--off); }
.ev-b { min-width: 0; flex: 1; }
.ev-t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-route { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ev-n { font-size: 14px; margin-top: 2px; }
.ev-w { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.maplink { color: var(--transit); text-decoration: none; margin-left: 6px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); box-shadow: var(--card-shadow); }
.panel .tbl-wrap { box-shadow: none; }
.panel .tbl-wrap { border: 0; border-radius: 0; margin: 0 -20px; padding: 0 20px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.missing td { background: color-mix(in srgb, var(--down-soft) 45%, transparent); }
.tbl tr.inactive td { opacity: .55; }
.tbl.compact td, .tbl.compact th { padding: 7px 8px; }
.tbl tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }

/* ---------- filters ---------- */
.filters { margin-bottom: 14px; display: grid; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters .chips { margin: 0; }
.fchip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 20px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.fchip b { font-weight: 700; }
.fchip.on { background: var(--amber); color: #1A1B3D; border-color: var(--amber-d); }
.fchip.f-breakdown b { color: var(--down); } .fchip.on.f-breakdown b { color: #FF9C94; }
.frow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.frow select, .frow input[type=date] { width: auto; min-width: 150px; }
.frow label { display: inline-flex; align-items: center; gap: 6px; }
.search-in { flex: 1; min-width: 220px; display: flex !important; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-m); padding-left: 10px; background: var(--surface); color: var(--muted); }
.search-in input { border: 0 !important; box-shadow: none !important; padding-left: 0 !important; color: var(--text); }
.seg-view { display: flex; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.daynav input { width: auto; }

/* ---------- machine cards ---------- */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: border-color .12s; }
.mcard:hover { border-color: var(--muted); }
.mcard-art { aspect-ratio: 4 / 3; background: var(--art-sky); }
.mcard-art img, .mcard-art svg { width: 100%; height: 100%; object-fit: cover; }
.mcard-b { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.mcard-t { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.art { width: 100%; height: auto; display: block; }

/* ---------- machine page ---------- */
.mhero { display: grid; grid-template-columns: minmax(260px, 400px) 1fr; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; margin-bottom: 14px; box-shadow: var(--card-shadow); }
.mphoto { display: flex; flex-direction: column; gap: 8px; }
.mphoto > .art, .photo-btn { border-radius: var(--r-m); overflow: hidden; }
.photo-btn { border: 0; padding: 0; cursor: zoom-in; background: var(--art-sky); }
.photo-btn img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs button { width: 56px; height: 56px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 0; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.addthumb { display: grid; place-items: center; color: var(--muted); border-style: dashed !important; }
.plate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.mline { font-size: 16px; margin-bottom: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 22px; margin: 0; }
.facts.one { grid-template-columns: 1fr; gap: 6px; }
.facts.one > div { display: flex; justify-content: space-between; gap: 12px; }
.facts.one .tot { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; }
.facts.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; margin-bottom: 18px; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 1px 0 0; font-weight: 500; }
.mnotes { margin-top: 14px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-m); font-size: 14px; }
.actbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.more { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: 0 14px 36px rgba(15, 26, 34, .16); min-width: 260px; padding: 6px; z-index: 15; }
.menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: var(--r-m); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--amber); }
.tabs.small a { padding: 7px 10px; font-size: 14px; }
.tabpanel { min-height: 160px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gph { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; padding: 0; background: var(--surface); cursor: pointer; text-align: left; display: flex; flex-direction: column; }
.gph img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.gph span { padding: 6px 8px; font-size: 13.5px; display: flex; flex-direction: column; }
.gph small { color: var(--muted); }
.gph.add { display: grid; place-items: center; min-height: 140px; color: var(--muted); border-style: dashed; text-align: center; }
.mcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mcol h3 { margin-bottom: 10px; }

/* ---------- operator ---------- */
.mym { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; margin-bottom: 18px; box-shadow: var(--card-shadow); }
.mym-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mym-top > div { flex: 1; }
.mym h2 { font: 600 24px var(--fc); }
.bigbtns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.bigbtn { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 14px; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; font-weight: 700; font-size: 16.5px; }
.bigbtn small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); }
.bigbtn.primary { background: var(--amber); border-color: var(--amber-d); color: #1A1B3D; }
.bigbtn.primary small { color: #3A3418; }
.bigbtn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.bigbtn.danger small { color: #FFE1DE; }
.bigbtn.done { background: var(--hire-soft); border-color: var(--hire); color: var(--hire); }
.alert-box { display: flex; gap: 10px; padding: 12px 14px; background: var(--down-soft); color: var(--text); border-radius: var(--r-m); margin-bottom: 12px; }
.alert-box > .ic { color: var(--down); }
.week { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.week li { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line-2); }
.week li > span:first-child { width: 60px; color: var(--muted); }

/* ---------- sites + team ---------- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.site { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; }
.site:hover { border-color: var(--muted); }
.site-t { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.site-n { margin-top: 4px; } .site-n b { font: 600 20px var(--fc); }
.sbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line-2); margin-top: 6px; gap: 1px; }
.sbar span { display: block; }
.s-on_hire { background: var(--hire); } .s-breakdown { background: var(--down); } .s-in_transit { background: var(--transit); } .s-off_hire { background: var(--off); }
.sup-h { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.sup-h h2 a { text-decoration: none; }
.sup-c { display: flex; gap: 18px; } .sup-c > * { text-decoration: none; } .sup-c b { font: 600 22px var(--fc); }
.sup-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 14px; }
.sup-cols h3 { margin: 6px 0 8px; }
.plist { list-style: none; padding: 0; margin: 0 0 12px; }
.person { display: grid; grid-template-columns: minmax(150px, 1fr) auto auto; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.person a { text-decoration: none; }
.pm { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.taglist .tg-breakdown .tag { box-shadow: 0 0 0 2px var(--down); }
.appr { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 6px; }
.appr-r { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.appr-a { display: flex; gap: 8px; }

/* ---------- income ---------- */
.pnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.segment { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segment a, .segment label span { display: block; padding: 6px 12px; border-radius: 4px; text-decoration: none; font-weight: 600; color: var(--muted); cursor: pointer; }
.segment a.on, .segment input:checked + span { background: var(--amber); color: #1A1B3D; }
.segment label { margin: 0; } .segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment input:focus-visible + span { outline: 3px solid var(--amber); }
.segment.sm label span { padding: 4px 9px; font-size: 13px; }
.pstep { display: flex; align-items: center; gap: 6px; }
.pstep b { font: 600 20px var(--fc); min-width: 140px; text-align: center; }
.bars { display: flex; align-items: flex-end; height: calc(var(--h) + 40px); gap: 0; padding-top: 18px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; padding: 0 2px; position: relative; }
.bar-f { width: 100%; max-width: 46px; background: var(--amber); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.mark .bar-f { background: var(--amber-d); }
.bar.future .bar-f { background: var(--line); }
.bar-v { font-size: 11.5px; color: var(--muted); white-space: nowrap; margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.bar-l { font-size: 12px; color: var(--muted); margin-top: 5px; height: 16px; }
.bars .bar:nth-child(n) .bar-v { writing-mode: horizontal-tb; }
.share { display: inline-block; width: 80px; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.share span { display: block; height: 100%; background: var(--amber-d); }

/* ---------- invoice ---------- */
.invoice { background: #fff; color: #1A1B3D; border: 1px solid var(--line); border-radius: var(--r-l); padding: 34px 38px; max-width: 920px; }
.invoice .tbl th { background: #fff; color: #5C6B77; } .invoice .tbl td { border-color: #E6EBEE; }
.inv-h { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 3px solid #F7941D; margin-bottom: 18px; flex-wrap: wrap; }
.inv-logo { height: 64px; width: auto; border-radius: 8px; margin-bottom: 8px; }
.inv-h h2 { font: 700 28px var(--fc); margin-bottom: 4px; }
.inv-h p { margin: 0; font-size: 14px; color: #3A4C5A; }
.inv-meta h3 { font: 600 22px var(--fc); text-align: right; margin-bottom: 6px; }
.inv-meta dl { margin: 0; display: grid; gap: 2px; }
.inv-meta dl div { display: flex; justify-content: space-between; gap: 18px; font-size: 14px; }
.inv-meta dt { color: #5C6B77; } .inv-meta dd { margin: 0; font-weight: 600; }
.inv-to { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 18px; }
.inv-to b { display: block; font-size: 16px; }
.inv-to p { margin: 0; font-size: 14px; color: #3A4C5A; }
.inv-lines tfoot td { padding: 6px 12px; }
.inv-lines .grand td { font: 700 20px var(--fc); border-top: 2px solid #272264; }
.inv-words { font-style: italic; margin: 14px 0; }
.inv-f { display: flex; justify-content: space-between; margin-top: 36px; font-size: 13.5px; color: #3A4C5A; text-align: right; gap: 20px; }
.inv-f span:first-child { text-align: left; }

/* ---------- forms + modal ---------- */
body.modal-open { overflow: hidden; }
.modal-wrap { position: fixed; inset: 0; background: rgba(9, 10, 34, .6); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: up .18s ease-out; }
.modal.wide { width: min(780px, 100%); }
.modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 12px 20px; border-bottom: 1px solid var(--line); }
.modal h2 { font: 600 22px var(--fc); }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal footer > .btn.ghost:not([data-close]) { margin-right: auto; }
.form-error { background: var(--down-soft); color: var(--down); padding: 10px 12px; border-radius: var(--r-m); font-weight: 600; margin-top: 12px; }
.fgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .flabel { font-weight: 600; font-size: 14px; }
.field.check label { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; padding-top: 6px; }
.req { color: var(--down); margin-left: 2px; }
.hint { color: var(--muted); font-size: 12.5px; }
.hint a { color: var(--transit); }
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.photo-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.photo-preview img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r-s); }
.photo-full { width: 100%; border-radius: var(--r-m); margin-bottom: 8px; }
.parts { display: grid; gap: 8px; margin-bottom: 14px; }
.parts-rows { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: 1fr 1.4fr 70px auto 38px; gap: 6px; align-items: center; padding: 8px; background: var(--surface-2); border-radius: var(--r-m); }
.prow .p-other { grid-column: 1 / 3; }
.parts:not(:has(.segment)) .prow { grid-template-columns: 1fr 1.4fr 70px 38px; }
.lrow { display: grid; grid-template-columns: 1fr 70px 64px 100px 110px 38px; gap: 6px; margin-bottom: 6px; }
.howto { padding-left: 20px; margin: 0 0 12px; }
.errs { color: var(--down); font-size: 14px; }
.filetext { font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-form h2 { margin: 6px 0 12px; }
.settings-form h2:not(:first-child) { margin-top: 26px; }
.form-actions { margin-top: 18px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { display: flex; gap: 10px; align-items: center; background: #1A1B3D; color: #fff; padding: 12px 16px; border-radius: var(--r-m); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 500; animation: up .2s; transition: opacity .3s; }
.toast .ic { color: #5DD18F; }
.toast-err { background: var(--down); } .toast-err .ic { color: #fff; }
.toast-warn .ic { color: var(--amber); }
.toast.out { opacity: 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: #272264; color: #CBCDF0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.login-art .logo { width: 300px; max-width: 80%; }
.login-brand h1 { font: 600 52px/1 var(--fc); color: #fff; margin: 22px 0 8px; }
.login-brand p { font-size: 18px; }
.login-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-width: 520px; }
.login-board .cell { height: 34px; }
.login-form { padding: 48px; max-width: 480px; width: 100%; align-self: center; justify-self: center; display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { font: 600 32px var(--fc); }
.login-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
.login-form input { min-height: 48px !important; font-size: 16px; }
.demo-logins { border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px 14px; background: var(--surface); }
.demo-logins summary { cursor: pointer; font-weight: 600; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-top: 8px; }
.dl-grid button { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-m); padding: 8px 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; }
.dl-grid button:hover { border-color: var(--amber-d); }
.dl-grid span { font-size: 13px; color: var(--transit); font-weight: 600; } .dl-grid small { color: var(--muted); font-size: 12px; }

/* ---------- value boxes: price excl. GST / GST / total ---------- */
.vboxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.vbox { border-radius: 0; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; position: relative; background: var(--surface); border: 0; text-decoration: none; }
.vbox span { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.vbox b { font: 600 30px/1.1 var(--fc); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.vbox small { color: var(--muted); }
.vbox .vi { display: none; }

/* ---------- daily report (one machine) ---------- */
.dayrep-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; font-size: 14px; }
.dayrep-meta span { color: var(--muted); }
.dayrep-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.daytbl td, .daytbl th { text-align: center; padding: 6px 10px; }
.daytbl td.r, .daytbl th.r { text-align: right; }
.tbl tr.yl td { background: rgba(255, 221, 0, .28); }
.sbox { border: 1px solid var(--line); border-radius: var(--r-m, 12px); overflow: hidden; background: var(--surface); position: sticky; top: 76px; }
.sbox h3 { margin: 0; padding: 10px 14px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-2, var(--bg)); }
.sbox-r { display: flex; justify-content: space-between; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.sbox-r span:first-child { color: var(--muted); }
.sbox-r.b span { font-weight: 700; color: var(--text); }
.sbox-r.tv { font-weight: 800; font-size: 15px; border-bottom: 0; }
.sbox-r.tv span:first-child { color: var(--text); }
@media (max-width: 900px) { .dayrep-grid { grid-template-columns: 1fr; } .sbox { position: static; } }

/* ---------- salary & OT, documents overview ---------- */
.monthbar { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.monthbar input[type=month] { width: auto; min-width: 160px; }
.monthbar b { font-size: 16px; margin-left: 6px; }
.icon-btn.flip svg { transform: scaleX(-1); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.paytbl td, .paytbl th { white-space: nowrap; }
.chip-sep { display: inline-block; width: 1px; height: 22px; background: var(--line); margin: 0 6px; vertical-align: middle; }
.dchip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin: 2px 4px 2px 0; white-space: nowrap; }
.dchip.ok { background: var(--hire-soft); color: var(--hire); }
.dchip.miss { background: var(--off-soft); color: var(--muted); border: 1px dashed var(--line); }
.dchip.bad { background: var(--down-soft); color: var(--down); }
.dchip.warn { background: var(--warn-soft); color: var(--warn); }
.doctbl td { vertical-align: top; }
.doctbl td:first-child { min-width: 210px; }
.doctbl td:nth-child(3), .doctbl td:nth-child(4) { min-width: 200px; }

/* ---------- stat cards with icons ---------- */
.stat { background: var(--surface); border: 0; border-radius: 0; padding: 12px 16px; display: flex; gap: 12px; align-items: center; text-decoration: none; }
.stat .si { display: none; }
.stat b { display: block; color: var(--text); font: 600 26px/1.1 var(--fc); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.si-hire { background: var(--hire-soft); color: var(--hire); } .si-down { background: var(--down-soft); color: var(--down); }
.si-transit { background: var(--transit-soft); color: var(--transit); } .si-off { background: var(--off-soft); color: var(--off); }
.si-gold { background: var(--amber-soft); color: var(--amber-d); }

/* ---------- charts ---------- */
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 18px; margin-bottom: 18px; }
.chart-grid .panel { margin-bottom: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gl { stroke: var(--chart-grid); stroke-width: 1; }
.chart .tx { fill: var(--chart-text); font: 500 11px var(--f); }
.chart .val { fill: var(--text); font: 600 11px var(--f); }
.chart .bar-r { fill: var(--amber); }
.chart .bar-r.now { fill: var(--amber); fill-opacity: .45; stroke: var(--amber-d); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .bar-r { fill: var(--amber-d); }
.chart .gl.base { stroke: var(--line); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut-wrap svg { width: 168px; height: 168px; flex: none; }
.donut-c { font: 700 30px var(--fc); fill: var(--text); }
.donut-s { font: 500 11px var(--f); fill: var(--muted); }
.dlegend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 150px; }
.dlegend li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dlegend li b { margin-left: auto; font: 600 18px var(--fc); }
.dlegend a { text-decoration: none; display: contents; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- breakdown pop-ups (bottom right, every 15 s) ---------- */
#bdpops { position: fixed; right: 18px; bottom: 18px; z-index: 90; width: min(360px, calc(100vw - 24px)); }
.bdpop { background: #272264; color: #ECEDFB; border-radius: var(--r-l); padding: 14px 16px 14px 18px; box-shadow: 0 18px 50px rgba(9, 10, 34, .45); border: 1px solid rgba(255, 94, 87, .35); position: relative; overflow: hidden; animation: popin .35s cubic-bezier(.2, .9, .3, 1.2); }
.bdpop::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #FF5E57; }
.bdpop.out { animation: popout .3s forwards; }
@keyframes popin { from { transform: translateY(30px) scale(.96); opacity: 0; } }
@keyframes popout { to { transform: translateX(40px); opacity: 0; } }
.bdpop-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 700 12px/1 var(--f); letter-spacing: .1em; text-transform: uppercase; color: #FF8A84; }
.bdpop-h .live { width: 9px; height: 9px; border-radius: 50%; background: #FF5E57; box-shadow: 0 0 0 0 rgba(255, 94, 87, .7); animation: pulse 1.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255, 94, 87, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 94, 87, 0); } }
.bdpop-h .n { margin-left: auto; margin-right: 26px; color: #B9BCE8; letter-spacing: 0; text-transform: none; font-weight: 500; }
.bdpop-t { display: flex; align-items: center; gap: 8px; }
.bdpop-t b { font: 600 17px var(--fc); }
.bdpop p { margin: 6px 0 0; font-size: 13.5px; color: #CBCDF0; }
.bdpop-m { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: #B9BCE8; margin-top: 8px; }
.bdpop-m b { color: #fff; }
.bdpop-a { display: flex; gap: 8px; margin-top: 10px; }
.bdpop-a .btn { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.bdpop-a .btn.ghost { background: transparent; color: #CBCDF0; border-color: rgba(203, 205, 240, .3); }
.bdpop .x { position: absolute; top: 8px; right: 8px; color: #B9BCE8; width: 30px; height: 30px; }
.bdpop .x:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- documents ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); }
.doc-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--transit-soft); color: var(--transit); flex: none; }
.doc-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-b b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-b small { color: var(--muted); font-size: 12.5px; }
.doc-a { display: flex; flex-direction: column; gap: 2px; }
.doc-add { border: 1.5px dashed var(--line); border-radius: var(--r-m); display: grid; place-items: center; min-height: 72px; color: var(--muted); background: none; cursor: pointer; font-weight: 600; gap: 4px; }
.doc-add:hover { border-color: var(--amber); color: var(--text); }
.doc-view { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--r-m); background: var(--surface-2); }
.doc-frame { width: 100%; height: 70vh; border: 0; border-radius: var(--r-m); background: #fff; }
.lock-note { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }

/* ---------- people: blacklist, pool, location ---------- */
.banner-bl { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-l); background: var(--down-soft); border: 1px solid var(--down); margin-bottom: 16px; }
.banner-bl .ic { color: var(--down); }
.chip-bl { background: var(--down); color: #fff; border-color: transparent; }
.chip-av { background: var(--hire-soft); color: var(--hire); border-color: transparent; }
.chip-busy { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.mech { border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; box-shadow: var(--card-shadow); }
.mech-t { display: flex; align-items: center; gap: 10px; }
.mech-t .av { background: var(--ink-3); }
.mech-t > div { flex: 1; min-width: 0; }
.mech-loc { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; }
.mech-loc .ic { color: var(--amber-d); margin-top: 2px; }
.pick { display: grid; gap: 8px; max-height: 52vh; overflow: auto; padding: 2px; }
.pick label { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); cursor: pointer; background: var(--surface); }
.pick label:has(input:checked) { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.pick small { display: block; color: var(--muted); }
.pick .km { font: 600 15px var(--fc); color: var(--text); text-align: right; }
.loc-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.loc-card .ic { color: var(--amber-d); }
.loc-card > div { flex: 1; min-width: 180px; }
.loc-card small { color: var(--muted); }

/* ---------- work orders + reports ---------- */
.wo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.wo { border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; background: var(--surface); text-decoration: none; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s; }
.wo:hover { border-color: var(--muted); }
.wo-no { font: 700 16px var(--fc); letter-spacing: .02em; word-break: break-all; }
.wo-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); }
.wo-row b { color: var(--text); }
.wo-meter { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.wo-meter span { display: block; height: 100%; background: var(--amber); }
.irow { display: grid; grid-template-columns: 1.3fr 1.3fr 56px 1fr 0.8fr 0.8fr 0.9fr 0.9fr 36px; gap: 6px; margin-bottom: 6px; align-items: center; }
.irow-h { font-size: 12px; color: var(--muted); font-weight: 600; }
.rep-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.rep-opts .field { margin: 0; }
.tbl tr.tot td { font-weight: 700; background: var(--surface-2); }
.sheet-chip { display: inline-block; min-width: 26px; text-align: center; padding: 1px 6px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.sh-single { background: var(--hire-soft); color: var(--hire); } .sh-double { background: var(--transit-soft); color: var(--transit); }
.sh-partial { background: var(--warn-soft); color: var(--warn); } .sh-holiday, .sh-sunday { background: var(--off-soft); color: var(--off); }
.spec-src { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin: -4px 0 10px; }
.spec-src.on { color: var(--hire); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr; } }
@media (max-width: 1060px) {
  .app { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(9, 10, 34, .55); z-index: 25; }
  .top .menu-btn, .top .brand.mob { display: inline-grid; }
  .brand.mob { padding: 0; }
  .cols { grid-template-columns: 1fr; }
  .bd-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .top { padding: 8px 12px; gap: 6px; }
  .gsearch label { padding: 0 10px; gap: 6px; } .gsearch input { font-size: 14px; min-width: 0; } .gsearch input::-webkit-search-cancel-button { display: none; }
  #page { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); }
  .top { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .phead h1 { font-size: 27px; }
  .bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom a, .bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--muted); border: 0; background: none; position: relative; }
  .bottom a.on { color: var(--text); }
  .bottom a.on::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--amber); border-radius: 0 0 3px 3px; }
  .bottom .pill { position: absolute; top: 3px; left: calc(50% + 6px); transform: scale(.8); }
  .money { grid-template-columns: 1fr 1fr; } .money .kpi:first-child { grid-column: 1 / -1; }
  .vboxes { grid-template-columns: 1fr; } .vbox { padding: 14px 16px; } .vbox b { font-size: 27px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .theme-btn span { display: none; } .theme-btn { padding: 0 10px; }
  .top-av { display: none; }
  #bdpops { right: 12px; left: 12px; width: auto; bottom: 74px; }
  .irow { grid-template-columns: 1fr 1fr; } .irow-h { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 23px; }
  .split, .mcols { grid-template-columns: 1fr; }
  .panel { padding: 14px; border-radius: var(--r-m); }
  .panel .tbl-wrap { margin: 0 -14px; padding: 0 14px; }
  .mhero { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .board { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .board-wrap { padding: 14px; margin-left: -2px; margin-right: -2px; }
  .cell { height: 36px; font-size: 13px; }
  .bigbtns { grid-template-columns: 1fr; }
  .sup-cols { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 94vh; border-radius: var(--r-l) var(--r-l) 0 0; }
  .modal footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1; }
  .prow { grid-template-columns: 1fr 1fr; } .prow .p-other { grid-column: 1 / -1; }
  .parts:not(:has(.segment)) .prow { grid-template-columns: 1fr 1fr; }
  .lrow { grid-template-columns: 1fr 1fr 1fr; } .lrow [name=d] { grid-column: 1 / -1; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px; } .login-brand h1 { font-size: 38px; margin-top: 14px; } .login-board { display: none; }
  .login-form { padding: 24px 20px 40px; }
  .actbar .btn { flex: 1 1 calc(50% - 8px); }
  .actbar .more { flex: 1 1 calc(50% - 8px); } .actbar .more .btn { width: 100%; }
  .tbl { font-size: 14px; }
  .frow select, .frow input[type=date] { min-width: 0; flex: 1 1 calc(50% - 4px); }
  .frow .search-in { flex: 1 1 100%; }
  .frow .dlab { flex: 1 1 calc(50% - 4px); } .frow .dlab input { flex: 1; min-width: 0; }
  .invoice { padding: 18px; } .inv-to { grid-template-columns: 1fr; }
  .person { grid-template-columns: 1fr auto; } .person > div:first-child { grid-column: 1; grid-row: 1; } .person > button { grid-column: 2; grid-row: 1; } .pm { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  #toasts { bottom: 76px; }
}

/* ---------- v4: maintenance, machines for sale, yards, log sheet photo ---------- */
.st-res { background: var(--amber-soft); color: var(--amber-d); }
:root[data-theme="dark"] .st-res { color: var(--gold-2); }
.chip-sale { background: var(--amber-soft); border-color: var(--amber-d); color: var(--text); }
.chip-sold { background: var(--off-soft); border-color: transparent; color: var(--text); }
.chip-new { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.strip-h { font: 600 13px/1 var(--f); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 8px; display: flex; gap: 12px; align-items: center; }
.strip-h .lnk { text-transform: none; letter-spacing: 0; font-size: 13px; }
.dlab { font-size: 13px; color: var(--muted); }
/* jobs list: one row per job, collapses to a card on phones */
.jlist { border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; background: var(--surface); }
.jrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) 200px 150px; gap: 12px; align-items: start; padding: 12px 14px; text-decoration: none; border-top: 1px solid var(--line-2); }
.jrow:first-child { border-top: 0; }
.jrow:hover { background: var(--surface-2); }
.jrow-n { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.jrow-n b { font: 600 16px/1.1 var(--fc); }
.jrow-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.jrow-mc { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jrow-m, .jrow-d { color: var(--text); }
.jrow .ic { vertical-align: -2px; color: var(--muted); }
.panel .jlist { border-radius: var(--r-m); }
/* job page */
.mstrip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); text-decoration: none; margin-bottom: 14px; }
.mstrip .ms-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mstrip .ms-t { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mstrip small { color: var(--muted); }
button.lnk { background: none; border: 0; padding: 0; cursor: pointer; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { border-top: 1px solid var(--line-2); }
.checklist li:first-child { border-top: 0; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 2px; cursor: pointer; }
.checklist input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--hire); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.cl-add { display: flex; gap: 8px; margin-top: 10px; }
.cl-add input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
/* machine page: maintenance tab */
.mt-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; margin-bottom: 18px; }
.mt-card { background: var(--surface); padding: 14px 16px; }
.mt-card h3 { font: 600 13px/1.2 var(--f); color: var(--muted); margin-bottom: 8px; }
.mt-card p:last-child { margin-bottom: 0; }
.tabpanel > .panel-h { margin-top: 22px; }
.tabpanel > .mt-top + .panel-h { margin-top: 0; }
.fleet-hist { list-style: none; margin: 0; padding: 0; }
.fleet-hist li { padding: 9px 0; border-top: 1px solid var(--line-2); }
.fleet-hist li:first-child { border-top: 0; }
.fleet-hist .ic { vertical-align: -2px; }
/* yards */
.ygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.ycard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; }
.ycard.off { opacity: .6; }
.ycard-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.ycard h2 { font: 600 22px/1.1 var(--fc); }
.ycard h2 a { text-decoration: none; }
.ynums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r-m); overflow: hidden; margin-top: 12px; }
.ynum { background: var(--surface); padding: 10px 12px; text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.ynum:hover { background: var(--surface-2); }
.ynum b { font: 600 24px/1 var(--fc); font-variant-numeric: tabular-nums; }
.ynum span { font-size: 12.5px; color: var(--muted); }
/* log sheet photo and reading it */
.ls-photo { border: 1px dashed var(--line); border-radius: var(--r-l); padding: 12px; margin-bottom: 14px; background: var(--surface-2); }
.ls-photo-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.ls-photo-prev img { max-height: 160px; border-radius: var(--r-m); border: 1px solid var(--line); margin: 6px 0; }
.ls-photo p { margin: 0; }
.field.ai-filled input, .field.ai-filled select, .field.ai-filled textarea { border-color: var(--amber); background: var(--amber-soft); }
.ls-cam { width: 30px; height: 30px; vertical-align: middle; }
@media (max-width: 700px) {
  .jrow { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .jrow-n { grid-column: 2; grid-row: 1; align-items: flex-end; }
  .jrow-t { grid-column: 1; grid-row: 1; }
  .jrow-m { grid-column: 1; }
  .jrow-d { grid-column: 2; text-align: right; }
  .ygrid { grid-template-columns: 1fr; }
  /* parts table becomes a list on phones */
  .ptbl thead { display: none; }
  .ptbl, .ptbl tbody, .ptbl tfoot { display: block; }
  .ptbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); }
  .ptbl td { display: block; padding: 0; border: 0; font-size: 13.5px; }
  .ptbl td.pt-part { flex: 1 1 100%; order: -1; font-size: 14.5px; }
  .ptbl td.pt-qty::before { content: '× '; color: var(--muted); }
  .ptbl td.pt-mech { color: var(--muted); }
  .ptbl td.pt-from .muted { display: inline; margin-left: 4px; }
  .ptbl td.pt-cost, .ptbl td.pt-del { margin-left: auto; }
  .ptbl td.pt-cost + td.pt-del { margin-left: 0; }
  .ptbl tfoot tr { justify-content: space-between; border-bottom: 0; }
  .ptbl tbody tr:hover td { background: none; }
  .ynums { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- print (invoice) ---------- */
@media print {
  body { background: #fff; }
  .side, .top, .bottom, .phead, .noprint, .demo-bar, #toasts, #bdpops { display: none !important; }
  .app { display: block; } #page { padding: 0; max-width: none; }
  .invoice { border: 0; padding: 0; max-width: none; }
}
.imp-sheets section { border-top: 1px solid var(--line-2); padding: 10px 0 2px; }
.imp-sheets section:first-child { border-top: 0; }
.imp-sheets h3 { font: 600 15px/1.2 var(--f); margin: 0 0 4px; }
