/* =========================================================
   You Are Loved — Fear Not Foundation
   Clickable mockup · mobile-first PWA
   ========================================================= */

:root {
  /* Brand */
  --teal:        #20808D;
  --teal-deep:   #0F2A2E;
  --teal-2:      #1B474D;
  --gold:        #FFC553;
  --gold-2:      #E8AF34;
  --terra:       #A84B2F;
  --rose:        #C26A7A;

  /* Surfaces */
  --bg:          #F7F6F2;
  --surface:     #FFFFFF;
  --surface-2:   #F9F8F5;
  --line:        #E5E2DA;
  --line-2:      #D4D1CA;

  /* Text */
  --ink:         #1A1815;
  --ink-2:       #3A3833;
  --muted:       #7A7974;
  --faint:       #BAB9B4;

  /* Semantic */
  --ok:          #2F8F47;
  --warn:        #C77A1F;
  --bad:         #B23A3A;

  /* Type */
  --font-display: 'Clash Display', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    'Satoshi', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,42,46,0.06), 0 1px 3px rgba(15,42,46,0.04);
  --shadow-md: 0 6px 18px rgba(15,42,46,0.08);
  --shadow-lg: 0 24px 60px rgba(15,42,46,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 20% -10%, #E8F0EF 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 0%, #FBEFD8 0%, transparent 55%),
    var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }

/* =====================================================
   STAGE (desktop wrapper) — disappears on mobile widths
   ===================================================== */

.stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 56px) clamp(12px, 3vw, 32px) 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-areas:
    "tabs tabs"
    "note note"
    "phone side";
  gap: 28px 32px;
  align-items: start;
}

.stage-tabs {
  grid-area: tabs;
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  justify-self: center;
  box-shadow: var(--shadow-sm);
}
.stage-tab {
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  transition: background .18s ease, color .18s ease;
}
.stage-tab:hover { background: var(--surface-2); }
.stage-tab.is-active {
  background: var(--teal-deep);
  color: #fff;
}

.stage-note {
  grid-area: note;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  max-width: 640px;
  justify-self: center;
}

.stage-side {
  grid-area: side;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 24px;
}
.stage-side h3 {
  font-size: 13px;
  font-family: var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 12px;
}
.stage-side h3 + ul + h3 { margin-top: 22px; }
.stage-side ul li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.stage-side ul li:last-child { border-bottom: 0; }
.stage-side ul li strong { color: var(--ink); }
.stage-side-foot {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 18px;
  line-height: 1.5;
}

/* =====================================================
   PHONE FRAME
   ===================================================== */

.phone {
  grid-area: phone;
  width: 100%;
  max-width: 420px;
  justify-self: center;
  aspect-ratio: 9 / 19.5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 44px;
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 8px #0F2A2E,
    inset 0 0 0 9px #1B474D;
  overflow: hidden;
  position: relative;
}

.phone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 26px;
  background: #0F2A2E;
  border-radius: 999px;
  z-index: 10;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  padding-top: 52px;            /* notch clearance */
  padding-bottom: 84px;         /* bottom nav clearance (volunteer view) */
  -webkit-overflow-scrolling: touch;
}
.view.is-active { display: block; }
.view::-webkit-scrollbar { width: 0; height: 0; }

/* =====================================================
   VIEW 1 — VOLUNTEER
   ===================================================== */

.v-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
}
.v-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--teal-deep);
}
.logo-mark { width: 30px; height: 30px; color: var(--teal); flex: 0 0 30px; }
.v-brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
}
.v-brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}
.v-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--teal-deep);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.v-hero {
  margin: 8px 18px 18px;
  background: linear-gradient(155deg, var(--teal-deep) 0%, var(--teal-2) 70%, var(--teal) 130%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.v-hero::after {
  content: "";
  position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  opacity: 0.18;
  right: -60px; top: -60px;
  pointer-events: none;
}
.v-hero-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  opacity: 0.7;
  text-transform: uppercase;
}
.v-hero-counter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 6px 0 14px;
  font-variant-numeric: tabular-nums;
}
.v-hero-progress {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
}
.v-hero-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}
.v-hero-meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  margin-top: 10px;
  opacity: 0.92;
}
.v-hero-meta strong { color: var(--gold); }
.v-hero-meta .dot { opacity: 0.45; }

