/* =====================================================================
   Kid Safe ID — design system v5
   Direction: a calm, trustworthy safety brand. Deep teal for trust, a warm
   sunflower for "act now" (call buttons, highlights), coral only for alerts.
   Soft mint ground, white raised cards, rounded but not bubbly.
   ===================================================================== */
:root {
  --bg: #f3f6f4;
  --bg-2: #e9f0ed;
  --surface: #ffffff;
  --surface-2: #f6f9f8;
  --ink: #0f2a26;
  --ink-2: #2c4641;
  --muted: #5b726d;
  --line: #dce6e2;
  --line-2: #c9d8d3;
  --brand: #0e5a52;
  --brand-2: #127a6f;
  --brand-soft: #dcefea;
  --brand-ink: #ffffff;
  --sun: #f7b32b;
  --sun-soft: #fff3d6;
  --sun-ink: #2b1b00;
  --coral: #e35d4f;
  --coral-soft: #fde7e4;
  --ok: #1f8a55;
  --ok-bg: #e1f4ea;
  --warn: #8a5a00;
  --warn-bg: #fff1cc;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --field: #ffffff;
  --shadow: 0 1px 2px rgba(15, 42, 38, .05), 0 10px 30px -12px rgba(15, 42, 38, .14);
  --shadow-lg: 0 2px 4px rgba(15, 42, 38, .05), 0 24px 60px -20px rgba(15, 42, 38, .28);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --display: "Bricolage Grotesque", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1513; --bg-2: #0f1c19; --surface: #12201d; --surface-2: #162724;
    --ink: #e6f1ee; --ink-2: #c3d6d1; --muted: #93aaa4; --line: #223632; --line-2: #2d4540;
    --brand: #1f8c7f; --brand-2: #27a597; --brand-soft: #143a35; --brand-ink: #ffffff;
    --sun: #ffc34d; --sun-soft: #3a2c0a; --sun-ink: #2b1b00;
    --coral: #ff7a6b; --coral-soft: #3c1a16;
    --ok: #6fd39c; --ok-bg: #12301f; --warn: #ffd27a; --warn-bg: #3a2c0a; --bad: #ff8a80; --bad-bg: #3a1614;
    --field: #0f1c19;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 60px -20px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--brand-2); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 12px; border: 0; cursor: pointer;
  font: 600 16px/1.2 var(--body); text-decoration: none; text-align: center;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--sun); outline-offset: 2px;
}
.btn-main { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -8px rgba(14, 90, 82, .6); }
.btn-main:hover { background: var(--brand-2); }
.btn-sun { background: var(--sun); color: var(--sun-ink); box-shadow: 0 6px 16px -8px rgba(247, 179, 43, .8); }
.btn-sun:hover { filter: brightness(1.04); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-2); }
.btn-ghost:hover { border-color: var(--brand-2); }
.btn-danger { background: transparent; color: var(--bad); border: 1.5px solid var(--line-2); }
.btn-danger[data-armed="1"] { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; gap: 6px; }
.btn-xs { padding: 5px 10px; font-size: 13px; border-radius: 8px; gap: 4px; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 22px; font-size: 18px; border-radius: 14px; }
.linkbtn { background: none; border: 0; color: var(--brand-2); font: 600 14px var(--body); cursor: pointer; padding: 0; justify-self: start; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms ---------- */
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
input, textarea, select {
  font: 400 16px/1.4 var(--body); width: 100%; padding: 11px 13px; border-radius: 11px;
  border: 1.5px solid var(--line-2); background: var(--field); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-soft); outline: none; }
textarea { resize: vertical; }
input[type="file"] { padding: 8px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--brand); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; display: grid; gap: 12px; min-width: 0; background: var(--surface-2); }
legend { font: 700 14px var(--display); padding: 0 6px; color: var(--ink); letter-spacing: .01em; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }

