/* The Truckers Hub app (/app/). Loaded after /styles.css, which gives the tokens (hitch orange, tar, concrete, light + dark), the
   Archivo font, .btn / .btn-amber / .btn-navy, .card and .note. Brand rule: red/orange + charcoal, NO blue anywhere; yellow and blue
   are never next to each other. Status colours are the road-desk ones of live.css (red, burnt orange, ochre, guide-sign green). */
:root {
  --st-expired: #B3261E; --st-expired-bg: #FBE3E0; --st-expired-text: #7D1A14;
  --st-soon: #C25100; --st-soon-bg: #FFE6D3; --st-soon-text: #7A3300;
  --st-heads: #8A6A00; --st-heads-bg: #F6EDCF; --st-heads-text: #5A4500;
  --st-ok: #0B5A3B; --st-ok-bg: #DDEEE5; --st-ok-text: #0B3A27;
  --st-none: #6E6B65; --st-none-bg: #ECECE8; --st-none-text: #3A3833;
  --tab-h: 68px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --st-expired: #FF8A70; --st-expired-bg: #3D1A14; --st-expired-text: #FFC2B5;
    --st-soon: #FF9A55; --st-soon-bg: #3A2213; --st-soon-text: #FFC9A3;
    --st-heads: #E2C25A; --st-heads-bg: #33290F; --st-heads-text: #F0DC9A;
    --st-ok: #7FD1A6; --st-ok-bg: #12301F; --st-ok-text: #BFE8D3;
    --st-none: #B5B3AC; --st-none-bg: #2F2D29; --st-none-text: #D9D7D0;
  }
}

html { scroll-padding-top: 84px; }
body { font-size: 18px; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }

/* top bar: logo + language switch, the lane-paint dashes under it like the site header */
.app-bar {
  position: sticky; top: 0; z-index: 40; background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
.app-bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--brand) 0 34px, transparent 34px 52px);
}
.app-brand { display: inline-flex; align-items: center; flex: none; }
.app-brand img { display: block; width: auto; height: 26px; }
@media (min-width: 480px) { .app-brand img { height: 34px; } }
.langs { display: flex; gap: 4px; flex: none; }
.lang-btn {
  min-width: 40px; min-height: 44px; padding: 0 6px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
  color: var(--text); background: transparent; border: 2px solid var(--line); border-radius: var(--radius);
}
.lang-btn[aria-pressed="true"] { background: var(--navy); color: var(--navy-text); border-color: var(--navy); }

#alert:empty { display: none; }
.alert-bar {
  position: sticky; top: 56px; z-index: 39; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 12px 16px 0; padding: 12px 16px; border-radius: var(--radius); background: var(--st-expired-bg); color: var(--st-expired-text); border: 2px solid var(--st-expired);
}

#app { display: block; max-width: 720px; margin: 0 auto; padding: 22px 16px 8px; outline: none; }
.view h1 { font-size: clamp(1.6rem, 6vw, 2.2rem); margin: 0 0 .4em; overflow-wrap: anywhere; }
.view h2 { font-size: 1.3rem; margin: 1.6em 0 .5em; overflow-wrap: anywhere; }
.view h3 { font-size: 1.1rem; margin: 0 0 .4em; }
.view h4 { font-size: 1rem; margin: 1em 0 .3em; }
.view .lead { font-size: 1.08rem; color: var(--muted); }
.view .hint { font-size: .95rem; color: var(--muted); }
.view .local { font-size: .95rem; font-weight: 700; padding: 8px 12px; border-left: 4px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.view .bad { color: var(--st-expired-text); background: var(--st-expired-bg); padding: 8px 12px; border-radius: var(--radius); }
.view .bad:empty { display: none; }
.plain-list { margin: 0 0 1em; padding-left: 1.2em; }
.plain-list li { margin-bottom: 6px; }

/* "parked only" strip under the title */
.parked { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--navy); color: var(--navy-text); }
.parked strong { font-weight: 800; }

.note.attn { margin: 14px 0; }
.note.attn ul { margin: 6px 0 10px; padding-left: 1.2em; }

/* the calm step list */
.kit-steps { list-style: none; counter-reset: s; margin: 0 0 8px; padding: 0; }
.kit-steps li { counter-increment: s; position: relative; margin: 0 0 10px; padding: 12px 14px 12px 58px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kit-steps li::before {
  content: counter(s); position: absolute; left: 12px; top: 12px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--brand); color: var(--amber-text); font-weight: 800;
}
.kit-steps strong { display: block; margin-bottom: 2px; }
.kit-steps span { display: block; font-size: .98rem; color: var(--muted); }

.elp-box { margin: 18px 0; padding: 14px 16px; border-radius: var(--radius); background: var(--note-bg); border: 2px solid var(--brand); }
.elp-box h2 { margin: 0 0 .3em; font-size: 1.2rem; }
.elp-box p { margin: 0 0 .8em; }

