/*
 * Cloud Energi · PDN Hub – Kizad MS design system.
 * Self-contained on purpose: no web fonts or CDNs, so every page renders fully on the
 * offline station Wi-Fi. Components are plain classes driven by the tokens below.
 */

:root {
  color-scheme: light;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  /* Soft gold lines, muted so they stay easy on the eyes: inner dividers, card edges, panel and field edges. */
  --border: #efe3bd;
  --border-card: #e6d9a8;
  --border-strong: #d9c27a;
  --gold-hover: #c9a227;
  --neutral-mark: #cbd5e1;  /* "no status" marks stay grey, so gold never looks like a warning */

  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  --brand: #0d9488;
  --brand-strong: #0f766e;
  --brand-deep: #134e4a;
  --brand-soft: #f0fdfa;
  --brand-border: #99f6e4;
  --brand-ring: rgb(13 148 136 / 0.22);

  --success: #059669;
  --success-text: #047857;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-text: #92400e;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --danger-ring: rgb(220 38 38 / 0.18);
  --info: #2563eb;
  --info-text: #1d4ed8;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --shadow-xs: 0 1px 2px rgb(15 23 42 / 0.05);
  --shadow-sm: 0 1px 3px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.07), 0 2px 4px -2px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 12px 24px -6px rgb(15 23 42 / 0.14), 0 4px 8px -4px rgb(15 23 42 / 0.06);
  --shadow-xl: 0 24px 48px -12px rgb(15 23 42 / 0.28);

  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 64px;
  --container: 1920px;
  --gutter: clamp(16px, 3.2vw, 40px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
a { color: var(--brand-strong); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -0.015em; line-height: 1.3; }
p { margin: 0; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.icon { width: 16px; height: 16px; flex: none; }
.icon-lg { width: 20px; height: 20px; flex: none; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Page changes ---------- */
/* Same-site navigation cross-fades the content while the header stays in place. */
@view-transition { navigation: auto; }
.app-header { view-transition-name: app-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: ease-out; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- App header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, #e9dcae, #c9a227 22%, #ecd58c 50%, #c9a227 78%, #e9dcae) 1;
}
.app-header__inner {
  display: flex; align-items: center; gap: 16px;
  max-width: var(--container); height: var(--header-h);
  margin: 0 auto; padding-inline: var(--gutter);
}
.brand { display: inline-flex; align-items: center; flex: none; border-radius: var(--r-sm); }
.brand img { width: auto; height: 32px; }
/* Product lockup next to the logo: PDN HUB over KIZAD MS. */
.app-header__product, .login-product {
  display: grid; gap: 2px; line-height: 1.05; white-space: nowrap;
}
.app-header__product { padding-left: 16px; border-left: 1px solid #d9c27a; }
.app-header__product strong, .login-product strong {
  color: var(--text); font-size: 13.5px; font-weight: 800; letter-spacing: .09em;
}
.app-header__product > span, .login-product > span {
  color: var(--brand-strong); font-size: 10px; font-weight: 700; letter-spacing: .2em;
}
.login-product { justify-self: center; justify-items: center; margin-top: -6px; }
/* Main navigation: a gold-framed bar with gold dividers; the current page is deep teal and gold. */
.app-nav {
  display: flex; align-items: center; gap: 0; margin-left: 8px; padding: 4px;
  border: 1px solid transparent; border-radius: 14px;
  background: linear-gradient(180deg, #fffdf6, #fbf5e3) padding-box,
    linear-gradient(135deg, #f0dd9c, #c9a227 45%, #e9d48c 70%, #a8861f) border-box;
  box-shadow: 0 6px 14px -10px rgb(122 92 18 / .45), inset 0 1px 0 rgb(255 255 255 / .85);
}
.app-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 15px;
  border: 1px solid transparent; border-radius: 10px; color: #3f4a56; font-size: 14px; font-weight: 650; letter-spacing: -.005em;
  text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.app-nav a + a::before {
  content: ""; position: absolute; top: 8px; bottom: 8px; left: -1px; width: 1px;
  background: linear-gradient(180deg, transparent, #c9a227 25%, #c9a227 75%, transparent);
  transition: opacity .15s;
}
.app-nav a[aria-current="page"]::before, .app-nav a[aria-current="page"] + a::before, .app-nav a:hover::before, .app-nav a:hover + a::before { opacity: 0; }
.app-nav a .icon { width: 16px; height: 16px; color: #a8861f; transition: color .15s, transform .15s; }
.app-nav a:hover { border-color: #e0c877; background: #fff6da; color: #5f4708; }
.app-nav a:hover .icon { color: #8a6d0f; transform: translateY(-1px); }
.app-nav a:active { background: #f6e8b6; transform: translateY(1px) scale(.98); }
.app-nav a[aria-current="page"], .app-nav a[aria-current="page"]:hover {
  border-color: #c9a227; background: linear-gradient(135deg, #14635c, #0b3f3d 60%, #082f2d); color: #f6e8b6;
  box-shadow: 0 8px 16px -9px rgb(8 47 45 / .85), inset 0 1px 0 rgb(246 232 182 / .28);
}
.app-nav a[aria-current="page"] .icon { color: #ecd58c; }
.app-nav a[aria-current="page"]::after {
  content: ""; position: absolute; right: 14px; bottom: 2px; left: 14px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #ecd58c, transparent);
}
.app-nav a:focus-visible { outline: 2px solid #c9a227; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .app-nav a, .app-nav a:active, .app-nav a:hover .icon { transform: none; transition: none; } }
@media (max-width: 1100px) {
  .app-header__product { display: none; }
}
/* Five menu items (CGM Verification added 20-Nov-2026): no menu icons up to 1240 px, and on tablets the
   second words go ("Asset", "CGM"), so the logo, the menu, the flag and the status still fit on one line. */
@media (min-width: 768px) and (max-width: 1240px) {
  .app-nav a { padding: 0 11px; font-size: 13.5px; }
  .app-nav a .icon { display: none; }
}
@media (max-width: 960px) { .nav-more { display: none; } }
/* Tablets: the logo, the menu items, the flag and the status must all fit on one line. */
@media (min-width: 768px) and (max-width: 960px) {
  .app-header__inner { gap: 10px; }
  .app-nav { margin-left: 0; }
  .app-nav a { padding: 0 10px; font-size: 13px; }
  .app-nav a .icon { display: none; }
  .live-status__detail, .live-status__label { display: none; }
  .live-status { padding-inline: 10px; }
}
.app-header__spacer { flex: 1; }

/* Live refresh indicator (refresh-status.js toggles the state classes). */
.live-status {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%;
  min-height: 32px; padding: 4px 12px 4px 10px;
  border: 1px solid #e0c877; border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow-xs); font-size: 13px; white-space: nowrap;
}
.live-status__dot { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--subtle); }
.live-status__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; opacity: 0; }
.live-status__label { color: var(--text); font-weight: 600; }
.live-status__detail { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.live-status.is-live .live-status__dot { background: var(--success); }
.live-status.is-live .live-status__dot::after { animation: live-ping 2.4s cubic-bezier(0, 0, .2, 1) infinite; }
.live-status.is-running .live-status__dot { background: var(--info); }
.live-status.is-running .live-status__dot::after { animation: live-ping 1.1s cubic-bezier(0, 0, .2, 1) infinite; }
.live-status.is-error { border-color: var(--danger-border); background: var(--danger-soft); }
.live-status.is-error .live-status__dot { background: var(--danger); }
.live-status.is-error .live-status__label { color: var(--danger-text); }
.live-status.is-off .live-status__dot { background: var(--subtle); }
@keyframes live-ping { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(2.8); opacity: 0; } }

/* ---------- Layout ---------- */
.shell { max-width: var(--container); margin: 0 auto; padding: 28px var(--gutter) 64px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px; margin-bottom: 24px;
}
.page-head__text { min-width: 0; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand-strong); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.page-head h1 { margin-top: 6px; font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.page-head__lede { margin-top: 6px; color: var(--muted); font-size: 15px; }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* "Data updated HH:mm · N min ago" pill (technician page). */
.data-freshness {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--success-border); border-radius: 999px;
  background: var(--success-soft); color: #065f46; font-size: 13.5px; line-height: 1.35;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow-xs);
}
.data-freshness[hidden] { display: none; }
.data-freshness strong { font-weight: 700; }
.data-freshness__dot { position: relative; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--success); }
.data-freshness__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; opacity: 0;
  animation: live-ping 2.4s cubic-bezier(0, 0, .2, 1) infinite;
}
.data-freshness[data-tone="running"] { border-color: var(--info-border); background: var(--info-soft); color: #1e3a8a; }
.data-freshness[data-tone="running"] .data-freshness__dot { background: var(--info); }
.data-freshness[data-tone="stale"] { border-color: var(--warning-border); background: var(--warning-soft); color: #78350f; }
.data-freshness[data-tone="stale"] .data-freshness__dot { background: var(--warning); }
.data-freshness[data-tone="error"] { border-color: var(--danger-border); background: var(--danger-soft); color: #7f1d1d; }
.data-freshness[data-tone="error"] .data-freshness__dot { background: var(--danger); }
.data-freshness[data-tone="stale"] .data-freshness__dot::after,
.data-freshness[data-tone="error"] .data-freshness__dot::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .data-freshness__dot::after { animation: none; } }
.footer-note { max-width: 900px; margin-top: 24px; color: var(--muted); font-size: 13px; }

.panel, .card {
  min-width: 0; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.panel__title .icon { color: var(--brand); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; line-height: 1.1; text-align: center; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgb(255 255 255 / .14);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.button:hover { background: var(--brand-strong); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); box-shadow: var(--shadow-xs); }
.button.secondary:hover { background: var(--surface-2); border-color: var(--gold-hover); color: var(--text); }
.button.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
.button.ghost:hover { background: var(--surface-3); color: var(--text); }
.button.danger { background: var(--surface); border-color: var(--danger-border); color: var(--danger-text); box-shadow: var(--shadow-xs); }
.button.danger:hover { background: var(--danger-soft); border-color: #fca5a5; }
.button--sm { min-height: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.button--lg { min-height: 48px; padding: 0 20px; font-size: 15px; }
.button .icon { width: 16px; height: 16px; }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badges & callouts ---------- */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  min-height: 22px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge--success, .pill.done { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); }
.badge--warning, .pill { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning-text); }
.badge--danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); }
.badge--brand { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand-strong); }
.badge--info { background: var(--info-soft); border-color: var(--info-border); color: var(--info-text); }
.badge--neutral { background: var(--surface-3); border-color: var(--border); color: var(--text-2); }
/* Awaiting trip older than 24 h (dashboard and technician page). */
.badge--overdue { background: #ffedd5; border-color: #fdba74; color: #9a3412; font-weight: 700; }
/* Dashboard "Filling now" row: calm sage tint, muted gold timer. */
.recent-item.is-filling { background: linear-gradient(90deg, #f2f8f6, transparent 70%); box-shadow: inset 3px 0 0 #7aa99f; }
.recent-item__trip.is-live { color: #2f6a61; font-weight: 600; }
.recent-item__filling { color: #8c6d22; font-weight: 650; font-variant-numeric: tabular-nums; }
.recent-item.is-overdue { background: linear-gradient(90deg, #fff7ed, transparent 70%); box-shadow: inset 3px 0 0 #f97316; }
.pending-trip.is-overdue { border-color: #fdba74; background: linear-gradient(180deg, #fff7ed, var(--surface) 55%); }
.stat-card__sub.is-overdue { color: #c2410c; font-weight: 600; }
.badge--count { min-width: 24px; justify-content: center; font-variant-numeric: tabular-nums; }

.callout, .notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--text-2); font-size: 14px; line-height: 1.5;
}
.callout > .icon { margin-top: 2px; }
.callout--info { background: var(--info-soft); border-color: var(--info-border); color: #1e3a8a; }
.callout--info > .icon { color: var(--info); }
.callout--success { background: var(--success-soft); border-color: var(--success-border); color: #065f46; }
.callout--success > .icon { color: var(--success); }
.callout--warning, .notice { background: var(--warning-soft); border-color: var(--warning-border); color: #78350f; }
.callout--warning > .icon { color: var(--warning); }
.callout--danger, .notice-error { background: var(--danger-soft); border-color: var(--danger-border); color: #7f1d1d; }

.message { display: none; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--r-lg); font-size: 14px; line-height: 1.5; }
.message.show { display: block; }
.message.error { background: var(--danger-soft); border-color: var(--danger-border); color: #7f1d1d; }
.message.warning { background: var(--warning-soft); border-color: var(--warning-border); color: #78350f; }
.message.success { background: var(--success-soft); border-color: var(--success-border); color: #065f46; }

.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.empty, .queue-empty {
  padding: 28px 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--muted); font-size: 14px; text-align: center;
}

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
label, .field-label { color: var(--text-2); font-size: 14px; font-weight: 600; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.required { color: var(--danger); font-weight: 600; }
.optional-label { color: var(--subtle); font-size: 12px; font-weight: 500; }

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: 15px; line-height: 1.4;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:not([type="checkbox"]):not([type="radio"]):hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--gold-hover); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
input[type="date"], input[inputmode="numeric"], input[type="number"] { font-variant-numeric: tabular-nums; }
.field-invalid :is(input, select, textarea, .combobox__input),
:is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--danger) !important; background-color: #fffbfb;
}
.field-invalid :is(input, select, textarea, .combobox__input):focus,
:is(input, select, textarea)[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-ring) !important; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group > input { padding-right: 48px !important; }
.input-group__suffix {
  position: absolute; right: 12px; color: var(--muted);
  font-size: 13px; font-weight: 500; pointer-events: none;
}
.search-field { position: relative; }
.search-field > .icon { position: absolute; top: 50%; left: 12px; color: var(--subtle); transform: translateY(-50%); pointer-events: none; }
.search-field > input { padding-left: 36px !important; }

.field-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.field-note:empty { display: none; }
.field-note.is-ok { color: var(--success-text); }
.field-note.is-warning, .field-note.is-danger {
  padding: 8px 10px; border: 1px solid var(--warning-border); border-radius: var(--r-md);
  background: var(--warning-soft); color: #78350f;
}
.field-note.is-danger { border-color: var(--danger-border); background: var(--danger-soft); color: #7f1d1d; }

/* ---------- Combobox (combobox.js) ---------- */
.combobox { position: relative; min-width: 0; }
.combobox__control { position: relative; display: flex; align-items: center; }
.combobox__icon { position: absolute; left: 12px; color: var(--subtle); pointer-events: none; }
.combobox__input { padding-left: 36px !important; padding-right: 92px !important; text-overflow: ellipsis; }
.combobox__input:not(:focus) { font-weight: 600; }
.combobox__adornments { position: absolute; right: 6px; display: flex; align-items: center; gap: 2px; }
.combobox__badge:empty { display: none; }
.combobox__clear {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--subtle); cursor: pointer;
}
.combobox__clear:hover { background: var(--surface-3); color: var(--text); }
.combobox__chevron { display: grid; place-items: center; width: 24px; color: var(--subtle); pointer-events: none; }
.combobox.is-disabled .combobox__chevron { opacity: .5; }
.combobox__listbox {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(340px, 52vh); margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain;
  list-style: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.combobox__option {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px;
  border-radius: var(--r-md); cursor: pointer; scroll-margin: 6px;
}
.combobox__option.is-active { background: var(--surface-3); }
.combobox__option[aria-selected="true"] { background: var(--brand-soft); }
.combobox__option[aria-selected="true"].is-active { background: #ccfbf1; }
.combobox__option-text { flex: 1; min-width: 0; }
/* People lists (with photos) open wider so full names fit beside the photo. */
@media (min-width: 768px) {
  .combobox:has(.combobox__option .avatar) .combobox__listbox { right: auto; width: max(100%, 360px); }
}
.combobox.has-avatar .combobox__icon { left: 9px; display: inline-flex; }
.combobox.has-avatar .combobox__input { padding-left: 42px !important; }
.combobox__primary, .combobox__secondary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobox__primary { color: var(--text); font-size: 14px; font-weight: 600; }
.combobox__primary mark { background: #fef08a; color: inherit; border-radius: 2px; }
.combobox__secondary { color: var(--muted); font-size: 12px; }
.combobox__check { width: 16px; color: var(--brand); visibility: hidden; }
.combobox__option[aria-selected="true"] .combobox__check { visibility: visible; }
.combobox__empty, .combobox__more { padding: 12px 10px; color: var(--muted); font-size: 13px; text-align: center; }
.combobox.opens-up .combobox__listbox { top: auto; bottom: calc(100% + 6px); }
.combobox__chevron .icon { transition: transform .15s; }
.combobox.is-open .combobox__chevron .icon { transform: rotate(180deg); }
.combobox.is-open .combobox__icon { color: var(--brand); }
.combobox__listbox { animation: listbox-in .12s ease-out; }
@keyframes listbox-in { from { opacity: 0; transform: translateY(-4px); } }
.combobox.opens-up .combobox__listbox { animation-name: listbox-in-up; }
@keyframes listbox-in-up { from { opacity: 0; transform: translateY(4px); } }
.combobox__more { padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }

/* Phone picker (combobox.js): full screen above the keyboard, search on top, big rows. */
.combobox__sheet-head { display: none; }
@media (max-width: 767px) {
  html.combobox-sheet-open, html.combobox-sheet-open body { overflow: hidden; }
  .combobox.is-sheet {
    position: fixed; left: 0; right: 0; top: 0; z-index: 1200; height: 100dvh;
    display: flex; flex-direction: column; gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 0;
    background: var(--surface);
  }
  .combobox.is-sheet .combobox__sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding-bottom: 10px; border-bottom: 1px solid #ecdfb4;
  }
  .combobox__sheet-title { min-width: 0; color: var(--brand-strong); font-size: 17px; font-weight: 700; }
  .combobox__done { flex: none; min-width: 76px; }
  .combobox.is-sheet .combobox__input { min-height: 52px; font-size: 17px; }
  .combobox.is-sheet .combobox__listbox {
    position: static; flex: 1 1 auto; min-height: 0; max-height: none !important;
    padding: 0 0 calc(12px + env(safe-area-inset-bottom));
    border: 0; border-radius: 0; box-shadow: none; animation: none;
  }
  .combobox.is-sheet .combobox__option {
    min-height: 56px; padding: 10px 8px; border-radius: 0; border-bottom: 1px solid var(--border);
  }
  .combobox.is-sheet .combobox__option[aria-selected="true"] { border-radius: var(--r-md); }
  .combobox.is-sheet .combobox__primary { font-size: 16px; }
  .combobox.is-sheet .combobox__secondary { font-size: 13px; }
}

/* ---------- Modal dialog ---------- */
.modal {
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xl);
}
.modal::backdrop { background: rgb(15 23 42 / .5); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal__body { display: flex; gap: 16px; padding: 24px; }
.modal__icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; background: var(--warning-soft); color: var(--warning);
}
.modal__title { font-size: 17px; font-weight: 650; }
.modal__desc { margin-top: 4px; color: var(--muted); font-size: 14px; }
.modal__list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.modal__list li {
  padding: 8px 12px; border: 1px solid var(--warning-border); border-radius: var(--r-md);
  background: var(--warning-soft); color: #78350f; font-size: 13px; line-height: 1.45;
}
.modal__icon--danger { background: var(--danger-soft); color: var(--danger); }
.modal__icon--info { background: var(--info-soft); color: var(--info); }
.modal__content { flex: 1; min-width: 0; }
.modal__subject {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2);
}
.modal__subject .cgm-mark { width: 52px; height: 38px; border-radius: 10px; background-size: 44px auto, auto; }
.modal__subject div { display: grid; min-width: 0; }
.modal__subject strong { color: var(--text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.modal__subject span:last-child { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.modal__confirm--danger { background: var(--danger); }
.modal__confirm--danger:hover { background: #b91c1c; }
.modal__confirm--warning { background: #d97706; }
.modal__confirm--warning:hover { background: #b45309; }
.modal__confirm--info:hover { background: var(--brand-strong); }
.modal__footer {
  display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* =====================================================================
   Driver page
   ===================================================================== */
.driver-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.driver-layout > .page-head { margin-bottom: 4px; }

/* Trip not submitted: the station is filling a CGM that has no driver trip (driver.js). */
.trip-alerts {
  display: grid; gap: 12px; padding: 16px 18px;
  border: 1px solid #e6d9a8; border-left: 4px solid #c9a227; border-radius: var(--r-xl);
  background: linear-gradient(135deg, #fdf6e3, #fffdf7 60%); box-shadow: var(--shadow-sm);
}
.trip-alerts__head { display: flex; align-items: flex-start; gap: 12px; }
.trip-alerts__icon {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: #fbefc6; color: #8a6d0f; box-shadow: inset 0 0 0 1px #ecd58c;
}
.trip-alerts__icon svg { width: 21px; height: 21px; }
.trip-alerts h2 { display: flex; align-items: center; gap: 8px; color: #3f3206; font-size: 17px; font-weight: 700; }
.trip-alerts__count {
  min-width: 24px; padding: 1px 8px; border-radius: 999px; background: #c9a227; color: #fff;
  font-size: 12.5px; font-weight: 700; text-align: center;
}
.trip-alerts__count:empty { display: none; }
.trip-alerts__head p { margin-top: 2px; color: #5b4a12; font-size: 13.5px; line-height: 1.45; }
.trip-alerts__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.trip-alert {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  padding: 11px 14px; border: 1px solid #efe3bd; border-radius: var(--r-lg); background: var(--surface);
}
.trip-alert__main { display: grid; gap: 2px; min-width: 0; flex: 1 1 240px; }
.trip-alert__main strong { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text); font-size: 16px; font-weight: 700; }
.trip-alert__state {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  background: #f1f5f4; color: #475569; font-size: 11.5px; font-weight: 700;
}
.trip-alert.is-filling .trip-alert__state { background: #fbefc6; color: #7a5c00; }
.trip-alert.is-filling .trip-alert__state::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d97706;
  animation: trip-alert-pulse 1.6s ease-in-out infinite;
}
@keyframes trip-alert-pulse { 50% { opacity: .35; transform: scale(.8); } }
.trip-alert__detail { color: var(--muted); font-size: 13px; line-height: 1.4; }
.trip-alert__action { flex: none; }
/* The matching Live arrival, shown before the tap. */
.trip-alert__arrival {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 12px; max-width: 520px;
  border: 1px solid #e6efe9; border-left: 3px solid #4f9a7a; border-radius: var(--r-md);
  background: linear-gradient(90deg, #f1f8f5, var(--surface));
}
.trip-alert__arrival-text { display: grid; gap: 1px; min-width: 0; }
.trip-alert__arrival-text small { color: #3f7d65; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.trip-alert__arrival-text strong { color: var(--text); font-size: 14px; font-weight: 650; }
.trip-alert__arrival-text span { color: var(--muted); font-size: 12.5px; }
.trip-alerts__more { justify-self: start; }
@media (max-width: 767px) {
  .trip-alerts { padding: 14px; }
  .trip-alert__action { width: 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .trip-alert.is-filling .trip-alert__state::before { animation: none; } }

/* Sidebar: my submissions + live arrivals */
.driver-sidebar { display: grid; gap: 16px; align-content: start; min-width: 0; }
.my-trips .panel__head { padding-bottom: 8px; border-bottom: 0; }
.my-trips__list { display: grid; gap: 6px; margin: 0; padding: 0 16px 4px; list-style: none; }
.my-trip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border-card); border-radius: var(--r-md); background: var(--surface);
}
.my-trip.is-editing { border-color: var(--brand); background: var(--brand-soft); }
.my-trip__main { display: grid; min-width: 0; }
.my-trip__main strong { color: var(--text); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.my-trip__main span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.my-trips__note { padding: 8px 20px 14px; color: var(--muted); font-size: 12px; }
.edit-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--info-border); border-radius: var(--r-md); background: var(--info-soft); color: #1e3a8a; font-size: 14px;
}
.edit-banner > span { flex: 1; min-width: 0; }
.edit-banner > .icon { color: var(--info); }
.time-validation-warning { color: var(--warning-text); font-weight: 600; }
.time-validation-warning::before { background: var(--warning); }

/* Time picker (time-picker.js) */
.time-field { position: relative; min-width: 0; }
.time-field > input { padding-right: 44px !important; }
.time-field__button {
  position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 34px; height: 34px;
  padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: var(--muted);
  transform: translateY(-50%); cursor: pointer; transition: background-color .15s, color .15s;
}
.time-field__button:hover, .time-field.is-open .time-field__button { background: var(--brand-soft); color: var(--brand-strong); }
.time-picker {
  position: absolute; z-index: 35; top: calc(100% + 6px); right: 0; width: 252px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg);
  animation: listbox-in .12s ease-out;
}
.time-field.opens-up .time-picker { top: auto; bottom: calc(100% + 6px); }
.time-picker__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.time-picker__title { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.time-picker__value { color: var(--text); font-size: 24px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.time-picker__columns { display: grid; grid-template-columns: 1fr 1fr; }
.time-picker__column + .time-picker__column { border-left: 1px solid var(--border); }
.time-picker__label { padding: 8px 0 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-align: center; text-transform: uppercase; }
.time-picker__list { height: 216px; padding: 2px 8px 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.time-picker__option {
  display: block; width: 100%; height: 36px; border: 0; border-radius: var(--r-md); background: transparent;
  color: var(--text-2); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer;
}
.time-picker__option:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.time-picker__option.is-selected, .time-picker__option.is-selected:hover:not(:disabled) { background: var(--brand); color: #fff; font-weight: 700; }
.time-picker__option:disabled { color: var(--neutral-mark); cursor: not-allowed; }
.time-picker__foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.time-picker-backdrop { display: none; }
@media (max-width: 767px) {
  .time-picker {
    position: fixed; z-index: 60; inset: auto 0 0 0; width: auto;
    padding-bottom: env(safe-area-inset-bottom); border-radius: 20px 20px 0 0;
    animation: sheet-in .2s ease-out;
  }
  .time-field.opens-up .time-picker { bottom: 0; }
  .time-picker__head { padding: 18px 20px; }
  .time-picker__value { font-size: 30px; }
  .time-picker__list { height: 264px; }
  .time-picker__option { height: 46px; font-size: 18px; }
  .time-picker__foot { padding: 12px 16px; }
  .time-picker__foot .button { flex: 1; min-height: 48px; font-size: 16px; }
  .time-picker-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 55; background: rgb(15 23 42 / .45); }
  body.time-picker-open { overflow: hidden; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }

/* Live arrivals */
.arrivals { display: flex; flex-direction: column; min-height: 0; }
.arrivals .panel__head { border-bottom: 0; padding-bottom: 8px; }
.arrivals__tools { display: grid; gap: 8px; padding: 0 20px 12px; }
.arrivals__status { color: var(--muted); font-size: 12px; }
.arrivals__status:empty, #workbook-refresh-message:empty { display: none; }
.arrival-list { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 4px 20px 16px; overflow-y: auto; }
.arrivals__more { margin: 0 20px 16px; }
.arrival-chip {
  position: relative; display: grid; flex: none; gap: 6px; width: 100%; min-width: 0; overflow: hidden;
  padding: 12px 14px 10px 17px; border: 1px solid var(--border-card); border-radius: var(--r-lg);
  background: linear-gradient(180deg, #ffffff, #fbfcfd); color: inherit; text-align: left; cursor: pointer;
  box-shadow: var(--shadow-xs); -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, box-shadow .15s, transform .15s, background-color .15s;
}
.arrival-chip::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--success); }
.arrival-chip:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--brand-border); box-shadow: var(--shadow-md); }
.arrival-chip:active:not(:disabled) { transform: translateY(0); }
.arrival-chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.arrival-chip:disabled { background: var(--surface-2); box-shadow: none; cursor: not-allowed; }
.arrival-chip:disabled::before { background: var(--neutral-mark); }
.arrival-chip:disabled .arrival-chip__truck, .arrival-chip:disabled .arrival-chip__line { color: var(--muted); }
.arrival-chip__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; margin-bottom: 2px; }
.arrival-chip__vehicle { display: flex; align-items: center; gap: 8px; min-width: 0; }
.arrival-chip__truck { color: var(--text); font-size: 16px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.arrival-chip__line { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.arrival-chip__line .icon { width: 14px; height: 14px; flex: none; color: var(--subtle); }
.arrival-chip__line--muted { color: var(--text-2); font-size: 13px; font-weight: 400; }
.arrival-chip__line.is-empty { color: var(--subtle); font-style: italic; }
.arrival-chip__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrival-chip__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums;
}
.arrival-chip__when { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.arrival-chip__when .icon { width: 13px; height: 13px; }
.arrival-chip__ago { white-space: nowrap; }
.arrival-chip__ago.is-new { display: inline-flex; align-items: center; gap: 5px; color: var(--success-text); font-weight: 600; }
.arrival-chip__ago.is-new::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgb(5 150 105 / .15); }

/* Trip form */
.trip-form { display: flex; flex-direction: column; }
.trip-form__head { display: grid; gap: 12px; padding: 20px 24px 4px; }
.data-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 13px; }
.data-status.notice-error { padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: var(--r-md); }
.stepper { display: none; gap: 8px; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stepper__step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%;
  padding: 0 0 2px; border: 0; background: none; color: var(--muted);
  font-size: 12px; font-weight: 600; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stepper__step::before { content: ""; width: 100%; height: 4px; border-radius: 999px; background: var(--border); transition: background-color .2s; }
.stepper__step.is-complete { color: var(--text-2); }
.stepper__step.is-complete::before, .stepper__step[aria-current="step"]::before { background: var(--brand); }
.stepper__step[aria-current="step"] { color: var(--brand-strong); }

.form-step { padding: 20px 24px 24px; }
.form-step + .form-step { border-top: 1px solid var(--border); }
.form-step__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.step-number {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border: 1px solid var(--brand-border); border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; font-weight: 700;
}
.form-step__title { font-size: 16px; font-weight: 650; }
.form-step__desc { margin-top: 2px; color: var(--muted); font-size: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.autofill-note { margin-bottom: 16px; }
.autofill-note:empty { display: none; }
.datetime { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(96px, 1fr); gap: 8px; }
.time-validation { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: -4px; }
.time-validation::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--subtle); }
.time-validation-error { color: var(--danger-text); font-weight: 600; }
.time-validation-error::before { background: var(--danger); }

.review-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 20px 0 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.review-summary div { min-width: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.review-summary div:nth-child(odd) { border-right: 1px solid var(--border); }
.review-summary div:nth-last-child(-n + 2) { border-bottom: 0; }
.review-summary dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.review-summary dd { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.review-summary__title { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; font-size: 14px; font-weight: 600; }

.form-message { margin: 0 24px; }
.form-message.show { margin-top: 12px; }
.form-footer {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  margin-top: auto; padding: 14px 24px;
  border-top: 1px solid var(--border); border-radius: 0 0 var(--r-xl) var(--r-xl);
  background: rgb(255 255 255 / .94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.submit-guidance { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.submit-guidance::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--subtle); }
.submit-guidance-ready { color: var(--success-text); }
.submit-guidance-ready::before { background: var(--success); }
.submit-guidance-warning { color: var(--warning-text); }
.submit-guidance-warning::before { background: var(--warning); }
.submit-guidance-error { color: var(--danger-text); font-weight: 600; }
.submit-guidance-error::before { background: var(--danger); }
.form-footer__actions { display: flex; flex: none; gap: 8px; }
.wizard-back, .wizard-next { display: none !important; }

@media (min-width: 1024px) {
  .driver-layout { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); gap: 24px; }
  .driver-layout > .page-head { grid-column: 1 / -1; }
  /* In the narrow left column: the button goes under the details, full width. */
  .driver-sidebar .trip-alert__action { width: 100%; }
  .driver-sidebar { align-self: stretch; }
  .arrivals {
    position: sticky; top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 40px);
  }
  .review-summary, .review-summary__title { display: none; }
}
@media (min-width: 1440px) {
  .driver-layout { grid-template-columns: 400px minmax(0, 1fr); }
}
/* Wide desktop: use the extra width for more columns instead of wider inputs. */
@media (min-width: 1600px) {
  .driver-layout { grid-template-columns: 420px minmax(0, 1fr); }
  .page-driver .field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .page-driver .time-validation { order: 1; }
  .page-driver .form-step[data-step="3"] .field { grid-column: span 2; }
  .stat-grid { gap: 20px; }
  .qr-grid { gap: 20px; }
}

/* Wizard mode: phones and tablets */
@media (max-width: 1023px) {
  .stepper { display: grid; }
  .form-step:not(.is-active) { display: none; }
  .form-step + .form-step { border-top: 0; }
  body[data-wizard-step="2"] .driver-sidebar, body[data-wizard-step="3"] .driver-sidebar { display: none; }
  .trip-form:not([data-step="1"]) .data-status:not(.notice-error) { display: none; }
  .form-step .step-number { display: none; }
  .arrival-list {
    flex-direction: row; gap: 10px; padding: 4px 20px 16px;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding-inline: 20px;
    scrollbar-width: thin;
  }
  .arrival-chip { flex: 0 0 min(272px, 78vw); scroll-snap-align: start; }
  .arrival-list > .queue-empty { flex: 1 0 100%; }
  .form-footer { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .form-footer__actions { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; }
  .form-footer .button { min-height: 48px; font-size: 16px; }
  .trip-form:not([data-step="1"]) .wizard-back { display: inline-flex !important; }
  .trip-form:not([data-step="3"]) .wizard-next { display: inline-flex !important; }
  .trip-form:not([data-step="3"]) button[type="submit"] { display: none; }
}

@media (max-width: 639px) {
  .page-driver .page-head__lede { display: none; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .review-summary { grid-template-columns: minmax(0, 1fr); }
  .review-summary div:nth-child(odd) { border-right: 0; }
  .review-summary div:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  .trip-form__head, .form-step { padding-inline: 16px; }
  .form-message { margin-inline: 16px; }
  .arrivals .panel__head, .arrivals__tools { padding-inline: 16px; }
  .arrival-list { padding-inline: 16px; scroll-padding-inline: 16px; }
  .arrivals__more { margin-inline: 16px; }
}

/* Live arrivals carousel: phones only. One whole card per swipe, nothing cut off or truncated. */
.arrival-carousel-nav { display: none; }
@media (max-width: 767px) {
  .arrival-list {
    /* The gap equals the side padding, so only one whole card is ever in view. */
    gap: 16px; padding: 6px 16px 10px; scroll-padding-inline: 16px;
    /* Each card keeps its own height (the old card size); only long names or places add a line. */
    align-items: flex-start; box-sizing: border-box; transition: height .22s ease;
    scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scroll-behavior: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .arrival-list::-webkit-scrollbar { display: none; }
  /* Same compact size as the old card; only the width changes to one full card. */
  .arrival-chip {
    flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always;
    border-radius: 14px;
    background:
      radial-gradient(120% 90% at 100% 0%, rgb(13 148 136 / .07), transparent 55%),
      linear-gradient(180deg, #ffffff, #f9fbfc);
    box-shadow: 0 1px 2px rgb(15 23 42 / .05), 0 10px 24px -14px rgb(15 23 42 / .22);
  }
  .arrival-chip::before { background: linear-gradient(180deg, #10b981, var(--brand)); }
  .arrival-chip:hover:not(:disabled), .arrival-chip:active:not(:disabled) { transform: none; }
  .arrival-chip[aria-pressed="true"] {
    background: linear-gradient(180deg, var(--brand-soft), #ffffff);
    box-shadow: 0 0 0 2px var(--brand), 0 10px 24px -14px rgb(13 148 136 / .45);
  }
  .arrival-chip__vehicle { flex-wrap: wrap; }
  /* Long names and locations wrap instead of being cut off with "…". */
  .arrival-chip__text { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
  .arrival-chip__line--muted { align-items: flex-start; }
  .arrival-chip__line--muted .icon { margin-top: 2px; }
  .arrival-list > .queue-empty { margin: 0; }

  .arrival-carousel-nav { display: flex; align-items: center; gap: 14px; padding: 12px 16px 18px; }
  .arrival-carousel-nav[hidden] { display: none; }
  .carousel-btn {
    display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0;
    border: 1px solid var(--border-strong); border-radius: 50%;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background-color .15s, border-color .15s, opacity .15s, transform .1s;
  }
  .carousel-btn .icon { width: 20px; height: 20px; }
  .carousel-btn:active:not(:disabled) { transform: scale(.94); background: var(--brand-soft); border-color: var(--brand-border); }
  .carousel-btn:disabled { opacity: .35; box-shadow: none; cursor: default; }
  .carousel-progress { display: grid; flex: 1; justify-items: center; gap: 7px; min-width: 0; }
  .carousel-count { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .carousel-count strong { color: var(--text); font-size: 15px; font-weight: 750; }
  .carousel-track { position: relative; width: 100%; height: 4px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
  .carousel-fill {
    position: absolute; inset: 0 auto 0 0; min-width: 8px; border-radius: inherit;
    background: linear-gradient(90deg, #10b981, var(--brand)); transition: width .28s cubic-bezier(.2, .7, .2, 1);
  }
}
@media (max-width: 767px) {
  /* Auto swipe: a thin line fills along the card in view until the next card slides in. */
  .arrival-list.is-autoplay .arrival-chip.is-current::after {
    content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 3px;
    background: linear-gradient(90deg, #10b981, var(--brand));
    transform: scaleX(0); transform-origin: left center;
    animation: carousel-timer var(--autoplay-ms, 4000ms) linear forwards;
  }
  /* Opening the page: the first card slides in from the right. */
  .arrival-list.is-entering .arrival-chip { animation: carousel-enter .7s cubic-bezier(.16, 1, .3, 1) both; }
}
@keyframes carousel-timer { to { transform: scaleX(1); } }
@keyframes carousel-enter { from { opacity: 0; transform: translateX(48px) scale(.97); } }
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .carousel-fill, .arrival-list { transition: none; }
  .arrival-list.is-entering .arrival-chip { animation: none; }
}

/* =====================================================================
   Technician login
   ===================================================================== */
.page-login {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, #ccfbf1 0, transparent 60%),
    var(--bg);
}
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login-card {
  display: grid; gap: 16px; width: min(420px, 100%); padding: 32px;
  border-radius: 20px; box-shadow: var(--shadow-xl);
}
.login-brand { justify-self: center; }
.login-brand img { height: 36px; }
.login-lock {
  display: grid; place-items: center; justify-self: center; width: 52px; height: 52px; margin-top: 4px;
  border: 1px solid var(--brand-border); border-radius: 16px;
  background: linear-gradient(180deg, #f0fdfa, #ccfbf1); color: var(--brand-strong);
}
.login-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; text-align: center; }
.login-subtitle { margin-top: -8px; color: var(--muted); font-size: 14px; text-align: center; }
.password-field { position: relative; }
.password-field input { padding-right: 48px !important; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: var(--subtle);
  transform: translateY(-50%); cursor: pointer;
}
.password-toggle:hover, .password-toggle[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.login-submit { width: 100%; }
.login-back { justify-self: center; color: var(--muted); font-size: 13px; text-decoration: none; }
.login-back:hover { color: var(--text); }
.logout-button { flex: none; }

/* =====================================================================
   Dashboard
   ===================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat-card { display: flex; align-items: flex-start; gap: 14px; padding: 20px; }
.stat-card__icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: var(--r-lg); background: var(--brand-soft); color: var(--brand-strong);
}
.stat-card__icon--warning { background: var(--warning-soft); color: var(--warning); }
.stat-card__icon--success { background: var(--success-soft); color: var(--success); }
.stat-card__label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-card__value { margin-top: 2px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.qr-card { display: flex; align-items: center; gap: 24px; padding: 24px; }
.qr-card img {
  width: 152px; height: 152px; flex: none; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: #fff;
}
.qr-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.qr-copy h2 { font-size: 18px; font-weight: 650; }
.qr-copy p { color: var(--muted); font-size: 14px; }
.qr-copy .url { overflow-wrap: anywhere; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dashboard-note { margin-top: 16px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.dashboard-grid > .qr-grid { margin-top: 0; }
.recent-panel { display: flex; flex-direction: column; min-width: 0; }
.recent-list { margin: 0; padding: 0 8px 10px; list-style: none; }
/* Every row shares one column template so trip no., status and time line up. */
.recent-item {
  position: relative; display: grid; align-items: center; column-gap: 16px;
  grid-template-columns: 52px minmax(0, 1fr) 92px 104px 128px;
  padding: 10px 12px; border-radius: var(--r-md); transition: background-color .12s;
}
.recent-item:not(.recent-header):hover { background: var(--surface-2); }
.recent-item:not(.recent-header) + .recent-item::before { content: ""; position: absolute; top: 0; left: 80px; right: 12px; height: 1px; background: var(--border); }
.recent-header {
  padding-top: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); border-radius: 0;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}
.recent-header__time { text-align: right; }
.recent-group {
  display: flex; align-items: center; gap: 8px; margin: 14px 12px 2px;
  color: var(--text-2); font-size: 12px; font-weight: 700;
}
.recent-group::after { content: ""; flex: 1; height: 1px; background: var(--border); order: 3; }
.recent-group__count { order: 2; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 600; }
/* Status groups on the dashboard: the same calm dots as the technician page. */
.recent-group { margin-top: 18px; color: var(--text); font-size: 12.5px; }
.recent-group__hint { order: 4; color: var(--subtle); font-size: 11.5px; font-weight: 500; font-style: normal; white-space: nowrap; }
.recent-group .status-dot { order: 0; }
.recent-group__label { order: 1; }
.recent-group[data-status="filling"] .status-dot { background: #7aa99f; box-shadow: 0 0 0 3px #e6f1ee; }
.recent-group[data-status="ready"] .status-dot { background: #4f9a7a; box-shadow: 0 0 0 3px #e3f2eb; }
.recent-group[data-status="completed"] .status-dot { background: #0f766e; box-shadow: 0 0 0 3px #e0efed; }
.badge--ready { border-color: #bfdccd; background: #ecf6f0; color: #1f5c43; }
@media (max-width: 767px) { .recent-group__hint { display: none; } }
.recent-item .cgm-mark { width: 52px; height: 38px; border-radius: 10px; background-size: 44px auto, auto; }
.recent-item__main { display: grid; gap: 3px; min-width: 0; }
.recent-item__main strong { color: var(--text); font-size: 15px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.recent-item__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-width: 0; overflow: hidden; color: var(--muted); font-size: 13px; white-space: nowrap; }
.recent-item__fact { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 5px; min-width: 0; }
.recent-item__fact:first-child { flex: none; }
.recent-item__fact > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.recent-item__fact .icon { width: 13px; height: 13px; flex: none; color: var(--subtle); }
.recent-item__trip { color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.recent-item__trip.is-empty { color: var(--subtle); font-weight: 400; }
.recent-item__status { justify-self: start; }
.recent-item__time { display: grid; justify-items: end; gap: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.recent-item__time strong { color: var(--text); font-size: 14px; font-weight: 650; }
.recent-item__time span { color: var(--muted); font-size: 12px; }
.recent-item__time span.is-future { color: var(--warning-text); font-weight: 600; }
.stat-card__sub { margin-top: 2px; color: var(--muted); font-size: 13px; }
.recent-empty { padding: 24px; color: var(--muted); font-size: 14px; text-align: center; }
@media (min-width: 1280px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; }
  .dashboard-grid > .qr-grid { grid-template-columns: minmax(0, 1fr); align-content: start; }
}
@media (max-width: 767px) {
  .recent-item { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; }
  .recent-header, .recent-item__trip { display: none; }
  .recent-item__facts { flex-wrap: wrap; white-space: normal; }
  .recent-item__time { grid-column: 2 / -1; grid-row: 2; display: flex; gap: 8px; justify-items: start; }
  .recent-item__time strong { font-size: 13px; }
}

/* =====================================================================
   Technician queue
   ===================================================================== */
.export-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.select-all, .pdn-select { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.export-status { flex-basis: 100%; color: var(--muted); font-size: 12px; text-align: right; }
.export-status:empty { display: none; }

.queue { display: grid; gap: 32px; }
.queue-section { min-width: 0; }
.queue-section-heading { display: flex; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.queue-section-heading > div:first-child { flex: 1; min-width: 0; }
.queue-section-heading h2 { font-size: 17px; font-weight: 650; }
.queue-section-heading p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.queue-section-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 8px;
  border: 1px solid var(--brand-border); border-radius: 999px; background: var(--brand-soft);
  color: var(--brand-strong); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pending-section .queue-section-count { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning-text); }

.day-group + .day-group { margin-top: 20px; }
.day-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0 2px; color: var(--text-2); font-size: 13px; }
.day-heading strong { font-weight: 650; white-space: nowrap; }
.day-heading span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.day-heading::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.queue-section-items { display: grid; gap: 8px; }
/* Awaiting trips grouped by status (technician page): calm dot, label, count and hint. */
.status-group + .status-group { margin-top: 22px; }
.status-heading { gap: 9px; margin-bottom: 10px; }
.status-heading strong { color: var(--text); font-size: 13.5px; letter-spacing: -.005em; }
.status-heading em { order: 3; color: var(--subtle); font-size: 12px; font-style: normal; white-space: nowrap; }
.status-heading::after { order: 2; }
.status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #9aa6b5; box-shadow: 0 0 0 3px #eef1f5; }
.status-group[data-status="filling"] .status-dot { background: #7aa99f; box-shadow: 0 0 0 3px #e6f1ee; }
.status-group[data-status="ready"] .status-dot { background: #4f9a7a; box-shadow: 0 0 0 3px #e3f2eb; }
/* Sort order of the group, a quiet chip before the line. */
.order-chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.status-group[data-status="waiting"] .order-chip { border-color: #e6d9b5; background: #fbf7ec; color: #7a6526; }
@media (max-width: 767px) { .status-heading em { display: none; } }

.queue-item {
  min-width: 0; padding: 14px 18px;
  border: 1px solid var(--border-card); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs);
  transition: box-shadow .15s, border-color .15s;
}
.queue-item:hover { box-shadow: var(--shadow-md); }
.pending-trip { position: relative; padding-top: 10px; padding-bottom: 10px; }
.pending-trip::before {
  content: ""; position: absolute; inset: -1px auto -1px -1px; width: 4px; border-radius: var(--r-lg) 0 0 var(--r-lg); background: var(--neutral-mark);
}
.pending-trip:has(.match-badge.badge--success)::before { background: var(--success); }
.pending-trip:has(.match-badge.badge--warning)::before, .pending-trip:has(.match-badge.badge--danger)::before { background: var(--warning); }

/* "Filling now": ROAMS shows this CGM filling. Compact and calm: soft sage-teal tint, deep muted
   teal text, muted gold accents (no vibrant colours, same height as the "1 match" table). */
.badge--filling {
  position: relative; padding-left: 19px;
  border-color: #c3dcd5; background: #e9f3f0; color: #24564f; font-weight: 650;
}
.badge--filling::before {
  content: ""; position: absolute; top: 50%; left: 8px; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: #b08d3a; animation: filling-dot 2s ease-in-out infinite;
}
@keyframes filling-dot { 50% { opacity: .35; } }
.pending-trip.is-filling { border-color: #cfe2dc; background: linear-gradient(180deg, #f7fbf9, var(--surface) 70%); }
.pending-trip.is-filling::before { background: #7aa99f; }

.filling-now {
  position: relative; display: flex; align-items: stretch; overflow: hidden; min-height: 52px;
  border: 1px solid #d6e6e1; border-radius: var(--r-md);
  background: linear-gradient(90deg, #f2f8f6, #fbfdfc 55%);
}
.filling-now__lead {
  display: flex; flex: none; align-items: center; gap: 10px; padding: 6px 14px 6px 12px;
  border-right: 1px solid #e1ece8;
}
.filling-now__pulse {
  position: relative; display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 50%; background: #e3efeb; color: #2f6a61;
}
.filling-now__pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgb(176 141 58 / .45);
  animation: filling-ring 2.4s ease-out infinite;
}
@keyframes filling-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.45); opacity: 0; } }
.filling-now__pulse .icon { display: none; }
.filling-now__pulse { background: url("/cgm-3d.svg?v=2") center / 24px auto no-repeat, #eaf3f0; }
.filling-now__title { display: grid; gap: 1px; white-space: nowrap; }
.filling-now__title strong { color: #1f4d47; font-size: 13.5px; font-weight: 700; }
.filling-now__title > span { color: #6b8580; font-size: 12px; font-variant-numeric: tabular-nums; }
.filling-now__elapsed { color: #8c6d22; font-weight: 700; }
.filling-now__facts {
  display: grid; flex: 1; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); align-items: center;
  gap: 4px 0; margin: 0; padding: 6px 4px;
}
.filling-now__fact { min-width: 0; padding: 2px 12px; }
.filling-now__fact + .filling-now__fact { border-left: 1px solid #e6efec; }
.filling-now__fact dt { color: #7b918c; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.filling-now__fact dd { margin: 1px 0 0; color: #1e293b; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.filling-now__flow { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; overflow: hidden; background: #e6efec; }
.filling-now__flow span {
  position: absolute; inset: 0 auto 0 0; width: 35%;
  background: linear-gradient(90deg, transparent, #8db8ae, #c9ad6a, transparent);
  animation: filling-flow 2.4s ease-in-out infinite;
}
@keyframes filling-flow { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
/* Wider screens: a fixed lead and five equal columns, so Trip No., Dispenser and the rest line up
   across every Filling now card. */
@media (min-width: 768px) {
  .filling-now__lead { width: 212px; box-sizing: border-box; }
  .filling-now__facts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .filling-now { flex-direction: column; }
  .filling-now__lead { border-right: 0; border-bottom: 1px solid #e1ece8; }
}
@media (prefers-reduced-motion: reduce) {
  .badge--filling::before, .filling-now__pulse::after, .filling-now__flow span { animation: none; }
}
.queue-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.pending-trip-actions { display: flex; flex: none; align-items: center; gap: 6px; }

/* Trip identity: CGM headline, truck tag and driver */
.trip-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* CGM mark: the Cloud Energi CGM trailer (3D-style SVG, no numbers) on a soft white tile.
   Used on technician cards, dashboard rows and dialogs; the old tank icon inside is hidden. */
.cgm-mark {
  position: relative; display: grid; place-items: center; width: 60px; height: 44px; flex: none;
  border: 0; border-radius: 12px;
  background: url("/cgm-3d.svg?v=2") center 54% / 50px auto no-repeat, linear-gradient(180deg, #ffffff, #eef3f6);
  box-shadow: inset 0 0 0 1px #e2e8ef, 0 1px 2px rgb(15 23 42 / .06);
}
.cgm-mark > .icon { display: none; }
/* Filling now: a calm gold ring around the trailer tile. */
.pending-trip.is-filling .trip-identity > .cgm-mark,
.recent-item.is-filling > .cgm-mark { box-shadow: inset 0 0 0 1px #d6e6e1, 0 0 0 3px rgb(176 141 58 / .14); }
.pending-trip.is-filling .trip-identity > .cgm-mark::after,
.recent-item.is-filling > .cgm-mark::after {
  content: ""; position: absolute; inset: -3px; border-radius: 14px; border: 1.5px solid rgb(176 141 58 / .5);
}
.trip-identity__text { min-width: 0; }
.trip-identity__name { overflow: hidden; color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.trip-identity__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; }
.trip-identity__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.trip-identity__head .trip-identity__name { min-width: 0; }
/* Awaiting cards: room for the longest CGM no. (CGM-101), so every badge starts in one column. */
.pending-trip .trip-identity__head .trip-identity__name { min-width: 4.6em; }
.trip-identity__badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.trip-identity__text > .meta-time { display: flex; width: fit-content; margin: 3px 0 0; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--text-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.meta-driver { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--text-2); font-size: 13px; font-weight: 500; }
.tag .icon, .meta-time .icon, .meta-driver .icon { width: 13px; height: 13px; color: var(--subtle); }
.meta-time { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.match-badge { margin-left: 2px; cursor: default; }
.trip-remark { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 12px; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }

.icon-button {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--subtle); cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-button.delete-trip-button:hover { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.icon-button:disabled { opacity: .6; cursor: wait; }
.tech-workspace { min-width: 0; }
.tech-reopen { margin-top: 8px; }

/* Filling row + operator + confirm on one line */
.tech-form-inner { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-top: 12px; }
.candidate-table { flex: 1 0 auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.filling-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.filling-table th { padding: 6px 10px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-align: left; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.filling-table th:first-child, .filling-table td:first-child { width: 40px; padding-right: 0; }
.filling-table td { height: 40px; padding: 4px 10px; border-top: 1px solid var(--surface-3); color: var(--text-2); }
.filling-table td strong { color: var(--text); }
.filling-table tbody tr { cursor: pointer; transition: background-color .12s; }
.filling-table tbody tr:first-child td { border-top: 0; }
.filling-table tbody tr:hover { background: var(--surface-2); }
.filling-table tbody tr:has(input:checked) { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.row-select { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; cursor: pointer; }
.tech-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.tech-actions .combobox { width: 220px; }
.tech-actions .combobox__input { min-height: 40px !important; font-size: 14px !important; }
.tech-actions select { width: 184px; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.tech-actions .button { min-height: 40px; }
.tech-actions .confirm-loading { min-width: 96px; }
.tech-actions .close-filling-table { padding: 0 10px; }
.auto-fields { flex-basis: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.auto-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; }
.auto-value { min-width: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.auto-value strong { display: block; margin-top: 1px; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.preview-warning { margin-top: 8px; color: var(--warning-text); font-size: 12px; font-weight: 600; }
.tech-form-inner .message { flex-basis: 100%; }

/* Wide screens: identity | filling row + actions | delete, all on one line */
@media (min-width: 1280px) {
  .pending-trip { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) auto; align-items: center; column-gap: 20px; }
  .pending-trip > .queue-top { display: contents; }
  .pending-trip .trip-identity { grid-column: 1; grid-row: 1; }
  .pending-trip .pending-trip-actions { grid-column: 3; grid-row: 1; }
  .pending-trip .tech-workspace { grid-column: 2; grid-row: 1; }
  .pending-trip .tech-form-inner { margin-top: 0; }
  .pending-trip .tech-reopen { margin-top: 0; }
  /* No filling row yet: identity takes the full line. */
  .pending-trip:has(.tech-form[hidden]):not(:has(.tech-reopen:not([hidden]))) { grid-template-columns: minmax(0, 1fr) auto; }
  .pending-trip:has(.tech-form[hidden]):not(:has(.tech-reopen:not([hidden]))) .pending-trip-actions { grid-column: 2; }
  .pending-trip:has(.tech-form[hidden]):not(:has(.tech-reopen:not([hidden]))) .tech-workspace { display: none; }
}
@media (max-width: 1023px) {
  .candidate-table { flex: 1 1 100%; min-width: 0; }
}

/* Trip number audit */
.audit-bar { margin-bottom: 14px; }
.audit-bar > span { min-width: 0; overflow-wrap: anywhere; }
.trip-gap {
  display: flex; align-items: center; gap: 12px 16px; padding: 10px 18px;
  border: 1px dashed #f59e0b; border-radius: var(--r-lg); background: var(--warning-soft); color: #78350f; font-size: 13px;
}
.trip-gap__icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--warning-border); border-radius: var(--r-lg); background: #fef3c7; color: var(--warning-text);
}
.trip-gap__icon .icon { width: 18px; height: 18px; }
.trip-gap strong { flex: none; color: var(--warning-text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trip-gap__reason { min-width: 0; }
/* A CGM filling in ROAMS with no driver trip, at the top of "Filling now". */
.no-trip-filling {
  display: flex; align-items: center; gap: 12px 16px; padding: 10px 18px;
  border: 1px solid var(--warning-border); border-left: 4px solid #d97706; border-radius: var(--r-lg);
  background: var(--warning-soft); color: #78350f; font-size: 13px;
}
.no-trip-filling strong { flex: none; color: var(--warning-text); font-size: 16px; font-weight: 700; }
.no-trip-filling__text { min-width: 0; }
.no-trip-filling__text b { font-weight: 700; }
.completed-trip-row[data-duplicate="true"] { border-color: var(--danger-border); box-shadow: inset 4px 0 0 var(--danger), var(--shadow-xs); }
.completed-detail-row strong .badge { margin-left: 4px; vertical-align: 1px; }
@media (max-width: 767px) {
  .trip-gap, .no-trip-filling { flex-wrap: wrap; padding: 10px 14px; }
  .trip-gap__reason, .no-trip-filling__text { flex-basis: 100%; }
}

.completed-trip-row {
  display: grid; align-items: center; gap: 8px 16px; padding: 12px 18px;
  grid-template-columns: minmax(260px, 1.6fr) repeat(4, minmax(110px, .8fr)) auto;
}
/* A completed card not built yet keeps about its real height, so the page does not jump while scrolling. */
.completed-trip-row.is-lazy { min-height: 76px; background: linear-gradient(90deg, #fbf7ec, var(--surface) 70%); }
.completed-trip-identity { min-width: 0; }
.completed-detail-row { display: grid; gap: 1px; min-width: 0; padding-left: 16px; border-left: 1px solid var(--border); }
.completed-detail-row span { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.completed-detail-row strong { overflow-wrap: anywhere; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.completed-trip-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.undo-loading-button { color: var(--muted); }
.undo-loading-button:hover { background: var(--warning-soft); color: var(--warning-text); }

@media (max-width: 1180px) {
  .completed-trip-row { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
  .completed-trip-row.is-lazy { min-height: 117px; }
  .completed-trip-identity { grid-column: 1 / -1; }
  .completed-detail-row:nth-child(2) { padding-left: 0; border-left: 0; }
}

/* ---------- Avatars (driver photos) ---------- */
/* Round photo with initials underneath: initials show until the photo loads or if it fails. */
.avatar {
  position: relative; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(135deg, #ccfbf1, var(--brand-soft) 55%, #e0f2fe);
  color: var(--brand-strong); font-weight: 700; letter-spacing: .02em; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgb(15 23 42 / .14);
}
.avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s ease-out;
}
.avatar.has-photo img { opacity: 1; }
.avatar.has-photo .avatar__initials { visibility: hidden; }
.avatar--xs { width: 24px; height: 24px; font-size: 9.5px; box-shadow: 0 0 0 1.5px var(--surface), 0 1px 2px rgb(15 23 42 / .14); }
.avatar--sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar--xl { width: 72px; height: 72px; border-radius: 20px; font-size: 22px; box-shadow: 0 0 0 3px var(--surface), 0 6px 16px -4px rgb(15 23 42 / .28); }

/* Selected driver: photo card with name, role, ID and licence status. */
.driver-card {
  display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 12px 14px;
  border: 1px solid var(--brand-border); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--brand-soft), #ffffff 70%);
  box-shadow: var(--shadow-xs);
  animation: driver-card-in .22s ease-out;
}
.driver-card[hidden] { display: none; }
.driver-card.needs-review { border-color: var(--warning-border); background: linear-gradient(135deg, var(--warning-soft), #ffffff 70%); }
.driver-card__text { display: grid; gap: 2px; min-width: 0; }
.driver-card__name { color: var(--text); font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.driver-card__meta { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.driver-card__note { margin-top: 4px; }
.driver-card__note:empty { display: none; }
@keyframes driver-card-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .driver-card { animation: none; } }

.arrival-chip__driver { gap: 9px; }
.arrival-chip__vehicle .tag > .icon { display: none; }
.arrival-chip__vehicle .tag::before {
  content: ""; width: 26px; height: 16px; flex: none;
  background: url("/cgm-3d.svg?v=2") center / contain no-repeat;
}
.arrival-chip:disabled .avatar { filter: grayscale(1); opacity: .7; }

/* Station odometer: tracker / last PDN / typed km comparison (never blocks). */
.km-compare {
  margin-top: 10px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-xs);
  transition: border-color .2s, box-shadow .2s;
  animation: driver-card-in .22s ease-out;
}
.km-compare[hidden] { display: none; }
.km-compare__rows { display: grid; }
.km-compare__rows > .km-row + .km-row { border-top: 1px solid var(--border); }
.km-compare__status {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); font-size: 13px; font-weight: 500; line-height: 1.45;
}
.km-compare__status::before {
  content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%;
  background: var(--info); box-shadow: 0 0 0 3px var(--info-soft);
}
.km-compare[data-tone="ok"] { border-color: var(--success-border); }
.km-compare[data-tone="ok"] .km-compare__status { background: var(--success-soft); color: #065f46; }
.km-compare[data-tone="ok"] .km-compare__status::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-border); }
.km-compare[data-tone="warning"] { border-color: #fdba74; box-shadow: 0 0 0 3px rgb(249 115 22 / .12), var(--shadow-xs); }
.km-compare[data-tone="warning"] .km-compare__status { background: #fff7ed; color: #9a3412; font-weight: 600; }
.km-compare[data-tone="warning"] .km-compare__status::before { background: #f97316; box-shadow: 0 0 0 3px #fed7aa; }
.km-compare[data-tone="danger"] { border-color: var(--danger-border); box-shadow: 0 0 0 3px var(--danger-ring), var(--shadow-xs); }
.km-compare[data-tone="danger"] .km-compare__status { background: var(--danger-soft); color: var(--danger-text); font-weight: 600; }
.km-compare[data-tone="danger"] .km-compare__status::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-border); }

.km-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; }
.km-row__icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--surface-3); color: var(--muted);
}
.km-row__icon .icon { width: 17px; height: 17px; }
.km-row--tracker .km-row__icon { background: var(--brand-soft); color: var(--brand); }
.km-row--pdn .km-row__icon { background: var(--info-soft); color: var(--info); }
.km-row--entered .km-row__icon { background: var(--text); color: #fff; }
.km-row--warning .km-row__icon { background: #f97316; color: #fff; }
.km-row__text { display: grid; gap: 1px; min-width: 0; }
.km-row__label { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.km-row__label > span:first-child { white-space: nowrap; }
.km-row__label .badge { padding: 1px 7px; font-size: 10.5px; }
.km-row__meta { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.km-row__value {
  display: grid; justify-items: end; gap: 3px;
  color: var(--text); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.km-row--emphasis { background: linear-gradient(90deg, var(--surface-2), var(--surface)); }
.km-row--emphasis .km-row__label { color: var(--text); }
.km-row--emphasis .km-row__value { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.km-row--warning { background: linear-gradient(90deg, #fff7ed, var(--surface)); }

.km-delta {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.km-delta.is-big { background: #ffedd5; color: #c2410c; }
.km-delta[hidden] { display: none; }

/* Confirm popup for a typed km. */
.km-dialog { width: min(440px, calc(100% - 32px)); }
.km-dialog__head { display: grid; justify-items: center; gap: 4px; padding: 26px 24px 6px; text-align: center; }
.km-dialog__icon {
  display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
  box-shadow: 0 10px 22px -8px rgb(13 148 136 / .6);
}
.km-dialog.is-big .km-dialog__icon { background: linear-gradient(135deg, #fb923c, #c2410c); box-shadow: 0 10px 22px -8px rgb(234 88 12 / .55); }
.km-dialog__body { display: grid; gap: 10px; padding: 14px 20px 18px; }
.km-dialog__previous { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.km-dialog__previous > .km-row + .km-row { border-top: 1px solid var(--border); }
.km-dialog__arrow { display: grid; place-items: center; height: 18px; color: var(--subtle); }
.km-dialog__entered {
  display: grid; justify-items: center; gap: 4px; padding: 14px 16px;
  border: 1.5px solid var(--brand-border); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--brand-soft), #ffffff 75%);
}
.km-dialog.is-big .km-dialog__entered { border-color: #fdba74; background: linear-gradient(135deg, #fff7ed, #ffffff 75%); }
.km-dialog__entered-label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.km-dialog__entered-value { color: var(--text); font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.km-dialog__alert {
  margin: 0; padding: 9px 12px; border: 1px solid #fed7aa; border-radius: var(--r-md);
  background: #fff7ed; color: #9a3412; font-size: 13px; font-weight: 600; text-align: center;
}
.km-dialog__alert[hidden] { display: none; }
.km-dialog__actions {
  display: grid; gap: 8px; padding: 16px 20px 20px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.km-dialog__choice { justify-content: flex-start; gap: 12px; min-height: 52px; padding: 8px 16px; white-space: normal; text-align: left; }
.km-dialog__choice span { display: grid; gap: 1px; }
.km-dialog__choice strong { font-size: 15px; font-weight: 650; }
.km-dialog__choice small { font-size: 12px; font-weight: 500; opacity: .85; }
.km-dialog__choice--gps { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); }
.km-dialog__choice--ok { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-deep); box-shadow: var(--shadow-xs); }
.km-dialog__choice--ok:hover { background: #ccfbf1; }
.km-dialog__choice--change { justify-content: center; }
/* Trip checks (driver page): unusual but possible entries. Calm gold note at the field, gold outline,
   gold badges on the review step and one popup before saving. Never blocks. */
.check-note {
  position: relative; display: grid; gap: 3px; margin: 0; padding: 9px 12px 9px 30px;
  border: 1px solid #e6d7ae; border-radius: var(--r-md);
  background: linear-gradient(90deg, #fbf7ec, var(--surface)); color: #5f4b17;
  font-size: 13px; font-weight: 500; line-height: 1.45;
}
.check-note[hidden] { display: none; }
.check-note::before {
  content: ""; position: absolute; left: 12px; top: 15px; width: 7px; height: 7px; border-radius: 50%;
  background: #b08d3a; box-shadow: 0 0 0 3px #f1e6c8;
}
.check-note strong { color: #4a3a10; font-weight: 750; font-variant-numeric: tabular-nums; }
.check-note__line { display: block; }
.check-note__foot { color: #8a7440; font-size: 12px; }
.field > .check-note { margin-top: 8px; }
#km-check-note { grid-column: 1 / -1; }
.field.field-check :is(input, select):not([type="hidden"]):not([aria-invalid="true"]) {
  border-color: #d6c28e; box-shadow: 0 0 0 3px rgb(176 141 58 / .12);
}
.badge--long { border-color: #e6d7ae; background: #fbf7ec; color: #6b5418; }
.check-dialog .km-dialog__icon { background: linear-gradient(135deg, #c4a463, #8a6d2b); box-shadow: 0 10px 22px -8px rgb(138 109 43 / .55); }
.check-dialog__ok { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); }
.check-list {
  display: grid; gap: 8px; max-height: min(52vh, 440px); margin: 0; padding: 0 4px 0 0;
  overflow-y: auto; list-style: none; scrollbar-width: thin; scrollbar-color: #d9cba5 transparent;
}
.check-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: start; gap: 12px; padding: 11px 12px;
  border: 1px solid #ecdfbd; border-radius: var(--r-lg); background: linear-gradient(135deg, #fbf7ec, #ffffff 80%);
}
.check-item__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #f4ecd8; color: #8a6d2b; }
.check-item__icon .icon { width: 18px; height: 18px; }
.check-item__cgm { width: 30px; height: 20px; background: url("/cgm-3d.svg?v=2") center / contain no-repeat; }
.check-item__text { display: grid; gap: 3px; min-width: 0; }
.check-item__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.check-item__title { color: var(--text); font-size: 14px; font-weight: 700; }
.check-item__value { color: #4a3a10; font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.check-item__detail { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
@media (prefers-reduced-motion: reduce) { .km-compare { animation: none; } }
.review-summary__person { display: flex; align-items: center; gap: 8px; }

/* ---------- Technician search ---------- */
/* Glass bar that stays under the header while scrolling: search field, filter pills, result count. */
.queue-search {
  position: sticky; top: calc(var(--header-h) + 10px); z-index: 20;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
  margin: 0 0 22px; padding: 8px;
  border: 1px solid var(--border); border-radius: 16px;
  background: rgb(255 255 255 / .86);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  box-shadow: var(--shadow-md);
}
.queue-search__field {
  position: relative; flex: 1 1 340px; display: flex; align-items: center; min-width: 0; height: 46px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.queue-search__field:hover { border-color: var(--border-strong); }
.queue-search__field:focus-within {
  border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-ring);
}
.queue-search__icon {
  position: absolute; left: 14px; width: 19px; height: 19px; color: var(--subtle);
  pointer-events: none; transition: color .15s;
}
.queue-search__field:focus-within .queue-search__icon { color: var(--brand); }
#queue-search-input {
  flex: 1; min-width: 0; height: 100%; min-height: 0; padding: 0 8px 0 44px;
  border: 0; border-radius: inherit; background: transparent; box-shadow: none;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 500; outline: none;
}
#queue-search-input::placeholder { color: var(--subtle); font-weight: 400; }
#queue-search-input::-webkit-search-cancel-button { display: none; }
.queue-search__clear {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; margin-right: 8px;
  border: 0; border-radius: 999px; background: var(--surface-3); color: var(--muted); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.queue-search__clear:hover { background: var(--border); color: var(--text); }
.queue-search__clear .icon { width: 14px; height: 14px; }
.queue-search__kbd {
  flex: none; margin-right: 12px; padding: 2px 8px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface); color: var(--muted); font: 600 12px/1.4 var(--font);
}
.queue-search__field:focus-within .queue-search__kbd { display: none; }
.queue-search__clear[hidden], .queue-search__kbd[hidden] { display: none; }
.queue-search__filters {
  display: flex; gap: 2px; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-3);
}
.queue-search__filters button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.queue-search__filters button:hover { background: rgb(255 255 255 / .65); color: var(--text); }
.queue-search__filters button[aria-pressed="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgb(15 23 42 / .08), 0 0 0 1px rgb(15 23 42 / .05);
}
.queue-search__count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: rgb(15 23 42 / .06); color: var(--muted);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center;
}
.queue-search__filters button[aria-pressed="true"] .queue-search__count { background: var(--brand-soft); color: var(--brand-strong); }
/* Missing count turns amber when there is something to look at. */
.queue-search__count--alert.is-alert,
.queue-search__filters button[aria-pressed="true"] .queue-search__count--alert.is-alert {
  background: var(--warning-soft); color: var(--warning-text); box-shadow: inset 0 0 0 1px var(--warning-border);
}
/* "Filling now" filter: a calm sage count and a muted gold dot while something is filling. */
.filter-dot { display: none; width: 6px; height: 6px; flex: none; border-radius: 50%; background: #b08d3a; animation: filling-dot 2s ease-in-out infinite; }
.queue-search__filters button.is-live .filter-dot { display: inline-block; }
.queue-search__filters button.is-live .queue-search__count--filling,
.queue-search__filters button[aria-pressed="true"].is-live .queue-search__count--filling {
  background: #e9f3f0; color: #24564f; box-shadow: inset 0 0 0 1px #c3dcd5;
}
.filter-label--short { display: none; }
@media (max-width: 767px) {
  .filter-label--long { display: none; }
  .filter-label--short { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .filter-dot { animation: none; } }
.audit-bar { align-items: center; }
.audit-bar > span { flex: 1; min-width: 0; }
.audit-bar__action { flex: none; margin-left: auto; }
.audit-bar__action[hidden] { display: none; }
.search-empty--success .search-empty__icon { background: var(--success-soft); color: var(--success); }
.queue-search__result {
  margin-left: auto; padding: 0 8px; color: var(--muted);
  font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.queue-search__result:empty { display: none; }
/* Matching text inside the trip cards. */
::highlight(pdn-search) { background-color: rgb(250 204 21 / .5); color: var(--text); }
#trip-queue [hidden] { display: none !important; }
.queue-item.is-spotlight { animation: queue-spotlight 1.4s ease-out; }
@keyframes queue-spotlight {
  0%, 30% { box-shadow: 0 0 0 4px var(--brand-ring), var(--shadow-md); border-color: var(--brand); }
  100% { box-shadow: var(--shadow-xs); }
}
.search-empty {
  display: grid; justify-items: center; gap: 6px; padding: 48px 16px;
  border: 1px dashed var(--border-strong); border-radius: 16px; background: var(--surface);
  text-align: center;
}
.search-empty__icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px;
  border-radius: 999px; background: var(--surface-3); color: var(--muted);
}
.search-empty__icon .icon { width: 22px; height: 22px; }
.search-empty strong { color: var(--text); font-size: 16px; }
.search-empty p { max-width: 420px; color: var(--muted); font-size: 14px; }
.search-empty .button { margin-top: 10px; }
@media (hover: none) { .queue-search__kbd { display: none; } }
@media (max-width: 767px) {
  .queue-search { top: calc(var(--header-h) + 6px); gap: 8px; margin-bottom: 16px; padding: 6px; border-radius: 14px; }
  .queue-search__field { flex-basis: 100%; height: 48px; }
  #queue-search-input { font-size: 16px; }
  /* Phones: the pills keep their full size and wrap into tidy rows that fill the width, so every
     filter and count stays visible (they used to shrink until label and count overlapped). */
  .queue-search__filters { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; gap: 4px; }
  .queue-search__filters button { flex: 1 0 auto; height: 38px; padding: 0 12px; gap: 7px; font-size: 13.5px; }
  .queue-search__count { min-width: 22px; padding: 2px 7px; font-size: 12px; line-height: 1.3; }
  .queue-search__result { display: none; }
  .audit-bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .queue-item.is-spotlight { animation: none; } }

/* ---------- Responsive (shared) ---------- */
@media (max-width: 1023px) {
  .stat-grid { gap: 12px; }
  .qr-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  :root { --header-h: 56px; }
  .app-nav, .app-header__product { display: none; }
  .app-header__inner { gap: 12px; }
  .brand img { height: 28px; }
  .shell { padding-top: 20px; padding-bottom: 40px; }
  .page-head { margin-bottom: 16px; }
  .page-head__actions { width: 100%; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea { min-height: 48px; font-size: 16px; }
  .combobox__option { min-height: 52px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat-card { flex-direction: column; gap: 8px; padding: 14px; }
  .stat-card__icon { width: 32px; height: 32px; }
  .stat-card__value { font-size: 22px; }
  .qr-card { flex-direction: column; align-items: flex-start; padding: 20px; }
  .qr-card img { width: 160px; height: 160px; }
  .queue-item { padding: 12px 14px; }
  .queue-top { align-items: flex-start; }
  .trip-identity { align-items: flex-start; }
  .cgm-mark { width: 52px; height: 38px; border-radius: 10px; background-size: 44px auto, auto; }
  .trip-identity__name { white-space: normal; }
  .meta-time { margin-left: 0; }
  .candidate-table { flex-basis: 100%; }
  .tech-actions { flex: 1 1 100%; flex-wrap: wrap; }
  .tech-actions select { flex: 1 1 100%; width: auto; min-height: 48px; }
  .tech-actions .combobox { flex: 1 1 100%; width: auto; }
  .tech-actions .combobox__input { min-height: 48px !important; }
  .queue-section-heading { flex-wrap: wrap; }
  .completed-export-slot { order: 3; flex-basis: 100%; }
  .export-bar { justify-content: space-between; }
  .export-status { text-align: left; }
  .auto-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tech-actions .button { flex: 1 1 auto; min-height: 44px; }
  .completed-trip-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 14px; }
  .completed-trip-row.is-lazy { min-height: 221px; }
  .completed-detail-row, .completed-detail-row:nth-child(2) { padding-left: 10px; border-left: 1px solid var(--border); }
  .completed-trip-actions { grid-column: 1 / -1; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
  .modal__body { flex-direction: column; gap: 12px; padding: 20px; }
  .modal__footer { flex-direction: column-reverse; padding: 16px 20px; }
  .modal__footer .button { min-height: 48px; }
}
@media (max-width: 420px) {
  .live-status__detail { display: none; }
  .stat-card__label { font-size: 12px; }
}
/* Phones, Technician page: the logo, flag, status and Log out must fit, so the status shows as its coloured dot. */
@media (max-width: 560px) {
  .app-header__inner:has(.logout-button) { gap: 8px; }
  .app-header__inner:has(.logout-button) .live-status { flex: none; padding-inline: 10px; }
  .app-header__inner:has(.logout-button) :is(.live-status__label, .live-status__detail) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print: dashboard QR codes ---------- */
@media print {
  body.print-driver *, body.print-technician * { visibility: hidden; }
  body.print-driver #driver-card, body.print-driver #driver-card *,
  body.print-technician #technician-card, body.print-technician #technician-card * { visibility: visible; }
  body.print-driver #driver-card, body.print-technician #technician-card {
    position: absolute; inset: 0 auto auto 0; width: 100%;
    flex-direction: column; align-items: center; justify-content: center; text-align: center;
    border: 0; box-shadow: none;
  }
  body.print-driver #driver-card img, body.print-technician #technician-card img { width: 300px; height: 300px; }
  body.print-driver .qr-copy, body.print-technician .qr-copy { align-items: center; }
  .print-button, .qr-actions { display: none !important; }
}

/* ---------- Roles (14-Nov-2026): Team leader sees the Technician page view only ---------- */
.role-chip {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid #e0c877; border-radius: 999px;
  background: #fffbef; color: #5f4708; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.readonly-note {
  margin: 0 0 16px; padding: 12px 16px; border: 1px solid #efe3bd; border-left: 3px solid #c9a227; border-radius: 12px;
  background: #fdf9ee; color: #5b4a12; font-size: 13.5px; line-height: 1.5;
}
body.is-readonly .tech-actions,
body.is-readonly .row-select,
body.is-readonly .undo-loading-button,
body.is-readonly .delete-trip-button { display: none !important; }
body.is-readonly .filling-table tbody tr { cursor: default; }
body.no-pdn-download .pdn-select,
body.no-pdn-download a[href*="/pdn.png"],
body.no-pdn-download .export-home,
body.no-pdn-download #export-bar { display: none !important; }
@media (max-width: 560px) { .role-chip { display: none; } }
