/* =========================================================================
   Fleet Maintenance Tracker — design system
   Bar: Linear / Notion / Stripe / senior Retool.
   Calm neutral surface, one considered status accent, dense but legible.
   ========================================================================= */

/* ---- Fonts (Inter for UI, JetBrains Mono for data/identifiers) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* Neutral surface — warm graphite, not cold blue-gray, not stark white */
  --bg:            #f6f6f4;   /* app canvas */
  --surface:       #ffffff;   /* cards, table, panels */
  --surface-2:     #fbfbfa;   /* subtle inset / table header */
  --surface-3:     #f0f0 ed; /* hover fill */
  --line:          #e6e5e1;   /* hairlines */
  --line-strong:   #d8d7d2;

  /* Ink */
  --ink:           #23231f;   /* primary text */
  --ink-2:         #5c5b54;   /* secondary */
  --ink-3:         #8a897f;   /* tertiary / captions */
  --ink-inv:       #ffffff;

  /* Accent — a single calm brand accent (indigo-slate), used sparingly */
  --accent:        #3a4d8f;
  --accent-ink:    #ffffff;
  --accent-soft:   #eef0f8;
  --accent-line:   #d5daef;

  /* STATUS — the load-bearing palette. Considered, adult, never bootstrap. */
  /* Overdue: warm clay-rose. Urgent, unmistakable, not screaming. */
  --overdue-ink:   #a02f2a;
  --overdue-bg:    #fbecea;
  --overdue-line:  #f0cfca;
  --overdue-edge:  #c1443c;

  /* Due soon: amber/ochre. Attention, not alarm. */
  --soon-ink:      #97590a;
  --soon-bg:       #fbf1df;
  --soon-line:     #f0dcb4;
  --soon-edge:     #d38a1f;

  /* OK: muted teal-green. Positive but recedes. */
  --ok-ink:        #2f6b53;
  --ok-bg:         #e9f3ee;
  --ok-line:       #cbe4d7;
  --ok-edge:       #4f9877;

  /* Radii / shadow / motion */
  --r-sm: 6px;
  --r-md: 9px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(30,29,25,.05), 0 1px 1px rgba(30,29,25,.04);
  --shadow-md: 0 4px 16px rgba(30,29,25,.08), 0 1px 3px rgba(30,29,25,.06);
  --shadow-lg: 0 20px 48px rgba(30,29,25,.16), 0 4px 12px rgba(30,29,25,.10);
  --ease: cubic-bezier(.2,.6,.2,1);

  --maxw: 1360px;
  --topbar-h: 60px;
}

