/* Psivia — Tire-Gauge Focus Deck */

:root {
  --bg: #24282a;
  --surface: #2f3437;
  --surface2: #363c40;
  --line: #3d4447;
  --cream: #e8e1d1;
  --cream-dim: #a49e90;
  --amber: #e0a33a;
  --amber-ink: #2b2417;
  --teal: #3f9188;
  --graphite: #7a8186;
  --danger: #d07a68;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--cream);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, select, textarea { font: inherit; }

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 16px calc(100px + env(safe-area-inset-bottom));
}

/* ---------- shared type ---------- */

.page-title {
  margin: 6px 0 2px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.page-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--cream-dim);
}

.brandrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 0 2px;
}

.brand {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* ---------- dots & state words (plain words, no ticks) ---------- */

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.dot.st-low { background: var(--amber); }
.dot.st-set { background: transparent; border: 2px solid var(--teal); }
.dot.st-checked { background: var(--graphite); }

.stateword {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--cream-dim);
}

/* ---------- Gauge tab ---------- */

.dial-card {
  display: block;
  width: min(76vw, 270px);
  aspect-ratio: 1;
  margin: 18px auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #3a4044, var(--surface) 72%);
  border: 1px solid var(--line);
  position: relative;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.dial-card:active { transform: scale(0.985); }

.dial-card svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24%;
  pointer-events: none;
}

.dial-psi {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
}

.dial-unit {
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.dial-pos {
  margin-top: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 1.5px;
}

.dial-note {
  margin-top: 2px;
  font-size: 12px;
  color: var(--cream-dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dial-hint {
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--cream-dim);
}

.calm {
  margin: 22px 0 8px;
  padding: 26px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.calm-word {
  font-size: 19px;
  font-weight: 700;
  color: var(--cream);
}

.calm-sub {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--cream-dim);
}

.counter-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--cream-dim);
}

.counter b { color: var(--cream); font-weight: 700; }

.add-strip {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 17px;
  border-radius: 16px;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.4px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(224, 163, 58, 0.22);
}

.add-strip:active { transform: translateY(1px); }

/* ---------- Checks tab ---------- */

.group { margin-top: 24px; }

.group:first-of-type { margin-top: 6px; }

.group h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.group h2 span { color: var(--amber); margin-left: 6px; letter-spacing: 0; }

.group-empty {
  margin: 0;
  padding: 10px 2px 4px;
  font-size: 13px;
  color: var(--cream-dim);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-radius: 12px;
  border-left: 4px solid var(--graphite);
  padding: 10px 10px 10px 13px;
  margin-bottom: 8px;
  min-height: 58px;
}

.row.st-low { border-left-color: var(--amber); }
.row.st-set { border-left-color: var(--teal); }
.row.st-checked { border-left-color: var(--graphite); }

.row-main {
  text-align: left;
  min-width: 0;
  display: block;
}

.pos {
  display: block;
  font-weight: 700;
  font-size: 16px;
  color: var(--cream);
}

.row-note {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--cream-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.psi { font-size: 15px; font-weight: 600; }

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mini {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cream-dim);
  background: var(--surface);
}

.mini:active { background: var(--line); color: var(--cream); }

.mini.del.armed {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- Record tab ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 18px 18px;
  margin-top: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.valve {
  width: 11px;
  height: 9px;
  margin: 0 auto 6px;
  background: var(--amber);
  border-radius: 3px 3px 5px 5px;
  position: relative;
}

.valve::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--graphite);
  border-radius: 2px 2px 0 0;
}

.field { margin-top: 15px; }
.field:first-of-type { margin-top: 14px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.field .opt {
  text-transform: none;
  letter-spacing: 0.4px;
  font-weight: 500;
  color: var(--graphite);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #26292c;
  color: var(--cream);
  font-size: 16px; /* prevents iOS zoom on focus */
}

.field textarea { resize: vertical; min-height: 58px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--amber);
}

.field .err {
  display: none;
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--danger);
}

.field.invalid .err { display: block; }
.field.invalid input { border-color: var(--danger); }

.save-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  border-radius: 15px;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
}

.save-btn:active { transform: translateY(1px); }

.rowbtns { display: flex; gap: 10px; margin-top: 12px; }

.ghost {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--cream-dim);
  font-weight: 600;
  text-align: center;
}

.ghost:active { background: var(--line); color: var(--cream); }

/* ---------- Find tab ---------- */

.search { margin-top: 4px; }

.result-count {
  margin: 16px 2px 8px;
  font-size: 11.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

/* ---------- empty states ---------- */

.empty { padding: 34px 10px 26px; text-align: center; }

.ring {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(232, 225, 209, 0.1);
  border-top-color: rgba(224, 163, 58, 0.42);
  transform: rotate(-35deg);
}

.empty-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--cream);
}

.empty-sub {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--cream-dim);
}

/* ---------- bottom tab bar: valve caps ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: #1e2124;
  border-top: 1px solid #33383b;
  padding: 8px 6px calc(9px + env(safe-area-inset-bottom));
  z-index: 10;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  color: #6d7478;
}

.tab.active { color: var(--amber); }

.cap {
  width: 32px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capbody {
  width: 22px;
  height: 13px;
  border-radius: 4px 4px 7px 7px;
  background: #4a5054;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.capbody::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  width: 8px;
  height: 5px;
  border-radius: 2px 2px 0 0;
  background: inherit;
}

.tab.active .capbody {
  background: var(--amber);
  transform: rotate(90deg);
  box-shadow: 0 3px 9px rgba(224, 163, 58, 0.35);
}

.tablabel {
  font-size: 11px;
  letter-spacing: 0.5px;
}
