[hidden] { display: none !important; }
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1f2328;
  --ink-2: #4a4f57;
  --muted: #5e636b;
  --line: #dcd9d1;
  --line-2: #ebe8e1;
  --accent: #1f4e79;
  --accent-tint: #e7eef5;
  --full: #1d6b4f;
  --most: #9a5b00;
  --part: #7c4a8c;
  --off: #9aa0a6;
  --warn-bg: #fdf3e2;
  --warn-ink: #6b3e00;
  --ok-bg: #e9f3ee;
  --ok-ink: #17543d;
  --radius: 8px;
  --font: 'Public Sans', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-top: 18px; padding-bottom: 16px; }
.eyebrow { margin: 0 0 2px; font-size: 13px; color: var(--muted); font-weight: 500; }
.topbar-note { margin: 0; max-width: 420px; font-size: 13px; color: var(--muted); text-align: right; }

main { padding-top: 20px; padding-bottom: 40px; display: grid; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.search-grid { display: grid; grid-template-columns: 1fr 220px auto; gap: 12px; align-items: end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=number], input[type=email], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #b9b5ab; border-radius: 6px; padding: 9px 11px; width: 100%; min-height: 42px;
}
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { font: inherit; font-size: 14px; font-weight: 600; color: var(--accent); background: #fff; border: 1px solid #a9b9c9; border-radius: 6px; padding: 9px 14px; min-height: 42px; cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--accent-tint); }
.btn:disabled { color: #767b82; border-color: var(--line); cursor: not-allowed; background: #f3f2ee; }
.btn-primary { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); padding: 9px 22px; }
.btn-primary:hover:not(:disabled) { background: #d6e3ef; }
.btn-link { border: 0; background: none; padding: 4px 2px; min-height: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.btn-link:hover { background: none !important; color: #143a5c; }
.btn-small { min-height: 34px; padding: 5px 10px; font-size: 13px; }

.presets { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 12px; font-size: 14px; }
.presets-label { color: var(--muted); }
.status { margin-top: 10px; font-size: 14px; color: var(--ink-2); min-height: 0; }
.status:empty { display: none; }
.status.is-error { color: #8a1f1f; background: #fbeaea; border: 1px solid #efc9c9; border-radius: 6px; padding: 8px 10px; }
.status .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status .spin { animation: none; } }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.map-card { padding: 0; overflow: hidden; }
#map { height: 640px; background: #e8e6e0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px 0; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.sw-area { height: 12px; background: rgba(31,78,121,0.12); border: 1.5px solid var(--accent); }
.sw-full { background: var(--full); }
.sw-most { background: var(--most); }
.sw-part { background: var(--part); }
.sw-off { background: repeating-linear-gradient(90deg, var(--off) 0 4px, transparent 4px 7px); }
.hint { margin: 4px 14px 12px; font-size: 13px; color: var(--muted); }
.side-col { display: grid; gap: 20px; }

.seg { display: inline-flex; border: 1px solid #a9b9c9; border-radius: 6px; overflow: hidden; }
.seg-btn { font: inherit; font-size: 13px; font-weight: 500; background: #fff; color: var(--ink-2); border: 0; padding: 6px 10px; cursor: pointer; min-height: 34px; }
.seg-btn + .seg-btn { border-left: 1px solid #a9b9c9; }
.seg-btn.is-on { background: var(--accent-tint); color: var(--accent); font-weight: 600; }

.scenarios { display: grid; gap: 10px; }
.scen { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; }
.scen.is-current { border-color: var(--accent); background: #f7fafc; }
.scen-title { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.scen-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.scen-nums b { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.scen-nums span { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 0; }
td.empty { padding: 14px 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.quick-label { font-size: 13px; color: var(--muted); margin-right: 2px; }

.plan-inputs { display: grid; grid-template-columns: 110px 1fr; gap: 14px; }
.range-row { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.range-row output { font-weight: 600; min-width: 48px; text-align: right; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; border: 1px solid; width: fit-content; }
.tag-est { color: var(--warn-ink); background: var(--warn-bg); border-color: #ecd3a6; }
.tag-prop { color: var(--accent); background: var(--accent-tint); border-color: #bfd0e1; }
.tag-conf { color: var(--ok-ink); background: var(--ok-bg); border-color: #bcdac9; }
.schedule { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cost-table td { padding: 7px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.cost-table td.num { text-align: right; white-space: nowrap; padding-left: 10px; font-weight: 500; }
.cost-table .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.cost-table .tag { margin-left: 6px; vertical-align: 1px; }
.cost-table tr.total td { font-weight: 700; font-size: 16px; border-bottom: 2px solid var(--ink); border-top: 1px solid var(--ink); }
.cost-table tr.per td { color: var(--ink-2); }
.check-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.rules { display: grid; gap: 6px; margin-top: 12px; }
.rule { font-size: 13px; padding: 7px 10px; border-radius: 6px; border: 1px solid; }
.rule.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: #bcdac9; }
.rule.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: #ecd3a6; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.copy-fallback { margin-top: 10px; display: grid; gap: 4px; font-size: 13px; }
.copy-fallback textarea { font-size: 12px; min-height: 140px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.routes { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.routes th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: #fff; }
.routes td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.routes tr.row { cursor: pointer; }
.routes tr.row:hover td, .routes tr.row.is-hover td { background: #f4f7fa; }
.routes tr.row.is-off td { color: #6b7077; }
.num { text-align: right; }
.c-check { width: 36px; }
.c-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.badge::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge.full { color: var(--full); }
.badge.most { color: var(--most); }
.badge.part { color: var(--part); }
.badge.nogeo { color: #6b7077; }
.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.groups .card > h2 { margin-bottom: 2px; }
.groups .small { margin: 0 0 10px; }
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.mini .flag { display: block; font-size: 12px; color: var(--warn-ink); font-weight: 600; }
.mini tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--ink); }
.caveat ul { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.caveat .small { margin: 0; }

.leaflet-container { font: 13px/1.4 var(--font); }
.route-tip b { font-weight: 600; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  #map { height: 480px; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
  .topbar-note { text-align: left; }
  .search-grid { grid-template-columns: 1fr; }
  .groups { grid-template-columns: 1fr; }
  #map { height: 380px; }
  .card { padding: 14px; }
  .plan-inputs { grid-template-columns: 1fr; }
  .scen-nums b { font-size: 18px; }
  .btn-primary { width: 100%; }
}

#retry { margin-top: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fixed-area { margin: 0; min-height: 42px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #f3f2ee; font-weight: 600; color: var(--ink); }
@media (min-width: 1081px) {
  .map-col { position: sticky; top: 16px; }
}
#routes-table { border-collapse: separate; border-spacing: 0; }
.card > .table-wrap:has(#routes-table) { max-height: 620px; overflow-y: auto; }

/* Filters */
.filter-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-intro { margin: -4px 0 12px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1.3fr 1.1fr; gap: 16px; }
.fgroup { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px 12px; margin: 0; min-width: 0; }
.fgroup legend { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.fsum { font-weight: 500; color: var(--muted); margin-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #a9b9c9; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; background: #fff; min-height: 36px; }
.chip:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.chip-meta { font-size: 12px; color: var(--muted); font-weight: 400; }
.fnote { margin: 8px 0 0; }
.optlist { max-height: 176px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 6px; }
.opt { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; font-size: 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.opt:last-child { border-bottom: 0; }
.opt:hover { background: #f4f7fa; }
.opt input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.opt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fgroup-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.fgroup-foot .btn-link { font-size: 13px; }
.filter-note { margin: 0; font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid #ecd3a6; border-radius: 6px; padding: 7px 10px; }
@media (max-width: 1080px) { .filter-grid { grid-template-columns: 1fr; } }
main.wrap { padding-top: 20px; padding-bottom: 40px; }

/* Fixed printing + quote */
.fixed-rate { margin: 0; min-height: 42px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #f3f2ee; font-weight: 600; width: fit-content; min-width: 90px; }
.print-note { margin: 10px 0 0; font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid #ecd3a6; border-radius: 6px; padding: 7px 10px; }
.quote-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); display: grid; gap: 10px; }
.quote-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.quote-check { margin-top: 0; }
.quote-email input { max-width: 340px; }
.quote-msg { font-size: 13px; color: var(--ink-2); }
.quote-msg:empty { display: none; }
.quote-msg a { font-weight: 600; }

.quote-err { color: #8a1f1f; font-weight: 600; }

/* Views */
.view { display: grid; gap: 20px; min-width: 0; }
.viewnav { display: flex; gap: 4px; flex-wrap: wrap; }
.viewlink { font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 7px 12px; border: 1px solid transparent; border-radius: 6px; }
.viewlink:hover { background: var(--accent-tint); }
.viewlink[aria-current="page"] { border-color: var(--accent); background: var(--accent-tint); }

/* Quick plan */
.qcard > h2 { margin-bottom: 4px; }
.q-intro { margin: 0 0 14px; font-size: 14px; }
.q-form { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: 12px; align-items: end; }
.money-input { display: flex; align-items: center; border: 1px solid #b9b5ab; border-radius: 6px; background: #fff; min-height: 42px; padding-left: 11px; }
.money-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.money-input span { color: var(--muted); font-weight: 600; }
.money-input input { border: 0; outline: none; padding-left: 6px; min-height: 40px; }
.money-input input:focus-visible { outline: none; }
.q-fixed { margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.q-mail-ctrl { display: flex; gap: 8px; flex-wrap: wrap; }
.q-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.q-stat { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.q-stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.q-stat span { font-size: 12px; color: var(--muted); }
.q-stat.is-key { border-color: var(--accent); background: #f7fafc; }
.q-note { margin: 10px 0 0; }
.q-full-link { margin: 12px 0 0; font-weight: 600; }
.q-warn { margin-bottom: 12px; }
.q-table-wrap { max-height: 520px; overflow-y: auto; }
.q-routes th { position: sticky; top: 0; background: #fff; }
.q-routes td { white-space: nowrap; }
@media (max-width: 1080px) { .q-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .q-form { grid-template-columns: 1fr; }
  .q-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-stat b { font-size: 19px; }
  .viewnav { width: 100%; }
}
.q-routes .sm-only { display: none; }
@media (max-width: 560px) {
  .q-routes .hide-sm { display: none; }
  .q-routes .sm-only { display: block; font-size: 12px; }
  .q-routes th, .q-routes td { padding-left: 5px; padding-right: 5px; }
  .q-routes td:nth-child(2) { white-space: normal; }
  .q-routes th:nth-child(4) { white-space: normal; }
  .q-table-wrap { max-height: none; }
}
.q-raised { margin: 0 0 10px; font-weight: 600; }

/* Staged public copy: brand type and colors */
:root { --accent: #1f3f66; --accent-tint: #e2e9f2; --bg: #f7f6f2; }
h1, h2 { font-family: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif; }
h1 { font-size: 26px; }
h2 { font-size: 18px; font-weight: 700; }
.brand-link { font-family: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif; font-weight: 700; font-size: 15px; color: var(--accent); text-decoration: none; }
.brand-link:hover { text-decoration: underline; }
.cost-table tr.subtotal td { border-top: 1px solid var(--line); font-weight: 600; }
