/* FleetHub — main stylesheet.
 *
 * Extracted verbatim from dashboard-mockup-topnav.html (the approved UI) per
 * CLAUDE.md: same class names, design replicated exactly, do not redesign.
 * Design tokens are CSS variables at the top; components below. Dark theme is
 * a token override under [data-theme="dark"].
 */

/* --- Design tokens ------------------------------------------------------- */
:root {
  --bg-page: #f4f4f6;
  --bg-surface: #ffffff;
  --bg-header: #3A3C48;
  --header-text: #B9BBC9;
  --header-active: #ffffff;
  --slate: #4D4F60;
  --text-primary: #262730;
  --text-secondary: #5d5f70;
  --text-tertiary: #8a8c9c;
  --border: rgba(77,79,96,0.18);
  --teal-50: #E1F5EE; --teal-400: #1D9E75; --teal-600: #0F6E56; --teal-800: #085041;
  --purple-50: #EEEDFE; --purple-100: #CECBF6; --purple-600: #534AB7; --purple-900: #26215C;
  --amber-50: #FAEEDA; --amber-100: #FAC775; --amber-600: #854F0B; --amber-900: #412402;
  --red-50: #FCEBEB; --red-100: #F7C1C1; --red-600: #A32D2D; --red-900: #501313;
  --blue-50: #E5EDFB; --blue-100: #C5D7F4; --blue-400: #5B86D9; --blue-600: #2F5DA8; --blue-800: #1E3D70;
  --pink-200: #ED93B1;
}
[data-theme="dark"] {
  --bg-page: #1d1e24;
  --bg-surface: #27282f;
  --bg-header: #222329;
  --header-text: #9598ad;
  --header-active: #eeeef2;
  --slate: #B7B9C9;
  --text-primary: #eeeef2;
  --text-secondary: #b2b4c2;
  --text-tertiary: #84869a;
  --border: rgba(255,255,255,0.14);
  --teal-50: #0a4537; --teal-600: #5DCAA5; --teal-800: #9FE1CB;
  --purple-50: #2e2a55; --purple-600: #AFA9EC; --purple-900: #CECBF6;
  --amber-50: #4a3408; --amber-600: #FAC775; --amber-900: #FAEEDA;
  --red-50: #4a1a1a; --red-100: #793030; --red-600: #F09595; --red-900: #FCEBEB;
  --blue-50: #182640; --blue-100: #2a4068; --blue-600: #9CBAEC; --blue-800: #C9DAF6;
}

/* --- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg-page); color: var(--text-primary); font-size: 16px; line-height: 1.55; }
/* Muted secondary text used across the app (card bodies, empty states, hints).
   Base size so a bare `.sub` doesn't fall back to the 16px body size; scoped
   rules (e.g. chart legends) override where a different size is wanted. */
.sub { font-size: 13.5px; color: var(--text-tertiary); }