/* paper checklist */
.papers { list-style: none; margin: 0 0 18px; padding: 0; }
.papers li { display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.papers input { width: 28px; height: 28px; margin: 2px 0 0; accent-color: var(--brand); }
.papers label { font-weight: 700; }
.papers .note-text { grid-column: 2; margin: 4px 0 0; font-size: .95rem; color: var(--muted); }
.src { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.card.may-ask { margin: 8px 0; }

/* phrase cards */
.phrases { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.phrase { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.phrase .who { margin: 0; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.phrase .officer { margin: 2px 0 10px; font-size: 1.2rem; font-weight: 700; }
.phrase .row { display: flex; flex-wrap: wrap; gap: 8px; }
.phrase .answer { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.phrase .say { margin: 0 0 8px; font-size: 1.2rem; font-weight: 800; color: var(--link); }
.phrase .help { margin: 8px 0 0; font-size: .95rem; color: var(--muted); }
.said { background: transparent; color: var(--text); border-color: var(--line); cursor: pointer; font: inherit; font-weight: 700; }
.said[aria-pressed="true"] { background: var(--st-ok-bg); color: var(--st-ok-text); border-color: var(--st-ok); }
button.btn { cursor: pointer; font-family: inherit; }
.sum { font-weight: 700; }

.signs { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.sign { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sign-face { margin: 0 0 8px; padding: 8px 10px; text-align: center; font-weight: 800; letter-spacing: .04em; border: 3px solid var(--text); border-radius: 6px; background: var(--sign-white); color: var(--text-on-sign); }
.sign .help { margin: 8px 0 0; font-size: .95rem; color: var(--muted); }

/* state chips + sheet */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: .98rem; cursor: pointer;
  color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 999px; text-decoration: none;
}
.chip[aria-current="true"], .chip[aria-pressed="true"] { background: var(--navy); color: var(--navy-text); border-color: var(--navy); }
.sheet .agency { margin: 0 0 .5em; }
.sheet .facts { margin: 0 0 1em; padding-left: 1.2em; }
.sheet .facts li { margin-bottom: 10px; }
.sheet .checked { font-weight: 700; margin: 0 0 .5em; }
.sheet .disclaimer { font-size: .92rem; color: var(--muted); padding: 10px 12px; border-left: 4px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.sheet .btn { white-space: normal; }

/* wallet */
.docs { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 14px; }
.paper-doc.card { padding: 16px; }
.doc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.doc-head h2 { margin: 0; font-size: 1.25rem; }
.status { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .95rem; font-weight: 800; border: 1.5px solid var(--st-none); background: var(--st-none-bg); color: var(--st-none-text); }
.status.st-expired { border-color: var(--st-expired); background: var(--st-expired-bg); color: var(--st-expired-text); }
.status.st-soon { border-color: var(--st-soon); background: var(--st-soon-bg); color: var(--st-soon-text); }
.status.st-heads-up { border-color: var(--st-heads); background: var(--st-heads-bg); color: var(--st-heads-text); }
.status.st-ok { border-color: var(--st-ok); background: var(--st-ok-bg); color: var(--st-ok-text); }
.view .field { margin: 0 0 12px; }
.view .field label, .pin-form label { display: block; font-weight: 700; margin-bottom: 4px; }
.view input[type="date"], .view input[type="text"], .view input[type="password"] {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: var(--radius);
}
.view input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.pin-form { display: grid; gap: 10px; max-width: 320px; }
.paper-doc .btn, .card .btn { margin-top: 4px; }
.btn { cursor: pointer; }
.btn.btn-sm:not(.btn-amber):not(.btn-navy) { background: transparent; color: var(--text); border-color: var(--line); }

/* link cards (jobs, more, forum) */
.link-cards { display: grid; gap: 10px; margin: 14px 0; }
.link-card { display: block; padding: 16px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--radius); }
.link-card.primary { border-left-color: var(--brand); }
.link-card strong { display: block; font-size: 1.1rem; }
.link-card span { display: block; color: var(--muted); font-size: .95rem; margin-top: 2px; }
.link-card span:empty { display: none; }
.link-card:hover { background: var(--surface-2); }

/* rest */
.big { margin: 0 0 8px; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.view .card + .card { margin-top: 14px; }
.view .card > h2:first-child, .view .card > h3:first-child { margin-top: 0; }

/* welcome: nothing else on the page competes */
.welcome .lead { color: var(--text); font-size: 1.2rem; }

/* footer + tab bar */
.app-foot { max-width: 720px; margin: 0 auto; padding: 18px 16px 20px; font-size: .9rem; color: var(--muted); }
.app-foot .legal-line { font-weight: 700; color: var(--text); padding: 10px 12px; border-left: 4px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.app-foot .foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0; }
.app-foot a { font-weight: 600; }
.app-foot .owner { margin: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr);
  min-height: var(--tab-h); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; padding: 6px 2px; text-decoration: none;
  color: var(--muted); font-size: .76rem; font-weight: 700; text-align: center;
}
.tab span { max-width: 100%; overflow-wrap: anywhere; line-height: 1.15; }
.tab[aria-current="page"] { color: var(--text); box-shadow: inset 0 4px 0 var(--brand); }
.tab[aria-current="page"] svg { color: var(--link); }

@media (min-width: 900px) {
  body { font-size: 19px; }
  #app { padding-top: 32px; }
  .phrases, .link-cards, .signs { grid-template-columns: 1fr 1fr; }
  .tab { font-size: .9rem; }
  .tabbar { left: 50%; right: auto; width: 720px; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print { .tabbar, .app-bar { display: none; } body { padding-bottom: 0; } }
