/* =====================================================================
   Fleet & Workforce Manager — styles (redesign prototype)
   ---------------------------------------------------------------------
   A dark, quiet interface: near-black surfaces, hairline borders instead
   of shadows, restrained type weights (400–590, never bold), and ONE
   acid-lime colour reserved for the single main action on each screen.
   Status is the only other place colour appears.

   HOW TO CHANGE THINGS
   Every colour, size and radius is a named setting in the first block.
   Change it there and it changes everywhere.
   ===================================================================== */

:root {
  /* ---- Surfaces, darkest to lightest ---- */
  --void:      #08090a;   /* page background */
  --carbon:    #0f1011;   /* sidebar, cards */
  --obsidian:  #161718;   /* dialogs, raised panels */
  --graphite:  #23252a;   /* hairline borders, selected items */
  --smoke:     #383b3f;   /* stronger borders */

  /* ---- Text, dimmest to brightest ---- */
  --ash:       #62666d;   /* least important text */
  --fog:       #8a8f98;   /* labels, secondary text */
  --mist:      #d0d6e0;   /* normal text */
  --paper:     #ffffff;   /* headings, names */

  /* ---- The one action colour ---- */
  --accent:       #e4f222;
  --accent-ink:   #08090a;
  --accent-hover: #eef85a;
  --link:         #d0d6e0;

  /* ---- Status (the only other colour on screen) ---- */
  --st-over:   #eb5757;   /* Overdue */
  --st-soon:   #f2994a;   /* Due soon */
  --st-stale:  #8a8f98;   /* Check data */
  --st-ok:     #27a644;   /* Up to date */

  /* ---- Tints laid over surfaces ---- */
  --tint-1:    rgba(255, 255, 255, .02);
  --tint-2:    rgba(255, 255, 255, .05);
  --tint-3:    rgba(255, 255, 255, .08);

  /* ---- Pieces that differ between the dark and light themes ---- */
  --page-bg:      var(--void);
  --pill-over-bg: rgba(235, 87, 87, .12);   --pill-over-fg: #ffb4b4;
  --pill-soon-bg: var(--tint-2);            --pill-soon-fg: var(--mist);
  --pill-ok-bg:   var(--tint-2);            --pill-ok-fg:   var(--mist);
  --pill-stale-bg: var(--tint-2);           --pill-stale-fg: var(--mist);
  --nav-on-bg:    var(--graphite);          --nav-on-fg:    var(--paper);
  --seg-on-bg:    var(--graphite);
  --sm-bg:        var(--tint-2);            --sm-fg: var(--fog);   --sm-hover-bg: var(--tint-3);   --sm-hover-fg: var(--paper);
  --btn-bg:       transparent;
  --glyph-bg:     var(--paper);             --glyph-fg: var(--void);
  --avatar-bg:    var(--graphite);          --avatar-fg: var(--mist);
  --mark:         var(--paper);             /* line marking the selected status count */
  --ring:         rgba(208, 214, 224, .55); --ring-line: var(--mist);
  --sel:          rgba(228, 242, 34, .28);
  --danger:       #eb5757;  --danger-hover: #ff8080;  --danger-line: rgba(235, 87, 87, .35);  --danger-bg: rgba(235, 87, 87, .1);
  --err:          #ff9b9b;
  --banner-bg:    var(--tint-1);            --banner-line: var(--smoke);
  --backdrop:     rgba(8, 9, 10, .72);
  --pop-shadow:   0 4px 32px rgba(8, 9, 10, .6);
  --w-strong:     510;
  --r-btn:        6px;

  /* ---- Shape ---- */
  --hair:      1px;       /* border thickness (half a pixel on sharp screens, see below) */
  --r-badge:   4px;
  --r-ctl:     6px;       /* buttons, inputs */
  --r-card:    12px;
  --r-pill:    9999px;

  /* ---- Type ---- */
  --sans: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --side-w: 244px;
}
@media (min-resolution: 2dppx) { :root { --hair: .5px; } }

/* =====================================================================
   LIGHT THEME — bright and colourful
   White cards on a soft cool-grey page, near-black text, one saturated
   blue for actions, pill-shaped buttons, and status shown in full colour.
   Switched with the sun/moon button; the choice is remembered per browser.
   ===================================================================== */
