/* Mobile-first, for a driver standing at a pump with one hand free.
   Tap targets are generously sized and the volume field is the largest thing on
   the screen, because that is the number the whole app exists to record. */
:root {
  --green: #0b6b3a;
  --green-dark: #085229;
  --amber: #a15c00;
  --red: #b3261e;
  --ink: #1a1a1a;
  --muted: #6a6a6a;
  --line: #dcdcdc;
  --bg: #f4f5f3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---- chrome ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--green);
  color: #fff;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
}
.brand { display: flex; align-items: baseline; gap: 0.4rem; }
.brand-mark { font-weight: 700; font-size: 1.1rem; }
.brand-sub { font-size: 0.8rem; opacity: 0.85; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }
.who { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.pill-on { background: #b9f0cd; color: var(--green-dark); }
.pill-off { background: #ffd7d2; color: var(--red); }
.link {
  background: none; border: 0; color: #fff; text-decoration: underline;
  font: inherit; padding: 0.25rem;
}

/* ---- layout ---- */
.view, .stack { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }
.view { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}
.card h1 { font-size: 1.05rem; margin: 0; }

/* ---- form ---- */
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-height: 3rem;   /* a gloved thumb, not a mouse */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
.big-input { font-size: 1.6rem; font-weight: 700; text-align: right; min-height: 3.6rem; }

button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  background: #e9e9e9;
  color: var(--ink);
  min-height: 3rem;
}
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--green); color: #fff; font-weight: 600; }
.primary:active { background: var(--green-dark); }
.big { min-height: 3.6rem; font-size: 1.1rem; }
.ghost { background: #fff; border-color: var(--line); }

.error { color: var(--red); font-size: 0.9rem; margin: 0; }
.note { color: var(--amber); font-size: 0.9rem; margin: 0; }
.verdict { margin: 0; padding: 0.6rem 0.75rem; border-radius: 10px; font-size: 0.95rem; }
.verdict-ok { background: #e4f6ea; color: var(--green-dark); }
.verdict-warn { background: #fdf0dc; color: var(--amber); }
.verdict-unknown { background: #ececec; color: var(--muted); }

/* ---- tabs ---- */
.tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 0.9rem 0.4rem;
}
.tab.active { color: var(--green); font-weight: 700; box-shadow: inset 0 3px 0 var(--green); }
.badge {
  background: var(--amber); color: #fff; border-radius: 999px;
  padding: 0 0.4rem; font-size: 0.75rem;
}

/* ---- rows ---- */
.row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.row-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.row-title { font-weight: 700; }
.row-meta { font-size: 0.85rem; color: var(--muted); }
.row-actions { display: flex; gap: 0.5rem; }
.row-actions button { flex: 1; }
.row-fix { border-color: var(--amber); background: #fffaf0; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.35rem 0.3rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.diff-warn { color: var(--amber); font-weight: 700; }
