/* Driver Log, phone app.
   Look: interstate guide sign green, reflector amber for the main action,
   DOT conspicuity tape as the one decorative mark, odometer digits for mileage. */

@font-face { font-family: "Overpass"; src: url("/static/fonts/overpass-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Overpass"; src: url("/static/fonts/overpass-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Overpass"; src: url("/static/fonts/overpass-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Overpass Mono"; src: url("/static/fonts/overpass-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --green: #00653A;
  --green-deep: #004A2B;
  --green-wash: #E3EFE8;
  --paper: #F5F7F5;
  --card: #FFFFFF;
  --ink: #142019;
  --asphalt: #56625B;
  --line: #CFD8D2;
  --amber: #F2A900;
  --amber-deep: #C98C00;
  --red: #C8102E;
  --red-wash: #FBE7EA;
  --odo: #131A16;
  --radius: 12px;
  --tape: repeating-linear-gradient(90deg, var(--red) 0 22px, #fff 22px 44px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.45 "Overpass", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.hidden { display: none !important; }
.noscript { padding: 24px; }

/* ---------- boot */
.boot { min-height: 100dvh; display: grid; place-items: center; background: var(--green); }

/* ---------- the guide sign motif */
.sign {
  background: var(--green); color: #fff; border-radius: 10px; padding: 4px;
  display: inline-block;
}
.sign > span, .sign > div {
  display: block; border: 2px solid #fff; border-radius: 7px; padding: 4px 12px 2px;
  font-weight: 800; letter-spacing: .01em;
}
.sign-sm > span { font-size: 20px; }

/* ---------- top bar */
.top {
  background: var(--green); color: #fff;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 5;
}
.top .sign { padding: 0; }
.top .sign > span { font-size: 22px; padding: 3px 12px 0; }
.top .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44vw; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.55);
  background: transparent; color: #fff; display: grid; place-items: center; flex: none;
}
.iconbtn svg { width: 22px; height: 22px; }
.lang {
  height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.55);
  background: transparent; color: #fff; font-weight: 800; font-size: 15px;
}

/* ---------- offline / queue strip */
.strip {
  background: var(--amber); color: var(--ink); padding: 10px 16px; font-weight: 600; font-size: 15px;
  display: flex; gap: 10px; align-items: center;
}
.strip svg { width: 20px; height: 20px; flex: none; }

/* ---------- page */
.page { padding: 18px 16px calc(120px + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.page h1 { font-size: 28px; line-height: 1.1; font-weight: 800; margin: 6px 0 4px; letter-spacing: -.01em; }
.page .lead { color: var(--asphalt); margin: 0 0 18px; }

/* ---------- status board on home */
.status {
  background: var(--green); color: #fff; border-radius: 14px; padding: 6px; margin-bottom: 18px;
}
.status-in {
  border: 2px solid #fff; border-radius: 10px; padding: 16px 16px 0; overflow: hidden;
}
.status .state { font-size: 15px; font-weight: 600; opacity: .9; margin: 0; }
.status .big { font-size: 34px; font-weight: 800; line-height: 1.05; margin: 2px 0 12px; }
.status dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; margin: 0 0 16px; }
.status dt { font-size: 13px; opacity: .8; }
.status dd { margin: 0; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape { height: 12px; margin: 0 -16px; background: var(--tape); }

.idle-note { color: var(--asphalt); text-align: center; margin: 10px 0 0; font-size: 15px; }

/* ---------- buttons */
.btn {
  display: flex; width: 100%; min-height: 64px; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--radius); border: 0; font-weight: 800; font-size: 20px; padding: 12px 18px;
  text-decoration: none;
}
.btn svg { width: 26px; height: 26px; }
.btn-go { background: var(--amber); color: var(--ink); box-shadow: inset 0 -4px 0 var(--amber-deep); }
.btn-go:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--amber-deep); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-line { background: transparent; border: 2px solid var(--line); color: var(--ink); min-height: 54px; font-size: 17px; }
.btn[disabled] { opacity: .55; }
.btn + .btn { margin-top: 10px; }

.linkbtn { background: none; border: 0; color: var(--green); font-weight: 600; padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms */
.field { margin: 0 0 18px; }
.field > label, .field > .label {
  display: block; font-weight: 600; font-size: 16px; margin-bottom: 6px;
}
.field .hint { color: var(--asphalt); font-size: 14px; margin-top: 6px; }
.field.bad .hint { color: var(--red); font-weight: 600; }
.input {
  width: 100%; height: 58px; border-radius: 10px; border: 2px solid var(--line); background: var(--card);
  padding: 4px 14px 0; font-size: 22px; font-weight: 600; text-transform: uppercase;
}
.input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-wash); }
.field.bad .input, .field.bad .odo, .field.bad .photo { border-color: var(--red); }
textarea.input { height: 92px; font-size: 17px; font-weight: 400; text-transform: none; padding-top: 12px; resize: vertical; }

.timefact {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--green-wash); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px;
}
.timefact b { font-size: 22px; font-weight: 800; }
.timefact span { color: var(--asphalt); font-size: 14px; }

/* odometer */
.odo {
  display: flex; align-items: center; background: var(--odo); border-radius: 10px; border: 2px solid var(--odo);
  padding: 0 14px; height: 70px; position: relative; overflow: hidden;
}
.odo::after { /* faint digit wheel separators */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.07), transparent 30%, transparent 70%, rgba(255,255,255,.07));
}
.odo input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; outline: none;
  font: 700 34px/1 "Overpass Mono", ui-monospace, monospace; letter-spacing: .14em; padding-top: 4px;
}
.odo input::placeholder { color: rgba(255,255,255,.28); }
.odo .unit { color: rgba(255,255,255,.6); font-weight: 600; font-size: 15px; }
.odo:focus-within { box-shadow: 0 0 0 3px var(--amber); }
.milesline { margin-top: 8px; font-weight: 600; }
.milesline b { font-size: 20px; }