:root[data-theme="light"] {
  --void:      #f3f6f6;   /* page background */
  --carbon:    #ffffff;   /* sidebar, cards */
  --obsidian:  #ffffff;   /* dialogs, menus */
  --graphite:  #e4e7ea;   /* hairlines */
  --smoke:     #d2d2d7;   /* stronger borders */

  --ash:       #76767b;   /* least important text */
  --fog:       #6e6e73;   /* labels, secondary text */
  --mist:      #36363a;   /* normal text */
  --paper:     #1d1d1f;   /* headings, names */

  --accent:       #0071e3;
  --accent-ink:   #ffffff;
  --accent-hover: #0077ed;
  --link:         #0066cc;

  --st-over:   #ff3b30;
  --st-soon:   #ff9500;
  --st-stale:  #8e8e93;
  --st-ok:     #34c759;

  --tint-1:    rgba(0, 20, 60, .025);
  --tint-2:    rgba(0, 20, 60, .05);
  --tint-3:    rgba(0, 20, 60, .09);

  --page-bg:      radial-gradient(1100px 520px at 78% -8%, rgba(0, 113, 227, .10), transparent 62%),
                  radial-gradient(900px 480px at 8% 0%, rgba(52, 199, 89, .06), transparent 60%), #f3f6f6;
  --pill-over-bg: rgba(255, 59, 48, .13);   --pill-over-fg: #c5221a;
  --pill-soon-bg: rgba(255, 149, 0, .17);   --pill-soon-fg: #a34a00;
  --pill-ok-bg:   rgba(52, 199, 89, .17);   --pill-ok-fg:   #1a7a37;
  --pill-stale-bg: #e8e8ed;                 --pill-stale-fg: #515154;
  --nav-on-bg:    rgba(0, 113, 227, .11);   --nav-on-fg:    #0066cc;
  --seg-on-bg:    #ffffff;
  --sm-bg:        rgba(0, 113, 227, .08);   --sm-fg: #0066cc;   --sm-hover-bg: rgba(0, 113, 227, .16);   --sm-hover-fg: #004f9e;
  --btn-bg:       #ffffff;
  --glyph-bg:     linear-gradient(160deg, #2997ff, #0058b9);   --glyph-fg: #ffffff;
  --avatar-bg:    rgba(0, 113, 227, .12);   --avatar-fg: #0066cc;
  --mark:         #0071e3;
  --ring:         rgba(0, 113, 227, .45);   --ring-line: #0071e3;
  --sel:          rgba(0, 113, 227, .2);
  --danger:       #d70015;  --danger-hover: #a8000f;  --danger-line: rgba(215, 0, 21, .3);  --danger-bg: rgba(255, 59, 48, .09);
  --err:          #c5221a;
  --banner-bg:    rgba(0, 113, 227, .06);   --banner-line: rgba(0, 113, 227, .28);
  --backdrop:     rgba(29, 29, 31, .32);
  --pop-shadow:   0 12px 40px rgba(0, 30, 80, .16), 0 2px 6px rgba(0, 30, 80, .06);
  --w-strong:     590;
  --r-btn:        980px;
  --r-ctl:        10px;
  --r-card:       16px;
  color-scheme: light;
}
/* Status counts become four cards, each washed in its own colour */
[data-theme="light"] .stats { background: none; box-shadow: none; gap: 14px; overflow: visible; }
[data-theme="light"] .stat { background: var(--carbon); border: 0 !important; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--graphite); padding: 18px 20px; }
[data-theme="light"] .stat.over  { background: linear-gradient(155deg, #fff 35%, #ffe4e1); }
[data-theme="light"] .stat.soon  { background: linear-gradient(155deg, #fff 35%, #ffeed3); }
[data-theme="light"] .stat.stale { background: linear-gradient(155deg, #fff 35%, #ecedf1); }
[data-theme="light"] .stat.ok    { background: linear-gradient(155deg, #fff 35%, #dcf7e4); }
[data-theme="light"] .stat.over b  { color: #d92d22; }
[data-theme="light"] .stat.soon b  { color: #c66a00; }
[data-theme="light"] .stat.ok b    { color: #1f9345; }
[data-theme="light"] .stat b { font-weight: 590; }
[data-theme="light"] .stat:hover { box-shadow: inset 0 0 0 1px var(--smoke); }
[data-theme="light"] .stat.over[aria-pressed="true"]  { box-shadow: inset 0 0 0 2px #ff3b30; }
[data-theme="light"] .stat.soon[aria-pressed="true"]  { box-shadow: inset 0 0 0 2px #ff9500; }
[data-theme="light"] .stat.stale[aria-pressed="true"] { box-shadow: inset 0 0 0 2px #8e8e93; }
[data-theme="light"] .stat.ok[aria-pressed="true"]    { box-shadow: inset 0 0 0 2px #34c759; }
[data-theme="light"] .stat-k { color: var(--mist); font-weight: 510; }
/* Sidebar: the page you are on is blue; counts sit in small chips */
[data-theme="light"] .side nav button.on svg { opacity: 1; }
[data-theme="light"] .side nav button .n { background: var(--tint-2); padding: 0 6px; border-radius: 980px; color: var(--fog); }
[data-theme="light"] .side nav button .n.alert { background: #ff3b30; color: #fff; }
[data-theme="light"] .subnav button.on { box-shadow: 0 1px 3px rgba(0, 30, 80, .14); }
[data-theme="light"] h3 { color: var(--mist); }
[data-theme="light"] th { color: var(--fog); }
[data-theme="light"] .timeline .ev::before { box-shadow: 0 0 0 2px var(--accent); background: #fff; }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background-color: #fff; border-color: var(--smoke); }
[data-theme="light"] .rec-title h2, [data-theme="light"] .page-head h2 { font-weight: 590; }


/* =====================================================================
   BASICS
   ===================================================================== */
* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--void); scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--page-bg);
  background-attachment: fixed;
  min-height: 100vh;
  display: flow-root;   /* keeps the sign-in card's top margin inside the page background */
  color: var(--mist);
  font: 400 14px/1.5 var(--sans);
  font-feature-settings: "cv01" on, "ss03" on, "zero" on;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
h1, h2, h3 { margin: 0; color: var(--paper); font-weight: 510; letter-spacing: -.012em; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 13px; line-height: 1.4; color: var(--fog); font-weight: 510; letter-spacing: -.005em; }
b, strong { font-weight: var(--w-strong); color: var(--paper); }
p { margin: 8px 0; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--paper); }
.mute { color: var(--fog); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.013em; color: var(--fog); }
.num  { text-align: right; font-variant-numeric: tabular-nums; }
.pad  { padding: 16px; }
.sp   { flex: 1; }
.gap  { margin-top: 32px; }
.sr   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--sel); }
* { scrollbar-width: thin; scrollbar-color: var(--smoke) transparent; }

/* =====================================================================
   APP SHELL — sidebar on the left, page on the right
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px;
  background: var(--carbon);
  border-right: var(--hair) solid var(--graphite);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; min-width: 0; }
.glyph {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--glyph-bg); color: var(--glyph-fg);
  font-size: 12px; font-weight: 590; letter-spacing: 0;
}
.brand-name { color: var(--paper); font-weight: 510; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { padding: 14px 8px 4px; font-size: 12px; color: var(--ash); font-weight: 510; }
.side nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: var(--r-ctl);
  background: none; color: var(--fog);
  font-size: 13px; font-weight: 400; text-align: left;
}
.side nav button svg { flex: none; width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.side nav button:hover { background: var(--tint-2); color: var(--mist); }
.side nav button.on { background: var(--nav-on-bg); color: var(--nav-on-fg); font-weight: 510; }
.side nav button .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ash); }
.side nav button .n.alert { color: var(--st-over); }

.side-foot { margin-top: auto; padding-top: 10px; border-top: var(--hair) solid var(--graphite); display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--avatar-bg); color: var(--avatar-fg);
  font-size: 11px; font-weight: 510; letter-spacing: 0;
}
.me-txt { display: grid; min-width: 0; line-height: 1.3; }
.me-txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { font-size: 11px; color: var(--ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 2px; }

main { min-width: 0; padding: 28px 36px 64px; max-width: 1320px; width: 100%; }
.narrow { max-width: 860px; }

/* Page title row */
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { margin: 2px 0 0; font-size: 13px; color: var(--fog); }
.page-head .count { font-family: var(--mono); font-size: 12px; color: var(--ash); margin-left: 8px; font-weight: 400; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ash); }
.crumbs button { padding: 2px 6px; margin-left: -6px; border: 0; background: none; color: var(--fog); }
.crumbs button:hover { color: var(--paper); background: var(--tint-2); }
.crumbs button { border-radius: var(--r-ctl); }

/* =====================================================================
   BUTTONS — quiet by default; lime only for the one main action
   ===================================================================== */
button, a.btn {
  font: inherit; font-size: 13px; line-height: 1.4;
  cursor: pointer;
  padding: 6px 12px;
  border: var(--hair) solid var(--graphite);
  border-radius: var(--r-btn);
  background: var(--btn-bg);
  color: var(--mist);
  transition: background .12s, border-color .12s, color .12s;
}
a.btn { display: inline-block; text-decoration: none; }
button:hover, a.btn:hover { background: var(--tint-2); border-color: var(--smoke); color: var(--paper); }
button:disabled { opacity: .35; cursor: default; }
button.pri, a.btn.pri {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 510;
}
button.pri:hover, a.btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
/* Small buttons inside tables and rows: text-only until pointed at */
button.sm { padding: 3px 10px; font-size: 12px; border-color: transparent; color: var(--sm-fg); background: var(--sm-bg); }
button.sm:hover { background: var(--sm-hover-bg); color: var(--sm-hover-fg); border-color: transparent; }
button.sm.pri { background: var(--accent); color: var(--accent-ink); }
button.sm.pri:hover { background: var(--accent-hover); color: var(--accent-ink); }
/* Destructive actions */
button.danger { color: var(--danger); border-color: var(--danger-line); background: transparent; }
button.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-hover); }
button.sm.danger { border-color: transparent; background: transparent; }

/* =====================================================================
   FORM FIELDS
   ===================================================================== */
input, select, textarea {
  font: inherit; font-size: 13px;
  width: 100%;
  padding: 8px 10px;
  border: var(--hair) solid var(--tint-3);
  border-radius: var(--r-ctl);
  background: var(--tint-1);
  color: var(--mist);
  transition: border-color .12s, background .12s;
}
input::placeholder, textarea::placeholder { color: var(--ash); }
input:hover, select:hover, textarea:hover { border-color: var(--smoke); }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a8f98' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
select option, select optgroup { background: var(--obsidian); color: var(--mist); }
input[type="search"] {
  padding-left: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2362666d' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='6' cy='6' r='4.2'/%3E%3Cpath d='M9.3 9.3L12.5 12.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
input[type="checkbox"] { accent-color: var(--mist); }
input[type="file"] { padding: 6px; color: var(--fog); }
input:disabled, select:disabled { opacity: .5; }
/* Keyboard focus: border brightens and a soft ring appears */
button:focus-visible, a.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px; border-color: var(--ring-line);
}
input:focus, select:focus, textarea:focus { border-color: var(--ring-line); outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* Toolbar row (search box, filters, action buttons) */
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.bar input, .bar select { width: auto; min-width: 150px; padding-top: 6px; padding-bottom: 6px; }
.bar input[type="search"] { min-width: 220px; }
.bar > span:not(.sp):not(.mute) { font-size: 12px; color: var(--fog); }
.chk { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--fog); }
.chk input { width: auto; min-width: 0; }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
/* The four status counts: one strip divided by hairlines, not four boxes */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--carbon);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 var(--hair) var(--graphite);
  overflow: hidden;
}
.stat {
  display: grid; gap: 2px; text-align: left;
  padding: 18px 20px 16px;
  border: 0; border-radius: 0;
  border-right: var(--hair) solid var(--graphite);
  background: none; color: var(--mist);
}
.stat:last-child { border-right: 0; }
.stat:hover { background: var(--tint-1); border-color: var(--graphite); }
.stat[aria-pressed="true"] { background: var(--tint-2); box-shadow: inset 0 2px 0 var(--mark); }
.stat-k { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fog); }
.stat b { font-size: 32px; line-height: 1.13; font-weight: 400; letter-spacing: -.022em; color: var(--paper); font-variant-numeric: tabular-nums; }
.stat small { font-size: 12px; color: var(--ash); }

/* Status dot, used in the counts, pills and lists */
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--st-stale); }
.dot.over  { background: var(--st-over); box-shadow: 0 0 0 3px rgba(235, 87, 87, .16); }
.dot.soon  { background: var(--st-soon); }
.dot.stale { background: transparent; box-shadow: inset 0 0 0 1.5px var(--st-stale); }
.dot.ok    { background: var(--st-ok); }

/* Records on the left, recent activity on the right */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; margin-top: 28px; align-items: start; }
.dash-side { position: sticky; top: 20px; }
.sec-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.dash-main .bar { margin-top: 8px; }

/* =====================================================================
   PANELS AND TABLES
   ===================================================================== */
.box {
  background: var(--carbon);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 var(--hair) var(--graphite);
  overflow-x: auto;
  margin-top: 10px;
}
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: var(--hair) solid var(--graphite); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 510; font-size: 12px; color: var(--ash); padding-top: 9px; padding-bottom: 9px; }
td b { font-weight: 510; }
td .mute, td.mute { font-size: 12px; }
td.mono { white-space: nowrap; padding-top: 12px; }
tr[data-a] { cursor: pointer; }
tr[data-a]:hover td { background: var(--tint-1); }
/* Action buttons wrap onto a second line when space is short (longer words in Italian), always right-aligned */
td:last-child:has(button) { text-align: right; }
td:last-child button.sm, td:last-child details.more { margin: 2px 0 2px 4px; white-space: nowrap; }
/* Long words and codes wrap inside their cell instead of pushing the table wider than its card */
td { overflow-wrap: break-word; }
th { white-space: normal; hyphens: manual; overflow-wrap: normal; }
.rec-side dd.mono { color: var(--mist); }
/* "⋯" menu for the less common actions on a row */
details.more { display: inline-block; position: relative; vertical-align: middle; }
details.more summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 3px 8px; border-radius: var(--r-ctl);
  font-size: 12px; line-height: 1.4; color: var(--sm-fg); background: var(--sm-bg);
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary:hover, details.more[open] summary { background: var(--sm-hover-bg); color: var(--sm-hover-fg); }
details.more summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
details.more .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5;
  display: grid; gap: 2px; min-width: 180px; padding: 4px;
  background: var(--obsidian); border-radius: 8px;
  box-shadow: inset 0 0 0 var(--hair) var(--smoke), var(--pop-shadow);
}
details.more .menu button { border: 0; text-align: left; padding: 6px 10px; white-space: nowrap; }
.rec-main .box:has(details.more) { overflow: visible; }
/* Sortable column headers */
th button.sort { background: none; border: 0; padding: 0; font: inherit; color: var(--ash); }
th button.sort:hover { background: none; color: var(--mist); }
th button.sort.on { color: var(--paper); }

/* Rows in history, documents and activity lists */
.ev { padding: 11px 16px; border-bottom: var(--hair) solid var(--graphite); font-size: 13px; }
.ev:last-child { border: 0; }
.ev b { font-weight: 510; }
.ev .mute { font-size: 12px; }
.ev[data-a] { cursor: pointer; }
.ev[data-a]:hover { background: var(--tint-1); }
.activity .ev { padding: 10px 14px; }
.activity .ev b { font-weight: 400; color: var(--mist); }
/* History drawn as a timeline: a rail with a dot per entry */
.timeline { background: none; box-shadow: none; border-radius: 0; overflow: visible; padding-left: 4px; }
.timeline .ev { position: relative; border: 0; padding: 0 0 18px 24px; }
.timeline .ev::before { content: ""; position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--carbon); box-shadow: 0 0 0 1.5px var(--smoke); }
.timeline .ev::after { content: ""; position: absolute; left: 3px; top: 18px; bottom: -2px; width: 1px; background: var(--graphite); }
.timeline .ev:last-child::after { display: none; }