/* --- Auth pages (allauth login / MFA), centred card ---------------------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 384px; background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 14px; padding: 28px 28px 22px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand-name { font-size: 16px; font-weight: 600; letter-spacing: 0.22em; }
.auth-content h1 { font-size: 20px; font-weight: 600; margin-bottom: 5px; }
.auth-content > p { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 18px; }
.auth-content form p { margin-bottom: 13px; }
.auth-content label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }
.auth-content input[type=text], .auth-content input[type=password], .auth-content input[type=email], .auth-content input[type=number] { width: 100%; padding: 9px 12px; border: 0.5px solid var(--border); border-radius: 9px; font-size: 14px; background: var(--bg-surface); color: var(--text-primary); }
.auth-content input:focus { outline: none; border-color: var(--teal-400); box-shadow: 0 0 0 3px rgba(29,158,117,0.15); }
.auth-content button[type=submit], .auth-content a.button { display: block; width: 100%; margin-top: 8px; padding: 10px 16px; background: var(--teal-400); color: #E1F5EE; border: none; border-radius: 9px; font-size: 14px; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer; }
.auth-content button[type=submit]:hover, .auth-content a.button:hover { background: var(--teal-600); }
.auth-content a { color: var(--teal-600); text-decoration: none; font-weight: 500; }
.auth-content a:hover { text-decoration: underline; }
/* Field help text (e.g. the "Forgot password?" link under the password field). */
.auth-content form p span { display: inline-block; margin-top: 6px; font-size: 12.5px; }
.auth-content .errorlist { list-style: none; color: var(--red-600); font-size: 12.5px; margin: 0 0 6px; padding: 0; }
/* MFA / 2FA management panels — allauth renders <section><h2>…<ul> actions. */
.auth-content section { margin-top: 16px; padding-top: 16px; border-top: 0.5px solid var(--border); }
.auth-content section h2 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.auth-content section p { font-size: 13px; color: var(--text-secondary); margin: 0; }
.auth-content section ul { list-style: none; padding: 0; margin: 11px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.auth-content section ul a, .auth-content section ul button { display: inline-flex; align-items: center; padding: 7px 14px; border: 0.5px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-primary); background: var(--bg-surface); text-decoration: none; cursor: pointer; }
.auth-content section ul a:hover, .auth-content section ul button:hover { border-color: var(--teal-400); color: var(--teal-600); }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 0.5px solid var(--border); font-size: 13px; }

