:root {
  --page: #f6f8fb;
  --surface: #ffffff;
  --text: #202d3d;
  --muted: #526174;
  --blue: #235dc1;
  --blue-hover: #194b9f;
  --border: #dfe5ed;
  --attention: #966312;
  --attention-bg: #fff8e9;
  --danger: #ad3539;
  --success: #276947;
  --radius: 5px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
a { color: var(--blue); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #779fe4; outline-offset: 3px; }
main:focus { outline: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 26px; line-height: 1.3; font-weight: 650; letter-spacing: -0.35px; }
h2 { margin-bottom: 12px; font-size: 19px; line-height: 1.4; font-weight: 600; }
h3 { margin-bottom: 6px; font-size: 16px; line-height: 1.5; font-weight: 600; }
p { margin-bottom: 12px; }
ul, ol { margin-top: 0; }
strong { font-weight: 600; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0, 0, 0, 0); overflow: hidden; white-space: nowrap; border: 0; }
.skip-link { position: absolute; z-index: 20; left: 16px; top: -80px; padding: 10px 16px; background: var(--surface); border: 2px solid var(--blue); border-radius: var(--radius); }
.skip-link:focus { top: 12px; }
.header-inner, .main-content { width: 100%; max-width: 1480px; margin-inline: auto; }
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { min-height: 68px; display: flex; align-items: center; gap: 38px; padding: 0 32px; }
.brand { flex-shrink: 0; font-size: 18px; font-weight: 650; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-divider { margin: 0 7px; color: #9ba7b6; font-weight: 400; }
.brand-service { font-weight: 400; }
.primary-nav { display: flex; align-self: stretch; gap: 24px; }
.primary-nav a { display: flex; align-items: center; color: var(--muted); border-bottom: 3px solid transparent; padding-top: 3px; }
.primary-nav a:hover { color: var(--blue); text-decoration: none; }
.primary-nav a.is-active { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.account-nav { display: flex; align-items: center; gap: 18px; margin-left: auto; min-width: 0; font-size: 14px; }
.account-nav form { margin: 0; }
.account-link { color: var(--muted); max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-button { border: 0; background: none; padding: 8px 0; color: var(--muted); }
.text-button:hover { color: var(--blue); text-decoration: underline; }
.main-content { padding: 30px 32px 64px; min-width: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.page-heading > div { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-intro { margin-bottom: 0; color: var(--muted); max-width: 75ch; }
.muted, .section-note { color: var(--muted); }
.section-note { font-size: 14px; margin-bottom: 12px; max-width: 85ch; }
.small-note { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.back-link { display: inline-block; font-size: 14px; margin-bottom: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 15px; gap: 8px; border: 1px solid transparent; border-radius: var(--radius); font-size: 14px; font-weight: 600; line-height: 1.5; white-space: nowrap; text-align: center; }
.button:hover { text-decoration: none; }
.button-primary { background: var(--blue); border-color: var(--blue); color: white; }
.button-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.button-secondary { color: var(--text); background: var(--surface); border-color: #cbd4e0; }
.button-secondary:hover { background: #f0f4f9; border-color: #a6b6cb; }
.button-full { width: 100%; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { display: block; width: 100%; min-height: 40px; padding: 8px 10px; color: var(--text); border: 1px solid #c4cedb; border-radius: var(--radius); background: var(--surface); line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #748196; opacity: 1; }
input[type=date], input[type=time] { font-variant-numeric: tabular-nums; min-width: 0; }
select { padding-right: 26px; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); flex-shrink: 0; }
label { display: block; color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field { min-width: 0; }
.field-checkbox { align-self: end; }
.field-checkbox label { display: flex; align-items: center; gap: 9px; margin: 0; min-height: 40px; font-weight: 400; font-size: 14px; cursor: pointer; }
.required-mark { color: var(--muted); font-weight: 400; }
.field-help { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field-help ul { margin: 4px 0 0; padding-left: 20px; }
.field-error { margin-top: 5px; color: var(--danger); font-size: 13px; }
.field-invalid input, .field-invalid select, .field-invalid textarea, input[aria-invalid=true] { border-color: var(--danger) !important; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-bottom: 24px; }
.date-filter { flex: 0 0 auto; }
.date-controls { display: flex; align-items: center; gap: 12px; }
.date-controls input { width: 154px !important; }
.date-shortcuts { display: flex; gap: 10px; font-size: 13px; }
.date-shortcuts a { padding-block: 9px; }
.date-shortcuts a[aria-current=date] { color: var(--text); text-decoration: underline; font-weight: 600; }
.filter-search { flex: 1 1 210px; }
.filter-select { flex: 0 1 170px; }
.filter-bar > .button { flex: 0 0 auto; }
.table-caption { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 18px 0 10px; font-size: 13px; }
.table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.data-table th { background: #f0f3f8; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); padding: 12px 16px; white-space: nowrap; }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.tasks-table { min-width: 1060px; table-layout: fixed; }
.tasks-table th:nth-child(1) { width: 18%; }
.tasks-table th:nth-child(2) { width: 27%; }
.tasks-table th:nth-child(3) { width: 12%; }
.tasks-table th:nth-child(4) { width: 13%; }
.tasks-table th:nth-child(5) { width: 16%; }
.tasks-table th:nth-child(6) { width: 14%; }
.row-link { font-weight: 600; }
.cell-primary { font-weight: 500; }
.cell-secondary { margin-top: 4px; color: var(--muted); font-size: 13px; }
.cell-address + .cell-address { margin-top: 6px; }
.cell-note { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status { display: inline; font-size: 13px; font-weight: 500; }
.status-neutral, .status-pending { color: var(--muted); }
.status-warning, .status-attention, .status-warn { color: var(--attention); }
.status-success, .status-positive { color: var(--success); }
.status-error, .status-danger, .status-negative { color: var(--danger); }
.status-info, .status-primary { color: var(--blue); }
.attention-text { color: var(--attention); }
.inline-status { margin-left: 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; font-size: 13px; }
.pagination > div { display: flex; gap: 8px; }
.empty-state { padding: 44px 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 65ch; margin-bottom: 0; }
.empty-state .button { margin-top: 20px; }
.notice { padding: 14px 18px; margin-bottom: 20px; border: 1px solid var(--border); border-left-width: 3px; border-radius: 3px; background: var(--surface); font-size: 14px; overflow-wrap: anywhere; }
.notice p { margin: 6px 0; }
.notice-title { font-size: 15px; margin-bottom: 4px; }
.notice-warning { background: var(--attention-bg); border-color: #e5d4ad; }
.notice-error { background: #fff5f5; border-color: #d9a5a8; color: #8c272c; }
.notice-success { background: #f3faf5; border-color: #a8cbb5; }
.notice-info { background: #f1f6ff; border-color: #bdcfea; }
.notice ul.errorlist { margin: 0; padding-left: 18px; }
.compact-list { padding-left: 20px; margin: 8px 0 0; }
.compact-list li + li { margin-top: 5px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 36px; }
.detail-main { min-width: 0; }
.stop-list { border-top: 1px solid var(--border); }
.stop-item { display: flex; gap: 16px; border-bottom: 1px solid var(--border); padding: 22px 0; }
.stop-number { width: 29px; height: 29px; display: flex; flex-shrink: 0; justify-content: center; align-items: center; border: 1px solid #bac9dd; border-radius: 50%; color: var(--muted); background: var(--surface); font-size: 13px; font-variant-numeric: tabular-nums; }
.stop-body { min-width: 0; overflow-wrap: anywhere; }
.heading-secondary { margin-left: 8px; font-weight: 400; }
.stop-address { margin-bottom: 14px; }
.stop-comment { margin: 14px 0 0; color: var(--muted); padding-left: 12px; border-left: 2px solid #c9d4e3; }
.inline-details { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 13px; margin: 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 3px 0 0; }
.detail-aside { min-width: 0; }
.aside-section { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.aside-section:last-child { border-bottom: 0; }
.aside-section h2 { font-size: 16px; }
.stack-details { margin: 0; }
.stack-details > div + div { margin-top: 16px; }
.stack-details dd { font-size: 14px; }
.history-list { padding: 0; margin-bottom: 0; list-style: none; font-size: 13px; }
.history-list li + li { margin-top: 16px; }
.history-list strong, .history-list span, .history-list time { display: block; }
.history-list span, .history-list time { color: var(--muted); margin-top: 3px; }
.route-toolbar { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.date-form { display: flex; align-items: end; gap: 16px; }
.calculate-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.plans-table { min-width: 690px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading .section-note { margin: 4px 0 0; }
.vehicle-section { margin-top: 30px; }
.unassigned-section { margin: 26px 0 34px; }
.unassigned-section .table-scroll { border-color: #e5d4ad; }
.unassigned-section .data-table { min-width: 680px; }
.route-stops-table { min-width: 850px; }
.route-stops-table th:nth-child(2) { width: 26%; }
.route-stops-table th:nth-child(3) { width: 29%; }
.route-stops-table th:nth-child(4) { width: 15%; }
.position-column { width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.comment-cell { color: var(--muted); font-size: 13px; }
.table-empty { color: var(--muted); }
.auth-main { max-width: 460px; padding: 64px 24px; }
.auth-box { padding: 30px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; }
.auth-box h1 { font-size: 24px; }
.auth-box .page-intro { margin-top: 8px; margin-bottom: 25px; }
.auth-help { color: var(--muted); font-size: 13px; margin: 22px 0 0; }
.stack-form { display: flex; flex-direction: column; gap: 20px; }
.form-section { background: var(--surface); padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); }
.narrow-section { max-width: 560px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-form { max-width: 1200px; }
.settings-section + .settings-section { margin-top: 34px; }
.settings-row { margin: 0 0 16px; padding: 14px 20px 20px; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.settings-row legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
.settings-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.settings-fields .field-help { font-size: 12px; }
.add-row { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.add-row summary { padding: 12px 20px; cursor: pointer; color: var(--blue); font-size: 14px; font-weight: 500; }
.add-row summary::marker { font-size: 11px; }
.add-row-content { padding: 8px 20px 20px; }
.settings-footer { display: flex; align-items: center; gap: 18px; padding-top: 24px; margin-top: 26px; border-top: 1px solid var(--border); }
.settings-footer .section-note { margin: 0; }

@media (min-width: 1400px) {
  .filter-bar { flex-wrap: nowrap; }
}
@media (max-width: 1000px) {
  .header-inner { gap: 24px; padding-inline: 24px; }
  .primary-nav { gap: 18px; }
  .account-nav { gap: 14px; }
  .account-link { max-width: 110px; }
  .main-content { padding: 26px 24px 48px; }
  .detail-layout { grid-template-columns: minmax(0, 1fr) 245px; gap: 26px; }
  .settings-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 0 18px; padding: 14px 20px 0; min-height: 0; }
  .brand { font-size: 17px; }
  .primary-nav { order: 3; width: 100%; gap: 24px; min-height: 48px; margin-top: 4px; }
  .account-nav { margin-left: auto; }
  .account-link { max-width: 100px; }
  .main-content { padding: 24px 20px 40px; }
  .page-heading { align-items: start; }
  .page-heading h1 { font-size: 24px; }
  .filter-bar { gap: 14px 12px; }
  .date-filter { flex-basis: 100%; }
  .filter-search { flex-basis: 100%; }
  .filter-select { flex: 1 1 140px; }
  .filter-bar > .button { margin-left: auto; }
  .table-caption { align-items: start; }
  .table-caption .muted { text-align: right; }
  .detail-layout { display: flex; flex-direction: column; gap: 28px; }
  .detail-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .aside-section { border-bottom: 0; }
  .route-toolbar { align-items: stretch; }
  .date-form { flex: 1 0 100%; }
  .date-form .date-filter { flex: 0 1 auto; }
  .calculate-form { margin-left: 0; }
  .section-heading { align-items: start; }
  .settings-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-footer { align-items: start; flex-direction: column; gap: 12px; }
  .empty-state { padding: 32px 24px; }
  .auth-main { padding-top: 40px; }
}
@media (max-width: 480px) {
  :root { font-size: 15px; }
  .header-inner { padding-inline: 16px; }
  .brand { font-size: 16px; }
  .brand-divider { margin-inline: 4px; }
  .account-nav { font-size: 13px; gap: 12px; }
  .account-link { max-width: 75px; }
  .primary-nav { gap: 22px; font-size: 14px; }
  .main-content { padding-inline: 16px; }
  .page-heading { gap: 12px; margin-bottom: 20px; }
  .page-heading h1 { font-size: 23px; }
  .page-intro { font-size: 14px; }
  .page-heading > .button { padding-inline: 10px; }
  .date-controls { gap: 10px; }
  .date-shortcuts { gap: 10px; }
  .filter-bar .filter-select { flex: 1 1 calc(50% - 12px); }
  .table-caption { font-size: 12px; }
  .table-caption .muted { max-width: 160px; }
  .notice { padding: 12px 14px; }
  .empty-state { padding: 28px 20px; }
  .detail-aside { grid-template-columns: 1fr; gap: 0; }
  .detail-aside .aside-section { margin-bottom: 12px; }
  .stop-item { gap: 12px; }
  .heading-secondary { display: block; margin-left: 0; margin-top: 3px; }
  .inline-details { display: block; }
  .inline-details > div + div { margin-top: 12px; }
  .date-form { flex-wrap: wrap; gap: 12px; }
  .section-heading { flex-direction: column; gap: 12px; }
  .section-heading .button { width: 100%; }
  .settings-fields { grid-template-columns: 1fr; gap: 16px; }
  .settings-row { padding-inline: 16px; }
  .add-row summary { padding-inline: 16px; }
  .add-row-content { padding-inline: 16px; }
  .auth-main { padding: 34px 16px; }
  .auth-box { padding: 25px 22px; }
  .form-section { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
