/* Spearhead brand colours, sampled from ST-logo-FINAL.pdf:
   orange #FFA403 ("Spearhead"), blue #305F93 ("Trucking" and the stripe), deep teal #002F3B (the mountain). */
:root {
    --brand-orange: #FFA403; --brand-blue: #305F93; --brand-teal: #002F3B;
    --bg: #f4f7f9; --card: #ffffff; --fg: #0f2a33; --muted: #5a6d75; --line: #d9e2e6;
    --accent: #305F93; --accent-fg: #ffffff; --highlight: #FFA403;
    --header-bg: #002F3B; --header-fg: #e3eef2; --header-muted: #9fbac3;
    --warn: #a15c00; --bad: #b42318; --good: #157347;
}
/* Dark theme: used when the visitor chose it, or when their device prefers dark and they made no choice. */
:root[data-theme="dark"] {
    --bg: #071a20; --card: #0e252d; --fg: #e4eef1; --muted: #93aab2; --line: #1d3a44;
    --accent: #6f9fd4; --accent-fg: #06141a; --highlight: #FFB42E;
    --header-bg: #001d25; --header-fg: #e4eef1; --header-muted: #8fb0ba;
    --warn: #ffb547; --bad: #ff8a80; --good: #6fd39a;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #071a20; --card: #0e252d; --fg: #e4eef1; --muted: #93aab2; --line: #1d3a44;
        --accent: #6f9fd4; --accent-fg: #06141a; --highlight: #FFB42E;
        --header-bg: #001d25; --header-fg: #e4eef1; --header-muted: #8fb0ba;
        --warn: #ffb547; --bad: #ff8a80; --good: #6fd39a;
    }
}
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 "Segoe UI", system-ui, sans-serif; }
.shell main { padding: 16px 24px 48px; max-width: 1400px; }
.top { display: flex; gap: 20px; align-items: center; padding: 8px 24px; background: var(--header-bg); color: var(--header-fg); border-bottom: 3px solid var(--brand-orange); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--header-fg); text-decoration: none; letter-spacing: .5px; }
.top .brand img { height: 38px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.top .brand .app { color: var(--brand-orange); }
.top nav { display: flex; gap: 14px; flex-wrap: wrap; }
.top nav a { color: var(--header-muted); text-decoration: none; padding: 4px 2px; }
.top nav a:hover { color: var(--header-fg); }
.top nav a.active { color: var(--header-fg); border-bottom: 2px solid var(--brand-orange); }
.top .right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.top .right a, .top .right .who { color: var(--header-muted); }
.top .env { font-size: 12px; font-weight: 700; color: var(--brand-orange); border: 1px solid var(--brand-orange); padding: 2px 8px; border-radius: 999px; }
.ask-btn { background: var(--brand-orange); color: #1b1300; border: none; border-radius: 999px; padding: 4px 12px; font-weight: 700; }
.ask-btn .chip { margin-left: 6px; font-size: 12px; background: rgba(0,0,0,.15); border-radius: 999px; padding: 0 6px; }
.ask-btn .chip.spin { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.ask-pop { position: fixed; top: 64px; right: 16px; box-sizing: border-box; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow-y: auto; overflow-wrap: anywhere; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-top: 3px solid var(--brand-orange); border-radius: 10px; padding: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 20; }
.ask-pop pre, .ask-reply pre { white-space: pre-wrap; }
.ask-reply table { display: block; max-width: 100%; overflow-x: auto; }
.ask-pop .toolbar { flex-wrap: wrap; }
.ask-pop textarea { width: 100%; box-sizing: border-box; min-height: 90px; resize: vertical; margin-top: 6px; }
.ask-reply { margin: 10px 0; line-height: 1.5; }
.viewer-backdrop { position: fixed; inset: 0; background: rgba(0, 20, 26, .72); z-index: 50; display: flex; align-items: center; justify-content: center; outline: none; }
.viewer { width: min(1100px, 94vw); height: 92vh; background: var(--card); border-radius: 10px; border-top: 3px solid var(--brand-orange); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.viewer-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.viewer-bar .spacer { flex: 1; }
.viewer .scan-view { flex: 1; min-height: 0; }
.page-link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; cursor: pointer; }
.theme-toggle { background: transparent; border: 1px solid var(--header-muted); color: var(--header-fg); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
@media (max-width: 760px) { .shell main { padding: 12px 16px 40px; } .top { padding: 8px 16px; } table { display: block; overflow-x: auto; } }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 8px; }
table { border-collapse: collapse; width: 100%; background: var(--card); border: 1px solid var(--line); }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot th { color: var(--fg); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
tr.warn td { color: var(--warn); }
.error { color: var(--bad); }
.ok { color: var(--good); }
.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 12px 0; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; margin: 8px 0 12px; }
.form .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea, button, .button { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); }
textarea { min-height: 60px; }
button, .button { cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.card { border-top: 3px solid var(--brand-orange); }
button.link { border: none; background: none; color: var(--accent); padding: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.card .big { font-size: 26px; font-weight: 700; }

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Shift review: the form on the left, the scanned page beside it. */
.review-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.review-head h1 { margin-right: auto; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); gap: 20px; align-items: start; }
.review-scan { position: sticky; top: 72px; display: flex; flex-direction: column; height: calc(100vh - 90px); background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand-orange); border-radius: 10px; overflow: hidden; }
.review-scan .toolbar { margin: 0; padding: 8px; border-bottom: 1px solid var(--line); gap: 6px; }
.review-scan .scan-view { flex: 1; min-height: 0; }
.notes-box { border: 1px solid var(--warn); border-left: 4px solid var(--warn); border-radius: 8px; padding: 8px 12px; margin: 8px 0; color: var(--warn); background: var(--card); }
table.tight td, table.tight th { padding: 4px 6px; }
table.tight input { padding: 4px 6px; }
.history { margin-top: 24px; }
.history summary { cursor: pointer; color: var(--accent); }
td.changes { font-size: 13px; color: var(--muted); }
@media (max-width: 1100px) { .review { grid-template-columns: 1fr; } .review-scan { position: static; height: 80vh; order: -1; } }
/* Shift review on a big monitor: the whole width, fields grouped in panels in two columns beside the
   scan, and nothing above the fields that changes height between drafts. */
.shell main:has(.review) { max-width: none; }
.review { grid-template-columns: minmax(0, 1fr) minmax(420px, 40%); }
.review.no-scan { grid-template-columns: 1fr; }
.review-cols { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 1800px) { .review-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); } }
.review-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px 12px; min-width: 0; }
.panel h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.panel .form { margin: 0; }
.form.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel input, .panel select, .panel textarea { background: var(--bg); width: 100%; box-sizing: border-box; min-width: 0; }
.panel input:focus, .panel select:focus, .panel textarea:focus { outline: 2px solid var(--highlight); outline-offset: -1px; border-color: var(--highlight); }
.panel select:disabled { opacity: .45; }
.panel table { border: none; background: transparent; }
.panel table th { padding-top: 0; }
.panel table td.grow { width: 40%; }
.panel button.add { margin-top: 6px; font-size: 13px; padding: 3px 10px; background: transparent; }
label.readout output { padding: 6px 2px; color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-box.scan-notes { margin: 16px 0 0; }
.review-actions { position: sticky; bottom: 0; z-index: 3; margin: 12px 0 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand-orange); border-radius: 8px; align-items: center; }
.review-message { margin-left: 8px; }
/* Pay and revenue under the review: one column per item, the sum under each amount. */
.pay-sub { font-size: 14px; margin: 14px 0 6px; color: var(--muted); font-weight: 600; }
table.pay-cols { width: auto; min-width: 50%; }
table.pay-cols th { white-space: normal; max-width: 160px; vertical-align: bottom; }
table.pay-cols td { white-space: nowrap; }
table.pay-cols .calc { font-size: 12px; color: var(--muted); }
/* While another page's picture is on its way: dim the old one and show a spinner over it. */
.scan-canvas { position: relative; }
.scan-canvas.loading img { opacity: .25; filter: blur(2px); transition: opacity .15s; }
.scan-canvas.loading::after { content: ""; position: absolute; top: 40%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
    border: 4px solid rgba(255,255,255,.25); border-top-color: var(--brand-orange); border-radius: 50%; animation: scanspin .8s linear infinite; }