/* --- Header / top nav ---------------------------------------------------- */
.header { background: var(--bg-header); }
.header-inner { max-width: 1280px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: #4D4F60; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.brand-name { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: 0.22em; }
.topnav { display: flex; gap: 4px; height: 100%; flex: 1; }
.topnav a { display: flex; align-items: center; gap: 7px; padding: 0 14px; font-size: 14px; color: var(--header-text); text-decoration: none; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.topnav a:hover { color: var(--header-active); }
.topnav a.active { color: var(--header-active); font-weight: 600; border-bottom-color: var(--teal-400); }
.topnav i { font-size: 17px; }
.topnav .count { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 8px; line-height: 17px; }
.count.amber { background: var(--amber-100); color: #412402; }
.count.red { background: var(--red-100); color: #501313; }
.count.purple { background: var(--purple-100); color: #26215C; }
.count.blue { background: var(--blue-100); color: #1E3D70; }
[data-theme="dark"] .count.red { color: #FCEBEB; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: none; border: none; color: var(--header-text); font-size: 19px; cursor: pointer; padding: 6px; text-decoration: none; display: inline-flex; }
.icon-btn:hover { color: var(--header-active); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.16); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; font-family: inherit; }
.avatar:hover { background: rgba(255,255,255,0.26); }
/* Account dropdown (click the avatar). */
.account-menu { position: relative; }
.account-dropdown { position: absolute; right: 0; top: calc(100% + 9px); min-width: 184px; background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 11px; box-shadow: 0 8px 26px rgba(77,79,96,0.18); padding: 6px; z-index: 60; }
.account-dropdown .account-head { font-size: 11.5px; color: var(--text-tertiary); padding: 6px 10px 5px; }
.account-dropdown a, .account-dropdown button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; color: var(--text-primary); text-decoration: none; background: none; border: none; cursor: pointer; text-align: left; font-family: inherit; }
.account-dropdown a:hover, .account-dropdown button:hover { background: rgba(127,129,148,0.14); }
.account-dropdown i { font-size: 16px; color: var(--text-tertiary); }
.account-dropdown form { margin: 0; }
.account-sep { height: 0.5px; background: var(--border); margin: 6px 4px; }

/* --- Page ---------------------------------------------------------------- */
.page { max-width: 1280px; margin: 0 auto; padding: 26px 28px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head .sub { font-size: 13.5px; color: var(--text-tertiary); margin-top: 2px; }
.btn-primary { font-size: 13.5px; font-weight: 500; padding: 9px 16px; background: var(--teal-400); color: #E1F5EE; border: none; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-circle { width: 40px; height: 40px; border-radius: 50%; background: var(--teal-400); color: #E1F5EE; border: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.btn-circle:hover { background: var(--teal-600); }

/* --- KPI band ------------------------------------------------------------ */
.kpi-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 16px 18px 13px; border: 0.5px solid var(--border); border-radius: 11px; text-align: center; }
.kpi.teal { background: var(--teal-50); }
.kpi.purple { background: var(--purple-50); }
.kpi.amber { background: var(--amber-50); }
.kpi.red { background: var(--red-50); }
.kpi.blue { background: var(--blue-50); }
.kpi-label { font-size: 13.5px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 9px; }
.kpi.teal .kpi-label, .kpi.teal .kpi-sub { color: var(--teal-600); }
.kpi.purple .kpi-label, .kpi.purple .kpi-sub { color: var(--purple-600); }
.kpi.amber .kpi-label, .kpi.amber .kpi-sub { color: var(--amber-600); }
.kpi.red .kpi-label, .kpi.red .kpi-sub { color: var(--red-600); }
.kpi.blue .kpi-label, .kpi.blue .kpi-sub { color: var(--blue-600); }
.chip { width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.chip.teal { background: var(--teal-50); color: var(--teal-600); }
.chip.purple { background: var(--purple-50); color: var(--purple-600); }
.chip.amber { background: var(--amber-50); color: var(--amber-600); }
.chip.red { background: var(--red-50); color: var(--red-600); }
.chip.blue { background: var(--blue-50); color: var(--blue-600); }
.kpi .chip { background: rgba(255,255,255,0.65); }
[data-theme="dark"] .kpi .chip { background: rgba(0,0,0,0.25); }
.kpi-value { font-size: 30px; font-weight: 600; }
.kpi.teal .kpi-value { color: var(--teal-800); }
.kpi.purple .kpi-value { color: var(--purple-900); }
.kpi.amber .kpi-value { color: var(--amber-900); }
.kpi.red .kpi-value { color: var(--red-900); }
.kpi.blue .kpi-value { color: var(--blue-800); }
.kpi-sub { font-size: 12.5px; margin-top: 2px; }
/* Whole-card KPI drill-down link: inherits the card styling, lifts on hover. */
.kpi-clickable { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow 0.12s ease, transform 0.12s ease; }
.kpi-clickable:hover { box-shadow: 0 4px 14px rgba(77,79,96,0.16); transform: translateY(-1px); }

/* --- Two-column grid + cards --------------------------------------------- */
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.link { font-size: 13.5px; color: var(--teal-600); font-weight: 500; text-decoration: none; }
/* Clickable identifier that should read as plain text (neutral), not a teal link. */
.link-quiet { color: var(--text-primary); font-weight: 500; text-decoration: none; }
.link-quiet:hover { text-decoration: underline; }

/* --- Tables -------------------------------------------------------------- */
table { width: 100%; font-size: 14px; border-collapse: collapse; }
th { font-weight: 500; text-align: left; color: var(--text-secondary); padding: 4px 8px 7px 0; }
td { padding: 11px 8px 11px 0; border-top: 0.5px solid var(--border); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
/* Clickable table rows (JS enhancement; Subject link is the no-JS fallback). */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--bg-page); }
td.row-go { text-align: right; color: var(--text-tertiary); }
td.row-go i { font-size: 16px; vertical-align: -2px; transition: transform 0.12s ease; }
.clickable-row:hover td.row-go { color: var(--teal-600); }
.clickable-row:hover td.row-go i { transform: translateX(3px); }
/* UK-plate-style badge for vehicle registrations (yellow rear-plate look). */
.plate { display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; font-size: 12.5px; letter-spacing: 1.5px; text-transform: uppercase; padding: 2px 8px; border-radius: 5px; background: #EBDD93; color: #2a2a2a; border: 1px solid #d3c473; white-space: nowrap; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 11px; white-space: nowrap; }
.pill.red { background: var(--red-100); color: #501313; }
.pill.amber { background: var(--amber-100); color: #412402; }
.pill.purple { background: var(--purple-100); color: #26215C; }
.pill.teal { background: var(--teal-50); color: var(--teal-600); }
.pill.blue { background: #D7E3FB; color: #1C3B73; }
.pill.pink { background: #FAD9E6; color: #7C2348; }
.pill.slate { background: rgba(127,129,148,0.16); color: var(--text-secondary); }
/* Count pill inside a filter chip is slightly smaller than a standalone pill. */
.chips .chip-link .pill { font-size: 11px; padding: 1px 7px; }
/* Lifecycle status as colour-coded text (no pill): active = teal, off road = amber,
   disposed / inactive = slate (neutral). */
.status-text { font-size: 13px; font-weight: 600; }
.status-text--teal { color: var(--teal-600); }
.status-text--amber { color: var(--amber-600); }
.status-text--slate { color: var(--text-secondary); }
.status-text--blue { color: var(--blue-600); }
.status-text--purple { color: var(--purple-600); }
/* Abbreviated source label (e.g. CDC) — dotted underline signals a hover tooltip. */
.src-abbr { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
[data-theme="dark"] .pill.red { color: #FCEBEB; }

/* Severity chip: icon + label, colour from the severity tier. */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sev i { font-size: 16px; }
.sev.teal { color: var(--teal-600); }
.sev.purple { color: var(--purple-600); }
.sev.amber { color: var(--amber-600); }
.sev.red { color: var(--red-600); }

/* Flash messages */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 0.5px solid var(--border); transition: opacity .3s ease, transform .3s ease; }
.flash.success { background: var(--teal-50); color: var(--teal-600); }
.flash.error { background: var(--red-50); color: var(--red-600); }
.flash--out { opacity: 0; transform: translateY(-6px); }
.flash-close { background: none; border: none; color: inherit; font-size: 19px; line-height: 1; cursor: pointer; opacity: .55; padding: 0 2px; }
.flash-close:hover { opacity: 1; }

/* Banner (manual-entry prompt / risk callout) */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.banner.red { background: var(--red-50); color: var(--red-600); }
.banner i { font-size: 19px; }

/* Search + type filter toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar select { width: auto; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box i { position: absolute; left: 11px; font-size: 16px; color: var(--text-tertiary); pointer-events: none; }
.search-box input[type=search] { width: 260px; max-width: 100%; padding-left: 34px; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13.5px; color: var(--text-secondary); }
.pager .pages { display: flex; align-items: center; gap: 8px; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* List controls row (chips + view toggle) */
.list-controls { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-controls .chips { margin-bottom: 18px; }
.view-toggle { display: inline-flex; margin-left: auto; border: 0.5px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg-surface); flex-shrink: 0; }
.view-toggle a { display: inline-flex; align-items: center; padding: 7px 11px; font-size: 17px; color: var(--text-tertiary); text-decoration: none; }
.view-toggle a:hover { color: var(--teal-600); }
.view-toggle a.active { background: var(--teal-50); color: var(--teal-600); }

/* Grid (card) view */
.grid-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-cards { grid-template-columns: 1fr; } }
.ccard { display: flex; flex-direction: column; gap: 11px; min-height: 195px; padding: 16px; border: 0.5px solid var(--border); border-radius: 12px; background: var(--bg-surface); text-decoration: none; color: var(--text-primary); }
.ccard:hover { border-color: var(--teal-400); }
.ccard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Identity info under the compliance subject (vehicle make/model, driver name/location). */
.subject-info { display: block; margin-top: 4px; font-size: 12px; color: var(--text-secondary); }
.ccard .subject-info { margin-top: -3px; }
/* Lifecycle status badge row inside a grid card. */
.ccard-status { margin-top: -2px; }
.ccard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-secondary); border-top: 0.5px solid var(--border); padding-top: 10px; margin-top: auto; }
/* Driver grid: licence-style cards (photo + key fields + location footer). */
.dcard { display: flex; flex-direction: column; padding: 14px; border: 0.5px solid var(--border); border-radius: 12px; background: var(--bg-surface); text-decoration: none; color: var(--text-primary); }
.dcard:hover { border-color: var(--teal-400); }
.dcard-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.dphoto { width: 50px; height: 62px; border-radius: 6px; background: rgba(127,129,148,0.16); color: var(--slate); display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600; flex-shrink: 0; }
.dname { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.dtype { font-size: 12px; font-weight: 600; }
.dfields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.dfield .fl { font-size: 11px; color: var(--text-tertiary); margin-bottom: 2px; }
.dfield .fv { font-size: 13px; font-weight: 600; }
/* Footer pinned to the card bottom so it lines up across a row regardless of
   how many lines the Vehicle field takes. */
.dcard-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); border-top: 0.5px solid var(--border); padding-top: 9px; margin-top: auto; }
.dfields { margin-bottom: 12px; }
.chip-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 0.5px solid var(--border); border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--text-secondary); text-decoration: none; background: var(--bg-surface); }
.chip-link.active { border-color: var(--teal-400); color: var(--teal-600); }
.chip-link .n { font-weight: 700; }

/* Definition grid (detail pages) */
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; font-size: 14px; }
.dl dt { color: var(--text-secondary); }
.dl dd { margin: 0; }

/* Form controls */
input[type=text], input[type=search], input[type=date], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; color: var(--text-primary);
  background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 9px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-400); outline-offset: -1px; }
/* Disabled fields (e.g. role/active locked when editing your own account). */
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
.form-check input[type=checkbox]:disabled + .toggle-track { opacity: 0.55; cursor: not-allowed; }

/* Grouped, full-width edit form: sections of fields laid out in a 2-column grid. */
.form-section { margin-bottom: 20px; }
.form-section + .form-section { border-top: 0.5px solid var(--border); padding-top: 18px; }
.form-section h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 14px; color: var(--text-primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; align-items: start; }
/* Single-column variant (e.g. the compliance form). */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
/* Read-only detail field (grouped detail pages): label on the left, value to its
   right on the same row. Value shows "·" / muted when empty. */
.detail-field { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.detail-label { flex: 0 0 124px; font-size: 13px; color: var(--text-tertiary); }
/* Value keeps the label's line and wraps within its own column (never crossing
   the gutter); long unbroken strings break rather than overflow. */
.detail-value { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--text-primary); overflow-wrap: anywhere; }
.detail-value.empty { font-weight: 400; color: var(--text-tertiary); }
.detail-field.full { grid-column: 1 / -1; }
/* Static adornment inside a money/unit input (e.g. £). */
.input-prefix { position: relative; }
.input-prefix .prefix { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); font-size: 14px; pointer-events: none; }
.input-prefix input { padding-left: 23px; }
.form-field { display: flex; flex-direction: column; min-width: 0; }
.form-field.full { grid-column: 1 / -1; }
.form-field > label { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 5px; }
.form-help { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.form-error { font-size: 12.5px; color: var(--red-600); margin-top: 4px; }
/* Checkboxes render inline: box then label. */
.form-check { flex-direction: row; align-items: center; flex-wrap: wrap; }
.form-check > label { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--text-primary); cursor: pointer; }
/* Boolean fields render as a toggle switch: the native checkbox is hidden (kept
   for clicks/keyboard/forms) and the .toggle-track span is the visible control. */
.form-check input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 38px; height: 22px; border-radius: 11px; background: rgba(127,129,148,0.35); position: relative; flex-shrink: 0; transition: background 0.18s ease; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.18s ease; }
.form-check input[type=checkbox]:checked + .toggle-track { background: var(--teal-400); }
.form-check input[type=checkbox]:checked + .toggle-track::after { transform: translateX(16px); }
.form-check input[type=checkbox]:focus-visible + .toggle-track { outline: 2px solid var(--teal-400); outline-offset: 2px; }
.form-check .form-help, .form-check .form-error { flex-basis: 100%; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }

/* Modern file upload (JS-enhanced). The native input is the no-JS fallback; once
   `.js` is set it's visually hidden and the styled drop zone takes over. */
.filedrop-zone { display: none; }
.js .filedrop input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.js .filedrop-zone { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 9px; background: var(--bg-surface); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease; }
.js .filedrop-zone:hover, .js .filedrop-zone.dragging { border-color: var(--teal-400); color: var(--teal-600); background: var(--teal-50); }
.filedrop-zone i { font-size: 18px; }
.filedrop-browse { color: var(--teal-600); font-weight: 500; }
.filedrop-zone.has-file { border-style: solid; color: var(--text-primary); }
.filedrop-name { font-weight: 500; word-break: break-all; }
.filedrop-clear { margin-left: auto; display: inline-flex; align-items: center; padding: 2px; border: none; border-radius: 5px; background: transparent; color: var(--text-tertiary); cursor: pointer; }
.filedrop-clear[hidden] { display: none; }

/* Grey fleet declaration section: hidden under JS until the grey fleet type is
   chosen, then it fades + slides in. (Without JS it's always shown.) */
.js #grey-fleet-section { display: none; }
.js #grey-fleet-section.is-open { display: block; animation: fade-slide-in 0.75s ease; }
.js #grey-fleet-section.is-closing { display: block; animation: fade-slide-out 0.45s ease forwards; }
@keyframes fade-slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes fade-slide-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .js #grey-fleet-section.is-open, .js #grey-fleet-section.is-closing { animation: none; } }
.filedrop-clear:hover { color: var(--red-600); background: rgba(127,129,148,0.16); }
.filedrop-clear i { font-size: 15px; }
.due.red { color: var(--red-600); font-weight: 600; }
.due.amber { color: var(--amber-600); font-weight: 600; }
.due.purple { color: var(--purple-600); font-weight: 600; }
.due.teal { color: var(--teal-600); font-weight: 600; }
/* Relative countdown shown beneath the absolute due date in the list. */
.due-countdown { display: block; margin-top: 3px; font-size: 12px; }

/* Responsive grid of report breakdown cards. */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }

/* Nightingale (rose) chart (dashboard — fleet by department). */
.radial-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 0; }
/* Compact the fleet-by-department card around its (fixed-size) chart. */
.radial-card { padding-top: 16px; padding-bottom: 14px; }
.radial-card .card-head { margin-bottom: 4px; }
.radial-card .card-head .sub { font-size: 12px; }
.radial-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px 14px; width: 100%; }
.radial-legend .comp-key { cursor: pointer; font-size: 12.5px; align-items: flex-start; border: none; background: none; padding: 0; margin: 0; text-align: left; font-family: inherit; transition: opacity 0.12s ease; }
.radial-legend .comp-key.off { opacity: 0.4; text-decoration: line-through; }
/* Fleet by department (polar-area rose): square canvas holder, centred. */
.donut-holder { position: relative; width: 200px; height: 200px; margin: 0 auto; }

