/* Trucker's Friend — Night Haul instrument-panel theme.
   Mobile-first, no external resources, no fixed layout widths in px. */
:root {
  --bg: #0d1512;
  --surface: #14211a;
  --surface-2: #182720;
  --ink: #f2efe6;
  --muted: #a8b5a9;
  --amber: #ffb224;
  --amber-ink: #ffb224;
  --green: #2fbf71;
  --ok: #2fbf71;
  --red: #ff5a4e;
  --bad: #ff5a4e;
  --brand: #16402a;
  --brand-ink: #f2efe6;
  --line: #2a3d31;
  --header-bg: #08110c;
  --cta-bg: #ffb224;
  --cta-ink: #17211b;
  --on-signal: #0d1512;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1ec;
    --surface: #ffffff;
    --surface-2: #ece7d8;
    --ink: #17211b;
    --muted: #46564a;
    --amber: #ffb224;
    --amber-ink: #7a4d00;
    --green: #146c2e;
    --ok: #146c2e;
    --red: #a31616;
    --bad: #a31616;
    --brand: #123524;
    --brand-ink: #ffffff;
    --line: #c9d2c6;
    --header-bg: #08110c;
    --cta-bg: #ffb224;
    --cta-ink: #17211b;
    --on-signal: #ffffff;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  padding-bottom: 5.75rem;
}
header {
  background: var(--header-bg);
  color: #f2efe6;
  border-bottom: 0.25rem solid var(--amber);
  padding: 1rem max(1rem, calc((100% - 60rem) / 2));
  margin: 0;
}
header p { color: #a8b5a9; margin: 0.25rem 0; }
main, footer { padding: 1rem; max-width: 60rem; margin: 0 auto; }
footer { color: var(--muted); }
h1 { font-size: 1.6rem; margin: 0.25rem 0; letter-spacing: 0.02em; }
h2, h3 { letter-spacing: 0.01em; }
section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
label { display: block; margin: 0.75rem 0; font-weight: 600; }
input, select, textarea {
  display: block; inline-size: 100%; font-size: 1rem; min-height: 48px;
  padding: 0.6rem; margin-top: 0.25rem;
  border: 1px solid var(--muted); border-radius: 0.5rem;
  background: var(--surface-2); color: var(--ink);
}
textarea { min-height: 6rem; }
button, a.door, nav a, nav button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; min-width: 48px; padding: 0.7rem 1rem; margin: 0.25rem 0.25rem 0.25rem 0;
  font-size: 1rem; border-radius: 0.5rem; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cta {
  min-height: 56px; font-size: 1.1rem; font-weight: 700;
  background: var(--cta-bg); color: var(--cta-ink); border-color: var(--cta-bg);
}
nav a, nav button { background: var(--surface); color: var(--ink); border-color: var(--line); flex: 0 0 auto; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile-go:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
@media (prefers-color-scheme: light) {
  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile-go:focus-visible {
    outline-color: var(--amber-ink);
  }
}

/* Navigation: fixed bottom thumb bar on small screens, top bar on wide. */
#main-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  margin: 0;
}
#main-nav[hidden] { display: none; }
@media (min-width: 64rem) {
  body { padding-bottom: 0; }
  #main-nav {
    position: static; flex-wrap: wrap; overflow-x: visible; white-space: normal;
    padding: 0.5rem 1rem; max-width: 60rem; margin: 0 auto;
    background: transparent; border-top: none;
  }
}