@keyframes scanspin { to { transform: rotate(360deg); } }

/* Pay statements: one driver per printed page. */
.statement { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin: 16px 0; max-width: 860px; }
.statement header { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid var(--brand-orange); padding-bottom: 10px; margin-bottom: 8px; }
.statement header img { height: 44px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.small { font-size: 12px; }
@media print {
    .top, .no-print, .ask-pop { display: none !important; }
    body { background: #fff; color: #000; }
    .statement { border: none; page-break-after: always; margin: 0; padding: 0; max-width: none; }
    .muted { color: #555; }
}

tr.bad td { color: var(--bad); }

/* Sign-in, invitation and driver portal */
.shell main.public, .shell main.portal { max-width: 900px; margin: 0 auto; }
.signin { max-width: 460px; margin: 40px auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px 28px; }
.signin h1 { margin-top: 0; }
.signin-foot { text-align: center; margin: 0; }
.privacy { max-width: 680px; }
.privacy h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.signin-choices { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.signin-button { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg); color: var(--fg); font-weight: 600; text-decoration: none; font-size: 16px; }
.signin-button:hover { border-color: var(--accent); }
.question { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.question .reply { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--good); background: var(--bg); border-radius: 4px; }
.question .driver-note { white-space: pre-line; margin: 6px 0; padding: 8px 10px; background: var(--bg); border-radius: 4px; }
.question .review-box { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--accent); }
.question .actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.question .actions-grid h3 { margin: 6px 0; font-size: 15px; }
.question textarea, .ask-office textarea { width: 100%; box-sizing: border-box; }
.ask-office { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.ask-office button { align-self: flex-start; }
@media (max-width: 600px) {
    .shell main { padding: 12px 12px 40px; }
    .signin { margin: 16px auto; padding: 18px; }
    .shell main.portal table { font-size: 13px; }
}
/* The "something went wrong" bar, for every layout (Blazor shows it only on an error). */
#blazor-error-ui { color-scheme: light only; background: lightyellow; color: #222; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box;
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
/* Driver statement on a phone: each day as a small card. */
@media (max-width: 600px) {
    table.statement thead { display: none; }
    table.statement, table.statement tbody, table.statement tfoot, table.statement tr, table.statement td, table.statement th { display: block; width: auto; }
    table.statement tbody tr { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 6px 10px; background: var(--card); }
    table.statement td { border: none; padding: 2px 0; text-align: left; }
    table.statement td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
    table.statement td:empty { display: none; }
    table.statement tfoot tr { display: flex; justify-content: space-between; padding: 4px 10px; }
}
/* A scanned page as a picture: tools on top, the page below, scrolling when zoomed in. */
.scan-view { display: flex; flex-direction: column; min-height: 0; }
.scan-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--line); }
.scan-tools .spacer { flex: 1; }
.scan-canvas { flex: 1; min-height: 0; overflow: auto; background: #525659; padding: 8px; }
.scan-canvas img { display: block; max-width: none; height: auto; margin: 0 auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
/* Office menu on one line; links that don't fit are in "More ▾". */
.top .main-nav { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 14px; }
.top .main-nav .nav-items { flex: 1 1 auto; min-width: 0; display: flex; gap: 14px; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.top .main-nav .nav-items a { flex: none; }
.nav-more { position: relative; flex: none; }
.nav-more summary { list-style: none; cursor: pointer; color: var(--header-muted); padding: 4px 2px; white-space: nowrap; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary:hover, .nav-more[open] summary { color: var(--header-fg); }
.nav-more.has-active summary { color: var(--header-fg); border-bottom: 2px solid var(--brand-orange); }
.nav-more-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px; display: flex; flex-direction: column;
    background: var(--header-bg); border: 1px solid var(--line); border-top: 3px solid var(--brand-orange); border-radius: 8px; padding: 6px 0; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.top .nav-more-menu a { padding: 8px 16px; color: var(--header-muted); text-decoration: none; border: none; }
.top .nav-more-menu a:hover { color: var(--header-fg); background: rgba(255,255,255,.06); }
.top .nav-more-menu a.active { color: var(--header-fg); border-bottom: none; border-left: 3px solid var(--brand-orange); padding-left: 13px; }
/* Phones: logo and buttons on the first line, the menu on its own line below. */
@media (max-width: 700px) {
    .top { gap: 8px 12px; padding: 8px 12px; }
    .top .main-nav { order: 3; flex: 1 1 100%; }
    .top .right { gap: 8px; }
    .top .right .who { display: none; }
    .top .right a, .top .right button { white-space: nowrap; }
    .top .theme-toggle .label { display: none; }
    .top .env { font-size: 11px; padding: 1px 6px; }
    .top .brand img { height: 32px; }
}

/* Schedule: a calendar week, one column per day and one row per gate time, so the same run lines up
   across the week. Scrolls sideways on narrow screens. */
.week-scroll { overflow-x: auto; }
.week-table { width: 100%; min-width: 980px; table-layout: fixed; border-collapse: separate; border-spacing: 6px 0; background: none; border: none; }
.week-table th, .week-table td { vertical-align: top; padding: 3px 6px; background: var(--card); border: 1px solid var(--line); border-top: none; border-bottom: none; text-align: left; }
.week-table th.slot { width: 44px; background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; padding: 10px 2px 0 0; font-variant-numeric: tabular-nums; }
.week-table thead th:not(.slot) { border-top: 1px solid var(--line); border-radius: 10px 10px 0 0; padding: 8px 8px 6px; display: table-cell; }
.week-table thead th:not(.slot) strong { display: block; }
.week-table tbody td { border-top: 1px dashed var(--line); }
.week-table tbody td .run-card + .run-card { margin-top: 4px; }
.week-table tfoot tr:last-child td { border-bottom: 1px solid var(--line); border-radius: 0 0 10px 10px; padding-bottom: 8px; }
.week-table tfoot .away-row td { border-top: 1px solid var(--line); padding-top: 6px; min-height: 24px; }
.week-table th.today, .week-table td.today { border-left-color: var(--highlight); border-right-color: var(--highlight); }
.week-table thead th.today { border-top: 3px solid var(--highlight); }
.week-table tfoot tr:last-child td.today { border-bottom-color: var(--highlight); }
.week-table td.empty-cell { height: 60px; }
.run-card { display: flex; flex-direction: column; align-items: stretch; gap: 1px; text-align: left; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--bg); color: var(--fg); cursor: pointer; }
.run-card:hover { border-color: var(--accent); }
.run-card .run-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.run-card .gate { font-weight: 700; font-variant-numeric: tabular-nums; }
.run-card .path { font-size: 13px; }
.run-card .run-who { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-card.done { border-left-color: var(--good); }
.run-card.missing { border-left-color: var(--warn); }
.run-card.cancelled { border-left-color: var(--muted); opacity: .65; }
.run-card.editing { outline: 2px solid var(--highlight); outline-offset: 1px; }
.run-card { user-select: none; }
.run-card.cancelled .gate, .run-card.cancelled .path, .run-card.cancelled .run-who { text-decoration: line-through; }
.day-actions { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 4px; }
.schedule-editor { margin: 8px 0 16px; }
.schedule-editor h2 { margin: 0 0 4px; }

/* Daily recap email preview: looks like the email (black borders on white). */
.recap-preview { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; }
.recap-preview table { width: auto; background: #fff; border: none; }
.recap-preview th, .recap-preview td { color: #000; }

/* Time off: chips, the week's list under the schedule, and the month calendar. */
.to-chip { display: inline-block; font-size: 12px; line-height: 1.3; padding: 1px 6px; margin: 1px 2px 1px 0; border-radius: 999px; border: 1px solid transparent; background: var(--bg); color: var(--fg); cursor: default; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
button.to-chip { cursor: pointer; font: inherit; font-size: 12px; }
.to-off { background: #e6e9eb; color: #33444b; border-color: #c9d1d5; }
.to-vacation { background: #dbeafe; color: #1e3a8a; border-color: #b3cdf5; }
.to-sick { background: #fde2e1; color: #8a1c14; border-color: #f4b9b4; }
.to-available { background: #dcf3e5; color: #14532d; border-color: #a9dfbf; }
:root[data-theme="dark"] .to-off { background: #26353b; color: #d4dde0; border-color: #3a4c53; }
:root[data-theme="dark"] .to-vacation { background: #17305a; color: #cfe0ff; border-color: #2a4a80; }
:root[data-theme="dark"] .to-sick { background: #4a1d1a; color: #ffd6d2; border-color: #6e2b26; }
:root[data-theme="dark"] .to-available { background: #173d27; color: #c9f2d8; border-color: #285c3c; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .to-off { background: #26353b; color: #d4dde0; border-color: #3a4c53; }
    :root:not([data-theme="light"]) .to-vacation { background: #17305a; color: #cfe0ff; border-color: #2a4a80; }
    :root:not([data-theme="light"]) .to-sick { background: #4a1d1a; color: #ffd6d2; border-color: #6e2b26; }
    :root:not([data-theme="light"]) .to-available { background: #173d27; color: #c9f2d8; border-color: #285c3c; }
}
.away-week { margin-top: 16px; }
.away-days { display: flex; flex-direction: column; gap: 4px; }
.away-day { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.away-day strong { min-width: 90px; }
.month-title { margin: 0 8px; min-width: 170px; text-align: center; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-head { font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; }
.month-day { background: var(--card); border: 1px solid var(--line); border-radius: 6px; min-height: 84px; padding: 3px 4px; display: flex; flex-direction: column; align-items: flex-start; overflow: hidden; }
.month-day.other { opacity: .5; }
.month-day.today { border-color: var(--highlight); box-shadow: inset 0 3px 0 var(--highlight); }
.month-num { font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .month-day { min-height: 56px; } .month-day .to-chip { font-size: 10px; padding: 0 3px; } }
.legend .to-chip { cursor: default; }
/* Month calendar as week rows: day boxes behind, one bar per entry across its days in front. */
.month-cal { display: flex; flex-direction: column; gap: 4px; }
.month-heads, .month-week-bg, .month-week-fg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-week { position: relative; min-height: 96px; }
.month-week-bg { position: absolute; inset: 0; }
.month-week-bg .month-day { min-height: 0; height: 100%; box-sizing: border-box; }
.month-week-fg { position: relative; grid-auto-flow: row dense; row-gap: 3px; padding: 3px 0 6px; }
.month-week-fg .month-num { padding: 0 6px; }
.to-bar { font: inherit; font-size: 12px; line-height: 1.35; text-align: left; padding: 1px 8px; margin: 0 4px; border-radius: 999px; border: 1px solid transparent;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; min-width: 0; }
.to-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.to-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
@media (max-width: 600px) { .month-week { min-height: 64px; } .to-bar { font-size: 10px; padding: 0 4px; } }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); }
@media (max-width: 700px) { .ask-pop { top: 92px; max-height: calc(100vh - 108px); } }

/* Jarvis voice: mic button and the quiet countdown bar before an automatic send. */
.mic-btn { min-width: 40px; }
.mic-btn.on { border-color: var(--brand-orange); }
.mic-btn.listening { animation: pulse 1.6s infinite; }
.mic-bar { height: 3px; margin-top: 4px; border-radius: 2px; background: transparent; overflow: hidden; position: relative; }
.mic-bar.run::after { content: ""; position: absolute; inset: 0; background: var(--brand-orange); transform-origin: left; animation: micbar 6s linear forwards; }
@keyframes micbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Driver page: click a pay item to open its rate history underneath. */
.nowrap { white-space: nowrap; }
table.rates-table tr.clickable { cursor: pointer; }
table.rates-table tr.clickable:hover td, table.rates-table tr.open td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
table.rates-table tr.rate-panel-row > td { padding: 0 6px 10px; }
.rate-panel { border: 1px solid var(--line); border-left: 3px solid var(--brand-orange); border-radius: 8px; padding: 10px 12px; background: var(--card); }
.rate-panel h4 { margin: 12px 0 6px; }
.rate-panel table { width: auto; }
.rate-panel input[type=date] { min-width: 9em; }

/* 24-hour time box (Time24.razor). */
input.time24 { width: 5.5em; font-variant-numeric: tabular-nums; }
input.time24.bad { border-color: var(--bad); outline-color: var(--bad); }
.time24-wrap { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Searchable pick list (PickBox.razor). */
.pickbox { position: relative; display: block; }
.pickbox > input { width: 100%; box-sizing: border-box; }
.pickbox-list { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none; max-height: 260px; overflow-y: auto;
    background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.pickbox-list li { padding: 5px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pickbox-list li.on { background: var(--accent); color: var(--accent-fg); }

/* Shift page: cover shown while saving and moving to the next / previous draft, so nothing is clicked twice. */
.busy-mask { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--bg) 60%, transparent); cursor: progress; }
.busy-box { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 10px; background: var(--card); color: var(--fg);
    border: 1px solid var(--line); border-top: 3px solid var(--brand-orange); box-shadow: 0 8px 30px rgba(0,0,0,.3); font-weight: 600; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-orange); animation: scanspin .8s linear infinite; }