/* Fix a token typo defensively (was --surface-3 with a stray space) */
:root { --surface-3: #f0f0ed; }

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv05' 1, 'ss01' 1;
}
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* Numbers, identifiers, dates read as DATA — mono + tabular */
.mono, .c-id, .num, time { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.tnum { font-variant-numeric: tabular-nums; }

/* =========================================================================
   App shell
   ========================================================================= */
.app { min-height: 100vh; display: flex; flex-direction: column; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: var(--topbar-h);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(145deg, #4a5ea6, #2e3f78);
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--shadow-sm);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub  { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-meta {
  font-size: 12.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 7px;
}
.topbar-meta .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok-edge); }

/* Main content */
.main {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 26px 24px 64px; flex: 1;
}

/* Page head */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.page-desc  { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 10px; }

/* =========================================================================
   Attention strip — the roll-up an ops lead reads on open
   ========================================================================= */
.attention {
  display: grid;
  grid-template-columns: repeat(3, 1fr) minmax(280px, 1.4fr);
  gap: 14px; margin-bottom: 26px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line-strong);
}
.stat--overdue::before { background: var(--overdue-edge); }
.stat--soon::before    { background: var(--soon-edge); }
.stat--ok::before      { background: var(--ok-edge); }
.stat-label {
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: 7px;
}
.stat-num {
  font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.stat--overdue .stat-num { color: var(--overdue-ink); }
.stat--soon .stat-num    { color: var(--soon-ink); }
.stat-foot { font-size: 12px; color: var(--ink-3); }
.stat-ico { width: 15px; height: 15px; opacity: .8; }
.stat--overdue .stat-ico { color: var(--overdue-edge); }
.stat--soon .stat-ico    { color: var(--soon-edge); }
.stat--ok .stat-ico      { color: var(--ok-edge); }

/* Needs-attention mini-list (4th cell of the strip) */
.needs {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px;
  display: flex; flex-direction: column; min-height: 0;
}
.needs-head {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 8px; display: flex; align-items: center; gap: 7px;
}
.needs-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.needs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer;
  transition: background .12s var(--ease);
}
.needs-item:hover { background: var(--surface-3); }
.needs-item .ni-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.needs-item.is-overdue  .ni-dot { background: var(--overdue-edge); }
.needs-item.is-due-soon .ni-dot { background: var(--soon-edge); }
.needs-item .ni-name { font-size: 13px; font-weight: 500; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.needs-item .ni-when { font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.needs-item.is-overdue  .ni-when { color: var(--overdue-ink); }
.needs-item.is-due-soon .ni-when { color: var(--soon-ink); }
.needs-empty { font-size: 13px; color: var(--ink-3); padding: 10px 8px; }

/* =========================================================================
   Toolbar above the table (search + filters)
   ========================================================================= */
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.search {
  position: relative; flex: 1; min-width: 200px; max-width: 340px;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); font-size: 13.5px; color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::placeholder { color: var(--ink-3); }

/* Segmented filter */
.segment {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.segment button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  padding: 5px 12px; border-radius: 6px; line-height: 1;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.segment button:hover { color: var(--ink); }
.segment button[aria-pressed="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); font-weight: 600;
}
.segment .seg-count {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--ink-3); font-weight: 500;
}
.toolbar-spacer { flex: 1; }

/* =========================================================================
   Fleet table (desktop) — spends the width
   ========================================================================= */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
table.fleet { width: 100%; border-collapse: collapse; }
/* Round the corners on the table itself so the wrap needs no clip
   (overflow:hidden on the wrap breaks the sticky header). */
table.fleet thead tr:first-child th:first-child { border-top-left-radius: var(--r-lg); }
table.fleet thead tr:first-child th:last-child  { border-top-right-radius: var(--r-lg); }
table.fleet tbody tr:last-child td:first-child  { border-bottom-left-radius: var(--r-lg); }
table.fleet tbody tr:last-child td:last-child   { border-bottom-right-radius: var(--r-lg); }
table.fleet thead th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em;
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: var(--topbar-h); z-index: 8;
}
/* Header background must fully occlude rows scrolling beneath it */
table.fleet thead tr { background: var(--surface-2); }
table.fleet tbody td {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: 13.5px;
}
table.fleet tbody tr:last-child td { border-bottom: 0; }
table.fleet tbody tr {
  cursor: pointer; transition: background .1s var(--ease);
  position: relative;
}
table.fleet tbody tr:hover { background: var(--surface-3); }

/* Column widths — deliberate use of the width */
.c-asset   { width: 30%; }
.c-type    { width: 10%; }
.c-id      { width: 15%; }
.c-last    { width: 13%; }
.c-next    { width: 15%; }
.c-status  { width: 12%; }
.c-actions { width: 5%; text-align: right; }

/* Asset cell: name + make/model + a small type dot */
.asset-cell { display: flex; align-items: center; gap: 11px; }
.asset-ico {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2);
}
.asset-ico svg { width: 16px; height: 16px; }
.asset-name { font-weight: 550; letter-spacing: -.01em; }
.asset-meta { font-size: 12px; color: var(--ink-3); }

/* Type tag */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  padding: 3px 9px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line);
  text-transform: capitalize;
}