.msg { border-radius: 12px; padding: 11px 14px; font-size: 14px; line-height: 1.45; }
.msg-ok { background: var(--ok-bg); color: var(--ok); }
.msg-bad { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--sun-soft); border: 1px solid color-mix(in srgb, var(--sun) 45%, transparent); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--ink); }
.notice code { font-size: 13px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500; z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg);
}
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- Page shell ---------- */
.page {
  max-width: 1120px; margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px));
  display: grid; gap: 24px;
}
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in {
  max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
}
.brand { color: var(--ink); text-decoration: none; font: 800 20px var(--display); display: flex; align-items: center; gap: 10px; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--brand); display: grid; place-items: center; color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.brand-mark svg { width: 20px; height: 20px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.topbar .who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font: 800 14px var(--display); flex: none; }
@media (max-width: 560px) { .topbar .who > span { display: none; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; display: grid; gap: 16px; min-width: 0; box-shadow: var(--shadow); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-2); }

/* ---------- Landing ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; padding-top: 12px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 28px; } }
.pitch { display: grid; gap: 18px; min-width: 0; }
.pitch h1 { font-size: clamp(34px, 5.6vw, 56px); line-height: 1.02; font-weight: 800; letter-spacing: -0.03em; }
.pitch h1 em { font-style: normal; color: var(--brand-2); position: relative; white-space: nowrap; }
.pitch h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .18em; background: var(--sun); border-radius: 4px; z-index: -1; opacity: .9; }
.pitch .lead { max-width: 50ch; color: var(--muted); font-size: 18px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.trust span { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.trust .icon { color: var(--brand-2); }
.hero-art { position: relative; display: grid; place-items: center; }
.hero-art svg { width: 100%; max-width: 420px; height: auto; }
.float-chip { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-size: 13px; line-height: 1.3; }
.float-chip b { display: block; font-size: 14px; }
.float-chip .dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.chip-a { top: 12%; left: -2%; }
.chip-b { bottom: 10%; right: -2%; }
@media (max-width: 560px) { .chip-a { left: 0; } .chip-b { right: 0; } .float-chip { font-size: 12px; padding: 8px 10px; } }
@media (prefers-reduced-motion: no-preference) {
  .pendant-swing { transform-origin: 210px 20px; animation: swing 6s ease-in-out infinite; }
  @keyframes swing { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
}

.auth-wrap { display: grid; grid-template-columns: 1fr 440px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-2); border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font: 600 15px var(--body); color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15,42,38,.12); }
.auth-form { display: grid; gap: 14px; }

.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; display: grid; gap: 10px; align-content: start; box-shadow: var(--shadow); }
.step-card .art { height: 130px; border-radius: 16px; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; }
.step-card .art svg { height: 110px; width: auto; }
.step-card .num { font: 800 13px var(--display); color: var(--brand-2); letter-spacing: .08em; text-transform: uppercase; }
.step-card h3 { font-size: 20px; }
.step-card p { color: var(--muted); font-size: 15px; }
.section-title { display: grid; gap: 6px; }
.section-title h2 { font-size: clamp(24px, 3.4vw, 32px); }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .features { grid-template-columns: 1fr; } }
.feature { display: grid; gap: 8px; padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.feature .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); }
.feature b { font-family: var(--display); font-size: 17px; }
.feature span { font-size: 14px; color: var(--muted); }
.site-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 0 24px; }

/* ---------- Dashboard ---------- */
.head-row { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.head-row h1 { font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -0.02em; }
.head-row h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.head-row h2 .icon { color: var(--brand-2); }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 380px) { .kid-grid { grid-template-columns: 1fr; } }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 14px; min-width: 0; box-shadow: var(--shadow); align-content: start; }
.kcard-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.kphoto { width: 76px; height: 76px; border-radius: 50%; flex: none; overflow: hidden; background: var(--brand-soft); display: grid; place-items: center; font: 800 24px var(--display); color: var(--brand-2); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--sun); }
.kphoto img { width: 100%; height: 100%; object-fit: cover; }
.kinfo { min-width: 0; display: grid; gap: 4px; }
.kinfo h3 { font-size: 20px; overflow-wrap: anywhere; }
.pill { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-on { background: var(--ok-bg); color: var(--ok); }
.pill-off { background: var(--bad-bg); color: var(--bad); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.kactions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.tag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tag-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 12px; }
.tag-list .tag-ic { color: var(--brand-2); display: grid; }
.tagcode { font-family: var(--mono); font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; font-size: 14px; }
.tag-actions { margin-left: auto; display: flex; gap: 6px; }
.empty { background: var(--surface); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 32px 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty svg.art { width: 160px; height: auto; }
.empty h3 { font-size: 22px; }

.alerts { display: grid; gap: 10px; }
.alert-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 14px 56px; display: grid; gap: 4px; min-width: 0; position: relative; }
.alert-item::before { content: ""; position: absolute; left: 16px; top: 16px; width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23127a6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Cpath d='M14 14h3v3h-3zM20 14v.01M14 20h.01M17 20h4v-3'/%3E%3C/svg%3E") center / 16px no-repeat; }
.alert-item.report { border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); background: color-mix(in srgb, var(--coral-soft) 45%, var(--surface)); }
.alert-item.report::before { background: var(--coral-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e35d4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / 16px no-repeat; }
.alert-item .when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alert-item p { margin: 0; overflow-wrap: anywhere; }

dialog {
  border: 0; border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink);
  width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(8, 24, 21, .55); backdrop-filter: blur(3px); }
.dlg { display: grid; gap: 16px; padding: 22px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-head h2 { font-size: 22px; }
.xbtn { border: 0; background: var(--bg-2); color: var(--ink); width: 38px; height: 38px; border-radius: 12px; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.photo-pick { display: flex; gap: 16px; align-items: center; }
.urltext { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; color: var(--muted); background: var(--bg-2); padding: 8px 10px; border-radius: 8px; user-select: all; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.key-entry input { font: 600 22px var(--mono); letter-spacing: .14em; text-transform: uppercase; text-align: center; padding: 14px; }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: center; border: 1.5px solid var(--line-2); border-radius: 14px; padding: 13px 15px; cursor: pointer; font-weight: 500; font-size: 16px; color: var(--ink); }
.choice input { width: 20px; height: 20px; flex: none; accent-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }

/* Round QR dialog */
.qr-layout { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
@media (max-width: 540px) { .qr-layout { grid-template-columns: 1fr; justify-items: center; } }
.qr-preview { width: 210px; height: 210px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--bg-2)); display: grid; place-items: center; box-shadow: 0 0 0 8px var(--surface-2), 0 0 0 9px var(--line), var(--shadow-lg); }
.qr-preview canvas { width: 192px; height: 192px; border-radius: 50%; }
.qr-controls { display: grid; gap: 12px; min-width: 0; width: 100%; }
.label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sizes button { border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: 600 14px var(--body); cursor: pointer; font-variant-numeric: tabular-nums; }
.sizes button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.sheet-print { display: grid; gap: 12px; justify-items: center; }
.sheet-print img { max-width: 100%; height: auto !important; border: 1px solid var(--line); background: #fff; border-radius: 6px; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: var(--shadow); justify-self: start; }
.admin-nav button { border: 0; background: transparent; padding: 10px 16px; border-radius: 11px; font: 600 15px var(--body); color: var(--muted); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.admin-nav button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 4px; box-shadow: var(--shadow); }
.stat b { font: 800 32px/1.05 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat.hl { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.stat.hl span { color: rgba(255,255,255,.8); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.toolbar label { flex: 1 1 180px; }
.toolbar select { width: auto; min-width: 160px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.wrap { white-space: normal; min-width: 140px; }
tr:last-child td { border-bottom: 0; }
td .row-actions { flex-wrap: nowrap; gap: 6px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 14px; }
.secret { font-family: var(--mono); font-weight: 700; font-size: 22px; letter-spacing: .1em; background: var(--sun-soft); padding: 10px 14px; border-radius: 10px; user-select: all; text-align: center; }

/* Package card (85.6 × 54 mm) */
.pkg { width: 85.6mm; height: 54mm; border: 1.5px solid #0e5a52; border-radius: 3mm; padding: 3.5mm 4mm; display: grid; grid-template-columns: 1fr auto; gap: 2mm 3mm; background: #fff; color: #0f2a26; font-size: 7.5pt; line-height: 1.3; break-inside: avoid; page-break-inside: avoid; }
.pkg h4 { margin: 0; font: 800 12pt var(--display); color: #0e5a52; grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; }
.pkg .pkg-tag { font: 600 6.5pt var(--mono); color: #5b726d; letter-spacing: .04em; }
.pkg ol { margin: 0; padding-left: 4mm; }
.pkg .pkg-qr img, .pkg .pkg-qr canvas { width: 17mm; height: 17mm; display: block; }
.pkg .pkg-qr { text-align: center; font-size: 6pt; color: #5b726d; }
.pkg .url { font: 700 7.5pt var(--mono); white-space: nowrap; }
.pkg .key { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 3mm; border-top: 1px dashed #b9c9c5; padding-top: 2mm; }
.pkg .key span { font-size: 6.5pt; text-transform: uppercase; letter-spacing: .06em; color: #5b726d; }
.pkg .key b { font: 700 14pt var(--mono); letter-spacing: .06em; }
.pkg-sheet { display: flex; flex-wrap: wrap; gap: 4mm; }

/* ---------- Public scan page ---------- */
.kid-page { padding: 20px max(14px, env(safe-area-inset-right, 0px)) 40px max(14px, env(safe-area-inset-left, 0px)); }
.kid-wrap { max-width: 480px; margin: 0 auto; display: grid; gap: 14px; }
.sos { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--coral-soft); color: var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-weight: 600; }
.sos a { color: var(--coral); font-weight: 800; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.card { background: var(--surface); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.band { position: relative; background: var(--brand); color: var(--brand-ink); padding: 22px; display: grid; gap: 6px; overflow: hidden; }
.card.with-photo .band { padding-bottom: 68px; }
.band::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%); }
.band .eyebrow { color: var(--sun); }
.band h1 { font: 800 clamp(26px, 7vw, 32px)/1.08 var(--display); letter-spacing: -0.02em; position: relative; }
.band p { opacity: .9; font-size: 15px; position: relative; }
.band .tl { font-size: 13px; opacity: .8; font-style: italic; }
.who-block { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 0 20px 20px; margin-top: -52px; position: relative; }
.photo { width: 120px; height: 120px; border-radius: 50%; background: var(--brand-soft); overflow: hidden; display: grid; place-items: center; box-shadow: 0 0 0 5px var(--surface), 0 0 0 9px var(--sun), var(--shadow-lg); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo svg { width: 64px; height: 64px; fill: var(--brand-2); }
.who-text { min-width: 0; display: grid; gap: 2px; justify-items: center; }
.name { font: 800 28px/1.1 var(--display); margin: 6px 0 0; overflow-wrap: anywhere; letter-spacing: -0.02em; }
.nick { color: var(--muted); font-size: 15px; }
.section { padding: 0 20px 20px; display: grid; gap: 12px; }
.section h2 { font: 700 18px/1.2 var(--display); display: flex; align-items: center; gap: 8px; }
.section h2 .icon { color: var(--brand-2); }
.parent { border: 1px solid var(--line); background: var(--surface-2); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.parent-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.parent-name { font-weight: 700; font-size: 17px; }
.role { font-size: 12px; font-weight: 700; color: var(--brand-2); background: var(--brand-soft); padding: 2px 9px; border-radius: 99px; }
.num { font: 700 24px var(--body); font-variant-numeric: tabular-nums; letter-spacing: .02em; user-select: all; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btns .btn:first-child { grid-column: 1 / -1; padding: 15px; font-size: 18px; }
dl { margin: 0; }
.row { display: grid; grid-template-columns: 100px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
dt { color: var(--muted); font-size: 14px; font-weight: 600; }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.health { background: var(--coral-soft); border-radius: 14px; padding: 12px 14px; display: grid; gap: 4px; }
.health b { font-family: var(--display); color: var(--coral); display: flex; gap: 6px; align-items: center; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.steps li::marker { font-weight: 800; color: var(--brand-2); }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin: 0; }
.state { padding: 40px 22px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.state svg.art { width: 140px; height: auto; }
@media (max-width: 360px) { .row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Demo mode bar ---------- */
.demo-bar { background: #20160a; color: #fff3d6; font-size: 13px; line-height: 1.45; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.demo-bar b { color: #ffc34d; }
.demo-bar button { margin-left: auto; background: #ffc34d; color: #2a1d00; border: 0; border-radius: 8px; padding: 5px 10px; font: 600 13px var(--body); cursor: pointer; }

@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; padding: 0 !important; }
  #printArea .print-head { display: none !important; }
  .sheet-print { display: block; gap: 0; }
  .sheet-print img { border: 0; border-radius: 0; max-width: none; display: block; page-break-after: always; break-after: page; }
  .sheet-print img:last-child { page-break-after: auto; break-after: auto; }
  .pkg-sheet { gap: 3mm; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Parent photos */
.kphoto-sm { width: 60px; height: 60px; font-size: 18px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line-2); }
.kphoto-sm svg { width: 30px; height: 30px; fill: var(--brand-2); }
.pp-ctl { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pphoto { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: none; background: var(--brand-soft); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--sun); }
.pphoto img { width: 100%; height: 100%; object-fit: cover; }
.parent-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.parent-head .parent-top { flex: 1; min-width: 0; }
.verify { background: var(--brand-soft); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; }
.verify b { font-family: var(--display); display: flex; gap: 8px; align-items: center; color: var(--brand-2); }
.verify ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 15px; }

/* ---------- v8: safe place, family, poster, renewals ---------- */
.safe-btns { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .safe-btns { grid-template-columns: 1fr; } }
.safe-btns .btn { justify-content: center; }
.renew-banner { background: var(--sun-soft); border: 1px solid var(--sun); border-radius: 16px; padding: 14px 16px; display: grid; gap: 6px; margin: 0 0 18px; }
.renew-banner.bad { background: var(--coral-soft); border-color: var(--coral); }
.renew-banner p { margin: 0; }
.kshared { font-size: 12px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.tag-exp { display: block; font-size: 12px; color: var(--muted); flex-basis: 100%; padding-left: 30px; }
.tag-exp.warn { color: var(--warn); font-weight: 600; }
.tag-exp.bad { color: var(--bad); font-weight: 600; }
.fam-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fam-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.fam-list .who-e { overflow-wrap: anywhere; }
.invite-box { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--brand-soft); }
.invite-code { font: 800 22px/1.2 "Bricolage Grotesque", system-ui, sans-serif; letter-spacing: .06em; }
.poster-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 720px) { .poster-layout { grid-template-columns: 1fr; } }
.poster-preview canvas { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* ---------- Chat (finder <-> parents) ---------- */
.chat { display: grid; gap: 10px; }
.chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 360px; min-height: 120px; overflow-y: auto; background: var(--bg-2); border-radius: var(--r); padding: 12px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.bubble .who { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble .text { white-space: pre-wrap; }
.bubble .loc { font-size: 13px; font-weight: 600; }
.bubble.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.bubble.me .who { color: rgba(255,255,255,.78); }
.bubble.me a { color: var(--brand-ink); }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.them a { color: var(--brand); }
.chat-send { display: grid; gap: 8px; }
.chat-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.chat-closed { text-align: center; font-size: 14px; color: var(--muted); background: var(--bg-2); border-radius: 10px; padding: 10px; }
.chat-list { display: grid; gap: 8px; margin-bottom: 8px; }
.chat-item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; font: inherit; }
.chat-item:hover { border-color: var(--brand); }
.chat-item:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.chat-item.unread { border-left: 5px solid var(--sun); }
.chat-item .ci-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-item .ci-prev { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .ci-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { background: var(--sun); color: var(--sun-ink); border-radius: 99px; min-width: 24px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
