/* Night Check.
   Built for a phone in a truck at night: everything is large, high contrast, and
   reachable with a thumb. Where the fleet dashboard optimises for information density,
   this optimises for being tappable without looking hard. */

:root {
  --bg: #0b0d11;
  --panel: #161a21;
  --panel-2: #1f242e;
  --line: #2b313c;
  --text: #f2f5f9;
  --muted: #98a1b0;
  --accent: #3b82f6;
  --go: #16a34a;
  --stop: #b91c1c;
  --warn: #f59e0b;
  --danger: #ef4444;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); }

header.top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
header.top .title { font-weight: 700; letter-spacing: 0.3px; }
header.top .who { margin-left: auto; color: var(--muted); font-size: 13px; }
header.top a { color: var(--muted); font-size: 13px; text-decoration: none; margin-left: 12px; }
header.top a:hover { color: var(--text); }

h2 { font-size: 18px; margin: 20px 0 8px; }
p.hint { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------------------------------------------------------------- big controls

   56px minimum on anything a driver taps. Well above the ~44px guideline, because this
   is used one-handed, at night, sometimes with gloves. */

button.big {
  width: 100%;
  min-height: 72px;
  font-size: 20px;
  font-weight: 700;
  border: 0;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  margin-bottom: 12px;
  padding: 16px;
}
button.go   { background: var(--go); }
button.stop { background: var(--stop); }
button.report {
  background: var(--warn);
  color: #1a1204;
  min-height: 140px;
  font-size: 26px;
  letter-spacing: 0.4px;
}
button.big:disabled { opacity: 0.45; cursor: default; }
button.big:active { transform: scale(0.99); }

button.choice {
  width: 100%;
  min-height: 62px;
  font-size: 18px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  padding: 14px;
  text-align: left;
}
button.choice:hover { border-color: var(--accent); }
button.choice.selected { border-color: var(--accent); background: #1d2a3f; }

button.ghost {
  background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; font-size: 15px; cursor: pointer; width: 100%;
}
button.ghost:hover { color: var(--text); }

/* ---------------------------------------------------------------- status */

.status {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 16px;
}
.status .row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.status .row:last-child { margin-bottom: 0; }
.status .k { color: var(--muted); font-size: 13px; min-width: 88px; }
.status .v { font-size: 17px; font-weight: 600; }
.status.live { border-color: var(--go); }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}
.pill.on  { background: var(--go); color: #fff; }
.pill.off { background: var(--panel-2); color: var(--muted); }

.elapsed { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }

input[type=email], input[type=text], select, textarea {
  width: 100%;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px;
  /* 16px minimum or iOS Safari zooms the page on focus. */
  font-size: 16px;
}
select { min-height: 56px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

input.code {
  letter-spacing: 8px; text-align: center; font-size: 26px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.msg { margin-top: 14px; font-size: 15px; min-height: 20px; }
.msg.err { color: var(--danger); }
.msg.ok  { color: var(--go); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; max-width: 420px; margin: 8vh auto;
}
.card h1 { font-size: 21px; margin: 0 0 4px; }

/* ---------------------------------------------------------------- lists */

.item {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
}
.item .head { display: flex; gap: 10px; align-items: baseline; }
.item .type { font-weight: 700; }
.item .when { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.item .note { color: var(--muted); font-size: 14px; margin-top: 4px; }

.empty { color: var(--muted); text-align: center; padding: 28px; }

/* ---------------------------------------------------------------- admin */

.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.tabs button {
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; cursor: pointer;
}
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  flex: 1 1 130px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px;
}
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.warn .n { color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.status-chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.status-chip.open { background: #3a2a0a; color: var(--warn); }
.status-chip.acknowledged { background: #10263f; color: #60a5fa; }
.status-chip.resolved { background: #0f2a18; color: #4ade80; }
.status-chip.invalid { background: var(--panel-2); color: var(--muted); }

.role-chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted);
}
.role-chip.admin { background: #10263f; color: #60a5fa; }

.scroll { overflow-x: auto; }
.notice {
  background: #2a1d05; border: 1px solid #5a3f0c; color: #fbbf24;
  border-radius: 12px; padding: 14px; margin-bottom: 16px; font-size: 14px;
}