/* Dashboard tiles are doors; CPM is the hero. */
.tiles { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 40rem) { .tiles { grid-template-columns: 1fr 1fr; } .doors { grid-template-columns: 1fr 1fr; } }
.tile {
  position: relative;
  border: 1px solid var(--line); border-radius: 0.75rem; padding: 1rem;
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.tile-go { position: absolute; inset: 0; border-radius: 0.75rem; }
.tile-hero { grid-column: 1 / -1; }
.tile .big, .big { font-size: 2.4rem; font-weight: 700; margin: 0.25rem 0; font-variant-numeric: tabular-nums; }
.tile-hero .big { font-size: 2.6rem; }
.tile h3 { margin-top: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; color: var(--muted); }
.doors { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
a.door { font-size: 1.25rem; font-weight: 700; min-height: 4.5rem; background: var(--amber); border-color: var(--amber); color: #17211b; }

/* Verdict banner: full-width signal block. */
.verdict-result {
  display: block; inline-size: 100%;
  margin: 0.5rem 0;
  padding: 1rem; border-radius: 0.75rem; text-align: center;
  font-size: 2.6rem; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.verdict-take { background: var(--green); color: var(--on-signal); }
.verdict-pass { background: var(--red); color: #170806; }
@media (prefers-color-scheme: light) {
  .verdict-take { color: #ffffff; }
  .verdict-pass { color: #ffffff; }
}

/* Formatted result helpers: chips, bars, live clocks. */
.chip {
  display: inline-flex; align-items: center; min-height: 48px;
  padding: 0.25rem 0.75rem; border-radius: 999px;
  font-weight: 700; font-size: 1rem;
}
.chip-ok, .chip-paid { background: var(--green); color: var(--on-signal); }
.chip-short { background: var(--red); color: #170806; }
.chip-pending, .chip-claimable { background: var(--amber); color: #17211b; }
@media (prefers-color-scheme: light) {
  .chip-ok, .chip-paid, .chip-short { color: #ffffff; }
}
.bar-track { background: var(--line); border-radius: 999px; overflow: hidden; margin: 0.35rem 0 0.85rem; }
.bar { height: 1rem; border-radius: 999px; }
.bar-maintenance { background: var(--amber); }
.bar-tax { background: var(--green); }
.meters-hero, .ifta-hero { font-variant-numeric: tabular-nums; }
.stay-clock { font-weight: 700; font-variant-numeric: tabular-nums; }
.stay-clock.accruing { color: var(--amber-ink); }
li.stay-claimable { border-left: 0.35rem solid var(--amber); padding-left: 0.6rem; }
.gps-dot-on { color: var(--green); }
.gps-dot-off { color: var(--muted); }

/* IFTA table: sticky head, zebra, right-aligned tabular numerals. */
table { border-collapse: collapse; inline-size: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--line); min-height: 48px; }
#ifta-table thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
#ifta-table tbody tr:nth-child(even) { background: var(--surface-2); }
#ifta-table th:nth-child(n+2), #ifta-table td:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
#ifta-table tfoot td { font-weight: 700; border-top: 2px solid var(--muted); }
ul { padding-left: 1.1rem; } li { margin: 0.6rem 0; }
li a, li button { min-height: 48px; }
.draft-note { font-weight: 700; }

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

/* ---- Elevation pass (2026-11-12): brand, stay cards, stat rows, states ----
   Presentation only: layout order, flows and the Night Haul palette are kept. */
.brand-mark { inline-size: 2.1rem; block-size: 2.1rem; vertical-align: -0.45rem; margin-right: 0.55rem; }
.tagline { color: var(--muted); font-size: 1.05rem; margin: 0 0 0.5rem; max-inline-size: 34rem; }
.hint { color: var(--muted); margin: 0 0 0.75rem; max-inline-size: 36rem; }
#signup-form { border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 0.75rem; }
section > h2 { border-left: 0.3rem solid var(--amber); padding-left: 0.6rem; }
nav a[aria-current="page"] { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-ink); font-weight: 700; }
.tile .big-status { font-size: 1.7rem; line-height: 1.25; }
.stat-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.mini-stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.55rem 0.85rem; }
.mini-stat b { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.mini-stat span { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.07em; text-transform: uppercase; }
#stay-list, #settlement-list { list-style: none; padding-left: 0; }
.stay-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 0.9rem; padding: 1rem; margin: 0 0 0.75rem; }
.stay-card.stay-claimable { border-left: 0.35rem solid var(--amber); }
.stay-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.stay-facility { font-weight: 800; font-size: 1.15rem; }
.stay-meta { margin: 0.4rem 0 0; font-variant-numeric: tabular-nums; }
.stay-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.75rem; }
a.packet-link { display: inline-flex; align-items: center; min-height: 48px; padding: 0.6rem 1rem; border: 1.5px solid var(--amber); border-radius: 0.75rem; color: var(--amber-ink); font-weight: 700; text-decoration: none; }
.draft-note { display: block; font-weight: 400; color: var(--muted); margin-top: 0.5rem; }
.empty-state { color: var(--muted); padding: 0.5rem 0; }
#settlement-list li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 0.9rem; padding: 0.8rem 1rem; margin: 0 0 0.6rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.settle-right { margin-left: auto; display: inline-flex; align-items: center; gap: 0.6rem; }
.settle-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.gps-miles-line #gps-miles { display: block; font-size: 2.2rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
a.door::after { content: "↗"; float: right; font-weight: 800; }
@media (prefers-color-scheme: light) {
  .tile, .mini-stat, .stay-card, #settlement-list li { background: #ffffff; }
  input, select, textarea { background: #ffffff; }
}

/* ---- Companion (integration, 2026-11-12): panel, mic, transcript log ----
   Appended block only; Night Haul palette and shell rules kept. */
#companion .tf-companion-parked-label { display: flex; align-items: center; gap: 0.6rem; }
#tf-companion-parked { display: inline-block; inline-size: auto; min-height: 48px; min-width: 48px; margin: 0; }
#tf-companion-log { margin: 0.75rem 0; }
#tf-companion-log:empty { margin: 0; }
.tf-companion-reply, .tf-companion-driver { background: var(--surface-2); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.6rem 0.85rem; margin: 0 0 0.6rem; }
.tf-companion-driver { border-left: 0.35rem solid var(--amber); }
#tf-companion-mode { background: var(--surface-2); border: 1px solid var(--amber); border-radius: 0.75rem; padding: 0.6rem 0.85rem; font-weight: 700; }
#tf-companion-mic { margin-bottom: 0.5rem; }
@media (prefers-color-scheme: light) {
  .tf-companion-reply, .tf-companion-driver, #tf-companion-mode { background: #ffffff; }
}