.c-id       { font-size: 12.5px; color: var(--ink-2); letter-spacing: -.01em; }
.c-last time, .c-next time { font-size: 12.5px; }
.date-primary { color: var(--ink); font-weight: 500; }
.date-sub { display: block; font-size: 11.5px; color: var(--ink-3); font-family: 'Inter', sans-serif; margin-top: 1px; }

/* Left status edge on rows */
table.fleet tbody tr.row--overdue  td:first-child { box-shadow: inset 3px 0 0 var(--overdue-edge); }
table.fleet tbody tr.row--due-soon td:first-child { box-shadow: inset 3px 0 0 var(--soon-edge); }
table.fleet tbody tr.row--ok       td:first-child { box-shadow: inset 3px 0 0 transparent; }

/* =========================================================================
   Status pills — most important visual object on the screen
   ========================================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: -.005em;
  padding: 4px 10px 4px 8px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill--overdue {
  color: var(--overdue-ink); background: var(--overdue-bg); border-color: var(--overdue-line);
}
.pill--overdue .pdot { background: var(--overdue-edge); }
.pill--due-soon {
  color: var(--soon-ink); background: var(--soon-bg); border-color: var(--soon-line);
}
.pill--due-soon .pdot { background: var(--soon-edge); }
.pill--ok {
  color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-line);
}
.pill--ok .pdot { background: var(--ok-edge); }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 550; line-height: 1; cursor: pointer;
  padding: 0 14px; height: 36px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: background .12s var(--ease), border-color .12s var(--ease),
              box-shadow .12s var(--ease), transform .04s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 15px; height: 15px; }
.btn--primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: #33447e; border-color: #33447e; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn--icon { width: 32px; padding: 0; }
.btn--danger { color: var(--overdue-ink); border-color: var(--overdue-line); background: var(--overdue-bg); }
.btn--danger:hover { background: #f7ddd9; border-color: var(--overdue-line); }

.row-action {
  opacity: 0; transition: opacity .12s var(--ease);
}
tr:hover .row-action { opacity: 1; }
@media (hover: none) { .row-action { opacity: 1; } }

/* =========================================================================
   Empty state
   ========================================================================= */