.v-action {
  margin: 0 18px 16px;
  text-align: center;
}
.v-log-btn {
  width: 100%;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  padding: 18px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(32,128,141,0.25);
  transition: transform .12s ease, box-shadow .2s ease;
}
.v-log-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(32,128,141,0.32); }
.v-log-btn:active { transform: translateY(0); }
.v-action-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.v-stats { margin: 0 18px 18px; }
.v-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
}
.v-stat { text-align: center; padding: 4px; }
.v-stat-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
}
.v-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.v-streak {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
  background: #FFF6E1;
  border: 1px solid #F2DCAE;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.v-streak-flame {
  color: var(--terra);
  font-size: 12px;
  width: 18px; height: 18px;
  display: inline-grid; place-items: center;
  background: #FCE5D9;
  border-radius: 50%;
}
.v-streak strong { color: var(--ink); }

.v-feed { margin: 0 18px 8px; }
.v-feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.v-feed-head h2 {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.v-feed-link {
  font-size: 12px;
  color: var(--teal);
  text-decoration: none;
}
.v-feed-list { display: flex; flex-direction: column; gap: 6px; }
.v-feed-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.v-feed-thumb {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.v-feed-thumb[data-type="card"] { background: #E8F0EF; border-color: #C8DDDC; }
.v-feed-thumb[data-type="gift"] { background: #FFF1D6; border-color: #F2DCAE; }
.v-feed-thumb[data-type="both"] { background: #F7E5EB; border-color: #E6CFD8; }

.v-feed-title { font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.25; }
.v-feed-sub   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.v-feed-badge {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}
.v-feed-badge.ok {
  color: var(--ok);
  background: #E6F3E9;
}

/* Bottom nav */
.v-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 8px 18px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  z-index: 5;
}
.v-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 10.5px;
  padding: 4px;
}
.v-nav-item.is-active { color: var(--teal); }
.v-nav-item.is-active span { font-weight: 600; }
.v-nav-fab {
  background: var(--teal);
  color: #fff !important;
  width: 52px; height: 52px;
  border-radius: 50%;
  align-self: center;
  margin-top: -22px;
  box-shadow: 0 6px 16px rgba(32,128,141,0.35);
}
.v-nav-fab svg { width: 26px; height: 26px; }

/* =====================================================
   LOG MODAL (volunteer flow)
   ===================================================== */

.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,42,46,0.55);
  backdrop-filter: blur(4px);
}
.modal-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  max-height: 92%;
  overflow-y: auto;
  background: var(--surface);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 12px 20px 28px;
  animation: sheetIn .32s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-head {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0 16px;
}
.modal-back {
  width: 32px; height: 32px;
  background: var(--surface-2);
  border-radius: 50%;
  font-size: 18px;
  color: var(--ink);
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  text-align: center;
}
.modal-step {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.modal-step-body[hidden] { display: none; }
.modal-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 16px;
  line-height: 1.45;
}
.modal-hint strong { color: var(--ink); }

.cam-frame {
  background: linear-gradient(135deg, #0F2A2E 0%, #1B474D 100%);
  color: rgba(255,255,255,0.7);
  border-radius: var(--r-md);
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255,255,255,0.18);
}
.cam-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.cam-placeholder svg { opacity: 0.7; }

.btn-primary {
  display: block;
  width: 100%;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  padding: 14px;
  margin-top: 14px;
  border-radius: var(--r-md);
  transition: transform .12s ease, box-shadow .2s ease;
}
.btn-primary:hover { box-shadow: 0 10px 24px rgba(32,128,141,0.28); transform: translateY(-1px); }

.btn-ghost {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  padding: 10px;
  margin-top: 4px;
}
.btn-ghost:hover { color: var(--ink); }

.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 14px 0 6px;
}
.field-opt { text-transform: none; letter-spacing: 0; color: var(--faint); margin-left: 4px; }
.field-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.field-input:focus { border-color: var(--teal); background: #fff; }
textarea.field-input { resize: vertical; min-height: 60px; }

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px;
}
.seg-opt {
  padding: 10px 6px;
  font-size: 13px;
  border-radius: 8px;
  color: var(--ink-2);
  font-weight: 500;
}
.seg-opt.is-active {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 1px 4px rgba(15,42,46,0.08);
  font-weight: 600;
}

