/* =============================================================================================
   Swiss Workshop — design system
   Navy ink, workshop green, cool paper. Inter for the interface, JetBrains Mono only where a
   character matters: number plates, job numbers, money, hours.
   The signature device is the stage track — the car's route through the workshop — used on the
   board, the job page and the customer's tracking page. Everything else stays quiet.
   Sections: 1 tokens · 2 base · 3 shell · 4 page · 5 components · 6 job & board · 7 forms
             8 tables & lists · 9 floor (touch) · 10 wall board · 11 print · 12 utilities
   ============================================================================================= */

/* ---- 1. tokens ------------------------------------------------------------------------------ */
@font-face { font-family: "Inter"; src: url("../lib/fonts/inter-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../lib/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../lib/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #001433;          /* navy — text, rail, headings */
  --ink-2: #0d2547;        /* rail hover */
  --ink-3: #2b3f5e;        /* secondary text on light */
  --muted: #5d6b80;        /* captions — AA on white and paper */
  --primer: #8a96a8;       /* disabled, placeholder */
  --line: #dfe5ee;
  --line-strong: #c8d1de;
  --paper: #f3f5f8;
  --surface: #ffffff;
  --brand: #1f9d6b;        /* workshop green — fills, icons, focus */
  --brand-strong: #14794f; /* green behind white text (AA) */
  --brand-soft: #e5f4ed;
  --amber: #f2a900;        /* holds and waiting */
  --amber-ink: #8a5a00;
  --amber-soft: #fff4d6;
  --red: #d64545;          /* overdue, damage, declined */
  --red-ink: #a8283a;
  --red-soft: #fdecee;
  --blue: #2563c9;
  --blue-soft: #e8f0fc;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-lg: 14px;
  --r: 10px;
  --r-sm: 6px;
  --rail-w: 232px;
  --top-h: 60px;
  --tab-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-primary: var(--brand-strong);
  --bs-primary-rgb: 20, 121, 79;
  --bs-link-color: var(--brand-strong);
  --bs-link-color-rgb: 20, 121, 79;
  --bs-link-hover-color: var(--ink);
  --bs-border-radius: var(--r);
  --bs-border-radius-sm: var(--r-sm);
  --bs-border-radius-lg: var(--r-lg);
  --bs-focus-ring-color: rgba(31, 157, 107, .35);
}

/* ---- 2. base -------------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper); font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4, h5 { color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { white-space: nowrap; }
.muted, .text-muted { color: var(--muted) !important; }
.small-caption { font-size: .8rem; color: var(--muted); }
hr { border-color: var(--line); opacity: 1; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- 3. shell ------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #c9d3e3; display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; }
.rail-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px; letter-spacing: -.02em; flex: none; }
.rail-brand .name { font-weight: 650; line-height: 1.15; font-size: .95rem; }
.rail-brand .shop { display: block; font-weight: 400; font-size: .76rem; color: #8fa0bb; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-group { margin: 10px 0 4px; padding: 0 12px; font-size: .72rem; color: #6f82a1; }
.rail a.rail-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: #c9d3e3; font-weight: 500; font-size: .92rem; position: relative; }
.rail a.rail-link i { font-size: 1.1rem; width: 20px; text-align: center; color: #8fa0bb; }
.rail a.rail-link:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.rail a.rail-link.active { background: #fff; color: var(--ink); }
.rail a.rail-link.active i { color: var(--brand); }
.rail a.rail-link .count { margin-left: auto; font-family: var(--mono); font-size: .75rem; background: rgba(255,255,255,.1); color: #fff; padding: 1px 7px; border-radius: 20px; }
.rail a.rail-link.active .count { background: var(--brand-soft); color: var(--brand-strong); }
.rail-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; color: #8fa0bb; }
.rail-foot a { color: #c9d3e3; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--top-h); background: rgba(243,245,248,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; padding: 0 12px 0 38px; font-size: .93rem; }
.topbar .search i { position: absolute; left: 13px; top: 11px; color: var(--muted); }
.topbar .search kbd { position: absolute; right: 9px; top: 9px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); font-size: .72rem; }
.topbar .who { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-weight: 650; font-size: .8rem; flex: none; }
.acting-banner { background: var(--amber); color: var(--ink); text-align: center; font-weight: 600; padding: 6px 12px; font-size: .9rem; }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.content.wide { max-width: none; }

.menu-btn { display: none; width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.4rem; color: var(--ink); border-radius: 10px; }
.tabbar { display: none; }
.rail-scrim { display: none; }

@media (max-width: 991.98px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 1050; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .22s var(--ease); }
  body.rail-open .rail { transform: none; box-shadow: 0 0 40px rgba(0,20,51,.35); }
  body.rail-open .rail-scrim { display: block; position: fixed; inset: 0; background: rgba(0,20,51,.4); z-index: 1040; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 0 12px; }
  .topbar .search kbd { display: none; }
  .content { padding: 16px 16px calc(var(--tab-h) + 24px); }
  body { font-size: 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 1030; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 600; }
  .tabbar a i { font-size: 1.35rem; }
  .tabbar a.active { color: var(--brand-strong); }
  .tabbar a.tab-new i { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-strong); color: #fff; margin-top: -18px; box-shadow: 0 6px 16px rgba(20,121,79,.35); }
  .hide-mobile { display: none !important; }
}
@media (min-width: 992px) { .show-mobile { display: none !important; } }

/* ---- 4. page -------------------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: .93rem; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.section-title h2, .section-title h3 { margin: 0; }

/* ---- 5. components -------------------------------------------------------------------------- */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel { padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 14px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1rem; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > .panel-head { padding: 16px 20px 0; }

.btn { font-weight: 600; border-radius: 9px; padding: .5rem .95rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { padding: .32rem .7rem; border-radius: 7px; font-size: .84rem; }
.btn-lg { padding: .8rem 1.3rem; font-size: 1.02rem; border-radius: 11px; }
.btn-primary { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-primary:hover, .btn-primary:focus { background: #0f6641; border-color: #0f6641; }
.btn-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-ink:hover { background: var(--ink-2); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); background: #fff; color: var(--ink); }
.btn-ghost { background: transparent; border: 0; color: var(--ink-3); }
.btn-ghost:hover { background: rgba(0,20,51,.06); color: var(--ink); }
.btn-danger { background: var(--red-ink); border-color: var(--red-ink); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-icon { width: 38px; height: 38px; padding: 0; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill-muted { background: #eef1f5; color: var(--ink-3); }
.pill-green { background: var(--brand-soft); color: var(--brand-strong); }
.pill-amber { background: var(--amber-soft); color: var(--amber-ink); }
.pill-rose { background: var(--red-soft); color: var(--red-ink); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-navy { background: var(--ink); color: #fff; }

/* SA number plate. The one ornament this product allows itself. */
.plate { display: inline-block; font-family: var(--mono); font-weight: 600; font-size: .86rem; letter-spacing: .04em; padding: 1px 8px; border: 1.5px solid var(--ink); border-radius: 5px; background: #fff; color: var(--ink); white-space: nowrap; line-height: 1.5; }
.plate-lg { font-size: 1.2rem; padding: 3px 12px; border-width: 2px; border-radius: 7px; }
.plate-none { border-style: dashed; color: var(--muted); border-color: var(--line-strong); font-family: var(--font); font-weight: 500; letter-spacing: 0; }
.jobno { font-family: var(--mono); font-weight: 600; font-size: .86rem; color: var(--ink-3); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: block; color: var(--ink); }
a.kpi:hover { border-color: var(--ink); text-decoration: none; }
.kpi .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.kpi.tone-amber { border-left: 4px solid var(--amber); }
.kpi.tone-red { border-left: 4px solid var(--red); }
.kpi.tone-green { border-left: 4px solid var(--brand); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--primer); display: block; margin-bottom: 8px; }
.empty h3 { color: var(--ink); font-size: 1rem; margin-bottom: 4px; }

.flash { border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.flash-ok { background: var(--brand-soft); color: #0d5236; }
.flash-error { background: var(--red-soft); color: var(--red-ink); }
.flash-warn { background: var(--amber-soft); color: var(--amber-ink); }

.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,20,51,.25); max-width: 380px; font-weight: 500; }
.toast-msg.err { background: var(--red-ink); }
@media (max-width: 991.98px) { .toast-host { bottom: calc(var(--tab-h) + 12px); left: 12px; right: 12px; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .92rem; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
.tabs a .count { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-left: 4px; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; font-size: .88rem; }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.t-key::before { background: var(--brand); }
.timeline li.t-warn::before { background: var(--amber); }
.timeline li.t-bad::before { background: var(--red); }
.timeline .when { font-size: .78rem; color: var(--muted); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; position: relative; border-radius: var(--r); overflow: hidden; background: #e9edf2; aspect-ratio: 4/3; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: .75rem; color: #fff; background: linear-gradient(transparent, rgba(0,20,51,.75)); }

.money-total { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; max-width: 360px; margin-left: auto; }
.money-total .lbl { color: var(--muted); text-align: right; }
.money-total .val { font-family: var(--mono); text-align: right; }
.money-total .grand { font-weight: 700; font-size: 1.1rem; color: var(--ink); border-top: 1px solid var(--line); padding-top: 6px; }

/* ---- 6. job & board ------------------------------------------------------------------------- */
/* The stage track: where this car is on its route through the workshop. */
.track { display: flex; gap: 3px; margin: 4px 0; }
.track .seg { flex: 1; min-width: 0; height: 8px; border-radius: 3px; background: #e2e7ee; position: relative; }
.track .seg.done { background: var(--brand); }
.track .seg.now { background: var(--ink); }
.track .seg.now.hold { background: var(--amber); }
.track-labels { display: flex; gap: 3px; }
.track-labels span { flex: 1; min-width: 0; font-size: .7rem; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-labels span.now { color: var(--ink); font-weight: 700; }
.track-lg .seg { height: 12px; border-radius: 4px; }
.track-lg + .track-labels span { font-size: .78rem; }

.job-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; margin-bottom: 18px; }
.job-head .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job-head h1 { font-size: 1.45rem; margin: 0; }
.job-head .meta { color: var(--muted); font-size: .92rem; margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
@media (max-width: 767.98px) { .job-head { grid-template-columns: 1fr; } }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; min-height: 60vh; }
.lane { background: #e9edf3; border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 650; }
.lane-head i { color: var(--brand-strong); }
.lane-head .count { margin-left: auto; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.lane-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; flex: 1; }
.lane-body.drop-hover { outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 10px; }

.jcard { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px 10px 14px; display: block; color: var(--ink); position: relative; cursor: grab; touch-action: manipulation; }
.jcard:hover { border-color: var(--line-strong); text-decoration: none; }
.jcard::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--brand); }
.jcard.is-hold::before { background: var(--amber); }
.jcard.is-late::before { background: var(--red); }
.jcard .row1 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.jcard .car { font-weight: 600; font-size: .88rem; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jcard .who { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jcard .foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.jcard .age { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-left: auto; }
.jcard .age.warn { color: var(--amber-ink); font-weight: 600; }
.jcard .age.bad { color: var(--red-ink); font-weight: 600; }
.jcard .techs { display: flex; }
.jcard .techs .avatar { width: 24px; height: 24px; font-size: .66rem; border: 2px solid #fff; margin-left: -6px; }
.jcard .techs .avatar:first-child { margin-left: 0; }
.jcard .live { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(31,157,107,.2); }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 12px 28px rgba(0,20,51,.2); }

/* ---- 7. forms ------------------------------------------------------------------------------- */
.form-label { font-weight: 600; font-size: .86rem; color: var(--ink-3); margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--line-strong); border-radius: 9px; padding: .55rem .8rem; color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(31,157,107,.18); }
.form-control::placeholder { color: var(--primer); }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--brand-strong); border-color: var(--brand-strong); }
.input-group-text { background: var(--paper); border-color: var(--line-strong); color: var(--muted); }
.field-validation-error, .text-danger { color: var(--red-ink) !important; font-size: .84rem; }
.input-validation-error { border-color: var(--red) !important; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 575.98px) { .form-grid .span-2 { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { border: 1.5px solid var(--line-strong); border-radius: 11px; padding: 12px 14px; cursor: pointer; background: #fff; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.choice label i { font-size: 1.2rem; color: var(--muted); }
.choice label small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.choice input:checked + label { border-color: var(--brand-strong); background: var(--brand-soft); }
.choice input:checked + label i { color: var(--brand-strong); }
.choice input:focus-visible + label { outline: 3px solid var(--brand); outline-offset: 2px; }
@media (hover: none) { .form-control, .form-select, .btn { min-height: 44px; } }

/* ---- 8. tables & lists ---------------------------------------------------------------------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .78rem; font-weight: 600; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover > * { --bs-table-bg-state: #f6f9fc; }
.table td.num, .table th.num { text-align: right; }
tr[data-href] { cursor: pointer; }
.table-wrap { overflow-x: auto; }
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border-bottom: 1px solid var(--line); padding: 10px 4px; }
  .table-stack td { border: 0 !important; padding: 2px 12px !important; text-align: left !important; }
  .table-stack td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .8rem; margin-right: 6px; }
}
.rows { display: flex; flex-direction: column; }
.rows > a, .rows > .row-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.rows > a:last-child, .rows > .row-item:last-child { border-bottom: 0; }
.rows > a:hover { background: #f8fafc; text-decoration: none; }
.rows .grow { flex: 1; min-width: 0; }
.rows .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .s { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .form-control, .filters .form-select { width: auto; min-width: 160px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-3); font-weight: 600; font-size: .85rem; }
.chip:hover { border-color: var(--ink); text-decoration: none; color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .count { font-family: var(--mono); font-size: .75rem; opacity: .8; }

/* ---- 9. floor (technician, touch-first) ----------------------------------------------------- */
.floor-job { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: block; color: var(--ink); }
.floor-job + .floor-job { margin-top: 12px; }
.floor-job.running { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,157,107,.15); }
.clock-btn { width: 100%; min-height: 64px; font-size: 1.1rem; border-radius: 14px; }
.clock-face { font-family: var(--mono); font-size: 2.4rem; font-weight: 600; letter-spacing: -.02em; }
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.big-actions .btn { min-height: 64px; flex-direction: column; gap: 4px; font-size: .9rem; border-radius: 14px; }
.big-actions .btn i { font-size: 1.4rem; }

/* ---- 10. wall board (TV) -------------------------------------------------------------------- */
body.wall { background: #000d22; color: #e8eef7; font-size: 18px; }
.wall-top { display: flex; align-items: center; gap: 24px; padding: 16px 24px; border-bottom: 1px solid #13284a; }
.wall-top .clock { font-family: var(--mono); font-size: 2.2rem; font-weight: 600; color: #fff; }
.wall-top .stat { font-size: .95rem; color: #8fa0bb; }
.wall-top .stat b { display: block; font-size: 1.8rem; color: #fff; font-weight: 700; }
.wall-top .stat.warn b { color: var(--amber); }
.wall-top .stat.bad b { color: #ff7a7a; }
.wall-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 10px; padding: 16px; height: calc(100vh - 100px); }
.wall-lane { background: #061a38; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.wall-lane h2 { color: #fff; font-size: 1.05rem; padding: 12px 14px 6px; margin: 0; display: flex; justify-content: space-between; }
.wall-lane h2 span { font-family: var(--mono); color: #8fa0bb; }
.wall-lane .cards { padding: 6px 8px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.wcard { background: #0d2547; border-radius: 10px; padding: 10px 12px; border-left: 5px solid var(--brand); }
.wcard.is-hold { border-left-color: var(--amber); }
.wcard.is-late { border-left-color: #ff5c5c; animation: pulse 3s ease-in-out infinite; }
.wcard .plate { font-size: 1.05rem; background: #fff; }
.wcard .car { color: #c9d3e3; font-size: .9rem; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard .bar { height: 5px; border-radius: 3px; background: #13284a; margin-top: 8px; overflow: hidden; }
.wcard .bar span { display: block; height: 100%; background: var(--brand); }
.wcard .bar span.warn { background: var(--amber); }
.wcard .bar span.bad { background: #ff5c5c; }
.wcard .meta { display: flex; justify-content: space-between; color: #8fa0bb; font-size: .8rem; margin-top: 4px; font-family: var(--mono); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255,92,92,.25); } }

/* ---- 11. print ------------------------------------------------------------------------------ */
.doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 36px 40px; border: 1px solid var(--line); border-radius: var(--r-lg); font-size: 13.5px; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid var(--ink); padding-bottom: 16px; margin-bottom: 18px; }
.doc-head img { max-height: 70px; max-width: 220px; }
.doc h1 { font-size: 1.5rem; margin: 0; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th { text-align: left; font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--ink); padding: 6px 4px; }
.doc td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc .num { text-align: right; }
.doc .sig { height: 70px; border-bottom: 1px solid var(--ink); }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; font-size: 12px; }
  .rail, .topbar, .tabbar, .no-print, .toast-host, .acting-banner { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; max-width: none; border-radius: 0; }
  a { color: inherit; }
}

/* ---- 12. utilities -------------------------------------------------------------------------- */
.gap-grid { display: grid; gap: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1199.98px) { .two-col { grid-template-columns: 1fr; } }
.stack-sm > * + * { margin-top: 8px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-650 { font-weight: 650; }
.text-ink { color: var(--ink) !important; }
.text-brand { color: var(--brand-strong) !important; }
.text-amber { color: var(--amber-ink) !important; }
.text-red { color: var(--red-ink) !important; }
.bg-paper { background: var(--paper); }
.sig-pad { width: 100%; height: 180px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: #fff; touch-action: none; display: block; }
.gap-grid > .panel + .panel, .two-col > * > .panel + .panel { margin-top: 0; }
@media (max-width: 575.98px) {
  .rows > a, .rows > .row-item { flex-wrap: wrap; row-gap: 6px; }
  .rows .grow { flex: 1 1 55%; }
  .rows > a > .pill, .rows > .row-item > .pill { margin-left: auto; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
}

/* =============================================================================================
   13. density pass (Oct 2026 review) — tighter rhythm on desktop, two-up tiles on phones.
   Desktop runs at 14px with 8px-based spacing; touch devices keep 16px and 44px targets.
   ============================================================================================= */
@media (min-width: 992px) {
  body { font-size: 14px; }
  .content { padding: 20px 24px 32px; }
  h1 { font-size: 1.4rem; }
  .page-head { margin-bottom: 16px; }
  .page-head .sub { font-size: .88rem; margin-top: 2px; }
  .topbar { height: 56px; }
  .rail a.rail-link { padding: 8px 12px; font-size: .9rem; }
}
.panel:not(.panel-flush) { padding: 14px 16px; }
.panel-head { margin: 0 0 10px; }
.panel-flush > .panel-head { padding: 12px 16px 0; }
.rows > a, .rows > .row-item { padding: 9px 16px; gap: 10px; }
.rows .s { font-size: .8rem; }

/* tables: one line per row wherever possible */
.table { font-size: .9rem; }
.table > :not(caption) > * > * { padding: .5rem .75rem; }
.table thead th { font-size: .72rem; padding-top: .55rem; padding-bottom: .55rem; }
.table .small-caption, .rows .small-caption { font-size: .75rem; line-height: 1.25; margin-top: 1px; }
.table .plate { font-size: .76rem; padding: 0 6px; border-width: 1.25px; line-height: 1.45; }
.table .pill { font-size: .72rem; padding: 0 8px; }
.table .btn-sm { padding: .2rem .55rem; }
.jobno, .plate, .pill, .chip, .num { white-space: nowrap; }

/* pills & chips a touch quieter */
.pill { font-size: .75rem; padding: 1px 9px; line-height: 1.5; }
.chip { padding: 5px 11px; font-size: .82rem; }

/* KPI tiles: compact, two-up on phones */
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { padding: 10px 14px; }
.kpi .v { font-size: 1.45rem; }
.kpi .l { font-size: .78rem; margin-top: 2px; line-height: 1.3; }
@media (max-width: 575.98px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi .v { font-size: 1.3rem; }
}

/* stage track: on phones only the current stage is named */
@media (max-width: 575.98px) {
  .track-labels span { visibility: hidden; flex: 1; }
  .track-labels span.now { visibility: visible; overflow: visible; text-align: left; }
}

/* board cards */
.jcard { padding: 8px 10px 8px 12px; }
.jcard .row1 { flex-wrap: nowrap; }
.jcard .plate { font-size: .78rem; padding: 0 6px; }
.jcard .jobno { font-size: .76rem; }
.jcard .car { margin-top: 5px; font-size: .85rem; }
.jcard .foot { margin-top: 6px; }
.board { grid-auto-columns: minmax(230px, 1fr); gap: 10px; }
.lane-head { padding: 10px 12px 6px; font-size: .92rem; }
.lane-body { gap: 6px; padding: 2px 6px 8px; }

/* forms a little tighter on desktop */
@media (min-width: 992px) {
  .form-control, .form-select { padding: .45rem .7rem; font-size: .9rem; }
  .form-label { font-size: .8rem; margin-bottom: .2rem; }
  .form-grid { gap: 12px 14px; }
  .btn { padding: .42rem .85rem; font-size: .88rem; }
  .btn-sm { padding: .25rem .6rem; font-size: .8rem; }
}
.dl { gap: 4px 16px; }
.dl dt { font-size: .82rem; }
.tabs { margin-bottom: 14px; }
.tabs a { padding: 8px 12px; font-size: .88rem; }