[data-empty] {
  display: none; text-align: center; padding: 64px 24px;
  color: var(--ink-3);
}
[data-empty] .empty-ico {
  width: 46px; height: 46px; margin: 0 auto 14px; color: var(--ink-3);
  opacity: .6;
}
[data-empty] .empty-title { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
[data-empty] .empty-desc { font-size: 13px; max-width: 320px; margin: 0 auto 18px; }

/* =========================================================================
   Asset detail panel (slides in as a drawer on desktop, full view on phone)
   ========================================================================= */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(30,29,25,.28);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
  backdrop-filter: blur(1px);
}
.drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(520px, 94vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .24s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head {
  padding: 20px 22px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 14px;
}
.drawer-head .asset-ico { width: 42px; height: 42px; border-radius: 10px; }
.drawer-head .asset-ico svg { width: 21px; height: 21px; }
.drawer-titles { flex: 1; min-width: 0; }
.drawer-title { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.drawer-sub { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.drawer-close {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-3);
  width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center;
  transition: background .12s var(--ease), color .12s var(--ease); flex: none;
}
.drawer-close:hover { background: var(--surface-3); color: var(--ink); }
.drawer-close svg { width: 18px; height: 18px; }

.drawer-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border-bottom: 1px solid var(--line);
}
.fact { background: var(--surface); padding: 13px 22px; }
.fact-label { font-size: 11px; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.fact-value { font-size: 13.5px; font-weight: 500; }

.drawer-body { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.drawer-section-head h3 { font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-2); }

/* Service items list */
.svc-list { display: flex; flex-direction: column; gap: 10px; }
.svc-item {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 15px; background: var(--surface);
  display: flex; align-items: center; gap: 13px;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.svc-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.svc-item.is-overdue  { border-left: 3px solid var(--overdue-edge); }
.svc-item.is-due-soon { border-left: 3px solid var(--soon-edge); }
.svc-item.is-ok       { border-left: 3px solid var(--ok-edge); }
.svc-main { flex: 1; min-width: 0; }
.svc-name { font-weight: 550; font-size: 13.5px; }
.svc-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px;
  display: flex; gap: 12px; flex-wrap: wrap; }
.svc-meta .mono { color: var(--ink-2); }
.svc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* -------------------------------------------------------------------------
   Controller-emitted states (rendered by app.js at runtime). Kept here so the
   dynamic markup meets the same bar as the static design. Dana owns/refines.
   ------------------------------------------------------------------------- */
.svc-item { align-items: stretch; }
.svc-status { flex: none; align-self: flex-start; }
.svc-when { font-weight: 550; }
.svc-when--overdue  { color: var(--overdue-ink); }
.svc-when--due-soon { color: var(--soon-ink); }
.svc-when--ok       { color: var(--ok-ink); }
.svc-note { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.svc-del:hover { color: var(--overdue-ink); }
.svc-empty { font-size: 13px; color: var(--ink-3); padding: 18px 4px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-md); }

/* Empty-filter row inside the table / cards */
.table-empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 40px 16px; }
.linklike { border: 0; background: none; cursor: pointer; color: var(--accent);
  font: inherit; font-weight: 550; font-size: 13px; padding: 0; }
.linklike:hover { text-decoration: underline; }
.linklike--danger { color: var(--overdue-ink); }

/* =========================================================================
   Modal + forms — designed as carefully as the table
   ========================================================================= */
.modal-scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(30,29,25,.34);
  display: grid; place-items: start center; padding: 6vh 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s var(--ease);
  overflow: auto; backdrop-filter: blur(2px);
}
.modal-scrim.is-open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 540px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(8px) scale(.99); transition: transform .2s var(--ease);
}
.modal-scrim.is-open .modal { transform: none; }
.modal-head {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 22px 24px; }
.modal-foot {
  padding: 16px 24px; border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 12.5px; font-weight: 550; color: var(--ink-2);
}
.field .hint { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); font-size: 13.5px; color: var(--ink);
  font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 72px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input[type="date"] { font-family: 'JetBrains Mono', monospace; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a897f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px;
}
.field--error input, .field--error select { border-color: var(--overdue-edge); }
.field--error input:focus, .field--error select:focus { box-shadow: 0 0 0 3px var(--overdue-bg); }
.field-error { font-size: 12px; color: var(--overdue-ink); font-weight: 500; display: none; }
.field--error .field-error { display: block; }

/* Type toggle inside the asset form (vehicle / equipment) */
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-toggle label {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 11px 13px; transition: border-color .12s var(--ease), background .12s var(--ease);
}
.type-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.type-toggle label:hover { background: var(--surface-2); }
.type-toggle label .tt-ico { width: 30px; height: 30px; border-radius: 7px; flex: none;
  display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); }
