:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --line: #dde3ee;
  --primary: #0b5cab;
  --primary-dark: #084f94;
  --danger: #b42318;
  --success: #087443;
  --warning: #b54708;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 24px; background: #111827; color: white; }
.brand { color: white; font-weight: 700; font-size: 20px; }
.version { margin-left: 8px; color: #cbd5e1; font-size: 13px; }
.userbox { color: #e5e7eb; font-size: 14px; }
.userbox a { color: white; margin-left: 12px; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 20px; background: white; border-bottom: 1px solid var(--line); }
.nav a { padding: 8px 11px; border-radius: 8px; color: #1f2937; }
.nav a:hover { background: #eef4ff; text-decoration: none; }
.container { max-width: 1450px; margin: 0 auto; padding: 24px; }
.container.narrow { max-width: 620px; }
h1 { margin-top: 0; }
h2 { margin: 0 0 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.05); margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col, .two-col-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stat { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.stat span { color: var(--muted); display: block; }
.stat strong { font-size: 34px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dispatch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.inline-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.mini-form { display: inline-block; margin: 0; }
.remove-form { margin-right: 8px; margin-bottom: 8px; }
label { display: grid; gap: 6px; font-weight: 600; color: #344054; }
label.check { display: flex; gap: 8px; align-items: center; }
input, select, textarea { width: 100%; border: 1px solid #cfd8e3; border-radius: 9px; padding: 10px 11px; font: inherit; background: white; }
textarea { min-height: 90px; resize: vertical; }
input.small { max-width: 64px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--primary); color: white; padding: 10px 14px; border-radius: 9px; cursor: pointer; font-weight: 700; font: inherit; }
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
button.secondary, .button.secondary { background: #eef4ff; color: var(--primary); }
button.secondary:hover, .button.secondary:hover { background: #dbeafe; }
button.danger { background: var(--danger); }
.actions, .filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { background: #f8fafc; color: #344054; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: 0; }
small { color: var(--muted); }
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.pill { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: #eaecf0; color: #344054; }
.pill.requested { background: #fffaeb; color: #b54708; }
.pill.planned { background: #eff8ff; color: #175cd3; }
.pill.in_progress { background: #eef4ff; color: #3538cd; }
.pill.completed { background: #ecfdf3; color: #067647; }
.pill.cancelled { background: #fef3f2; color: #b42318; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
dt { font-weight: 700; color: #344054; }
dd { margin: 0; }
.route-day-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.route-card h3 { margin-top: 0; }
.stops { padding-left: 22px; }
.stops li { margin-bottom: 12px; }
.footer { color: var(--muted); text-align: center; padding: 30px; }
@media (max-width: 900px) {
  .cards-4, .two-col, .two-col-view, .form-grid.two-col, .dispatch-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .container { padding: 16px; }
}
.address-autocomplete { position: relative; display: grid; gap: 6px; }
.address-suggestions {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 18px 34px rgba(16,24,40,.24);
}
.address-suggestions:empty { display: none; }
.address-suggestion {
  appearance: none;
  -webkit-appearance: none;
  display: block !important;
  width: 100% !important;
  min-height: 0;
  text-align: left;
  border: 0 !important;
  border-bottom: 1px solid #e4e7ec !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  color: #18202b !important;
  padding: 12px 14px !important;
  font-weight: 400 !important;
  line-height: 1.25;
  cursor: pointer;
}
.address-suggestion:last-child { border-bottom: 0 !important; }
.address-suggestion:hover,
.address-suggestion:focus {
  background: #eef4ff !important;
  color: #18202b !important;
  outline: 3px solid rgba(11,92,171,.18);
  outline-offset: -3px;
}
.address-suggestion-name {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 3px;
}
.address-suggestion-address {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #344054;
  white-space: normal;
}
.address-suggestion-empty {
  padding: 12px 14px;
  background: #ffffff;
  color: #344054;
  font-weight: 600;
}
