/* LCCC staff app — phone first, big touch targets, no animations */
:root {
  --purple: #4b2d8f;
  --purple-dark: #2d1660;
  --gold: #f5c518;
  --bg: #f6f5f8;
  --card: #fff;
  --text: #24212b;
  --muted: #5f5a6b;
  --border: #e3dfeb;
  --ok: #138a3d;
  --warn: #d98a00;
  --bad: #c62828;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button { font: inherit; cursor: pointer; }

input {
  font: inherit;
  font-size: 16px; /* no zoom on iOS */
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  background: #fff;
}

h2 { font-size: 1.3rem; color: var(--purple-dark); margin-bottom: 12px; }
h3 { font-size: 1rem; color: var(--purple-dark); margin: 18px 0 8px; }

/* ---------- login ---------- */
.login {
  min-height: 100%;
  background: var(--purple-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  gap: 10px;
}

.login img { border-radius: 20px; }

.pin-dots { display: flex; gap: 14px; margin: 10px 0; }

.pin-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
}

.pin-dots span.on { background: var(--gold); border-color: var(--gold); }

.login-error { color: #ffb4b4; min-height: 1.4em; font-weight: 700; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 12px;
}

.keypad button {
  height: 76px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 700;
}

.keypad button:active { background: rgba(255, 255, 255, 0.3); }

/* ---------- app layout ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--purple-dark);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}

.bar-name { font-weight: 800; flex: 1; }

.bar-status { font-size: 0.85rem; padding: 3px 10px; border-radius: 20px; background: rgba(255, 255, 255, 0.15); }
.bar-status.offline { background: var(--warn); color: #000; }

.bar-btn { background: none; border: 1px solid rgba(255, 255, 255, 0.5); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; }

main { flex: 1; padding: 14px 14px 100px; }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.tabs button {
  background: none;
  border: none;
  padding: 10px 0 8px;
  font-size: 1.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
}

.tabs button span { font-size: 0.75rem; font-weight: 700; }
.tabs button.is-active { color: var(--purple); background: #efeaf9; }

/* ---------- scan ---------- */
.camera {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 60vh;
  margin: 0 auto;
}

.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }

.camera-frame {
  position: absolute;
  inset: 18%;
  border: 4px solid var(--gold);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.camera-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 3px #000;
}

.manual { display: flex; gap: 8px; margin-top: 12px; }
.manual input { text-transform: uppercase; }
.manual button { border: none; background: var(--purple); color: #fff; border-radius: 10px; padding: 0 18px; font-weight: 800; }

.today { margin-top: 10px; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ---------- result overlay ---------- */
.result {
  position: fixed;
  inset: 0;
  z-index: 50;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 10px;
}

.result.ok { background: var(--ok); }
.result.warn { background: var(--warn); color: #000; }
.result.bad { background: var(--bad); }

.result-icon { font-size: 5rem; line-height: 1; }
.result h2 { color: inherit; font-size: 2rem; margin: 0; }
.result p { font-size: 1.2rem; max-width: 420px; }
.result-meta { opacity: 0.9; font-size: 1rem !important; }

.result-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px; margin-top: 16px; }

.result-actions button {
  border: 3px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 14px;
  padding: 16px;
  font-size: 1.2rem;
  font-weight: 800;
}

#result-override { background: #000; color: #fff; border-color: #000; }

/* ---------- door ---------- */
.door-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.door-row .info { flex: 1; }
.door-row .info strong { display: block; }
.door-row .info span { color: var(--muted); font-size: 0.9rem; }

.step { display: flex; align-items: center; gap: 6px; }

.step button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--purple);
  background: #fff;
  color: var(--purple);
  font-size: 1.4rem;
  font-weight: 800;
}

.step span { min-width: 26px; text-align: center; font-weight: 800; font-size: 1.2rem; }

.door-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 4px;
  border-top: 2px solid var(--purple);
  margin: 6px 0 10px;
  font-size: 1.2rem;
}

.door-total strong { font-size: 2rem; color: var(--purple-dark); }

.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-weight: 600; }
.check input { width: auto; }

.door-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.big { border: none; border-radius: 14px; padding: 18px 10px; font-size: 1.1rem; font-weight: 800; color: #fff; }
.big.cash { background: var(--ok); }
.big.card { background: var(--purple); }
.big:disabled { opacity: 0.4; }

.door-msg { margin-top: 12px; font-weight: 700; font-size: 1.1rem; }
.door-msg.ok { color: var(--ok); }
.door-msg.bad { color: var(--bad); }

/* ---------- search ---------- */
.results { list-style: none; margin-top: 12px; }

.results li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.results .info { flex: 1; }
.results .info strong { display: block; }
.results .info span { color: var(--muted); font-size: 0.88rem; display: block; }
.results button { border: none; background: var(--purple); color: #fff; border-radius: 10px; padding: 10px 12px; font-weight: 700; }
.results .badge { font-size: 0.8rem; font-weight: 800; padding: 3px 8px; border-radius: 12px; background: #e8f5ec; color: var(--ok); }
.results .badge.used { background: #eee; color: var(--muted); }
.results .badge.cancelled { background: #fdecea; color: var(--bad); }

/* ---------- live ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.kpi span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.kpi strong { font-size: 1.6rem; color: var(--purple-dark); }

.types { width: 100%; border-collapse: collapse; margin-top: 14px; background: var(--card); border-radius: 12px; overflow: hidden; font-size: 0.92rem; }
.types th, .types td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
.types th:first-child, .types td:first-child { text-align: left; }
.types th { background: #efeaf9; color: var(--purple-dark); font-size: 0.8rem; }

.recent { list-style: none; font-size: 0.9rem; }
.recent li { padding: 6px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.recent .r-ok { color: var(--ok); font-weight: 800; }
.recent .r-bad { color: var(--bad); font-weight: 800; }
.recent .r-warn { color: var(--warn); font-weight: 800; }
.recent time { color: var(--muted); min-width: 44px; }
