/*
 * Door UI. Different constraints from the dashboard: one hand, a dark room, a queue, and a phone
 * held at arm's length. So: huge type, full-bleed colour for the verdict, nothing clickable near
 * the thumb by accident.
 */
:root {
  --coral: #FF6B6B;
  --ink: #16120f;
  --ink-mid: #6b625c;
  --bg: #fcfbfa;
  --line: #e4dfdb;
  --admit: #0f7a3d;
  --refuse: #b3261e;
  --escalate: #9a6700;
  --radius: 14px;
}

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

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  /* Home-screen PWAs sit under the notch and the home indicator. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen { display: none; height: 100%; flex-direction: column; }
.screen[data-active] { display: flex; }

/* ---------- pairing ---------- */

.pair {
  justify-content: center;
  padding: 1.5rem;
  gap: 1.25rem;
  max-width: 26rem;
  margin: 0 auto;
  width: 100%;
}

.wordmark {
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--coral);
  font-size: 1.5rem;
  margin: 0;
}

.pair h1 { font-size: 1.4rem; margin: 0; letter-spacing: -0.02em; }
.pair p { color: var(--ink-mid); margin: 0; line-height: 1.5; font-size: 0.95rem; }

label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-mid); margin-bottom: 0.35rem; }

input[type="text"], input[type="tel"] {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input:focus { outline: 2px solid var(--coral); outline-offset: 1px; border-color: transparent; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.5; }
button.ghost { background: transparent; color: var(--ink-mid); font-weight: 500; }

.error { color: var(--refuse); font-size: 0.9rem; min-height: 1.2em; margin: 0; }

/* ---------- scanning ---------- */

.scan { position: relative; }

#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.scan-chrome {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  pointer-events: none;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: auto;
}
.bar strong { font-weight: 600; }
.bar button { padding: 0.4rem 0.7rem; font-size: 0.8rem; background: rgba(255,255,255,0.15); }

.reticle {
  align-self: center;
  width: min(62vw, 16rem);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}

/* ---------- verdict ---------- */

.verdict {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  color: #fff;
  z-index: 10;
}
.verdict[data-show] { display: flex; }
.verdict[data-action="admit"] { background: var(--admit); }
.verdict[data-action="refuse"] { background: var(--refuse); }
.verdict[data-action="escalate"] { background: var(--escalate); }

.verdict .headline {
  font-size: clamp(2rem, 11vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 0.75rem;
}
.verdict .detail { font-size: 1.05rem; opacity: 0.92; margin: 0 0 1.25rem; max-width: 22rem; line-height: 1.45; }
.verdict .who { font-size: 1rem; opacity: 0.85; margin: 0; }
.verdict .who b { font-weight: 600; }
.verdict .dismiss { margin-top: 2rem; background: rgba(255,255,255,0.18); }

.counts { display: flex; gap: 1rem; flex-wrap: wrap; }
.counts span { opacity: 0.85; }

/* ---------- install sheet ---------- */

/* iOS exposes no install API, so the button can only explain. This is that explanation. */
.sheet {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  z-index: 20;
}
.sheet[data-show] { display: flex; }

.sheet-card {
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 28rem;
}
.sheet-card h2 { margin: 0 0 1rem; font-size: 1.15rem; letter-spacing: -0.02em; }
/* display:flex on the items kills the native markers, so the numbers are drawn with a counter. */
.sheet-card ol { margin: 0 0 1rem; padding: 0; list-style: none; counter-reset: step; }
.sheet-card li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  counter-increment: step;
}
.sheet-card li::before {
  content: counter(step);
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.sheet-card svg { color: var(--coral); flex: none; }
.sheet-note { color: var(--ink-mid); font-size: 0.85rem; margin: 0 0 1.25rem; }
.sheet-card button { width: 100%; }

/* ---------- guest list ---------- */

.bar-actions { display: flex; gap: 0.5rem; align-items: center; flex: none; }
.bar-actions button { white-space: nowrap; }
.guests { padding: 1rem 1.25rem 2rem; gap: 0.75rem; overflow-y: auto; }
.guests-head { display: flex; align-items: center; gap: 0.5rem; }
.guests-head h1 { font-size: 1.2rem; margin: 0; letter-spacing: -0.02em; }
.guests-head button { padding: 0.4rem 0.6rem; }
#guest-search {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.75rem 0.9rem; -webkit-appearance: none; appearance: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.guests-note { color: var(--ink-mid); font-size: 0.85rem; margin: 0; min-height: 1.2em; }
.guests-note[data-tone="warn"] { color: var(--escalate); font-weight: 600; }
.guest-rows { list-style: none; margin: 0; padding: 0; }
.guest-rows li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--line);
}
.guest-rows .name { font-weight: 600; overflow-wrap: anywhere; }
.guest-rows .msg { display: block; color: var(--escalate); font-size: 0.8rem; font-weight: 500; }
.guest-rows .in { color: var(--admit); font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.guest-rows button { padding: 0.55rem 0.9rem; font-size: 0.9rem; flex: none; }

/* ---------- phone owner's name ---------- */

.bar .name-chip {
  display: block; margin: 0.1rem 0 0.2rem; padding: 0; background: none; color: #fff; opacity: 0.75;
  font-size: 0.8rem; font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}
#owner-name {
  width: 100%; font: inherit; font-size: 1rem; letter-spacing: normal; padding: 0.75rem 0.9rem; margin: 0 0 0.5rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.sheet-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
