:root {
  color-scheme:light;
  --navy:#15355e;
  --ink:#17283d;
  --blue:#285485;
  --muted:#566b83;
  --sky:#c8e1ff;
  --paper:#f1f5fb;
  --white:#fdfdff;
  --line:#d8e4f0;
  --focus:#2b6ac0;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--paper);
  color:var(--ink);
  font-synthesis:none;
}
* { box-sizing:border-box; }
body { margin:0; min-width:280px; }
button,input,select,textarea { font:inherit; }
button,a,input,select,textarea,summary { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { opacity:.46; cursor:default; }
button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline:3px solid var(--focus); outline-offset:3px;
}
h1,h2,h3,p { margin:0; }
p,small { line-height:1.5; }
small { font-size:.84rem; }
a { color:var(--blue); }
[hidden] { display:none !important; }

.top { background:var(--navy); color:white; padding-top:env(safe-area-inset-top); position:sticky; top:0; z-index:5; }
.top-inner { max-width:1240px; min-height:72px; margin:auto; padding:0 32px; display:flex; gap:32px; align-items:center; justify-content:space-between; }
.brand { color:#fff; padding:0; display:flex; align-items:center; gap:10px; background:transparent; border:0; text-align:left; font-size:1.13rem; line-height:1.16; white-space:nowrap; letter-spacing:-.035em; }
.brand img { width:45px; height:45px; margin-left:-7px; }
.brand strong { color:var(--sky); }
.brand small { color:#bdcfe8; display:block; font-size:.57rem; letter-spacing:.15em; margin-top:4px; font-weight:650; }
.nav { display:flex; align-items:center; gap:5px; }
.nav button { display:flex; align-items:center; justify-content:center; gap:8px; border:0; background:transparent; color:#dce8fb; min-height:44px; padding:0 14px; border-radius:9px; font-weight:650; font-size:.9rem; white-space:nowrap; }
.nav i { font-style:normal; font-size:1.1rem; line-height:1; }
.nav button:hover,.nav [aria-current] { background:#2b517d; color:white; }
.local-tag { display:flex; align-items:center; gap:7px; white-space:nowrap; color:#ccdbee; font-size:.76rem; }
.local-tag b { height:7px; width:7px; border-radius:50%; background:var(--sky); }

main { max-width:1180px; margin:0 auto; padding:42px 32px 110px; min-height:85vh; }
main:focus { outline:none; }
.page-head { display:flex; align-items:end; justify-content:space-between; gap:15px; margin-bottom:26px; }
.kicker { color:#486786; font-size:.68rem; font-weight:800; letter-spacing:.15em; display:flex; align-items:center; gap:8px; }
.kicker span { width:15px; height:2px; background:#548ac5; }
h1 { font-size:clamp(2.2rem,4.7vw,3.55rem); line-height:1.05; margin:10px 0 10px; letter-spacing:-.06em; }
.page-head p,.panel-head p,.settings-card p,.muted { color:var(--muted); }
h2 { font-size:1.32rem; letter-spacing:-.035em; }
h3 { font-size:1.05rem; }

.primary,.outline,.waze,.route-tab,.link { display:inline-flex; min-height:46px; align-items:center; justify-content:center; gap:8px; border:1px solid transparent; border-radius:9px; padding:10px 16px; font-weight:700; line-height:1.18; text-align:center; text-decoration:none; }
.primary { background:var(--sky); border-color:#a9cbf5; color:var(--navy); }
.primary:hover:not(:disabled) { background:#b8d7ff; }
.outline { background:var(--white); border-color:#cfdbeb; color:var(--navy); }
.outline:hover:not(:disabled) { background:#eaf3fc; }
.compact { min-height:44px; padding:7px 12px; font-size:.85rem; }
.link { background:none; border:none; color:var(--blue); padding:7px 0; text-align:left; justify-content:flex-start; }
.link:hover { text-decoration:underline; }
.danger { color:#a03036; }
.route-strip { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.route-tab { background:#e7eff9; border-color:#dce8f6; color:var(--blue); }
.route-tab.selected { background:var(--navy); border-color:var(--navy); color:#fff; }
.route-tab span { display:grid; place-items:center; min-width:23px; min-height:22px; border-radius:5px; background:#dce8f6; color:#245489; font-size:.75rem; padding:2px 4px; }
.route-tab.selected span { background:#345c88; color:var(--sky); }
.split { display:grid; grid-template-columns:minmax(0,1.8fr) minmax(265px,1fr); gap:18px; align-items:start; }
.panel { border:1px solid var(--line); border-radius:16px; background:var(--white); box-shadow:0 2px 4px #15355e06; min-width:0; }
.list-panel { padding:19px 22px; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:14px; }
.panel-head p { font-size:.89rem; margin-top:3px; }
.search { margin:3px 0 10px; display:flex; align-items:center; border:1px solid #dce5ef; border-radius:9px; background:#edf3fa; min-height:49px; padding:0 13px; gap:10px; }
.search span { font-size:1.36rem; color:var(--blue); }
.search input { color:var(--ink); flex:1; min-width:0; width:100%; border:0; padding:10px 0; background:transparent; }
.search:focus-within { outline:2px solid var(--focus); outline-offset:1px; }
.search input:focus-visible { outline:none; }

.contact-row,.directory-row { display:flex; gap:9px; align-items:center; padding:7px 0; border-bottom:1px solid #e4ebf4; min-height:62px; }
.contact-row:last-child,.directory-row:last-child { border:0; }
.contact-row { flex-wrap:wrap; }
.select-contact { flex:1; display:flex; gap:12px; align-items:center; min-height:46px; min-width:126px; cursor:pointer; overflow-wrap:anywhere; }
.select-contact input,.check input { width:22px; height:22px; margin:0; flex:none; accent-color:#275992; }
.select-contact span,.directory-copy { display:grid; gap:2px; }
.select-contact small,.directory-copy small,.stop-copy small { color:var(--muted); }
.contact-row.chosen { background:#f2f7fe; margin:0 -9px; padding-left:9px; padding-right:9px; border-radius:9px; }
.badges { display:flex; flex-wrap:wrap; gap:5px; margin-top:4px; }
.badge { background:#ecf2fa; color:#45607b; border-radius:6px; padding:4px 7px; font-size:.71rem; font-weight:700; line-height:1.2; }
.badge.warn { background:#fff0d5; color:#79511a; }
.badge.success { background:#ddeafa; color:#215486; }

.visit-fields,.editor-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.visit-fields { width:100%; padding:2px 0 9px 34px; }
.visit-fields label,.editor-grid label,form>label:not(.check) { display:grid; align-content:start; gap:4px; font-size:.84rem; font-weight:650; min-width:0; }
.visit-fields input,.visit-fields select,.editor-grid input,.editor-grid textarea,form>label:not(.check) input {
  display:block; width:100%; min-width:0; min-height:44px; padding:8px 10px; font-size:16px; color:var(--ink);
  background:#fff; border:1px solid #cbd8e8; border-radius:7px;
}
.span-all { grid-column:1/-1; }
.plan-aside { display:grid; gap:16px; }
.base-card { min-height:243px; background:#1a4575; overflow:hidden; position:relative; border-radius:16px; color:white; padding:22px; isolation:isolate; }
.base-content { position:relative; z-index:1; }
.base-symbol { display:grid; place-items:center; width:38px; height:38px; border-radius:9px; background:var(--sky); color:var(--navy); font-size:1.53rem; margin-bottom:15px; }
.base-card .kicker { color:#c0dcff; }
.base-card h2 { letter-spacing:-.055em; font-size:2.1rem; line-height:.99; margin:8px 0 12px; }
.base-card p { color:#dce9f8; font-size:.88rem; }
.contours { position:absolute; inset:0; z-index:0; pointer-events:none; opacity:.6; }
.contours i { position:absolute; transform:rotate(-28deg); right:-130px; top:-94px; width:378px; height:435px; border:1px solid #668ab0; border-radius:46% 54% 64% 36%; }
.contours i:nth-child(2){right:-116px;top:-73px;width:324px;height:376px;}
.contours i:nth-child(3){right:-104px;top:-52px;width:268px;height:318px;}
.contours i:nth-child(4){right:-92px;top:-31px;width:211px;height:258px;}
.contours i:nth-child(5){right:-79px;top:-13px;width:151px;height:195px;}
.plan-summary { padding:17px 19px; }
.plan-summary .link { margin-right:14px; font-size:.84rem; }
.plan-summary p { color:var(--muted); font-size:.86rem; }
.summary-line { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); font-size:.9rem; }
.action-dock { display:flex; justify-content:space-between; align-items:center; gap:10px; position:sticky; bottom:max(12px,env(safe-area-inset-bottom)); z-index:3; margin-top:18px; padding:11px 14px; border:1px solid #d8e4f0; border-radius:14px; background:#fdfdff; box-shadow:0 10px 33px #173b6522; }
.action-dock div { display:grid; }
.action-dock small { color:var(--muted); }

.route-overview { padding:17px; }
.map-wrap { position:relative; }
.map-switch { margin-bottom:8px; }
.map-switch [aria-pressed="true"] { background:var(--sky); color:var(--navy); }
.google-map { display:block; width:100%; border:0; }
.map { min-width:0; height:clamp(260px,37vw,370px); background:#e6eff8; position:relative; overflow:hidden; border-radius:10px; isolation:isolate; }
.map canvas { display:block; width:100%; height:100%; touch-action:none; cursor:grab; }
.map canvas:active { cursor:grabbing; }
.map-tools { display:grid; gap:4px; position:absolute; top:10px; right:10px; }
.map-tools button { width:44px; height:44px; border-radius:8px; background:#fdfdff; border:1px solid #c8d7e7; color:var(--navy); font-size:1.3rem; }
.map-label,.map-caption,.map-unavailable:not(:empty),.attribution { position:absolute; background:#fffffff0; color:var(--navy); padding:5px 7px; border-radius:5px; font-size:.7rem; }
.map-label { top:10px; left:10px; pointer-events:none; font-weight:700; }
.attribution { bottom:5px; right:6px; }
.map-unavailable:not(:empty) { bottom:5px; left:6px; }
.map-caption { left:10px; top:46px; font-weight:750; }
.route-meta { padding-top:12px; display:grid; gap:3px; }
.route-meta p { color:var(--muted); font-size:.87rem; }
.notice { background:#e9f1f9; padding:13px 16px; border-radius:10px; margin:13px 0; font-size:.89rem; }
.notice.attention { background:#fff0d5; color:#6f4516; }
.notice ul { padding-left:21px; margin:7px 0; }
.notice summary { font-weight:700; }
.section-title { display:flex; justify-content:space-between; align-items:end; flex-wrap:wrap; gap:5px 12px; margin:23px 0 12px; }
.section-title span { color:var(--muted); font-size:.82rem; }
.timeline { display:grid; gap:9px; }
.stop { background:var(--white); border:1px solid var(--line); border-radius:13px; padding:13px; min-width:0; }
.stop.done { background:#eaf2fc; }
.stop.drag-source { opacity:.55; }
.stop.drag-over { outline:3px solid #4a83c8; outline-offset:1px; }
.stop-main { display:grid; grid-template-columns:40px minmax(0,1fr) auto; align-items:start; gap:10px; }
.stop-copy { overflow-wrap:anywhere; }
.stop-copy p { font-size:.9rem; }
.list-number,.initial { width:38px; height:38px; display:grid; place-items:center; border-radius:9px; background:#e1ecf9; color:#1f4d80; font-weight:800; }
.base-stop { border-color:#ccd9e9; }
.base-stop .list-number { background:var(--navy); color:var(--sky); }
.waze { min-width:94px; min-height:50px; color:#183d67; background:#e1efff; border-color:#bfd9f2; }
.waze:hover { background:#d1e9ff; }
.stop-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:6px; }
.check { display:inline-flex; align-items:center; gap:8px; min-height:44px; font-size:.85rem; font-weight:650; cursor:pointer; }
.stop-actions .check { margin-right:8px; }
.drag-handle { touch-action:none; cursor:grab; user-select:none; -webkit-user-select:none; }
.drag-handle:active { cursor:grabbing; }
.arrow,.drag-handle { min-width:44px; font-size:1rem; }
.stop details { margin:4px 0 0; color:var(--muted); font-size:.87rem; }
.stop summary,.notice summary { cursor:pointer; padding:7px 0; }
.stop details p { margin:5px 0; }

.directory-row { display:grid; grid-template-columns:38px minmax(0,1fr) auto; padding:10px 0; }
.directory-copy { overflow-wrap:anywhere; }
.empty { padding:22px 12px; text-align:center; color:var(--muted); }
.empty strong { color:var(--ink); }
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
.settings-card { padding:17px; display:grid; gap:10px; }
.settings-card:last-child { grid-column:1/-1; }
.settings-card form { display:grid; gap:9px; }
.settings-card form .primary { justify-self:start; }
.button-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.file-input { position:relative; cursor:pointer; }
.file-input:focus-within { outline:3px solid var(--focus); }
.file-input input { opacity:0; position:absolute; inset:0; width:100%; cursor:pointer; }
.toast { position:fixed; bottom:max(18px,env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100vw - 30px); background:var(--navy); color:white; padding:12px 16px; border-radius:10px; z-index:7; box-shadow:0 6px 20px #0003; }
dialog { border:1px solid #cedaec; border-radius:16px; background:var(--white); color:var(--ink); padding:17px; width:min(565px,calc(100vw - 24px)); max-height:calc(92dvh - env(safe-area-inset-top)); overscroll-behavior:contain; }
dialog::backdrop { background:#101f3ab4; }
dialog form { display:grid; gap:8px; }
.dialog-head,.dialog-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dialog-footer { justify-content:flex-end; padding-top:8px; }
.dialog-footer .danger { margin-right:auto; }
.location-editor { border-top:1px solid var(--line); padding-top:10px; display:grid; gap:6px; }
.location-editor>p,.location-editor #lookup-results { font-size:.84rem; color:var(--muted); }
.location-editor .candidate { display:flex; margin-top:5px; text-align:left; }
.location-editor .editor-map { height:286px; }
.form-error { color:#95313a; font-size:.87rem; }
@media (max-width:730px) {
  .top-inner { min-height:62px; padding:0 16px; }
  .nav { position:fixed; bottom:0; left:0; right:0; color:white; background:var(--navy); display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; padding:5px 6px calc(5px + env(safe-area-inset-bottom)); box-shadow:0 -2px 8px #16365415; }
  .nav button { display:grid; align-content:center; gap:4px; font-size:.72rem; padding:4px 2px; min-height:48px; }
  main { padding:23px 13px calc(77px + env(safe-area-inset-bottom)); }
  .page-head { align-items:flex-start; flex-wrap:wrap; margin-bottom:17px; }
  .page-head h1 { margin-bottom:7px; }
  .page-head p { font-size:.92rem; }
  .split { display:flex; flex-direction:column; }
  .split>* { width:100%; }
  .plan-aside { order:-1; }
  .base-card { min-height:124px; padding:12px 15px; }
  .base-card h2 { font-size:1.38rem; margin:5px 0; }
  .base-card h2 br { display:none; }
  .base-card h2 br::after { content:' '; }
  .base-card .base-symbol { float:left; margin:7px 11px 60px 0; }
  .base-card p { font-size:.81rem; }
  .plan-summary { padding:10px 13px; }
  .plan-summary h2,.plan-summary .summary-line { display:none; }
  .plan-summary p { font-size:.81rem; }
  .plan-summary .link { min-height:40px; }
  .list-panel { padding:13px; }
  .route-overview .panel-head { flex-wrap:wrap; }
  .visit-fields { padding-left:0; }
  .action-dock { bottom:calc(63px + env(safe-area-inset-bottom)); }
  .action-dock div { font-size:.86rem; }
  .toast { bottom:calc(68px + env(safe-area-inset-bottom)); }
  .settings-grid { grid-template-columns:1fr; }
}
@media (max-width:380px) {
  .stop { padding:9px; }
  .stop-main { grid-template-columns:32px minmax(0,1fr) auto; gap:6px; }
  .stop-main .list-number { width:31px; height:34px; }
  .waze { min-width:75px; padding:8px; }
  .primary,.outline { padding-left:10px; padding-right:10px; }
}