/* Label / value lists */
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 10px 0; font-size: 13px; }
dt { color: var(--fog); }
dd { margin: 0; color: var(--mist); }
dd.pre { white-space: pre-wrap; }
pre { white-space: pre-wrap; padding: 16px; margin: 0; font: 12px/1.6 var(--mono); color: var(--mist); }

/* =====================================================================
   STATUS PILLS AND BADGES
   ===================================================================== */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 8px;
  border-radius: var(--r-pill);
  background: var(--tint-2);
  color: var(--mist);
  font-size: 12px; font-weight: 400; line-height: 1.5; white-space: nowrap;
  vertical-align: middle;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st-stale); flex: none; }
.tag.over::before  { background: var(--st-over); }
.tag.soon::before  { background: var(--st-soon); }
.tag.stale::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--st-stale); }
.tag.ok::before    { background: var(--st-ok); }
.tag.over  { color: var(--pill-over-fg);  background: var(--pill-over-bg); }
.tag.soon  { color: var(--pill-soon-fg);  background: var(--pill-soon-bg); }
.tag.ok    { color: var(--pill-ok-fg);    background: var(--pill-ok-bg); }
.tag.stale { color: var(--pill-stale-fg); background: var(--pill-stale-bg); }
/* Draft / archived / inactive: a plain square badge, no dot */
.tag.arch { border-radius: var(--r-badge); padding: 1px 6px; color: var(--fog); background: var(--tint-2); }
.tag.arch::before { display: none; }