/* Interactive trend line graph (incident reports). */
.line-holder { position: relative; height: 220px; margin-top: 12px; }
.line-chart { display: block; }
.line-readout, .comp-readout { font-size: 12.5px; color: var(--text-tertiary); }

/* Interactive donut charts (incident reports — fault / severity). */
.donut-wrap { display: flex; align-items: center; gap: 20px; margin-top: 8px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut.donut--lg { width: 188px; height: 188px; }
.donut-seg { cursor: pointer; transition: stroke-width .12s ease; }
.donut-seg:hover, .donut-seg.is-active { stroke-width: 28; }
.donut-num { font-size: 30px; font-weight: 600; fill: var(--text-primary); }
.donut-num--sm { font-size: 15px; }
.donut-lbl { font-size: 11px; fill: var(--text-secondary); }
.donut-legend { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 0; }
/* Stroke swatch colours for donut segments (mirror the .sw-* fills). */
.st-teal { stroke: var(--teal-400); } .st-purple { stroke: var(--purple-600); } .st-amber { stroke: #EF9F27; }
.st-red { stroke: #E24B4A; } .st-blue { stroke: #5B86D9; } .st-pink { stroke: var(--pink-200); } .st-slate { stroke: var(--text-tertiary); }

/* Active drill-down filter pills above the list. */
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.active-filters .chip-link i { font-size: 14px; margin-left: 2px; }

/* Stacked composition bars (report breakdowns) with drill-down + hover. */
.comp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 760px) { .comp-grid { grid-template-columns: 1fr; } }
.comp-holder { position: relative; height: 150px; margin-top: 6px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-top: 13px; }
.comp-key { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-primary); text-decoration: none; }
.comp-key:hover { color: var(--teal-600); }
.comp-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
/* Swatch colours shared by composition segments + legend dots. */
.sw-teal { background: var(--teal-400); }
.sw-purple { background: var(--purple-600); }
.sw-amber { background: #EF9F27; }
.sw-red { background: #E24B4A; }
.sw-blue { background: #5B86D9; }
.sw-pink { background: var(--pink-200); }
.sw-slate { background: var(--text-tertiary); }


/* --- Activity feed ------------------------------------------------------- */
.activity { display: flex; flex-direction: column; gap: 13px; font-size: 13.5px; }
.activity .row { display: flex; gap: 10px; align-items: flex-start; }

/* --- Quick actions ------------------------------------------------------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a { display: flex; align-items: center; gap: 9px; padding: 12px; border: 0.5px solid var(--border); border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--text-primary); text-decoration: none; }
.quick a:hover { background: var(--bg-page); }
.quick i { font-size: 18px; color: var(--teal-600); }

/* --- Integrations / API page --------------------------------------------- */
.endpoint-list { display: flex; flex-direction: column; gap: 8px; }
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.endpoint .method { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; color: var(--teal-600); background: var(--teal-50); border-radius: 5px; padding: 2px 7px; }
.endpoint .endpoint-desc { font-size: 13px; color: var(--text-secondary); }
.code-inline { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; background: var(--bg-page); border: 0.5px solid var(--border); border-radius: 7px; padding: 3px 9px; color: var(--text-primary); cursor: pointer; position: relative; }
.code-inline:hover { border-color: var(--teal-400); }
.code-inline.copied::after { content: "Copied"; position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-family: -apple-system, sans-serif; font-size: 11px; background: var(--text-primary); color: var(--bg-surface); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.token-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.token-key { font-weight: 600; }
.code-block { position: relative; background: var(--bg-page); border: 0.5px solid var(--border); border-radius: 10px; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code-block code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; color: var(--text-primary); }
.code-copy { position: absolute; top: 8px; right: 8px; background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 7px; width: 30px; height: 30px; font-size: 15px; color: var(--text-secondary); cursor: pointer; }
.code-copy:hover { color: var(--teal-600); border-color: var(--teal-400); }
.code-copy.copied { color: var(--teal-600); border-color: var(--teal-400); }

/* --- Responsive + theme toggle ------------------------------------------- */
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } .topnav a span.label { display: none; } }
.theme-toggle { position: fixed; bottom: 24px; right: 24px; background: var(--bg-surface); border: 0.5px solid var(--border); border-radius: 50%; width: 44px; height: 44px; font-size: 19px; color: var(--text-secondary); cursor: pointer; }