/* stepper */
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: stretch; }
.stepper button {
  height: 64px; border-radius: 10px; border: 2px solid var(--line); background: var(--card);
  font-size: 30px; font-weight: 800; color: var(--green); display: grid; place-items: center;
}
.stepper button:active { background: var(--green-wash); }
.stepper input {
  height: 64px; text-align: center; border-radius: 10px; border: 2px solid var(--line); background: var(--card);
  font-size: 32px; font-weight: 800; width: 100%; padding-top: 4px;
}
.stepper.small { grid-template-columns: 48px 64px 48px; }
.stepper.small button, .stepper.small input { height: 48px; font-size: 22px; }

/* stops summary bar */
.stopsbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 4px 0 6px; }
.stopsbar i { display: block; background: var(--green); }
.stopsbar u { display: block; background: var(--red); text-decoration: none; }
.stopsnote { font-size: 15px; font-weight: 600; }
.stopsnote.warn { color: var(--red); }

/* reason chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 16px 8px;
  font-weight: 600; font-size: 16px; min-height: 48px;
}
.chip[aria-pressed="true"] { border-color: var(--red); background: var(--red-wash); color: var(--red); }
.reasonrows { margin-top: 12px; display: grid; gap: 10px; }
.reasonrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border: 2px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 14px; }
.reasonrow span { font-weight: 600; }

/* photo */
.photo {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 10px 14px;
  border: 2px dashed var(--asphalt); border-radius: 10px; background: var(--card); text-align: left;
}
.photo svg { width: 34px; height: 34px; flex: none; color: var(--green); }
.photo b { display: block; font-size: 18px; }
.photo small { color: var(--asphalt); font-size: 14px; }
.photo.has { border-style: solid; border-color: var(--green); }
.photo img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; }

/* sticky action */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(180deg, rgba(245,247,245,0), var(--paper) 30%);
}
.dock .inner { max-width: 560px; margin: 0 auto; }

/* ---------- sign in */
.signin { min-height: 100dvh; display: flex; flex-direction: column; }
.signin-head { background: var(--green); color: #fff; padding: calc(28px + var(--safe-t)) 20px 0; }
.signin-head .sign > span { font-size: 30px; padding: 6px 16px 2px; }
.signin-head p { margin: 14px 0 18px; opacity: .92; }
.signin-head .tape { margin: 0 -20px; }
.signin-body { padding: 18px 16px 40px; max-width: 560px; width: 100%; margin: 0 auto; }
.names { display: grid; gap: 8px; }
.name {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 60px;
  border: 2px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 16px;
  font-size: 20px; font-weight: 600; text-align: left;
}
.name svg { width: 22px; height: 22px; color: var(--asphalt); }
.search { margin-bottom: 12px; }
.search .input { text-transform: none; font-size: 18px; }

.pinwho { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pinwho b { font-size: 24px; font-weight: 800; }
.pindots { display: flex; gap: 14px; justify-content: center; margin: 10px 0 22px; }
.pindots i { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ink); }
.pindots i.on { background: var(--ink); }
.pindots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.keypad button {
  height: 68px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  font-size: 28px; font-weight: 800;
}
.keypad button:active { background: var(--green-wash); }
.keypad .muted { border-color: transparent; background: transparent; font-size: 16px; color: var(--asphalt); }
.pinerr { text-align: center; color: var(--red); font-weight: 600; min-height: 24px; margin: -10px 0 10px; }

/* ---------- done screen */
.done { text-align: center; padding-top: 18px; }
.done .check { width: 92px; height: 92px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; }
.done .check svg { width: 50px; height: 50px; }
.receipt { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 12px; margin: 18px 0; overflow: hidden; }
.receipt .row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.receipt .row:first-child { border-top: 0; }
.receipt .row span { color: var(--asphalt); }
.receipt .row b { text-align: right; }
.receipt .tape { margin: 0; height: 8px; }

/* ---------- history */
.hist { display: grid; gap: 10px; }
.histitem { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.histitem .h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.histitem .h b { font-size: 18px; }
.histitem .h small { color: var(--asphalt); }
.histitem .facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 15px; color: var(--asphalt); }
.histitem .facts b { color: var(--ink); }
.pill { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 9px 1px; border-radius: 999px; }
.pill.out { background: var(--amber); color: var(--ink); }
.pill.back { background: var(--green-wash); color: var(--green-deep); }
.empty { text-align: center; color: var(--asphalt); padding: 30px 10px; }

/* ---------- menu sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,32,25,.45); z-index: 20; display: flex; align-items: flex-end; }
.sheet { background: var(--paper); width: 100%; border-radius: 18px 18px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); max-width: 560px; margin: 0 auto; animation: up .2s ease-out; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 20px; margin: 0 0 12px; }
.sheet .btn + .btn { margin-top: 8px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- toast */
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + var(--safe-b)); z-index: 30;
  max-width: 528px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 12px;
  padding: 14px 16px; font-weight: 600; opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: none; }
#toast.bad { background: var(--red); }

.installhint { background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 18px; font-size: 15px; }
.installhint b { display: block; font-size: 16px; margin-bottom: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.signin-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.signin-foot .linkbtn { color: var(--asphalt); }

.signin .input { text-transform: none; font-size: 20px; }
.signin .label { font-weight: 600; margin: 4px 0 2px; }
.officebox { margin-top: 28px; padding-top: 18px; border-top: 2px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.officebox span { color: var(--asphalt); font-weight: 600; }
.officebox .btn { width: auto; min-height: 48px; padding: 8px 18px; font-size: 16px; }
