/* TruckFree Map — highway-sign inspired, high contrast, thumb-friendly. */
:root {
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #ebe8e1; --ink: #14202b; --ink-2: #4a5663; --line: #d6d1c6;
  --brand: #14202b; --accent: #f5b700; --accent-ink: #1b1400; --link: #1d5fa8;
  --free: #1f7a45; --free-bg: #dff3e6; --cond: #1f5aa0; --cond-bg: #dfeafb; --paid: #4b5563; --paid-bg: #e7e8ea;
  --unk: #6b7280; --unk-bg: #f1f1ef; --none: #a11d1d; --none-bg: #fbe3e3; --warn: #9a3412; --warn-bg: #fff1e2;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,32,43,.08), 0 4px 16px rgba(20,32,43,.06);
  --head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151c; --surface: #16212b; --surface-2: #1d2a36; --ink: #e8edf2; --ink-2: #a6b2bf; --line: #2a3a49;
    --brand: #0b1219; --link: #7db4f0;
    --free: #5fd394; --free-bg: #133a26; --cond: #8ab9f5; --cond-bg: #172c47; --paid: #c2c8d0; --paid-bg: #2a333d;
    --unk: #9aa4ae; --unk-bg: #1f2a34; --none: #f59a9a; --none-bg: #3d1b1b; --warn: #fdba74; --warn-bg: #3a2414;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151c; --surface: #16212b; --surface-2: #1d2a36; --ink: #e8edf2; --ink-2: #a6b2bf; --line: #2a3a49;
  --brand: #0b1219; --link: #7db4f0;
  --free: #5fd394; --free-bg: #133a26; --cond: #8ab9f5; --cond-bg: #172c47; --paid: #c2c8d0; --paid-bg: #2a333d;
  --unk: #9aa4ae; --unk-bg: #1f2a34; --none: #f59a9a; --none-bg: #3d1b1b; --warn: #fdba74; --warn-bg: #3a2414; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
h1, h2, h3 { font-family: var(--head); letter-spacing: .01em; line-height: 1.15; margin: 1.2em 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
.small { font-size: .86rem; color: var(--ink-2); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }
.wrap.narrow { max-width: 760px; }
.lead { font-size: 1.1rem; color: var(--ink-2); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--brand); color: #fff; border-bottom: 3px solid var(--accent); }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font: 700 1.35rem var(--head); letter-spacing: .02em; white-space: nowrap; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.topnav a { color: #dfe6ec; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-weight: 500; font-size: .95rem; }
.topnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.navtoggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 1.3rem; border-radius: 8px; width: 44px; height: 40px; }
@media (max-width: 1000px) {
  .navtoggle { display: block; }
  .topnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--brand); flex-direction: column; padding: 8px 16px 16px; border-bottom: 3px solid var(--accent); }
  body.navopen .topnav { display: flex; }
  .topnav a { padding: 12px 8px; font-size: 1.05rem; }
}

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 0; background: var(--accent); color: var(--accent-ink); font: 600 1rem var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.big { min-height: 52px; font-size: 1.1rem; font-family: var(--head); letter-spacing: .03em; text-transform: uppercase; }
.btn.full { width: 100%; }
.linkbtn { background: none; border: 0; padding: 6px 2px; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.iconbtn { min-width: 44px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; font-size: 1.1rem; cursor: pointer; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 1rem var(--body); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
label { font-weight: 600; font-size: .92rem; }
.field { margin-bottom: 10px; position: relative; }
.field > label { display: block; margin-bottom: 4px; }
.inrow { display: flex; gap: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; min-height: 40px; }
.chk input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
.acl { list-style: none; margin: 2px 0 0; padding: 0; position: absolute; z-index: 40; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); display: none; max-height: 260px; overflow: auto; }
.acl.open { display: block; }
.acl li { padding: 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.acl li:last-child { border: 0; }
.acl li:hover, .acl li.act { background: var(--surface-2); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge .basis, .mini .basis { font-style: normal; font-weight: 500; opacity: .8; font-size: .76rem; }
.badge .basis::before { content: "· "; }
.basis.ok { color: var(--free); opacity: 1; }
.st-free, .st-ongoing { background: var(--free-bg); color: var(--free); }
.st-free_conditional, .st-event { background: var(--cond-bg); color: var(--cond); }
.st-paid { background: var(--paid-bg); color: var(--paid); }
.st-unknown { background: var(--unk-bg); color: var(--unk); border-color: var(--line); }
.st-none { background: var(--none-bg); color: var(--none); }
.badge.sponsor { background: var(--accent); color: var(--accent-ink); }
.badge.plain, .mini.plain { background: var(--surface-2); color: var(--ink-2); }
.mini { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.mini.ok { background: var(--free-bg); color: var(--free); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin: 0 2px 0 6px; }
.dot.st-free { background: #1f9d55; } .dot.st-free_conditional { background: #2b6cb0; } .dot.st-paid { background: #6b7280; } .dot.st-unknown { background: #a0a7b0; }

/* planner layout */
body.app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app main { flex: 1; min-height: 0; }
.planner { display: grid; grid-template-columns: minmax(340px, 430px) 1fr; height: 100%; }
.panel { overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 12px 16px 24px; }
.mapwrap { position: relative; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.mapfail { padding: 24px; color: var(--ink-2); }
.ptitle { margin: 4px 0 12px; font-size: 1.6rem; }
.routeform { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.checks { display: flex; flex-wrap: wrap; gap: 0 16px; }
details.truck { margin: 6px 0 12px; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; }
details.truck summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; gap: 6px; }
.err { color: var(--none); font-weight: 600; min-height: 1em; margin: 8px 0 0; }
.filters { padding: 8px 0; border-bottom: 1px solid var(--line); }
.fhead, .rhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fhead h2, .rhead h2 { margin: 8px 0; font-size: 1.25rem; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 500 .92rem var(--body); cursor: pointer; }
.chip.t { font-size: .86rem; min-height: 36px; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.summary { padding: 10px 0; border-bottom: 1px solid var(--line); }
.sumrow { font-size: 1.05rem; }
.warn { background: var(--warn-bg); color: var(--warn); padding: 8px 10px; border-radius: 8px; }
.ok { color: var(--free); }
.notice { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; }
.overnight { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.overnight h2 { margin: 8px 0 2px; }
.night h3 { margin: 12px 0 4px; }
.rlist { list-style: none; margin: 0; padding: 0; }
.ritem { border-bottom: 1px solid var(--line); }
.ritem.sponsored { background: linear-gradient(90deg, rgba(245,183,0,.12), transparent); }
.rbtn { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; background: none; border: 0; padding: 10px 4px; color: inherit; font: inherit; cursor: pointer; }
.rbtn:hover { background: var(--surface-2); }
.rname { font-weight: 600; }
.rmeta { font-size: .86rem; color: var(--ink-2); }
.rmeta.strong { color: var(--ink); }
.minis { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.rlist.compact .rbtn { padding: 8px 4px; }
.hint { padding: 16px 4px; color: var(--ink-2); }
.legend { margin-top: 16px; }
.saved ul.plain { list-style: none; padding: 0; margin: 0; }
.detail { position: absolute; z-index: 5; left: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 14px 16px; border-top: 4px solid var(--accent); }
.detail h3 { margin: 0 32px 2px 0; font-size: 1.3rem; }
.detail .x { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; background: var(--surface-2); color: var(--ink); border-radius: 50%; cursor: pointer; font-size: 1rem; }
.dl { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: .94rem; }
.dirbtns { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.dirbtns .btn { flex: 1; min-width: 90px; }
@media (max-width: 899px) {
  body.app { height: auto; overflow: visible; display: block; }
  .planner { display: flex; flex-direction: column; height: auto; }
  .panel { order: 2; border-right: 0; overflow: visible; }
  .mapwrap { order: 1; height: 42vh; min-height: 260px; position: sticky; top: 59px; z-index: 4; }
  body.app:not(.hasroute) .mapwrap { height: 34vh; }
  .detail { position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 70vh; z-index: 50; }
}

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.mbox { background: var(--surface); border-radius: 12px; padding: 18px 20px; max-width: 460px; border-top: 6px solid var(--accent); }
.mbox h2 { margin-top: 0; }
.mrow { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

/* content pages */
.crumbs { margin-top: 16px; font-size: .9rem; color: var(--ink-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 14px; margin: 14px 0; box-shadow: var(--shadow); }
.card h2 { margin: 14px 0 8px; font-size: 1.3rem; }
.facts { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 8px 14px; margin: 0; }
.facts dt { font-weight: 600; color: var(--ink-2); }
.facts dd { margin: 0; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 8px; } }
.verif { padding: 10px 14px; border-radius: 8px; background: var(--surface-2); border-left: 5px solid var(--unk); }
.verif.v-verified { border-color: var(--free); }
.verif.v-partial { border-color: var(--cond); }
.verif.v-needs_review { border-color: var(--warn); }
.minimap { height: 240px; border-radius: 8px; overflow: hidden; margin: 10px 0 4px; background: var(--surface-2); }
.pre { white-space: pre-line; }
.sources { padding-left: 18px; word-break: break-all; }
.loclist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.loccard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.loccard.sponsored { border-color: var(--accent); }
.loclink { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.lname { font-weight: 600; color: var(--link); font-size: 1.05rem; }
.lmeta { font-size: .88rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.citylist, .statelist { columns: 3 200px; padding-left: 18px; }
.citylist li, .statelist li { padding: 3px 0; break-inside: avoid; }
.explain { background: var(--surface-2); border-radius: 8px; padding: 2px 14px; }
.nearby { padding-left: 18px; }
.nearby li { padding: 4px 0; }
.form label { display: block; margin: 10px 0 0; }
.form label > input, .form label > select, .form label > textarea { margin-top: 4px; font-weight: 400; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 14px 0 0; padding: 4px 12px 12px; }
.form .hp { position: absolute; left: -9999px; }
.form .btn { margin-top: 16px; }
.footer { border-top: 1px solid var(--line); margin-top: 32px; padding: 20px 0; background: var(--surface); }
.footer p { max-width: 900px; }
