/* Barlow and Barlow Condensed (SIL Open Font License), served from this site. */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
/* Colmech DriveFix — shared tokens and components (public site + app). */

:root {
  /* Palette from the Colmech DriveFix logo: navy, red and gear grey,
     plus number-plate yellow for registration plates. */
  --overall: #0c2340;
  --overall-deep: #031122;
  --overall-tint: #e2e7ef;
  --plate: #f5c400;
  --plate-deep: #dcaf00;
  --signal: #d40104;
  --signal-deep: #b00103;
  --gear: #898a90;
  --signal-tint: #fbe9e7;
  --paper: #eef1f4;
  --surface: #ffffff;
  --ink: #101d31;
  --ink-2: #4a5668;
  --muted: #6b7686;
  --line: #d3dae2;
  --line-strong: #b9c3cf;
  --good: #1e7a46;
  --good-tint: #e4f2ea;
  --amber: #a85d00;
  --amber-tint: #fdf0dc;
  --blue: #1f5fae;
  --blue-tint: #e3eefb;
  --grey-tint: #eceff3;
  --series-1: #2a78d6;
  --series-2: #eb6834;

  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --focus: 0 0 0 3px rgba(12, 35, 64, 0.3);
  --shadow-overlay: 0 18px 48px rgba(20, 44, 82, 0.22);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--overall); text-underline-offset: 2px; }
a:hover { color: var(--overall-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--overall); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { font-family: var(--font-cond); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0 0 12px; }
small, .small { font-size: 14px; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 600; font-size: 16px; line-height: 1.1; text-decoration: none;
  cursor: pointer; transition: background-color .12s, border-color .12s, color .12s;
  white-space: nowrap; user-select: none;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--signal-deep); border-color: var(--signal-deep); color: #fff; }
.btn-dark { background: var(--overall); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--overall-deep); color: #fff; }
.btn-danger { background: #8f1710; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #74120c; color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--overall); color: var(--overall); }
.btn-quiet { background: transparent; color: var(--overall); padding: 0 10px; }
.btn-quiet:hover:not(:disabled) { background: var(--overall-tint); }
.btn-good { background: var(--good); color: #fff; }
.btn-good:hover:not(:disabled) { background: #17633a; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 15px; }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 18px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite; display: inline-block; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 16px; line-height: 1.3;
}
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234a5668' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--overall); box-shadow: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--signal); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--overall); flex: none; }
.input-prefix { display: flex; }
.input-prefix span { display: flex; align-items: center; padding: 0 12px; background: var(--grey-tint); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); color: var(--ink-2); font-weight: 600; }
.input-prefix .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* Choice tiles (radio/checkbox styled as tappable options) */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--overall); box-shadow: inset 0 0 0 1px var(--overall); background: #f6f8fc; }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.choice .choice-title { font-weight: 600; }
.choice .choice-sub { font-size: 14px; color: var(--muted); }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; background: var(--grey-tint); border-radius: 9px; gap: 2px; }
.segmented button, .segmented a, .segmented label { border: 0; background: transparent; padding: 8px 14px; border-radius: 7px; font-weight: 600; font-size: 15px; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.segmented [aria-pressed="true"], .segmented [aria-current="page"], .segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20,44,82,.14); }
.segmented label input { position: absolute; opacity: 0; }

/* ---------- Number plate (Kenyan rear plate: black on yellow) ---------- */
.plate {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-cond); font-weight: 700; font-size: 15px; letter-spacing: 0.05em;
  color: #000; background: var(--plate); border: 2px solid #000; border-radius: 4px;
  padding: 0 7px; line-height: 1.45; white-space: nowrap;
}
.plate-lg { font-size: 26px; padding: 2px 12px; border-width: 3px; border-radius: 6px; }
.plate-none { background: var(--grey-tint); border-color: var(--line-strong); color: var(--muted); font-weight: 600; letter-spacing: 0; }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px;
  font-size: 14px; font-weight: 600; white-space: nowrap; background: var(--grey-tint); color: var(--ink-2); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-blue { background: var(--blue-tint); color: var(--blue); }
.chip-amber { background: var(--amber-tint); color: var(--amber); }
.chip-yellow { background: #fff4c2; color: #6b5300; }
.chip-green { background: var(--good-tint); color: var(--good); }
.chip-red { background: var(--signal-tint); color: var(--signal); }
.chip-plain::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 600; background: var(--grey-tint); color: var(--ink-2); }
.tag-emergency { background: var(--signal); color: #fff; }
.tag-colmech { background: var(--overall); color: #fff; }

/* ---------- Panels, lists, tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 20px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 16px 20px 0; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; align-items: center; gap: 14px; padding: 14px 20px; color: inherit; text-decoration: none; }
.row-link:hover { background: #f7f9fb; color: inherit; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-sub { color: var(--muted); font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.row-end { text-align: right; display: grid; gap: 4px; justify-items: end; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #f7f9fb; }

.dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 8px 18px; margin: 0; }
.dl dt { color: var(--muted); font-size: 15px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.stat-label { font-size: 15px; color: var(--ink-2); }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.stat-sub { font-size: 14px; color: var(--muted); }
a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--overall); }

/* ---------- Notices ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--blue-tint); color: #183f72; }
.notice .icon { margin-top: 2px; }
.notice-warn { background: var(--amber-tint); color: #6d3d00; }
.notice-danger { background: var(--signal-tint); color: #8e1f15; }
.notice-good { background: var(--good-tint); color: #155c34; }
.notice p:last-child { margin-bottom: 0; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty .icon { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--muted); }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 42ch; margin: 0 auto 14px; }
.loading { display: flex; align-items: center; gap: 12px; padding: 40px 20px; justify-content: center; color: var(--muted); }

/* ---------- Toasts & dialogs ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--overall-deep); color: #fff; padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-overlay);
  display: flex; gap: 10px; align-items: flex-start; border-left: 5px solid var(--gear); animation: toast-in .18s ease-out; }
.toast-error { border-left-color: #ff6b5c; }
.toast-good { border-left-color: #4cc98a; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

dialog.modal { border: 0; padding: 0; border-radius: var(--r-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-overlay); color: var(--ink); }
dialog.modal::backdrop { background: rgba(20, 35, 56, 0.55); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 0; }
.modal-head h2 { font-size: 22px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 600px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-foot .btn { flex: 1; }
}

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 2px; color: #c99a00; }
.stars .icon { width: 16px; height: 16px; }
.stars .on { fill: currentColor; }
.star-input { display: inline-flex; gap: 4px; }
.star-input button { border: 0; background: none; padding: 4px; cursor: pointer; color: #b9c3cf; border-radius: 6px; }
.star-input button .icon { width: 30px; height: 30px; }
.star-input button[aria-pressed="true"] { color: #c99a00; }
.star-input button[aria-pressed="true"] .icon { fill: currentColor; }

/* ---------- Logo ---------- */
.brand-lockup { display: block; height: 44px; width: auto; }
.brand-full { display: block; width: 100%; height: auto; }
.brand-tile { display: inline-block; background: #fff; border-radius: var(--r-md); padding: 8px 12px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
