/* CellarRoute staff portal. Visual language from the Relay prototype (ohy/styles.css),
   with text sizes raised for all-day office use. Everything is same-origin (strict CSP). */

@font-face { font-family: "Fira Sans"; src: url("fonts/fira-sans-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/fira-sans-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/fira-sans-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/fira-sans-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Code"; src: url("fonts/fira-code.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  --navy-950: #07111f;
  --navy-900: #0b1728;
  --navy-800: #14243a;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --blue-800: #1e40af;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --cyan-600: #0891b2;
  --cyan-50: #ecfeff;
  --green-800: #166534;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --orange-800: #9a3412;
  --orange-700: #c2410c;
  --orange-600: #ea580c;
  --orange-100: #ffedd5;
  --orange-50: #fff7ed;
  --red-700: #b91c1c;
  --red-100: #fee2e2;
  --red-50: #fef2f2;
  --font-body: "Fira Sans", "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  --font-mono: "Fira Code", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, .18);
  --topbar: 64px;
}

/* Base */
* { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--navy-900); background: var(--slate-100); font: 400 15px/1.5 var(--font-body); }
[hidden] { display: none !important; }
a { color: var(--blue-700); }
h1, h2, h3 { color: var(--navy-900); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; top: 8px; left: -999px; z-index: 200; padding: 10px 14px; border-radius: 8px; color: #fff; background: var(--navy-900); }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--font-mono); font-size: .94em; }
code { color: var(--slate-500); font: 500 12px/1.4 var(--font-mono); }
.muted { color: var(--slate-500); }
.hint { margin: 0; color: var(--slate-500); font-size: 14px; }
.good { color: var(--green-700); }
.bad { color: var(--red-700); }

/* Shell */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, var(--navy-950) 240px, transparent 240px); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; padding: 22px 14px 14px; flex-direction: column; overflow-y: auto; color: #d9e2ef; background: var(--navy-950); }
.sidebar :focus-visible { outline-color: #8fb3ff; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.close-menu { display: none !important; }
.wordmark { display: flex; gap: 11px; min-height: 42px; padding: 0 8px; align-items: center; color: #fff; text-decoration: none; }
.wordmark > span:last-child { display: grid; gap: 3px; }
.wordmark b { font: 600 14px/1 var(--font-mono); letter-spacing: .08em; }
.wordmark small { color: #8fa1b8; font: 500 9.5px/1 var(--font-mono); letter-spacing: .15em; }
.wordmark.dark { padding: 0; color: var(--navy-900); }
.wordmark.dark small { color: var(--slate-500); }
.mark { display: flex; gap: 2px; width: 30px; height: 30px; padding: 6px; flex: none; border-radius: 7px; background: var(--blue-600); align-items: flex-end; justify-content: center; }
.mark i { display: block; width: 3px; border-radius: 1px; background: #fff; }
.mark i:nth-child(1) { height: 8px; }
.mark i:nth-child(2) { height: 17px; }
.mark i:nth-child(3) { height: 12px; }

.nav { display: grid; gap: 2px; margin-top: 26px; }
.nav p { margin: 18px 12px 6px; color: #8193ab; font: 600 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.nav p:first-child { margin-top: 0; }
.nav a { display: grid; grid-template-columns: 20px 1fr auto; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 7px; color: #a3b3c8; font-size: 14.5px; font-weight: 500; text-decoration: none; align-items: center; transition: color .18s ease, background .18s ease; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav a[aria-current] { color: #fff; background: var(--blue-600); }
.nav .icon { width: 18px; height: 18px; }
.nav a b { display: grid; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; color: var(--blue-100); background: rgba(37, 99, 235, .3); font: 600 11px/1 var(--font-mono); place-items: center; }
.nav a[aria-current] b { color: var(--blue-700); background: #fff; }

.system-card { margin-top: auto; padding: 12px 14px; border: 1px solid #1e3048; border-radius: 9px; background: #0d1c2f; }
.system-card > div { display: flex; gap: 9px; align-items: center; color: #e2e8f0; font-size: 13px; }
.pulse { width: 9px; height: 9px; flex: none; border: 2px solid #5ee692; border-radius: 50%; box-shadow: 0 0 0 4px rgba(94, 230, 146, .1); }
.system-card.stale .pulse, .system-card.off .pulse { border-color: #fdba74; box-shadow: 0 0 0 4px rgba(253, 186, 116, .12); }
.system-card p { margin: 6px 0 8px 18px; color: #8fa1b8; font-size: 12px; line-height: 1.45; }
.system-card a { display: flex; margin-left: 18px; color: #8fb3ff; font-size: 12.5px; font-weight: 600; text-decoration: none; justify-content: space-between; align-items: center; }
.system-card a .icon { width: 14px; height: 14px; }
.user-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; margin-top: 10px; padding: 8px 4px 0 8px; align-items: center; }
.user-card > span:nth-child(2) { display: grid; min-width: 0; }
.user-card b { overflow: hidden; color: #fff; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { color: #8fa1b8; font-size: 12px; }
.avatar { display: grid; width: 36px; height: 36px; flex: none; border-radius: 8px; color: #fff; background: #284363; font: 600 12px/1 var(--font-mono); place-items: center; }
.avatar.large { width: 56px; height: 56px; border-radius: 12px; font-size: 18px; }
.icon-button { display: grid; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 8px; color: inherit; background: transparent; cursor: pointer; place-items: center; transition: background .18s ease, color .18s ease; }
.icon-button:hover { background: var(--slate-100); }
.sidebar .icon-button { color: #a3b3c8; }
.sidebar .icon-button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar .icon-button .icon { width: 18px; height: 18px; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(7, 17, 31, .55); }

.main-col { display: flex; min-width: 0; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 12px; height: var(--topbar); padding: 0 32px; border-bottom: 1px solid var(--slate-200); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); align-items: center; }
.menu-button { display: none; color: var(--navy-900); }
.command-search { display: flex; gap: 8px; width: min(460px, 46vw); height: 42px; padding: 0 12px; border: 1px solid var(--slate-200); border-radius: 8px; background: var(--slate-50); align-items: center; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.command-search:focus-within { border-color: var(--blue-600); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.command-search .icon { width: 17px; height: 17px; color: var(--slate-500); }
.topbar .command-search input[type=search] { min-width: 0; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; outline: 0; color: inherit; background: transparent; box-shadow: none; font-size: 14px; flex: 1; }
.command-search kbd { padding: 4px 6px; border: 1px solid var(--slate-300); border-radius: 5px; color: var(--slate-500); background: #fff; font: 500 11px/1 var(--font-mono); white-space: nowrap; }
.topbar-actions { display: flex; gap: 10px; margin-left: auto; align-items: center; }
.content { width: min(100%, 1440px); margin: 0 auto; padding: 32px 32px 64px; outline: none; }

/* Headings */
.page-heading { display: flex; gap: 24px; margin-bottom: 22px; justify-content: space-between; align-items: flex-end; }
.page-heading h1 { margin: 6px 0; font-size: clamp(28px, 2.6vw, 38px); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; }
.page-heading > div > p:last-child { max-width: 72ch; margin: 0; color: var(--slate-600); font-size: 15px; }
.page-heading > div > p.kicker:last-child { color: var(--blue-700); }
.kicker { margin: 0; color: var(--blue-700); font: 600 11px/1.3 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
.kicker.ok { color: var(--green-700); }
.title-with-chip { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.title-with-chip .mono { font-size: 1em; letter-spacing: -.04em; }
.title-with-chip .chip { font-size: 13px; letter-spacing: 0; }
.person-heading { display: flex; gap: 16px; align-items: center; }
.person-heading .avatar { background: var(--c, #284363); }

/* Buttons */
.button { display: inline-flex; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--slate-300); border-radius: 7px; color: var(--navy-900); background: #fff; font: 600 14px/1 var(--font-body); text-decoration: none; white-space: nowrap; align-items: center; justify-content: center; cursor: pointer; transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.button:hover { border-color: var(--blue-600); color: var(--blue-700); background: var(--blue-50); }
.button .icon { width: 17px; height: 17px; }
.button.primary { border-color: var(--blue-700); color: #fff; background: var(--blue-600); box-shadow: 0 2px 4px rgba(37, 99, 235, .2); }
.button.primary:hover { color: #fff; background: var(--blue-700); box-shadow: 0 4px 10px rgba(37, 99, 235, .24); }
.button.danger { border-color: var(--red-700); color: #fff; background: var(--red-700); }
.button.danger:hover { color: #fff; background: #991b1b; }
.button.ghost { border-color: transparent; color: var(--slate-600); background: transparent; }
.button.ghost:hover { border-color: transparent; color: var(--navy-900); background: rgba(15, 23, 42, .05); }
.button.large { min-height: 46px; padding: 0 20px; font-size: 15px; }
.button.compact { min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.button.square { width: 40px; padding: 0; }
.button.full { width: 100%; }

/* Chips, dots and driver colours */
.chip { display: inline-flex; gap: 6px; min-height: 26px; padding: 0 9px; border-radius: 6px; color: var(--slate-700); background: var(--slate-100); font: 600 12.5px/1 var(--font-body); white-space: nowrap; align-items: center; }
.chip .icon { width: 14px; height: 14px; stroke-width: 2.1; }
.chip.s-pending { color: var(--orange-800); background: var(--orange-100); }
.chip.s-confirmed { color: var(--blue-800); background: var(--blue-100); }
.chip.s-delivered, .chip.s-left_at_doorstep, .chip.s-left_at_management, .chip.s-active { color: var(--green-800); background: var(--green-100); }
.chip.s-returned_to_warehouse, .chip.s-rejected, .chip.s-off { color: var(--slate-700); background: var(--slate-200); }
.chip.s-cancelled_by_driver { color: var(--red-700); background: var(--red-100); }
.dot { display: inline-block; width: 9px; height: 9px; flex: none; margin-right: 7px; border-radius: 50%; background: var(--c, var(--slate-400)); vertical-align: 1px; }
.c-blue { --c: #2563eb; --c-bg: #eff6ff; --c-ink: #1e3a8a; }
.c-teal { --c: #0891b2; --c-bg: #ecfeff; --c-ink: #164e63; }
.c-violet { --c: #7c3aed; --c-bg: #f5f3ff; --c-ink: #4c1d95; }
.c-amber { --c: #d97706; --c-bg: #fffbeb; --c-ink: #78350f; }
.c-rose { --c: #e11d48; --c-bg: #fff1f2; --c-ink: #881337; }
.c-green { --c: #16a34a; --c-bg: #f0fdf4; --c-ink: #14532d; }

/* Banners and alerts */
.banner { display: flex; gap: 10px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--blue-100); border-radius: 9px; color: var(--blue-800); background: var(--blue-50); font-size: 14px; align-items: flex-start; }
.banner p { margin: 0; }
.banner .icon { width: 18px; height: 18px; margin-top: 1px; }
.banner.success { border-color: #bbf7d0; color: var(--green-800); background: var(--green-50); }
.banner.error { border-color: #fecaca; color: var(--red-700); background: var(--red-50); }
.banner.warning { border-color: #fed7aa; color: var(--orange-800); background: var(--orange-50); }
.inline-alert { display: flex; gap: 8px; margin: 12px 0 0; padding: 9px 12px; border-radius: 7px; font-size: 13.5px; line-height: 1.45; align-items: flex-start; }
.inline-alert .icon { width: 16px; height: 16px; margin-top: 2px; }
.inline-alert p { margin: 0; }
.inline-alert > div { display: grid; gap: 8px; }
.inline-alert.error { border: 1px solid #fecaca; color: var(--red-700); background: var(--red-50); }
.inline-alert.warn { border: 1px solid #fed7aa; color: var(--orange-800); background: var(--orange-50); }
.booking-note { display: flex; gap: 8px; margin: 10px 0 0; padding: 8px 11px; border-left: 3px solid var(--slate-300); color: var(--slate-700); background: var(--slate-50); font-size: 13.5px; align-items: flex-start; }
.booking-note .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--slate-500); }

/* Status strip */
.status-strip { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; min-height: 62px; margin-bottom: 16px; padding: 10px 16px; border: 1px solid #b7e4c7; border-radius: 10px; background: var(--green-50); align-items: center; }
.strip-icon { display: grid; width: 36px; height: 36px; border-radius: 8px; color: var(--green-700); background: var(--green-100); place-items: center; }
.strip-icon .icon { width: 19px; height: 19px; }
.status-strip > div { display: grid; gap: 2px; }
.status-strip > div > b { font-size: 14px; }
.status-strip > div > span { color: #3f6b50; font-size: 13px; }
.status-strip > a { display: flex; gap: 6px; color: var(--green-800); font-size: 13px; font-weight: 600; text-decoration: none; align-items: center; white-space: nowrap; }
.status-strip > a:hover { text-decoration: underline; }
.status-strip > a .icon { width: 14px; height: 14px; }
.status-strip.stale, .status-strip.off { border-color: #fed7aa; background: var(--orange-50); }
.status-strip.stale .strip-icon, .status-strip.off .strip-icon { color: var(--orange-700); background: var(--orange-100); }
.status-strip.stale > div > span, .status-strip.off > div > span { color: #7c4a1e; }
.status-strip.stale > a, .status-strip.off > a { color: var(--orange-800); }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { display: flex; gap: 14px; min-height: 118px; padding: 18px; border: 1px solid var(--slate-200); border-radius: 10px; color: inherit; background: #fff; box-shadow: var(--shadow-xs); text-decoration: none; transition: border-color .18s ease, box-shadow .18s ease; }
.metric:hover { border-color: var(--blue-600); box-shadow: var(--shadow-sm); }
.metric.attention { border-color: #fdba74; }
.metric-icon { display: grid; width: 38px; height: 38px; flex: none; border-radius: 9px; place-items: center; }
.metric-icon .icon { width: 19px; height: 19px; }
.metric-icon.blue { color: var(--blue-700); background: var(--blue-100); }
.metric-icon.cyan { color: var(--cyan-600); background: var(--cyan-50); }
.metric-icon.green { color: var(--green-700); background: var(--green-100); }
.metric-icon.orange { color: var(--orange-700); background: var(--orange-100); }
.metric-body { display: grid; gap: 2px; min-width: 0; align-content: start; }
.metric-body small { color: var(--slate-600); font-size: 13.5px; font-weight: 500; }
.metric-body strong { font: 600 32px/1.15 var(--font-mono); letter-spacing: -.05em; }
.metric-body > span { color: var(--slate-500); font-size: 12.5px; }

/* Surfaces */
.surface { border: 1px solid var(--slate-200); border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); overflow: hidden; }
.stack > * + * { margin-top: 16px; }
.surface-header { display: flex; gap: 12px; min-height: 74px; padding: 16px 20px; border-bottom: 1px solid var(--slate-200); justify-content: space-between; align-items: center; }
.surface-header h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.02em; }
.header-link { display: flex; gap: 6px; color: var(--blue-700); font-size: 13px; font-weight: 600; text-decoration: none; align-items: center; }
.header-link:hover { text-decoration: underline; }
.header-link .count { display: grid; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; background: var(--blue-100); font: 600 11px/1 var(--font-mono); place-items: center; }
.header-link .icon { width: 14px; height: 14px; }
.surface-footer { display: flex; min-height: 48px; padding: 0 20px; border-top: 1px solid var(--slate-200); color: var(--blue-700); font-size: 13.5px; font-weight: 600; text-decoration: none; justify-content: space-between; align-items: center; transition: background .18s ease; }
.surface-footer:hover { background: var(--blue-50); }
.surface-footer:focus-visible, .row-link:focus-visible { outline-offset: -3px; }
.surface-footer .icon { width: 15px; height: 15px; }
.surface.narrow { width: min(560px, 100%); margin: 24px auto; }
.empty-state { display: grid; gap: 6px; padding: 44px 24px; color: var(--slate-500); text-align: center; justify-items: center; }
.empty-state > .icon { width: 30px; height: 30px; margin-bottom: 6px; color: var(--slate-400); }
.empty-state.ok > .icon { color: var(--green-700); }
.empty-state b { color: var(--navy-900); font-size: 16px; }
.empty-state p { max-width: 46ch; margin: 0 0 6px; font-size: 14px; }
.seal { display: inline-flex; gap: 7px; min-height: 30px; padding: 0 11px; border-radius: 999px; color: var(--green-800); background: var(--green-100); font: 600 11.5px/1 var(--font-mono); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; align-items: center; }
.seal .icon { width: 15px; height: 15px; }
.seal.warn { color: var(--orange-800); background: var(--orange-100); }
.seal.bad { color: var(--red-700); background: var(--red-100); }
.seal.muted { color: var(--slate-600); background: var(--slate-100); }

/* Control room */
.ops-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(330px, .9fr); gap: 16px; align-items: start; }
.approval-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 20px; padding: 20px; align-items: start; }
.approval-row + .approval-row { border-top: 1px solid var(--slate-200); }
.approval-date { display: grid; gap: 5px; padding-right: 16px; border-right: 1px solid var(--slate-200); }
.approval-date strong { font: 500 23px/1.1 var(--font-mono); letter-spacing: -.03em; }
.approval-date span { color: var(--slate-500); font: 500 11px/1.35 var(--font-mono); letter-spacing: .04em; }
.approval-main { min-width: 0; }
.approval-meta { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; }
.approval-meta .muted { font-size: 13px; }
.approval-main h3 { margin: 10px 0 2px; font-size: 17px; letter-spacing: -.01em; }
.address { margin: 0; color: var(--slate-600); font-size: 14px; overflow-wrap: anywhere; }
.code { color: var(--slate-600); font: 500 13px/1.2 var(--font-mono); text-decoration: none; }
a.code:hover { color: var(--blue-700); text-decoration: underline; }
.slot-box { display: flex; gap: 8px; width: fit-content; max-width: 100%; margin-top: 12px; padding: 8px 11px; border-radius: 7px; color: var(--slate-600); background: var(--slate-100); font-size: 13.5px; align-items: center; }
.slot-box .icon { width: 16px; height: 16px; color: var(--blue-600); }
.slot-box b { color: var(--slate-700); }
.slot-box .dot { margin-left: 2px; margin-right: 5px; }
.slot-boxes { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.slot-boxes .slot-box { margin-top: 0; }
.slot-box.suggested { color: var(--blue-800); background: var(--blue-50); }
.slot-box.suggested b { color: var(--blue-800); }
.slot-box.muted .icon { color: var(--slate-500); }
.slot-box.current { margin: 20px 24px 0; }
.approval-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.approval-controls form { display: contents; }
.approval-controls.stacked { min-width: 210px; flex-direction: column; align-items: stretch; }
.approval-controls .check.small { font-size: 13px; }
.approval-more { display: grid; border-top: 1px solid var(--slate-200); background: var(--slate-50); }
.approval-more > details + details { border-top: 1px solid var(--slate-200); }
.approval-more details.more > summary { padding: 0 20px; }
.approval-card, details.more, .surface[id], .exceptions { scroll-margin-top: calc(var(--topbar) + 16px); }
.date-chip { display: flex; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid var(--slate-300); border-radius: 7px; color: var(--navy-900); background: #fff; font: 500 11.5px/1 var(--font-mono); text-decoration: none; align-items: center; transition: border-color .18s ease, background .18s ease; }
.date-chip:hover { border-color: var(--blue-600); background: var(--blue-50); }
.date-chip .icon { width: 15px; height: 15px; }

.driver-tabs { display: none; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); }
.js .driver-tabs { display: grid; }
.driver-tabs button { display: flex; gap: 8px; min-height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; color: var(--slate-600); background: transparent; font: 600 13.5px/1 var(--font-body); align-items: center; cursor: pointer; transition: background .18s ease, color .18s ease; }
.driver-tabs button:hover { color: var(--navy-900); }
.driver-tabs button[aria-selected="true"] { border-color: var(--slate-200); color: var(--navy-900); background: #fff; box-shadow: var(--shadow-xs); }
.driver-tabs button span { margin-left: auto; color: var(--slate-500); font: 500 11.5px/1 var(--font-mono); }
.driver-tabs .dot { margin: 0; }
.route-name { margin: 16px 20px 0; font-size: 14px; }
.js .route-name { display: none; }
.route-list { margin: 0; padding: 10px 18px 10px 22px; list-style: none; }
.route-list li { position: relative; display: grid; grid-template-columns: 26px 46px minmax(0, 1fr) auto; gap: 10px; min-height: 68px; align-items: center; }
.route-list li:not(:last-child)::after { position: absolute; top: 47px; bottom: -21px; left: 12px; width: 1px; background: var(--slate-200); content: ""; }
.route-list .next:not(:last-child)::after { left: 22px; }
.marker { position: relative; z-index: 1; display: grid; width: 26px; height: 26px; border: 2px solid var(--slate-300); border-radius: 50%; color: var(--slate-600); background: #fff; font: 600 11px/1 var(--font-mono); place-items: center; }
.marker .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.route-list time { color: var(--slate-600); font: 500 12.5px/1 var(--font-mono); }
.route-list li > div { display: grid; gap: 3px; min-width: 0; }
.route-list li > div a, .route-list li > div b { overflow: hidden; color: var(--navy-900); font-size: 14px; font-weight: 600; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.route-list li > div a:hover { color: var(--blue-700); text-decoration: underline; }
.route-list li > div span { overflow: hidden; color: var(--slate-500); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.route-list em { color: var(--slate-500); font: normal 600 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.route-list .done .marker { border-color: var(--green-700); color: #fff; background: var(--green-700); }
.route-list .done em { color: var(--green-700); }
.route-list .next { margin: 0 -10px; padding: 0 10px; border-radius: 8px; background: var(--blue-50); }
.route-list .next .marker { border-color: var(--blue-600); color: #fff; background: var(--blue-600); }
.route-list .next em { color: var(--blue-700); }
.route-list .busy .marker { border: 0; background: var(--slate-300); }
.route-list .busy b { color: var(--slate-600); }
.route-list .cancelled .marker { border-color: var(--red-700); color: var(--red-700); }
.route-list .cancelled > div a { color: var(--slate-500); text-decoration: line-through; }
.route-list .cancelled em { color: var(--red-700); }
.route-list .pending .marker { border-style: dashed; border-color: var(--orange-600); color: var(--orange-700); }
.route-list .pending em { color: var(--orange-700); }
.fold-toggle { display: none !important; }
.js .fold-toggle { display: grid !important; }
.fold-toggle .marker { border-color: var(--green-700); color: var(--green-700); background: var(--green-50); }
.fold-toggle button { display: flex; gap: 10px; min-height: 40px; padding: 0 12px; grid-column: 2 / -1; border: 1px dashed var(--slate-300); border-radius: 8px; color: var(--slate-600); background: var(--slate-50); font: 500 13.5px/1 var(--font-body); justify-content: space-between; align-items: center; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.fold-toggle button:hover { border-color: var(--blue-600); color: var(--navy-900); background: var(--blue-50); }
.fold-toggle em { color: var(--blue-700); font: normal 600 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.js .route-list.is-folded > li.folded { display: none; }
.route-empty { margin: 0; padding: 32px 20px; color: var(--slate-500); font-size: 14px; text-align: center; }

.exceptions { display: grid; gap: 12px; margin-top: 16px; outline: none; }
.exception-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; margin: 0 0 16px; padding: 16px 18px; border: 1px solid #fed7aa; border-left: 4px solid var(--orange-600); border-radius: 10px; background: #fff; align-items: center; }
.exceptions .exception-card { margin: 0; }
.exception-icon { display: grid; width: 40px; height: 40px; border-radius: 9px; color: var(--orange-700); background: var(--orange-100); place-items: center; }
.exception-card .kicker { color: var(--orange-700); }
.exception-card h3 { margin: 4px 0 3px; font-size: 16px; }
.exception-card p { margin: 0; color: var(--slate-600); font-size: 14px; }
.exception-card p .code { font-size: 12.5px; }
.exception-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.exception-card.neutral { border-color: var(--slate-200); border-left-color: var(--slate-500); }
.exception-card.neutral .exception-icon { color: var(--slate-600); background: var(--slate-100); }
.exception-card.neutral .kicker { color: var(--slate-600); }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 12px 16px; border-bottom: 1px solid var(--slate-200); color: var(--slate-500); background: var(--slate-50); font: 600 11px/1.2 var(--font-mono); letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table .when b { display: block; font: 500 14px/1.3 var(--font-mono); white-space: nowrap; }
.data-table .when span { color: var(--slate-500); font-size: 12.5px; white-space: nowrap; }
.data-table .customer { min-width: 220px; }
.data-table .customer b { display: block; font-weight: 600; }
.data-table .customer span { display: block; max-width: 380px; overflow: hidden; color: var(--slate-500); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.data-table .driver { white-space: nowrap; }
.data-table .go { width: 56px; text-align: right; }
.data-table a.code { color: var(--blue-700); font-weight: 600; }
.row-link { display: inline-grid; width: 34px; height: 34px; border: 1px solid var(--slate-300); border-radius: 7px; color: var(--slate-500); background: #fff; place-items: center; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.row-link:hover { border-color: var(--blue-600); color: var(--blue-700); background: var(--blue-50); }
.row-link .icon { width: 15px; height: 15px; }
.person-cell { display: flex; gap: 12px; min-width: 240px; align-items: center; }
.person-cell > span:last-child { display: grid; min-width: 0; }
.person-cell a { color: inherit; text-decoration: none; }
.person-cell a:hover b { color: var(--blue-700); text-decoration: underline; }
.person-cell span span { color: var(--slate-500); font-size: 12.5px; overflow-wrap: anywhere; }
.people-table .avatar { background: var(--c, #284363); }
.pager { display: flex; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--slate-200); color: var(--slate-600); font-size: 13.5px; justify-content: space-between; align-items: center; }
.pager span:last-child { display: flex; gap: 8px; }

/* Forms */
.filter-bar { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(130px, 1fr)) auto; gap: 12px; margin-bottom: 16px; padding: 16px 18px; align-items: end; overflow: visible; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .button { min-height: 44px; }
.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; top: 50%; left: 12px; width: 17px; height: 17px; color: var(--slate-500); transform: translateY(-50%); pointer-events: none; }
.input-icon input { padding-left: 38px !important; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field.wide, .field:has(textarea) { grid-column: 1 / -1; }
.field-label { display: flex; gap: 8px; color: var(--navy-900); font-size: 14px; font-weight: 600; justify-content: space-between; align-items: baseline; }
.field-label b { color: var(--blue-700); font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.field-label em { color: var(--slate-500); font: normal 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.field small, .check small { color: var(--slate-500); font-size: 12.5px; font-weight: 400; }
.field small.field-error, .check small.field-error { color: var(--red-700); font-weight: 600; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red-700); }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--slate-300); border-radius: 7px; color: var(--navy-900); background-color: #fff; font: 400 15px/1.4 var(--font-body); transition: border-color .18s ease, box-shadow .18s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-600); outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
textarea { min-height: 88px; resize: vertical; }
select { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; background-size: 18px; appearance: none; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--blue-600); cursor: pointer; }
.check { display: flex; gap: 10px; color: var(--navy-900); font-size: 14px; font-weight: 500; align-items: flex-start; cursor: pointer; }
.check > span { display: grid; gap: 2px; }
.check input { margin-top: 1px; }
.field-grid > .check { grid-column: 1 / -1; }
details.more > summary { display: flex; gap: 8px; min-height: 48px; color: var(--blue-700); font-size: 14px; font-weight: 600; list-style: none; align-items: center; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .icon { width: 17px; height: 17px; }
details.more > summary::after { width: 8px; height: 8px; margin: 0 4px 0 auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ""; transform: rotate(45deg); transition: transform .18s ease; }
details.more[open] > summary::after { transform: rotate(-135deg); }
details.more.danger > summary { color: var(--red-700); }
details.more > .field-grid, details.more > .check { margin-top: 4px; }
details.more > .check { margin-top: 14px; }
.more-body { display: grid; gap: 16px; padding: 4px 20px 20px; }
.form-surface { max-width: 900px; }
.form-section { padding: 22px 24px; }
.form-section + .form-section { border-top: 1px solid var(--slate-200); }
.form-section > h2 { display: flex; gap: 10px; margin: 0 0 18px; font-size: 17px; letter-spacing: -.01em; align-items: center; }
.step { display: grid; width: 28px; height: 28px; border-radius: 7px; color: #fff; background: var(--blue-600); font: 600 12px/1 var(--font-mono); place-items: center; }
.step .icon { width: 15px; height: 15px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.form-body { padding: 20px 22px 22px; }
.group-text { margin: 0 0 16px; color: var(--slate-600); font-size: 14px; }
.save-bar { position: sticky; bottom: 0; z-index: 4; display: flex; margin: 16px -32px 0; padding: 12px 32px; border-top: 1px solid var(--slate-200); justify-content: flex-end; background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); }
.read-log { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--slate-200); }
.read-log h3 { margin: 0 0 10px; font-size: 14px; }
.read-log ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.read-log li { display: flex; gap: 12px; font-size: 13.5px; flex-wrap: wrap; align-items: center; }

/* Slot picker */
.slotpick { display: grid; gap: 16px; }
.assurance { display: flex; gap: 10px; padding: 11px 13px; border: 1px solid var(--slate-200); border-radius: 8px; color: var(--slate-600); background: var(--slate-50); align-items: flex-start; transition: background .18s ease, border-color .18s ease, color .18s ease; }
.assurance .icon { width: 19px; height: 19px; margin-top: 1px; }
.assurance > span { display: grid; gap: 2px; font-size: 13px; }
.assurance b { color: inherit; font-size: 14px; }
.assurance[data-state="ok"] { border-color: #b7e4c7; color: var(--green-800); background: var(--green-50); }
.assurance[data-state="warn"] { border-color: #fed7aa; color: var(--orange-800); background: var(--orange-50); }
.assurance[data-state="error"] { border-color: #fecaca; color: var(--red-700); background: var(--red-50); }
.slot-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.slot-picker legend { margin-bottom: 10px; padding: 0; font-size: 14px; font-weight: 600; }
.slot-picker legend b { margin-left: 8px; color: var(--blue-700); font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.slots .hint { grid-column: 1 / -1; }
.slot { position: relative; display: block; cursor: pointer; }
.slot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.slot > span { display: grid; gap: 3px; min-height: 56px; padding: 6px; border: 1px solid var(--slate-300); border-radius: 8px; color: var(--slate-700); background: #fff; text-align: center; place-content: center; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.slot b { font: 600 15px/1 var(--font-mono); }
.slot small { color: var(--slate-500); font: 500 11px/1 var(--font-mono); }
.slot:hover > span { border-color: var(--blue-600); }
.slot input:checked + span { border-color: var(--blue-600); color: var(--blue-700); background: var(--blue-50); box-shadow: 0 0 0 1px var(--blue-600); }
.slot input:checked + span small { color: var(--blue-700); }
.slot input:focus-visible + span { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; }

/* Delivery detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.detail-main > * + *, .detail-side > * + * { margin-top: 16px; }
.proof-body { display: grid; gap: 18px; padding: 18px 20px 20px; }
.proof-body > .inline-alert { margin: 0; }
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.evidence-item { margin: 0; overflow: hidden; border: 1px solid var(--slate-200); border-radius: 9px; background: #fff; }
.evidence-item > a { display: block; }
.evidence-item img { display: block; width: 100%; height: 200px; background: var(--slate-100); object-fit: contain; }
.evidence-item figcaption { display: grid; gap: 5px; padding: 10px 12px; font-size: 12.5px; }
.evidence-kind { display: flex; gap: 6px; font-size: 13.5px; font-weight: 600; align-items: center; }
.evidence-kind .icon { width: 16px; height: 16px; color: var(--blue-600); }
.integrity { display: flex; gap: 6px; font-weight: 600; align-items: center; }
.integrity .icon { width: 15px; height: 15px; }
.integrity.ok { color: var(--green-700); }
.integrity.bad { color: var(--red-700); }
.evidence-item code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 0; overflow: hidden; border: 1px solid var(--slate-200); border-radius: 9px; }
.facts > div { padding: 12px 14px; box-shadow: 0 0 0 .5px var(--slate-200); }
dt { color: var(--slate-500); font: 600 10.5px/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
dd { display: grid; gap: 2px; margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }
dd small { color: var(--slate-500); font-size: 12.5px; }
dd .dot { display: none; }
.facts.stacked { grid-template-columns: 1fr; border: 0; border-radius: 0; }
.facts.stacked > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--slate-100); box-shadow: none; }
.facts.stacked > div:last-child { border-bottom: 0; }
.facts.stacked dt { padding-top: 3px; }
.facts.stacked dd { margin: 0; }
.timeline { margin: 0; padding: 16px 20px 6px; list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 13.5px; }
.timeline li::before { position: absolute; top: 5px; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 0 3px var(--blue-100); content: ""; }
.timeline li:not(:last-child)::after { position: absolute; top: 20px; bottom: 2px; left: 4px; width: 1px; background: var(--slate-200); content: ""; }
.timeline time { display: block; color: var(--slate-500); font: 500 11.5px/1.5 var(--font-mono); }
.timeline li > span { color: var(--slate-600); }
.timeline small { display: block; color: var(--slate-500); font-size: 12.5px; overflow-wrap: anywhere; }

/* Schedule */
.cal-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--slate-300); border-radius: 8px; background: #fff; }
.segmented a { display: grid; min-width: 64px; min-height: 34px; padding: 0 12px; border-radius: 6px; color: var(--slate-600); font-size: 13.5px; font-weight: 600; text-decoration: none; place-items: center; transition: background .18s ease, color .18s ease; }
.segmented a:hover { color: var(--navy-900); }
.segmented a[aria-current] { color: #fff; background: var(--navy-900); }
.pager-buttons { display: flex; gap: 6px; }
.legend { display: flex; gap: 8px 18px; margin: 0 0 12px; color: var(--slate-600); font-size: 13.5px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; }
.swatch-busy, .swatch-pending { display: inline-block; width: 18px; height: 11px; margin-right: 7px; border-radius: 3px; }
.swatch-busy { background: repeating-linear-gradient(135deg, var(--slate-300) 0 3px, var(--slate-200) 3px 6px); }
.swatch-pending { border: 1.5px dashed var(--orange-600); background: var(--orange-50); }
.surface.cal { --row: 5px; --gutter: 62px; --days: 7; overflow: clip; }
.surface.cal.day { --days: 1; }
.cal-head { position: sticky; top: var(--topbar); z-index: 5; display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--slate-200); background: #fff; }
.cal-corner { border-right: 1px solid var(--slate-200); }
.cal-day-head { min-width: 0; border-right: 1px solid var(--slate-200); }
.cal-day-head:last-child { border-right: 0; }
.cal-day-head > a { display: flex; gap: 7px; padding: 10px 12px; color: var(--navy-900); text-decoration: none; align-items: center; }
.cal-day-head > a:hover b { color: var(--blue-700); }
.cal-day-head > a span { color: var(--slate-500); font: 600 11px/1 var(--font-mono); letter-spacing: .08em; }
.cal-day-head > a b { display: inline-grid; min-width: 32px; height: 32px; border-radius: 8px; font: 600 19px/1 var(--font-mono); letter-spacing: -.03em; place-items: center; }
.cal-day-head > a em { margin-left: auto; color: var(--slate-500); font: normal 500 11px/1 var(--font-mono); }
.cal-day-head.today > a span { color: var(--blue-700); }
.cal-day-head.today > a b { color: #fff; background: var(--blue-600); }
.cal-day-head.today > a:hover b { color: #fff; }
.lane-heads { display: grid; border-top: 1px solid var(--slate-200); }
.lane-heads span { padding: 9px 12px; border-right: 1px solid var(--slate-100); font-size: 13.5px; font-weight: 600; }
.lane-heads span:last-child { border-right: 0; }
.all-day { margin: 0 8px 8px; padding: 4px 8px; border-radius: 5px; color: var(--slate-700); background: repeating-linear-gradient(135deg, var(--slate-200) 0 4px, var(--slate-100) 4px 8px); font: 600 11px/1.3 var(--font-mono); }
.cal-body { display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); }
.cal-gutter { display: none; grid-auto-rows: var(--row); border-right: 1px solid var(--slate-200); }
.cal-gutter span { padding-right: 8px; color: var(--slate-500); font: 500 11px/1 var(--font-mono); text-align: right; transform: translateY(-6px); }
.cal-gutter span:first-child { transform: none; padding-top: 3px; }
.cal-day { position: relative; display: flex; gap: 6px; min-width: 0; padding: 8px; flex-direction: column; border-right: 1px solid var(--slate-200); }
.cal-day:last-child { border-right: 0; }
.cal-day.today { background: rgba(239, 246, 255, .5); }
.cal .hour { display: none; }
.js .cal-gutter { display: grid; }
.js .cal-day { display: grid; gap: 0 3px; padding: 0 3px; grid-auto-rows: var(--row); }
.js .cal .hour { display: block; grid-column: 1 / -1; border-top: 1px solid var(--slate-100); pointer-events: none; }
.js .cal-day .cal-empty { display: none; }
.cal-empty { margin: 4px; color: var(--slate-500); font-size: 13px; }
.event { position: relative; z-index: 1; display: flex; gap: 1px; min-width: 0; margin: 1px 0; padding: 4px 7px 4px 8px; flex-direction: column; overflow: hidden; border-left: 3px solid var(--c, var(--slate-400)); border-radius: 6px; color: var(--c-ink, var(--navy-900)); background: var(--c-bg, var(--slate-50)); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .07); font-size: 12.5px; line-height: 1.25; text-decoration: none; transition: box-shadow .18s ease; }
.event { container-type: inline-size; }
@container (max-width: 118px) {
  .event .t-end, .event > span { display: none; }
}
.event:hover { z-index: 2; box-shadow: inset 0 0 0 1px var(--c, var(--slate-400)), var(--shadow-sm); }
.event:focus-visible { z-index: 3; }
.event time { font: 500 11px/1.25 var(--font-mono); }
.event b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.event > span { overflow: hidden; color: var(--slate-600); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.event time span { color: inherit; font: inherit; }
.event .event-driver { display: none; }
.event.s-delivered, .event.s-left_at_doorstep, .event.s-left_at_management, .event.s-returned_to_warehouse { color: #fff; background: var(--c, var(--slate-500)); }
.event.s-delivered > span, .event.s-left_at_doorstep > span, .event.s-left_at_management > span, .event.s-returned_to_warehouse > span { color: rgba(255, 255, 255, .88); }
.event.s-pending { border-left-style: dashed; background: repeating-linear-gradient(135deg, var(--orange-50) 0 6px, #fff 6px 12px); box-shadow: inset 0 0 0 1px #fed7aa; }
.event.s-cancelled_by_driver { opacity: .7; }
.event.s-cancelled_by_driver b { text-decoration: line-through; }
.event.busy { z-index: 0; border-left-color: var(--slate-400); color: var(--slate-700); background: repeating-linear-gradient(135deg, var(--slate-200) 0 4px, var(--slate-100) 4px 8px); box-shadow: none; }
.now-line { position: relative; z-index: 4; height: 2px; margin-top: -1px; grid-column: 1 / -1; background: var(--red-700); pointer-events: none; }
.now-line::before { position: absolute; top: -4px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red-700); content: ""; }
.cal-day-label { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Sign in and error pages */
.signin-page { display: grid; grid-template-columns: minmax(360px, .95fr) minmax(420px, 1.05fr); min-height: 100vh; }
.signin-story { position: relative; display: flex; padding: 40px clamp(36px, 6vw, 88px); flex-direction: column; overflow: hidden; color: #fff; background: var(--navy-950); }
.signin-story::before { position: absolute; right: -200px; bottom: -240px; width: 620px; height: 620px; border: 1px solid #243a57; border-radius: 50%; box-shadow: 0 0 0 80px rgba(37, 99, 235, .04), 0 0 0 160px rgba(37, 99, 235, .025); content: ""; }
.signin-story .wordmark { position: relative; padding: 0; }
.story-copy { position: relative; max-width: 520px; margin: auto 0; }
.story-index { color: #7fa7f8; font: 600 12px/1 var(--font-mono); letter-spacing: .12em; }
.story-title { margin: 18px 0 20px; font-size: clamp(44px, 5vw, 72px); font-weight: 700; line-height: .98; letter-spacing: -.05em; }
.story-title em { color: #66a0ff; font-style: normal; }
.story-copy > p:last-child { max-width: 420px; margin: 0; color: #a3b3c8; font-size: 16px; line-height: 1.6; }
.story-features { position: relative; display: flex; gap: 8px; flex-wrap: wrap; }
.story-features span { display: flex; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid #263b56; border-radius: 7px; color: #b6c4d6; font-size: 13px; align-items: center; }
.story-features .icon { width: 16px; height: 16px; color: #75a4ff; }
.signin-panel { display: grid; padding: 32px 20px; background-color: #eaf0f5; background-image: linear-gradient(rgba(51, 65, 85, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(51, 65, 85, .05) 1px, transparent 1px); background-size: 24px 24px; place-items: center; }
.signin-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--slate-200); border-radius: 14px; background: #fff; box-shadow: var(--shadow-lg); }
.signin-card .wordmark { display: none; margin-bottom: 26px; }
.signin-card h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.03em; }
.signin-card > p.muted { margin: 0; font-size: 14.5px; }
.signin-card .inline-alert { margin-top: 16px; }
.signin-form { display: grid; gap: 16px; margin-top: 22px; }
.signin-foot { display: flex; gap: 8px; margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--slate-200); color: var(--slate-500); font-size: 13px; align-items: center; }
.signin-foot .icon { width: 17px; height: 17px; }
.center-page { display: grid; min-height: 100vh; padding: 24px; place-items: center; }

/* Narrower screens */
@media (max-width: 1240px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-bar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-bar .grow { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  :root { --topbar: 60px; }
  .shell { display: block; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 86vw); height: 100%; visibility: hidden; transform: translateX(-102%); transition: transform .22s ease, visibility .22s; }
  .nav-open .sidebar { visibility: visible; transform: none; }
  .close-menu { display: grid !important; }
  .menu-button { display: grid; }
  .topbar { gap: 8px; padding: 0 12px; }
  .command-search { width: auto; flex: 1; }
  .command-search kbd { display: none; }
  .topbar-actions .button.compact { width: 42px; padding: 0; }
  .topbar-actions .button.compact span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .content { padding: 22px 16px 72px; }
  .save-bar { margin: 16px -16px 0; padding: 12px 16px; }
  .shell { background: none; }
  .page-heading { flex-direction: column; align-items: stretch; }
  .page-heading > .button.large { width: 100%; }
}

@media (max-width: 760px) {
  .metric { min-height: 104px; padding: 14px; gap: 12px; }
  .metric-body strong { font-size: 27px; }
  .approval-row { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .approval-controls, .approval-controls.stacked { min-width: 0; grid-column: 1 / -1; flex-direction: row; justify-content: stretch; }
  .approval-controls > .button, .approval-controls > form > .button { flex: 1; }
  .approval-controls .button.square { flex: 0 0 40px; }
  .approval-controls .check { width: 100%; }
  .approval-more details.more > summary, .more-body { padding-right: 16px; padding-left: 16px; }
  .status-strip { grid-template-columns: 36px minmax(0, 1fr); }
  .status-strip > a { grid-column: 2; }
  .exception-card { grid-template-columns: 40px minmax(0, 1fr); }
  .exception-actions { grid-column: 1 / -1; justify-content: stretch; }
  .exception-actions .button { flex: 1; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
  .filter-actions .button { flex: 1; }
  .form-section { padding: 18px 16px; }
  .form-body { padding: 16px; }
  .slot-box.current { margin: 16px 16px 0; }
  .surface-header { min-height: 64px; padding: 14px 16px; }
  .facts.stacked > div { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 16px; }
  .route-list { padding: 8px 12px 8px 16px; }
  .route-list li { grid-template-columns: 26px 42px minmax(0, 1fr) auto; gap: 8px; }

  /* Tables become cards */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; }
  .data-table tr { position: relative; padding: 12px 60px 12px 16px; border-bottom: 1px solid var(--slate-200); }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table td { padding: 2px 0; border: 0; }
  .data-table .when { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .data-table .customer { min-width: 0; }
  .data-table .customer span { max-width: none; }
  .data-table td:has(.chip) { padding-top: 6px; }
  .data-table .go { position: absolute; top: 50%; right: 14px; width: auto; transform: translateY(-50%); }
  .data-table td.person-cell { display: flex; min-width: 0; }
  .people-table td:not(.person-cell):not(.go) { display: inline-block; margin: 6px 8px 0 0; }

  /* Schedule becomes a list of days */
  .cal-head { display: none; }
  .cal-body { display: block; }
  .js .cal-gutter, .js .cal .hour, .now-line { display: none !important; }
  .js .cal-day, .cal-day { display: flex; gap: 6px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--slate-200); }
  .cal-day:last-child { border-bottom: 0; }
  .js .cal-day .cal-empty { display: block; }
  .cal-day-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; margin: 0 0 2px; font: 600 12px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--slate-600); }
  .cal-day.today .cal-day-label { color: var(--blue-700); }
  .event { padding: 8px 10px; }
  .event .event-driver { display: block; }
  .event > span { white-space: normal; }
}

@media (max-width: 440px) {
  .metrics { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .metric { min-height: 0; align-items: center; }
  .metric-body { grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
  .metric-body small { grid-column: 1; }
  .metric-body strong { grid-row: 1 / span 2; grid-column: 2; }
  .metric-body > span { grid-column: 1; }
  .approval-row { grid-template-columns: minmax(0, 1fr); }
  .approval-date { display: flex; gap: 8px; padding: 0; border: 0; align-items: baseline; }
  .filter-bar { grid-template-columns: minmax(0, 1fr); }
  .signin-card { padding: 24px 20px; }
}

@media (max-width: 960px) and (min-width: 761px) {
  .cal-day-head > a { padding: 8px; }
}

@media (max-width: 860px) {
  .signin-page { grid-template-columns: minmax(0, 1fr); }
  .signin-story { display: none; }
  .signin-card .wordmark { display: flex; }
}

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

@media print {
  .sidebar, .topbar, .scrim, .approval-more, .exception-actions, .form-actions, .save-bar { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .surface { box-shadow: none; }
}
