/* BCI Vehicle Check-out. Light theme in Bus and Coach International orange.
   Layout: single phone-width column; white header carrying the logo, warm off-white page, white cards. */
:root {
  --brand: #c86335;        /* BCI orange, sampled from the logo */
  --brand-press: #a44c29;  /* pressed buttons, orange text on white (5.8:1) */
  --brand-tint: #fbeee7;
  --bg: #f7f4f2;
  --surface: #ffffff;
  --ink: #221c18;
  --muted: #6b625c;
  --line: #e7dfd9;
  --warn-bg: #fff3d6;
  --warn-ink: #6b4a00;
  --bad-bg: #fde8e8;
  --bad-ink: #9b1c1c;
  --ok-bg: #e3f4ea;
  --ok-ink: #0b5a2d;
  --ev: #0b7a6f;           /* EV-permitted trade plates */
  --ev-bg: #e2f4f1;
  --ev-ink: #08544c;
  --focus: #1f5fd6;
  --radius: 14px;
  --display: "Montserrat", "Avenir Next", "Segoe UI", Roboto, Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--body);
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: calc(10px + env(safe-area-inset-top)) 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 4px solid var(--brand);
}
.brand { display: block; line-height: 0; }
.brand img { height: 44px; width: auto; display: block; }
.app-name {
  font: 700 12px/1.25 var(--display); text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand-press); text-align: right;
}
.demo-bar { background: var(--brand-tint); color: var(--brand-press); font-size: 14px; padding: 8px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
main { max-width: 520px; margin: 0 auto; padding: 16px; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

h1, h2 { font-family: var(--display); text-wrap: balance; }
h1 { font-size: 24px; line-height: 1.2; margin: 8px 0 6px; font-weight: 800; }
h2 { font-size: 17px; margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }

/* Number plate */
.plate-wrap { text-align: center; padding: 8px 0 4px; }
.plate {
  display: inline-block; background: #fff; color: #111; border: 3px solid #111; border-radius: 8px;
  padding: 6px 18px; font: 800 34px/1.1 var(--display);
  letter-spacing: .06em; box-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.plate.small-plate { font-size: 18px; padding: 2px 8px; border-width: 2px; border-radius: 5px; }
.vehicle-sub { text-align: center; margin-top: 10px; }
.vehicle-sub .name { font: 700 18px/1.3 var(--display); }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.pill.available { background: var(--ok-bg); color: var(--ok-ink); }
.pill.out { background: var(--warn-bg); color: var(--warn-ink); }
.pill.unavailable { background: var(--bad-bg); color: var(--bad-ink); }
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* Trade plate EV rule */
.rule-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font: 800 13px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.rule-badge.ev { background: var(--ev); color: #fff; }
.rule-badge.nonev { background: var(--ink); color: #fff; }
.notice.rule { display: flex; gap: 12px; align-items: flex-start; border: 2px solid; font-size: 16px; }
.notice.rule.ev { background: var(--ev-bg); color: var(--ev-ink); border-color: var(--ev); }
.notice.rule.nonev { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.notice.rule .rule-badge { margin-top: 2px; }

/* Forms */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: 14px; }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 50px;
}
input:hover, textarea:hover { border-color: #d6cbc3; }
input.big { font: 700 26px/1.2 var(--display); letter-spacing: .03em; }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--bad-ink); }
.field-error { color: var(--bad-ink); font-size: 14px; margin-top: 4px; }
input[readonly] { background: var(--bg); color: var(--muted); }

button, .btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 16px; min-height: 56px;
  font-family: var(--display); font-size: 18px; font-weight: 700; line-height: 1.2; letter-spacing: .01em;
  cursor: pointer; text-align: center; text-decoration: none;
  margin-top: 16px; touch-action: manipulation;
}
.btn-go, .btn-dark { background: var(--brand); color: #fff; }
.btn-go:active, .btn-dark:active { background: var(--brand-press); }
.btn-ghost { background: var(--surface); color: var(--brand-press); border: 2px solid var(--brand); font-size: 16px; min-height: 50px; padding: 12px; }
.btn-ghost:active { background: var(--brand-tint); }
.btn-link { background: none; color: var(--brand-press); font-family: var(--body); font-size: 15px; font-weight: 600; min-height: 44px; padding: 8px; text-decoration: underline; margin-top: 8px; }
button[disabled] { opacity: .6; cursor: progress; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.notice { border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice strong { display: block; margin-bottom: 2px; }

dl.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; font-weight: 600; word-break: break-word; font-variant-numeric: tabular-nums; }

.trip-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.trip-link:first-of-type { border-top: 0; }
.trip-link .go { color: var(--brand-press); font-weight: 700; font-size: 15px; white-space: nowrap; }
.chev { font-size: 22px; }

.done-icon { width: 76px; height: 76px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin: 16px auto 8px; font-size: 42px; font-weight: 800; }
.center { text-align: center; }

.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 1; max-width: 100%; margin-top: 12px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner::after { content: ""; position: absolute; inset: 18%; border: 3px solid var(--brand); border-radius: 12px; }

.demo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.demo-list button { margin: 0; min-height: 0; padding: 10px; font-family: var(--body); font-size: 14px; font-weight: 600; background: var(--surface); color: var(--ink); border: 1px solid var(--line); text-align: left; }
.demo-list button:hover { border-color: var(--brand); }
.demo-list button .plate { font-size: 15px; padding: 1px 6px; border-width: 2px; margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