.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.stepper-btn {
  font-size: 22px;
  color: var(--teal);
  font-weight: 600;
}
.stepper-btn:hover { background: rgba(32,128,141,0.08); }
.stepper-num {
  border: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  outline: none;
}

.auto-meta {
  margin-top: 16px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.auto-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.auto-meta-row:last-child { border-bottom: 0; }
.auto-meta-row span { color: var(--muted); }
.auto-meta-row strong { color: var(--ink-2); font-weight: 500; }

.confirm-card { text-align: center; padding: 12px 4px; }
.confirm-emoji { font-size: 44px; }
.confirm-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-top: 6px;
  color: var(--ink);
}
.confirm-sub { font-size: 13px; color: var(--muted); margin: 6px 0 16px; }
.confirm-counter {
  background: var(--teal-deep);
  color: #fff;
  border-radius: var(--r-md);
  padding: 18px;
  margin-bottom: 18px;
}
.confirm-counter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
.confirm-counter-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* =====================================================
   VIEW 2 — PUBLIC DASHBOARD
   ===================================================== */

.p-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
}
.p-cta {
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
}

.p-hero {
  margin: 6px 18px 16px;
  text-align: center;
  background: linear-gradient(160deg, var(--teal-deep) 0%, var(--teal-2) 80%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 24px 18px;
  position: relative;
  overflow: hidden;
}
.p-hero::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  opacity: 0.16;
  left: -100px; bottom: -120px;
  pointer-events: none;
}
.p-hero-label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  opacity: 0.7;
  text-transform: uppercase;
}
.p-hero-counter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 56px;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 8px 0 12px;
  font-variant-numeric: tabular-nums;
}
.p-hero-meta {
  font-size: 12.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.p-hero-meta .dot { opacity: 0.4; }
.p-hero-meta strong { color: var(--gold); }
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(255,197,83,0.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,197,83,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(255,197,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,197,83,0); }
}
.p-hero-bar {
  height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
}
.p-hero-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  border-radius: 999px;
}

.p-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 18px 16px;
}
.p-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 10px;
  text-align: center;
}
.p-kpi-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--teal);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.p-kpi-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.p-card {
  margin: 0 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}
