:root {
  --ink: #17212b;
  --muted: #64727d;
  --line: #d9e1e5;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --accent: #e55b35;
  --accent-dark: #ba3e20;
  --teal: #167a7d;
  --shadow: 0 18px 45px rgba(23, 33, 43, 0.12);
  font-family: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at top right, #e7f0ed 0, transparent 38%), var(--paper); }
button, input { font: inherit; }
.app-shell { max-width: 1440px; margin: 0 auto; padding: 32px 40px 40px; }
.topbar { position: relative; display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font: 700 0.72rem/1.2 Arial, sans-serif; letter-spacing: 0.14em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 8px; font-size: clamp(2rem, 4vw, 4.4rem); line-height: 0.98; letter-spacing: 0; }
h2 { margin: 0; font-size: 1.55rem; }
.subtitle { max-width: 630px; margin: 0; color: var(--muted); font-size: 1.05rem; }
.control-panel { display: grid; grid-template-columns: minmax(260px, 1fr) 180px 240px; align-items: end; gap: 18px; padding: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
label { display: block; margin-bottom: 8px; color: var(--muted); font: 700 0.75rem/1.2 Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.08em; }
.search-row { display: flex; gap: 10px; }
input[type='search'] { width: 100%; min-width: 0; padding: 12px 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; }
.address-input-wrap { position: relative; flex: 1; min-width: 0; }
.address-input-wrap input[type='search'] { display: block; }
.location-suggestions { position: absolute; z-index: 1000; top: calc(100% + 6px); right: 0; left: 0; display: grid; gap: 2px; max-height: 280px; padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); box-shadow: 0 12px 28px rgba(23, 33, 43, 0.16); }
.location-suggestion { display: grid; gap: 3px; width: 100%; padding: 10px 12px; color: var(--ink); border-radius: 3px; background: transparent; text-align: left; white-space: normal; }
.location-suggestion:hover, .location-suggestion.active, .location-suggestion:focus-visible { background: #edf6f3; outline: none; }
.location-suggestion strong { font-family: Georgia, 'Times New Roman', serif; font-size: 0.95rem; font-weight: 700; }
.location-suggestion span { color: var(--muted); font: 0.72rem/1.2 Arial, sans-serif; }
.search-tabs { display: flex; gap: 18px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.search-tabs .tab-button { padding-bottom: 9px; }
.zone-filters { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 10px; }
.zone-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 178px; margin-top: 10px; overflow-y: auto; }
.zone-option { display: grid; gap: 3px; padding: 9px 10px; color: var(--ink); border: 1px solid var(--line); background: var(--paper); text-align: left; white-space: normal; }
.zone-option:hover, .zone-option:focus-visible { border-color: var(--teal); background: #edf6f3; }
.zone-option strong { overflow: hidden; font-family: Georgia, 'Times New Roman', serif; font-size: 0.92rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.zone-option span { color: var(--muted); font: 0.72rem/1.2 Arial, sans-serif; }
input[type='range'] { width: 100%; accent-color: var(--accent); }
output { float: right; color: var(--accent-dark); font-weight: 700; text-transform: none; letter-spacing: 0; }
button { border: 0; border-radius: 3px; cursor: pointer; font: 700 0.83rem/1 Arial, sans-serif; white-space: nowrap; }
.primary-button { padding: 13px 17px; color: white; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { padding: 12px 15px; color: var(--teal); border: 1px solid var(--teal); background: transparent; }
.status { grid-column: 1 / -1; min-height: 1.1em; margin: 0; color: var(--muted); font: 0.85rem/1.3 Arial, sans-serif; }
.status.error { color: #a52f27; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; min-height: 720px; margin-top: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
#map { min-height: 720px; background: #dce8e5; }
.results-panel { padding: 22px; background: var(--panel); height: 720px; display: flex; flex-direction: column; overflow: hidden; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.count-badge { display: grid; place-items: center; min-width: 30px; height: 30px; color: white; border-radius: 50%; background: var(--teal); font: 700 0.8rem Arial, sans-serif; }
.results-list { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; flex: 1; min-height: 0; overflow-y: auto; }
.result-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.result-item h3 { margin: 0 0 5px; font-size: 1rem; }
.result-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font: 0.77rem/1.3 Arial, sans-serif; }
.empty-state { color: var(--muted); font: 0.9rem/1.4 Arial, sans-serif; }
.hotspot-pin { display: grid; place-items: center; width: 30px; height: 30px; color: white; border: 3px solid white; border-radius: 50% 50% 50% 0; background: var(--accent); box-shadow: 0 2px 6px #0004; transform: rotate(-45deg); }
.hotspot-pin span { transform: rotate(45deg); font: 700 0.75rem Arial, sans-serif; }
.smart-panel { margin-bottom: 12px; padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--paper); flex-shrink: 0; }
.smart-panel .eyebrow { margin-bottom: 4px; }
.smart-panel .status { margin-top: 6px; }
.smart-picks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.smart-pick { display: flex; align-items: start; gap: 10px; padding: 7px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.smart-pick-rank { display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; color: white; border-radius: 50%; background: var(--teal); font: 700 0.75rem Arial, sans-serif; }
.smart-pick-body { min-width: 0; }
.smart-pick-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.smart-pick-heading h3 { margin: 0; font-size: 1rem; }
.smart-pick-meta { margin: 4px 0 0; color: var(--muted); font: 0.8rem/1.3 Arial, sans-serif; }
.smart-pick-reason { margin: 4px 0 0; color: var(--teal); font: italic 0.78rem/1.3 Arial, sans-serif; }
.tier-badge { padding: 2px 8px; border-radius: 10px; color: white; font: 700 0.65rem/1.6 Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.04em; }
.tier-badge.tier-very-high { background: var(--accent-dark); }
.tier-badge.tier-high { background: var(--teal); }
.tier-badge.tier-moderate { background: var(--muted); }
.tier-badge.tier-low { background: var(--line); color: var(--muted); }

.hotspot-pin.tier-very-high { background: var(--accent-dark); }
.hotspot-pin.tier-high { background: var(--teal); }
.hotspot-pin.tier-moderate { background: var(--muted); }
.hotspot-pin.tier-low { background: var(--line); }
.time-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; margin-bottom: 0; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink); }
.checkbox-label input { accent-color: var(--accent); }
.time-picker-selects { display: flex; gap: 8px; }
select, input[type="date"] { padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; }
select:disabled, input[type="date"]:disabled { color: var(--muted); background: var(--paper); }

@media (max-width: 900px) {
  .app-shell { padding: 24px 18px; }
  .topbar, .workspace { grid-template-columns: 1fr; }
  .topbar { align-items: start; flex-direction: column; }
  .control-panel { grid-template-columns: 1fr; }
  .status { grid-column: auto; }
  .workspace { display: flex; flex-direction: column; }
  #map { min-height: 420px; }
  .results-panel { min-height: 280px; height: auto; overflow: visible; }
  .results-list { flex: none; overflow-y: visible; }
  .search-row { flex-wrap: wrap; }
  .search-row button { flex: 1 1 100%; }
  #locate-button { width: 100%; }
  .time-picker-selects { flex-direction: column; width: 100%; }
  .time-picker-selects select, .time-picker-selects input[type="date"] { width: 100%; }
  .zone-filters, .zone-list { grid-template-columns: 1fr; }
  .zone-list { max-height: 220px; }
}

.topbar-actions { position: absolute; top: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; }
.location-action { position: absolute; right: 0; bottom: 0; }
.admin-login-button { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 38px; padding: 8px; }
.profile-verified-icon { display: block; flex: 0 0 28px; width: 28px; height: 28px; overflow: visible; }
.profile-icon-background { fill: currentColor; }
.profile-icon-cutout { fill: var(--panel); }
.admin-session-actions { display: flex; align-items: center; gap: 10px; }
.admin-label { color: var(--muted); font: 700 0.75rem/1 Arial, sans-serif; text-transform: uppercase; letter-spacing: 0.08em; }
.admin-auth-shell { display: grid; align-content: start; gap: 24px; width: min(100% - 36px, 520px); min-height: 100vh; margin: 0 auto; padding: 30px 0; }
.admin-auth-back { color: var(--teal); font: 600 0.86rem/1.4 Arial, sans-serif; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.admin-auth-panel { padding: 32px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.admin-auth-panel h1 { margin: 0 0 10px; font-size: 2.5rem; }
.admin-auth-panel .subtitle { margin-bottom: 24px; font-size: 0.98rem; }
.admin-auth-form { display: grid; gap: 10px; }
.admin-auth-form label { margin: 8px 0 0; }
.admin-auth-form input { width: 100%; min-width: 0; padding: 12px 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; }
.admin-auth-form button { margin-top: 12px; }
.admin-cognito-button { width: 100%; }
.admin-auth-panel .status { margin-top: 14px; }
.admin-dashboard { min-height: 520px; padding: 28px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.admin-dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.admin-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.admin-summary div { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.admin-summary dt { margin-bottom: 8px; color: var(--muted); font: 700 0.72rem/1.2 var(--ui-font); text-transform: uppercase; letter-spacing: 0.08em; }
.admin-summary dd { margin: 0; overflow: hidden; font: 600 1.5rem/1.2 var(--display-font); text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.admin-card { min-width: 0; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.admin-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.admin-card h4 { margin: 20px 0 8px; color: var(--ink); font: 600 0.9rem/1.2 var(--ui-font); }
.admin-card .status { margin-top: 10px; }
.admin-issues { display: grid; gap: 10px; margin: 10px 0 0; padding: 12px 14px; border: 1px solid; border-radius: 4px; font: 0.84rem/1.45 var(--ui-font); }
.admin-issues.error { color: #6e1f19; border-color: #efc4bf; background: #fdf1f0; }
.admin-issues.warning { color: #6b4300; border-color: #f0d9a8; background: #fff7e6; }
.admin-issues-summary { margin: 0; font-weight: 700; }
.admin-issue { display: grid; gap: 4px; }
.admin-issue + .admin-issue, .admin-issues-summary + .admin-issue { padding-top: 10px; border-top: 1px solid rgba(23, 33, 43, 0.1); }
.admin-issue h5 { margin: 0; font: 700 0.86rem/1.35 var(--ui-font); }
.admin-issue p { margin: 0; }
.admin-issue-lines { display: grid; gap: 3px; margin: 2px 0; padding: 0; list-style: none; }
.admin-issue-lines li { display: flex; align-items: baseline; gap: 10px; }
.admin-issue-line { min-width: 58px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.admin-issue-lines code { padding: 1px 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.75); font-size: 0.8rem; }
.admin-issue-more { opacity: 0.75; }
.admin-card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.admin-card-heading h3 { margin: 0; }
.admin-hint { margin: 0 0 14px; color: var(--muted); font: 0.85rem/1.45 var(--ui-font); }
.admin-hint code { padding: 1px 4px; border-radius: 3px; background: var(--paper); font-size: 0.8rem; }
.admin-import-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-import-form input[type='file'] { flex: 1; min-width: 0; padding: 8px; border: 1px dashed var(--line); border-radius: 3px; background: #fbfcfb; font: 0.85rem var(--ui-font); }
.admin-create-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; }
.admin-field { min-width: 0; }
.admin-field-wide { grid-column: 1 / -1; }
.admin-field label { margin-bottom: 6px; color: var(--ink); font: 600 0.82rem/1.2 var(--ui-font); text-transform: none; letter-spacing: 0; }
.admin-field select, .admin-field input { width: 100%; height: 42px; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; font: 0.9rem var(--ui-font); }
.admin-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-filters select { max-width: 260px; font-size: 0.85rem; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font: 0.85rem/1.35 var(--ui-font); }
.admin-table th { padding: 8px 10px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; text-align: left; white-space: nowrap; }
.admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table td strong { display: block; font-weight: 600; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Score bar colours match the demand tiers on the driver map pins. */
.admin-score { display: flex; align-items: center; gap: 10px; }
.admin-score-bar { flex: 0 0 110px; height: 8px; overflow: hidden; border-radius: 4px; background: #e8edeb; }
.admin-score-bar span { display: block; height: 100%; border-radius: 4px; }
.admin-score-value { min-width: 46px; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.admin-tier { display: inline-block; min-width: 76px; padding: 3px 8px; border-radius: 10px; font: 600 0.72rem/1.3 var(--ui-font); text-align: center; white-space: nowrap; }
.admin-tier.tier-very-high { color: var(--accent-dark); background: #fbebe6; }
.admin-tier.tier-high { color: var(--teal); background: #e3f1f0; }
.admin-tier.tier-moderate { color: #4f5c66; background: #eceff1; }
.admin-tier.tier-low { color: #7b8890; background: #f3f5f6; }
.admin-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 10px; color: var(--muted); font: 0.78rem/1.3 var(--ui-font); }
.admin-legend span { display: inline-flex; align-items: center; gap: 6px; }
.admin-legend i { width: 10px; height: 10px; border-radius: 2px; }
.admin-score-bar .tier-very-high, .admin-legend .tier-very-high { background: var(--accent-dark); }
.admin-score-bar .tier-high, .admin-legend .tier-high { background: var(--teal); }
.admin-score-bar .tier-moderate, .admin-legend .tier-moderate { background: var(--muted); }
.admin-score-bar .tier-low, .admin-legend .tier-low { background: #b6c2c8; }
.admin-table .empty-state { padding: 18px 10px; text-align: center; }
.admin-subtle { color: var(--muted); font-size: 0.78rem; }
.admin-filename { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-filename-button { display: block; max-width: 100%; overflow: hidden; padding: 0; text-align: left; text-overflow: ellipsis; }
.admin-upload-filter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 12px; padding: 9px 12px; color: var(--ink); border: 1px solid #cfe5e0; border-radius: 4px; background: #edf6f3; font: 0.85rem/1.4 var(--ui-font); }
.admin-row-actions { text-align: right; white-space: nowrap; }
.admin-link-button { padding: 6px 8px; color: var(--teal); background: transparent; font: 600 0.8rem var(--ui-font); }
.admin-link-button:hover { text-decoration: underline; }
.admin-link-button.danger { color: #a52f27; }
.admin-zone-card { margin-top: 18px; }
.admin-zone-card td .admin-subtle, .admin-zone-comment { display: block; }
.admin-zone-comment { color: var(--muted); font-style: italic; font-size: 0.8rem; }
.zone-badge { display: inline-block; padding: 3px 9px; border-radius: 10px; font: 600 0.72rem/1.3 var(--ui-font); white-space: nowrap; }
.zone-badge.zone-active { color: #2e7d32; background: #e6f4e6; }
.zone-badge.zone-inactive { color: #8a5a00; background: #fff1d6; }
.zone-badge.zone-deleted { color: #a52f27; background: #fbe9e7; }
.admin-row-unavailable td { background: #fafbfa; }
.admin-row-unavailable .admin-pickups, .admin-row-unavailable .admin-score { opacity: 0.55; }
.zone-status-dialog { width: min(100%, 460px); }
.zone-status-dialog h2 { margin-bottom: 0; }
.zone-status-dialog .admin-hint { margin: 0 0 4px; }
.zone-status-dialog .admin-field label { margin-bottom: 6px; }
.zone-status-dialog textarea { width: 100%; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; font: 0.9rem/1.4 var(--ui-font); resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.primary-button.danger { background: #a52f27; }
.primary-button.danger:hover { background: #82241e; }
.admin-inline-input { width: 100px; padding: 6px 8px; border: 1px solid var(--teal); border-radius: 3px; font: 0.85rem var(--ui-font); text-align: right; }
.admin-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: var(--muted); font: 0.82rem var(--ui-font); }
.admin-pager div { display: flex; gap: 8px; }
.admin-pager button { padding: 8px 12px; }
button:disabled { cursor: default; opacity: 0.45; }
.admin-login-modal { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(20, 42, 53, 0.45); }
.admin-login-dialog { position: relative; display: grid; width: min(100%, 390px); gap: 10px; padding: 30px; background: var(--panel); box-shadow: var(--shadow); }
.admin-login-dialog h2 { margin-bottom: 10px; }
.admin-login-dialog label { margin-bottom: 0; }
.admin-login-dialog input { width: 100%; padding: 12px 14px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; background: #fbfcfb; }
.dialog-close { position: absolute; top: 14px; right: 14px; padding: 4px 8px; color: var(--muted); background: transparent; font-size: 1.4rem; line-height: 1; }
.dialog-close:hover { color: var(--ink); }
.login-error { min-height: 1.1em; margin: 4px 0; color: #a52f27; font: 0.82rem/1.3 var(--ui-font); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tab-button { padding: 0 0 8px; color: var(--muted); border-bottom: 2px solid transparent; background: transparent; }
.tab-button.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

@media (max-width: 900px) {
  .location-action { position: static; margin-top: 14px; }
  .topbar-actions { position: static; width: 100%; justify-content: stretch; }
  .topbar-actions button { flex: 1; }
  .admin-dashboard { padding: 18px; }
  .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
  .admin-create-form button { grid-column: 1 / -1; }
  .admin-filters, .admin-filters select { width: 100%; max-width: none; }
}

@media (max-width: 540px) {
  .admin-auth-shell { width: min(100% - 28px, 520px); padding-top: 20px; }
  .admin-auth-panel { padding: 24px 20px; }
  .admin-auth-panel h1 { font-size: 2rem; }
}

:root { --display-font: 'Space Grotesk', Georgia, serif; --ui-font: 'DM Sans', Arial, sans-serif; --deep: #142a35; --mint: #d8eee7; }
body { background-color: #f1f5f2; background-image: linear-gradient(rgba(20, 42, 53, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(20, 42, 53, 0.035) 1px, transparent 1px); background-size: 34px 34px; }
button, input, select, label, .status { font-family: var(--ui-font); }
h1, h2, h3 { font-family: var(--display-font); }
.tab-button { font-weight: 600; }