/* =====================================================================
   RECORD PAGE
   ===================================================================== */
.rec-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 4px; }
.rec-title h2 { font-size: 24px; line-height: 1.33; }
.rec-meta { font-size: 13px; color: var(--fog); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.rec-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; margin-top: 8px; }
.rec-side {
  position: sticky; top: 20px;
  padding: 16px 18px;
  background: var(--carbon);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 var(--hair) var(--graphite);
}
.rec-side dl { grid-template-columns: 1fr; gap: 0; margin: 8px 0 0; }
.rec-side dt { font-size: 12px; color: var(--ash); margin-top: 10px; }
.rec-side dd { font-size: 13px; overflow-wrap: anywhere; }
.rec-main > .bar:first-child, .rec-main > h3:first-child { margin-top: 0; }
.rec-main .bar { margin: 28px 0 0; }
.rec-main h3.gap { margin-top: 28px; }

.banner {
  display: block;
  background: var(--banner-bg);
  color: var(--mist);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--banner-line);
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 13px;
}
.banner ul { margin: 6px 0; padding-left: 18px; }
.banner button { margin-left: 8px; }

/* Details / Reports switch */
.subnav { display: inline-flex; gap: 2px; padding: 2px; margin: 18px 0 20px; background: var(--tint-2); border-radius: 8px; }
.subnav button { border: 0; padding: 4px 12px; color: var(--fog); background: none; }
.subnav button:hover { background: none; color: var(--mist); }
.subnav button.on { background: var(--seg-on-bg); color: var(--paper); }
.report h3 { margin-top: 24px; }

/* =====================================================================
   SETTINGS
   ===================================================================== */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; margin-top: 10px; align-items: end; }