.type-toggle label .tt-ico svg { width: 16px; height: 16px; }
.type-toggle label .tt-name { font-size: 13.5px; font-weight: 550; }
.type-toggle label .tt-desc { font-size: 11.5px; color: var(--ink-3); }
.type-toggle input:checked + .tt-ico { }
.type-toggle label:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.type-toggle label:has(input:checked) .tt-ico { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Section label inside forms */
.form-section {
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em;
  padding-top: 4px;
}

/* ---- Import modal ---- */
.import-lead { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.import-lead .mono { font-size: 12.5px; color: var(--ink); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 26px 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink-3);
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.dropzone svg { width: 26px; height: 26px; margin-bottom: 4px; }
.dz-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.dropzone:hover .dz-title, .dropzone.is-drag .dz-title { color: var(--accent); }
.dz-sub { font-size: 12px; }
.import-note {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 11px 13px;
}
.import-note svg { flex: none; margin-top: 2px; color: var(--ink-3); }
.import-note a { color: var(--accent); font-weight: 550; text-decoration: none; }
.import-note a:hover { text-decoration: underline; }
.import-result {
  font-size: 13px; font-weight: 500; padding: 11px 13px; border-radius: var(--r-md);
  background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-ink);
}
.import-result.is-error { background: var(--overdue-bg); border-color: var(--overdue-line); color: var(--overdue-ink); }

/* =========================================================================
   Phone card list (hidden on desktop)
   ========================================================================= */
.fleet-cards { display: none; }
.asset-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 15px; margin-bottom: 10px;
  position: relative; cursor: pointer;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.asset-card:active { box-shadow: var(--shadow-sm); }
.asset-card.row--overdue  { border-left: 3px solid var(--overdue-edge); }
.asset-card.row--due-soon { border-left: 3px solid var(--soon-edge); }
.asset-card.row--ok       { border-left: 3px solid var(--ok-edge); }
.card-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-top .asset-ico { width: 36px; height: 36px; }
.card-titles { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.card-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card-rows { display: flex; flex-direction: column; gap: 7px; }
.card-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-line .cl-label { font-size: 12.5px; color: var(--ink-3); }
.card-line .cl-value { font-size: 13px; font-weight: 500; }
.card-line .cl-value.mono { font-size: 12.5px; }

/* =========================================================================
   Responsive
   ========================================================================= */

/* Wide (>1440): let it breathe, don't over-stretch the table */
@media (min-width: 1441px) {
  .main { padding-left: 32px; padding-right: 32px; }
}

/* Tablet: 3-across roll-up wraps needs-list under the stats */
@media (max-width: 1080px) {
  .attention { grid-template-columns: repeat(3, 1fr); }
  .needs { grid-column: 1 / -1; }
}

/* Phone: single-column ops view — table → cards, deliberate recomposition */
@media (max-width: 720px) {
  .topbar { padding: 0 16px; height: 54px; }
  .brand-sub { display: none; }
  .topbar-meta { display: none; }
  .main { padding: 18px 14px 80px; }
  .page-head { align-items: stretch; }
  .page-title { font-size: 19px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  /* Attention strip → 2 up (overdue + due soon lead), OK + needs below */
  .attention { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .stat { padding: 13px 14px; border-radius: var(--r-md); }
  .stat-num { font-size: 26px; }
  .stat--ok { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .stat--ok .stat-num { font-size: 20px; }
  .needs { grid-column: 1 / -1; }

  /* Toolbar stacks */
  .toolbar { gap: 8px; }
  .search { max-width: none; flex: 1 1 100%; }
  .segment { width: 100%; justify-content: space-between; }
  .segment button { flex: 1; justify-content: center; }

  /* The table gives way to cards */
  .table-wrap { display: none; }
  .fleet-cards { display: block; }

  /* Drawer becomes a bottom sheet feel — full width */
  .drawer { width: 100%; border-left: 0; }
  .drawer-facts { grid-template-columns: 1fr 1fr; }

  /* Service items stack on phone: info on top, status + edit below */
  .svc-item { flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; }
  .svc-main { flex: 1 1 100%; }
  .svc-item .pill { order: 2; }
  .svc-actions { order: 3; margin-left: auto; }

  /* Modal fills more of the phone */
  .modal-scrim { padding: 0; place-items: end stretch; }
  .modal { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  .form-row { grid-template-columns: 1fr; }
  .modal-foot .btn { flex: 1; }

  /* Sticky add button on phone for thumb reach */
  .fab {
    position: fixed; right: 16px; bottom: 16px; z-index: 30;
    height: 50px; padding: 0 20px; border-radius: 26px;
    box-shadow: var(--shadow-lg); font-size: 14px;
  }
}

/* On desktop the FAB is not needed */
.fab { display: none; }
@media (max-width: 720px) { .fab { display: inline-flex; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