.p-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.p-card-head h2 {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.p-card-sub {
  font-size: 10.5px;
  color: var(--muted);
  text-align: right;
  flex: 1 1 auto;
}

.p-map {
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  background: var(--teal-deep);
}
.p-map-svg { display: block; width: 100%; height: auto; }
.map-label {
  font-family: var(--font-body);
  font-size: 9px;
  fill: rgba(255,255,255,0.85);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.map-dot circle:nth-child(1) {
  animation: ripple 3.6s ease-out infinite;
  transform-origin: center;
}
.map-dot:nth-of-type(2) circle:nth-child(1) { animation-delay: 0.5s; }
.map-dot:nth-of-type(3) circle:nth-child(1) { animation-delay: 1.0s; }
.map-dot:nth-of-type(4) circle:nth-child(1) { animation-delay: 1.5s; }
@keyframes ripple {
  0%   { opacity: 0.25; transform: scale(0.95); }
  60%  { opacity: 0; transform: scale(1.15); }
  100% { opacity: 0; }
}

.p-rank { display: flex; flex-direction: column; gap: 8px; }
.p-rank-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--line);
}
.p-rank-item:last-child { border-bottom: 0; }
.p-rank-rank {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--teal);
  text-align: center;
}
.p-rank-name { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.p-rank-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.p-rank-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.p-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.p-tile {
  margin: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.p-tile figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px 12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7));
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
}
.p-tile figcaption strong { font-size: 12.5px; font-weight: 600; }
.p-tile figcaption span { opacity: 0.85; font-size: 10.5px; }
.p-tile-art {
  position: absolute; inset: 0;
}
/* Stylized art for each gallery tile (no faces, no recipients) */
.p-art-cards {
  background:
    radial-gradient(circle at 30% 30%, rgba(255,197,83,0.4) 0%, transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(32,128,141,0.4) 0%, transparent 40%),
    repeating-linear-gradient(135deg, #FFF6E1 0 18px, #F2DCAE 18px 22px),
    #FFE7B8;
}
.p-art-porch {
  background:
    linear-gradient(180deg, #C2D8D5 0%, #95B5B3 60%, #5E8784 100%),
    #95B5B3;
  position: relative;
}
.p-art-porch::after {
  content: "";
  position: absolute;
  inset: 35% 20% 25% 20%;
  background:
    linear-gradient(180deg, #A84B2F 0%, #6E331F 100%);
  border-radius: 4px;
}
.p-art-kids {
  background:
    radial-gradient(circle at 50% 60%, #FFC553 0%, transparent 50%),
    radial-gradient(circle at 30% 30%, #C26A7A 0%, transparent 40%),
    radial-gradient(circle at 80% 40%, #20808D 0%, transparent 40%),
    #F7E5EB;
}
.p-art-boxes {
  background:
    repeating-linear-gradient(0deg, #B57A3A 0 28px, #C8884A 28px 30px),
    #B57A3A;
  position: relative;
}
.p-art-boxes::before {
  content: "";
  position: absolute;
  inset: 45% 12% 12% 12%;
  background: #FFC553;
  opacity: 0.85;
}

.p-ticker { display: flex; flex-direction: column; gap: 6px; }
.p-ticker li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.p-ticker li:last-child { border-bottom: 0; }
.tick-dot {
  width: 8px; height: 8px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(47,143,71,0.18);
}
.tick-time { color: var(--muted); font-size: 11.5px; min-width: 56px; }

.p-foot {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin: 0 18px 28px;
}
.p-foot-sub { margin-top: 4px; opacity: 0.8; }

/* =====================================================
   VIEW 3 — ADMIN
   ===================================================== */

.a-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
}
.a-export {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
}

.a-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 18px 16px;
}
.a-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
}
.a-kpi-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.a-kpi-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.025em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.a-kpi-num.warn { color: var(--warn); }
.a-kpi-num.ok { color: var(--ok); }
.a-kpi-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.a-card {
  margin: 0 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
}
.a-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.a-card-head h2 { font-size: 14px; }
.a-tabs { display: flex; gap: 4px; }
.a-tab {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
}
.a-tab.is-active { background: var(--teal-deep); color: #fff; }

.a-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px;
  padding: 0 14px;
}
.a-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.a-table th {
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.a-table td {
  padding: 8px 6px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }

.pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 999px;
}
.pill-card { background: #E8F0EF; color: var(--teal-2); }
.pill-gift { background: #FFF1D6; color: #8A6720; }
.pill-both { background: #F7E5EB; color: #87425A; }
.pill-ok   { background: #E6F3E9; color: var(--ok); }
.pill-warm { background: #FFF1D6; color: var(--warn); }
.pill-cold { background: var(--surface-2); color: var(--muted); }

.flag {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.flag.ok   { background: #E6F3E9; color: var(--ok); }
.flag.warn { background: #FFEFD2; color: var(--warn); }
.flag.bad  { background: #FCE4E4; color: var(--bad); }

.a-act {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.a-act:hover { background: var(--line); }
.a-act.ok  { background: var(--ok); color: #fff; }
.a-act.ok:hover { background: #1E6E33; }
.a-act.bad { background: var(--bad); color: #fff; }
.a-act.bad:hover { background: #8E2A2A; }

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 880px) {
  .stage {
    grid-template-columns: 1fr;
    grid-template-areas:
      "tabs"
      "note"
      "phone"
      "side";
    padding: 20px 14px 60px;
    gap: 20px;
  }
  .stage-side { position: static; }
  .phone {
    aspect-ratio: auto;
    height: min(85dvh, 760px);
    border-radius: 36px;
  }
}

@media (max-width: 540px) {
  .stage { padding: 12px 0 60px; gap: 14px; }
  .stage-tabs { border-radius: 16px; margin: 0 12px; }
  .stage-note { padding: 0 16px; }
  .phone {
    max-width: 100%;
    border-radius: 0;
    aspect-ratio: auto;
    height: 100dvh;
    box-shadow: none;
    border-left: 0; border-right: 0;
  }
  .phone-notch { display: none; }
  .view { padding-top: 8px; }
  .stage-side { margin: 0 12px; }
}

/* =====================================================
   PILOT MODE — patient-zero overrides + new components
   ===================================================== */

/* Stage-note: pilot chip */
.stage-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pilot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--teal-deep);
  color: var(--gold);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid rgba(255, 197, 83, 0.35);
}

/* Hero counter — pilot fractional display */
.v-hero-of {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.45em;
  color: rgba(255, 255, 255, 0.55);
  margin-left: 8px;
  letter-spacing: 0;
}

/* Up-next card */
.v-upnext {
  margin: 0 18px 14px;
  padding: 14px 16px;
  background: #FFFBED;
  border: 1px solid rgba(232, 175, 52, 0.45);
  border-left: 3px solid var(--gold-2);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.v-upnext-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warn);
}
.v-upnext-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.3;
}
.v-upnext-meta {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* Stat-of (the /3, /12 suffix) */
.v-stat-of {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.55em;
  color: var(--muted);
  margin-left: 2px;
  letter-spacing: 0;
}

/* Feed mini-sub */
.v-feed-sub-mini {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* The 12 timeline */
.v-twelve {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 24px;
}
.v-twelve-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: background 0.15s ease;
}
.v-twelve-item.is-next {
  background: linear-gradient(135deg, #F0F7F6 0%, #FFFBED 100%);
  border-color: rgba(32, 128, 141, 0.35);
  box-shadow: 0 2px 8px rgba(32, 128, 141, 0.08);
}
.v-twelve-item.is-empty {
  background: var(--surface-2);
  opacity: 0.92;
}
.v-twelve-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--teal);
  text-align: center;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.v-twelve-item.is-empty .v-twelve-num {
  color: var(--faint);
}
.v-twelve-body { min-width: 0; }
.v-twelve-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 2px;
}
.v-twelve-title.muted { color: var(--ink-2); font-weight: 500; }
.v-twelve-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.v-twelve-state {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
}
.v-twelve-state.next {
  color: var(--teal-deep);
  background: var(--gold);
}

/* Confirm counter — fractional */
.confirm-counter-of {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.5em;
  color: rgba(255, 255, 255, 0.5);
  margin-left: 6px;
}

/* Side rail — pilot brief */
.side-stamp {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--gold-2);
  padding: 4px 9px;
  border: 1.5px solid var(--gold-2);
  border-radius: 4px;
  margin-bottom: 12px;
  transform: rotate(-1deg);
}
.side-lead {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 18px;
}
.side-week {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 18px;
}
.side-week li {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
  padding-left: 0;
}
.side-week li::before { content: none; }
.side-week li strong {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 32px;
}
.side-strip li {
  font-size: 12.5px;
  color: var(--muted);
}

/* Seg control — handle 6 options (wraps to 2 rows on phone) */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.seg-opt {
  padding: 10px 6px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Pilot fractional num: keep on one line */
.v-stat-num { white-space: nowrap; }
.v-hero-counter { white-space: nowrap; }
.confirm-counter-num { white-space: nowrap; }

/* Hero counter pilot mode: keep "0" big, "/12" muted */
.v-hero-counter {
  font-size: 72px;
  letter-spacing: -0.04em;
}
.v-hero-of {
  font-size: 0.4em;
  margin-left: 12px;
  vertical-align: 0.15em;
}


/* ============================================================
   PWA Pilot v3 — camera preview, story prompt step, The Week
   ============================================================ */

/* --- Camera capture (real photo) ---------------------------- */
.cam-frame {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.cam-frame:active { transform: scale(0.99); }
.cam-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.cam-frame.no-photo {
  background: linear-gradient(135deg, #F2EDE3 0%, #E9E2D3 100%);
}
.cam-skipped {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #3A4F53;
  text-align: center;
  padding: 10px;
}
.cam-skipped-emoji {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 4px;
}
.cam-skipped-sub {
  font-size: 12.5px;
  color: #6E7B7E;
  margin-top: 2px;
}

/* --- Story prompt step --- */
.prompt-card {
  background: linear-gradient(180deg, #F8F4EA 0%, #F2ECDC 100%);
  border: 1px solid rgba(15, 42, 46, 0.08);
  border-radius: 16px;
  padding: 20px 18px 16px;
  margin-bottom: 12px;
}
.prompt-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8B6A1A;
  font-weight: 600;
  margin-bottom: 8px;
}
.prompt-q {
  font-family: 'Clash Display', 'Satoshi', system-ui, sans-serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.25;
  color: #0F2A2E;
  margin: 0 0 14px;
}
.prompt-input {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(15, 42, 46, 0.12);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.4;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}
.prompt-input:focus {
  outline: none;
  border-color: #20808D;
  box-shadow: 0 0 0 3px rgba(32, 128, 141, 0.15);
}
.prompt-sub {
  font-size: 12.5px;
  color: #6E7B7E;
  margin: 10px 2px 0;
  line-height: 1.4;
}

/* --- The Twelve: done state --- */
.v-twelve-num.done {
  background: #1B474D;
  color: #FFC553;
  border-color: #1B474D;
}
.v-twelve-state.done {
  color: #1B474D;
  font-weight: 600;
}
.v-twelve-item.is-done .v-twelve-title { color: #0F2A2E; }
.v-twelve-item.is-done .v-twelve-sub { color: #6E7B7E; }

/* --- Feed actions: "The week →" --- */
.v-feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.v-feed-actions {
  display: flex;
  gap: 8px;
}
.v-feed-action {
  appearance: none;
  background: transparent;
  border: 0;
  color: #20808D;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  font-family: inherit;
}
.v-feed-action:active { opacity: 0.7; }

/* --- The Week modal --- */
.week-sheet { padding-bottom: 40px; }
.modal-export {
  appearance: none;
  background: #FFC553;
  border: 0;
  color: #0F2A2E;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.modal-export:active { transform: scale(0.97); }

.week-body {
  padding: 4px 18px 80px;
  max-height: calc(100% - 60px);
  overflow-y: auto;
}
.week-empty {
  text-align: center;
  padding: 60px 20px;
  color: #6E7B7E;
}
.week-empty-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 16px;
}
.week-empty h3 {
  font-family: 'Clash Display', sans-serif;
  font-size: 22px;
  color: #0F2A2E;
  margin: 0 0 6px;
}
.week-empty p {
  font-size: 14.5px;
  margin: 0;
}

.week-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.week-item {
  display: grid;
  grid-template-columns: 32px 84px 1fr;
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  background: #fff;
  border: 1px solid rgba(15, 42, 46, 0.08);
  border-radius: 14px;
}
.week-item-num {
  font-family: 'Clash Display', sans-serif;
  font-weight: 700;
  color: #20808D;
  font-size: 20px;
  line-height: 1;
  align-self: start;
  padding-top: 4px;
}
.week-item-photo {
  width: 84px;
  height: 84px;
  background: #F2EDE3;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.week-item-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.week-item-photo.is-empty {
  background: linear-gradient(135deg, #F2EDE3, #E9E2D3);
}
.week-item-photo-empty {
  font-size: 22px;
  text-align: center;
  color: #6E7B7E;
  line-height: 1.3;
}
.week-item-photo-empty span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}
.week-item-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.week-item-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.week-item-head strong {
  font-size: 14.5px;
  color: #0F2A2E;
  line-height: 1.25;
}
.week-item-time {
  font-size: 11.5px;
  color: #6E7B7E;
}
.week-item-story {
  font-size: 13.5px;
  line-height: 1.45;
  color: #0F2A2E;
  margin: 4px 0 0;
}
.week-item-prompt {
  font-size: 13px;
  line-height: 1.4;
  color: #3A4F53;
  background: #F8F4EA;
  border-left: 3px solid #FFC553;
  padding: 6px 10px;
  margin: 4px 0 0;
  border-radius: 4px;
}
.week-item-prompt em {
  color: #8B6A1A;
  font-style: italic;
  font-size: 12px;
}
.week-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}
.week-item-count,
.week-item-loc,
.week-item-noflag {
  font-size: 11.5px;
  color: #6E7B7E;
}
.week-item-noflag {
  background: #F2EDE3;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* ============================================================
   PWA MOBILE LOCKDOWN — real-app feel on iPhone
   Hide all desktop "preview" chrome (tabs, side panel, phone frame)
   when running on a phone or in standalone (home-screen) mode.
   ============================================================ */

@media (max-width: 640px), (display-mode: standalone), (display-mode: fullscreen) {
  html, body {
    background: #F7F6F2;
    height: 100%;
    overflow-x: hidden;
  }
  body {
    /* Respect iOS safe areas (notch, home indicator) */
    padding: 0;
    margin: 0;
  }
  .stage {
    padding: 0;
    gap: 0;
    background: transparent;
    min-height: 100dvh;
  }
  /* Hide the desktop-only preview chrome entirely */
  .stage-tabs,
  .stage-note,
  .stage-side,
  .phone-notch {
    display: none !important;
  }
  /* Hide the non-volunteer views — pilot is only the Volunteer flow */
  .view-public,
  .view-admin {
    display: none !important;
  }
  /* The "phone frame" becomes the whole page */
  .phone {
    max-width: 100% !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    aspect-ratio: auto !important;
    overflow: hidden;
    background: #F7F6F2;
  }
  .view {
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
  }
  .v-topbar {
    padding-top: calc(12px + env(safe-area-inset-top, 0));
  }
  .v-nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  }
  /* Modal sheets go truly fullscreen on phone */
  .modal-sheet {
    border-radius: 18px 18px 0 0;
    max-height: 92dvh;
  }
}

/* ============================================================
   Save toast — confirmation Kevin can actually see
   ============================================================ */
.fn-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 120%);
  background: #0F2A2E;
  color: #FFC553;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(15, 42, 46, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(.2,.7,.2,1), opacity 0.28s;
  z-index: 9999;
  max-width: calc(100% - 32px);
  text-align: center;
}
.fn-toast.is-on {
  transform: translate(-50%, 0);
  opacity: 1;
}
.fn-toast.is-error {
  background: #7A1F1F;
  color: #FFE4B0;
}
