:root {
  --ink: #17212b;
  --muted: #61707d;
  --paper: #f5f6f3;
  --surface: #ffffff;
  --line: #dce2e5;
  --primary: #263e6a;
  --primary-dark: #182a4b;
  --accent: #e06c3b;
  --success: #287a57;
  --danger: #a63d40;
  --shadow: 0 12px 34px rgba(23, 33, 43, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--primary); }
.site-header { min-height: 64px; padding: 0 4vw; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--primary-dark); }
.site-header a, .link-button { color: white; text-decoration: none; }
.brand { font-weight: 800; letter-spacing: -0.02em; font-size: 1.05rem; }
.site-header nav { display: flex; gap: 1.25rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; background: transparent; font: inherit; padding: 0; cursor: pointer; }
.page-shell { width: min(1280px, 92vw); margin: 0 auto; padding: 3rem 0 5rem; }
.page-heading { margin-bottom: 2rem; }
.split-heading { display: flex; gap: 2rem; justify-content: space-between; align-items: center; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; line-height: 1.05; }
h2 { margin-bottom: .35rem; font-size: 1.25rem; }
.eyebrow { color: var(--accent); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .6rem; }
.lede, .panel-heading p { color: var(--muted); max-width: 760px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: .55rem .9rem; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:disabled, .link-button:disabled { opacity: .5; cursor: not-allowed; }
.button[aria-busy="true"], .link-button[aria-busy="true"] { cursor: wait; }
.button[aria-busy="true"]::before, .link-button[aria-busy="true"]::before { content: ""; width: 1em; height: 1em; margin-right: .5rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: button-spin .7s linear infinite; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--primary); background: white; border-color: var(--line); }
.button.success { color: white; background: var(--success); }
.button.danger { color: white; background: var(--danger); }
.full-width { width: 100%; }
.panel { margin-bottom: 1.5rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.narrow-panel { max-width: 680px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.panel-heading p { margin-bottom: 0; }
.collapsible-panel > summary { list-style: none; }
.collapsible-panel > summary::-webkit-details-marker { display: none; }
.collapsible-summary { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; cursor: pointer; }
.collapsible-summary:focus-visible { outline: 3px solid rgba(38, 62, 106, .28); outline-offset: 6px; border-radius: 6px; }
.collapsible-summary-copy { display: grid; gap: .25rem; min-width: 0; }
.collapsible-title { font-size: 1.25rem; font-weight: 800; line-height: 1.3; }
.collapsible-description { color: var(--muted); }
.summary-meta { display: flex; align-items: center; gap: .8rem; flex: 0 0 auto; }
.summary-chevron { width: .7rem; height: .7rem; margin: 0 .3rem .3rem 0; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(45deg); transition: transform .18s ease; }
.collapsible-panel[open] .summary-chevron { margin: .3rem .3rem 0 0; transform: rotate(225deg); }
.collapsible-content { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.collapsible-toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-grid article { padding: 1.1rem; border-radius: 12px; color: white; background: var(--primary); }
.stat-grid strong { display: block; font-size: 2rem; line-height: 1; }
.stat-grid span { display: block; margin-top: .4rem; opacity: .8; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.stacked-form p { margin-bottom: 1rem; }
.stacked-form label, .dispatcher-form label { display: block; font-weight: 700; margin-bottom: .3rem; }
.stacked-form input, .stacked-form select, .stacked-form textarea, .dispatcher-form input, .dispatcher-form select { width: 100%; min-height: 42px; padding: .55rem .65rem; border: 1px solid #b9c3ca; border-radius: 8px; background: white; font: inherit; }
.helptext { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.errorlist { color: var(--danger); }
.form-actions { display: flex; gap: .75rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.status, .pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; background: #e9edf0; font-size: .78rem; font-weight: 800; }
.status.draft { color: #765a00; background: #fff3c9; }
.status.published { color: #146040; background: #dff4e9; }
.status.closed { color: #4d5760; }
.status.uncovered { color: #7d2428; background: #f8dfe0; margin-right: .45rem; }
.status.large { padding: .45rem .8rem; }
.pill { margin-left: .45rem; color: #694000; background: #ffedb5; }
.recommended-row { background: #fffbef; }
.uncovered-row { background: #fff6f6; }
.uncovered-row small { display: block; margin-top: .3rem; color: var(--danger); }
.messages { margin-bottom: 1.25rem; }
.message { margin-bottom: .55rem; padding: .85rem 1rem; border-radius: 8px; background: #e7eef5; }
.message.success { color: #155c3f; background: #dff4e9; }
.message.error { color: #7d2428; background: #f8dfe0; }
.message.warning { color: #674b00; background: #fff0bd; font-weight: 700; }
.empty-state { padding: 2rem; text-align: center; color: var(--muted); }
.large-empty { min-height: 280px; display: grid; place-content: center; }
.compact-list { margin: 1.5rem 0 0; padding: 0; list-style: none; }
.compact-list li { padding: .55rem 0; border-top: 1px solid var(--line); }
.compact-list span { float: right; color: var(--muted); }
#campaign-map { height: 600px; border-radius: 10px; }
.driver-map { height: 380px; margin-bottom: 1rem; border-radius: 10px; }
#route-preview-map { height: 520px; border-radius: 10px; }
.map-legend { display: flex; gap: 1rem; font-size: .8rem; }
.map-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.map-filters label { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.map-filters select { display: block; width: 100%; min-height: 40px; margin-top: .3rem; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: white; font: inherit; text-transform: none; letter-spacing: normal; }
.map-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; }
.driver-dot::before { background: #236b8e; }.recipient-dot::before { background: #e06c3b; }.ineligible-dot::before { background: #8a9299; }
.auth-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "staff driver" "cta cta"; gap: 1.5rem; width: min(960px, 100%); margin: 3vh auto; align-items: start; }
.auth-card { width: min(460px, 100%); margin: 5vh auto; padding: 2rem; border-radius: 16px; background: white; box-shadow: var(--shadow); }
.auth-layout .auth-card { width: auto; min-height: 100%; margin: 0; }
.auth-layout .auth-card h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.staff-auth { grid-area: staff; }
.driver-auth { grid-area: driver; }
.auth-intro { min-height: 3rem; color: var(--muted); }
.auth-cta { grid-area: cta; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.25rem 1.5rem; border: 1px solid #f0c5b2; border-radius: 14px; background: #fff8f4; box-shadow: var(--shadow); }
.auth-cta strong, .auth-cta span { display: block; }
.auth-cta strong { margin-bottom: .15rem; font-size: 1.05rem; }
.auth-cta span { color: var(--muted); }
.auth-cta .button { flex: 0 0 auto; }
.dispatcher-panel { border-color: #b8c8de; background: #f9fbff; }
.dispatcher-form { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(220px, 2fr) minmax(130px, 1fr) auto; gap: 1rem; align-items: end; }
.dispatcher-form p { margin-bottom: 0; }
.dispatcher-warning { grid-column: 1 / -1; margin-bottom: 0; }
.dispatcher-form .button { min-height: 42px; }
.muted-note { margin: 1rem 0 0; color: var(--muted); }
.preview-notice { border: 1px solid #c8d8e8; }
.preview-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.preview-stat-grid article { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.preview-stat-grid strong { display: block; color: var(--primary); font-size: 1.75rem; line-height: 1.1; }
.preview-stat-grid span { color: var(--muted); font-size: .85rem; }
.preview-stop-list { margin: 0; padding: 0; list-style: none; }
.preview-stop { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.preview-stop:last-child { border-bottom: 0; }
.preview-stop div span { display: block; color: var(--muted); }
.stop-number { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: white; background: var(--primary); font-weight: 800; }
.preview-actions { display: flex; justify-content: flex-end; gap: .75rem; align-items: flex-end; }
.preview-actions form { margin: 0; }
.large-button { min-height: 48px; padding-inline: 1.2rem; }
.confirm-warning { max-width: 520px; margin: 0 0 .5rem; color: var(--danger); font-size: .85rem; font-weight: 700; }
.compact-warning-list { margin-bottom: 0; }
.route-section-heading { margin: 2rem 0 1rem; }
.route-section-heading p { color: var(--muted); }
.driver-route-card { padding: 1.5rem; }
.route-summary { display: flex; flex-direction: column; align-items: flex-end; color: var(--muted); }
.route-summary strong { color: var(--primary); font-size: 1.4rem; }
.completed-routes { margin-top: 3rem; }
.completed-route-details { margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 12px; background: white; }
.completed-route-details > summary { padding: 1rem 1.2rem; cursor: pointer; font-weight: 800; }
.completed-route-details > .driver-route-card { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; box-shadow: none; }
.route-progress { position: sticky; top: 8px; z-index: 500; display: flex; justify-content: center; gap: .5rem; margin: 1rem auto; padding: .75rem 1rem; width: max-content; border-radius: 999px; color: white; background: var(--primary-dark); box-shadow: var(--shadow); }
.stop-list { padding: 0; list-style: none; counter-reset: stops; }
.stop-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; margin-bottom: .85rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.stop-card.visited { opacity: .62; background: #edf5f0; }
.stop-card.visited h2, .stop-card.visited p { text-decoration: line-through; }
.stop-check input { position: absolute; opacity: 0; }
.stop-check span { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--primary); border-radius: 50%; font-weight: 900; }
.stop-check input:checked + span { color: white; background: var(--success); border-color: var(--success); }
.stop-details h2, .stop-details p { margin-bottom: .2rem; }
footer { padding: 2rem; color: var(--muted); text-align: center; font-size: .8rem; }
@keyframes button-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .button[aria-busy="true"]::before, .link-button[aria-busy="true"]::before { animation-duration: 1.4s; }
  .summary-chevron { transition: none; }
}
@media (max-width: 760px) {
  .page-shell { padding-top: 2rem; }
  .split-heading, .panel-heading { align-items: stretch; flex-direction: column; }
  .collapsible-summary { align-items: flex-start; }
  .summary-meta { padding-top: .15rem; }
  .two-column { grid-template-columns: 1fr; }
  .dispatcher-form, .preview-stat-grid { grid-template-columns: 1fr; }
  .map-filters { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; grid-template-areas: "driver" "staff" "cta"; width: min(460px, 100%); margin-top: 0; }
  .auth-layout .auth-card { min-height: 0; }
  .auth-intro { min-height: 0; }
  .auth-cta { align-items: stretch; flex-direction: column; }
  .auth-cta .button { width: 100%; }
  .site-header { padding: .85rem 4vw; }
  .site-header nav a:not(:last-child) { display: none; }
  #campaign-map { height: 450px; }
  #route-preview-map, .driver-map { height: 360px; }
  .preview-actions { align-items: stretch; flex-direction: column; }
  .preview-actions form, .preview-actions .button { width: 100%; }
  .route-summary { align-items: flex-start; }
  .stop-card { grid-template-columns: auto 1fr; }
  .navigation-link { grid-column: 2; width: 100%; }
}
