:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel2: #182338;
  --text: #eef3ff;
  --muted: #9aaccb;
  --brand: #3b82f6;
  --brand2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --line: #24324d;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;
  --touch: 48px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: radial-gradient(1200px 600px at 20% -10%, #1e3a8a55, transparent), var(--bg); color: var(--text); min-height: 100%; }
button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app-shell { max-width: 720px; margin: 0 auto; min-height: 100vh; padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #2563eb, #22c55e); display:grid; place-items:center; font-size: 22px; box-shadow: var(--shadow); }
.brand h1 { font-size: 1.15rem; margin: 0; }
.brand p { margin: 0; color: var(--muted); font-size: .82rem; }

.pill { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 8px 12px; min-height: var(--touch); }
.card { background: linear-gradient(180deg, var(--panel), var(--panel2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card h2 { margin: 0 0 8px; font-size: 1rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 140px; }

.kid-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kid-btn {
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  min-height: 64px;
}
.kid-btn.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #172554; }
.kid-btn strong { display:block; font-size: 1.05rem; }
.kid-btn span { color: var(--muted); font-size: .85rem; }

.total-box { display:flex; justify-content: space-between; align-items: end; gap: 10px; }
.total-box .amount { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; }
.badge { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:4px 10px; font-size:.78rem; background:#0f172a; border:1px solid var(--line); color: var(--muted); }

.tabs {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(8,12,22,.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 8px;
  border-radius: 18px;
  z-index: 20;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 12px 6px;
  font-size: .8rem;
  min-height: var(--touch);
}
.tab.active { background: #1e3a8a; color: white; }

.primary {
  background: var(--brand);
  color: white;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  min-height: var(--touch);
}
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.secondary {
  background: #0f172a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  min-height: var(--touch);
}
.danger { background: #7f1d1d; color: white; border: 0; border-radius: 12px; padding: 10px 12px; min-height: 44px; }
input[type="search"], input[type="text"], input[type="number"], select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
  padding: 12px 14px;
  min-height: var(--touch);
}

.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #0f172a; border: 1px solid var(--line); }
.item img, .thumb { width: 64px; height: 88px; object-fit: cover; border-radius: 8px; background: #1e293b; }
.item h3 { margin: 0; font-size: .95rem; }
.item .meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.price { font-weight: 700; text-align: right; }
.price small { display:block; color: var(--muted); font-weight: 500; }

.candidate-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.candidate {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #0f172a;
  color: inherit;
  text-align: left;
  width: 100%;
  min-height: 96px;
}
.candidate.active {
  border-color: var(--brand2);
  box-shadow: inset 0 0 0 1px var(--brand2), 0 0 0 2px #16653455;
  background: #052e1a;
}
.candidate .pick-hint {
  display: block;
  margin-top: 6px;
  font-size: .78rem;
  color: var(--brand2);
  font-weight: 700;
}
.candidate:not(.active) .pick-hint { display: none; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.notice { padding: 12px 14px; border-radius: 12px; background: #1f2937; border: 1px solid var(--line); color: var(--muted); font-size: .95rem; line-height: 1.35; }
.notice.ok { background: #052e1a; border-color: #14532d; color: #bbf7d0; }
.notice.err { background: #450a0a; border-color: #7f1d1d; color: #fecaca; }
.notice.warn { background: #451a03; border-color: #9a3412; color: #fed7aa; }

/* —— Snap one-handed UX —— */
.snap-card { padding-bottom: 18px; }
.snap-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.snap-header h2 { margin: 0; }
.active-kid-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  background: #172554;
  border: 1px solid var(--brand);
  border-radius: 14px;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 110px;
}
.active-kid-chip .chip-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.active-kid-chip strong {
  font-size: 1rem;
  color: #dbeafe;
}
.snap-tip { margin: 0 0 8px; }
.snap-photo-tips {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  border: 1px dashed #3b82f688;
  color: #c7d2fe;
  font-size: .88rem;
  line-height: 1.4;
}
.snap-photo-tips strong {
  color: #93c5fd;
  font-weight: 700;
}
.snap-subhead { margin: 4px 0 0; font-size: 1.05rem; }

.recovery-panel {
  margin: 10px 0 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #451a03;
  border: 1px solid #9a3412;
  color: #fed7aa;
}
.recovery-panel .recovery-status {
  margin: 0 0 6px;
  font-weight: 700;
  color: #ffedd5;
  font-size: .98rem;
  line-height: 1.35;
}
.recovery-panel .recovery-hint {
  margin: 0;
  color: #fdba74;
  font-size: .86rem;
  line-height: 1.35;
}
.snap-actions.manual-only .confirm-btn { display: none; }
.primary-search-cta {
  background: linear-gradient(180deg, #3b82f6, #2563eb) !important;
  border: 0 !important;
  color: white !important;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.shutter-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 168px;
  border: 2px dashed #3b82f6aa;
  border-radius: 20px;
  padding: 22px 16px;
  text-align: center;
  background: linear-gradient(180deg, #0f172a, #17255455);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.shutter-zone:active { transform: scale(0.99); }
.shutter-icon { font-size: 2.4rem; line-height: 1; }
.shutter-title { font-size: 1.15rem; font-weight: 800; }
.shutter-sub { font-size: .85rem; }

.snap-preview-wrap {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.preview {
  max-width: min(280px, 100%);
  max-height: 320px;
  width: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #0f172a;
}

.snap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: stretch;
  margin-top: 14px;
}
.snap-actions > button {
  flex: 1 1 140px;
}
.shutter-btn,
.confirm-btn {
  flex: 2 1 180px !important;
  font-size: 1.05rem;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.confirm-btn:not(:disabled) {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}
.secondary-row {
  margin-top: 8px;
}
.secondary-row > button {
  flex: 1 1 100%;
}

.touch-target {
  min-height: var(--touch);
  min-width: 44px;
}

.qty { width: 72px; }
.actions { display:flex; gap:8px; justify-content:flex-end; margin-top: 8px; flex-wrap: wrap; }
.footer-note { text-align:center; color: var(--muted); font-size: .75rem; margin-top: 18px; }

/* —— Parent corner (calm, short copy) —— */
.parent-card .parent-lead {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
  font-size: .95rem;
}
.parent-gate {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: #0f172a;
  border: 1px solid var(--line);
  margin-bottom: 4px;
}
.parent-gate-label {
  margin: 0;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.parent-gate-row { width: 100%; }
.parent-gate-hint { margin: 0; font-size: .85rem; }
.parent-subhead {
  margin: 16px 0 8px;
  font-size: .95rem;
  color: #dbeafe;
}
.parent-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: .92rem;
}
.parent-list li { margin-bottom: 6px; }
.parent-list.can-list li::marker { color: var(--brand2); }
.parent-list.cannot-list li::marker { color: var(--warn); }
.parent-kids-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.parent-kid-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #0f172a;
  border: 1px solid var(--line);
}
.parent-kid-row .meta {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 2px;
}
.parent-kid-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: .82rem;
}
.parent-kid-stats strong {
  color: var(--text);
  font-size: 1rem;
}
.parent-callout {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #172554;
  border: 1px solid #1e3a8a;
  color: #bfdbfe;
  font-size: .9rem;
  line-height: 1.4;
}
.parent-actions { margin-top: 12px; }
.parent-household { font-size: .9rem; }

@media (min-width: 720px) {
  .app-shell { padding-top: 24px; }
}

/* Thumb zone: keep primary Snap CTAs near bottom of card on short phones */
@media (max-width: 420px) {
  .shutter-zone { min-height: 150px; }
  .snap-actions { position: sticky; bottom: 84px; z-index: 5; }
}
