:root {
  --red: #c8102e;
  --red-2: #e0283f;
  --red-dark: #8f0b20;
  --on-red-soft: #ffd9de;
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #1f1517;
  --muted: #6e5f62;
  --line: #ecd6d9;
  --tint: #fff4f5;
  --danger: #b42318;
  --radius: 16px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) calc(var(--gutter) + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Home ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 2px 6px; }
.brand-mark { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 26px; height: 26px; stroke-width: 2.6; }
.brand h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.01em; color: var(--red); font-weight: 800; text-wrap: balance; }
#home { display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 52px; gap: 8px; }
.who {
  background: none; border: 0; padding: 10px 4px; min-height: 44px;
  color: var(--muted); font-size: 15px; cursor: pointer; text-align: left;
}
.who b { color: var(--ink); font-weight: 650; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 9px 16px; min-height: 40px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip-red { background: var(--red); border-color: var(--red); color: #fff; }

.hero {
  background: radial-gradient(120% 90% at 50% 0%, var(--red-2) 0%, var(--red) 55%, var(--red-dark) 100%);
  color: #fff;
  border-radius: 28px;
  padding: 28px 20px 24px;
  text-align: center;
  margin-top: 4px;
  box-shadow: 0 18px 40px -22px rgba(143, 11, 32, .55);
}
.hero-label {
  margin: 0; font-size: 14px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--on-red-soft); font-weight: 700;
}
.hero-number {
  display: block; width: 100%; margin: 6px 0 2px; padding: 0; border: 0; background: none;
  color: #fff; font-weight: 800; line-height: 1.05; letter-spacing: -.02em;
  font-size: clamp(88px, 34vw, 168px);
  font-variant-numeric: tabular-nums;
  cursor: default; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.hero-number:focus-visible { outline-offset: 6px; border-radius: 12px; }
.hero-note { margin: 0; min-height: 22px; font-size: 14px; color: rgba(255, 255, 255, .72); }

.actions { display: grid; gap: 12px; margin-top: 20px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 20px; border-radius: var(--radius);
  border: 2px solid transparent; font-size: 17px; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary { background: #fff; color: var(--red); border-color: var(--red); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.badge {
  min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 14px; font-weight: 700; text-align: center;
}
.hint { text-align: center; color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.home-foot { margin-top: auto; padding-top: 28px; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.grid { display: grid; gap: 14px; }

/* ---------- Sub-screen bar ---------- */
.bar {
  display: flex; align-items: center; gap: 4px; min-height: 64px;
  position: sticky; top: 0; background: var(--bg); z-index: 2;
  padding-top: env(safe-area-inset-top); margin-top: calc(-1 * env(safe-area-inset-top));
}
.bar h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.back {
  display: grid; place-items: center; width: 48px; height: 48px; margin-left: -10px;
  border-radius: 50%; color: var(--red); text-decoration: none;
}
.back:active { background: rgba(200, 16, 46, .1); }

/* ---------- Form ---------- */
.form { display: grid; gap: 18px; padding-top: 8px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 650; color: var(--red); }
.field em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 4px; }
.field input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  font-size: 17px; /* >=16px stops iOS zooming on focus */
}
.field input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .22); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.by { margin: 0; color: var(--muted); font-size: 14px; }
.by b { color: var(--ink); }

/* ---------- List ---------- */
.tools { display: grid; gap: 8px; padding-bottom: 8px; position: sticky; top: calc(64px); background: var(--bg); z-index: 1; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; }
.search:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200, 16, 46, .22); }
.search svg { color: var(--muted); width: 20px; height: 20px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; min-height: 48px; font-size: 17px; }
.count { margin: 0; font-size: 14px; color: var(--muted); }
.count b { color: var(--ink); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px 14px 16px;
}
.item h3 { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.item .phone { margin: 0; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.item .loc { margin: 2px 0 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.item .meta { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pending { color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.icons { display: flex; gap: 8px; align-self: start; }
.icon-btn {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  text-decoration: none; border: 1.5px solid var(--line); color: var(--red); background: var(--tint);
}
.icon-btn.call { background: var(--red); border-color: var(--red); color: #fff; }
.icon-btn:active { transform: scale(.94); }
.empty { text-align: center; color: var(--muted); padding: 36px 8px; }

/* ---------- Overlays / toast ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(60, 8, 16, .6);
  display: grid; align-items: end; justify-items: center; padding: 0;
}
.sheet {
  width: 100%; max-width: 560px; background: #fff; border-radius: 24px 24px 0 0;
  padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 14px;
  max-height: 100dvh; overflow: auto;
}
.sheet h2 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.sheet p { margin: 0; color: var(--muted); }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .overlay { align-items: center; } .sheet { border-radius: 24px; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 999px; z-index: 20;
  background: #2a1a1d; color: #fff; font-size: 15px; font-weight: 600; text-align: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}
.toast.bad { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