.settings label, dialog label { display: block; font-size: 12px; color: var(--fog); }
.settings label input, .settings label select, dialog label input, dialog label select, dialog label textarea { margin-top: 6px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.cat-grid .box { margin-top: 0; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cat-head h3 { color: var(--paper); }
.cat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-top: var(--hair) solid var(--graphite); font-size: 13px; }
.cat-row .mute { font-size: 12px; }
.cat-row.off b { color: var(--ash); text-decoration: line-through; }
.cat-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* =====================================================================
   POP-UP DIALOGS
   ===================================================================== */
dialog {
  width: min(520px, 94vw);
  padding: 24px;
  border: 0;
  border-radius: var(--r-card);
  background: var(--obsidian);
  color: var(--mist);
  box-shadow: inset 0 0 0 var(--hair) var(--smoke), var(--pop-shadow);
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog h3 { font-size: 16px; color: var(--paper); margin-bottom: 6px; }
dialog label { margin: 14px 0 0; }
dialog p.mute { font-size: 13px; }
.row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.row button { padding: 8px 14px; }

/* =====================================================================
   MESSAGES
   ===================================================================== */
.err { color: var(--err); margin: 8px 0 0; min-height: 1em; font-size: 13px; }
main > .err.pad {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  margin: 0 0 20px; padding: 10px 14px;
  background: var(--danger-bg); border-radius: var(--r-card);
  box-shadow: inset 0 0 0 1px var(--danger-line);
  color: var(--mist);
}

/* =====================================================================
   SIGN-IN AND LOADING
   ===================================================================== */
.login {
  max-width: 400px;
  margin: 14vh auto 0;
  padding: 28px;
  background: var(--carbon);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 var(--hair) var(--graphite);
}
.login-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.login h1 { font-size: 20px; }
.login h3 { color: var(--paper); font-size: 14px; margin-top: 10px; }
.login label { display: block; font-size: 12px; color: var(--fog); margin-top: 14px; }
.login label input { margin-top: 6px; padding: 10px 12px; }
.login button { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; text-align: left; }
.login button b { margin-right: 6px; }
.login form button.pri { text-align: center; margin-top: 16px; }
.login .err { margin-top: 12px; }
.login .qr { display: block; width: 200px; height: 200px; margin: 14px auto; background: #fff; border-radius: 8px; }
.login code { font-family: var(--mono); font-size: 12px; user-select: all; word-break: break-all; color: var(--paper); }
.login pre.codes { font-size: 14px; letter-spacing: .5px; line-height: 1.8; padding: 14px; border-radius: 8px; box-shadow: inset 0 0 0 var(--hair) var(--graphite); user-select: all; }

/* Language switch */
.lang select { width: auto; padding: 4px 26px 4px 8px; font-size: 12px; color: var(--fog); }

/* =====================================================================
   NARROW SCREENS (tablet and phone): sidebar becomes a top strip
   ===================================================================== */
@media (max-width: 1080px) {
  .dash-grid, .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-side, .rec-side { position: static; }
  .rec-side { order: 1; }   /* requirements first on narrow screens; picture and properties after */
  .rec-side dl { grid-template-columns: max-content 1fr; gap: 6px 20px; }
  .rec-side dt { margin-top: 0; font-size: 13px; color: var(--fog); }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-right: 0; border-bottom: var(--hair) solid var(--graphite); }
  .brand { padding: 4px 4px; flex: 1; }
  .side nav { order: 3; flex-direction: row; width: 100%; overflow-x: auto; gap: 2px; padding-bottom: 2px; }
  .side nav button { width: auto; white-space: nowrap; padding: 6px 10px; }
  .side nav button .n { margin-left: 6px; }
  .nav-label { display: none; }
  .side-foot { margin: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 6px; }
  .me-txt { display: none; }
  .me { padding: 0; }
  .brand { min-width: 120px; }
  .side-actions { padding: 0; flex-wrap: nowrap; }
  main { padding: 18px 16px 48px; }
  .login { margin: 8vh 16px 0; padding: 22px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: var(--hair) solid var(--graphite); }
  .bar input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .bar select { flex: 1 1 140px; min-width: 0; }
  .rec-title h2 { font-size: 20px; }
  .rec-main .box:has(details.more) { overflow-x: auto; }
  details.more .menu { position: static; margin-top: 4px; box-shadow: inset 0 0 0 var(--hair) var(--smoke); }
}

/* =====================================================================
   QR STICKER PAGE for workers (worker.html): one card, big touch targets
   ===================================================================== */
[hidden] { display: none !important; }
body.wk { min-height: 100vh; }
.wk-card { max-width: 480px; margin: 0 auto; padding: 18px 16px 40px; }
.wk-top { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.wk-top .sp { flex: 1; }
.wk-brand { font-size: 13px; color: var(--fog); }
.wk-link { font-size: 13px; color: var(--fog); }
.wk-h { font-size: 24px; margin: 6px 0 4px; color: var(--paper); font-weight: 560; }
.wk-meta { margin: 0 0 14px; color: var(--fog); }
.wk-card form label { display: block; margin: 14px 0 0; }
.wk-card form input:not([type="checkbox"]), .wk-card form textarea { width: 100%; font-size: 18px; padding: 12px; margin-top: 6px; }
.wk-card .wk-chk { white-space: normal; font-size: 15px; margin-top: 16px; align-items: flex-start; }
.wk-card .wk-chk input { width: 22px; height: 22px; padding: 0; margin: 0; flex: none; accent-color: var(--accent, #2f6fde); }
.wk-go { width: 100%; margin-top: 18px; padding: 14px; font-size: 17px; }
.wk-ok { font-size: 18px; color: var(--paper); }
.wk-loading { font-size: 16px; color: var(--paper); }
.wk-tech { font-size: 12px; word-break: break-word; opacity: .8; }
.wk-list { list-style: none; padding: 0; margin: 14px 0 0; }
.wk-list a { display: block; padding: 14px; margin-bottom: 8px; border-radius: var(--r-card); background: var(--carbon); box-shadow: inset 0 0 0 var(--hair) var(--graphite); color: var(--paper); text-decoration: none; }
.wk-list a small { display: block; margin-top: 4px; color: var(--fog); }

/* Sheet of QR stickers (managers print these) */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.label { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px dashed var(--smoke); border-radius: 6px; background: #fff; color: #000; break-inside: avoid; }
.label img { width: 104px; height: 104px; flex: none; }
.label b { display: block; font-size: 14px; color: #000; }
.label .mono { display: block; font-size: 13px; color: #000; }
.label small { display: block; margin-top: 4px; font-size: 10px; color: #333; }

/* =====================================================================
   PRINTING (reports): plain black on white, no menus or buttons
   ===================================================================== */
/* ---------- Pictures ---------- */
.th { flex: none; width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: var(--avatar-bg); box-shadow: inset 0 0 0 var(--hair) var(--graphite); }
.th.ph { display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--avatar-fg); }
.th.lg { width: 56px; height: 56px; border-radius: 12px; font-size: 16px; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.photo { margin-bottom: 18px; }
.photo img, .photo-empty { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-card); background: var(--tint-1); box-shadow: inset 0 0 0 var(--hair) var(--graphite); }
.photo img { object-fit: cover; }
.photo-empty { display: grid; place-items: center; color: var(--ash); font-size: 13px; }
.photo .side-actions { margin-top: 8px; padding: 0; }
.wk-pic { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; float: left; margin-right: 12px; }
/* The vehicle's picture on its sticker page: centred, large enough to recognise the machine at a glance */
.wk-hero { display: flex; justify-content: center; margin: 6px 0 14px; }
.wk-hero img { width: min(260px, 80%); aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .14); background: var(--tint-2); }

/* ---------- Assignment ---------- */
.holder { display: flex; align-items: flex-start; gap: 14px; line-height: 1.6; }

/* ---------- Costs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.kpi { padding: 14px 16px; border-radius: var(--r-card); background: var(--carbon); box-shadow: inset 0 0 0 var(--hair) var(--graphite); }
.kpi span { display: block; font-size: 12px; color: var(--fog); }
.kpi b { display: block; margin-top: 4px; font-size: 20px; font-weight: 560; color: var(--paper); font-variant-numeric: tabular-nums; }
.kpi small { display: block; margin-top: 4px; color: var(--ash); font-size: 12px; }
.cbar { display: block; height: 4px; margin-top: 6px; min-width: 90px; border-radius: 2px; background: var(--tint-2); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 2px; background: var(--fog); }

/* ---------- Service notice ---------- */
.notice-pick { display: grid; gap: 8px; margin-bottom: 16px; }
.notice-pick label:not(.chk) { display: grid; gap: 4px; max-width: 520px; margin-top: 6px; }
.notice-head { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; }
.notice-head h3 { margin-top: 2px; font-size: 20px; }
.notice-head dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 20px; margin: 12px 0 0; }
.notice-photo { width: 220px; max-width: 38%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-card); }
.notice table { width: 100%; }
.tick { display: inline-block; width: 18px; height: 18px; border: 1.5px solid var(--fog); border-radius: 3px; }
.fills { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin-top: 10px; }
.fill { display: flex; align-items: flex-end; gap: 8px; font-size: 13px; color: var(--fog); }
.fill.wide { grid-column: 1 / -1; }
.fill i { flex: 1; height: 22px; border-bottom: 1px solid var(--fog); }
@media (max-width: 700px) { .notice-head { flex-direction: column-reverse; } .notice-photo { max-width: 100%; } .fills { grid-template-columns: 1fr; } }

@media print {
  .side, .bar, button, .noprint, .subnav, dialog { display: none !important; }
  .shell { display: block; }
  body, .box, .rec-side { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  h1, h2, h3, b, strong, dd, dt, td, th, .mute, .mono, .tag { color: #000 !important; }
  th, td { border-color: #bbb !important; }
  main { padding: 0; max-width: none; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .notice { padding: 0 !important; }
  .notice .tick, .notice .fill i { border-color: #000 !important; }
  .notice .fill { color: #000 !important; }
  .label { border-color: #999; }
}

/* Sun / moon button that switches between the light and dark themes */
.tools { display: inline-flex; align-items: center; gap: 6px; }
button.theme { display: inline-grid; place-items: center; width: 28px; height: 26px; padding: 0; border-color: transparent; background: var(--sm-bg); color: var(--sm-fg); }
button.theme:hover { background: var(--sm-hover-bg); color: var(--sm-hover-fg); border-color: transparent; }
button.theme svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.login button.theme { display: inline-grid; width: 28px; margin: 0; padding: 0; }
.subnav button, .side nav button, .stat, details.more .menu button, th button.sort { border-radius: var(--r-ctl); }
.stat { border-radius: 0; }
.notice tr.sum td { border-top: 1.5px solid var(--fog); }

/* ---------- Parts list ---------- */
fieldset.checks { border: 0; padding: 0; margin: 4px 0 8px; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
fieldset.checks legend { padding: 0; margin-bottom: 6px; font-size: 13px; color: var(--fog); }
table.parts td { vertical-align: top; }
table.parts tr.sum td, .box table tr.sum td { border-top: 1.5px solid var(--fog); }
h3 .count { margin-left: 8px; font-weight: 400; color: var(--fog); }

.login-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 12px; }
.login-card .side-actions { padding: 0; }

/* ---------- Enlarged picture ---------- */
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: var(--r-card); cursor: zoom-in; }
.photo-open:hover img { filter: brightness(1.04); }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: var(--backdrop); backdrop-filter: blur(3px); cursor: zoom-out; animation: lb-in .15s ease-out; }
.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: min(1100px, 100%); cursor: default; }
.lightbox figure { width: min(1100px, 100%); }
.lightbox img { display: block; width: 100%; height: auto; max-height: calc(100vh - 110px); object-fit: contain; border-radius: var(--r-card); filter: drop-shadow(0 4px 24px rgba(0, 0, 0, .45)); }
.lightbox figcaption .mono { color: inherit; }
.lightbox figcaption { color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.lightbox .lb-x { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.lightbox .lb-x:hover { background: rgba(255, 255, 255, .28); }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lightbox { animation: none; } }
@media print { .lightbox { display: none !important; } }

/* =====================================================================
   Motion: short, soft transitions when moving around the app.
   Only on navigation (new page, record or tab), never while typing. Turned off for people who
   ask their system for reduced motion.
   ===================================================================== */
:root { --ease-out: cubic-bezier(.22, .8, .36, 1); --t-fast: .14s; --t-med: .24s; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes nav-on { from { background: transparent; } to { background: var(--nav-on-bg); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* New page or record: the whole page area glides in; cards and tables follow a moment later */
main.enter > * { animation: page-in var(--t-med) var(--ease-out) var(--t0, 0s) both; }
main.enter > *:nth-child(2) { animation-delay: calc(var(--t0, 0s) + .03s); }
main.enter > *:nth-child(3) { animation-delay: calc(var(--t0, 0s) + .06s); }
main.enter > *:nth-child(n+4) { animation-delay: calc(var(--t0, 0s) + .09s); }
main.enter .stats > * { animation: page-in .3s var(--ease-out) var(--t0, 0s) both; }
main.enter .stats > *:nth-child(2) { animation-delay: calc(var(--t0, 0s) + .04s); }
main.enter .stats > *:nth-child(3) { animation-delay: calc(var(--t0, 0s) + .08s); }
main.enter .stats > *:nth-child(4) { animation-delay: calc(var(--t0, 0s) + .12s); }
/* Another tab on the same record: only the content under the tabs fades in */
main.enter-tab .subnav ~ * { animation: page-in .2s var(--ease-out) var(--t0, 0s) both; }
/* The menu item just chosen fills in */
.shell.nav-moved .side nav button.on { animation: nav-on .22s var(--ease-out) var(--t0, 0s) both; }

/* Hover and press feedback */
.side nav button, .subnav button, button, .btn, details.more summary { transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
button:active:not(:disabled), .btn:active { transform: scale(.98); }
.stat { transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out); }
.stat:hover { transform: translateY(-2px); }
tbody tr { transition: background var(--t-fast); }
.box table tbody tr[data-a]:hover, .box table tbody tr[data-a="open"]:hover { background: var(--tint-2); }
.ev[data-a] { transition: background var(--t-fast); }
.ev[data-a]:hover { background: var(--tint-2); }
.kpi, .label, .photo-open img { transition: transform .18s var(--ease-out), filter .18s; }
.kpi:hover { transform: translateY(-2px); }

/* Pop-up forms */
dialog[open] { animation: pop-in .22s var(--ease-out); }
dialog[open]::backdrop { animation: fade-in .2s ease-out; }
/* "More actions" menus */
details.more[open] .menu { animation: menu-in .14s var(--ease-out); transform-origin: top right; }
/* Messages and banners */
main > p.err.pad, .banner { animation: msg-in .22s var(--ease-out); }
/* Smooth scrolling when the app jumps to the top of a page */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
@media print { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =====================================================================
   Opening animation (once per visit): an excavator lifts the two halves of
   the company logo into place, then drives off. Tap or press a key to skip.
   Timeline 3.4 s: drive in 0–0.7 · lift 0.7–1.1 · lower · drive 1.35–1.85 · pick up and
   lift 1.85–2.25 · lower · drive off 2.5–3.0 · fade 3.0–3.4
   ===================================================================== */
:root { --logo-green: #469b49; --ex-yellow: #f2b705; --ex-dark: #2f3437; }
.intro { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: var(--void); cursor: pointer;
  animation: in-out 3.4s linear forwards; }
.intro-art { width: min(720px, 94vw); height: auto; overflow: visible; }
.intro .in-ground { stroke: var(--smoke); stroke-width: 2; stroke-dasharray: 6 8; }
.intro .in-real, .intro .in-copy use, .intro .in-ground2 use { fill: var(--logo-green); }
.intro .ex-track { fill: var(--ex-dark); }
.intro .ex-wheels circle { fill: #5b6166; stroke: var(--ex-dark); stroke-width: 2; }
.intro .ex-yellow, .intro .ex-boom, .intro .ex-stick { fill: var(--ex-yellow); }
.intro .ex-dark { fill: var(--ex-dark); }
.intro .ex-glass { fill: #bfe3f5; opacity: .9; }
.intro .in-dust circle { fill: var(--fog); opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }

.intro .in-ex { animation: in-drive 3.4s cubic-bezier(.45, 0, .3, 1) both; }
.intro .in-body { animation: in-bob .18s ease-in-out infinite alternate; }
.intro .in-arm { transform-origin: 0 0; animation: in-arm 3.4s ease-in-out both; }
.intro .in-hold { transform-origin: 0 0; animation: in-hold 3.4s ease-in-out both; }
.intro .in-copy1 { animation: in-copy1 3.4s step-end both; }
.intro .in-copy2 { animation: in-copy2 3.4s step-end both; }
.intro .in-ground2 { animation: in-ground2 3.4s step-end both; }
.intro .in-real1 { transform-box: fill-box; transform-origin: 50% 100%; animation: in-real1 3.4s ease-out both; }
.intro .in-real2 { transform-box: fill-box; transform-origin: 50% 100%; animation: in-real2 3.4s ease-out both; }
.intro .in-dust1 circle { animation: in-dust1 3.4s ease-out both; }
.intro .in-dust2 circle { animation: in-dust2 3.4s ease-out both; }
.intro .in-logo { transform-box: fill-box; transform-origin: 50% 50%; }

@keyframes in-drive {
  0% { transform: translateX(-280px); } 20.6% { transform: translateX(129.5px); } 39.7% { transform: translateX(129.5px); }
  54.4% { transform: translateX(241px); } 73.5% { transform: translateX(241px); } 88.2%, 100% { transform: translateX(900px); } }
@keyframes in-bob { from { transform: translateY(0); } to { transform: translateY(-1px); } }
@keyframes in-arm {
  0%, 20.6% { transform: rotate(70deg); } 32.4% { transform: rotate(0deg); } 39.7% { transform: rotate(40deg); } 50% { transform: rotate(70deg); } 54.4% { transform: rotate(70deg); }
  66.2% { transform: rotate(0deg); } 73.5%, 100% { transform: rotate(40deg); } }
@keyframes in-hold {
  0%, 20.6% { transform: rotate(-70deg); } 32.4% { transform: rotate(0deg); } 39.7% { transform: rotate(-40deg); } 50% { transform: rotate(-70deg); } 54.4% { transform: rotate(-70deg); }
  66.2% { transform: rotate(0deg); } 73.5%, 100% { transform: rotate(-40deg); } }
@keyframes in-copy1 { 0% { opacity: 1; } 32.4%, 100% { opacity: 0; } }
@keyframes in-copy2 { 0% { opacity: 0; } 54.4% { opacity: 1; } 66.2%, 100% { opacity: 0; } }
@keyframes in-ground2 { 0% { opacity: 1; } 54.4%, 100% { opacity: 0; } }
@keyframes in-real1 { 0%, 32.3% { opacity: 0; transform: none; } 32.4% { opacity: 1; transform: translateY(-6px); } 36% { transform: translateY(0) scaleY(.97); } 39%, 100% { opacity: 1; transform: none; } }
@keyframes in-real2 { 0%, 66.1% { opacity: 0; transform: none; } 66.2% { opacity: 1; transform: translateY(-6px); } 70% { transform: translateY(0) scaleY(.97); } 73%, 100% { opacity: 1; transform: none; } }
@keyframes in-dust1 { 0%, 32.4% { opacity: 0; transform: none; } 34% { opacity: .55; } 44%, 100% { opacity: 0; transform: translateY(-10px) scale(1.6); } }
@keyframes in-dust2 { 0%, 66.2% { opacity: 0; transform: none; } 68% { opacity: .55; } 78%, 100% { opacity: 0; transform: translateY(-10px) scale(1.6); } }
@keyframes in-out { 0%, 88.2% { opacity: 1; visibility: visible; } 99.9% { opacity: 0; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
/* A small "settle" of the finished logo as the excavator leaves */
.intro .in-logo { animation: in-logo 3.4s ease-in-out both; }
@keyframes in-logo { 0%, 76% { transform: none; } 82% { transform: scale(1.05); } 88%, 100% { transform: none; } }
.intro.gone { display: none; }
@media (prefers-reduced-motion: reduce) { .intro { display: none; } }
@media print { .intro { display: none; } }

/* ---------- Faint company-logo pattern behind the sign-in screens (light grey) ---------- */
:root { --logo-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='72' viewBox='0 0 84 72'%3E%3Cg fill='%23000'%3E%3Cg transform='translate(7 8) scale(.04)'%3E%3Cpolygon points='0,0 165,0 330,157 330,340 165,490 0,490 0,335 165,335 165,152 0,152'/%3E%3Cpolygon points='703,0 538,0 372,157 372,340 538,490 703,490 703,335 538,335 538,152 703,152'/%3E%3C/g%3E%3Cg transform='translate(49 44) scale(.04)'%3E%3Cpolygon points='0,0 165,0 330,157 330,340 165,490 0,490 0,335 165,335 165,152 0,152'/%3E%3Cpolygon points='703,0 538,0 372,157 372,340 538,490 703,490 703,335 538,335 538,152 703,152'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); --logo-pattern-o: .045; }
:root[data-theme="dark"] { --logo-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='72' viewBox='0 0 84 72'%3E%3Cg fill='%23fff'%3E%3Cg transform='translate(7 8) scale(.04)'%3E%3Cpolygon points='0,0 165,0 330,157 330,340 165,490 0,490 0,335 165,335 165,152 0,152'/%3E%3Cpolygon points='703,0 538,0 372,157 372,340 538,490 703,490 703,335 538,335 538,152 703,152'/%3E%3C/g%3E%3Cg transform='translate(49 44) scale(.04)'%3E%3Cpolygon points='0,0 165,0 330,157 330,340 165,490 0,490 0,335 165,335 165,152 0,152'/%3E%3Cpolygon points='703,0 538,0 372,157 372,340 538,490 703,490 703,335 538,335 538,152 703,152'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); --logo-pattern-o: .03; }
body.on-login::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background-image: var(--logo-pattern); background-size: 84px 72px; opacity: var(--logo-pattern-o); }
#app { position: relative; z-index: 1; }
@media print { body.on-login::before { display: none; } }

/* ---------- Company logo at the top of the sidebar ---------- */
.brand-logo { display: inline-flex; align-items: center; padding: 4px 6px; margin: -4px -6px; border: 0; background: none; border-radius: var(--r-ctl); cursor: pointer; }
.brand-logo:hover { background: var(--tint-2); }
.brand-logo .logo { display: block; height: 30px; width: auto; fill: var(--logo-green, #469b49); }
@media (max-width: 900px) { .brand-logo .logo { height: 24px; } }

/* =====================================================================
   Charts. Series colours (validated for colour-blind separation on these surfaces):
   light #2a78d6 / #eb6834 / #1baf7a on white; dark #3987e5 / #d95926 / #199e70 on the dark card.
   ===================================================================== */
:root { --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --ch-grid: #e8e8e4; --ch-base: #c3c2b7; --ch-ink: #898781; }
:root[data-theme="dark"] { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --ch-grid: #23252a; --ch-base: #383b3f; --ch-ink: #8a8f98; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; margin: 4px 0 22px; }
.chart-row.two-one { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .chart-row.two-one { grid-template-columns: minmax(0, 1fr); } }
.chart-card { margin: 0; padding: 16px 18px 14px; border-radius: var(--r-card); background: var(--carbon); box-shadow: inset 0 0 0 var(--hair) var(--graphite); min-width: 0; position: relative; overflow: hidden; }
/* A soft abstract wash in the corner of each chart card */
.chart-card::before { content: ""; position: absolute; inset: -40% -30% auto auto; width: 70%; height: 90%; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c1) 9%, transparent), transparent); pointer-events: none; }
.chart-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; position: relative; }
.chart-card figcaption b { color: var(--paper); font-weight: 560; font-size: 14px; }
.chart-card figcaption .mute { font-size: 12px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; position: relative; }
.chart .ch-grid { stroke: var(--ch-grid); stroke-width: 1; }
.chart .ch-base { stroke: var(--ch-base); }
.chart .ch-tick, .ch-donut .ch-tick { fill: var(--ch-ink); font-size: 12.5px; font-family: var(--sans); }
.chart path { transition: opacity .15s; }
.chart .ch-hit { fill: transparent; cursor: default; }
.chart rect.ch-hit.on { fill: var(--tint-2); }
.chart .ch-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-area { fill: var(--c1); opacity: .09; }
.chart .ch-dot { fill: var(--c1); stroke: var(--carbon); stroke-width: 2; }
.chart circle.ch-hit.on { fill: color-mix(in srgb, var(--c1) 18%, transparent); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--fog); position: relative; }
.ch-legend span, .ch-key li { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i, .ch-key i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ch-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; position: relative; }
.ch-donut svg { width: 150px; height: 150px; flex: none; }
.ch-donut .ch-slice { stroke: var(--carbon); stroke-width: 2; transition: opacity .15s; }
.ch-donut:hover .ch-slice:not(.on) { opacity: .55; }
.ch-donut .ch-centre { fill: var(--paper); font-size: 20px; font-weight: 560; font-family: var(--sans); }
.ch-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; flex: 1; min-width: 150px; }
.ch-key li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; color: var(--mist); }
.ch-key b { font-weight: 560; color: var(--paper); font-variant-numeric: tabular-nums; }
.ch-key small { color: var(--ash); min-width: 32px; text-align: right; }
.ch-empty { margin: 8px 0; }
.ch-tip { position: fixed; z-index: 2500; pointer-events: none; max-width: 300px; padding: 8px 10px; border-radius: 8px; white-space: pre-line;
  font-size: 12px; line-height: 1.45; color: var(--paper); background: var(--obsidian); box-shadow: var(--pop-shadow), inset 0 0 0 var(--hair) var(--smoke); }
.ch-tip::first-line { font-weight: 560; }
main.enter .chart-card { animation: page-in .32s var(--ease-out) var(--t0, 0s) both; }
@media print { .chart-card { break-inside: avoid; box-shadow: none; } .chart-card::before, .ch-tip { display: none; } }

/* ---------- History filters ---------- */
.hist-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fog); }

/* Medium screens (tablets, small laptops): a little less padding so wide tables fit without sideways scrolling */
@media (max-width: 1100px) {
  th, td { padding-left: 9px; padding-right: 9px; }
  table.parts td.mono, .box td.mono { white-space: normal; overflow-wrap: anywhere; }
  .kpi b { font-size: 18px; }
  table { font-size: 12.5px; }
}
/* Tables inside a printed sheet (report, service notice) size to the sheet */
.report table { min-width: 0; }

/* ---------- Work orders ---------- */
.wo-pick { margin-bottom: 10px; display: grid; gap: 6px; }
.wo-pick-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.wo-pick-head .sp, .wo-head .sp { flex: 1; }
.wo-send { display: grid; gap: 10px; margin-top: 16px; }
.wo-send label { display: grid; gap: 4px; max-width: 560px; }
.wo { display: grid; gap: 18px; }
.wo-head h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wo-veh { padding: 18px; border-radius: var(--r-card); background: var(--carbon); box-shadow: inset 0 0 0 var(--hair) var(--graphite); display: grid; gap: 12px; break-inside: avoid-page; }
.wo-veh h3 { margin: 0; font-size: 17px; }
.wo-veh table { min-width: 0; font-size: 12px; }
/* Work order tables: smaller text, tighter cells and long part codes wrap, so long part details stay inside the card;
   on a narrow screen the table scrolls sideways instead of pushing the page wider */
.wo-scroll { overflow-x: auto; max-width: 100%; }
.wo-veh th, .wo-veh td { padding: 8px; }
.wo-veh th { font-size: 11px; }
.wo-veh td.mono { white-space: normal; overflow-wrap: anywhere; font-size: 11px; }
.wo-veh td { overflow-wrap: anywhere; }
.wo-parts td:nth-child(2) { min-width: 120px; }
.wo-qcell, .wo-veh td:first-child { white-space: nowrap; overflow-wrap: normal; }
.wo-id { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; margin: 0; }
.wo-id dt { font-size: 12px; color: var(--ash); } .wo-id dd { margin: 0 0 4px; font-size: 13px; }
.wo-fill { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; }
.wo-fill label, .wo-sign label { display: grid; gap: 4px; font-size: 13px; color: var(--fog); }
.wo-fill label.wide { grid-column: 1 / -1; }
.wo-qty { width: 64px; }
.wo-tick { width: 22px; height: 22px; }
.wo-sign { display: grid; gap: 6px; max-width: 420px; }
.wo input:disabled, .wo textarea:disabled { opacity: 1; color: var(--paper); background: transparent; }
@media print {
  .wo-veh { box-shadow: none !important; background: #fff !important; padding: 0 0 6mm; border-bottom: 1px solid #999; border-radius: 0; }
  .wo input, .wo textarea { border: 0 !important; border-bottom: 1px solid #000 !important; border-radius: 0 !important; background: transparent !important; color: #000 !important; box-shadow: none !important; }
  .wo input[type="checkbox"] { border: 1px solid #000 !important; }
  .wo .banner { border: 1px solid #999; }
}

/* ---------- Company branding: uploaded logo or initials (see server/src/brand.js) ---------- */
.logo-img { display: block; height: 30px; width: auto; max-width: 180px; object-fit: contain; }
.logo-ini { display: inline-grid; place-items: center; height: 30px; min-width: 30px; padding: 0 7px; border-radius: 8px; background: var(--logo-green, #469b49); color: #fff; font-weight: 600; font-size: 14px; letter-spacing: .02em; line-height: 1; }
@media (max-width: 900px) { .brand-logo .logo-img, .brand-logo .logo-ini { height: 24px; } .brand-logo .logo-ini { min-width: 24px; font-size: 12px; } }
body.on-login:not(.brand-dc)::before { display: none; }
.login-brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.login-brand .logo { height: 34px; width: auto; fill: var(--logo-green, #469b49); flex: none; }
.org-line { display: flex; align-items: center; gap: 8px; }
.org-line .logo { height: 22px; width: auto; fill: var(--logo-green, #469b49); flex: none; }
.org-line .logo-ini { min-width: 22px; padding: 0 5px; font-size: 11px; border-radius: 6px; }
.brand-set { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-set .lbl { width: 100%; font-size: 13px; color: var(--fog); }
.brand-set > .mute { width: 100%; font-size: 12px; }
.brand-prev { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 10px; border-radius: var(--r-ctl); box-shadow: inset 0 0 0 var(--hair) var(--graphite); }
.brand-prev .logo { height: 30px; width: auto; fill: var(--logo-green, #469b49); }
.wk-brand { display: inline-flex; align-items: center; gap: 8px; }
.wk-brand img { height: 22px; width: auto; max-width: 120px; object-fit: contain; }
@media print { .org-line .logo-ini { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.settings .brand-set { grid-column: 1 / -1; }
.brand-logo .logo-ini, .login-brand .logo-ini, .org-line .logo-ini, .brand-prev .logo-ini { display: inline-grid; place-items: center; }

/* Parts linked to a requirement, and the original/alternate choice on work orders */
.pchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.pchip { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--tint-2, rgba(0,0,0,.05)); }
.pchip .tag { font-size: 11px; }
.wo-use { font-size: 12px; padding: 4px 6px; max-width: 220px; }
.wo-alts { display: none; font-size: 11px; }
@media print { .wo-use { display: none; } .wo-alts { display: block; } }

/* Phone page: the worker confirms the end-of-day reading before it is saved */
.wk-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 20, .55); animation: wk-fade .15s ease-out; }
.wk-modal[hidden] { display: none; }
.wk-confirm { width: min(420px, 100%); display: grid; gap: 12px; padding: 22px 20px 18px; border-radius: 16px; background: var(--carbon, #fff); color: var(--paper, #111); box-shadow: 0 18px 48px rgba(0, 0, 0, .28); animation: wk-pop .18s ease-out; }
.wk-confirm h2 { margin: 0; font-size: 18px; font-weight: 600; }
.wk-confirm p { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--fog, #555); }
.wk-confirm b { display: block; margin: 6px 0; font-size: 30px; font-weight: 650; color: var(--paper, #111); letter-spacing: -.01em; }
.wk-confirm .wk-go { width: 100%; }
body.wk-noscroll { overflow: hidden; }
@keyframes wk-fade { from { opacity: 0 } }
@keyframes wk-pop { from { opacity: 0; transform: translateY(12px) scale(.98) } }
@media (prefers-reduced-motion: reduce) { .wk-modal, .wk-confirm { animation: none; } }

/* Work order: jobs and their parts in one compact table */
.wo-one { font-size: 12px; min-width: 540px; }
.wo-one td { overflow-wrap: break-word; word-break: normal; }
.wo-one td:nth-child(2) { min-width: 110px; } .wo-one td:nth-child(4) { min-width: 90px; }
.wo-one th, .wo-one td { padding: 6px 8px; }
.wo-one .wo-trow td { border-top: 1px solid var(--graphite, #ddd); }
.wo-one .wo-trow:first-child td { border-top: 0; }
.wo-one .wo-prow td { border-bottom: 0; padding-top: 3px; padding-bottom: 3px; color: var(--fog); }
.wo-one .wo-prow td:nth-child(2) { padding-left: 20px; }
.wo-one .wo-qty { width: 56px; padding: 3px 6px; }
.wo-one .wo-use { font-size: 11px; margin-top: 3px; }
@media print { .wo-one { font-size: 10px; min-width: 0; } .wo-one th, .wo-one td { padding: 3px 5px; } }

/* Figure tiles that filter the list (e.g. Warehouse stock: Items / Below minimum) */
.kpi-btn { display: block; width: 100%; text-align: left; font: inherit; border: 0; cursor: pointer; }
.kpi-btn.on { box-shadow: inset 0 0 0 2px var(--link); }
.kpi-btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
