@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* Light theme (default). theme.js sets data-theme on <html> before the first paint. */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f4efe7;
  --text: #1f2430;
  --muted: #6b6f7a;
  --border: #ece5da;
  --peach: #ffd8c4;
  --mint: #c9f0e4;
  --sun: #fde8b4;
  --rose: #f9d4e0;
  --primary: #08806b;
  --primary-ink: #ffffff;
  --primary-soft: #e0f4ef;
  --accent: #f0a53a;
  --accent-soft: #fdf0d8;
  --danger: #c0392b;
  --danger-soft: #fde9e6;
  --success: #23804a;
  --success-soft: #e3f5e8;
  --info: #2a62b8;
  --info-soft: #e6effc;
  --warn: #8f5b06;
  --warn-soft: #fdf0d8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .04), 0 8px 24px rgba(20, 30, 40, .07);
  --shadow-lg: 0 18px 50px rgba(20, 30, 40, .18);
  --hearts: .07;
  --max: 1080px;
  /* Phone notches and the Android status bar: Capacitor sets --safe-area-inset-*, browsers use env(). */
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}

/* Dark theme: deep navy with teal light, easy on the eyes at night. */
:root[data-theme="dark"] {
  --bg: #0e1621;
  --surface: #142030;
  --surface-2: #1b2a3d;
  --text: #e9eef5;
  --muted: #9fb0c3;
  --border: #24364b;
  --peach: #3b2534;
  --mint: #0f3a3b;
  --sun: #2c2a1a;
  --rose: #3a1f33;
  --primary: #34d3b4;
  --primary-ink: #052620;
  --primary-soft: #12363a;
  --accent: #fbbf4d;
  --accent-soft: #33290f;
  --danger: #ff8a80;
  --danger-soft: #3a1d22;
  --success: #6ee7a0;
  --success-soft: #123224;
  --info: #8cc1ff;
  --info-soft: #172a44;
  --warn: #fcd078;
  --warn-soft: #33290f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  --hearts: .05;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* Elements hidden from script stay hidden even when a class gives them display: flex or grid. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Soft, warm glow: peach, mint and sunlight washes over cream. */
  background-color: var(--bg);
  background-image:
    radial-gradient(42rem 32rem at 100% -5%, color-mix(in srgb, var(--peach) 75%, transparent), transparent 70%),
    radial-gradient(36rem 30rem at -10% 30%, color-mix(in srgb, var(--mint) 70%, transparent), transparent 70%),
    radial-gradient(40rem 30rem at 80% 105%, color-mix(in srgb, var(--sun) 70%, transparent), transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
  padding-top: var(--safe-top);
  overflow-x: clip; /* pop-ups near the edge never cause sideways scrolling */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
/* Faint scattered hearts, like a hand-drawn wallpaper. */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: var(--hearts);
  background-image: url("/img/hearts.svg");
}
h1, h2, h3 { line-height: 1.45; margin: 0 0 .5rem; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .02em; }
.grow { flex: 1; min-width: 0; }
.end { text-align: left; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.mb { margin-bottom: 1rem; }

.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.icon svg { width: 100%; height: 100%; }

/* Shell */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }

.demo-banner {
  background: var(--accent-soft); color: var(--warn); text-align: center; font-size: .78rem; line-height: 1.6;
  padding: .35rem 1rem; display: flex; gap: .4rem; justify-content: center; align-items: center;
}
.topbar {
  position: sticky; top: var(--safe-top); z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .65rem max(1rem, calc((100vw - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 900; font-size: 1.2rem; color: var(--text); }
.brand img { border-radius: 10px; }
.topnav { display: none; gap: .25rem; margin-inline-start: 1rem; }
.topnav a { color: var(--muted); padding: .35rem .8rem; border-radius: 999px; font-weight: 600; font-size: .92rem; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: var(--primary); background: var(--primary-soft); }
.header-actions { margin-inline-start: auto; display: flex; gap: .5rem; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 1.1rem; flex: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.4rem; }

main { max-width: var(--max); margin: 0 auto; padding: 1.25rem 1rem 6.5rem; outline: none; }
main:focus, main:focus-visible { outline: none; } /* focused only to move screen readers to the new page */
.page { animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--border); padding: .3rem .25rem calc(.3rem + var(--safe-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: .1rem; color: var(--muted); font-size: .7rem; font-weight: 600; padding: .3rem 0; border-radius: 10px; }
.tabbar a .icon { font-size: 1.35rem; }
.tabbar a.active { color: var(--primary); }
.tabbar a[data-tab="new"] .icon { background: var(--primary); color: var(--primary-ink); border-radius: 12px; width: 2.1rem; height: 2.1rem; padding: .4rem; margin-top: -.2rem; }

.footer { max-width: var(--max); margin: 0 auto; padding: 2rem 1rem 7rem; color: var(--muted); font-size: .85rem; display: grid; gap: .5rem; border-top: 1px solid var(--border); }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  main { padding-bottom: 3rem; }
  .footer { padding-bottom: 2rem; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .5rem 1.15rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer;
  transition: transform .12s, background .15s, box-shadow .15s; text-align: center;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-sm { min-height: 36px; padding: .3rem .85rem; font-size: .88rem; }
.btn-lg { min-height: 52px; padding: .7rem 1.5rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--primary-ink) transparent var(--primary-ink) transparent; animation: spin .7s linear infinite; }
.btn-ghost.loading::after, .btn-danger-ghost.loading::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--primary); cursor: pointer; font-weight: 600; padding: 0; }

/* Cards & layout */
.card { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid .card { margin: 0; }
.stack > * { margin-bottom: 1rem; }
.page-head { margin: .5rem 0 1.25rem; }
.page-head p { max-width: 60ch; }
.section { margin: 2.25rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.section-head a { display: flex; align-items: center; gap: .3rem; font-weight: 600; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.row-gap { display: flex; gap: .75rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); margin-bottom: .75rem; font-weight: 600; font-size: .92rem; }
.two-col { display: grid; gap: 0 1rem; }
@media (min-width: 600px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* Hero */
.hero { display: grid; gap: 2rem; align-items: center; padding: 1.5rem 0 1rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .4rem; background: var(--primary-soft); color: var(--primary); padding: .25rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.hero h1 { font-size: clamp(1.85rem, 5.5vw, 2.9rem); line-height: 1.35; margin: 1rem 0; font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--primary); background: linear-gradient(transparent 62%, var(--accent-soft) 62%); }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-art { position: relative; height: 260px; }
.bill-card {
  position: absolute; display: flex; align-items: center; gap: .8rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: .85rem 1.1rem; box-shadow: var(--shadow); min-width: 210px; animation: float 5s ease-in-out infinite;
}
.bill-card > .icon:first-child { width: 2.4rem; height: 2.4rem; padding: .5rem; border-radius: 12px; }
.bill-card div { display: flex; flex-direction: column; line-height: 1.5; }
.bill-card small { color: var(--muted); }
.bill-card .ok { color: var(--success); margin-inline-start: auto; }
.bill-1 { top: 10px; inset-inline-start: 4%; }
.bill-1 > .icon:first-child { background: var(--accent-soft); color: var(--warn); }
.bill-2 { top: 95px; inset-inline-end: 2%; animation-delay: -1.6s; }
.bill-2 > .icon:first-child { background: var(--danger-soft); color: var(--danger); }
.bill-3 { top: 180px; inset-inline-start: 14%; animation-delay: -3.2s; }
.bill-3 > .icon:first-child { background: var(--info-soft); color: var(--info); }
@keyframes float { 50% { transform: translateY(-8px); } }
@media (min-width: 860px) { .hero { grid-template-columns: 1.2fr 1fr; padding: 3rem 0 2rem; } .hero-art { height: 300px; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin: 1rem 0; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.stat strong { font-size: 1.25rem; font-weight: 900; color: var(--primary); }
.stat span { color: var(--muted); font-size: .85rem; }

.steps { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem; position: relative; }
.step::before { counter-increment: step; content: counter(step, persian); position: absolute; inset-inline-end: 1rem; top: .6rem; font-size: 2rem; font-weight: 900; color: var(--surface-2); }
.step-icon { width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.25rem; margin-bottom: .6rem; }

.trust-strip { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.trust-item { display: flex; gap: .75rem; }
.trust-item > .icon { font-size: 1.5rem; color: var(--primary); margin-top: .2rem; }

/* Categories */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
.cat-tile {
  display: flex; align-items: center; gap: .6rem; padding: .8rem .9rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1.5px solid var(--border); color: var(--text); font-weight: 700; cursor: pointer; text-align: start;
}
.cat-tile .icon { width: 2.1rem; height: 2.1rem; padding: .42rem; border-radius: 10px; background: var(--c-soft); color: var(--c); }
.cat-tile:hover { border-color: var(--c); }
.cat-tile.selected { border-color: var(--c); background: var(--c-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.selectable { margin-bottom: 1rem; }
.cat-electricity { --c: var(--warn); --c-soft: var(--accent-soft); }
.cat-water { --c: var(--info); --c-soft: var(--info-soft); }
.cat-gas { --c: var(--danger); --c-soft: var(--danger-soft); }
.cat-landline, .cat-mobile { --c: #6b5bb5; --c-soft: color-mix(in srgb, #6b5bb5 14%, var(--surface)); }
.cat-loan { --c: var(--primary); --c-soft: var(--primary-soft); }
.cat-rent { --c: #8a5a2b; --c-soft: color-mix(in srgb, #8a5a2b 14%, var(--surface)); }
.cat-medical { --c: #b0466f; --c-soft: color-mix(in srgb, #b0466f 14%, var(--surface)); }
.cat-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 700; padding: .15rem .65rem; border-radius: 999px; background: var(--c-soft); color: var(--c); }
.cat-dot { width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center; background: var(--c-soft, var(--surface-2)); color: var(--c, var(--muted)); font-size: 1.2rem; flex: none; }

/* Case cards */
.case-card { display: flex; flex-direction: column; gap: .35rem; color: var(--text); transition: transform .15s, box-shadow .15s; }
.case-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(20, 30, 25, .1); }
.case-top { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .2rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; }
.case-meta { display: flex; gap: 1rem; color: var(--muted); font-size: .8rem; flex-wrap: wrap; }
.case-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.case-amounts { display: flex; justify-content: space-between; font-size: .88rem; }
.case-amounts strong { color: var(--primary); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: .5rem 0 .3rem; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .6s ease; }
.skeleton { min-height: 230px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.case-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 860px) { .case-layout { grid-template-columns: 1.6fr 1fr; } .donate-box { position: sticky; top: 5rem; } }
.story { white-space: pre-line; font-size: 1.02rem; margin: 1rem 0; }
.checks { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .55rem; }
.checks li { display: flex; gap: .55rem; align-items: flex-start; }
.checks .icon { color: var(--success); margin-top: .3rem; }
.big-amount strong { font-size: 1.5rem; font-weight: 900; color: var(--primary); }
.donate-form { margin-top: 1rem; display: grid; gap: .75rem; }
.amount-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.done-box { display: grid; justify-items: center; text-align: center; gap: .5rem; margin-top: 1rem; }
.done-icon { width: 3rem; height: 3rem; padding: .6rem; border-radius: 50%; background: var(--success-soft); color: var(--success); }

/* Chips, pills, segmented */
.chips { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 1rem; scrollbar-width: none; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; padding: .35rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: .86rem; font-weight: 600;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip-strong { border-color: var(--primary); color: var(--primary); }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pill-muted { background: var(--surface-2); color: var(--muted); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--info-soft); color: var(--info); }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 1rem; }
.segmented > * { border: 0; background: transparent; padding: .4rem 1rem; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); font-size: .9rem; }
.segmented > .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Forms */
.field { display: grid; gap: .3rem; margin-bottom: .9rem; }
.field label, .label { font-weight: 700; font-size: .92rem; }
.hint { color: var(--muted); font-size: .8rem; }
.input {
  width: 100%; min-height: 46px; padding: .55rem .85rem; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
  font-size: 16px; /* 16px stops iPhone Safari zooming in on focus */
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
textarea.input { resize: vertical; line-height: 1.8; }
.money { font-size: 1.1rem; font-weight: 700; text-align: center; }
.otp { font-size: 1.6rem; letter-spacing: .6em; text-align: center; font-weight: 800; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); margin-top: .3rem; flex: none; }
h2 .num { width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: inline-grid; place-items: center; font-size: .85rem; }
.bill-preview { display: flex; align-items: center; gap: .4rem; font-size: .9rem; min-height: 1.5rem; }
.bill-preview.good { color: var(--success); }
.bill-preview.bad { color: var(--danger); }
.dropzone {
  display: grid; justify-items: center; gap: .2rem; padding: 1.4rem; border: 2px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; text-align: center; transition: border-color .15s, background .15s; margin-top: .75rem;
}
.dropzone > .icon { font-size: 1.8rem; color: var(--primary); }
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.loading { opacity: .6; pointer-events: none; }

.alert { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin: .75rem 0; }
.alert .icon { margin-top: .3rem; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }

/* Auth */
.auth-wrap { display: grid; place-items: center; min-height: 60vh; }
.auth-card { width: 100%; max-width: 420px; text-align: center; padding: 2rem 1.5rem; }
.auth-card form { text-align: start; margin-top: 1rem; }
.auth-icon { width: 3.6rem; height: 3.6rem; margin: 0 auto 1rem; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.7rem; }
.demo-code { background: var(--accent-soft); color: var(--warn); border-radius: 10px; padding: .5rem; margin-top: .5rem; }

/* Lists, account */
.profile { display: flex; align-items: center; gap: 1rem; }
.list { display: grid; gap: .6rem; }
.list-item { display: flex; align-items: center; gap: .85rem; margin: 0; color: var(--text); padding: .85rem 1rem; }
.list-item:hover { border-color: var(--primary); }
.highlight { display: flex; justify-content: space-between; align-items: center; background: var(--primary-soft); border-color: transparent; }
.highlight strong { font-size: 1.2rem; color: var(--primary); }
.timeline { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: 0; }
.timeline li { display: flex; align-items: center; gap: .75rem; position: relative; padding-bottom: 1rem; color: var(--muted); }
.timeline li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.timeline li.done { color: var(--text); font-weight: 600; }
.timeline li.done::after { background: var(--primary); }
.timeline .dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; background: var(--surface); flex: none; font-size: .9rem; }
.timeline li.done .dot { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.docs { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.docs li { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; background: var(--surface-2); border-radius: 10px; }

/* Receipt */
.receipt-wrap { max-width: 520px; margin: 0 auto; }
.receipt { text-align: center; padding: 2rem 1.5rem; }
.receipt-icon { width: 4.2rem; height: 4.2rem; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; }
.receipt.ok .receipt-icon { background: var(--success-soft); color: var(--success); animation: pop .4s ease-out; }
.receipt.fail .receipt-icon { background: var(--danger-soft); color: var(--danger); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.1); } }
.receipt-rows { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; text-align: start; margin: 1.5rem 0; padding: 1rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.receipt-rows dt { color: var(--muted); }
.receipt-rows dd { margin: 0; text-align: end; }
.receipt-actions { display: grid; gap: .6rem; }

/* Trust */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.badge-tile { display: grid; justify-items: center; gap: .4rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; color: var(--text); font-size: .85rem; font-weight: 600; }
.badge-tile img { height: 90px; object-fit: contain; }
.badge-tile.placeholder { border-style: dashed; border-width: 2px; color: var(--muted); background: var(--surface-2); }
.badge-tile.placeholder > .icon { font-size: 2.2rem; opacity: .55; }
.badge-tile.placeholder small { font-weight: 400; font-size: .75rem; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: 0; }
.info-row strong { text-align: end; overflow-wrap: anywhere; }
.placeholder-text { color: var(--muted); font-size: .82rem; border: 1px dashed var(--border); border-radius: 8px; padding: 0 .5rem; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 700; background: var(--surface-2); }
.inline-icon { display: inline-flex; align-items: center; gap: .35rem; }

/* Admin */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
.doc-thumb { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb.pdf { gap: .3rem; font-size: .85rem; }
.doc-thumb.pdf .icon { font-size: 2rem; }

/* Empty, toast */
.empty { text-align: center; padding: 3rem 1rem; display: grid; justify-items: center; gap: .4rem; }
.empty-icon { width: 4rem; height: 4rem; padding: .9rem; border-radius: 50%; background: var(--surface-2); color: var(--muted); margin-bottom: .5rem; }
.toast {
  position: fixed; z-index: 100; bottom: calc(5.5rem + var(--safe-bottom)); left: 50%; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: .7rem 1.2rem; border-radius: 12px; font-size: .92rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 2rem); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
@media (min-width: 860px) { .toast { bottom: 2rem; } }

/* Test gateway page */
.gateway-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.gateway { width: 100%; max-width: 400px; text-align: center; display: grid; gap: .75rem; padding: 2rem 1.5rem; }
.gateway-badge { background: var(--accent-soft); color: var(--warn); border-radius: 999px; padding: .25rem .8rem; font-size: .8rem; font-weight: 700; justify-self: center; }
.gateway-amount { display: grid; padding: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); margin: .5rem 0; }
.gateway-amount strong { font-size: 1.5rem; color: var(--primary); }

/* ---------- Install card ---------- */
.install-card { display: flex; align-items: center; gap: 1rem; position: relative; padding-inline-end: 2.8rem; }
.install-icon { border-radius: 14px; flex: none; }
.install-steps { margin: .3rem 0 0; padding-inline-start: 1.2rem; font-size: .9rem; line-height: 2; }
.icon-btn { position: absolute; top: .6rem; inset-inline-end: .6rem; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.hide-sm { display: none; }
@media (min-width: 860px) { .hide-sm { display: inline-flex; } }

/* ---------- Levels and avatars ---------- */
.lvl-teal, .ring-teal, .ring-card-teal, .tier-teal { --lv: #1d9e75; --lv-soft: #def4ec; }
.lvl-bronze, .ring-bronze, .ring-card-bronze, .tier-bronze { --lv: #b8733a; --lv-soft: #f8e6d6; }
.lvl-silver, .ring-silver, .ring-card-silver, .tier-silver { --lv: #8a96a3; --lv-soft: #eceff3; }
.lvl-gold, .ring-gold, .ring-card-gold, .tier-gold { --lv: #d4a024; --lv-soft: #fbf0cf; }
.lvl-diamond, .ring-diamond, .ring-card-diamond, .tier-diamond { --lv: #5b8def; --lv-soft: #e3ecff; }
.ring-none, .ring-card-none, .lvl-none { --lv: var(--border); --lv-soft: var(--surface-2); }
[data-theme="dark"] .lvl-teal, [data-theme="dark"] .ring-teal, [data-theme="dark"] .ring-card-teal, [data-theme="dark"] .tier-teal { --lv-soft: #16332c; }
[data-theme="dark"] .lvl-bronze, [data-theme="dark"] .ring-bronze, [data-theme="dark"] .ring-card-bronze, [data-theme="dark"] .tier-bronze { --lv-soft: #3b2818; }
[data-theme="dark"] .lvl-silver, [data-theme="dark"] .ring-silver, [data-theme="dark"] .ring-card-silver, [data-theme="dark"] .tier-silver { --lv-soft: #2b3036; }
[data-theme="dark"] .lvl-gold, [data-theme="dark"] .ring-gold, [data-theme="dark"] .ring-card-gold, [data-theme="dark"] .tier-gold { --lv-soft: #3a2f12; }
[data-theme="dark"] .lvl-diamond, [data-theme="dark"] .ring-diamond, [data-theme="dark"] .ring-card-diamond, [data-theme="dark"] .tier-diamond { --lv-soft: #1d2a45; }
.level-badge, .level-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--lv-soft); color: var(--lv); white-space: nowrap; }
.level-chip { font-size: .72rem; padding: .05rem .55rem; align-self: center; }
.avatar-ring { display: inline-grid; place-items: center; border-radius: 50%; padding: 3px; background: conic-gradient(var(--lv), color-mix(in srgb, var(--lv) 45%, #fff), var(--lv)); flex: none; }
.avatar-letter { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: linear-gradient(135deg, var(--peach), var(--mint)); color: var(--text); font-weight: 900; }
.avatar-sm { width: 40px; height: 40px; font-size: 1rem; }
.avatar-md { width: 52px; height: 52px; font-size: 1.2rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2.2rem; padding: 4px; }
.level-progress { width: 100%; display: grid; gap: .1rem; margin-top: .5rem; text-align: start; }

/* ---------- Profile hover card ---------- */
.hover-wrap { position: relative; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; display: block; }
.hovercard {
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; width: min(330px, calc(100vw - 2rem)); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1rem; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: opacity .16s, transform .16s;
}
/* Invisible margins keep the card open while the pointer crosses the gap or brushes its edges. */
.hovercard::before { content: ''; position: absolute; top: -22px; inset-inline: -12px; height: 22px; }
.hover-wrap.open .hovercard::after { content: ''; position: absolute; inset: -28px; z-index: -1; }
.hover-wrap.open .hovercard { opacity: 1; transform: none; pointer-events: auto; }
.hovercard-loading { text-align: center; color: var(--muted); padding: 1rem; }
.hc-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.hc-head strong { display: block; font-size: 1.05rem; }
.hc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .6rem 0; width: 100%; }
.hc-stats > div { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .1rem; min-height: 4.2rem; text-align: center; background: var(--surface-2); border-radius: 12px; padding: .45rem .3rem; }
.hc-stats strong { font-size: 1rem; font-weight: 900; color: var(--primary); line-height: 1.4; overflow-wrap: anywhere; }
.hc-stats span { font-size: .72rem; color: var(--muted); }
.hc-medals { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: .7rem 0 .2rem; }
.hc-links { display: grid; margin-top: .6rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.menu-link { display: flex; align-items: center; gap: .6rem; padding: .5rem .55rem; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .92rem; border: 0; background: none; cursor: pointer; text-align: start; width: 100%; }
.menu-link:hover { background: var(--surface-2); }
.menu-link.danger { color: var(--danger); }

/* ---------- Medals ---------- */
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .9rem; margin-top: .75rem; align-items: start; }
.medal { display: grid; justify-items: center; text-align: center; gap: .15rem; }
.medal strong { font-size: .86rem; }
.medal small { font-size: .72rem; color: var(--muted); line-height: 1.5; }
.medal-art { position: relative; width: 64px; height: 78px; }
.medal-sm .medal-art { width: 34px; height: 42px; }
.medal-disc {
  position: absolute; top: 0; left: 0; right: 0; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; color: #fff; z-index: 1;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--lv) 35%, #fff), var(--lv) 62%, color-mix(in srgb, var(--lv) 70%, #000));
  box-shadow: inset 0 0 0 4px color-mix(in srgb, #fff 35%, transparent), 0 6px 14px color-mix(in srgb, var(--lv) 35%, transparent);
}
.medal-sm .medal-disc { height: 34px; font-size: .9rem; box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 35%, transparent); }
.ribbon { position: absolute; bottom: 0; width: 16px; height: 32px; background: var(--primary); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.medal-sm .ribbon { width: 9px; height: 17px; }
.ribbon-l { left: 18px; transform: rotate(14deg); background: var(--accent); }
.ribbon-r { right: 18px; transform: rotate(-14deg); }
.medal-sm .ribbon-l { left: 9px; }
.medal-sm .ribbon-r { right: 9px; }
.medal.earned .medal-art { animation: medal-in .5s ease-out both; }
@keyframes medal-in { from { transform: scale(.6) rotate(-12deg); opacity: 0; } }
.medal.locked .medal-disc { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 2px var(--border); }
.medal.locked .ribbon { background: var(--border); }
.medal.locked strong { color: var(--muted); }

/* ---------- Profile page ---------- */
.profile-hero { display: grid; justify-items: center; text-align: center; gap: .4rem; padding: 1.6rem 1.2rem; border-top: 4px solid var(--lv); }
.profile-hero h1 { margin: .3rem 0 0; display: flex; gap: .5rem; align-items: center; }
.profile-hero .level-progress { max-width: 420px; }
.profile-hero .hc-stats { max-width: 460px; }
/* Tab bars: on phones they slide sideways (finger, wheel or drag) with faded edges hinting at more;
   on wide screens every tab is visible, wrapping onto a second line if needed. */
.segmented.scroll { display: flex; overflow-x: auto; max-width: 100%; scrollbar-width: none; scroll-behavior: smooth; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(to left, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to left, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
.segmented.scroll::-webkit-scrollbar { display: none; }
@media (min-width: 700px) {
  .segmented.scroll { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; gap: 2px; }
}
.segmented.scroll > * { white-space: nowrap; }
.perk-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .55rem; }
.perk { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem; border-radius: 14px; background: var(--surface-2); }
.perk strong { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.perk p { margin: .15rem 0 0; }
.perk-icon { width: 2rem; height: 2rem; border-radius: 10px; display: grid; place-items: center; flex: none; }
.perk.unlocked .perk-icon { background: var(--success-soft); color: var(--success); }
.perk.locked { opacity: .75; }
.perk.locked .perk-icon { background: var(--surface); color: var(--muted); }
.cert-cta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: linear-gradient(135deg, color-mix(in srgb, var(--sun) 60%, var(--surface)), var(--surface)); }

/* ---------- Home rewards teaser ---------- */
.reward-teaser { display: grid; gap: 1.5rem; align-items: center; padding: 1.5rem; border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--sun) 70%, var(--surface)), color-mix(in srgb, var(--rose) 60%, var(--surface))); }
.reward-teaser h2 { font-size: 1.4rem; margin-top: .7rem; }
.teaser-medals { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.teaser-medals .medal small { display: none; }
@media (min-width: 860px) { .reward-teaser { grid-template-columns: 1.2fr 1fr; padding: 2rem; } }

/* ---------- Honor wall ---------- */
.honor-hero { text-align: center; padding: 1rem 0 .5rem; }
.honor-trophy { width: 4.5rem; height: 4.5rem; margin: 0 auto .6rem; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; color: #a87508; background: radial-gradient(circle at 35% 30%, #fff6d6, #f6cf63); box-shadow: 0 10px 30px rgba(212, 160, 36, .35); }
.level-ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0 1.5rem; }
.ladder-step { display: grid; gap: .1rem; justify-items: center; text-align: center; padding: .75rem; border-radius: 14px; background: var(--lv-soft); color: var(--lv); }
.ladder-step small { color: var(--muted); font-size: .72rem; }
.donor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; padding-bottom: 6rem; }
.donor-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; position: relative; color: var(--text); margin: 0; border-top: 4px solid var(--lv); transition: transform .15s; }
.donor-card:hover, .donor-card:focus-visible { transform: translateY(-3px); z-index: 5; }
.rank { position: absolute; top: .6rem; inset-inline-start: .6rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .85rem; color: #fff; }
.rank-1 { background: #d4a024; }
.rank-2 { background: #8a96a3; }
.rank-3 { background: #b8733a; }
.donor-pop {
  position: absolute; bottom: calc(100% - 6px); left: 50%; width: 240px; transform: translate(-50%, 4px); z-index: 10;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: .8rem; box-shadow: var(--shadow-lg);
  display: grid; gap: .4rem; justify-items: center; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
.donor-pop p { margin: 0; }
.donor-card:hover .donor-pop, .donor-card:focus-visible .donor-pop { opacity: 1; transform: translate(-50%, 0); }
@media (hover: none) { .donor-pop { display: none; } }

/* ---------- Certificate ---------- */
.certificate { max-width: 820px; margin: 0 auto; background: #fffdf7; color: #2a2420; border-radius: 6px; padding: 14px; box-shadow: 0 20px 60px rgba(60, 40, 20, .18); }
.cert-border { border: 3px double var(--lv); outline: 1px solid color-mix(in srgb, var(--lv) 40%, transparent); outline-offset: 6px; padding: 2.2rem 1.5rem 1.5rem; text-align: center;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--lv) 10%, transparent), transparent 60%); }
.cert-bronze { --lv: #b8733a; }
.cert-silver { --lv: #8a96a3; }
.cert-gold { --lv: #c79414; }
.cert-diamond { --lv: #4f7fe0; }
.cert-teal { --lv: #1d9e75; }
.cert-top { display: flex; align-items: center; justify-content: center; gap: .6rem; font-weight: 900; font-size: 1.3rem; color: #0f6e5c; }
.cert-top img { border-radius: 14px; }
.cert-kicker { margin: 1rem 0 .4rem; font-size: 1.9rem; font-weight: 900; color: var(--lv); }
.cert-lead { margin: .3rem 0; color: #5d5249; }
.cert-name { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: .4rem 0; color: #2a2420; border-bottom: 2px solid color-mix(in srgb, var(--lv) 40%, transparent); display: inline-block; padding: 0 1.5rem .3rem; }
.cert-level { display: inline-block; margin: .5rem 0; padding: .35rem 1.4rem; border-radius: 999px; background: color-mix(in srgb, var(--lv) 15%, #fff); color: var(--lv); font-weight: 900; font-size: 1.15rem; }
.cert-seal { width: 4.4rem; height: 4.4rem; margin: 1rem auto; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--lv) 40%, #fff), var(--lv)); box-shadow: 0 0 0 6px color-mix(in srgb, var(--lv) 18%, #fff); }
.cert-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; border-top: 1px solid #eadfcd; padding-top: .9rem; }
.cert-foot div { display: grid; }
.cert-foot small { color: #8a7d70; font-size: .75rem; }
.cert-foot strong { font-size: .9rem; overflow-wrap: anywhere; }
.cert-verify { margin: .8rem 0 0; font-size: .75rem; color: #8a7d70; overflow-wrap: anywhere; }
@media print {
  body { background: #fff !important; padding: 0; }
  body::before, .topbar, .tabbar, .footer, .demo-banner, .no-print, .back, #toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .certificate { box-shadow: none; max-width: none; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* Status bar strip: content scrolling under the Android status bar or iPhone notch stays hidden. */
body::after { content: ''; position: fixed; top: 0; inset-inline: 0; height: var(--safe-top); background: var(--bg); z-index: 60; pointer-events: none; }

/* ---------- Theme toggle ---------- */
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; flex: none; }
.theme-btn:hover { background: var(--surface-2); }

/* ---------- Creator credit ---------- */
.credit { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; color: var(--muted); }
.credit a, .credit strong { color: var(--text); font-weight: 800; }
.creator-card { display: flex; align-items: center; gap: 1rem; background: linear-gradient(135deg, color-mix(in srgb, var(--mint) 55%, var(--surface)), color-mix(in srgb, var(--peach) 45%, var(--surface))); }
.creator-mark { width: 3.4rem; height: 3.4rem; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; font-weight: 900; background: var(--primary); color: var(--primary-ink); flex: none; }

/* ---------- App update ---------- */
.update-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--sun) 60%, var(--surface))); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.update-bar > .icon { font-size: 1.6rem; color: var(--primary); }

/* ---------- File picker in the request form ---------- */
.file-list { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; }
.file-list li { display: flex; align-items: center; gap: .55rem; padding: .45rem .7rem; background: var(--surface-2); border-radius: 10px; font-size: .88rem; }
.file-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list button { border: 0; background: none; color: var(--danger); cursor: pointer; padding: .2rem; display: grid; }

/* ---------- Admin panel ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .15rem; align-content: start; }
.kpi span { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: .35rem; }
.kpi strong { font-size: 1.35rem; font-weight: 900; }
.kpi small { color: var(--muted); font-size: .76rem; }
.kpi.hot { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.events { list-style: none; padding: 0; margin: 0; display: grid; }
.event { display: flex; gap: .7rem; align-items: flex-start; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.event:last-child { border-bottom: 0; }
.event-icon { width: 2.1rem; height: 2.1rem; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.event-icon.k-user { background: var(--info-soft); color: var(--info); }
.event-icon.k-case { background: var(--accent-soft); color: var(--warn); }
.event-icon.k-donation { background: var(--success-soft); color: var(--success); }
.event-icon.k-admin { background: var(--primary-soft); color: var(--primary); }
.event-body { flex: 1; min-width: 0; font-size: .9rem; }
.event-body .who { font-weight: 800; }
.event-body .meta { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.event time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.table td a { font-weight: 700; }
.table .wrap { white-space: normal; min-width: 12rem; }
.editor-row { display: grid; gap: .6rem; padding: .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .7rem; background: var(--surface-2); }
.editor-row .row-gap { align-items: center; }
.thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: contain; background: var(--surface); border: 1px solid var(--border); }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sticky-save { position: sticky; bottom: calc(4.8rem + var(--safe-bottom)); z-index: 5; display: flex; justify-content: flex-end; }
@media (min-width: 860px) { .sticky-save { bottom: 1rem; } }

.notice-slot { max-width: var(--max); margin: 0 auto; padding: 1rem 1rem 0; }
.notice-slot:empty { display: none; }

/* ---------- Motion: rise into view, lean toward the pointer, ripple ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease-out var(--delay, 0ms), transform .55s cubic-bezier(.2, .8, .2, 1) var(--delay, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.tilt { transform-style: preserve-3d; transition: transform .25s ease-out, box-shadow .25s ease-out; will-change: transform; position: relative; }
.tilt:hover { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); box-shadow: var(--shadow-lg); }
.tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, #fff 22%, transparent), transparent 55%); }
.tilt:hover::after { opacity: 1; }
.reveal.tilt.in { transition: opacity .55s ease-out var(--delay, 0ms), transform .25s ease-out, box-shadow .25s ease-out; }
.btn, .chip, .tabbar a, .theme-btn { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); pointer-events: none; animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.step, .stat, .medal, .kpi { transition: transform .2s ease-out, box-shadow .2s ease-out; }
.step:hover, .stat:hover, .kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.medal.earned:hover .medal-art { animation: wiggle .6s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 50% { transform: rotate(6deg) scale(1.05); } 75% { transform: rotate(-3deg); } }
.step-icon, .way-icon, .tcard .ic { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.step:hover .step-icon, .way:hover .way-icon { transform: scale(1.12) rotate(-6deg); }
.theme-btn .icon { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.theme-btn:hover .icon { transform: rotate(40deg) scale(1.1); }
.btn-primary:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 35%, transparent); }
.tabbar a[data-tab="new"] .icon { transition: transform .3s; }
.tabbar a[data-tab="new"]:active .icon { transform: scale(.9) rotate(90deg); }
.reveal-pop { animation: pop-in .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.85) rotate(-2deg); } }

/* ---------- Tip ---------- */
.tip-box { display: grid; gap: .4rem; padding: .85rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.tip-box p { margin: 0; }
.tip-total { font-size: .85rem; color: var(--muted); }
.tip-total strong { color: var(--text); }

/* ---------- More ways to give ---------- */
.ways { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.way { display: flex; flex-direction: column; gap: .35rem; color: var(--text); margin: 0; }
.way-icon { width: 2.8rem; height: 2.8rem; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; background: var(--primary-soft); color: var(--primary); }
.way:nth-child(2) .way-icon { background: var(--accent-soft); color: var(--warn); }
.way:nth-child(3) .way-icon { background: var(--info-soft); color: var(--info); }
.way:nth-child(4) .way-icon { background: color-mix(in srgb, var(--rose) 70%, var(--surface)); color: var(--danger); }
.way-cta { margin-top: auto; display: inline-flex; align-items: center; gap: .3rem; color: var(--primary); font-weight: 800; font-size: .9rem; }

/* ---------- Gift cards ---------- */
.gift-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 860px) { .gift-layout { grid-template-columns: 1fr 1fr; } .gift-preview { position: sticky; top: 5rem; } }
.gift-preview { display: grid; gap: .5rem; }
.theme-swatches { display: flex; gap: .6rem; }
.swatch { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform .2s; }
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.gift-card { position: relative; overflow: hidden; border-radius: 22px; padding: 1.4rem 1.3rem 1.1rem; color: #2b2118; display: grid; gap: .6rem;
  box-shadow: var(--shadow-lg); min-height: 300px; isolation: isolate; }
.gift-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background-image: url("/img/hearts.svg"); opacity: .12; }
.gift-dawn { background: linear-gradient(150deg, #ffe3c7, #ffc7b0 45%, #fde8b4); }
.gift-garden { background: linear-gradient(150deg, #d9f5e6, #bfe9d6 50%, #f3f7d9); }
.gift-night { background: linear-gradient(150deg, #1c2a4a, #2c2350 55%, #3d2a55); color: #f6efe4; }
.gift-rose { background: linear-gradient(150deg, #ffd9e4, #f7b8c9 50%, #ffe8d6); }
.gift-top { display: flex; align-items: center; gap: .45rem; font-weight: 900; }
.gift-top img { border-radius: 9px; }
.gift-kind { margin-inline-start: auto; display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; padding: .15rem .7rem; border-radius: 999px; background: color-mix(in srgb, #fff 55%, transparent); color: inherit; }
.gift-night .gift-kind { background: color-mix(in srgb, #fff 15%, transparent); }
.gift-to { font-size: .9rem; opacity: .8; display: grid; }
.gift-to strong { font-size: clamp(1.5rem, 5vw, 2rem); opacity: 1; line-height: 1.5; }
.gift-line { font-size: 1.02rem; line-height: 1.9; margin: 0; }
.gift-card blockquote { margin: 0; padding: .6rem .9rem; border-inline-start: 3px solid currentColor; background: color-mix(in srgb, #fff 35%, transparent); border-radius: 10px; font-style: italic; }
.gift-night blockquote { background: color-mix(in srgb, #fff 8%, transparent); }
.gift-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: .82rem; font-weight: 700; opacity: .75; }
.card-page { max-width: 520px; margin: 0 auto; display: grid; gap: 1rem; }
.center-row { justify-content: center; }

/* ---------- Circle, campaigns, plans ---------- */
.circle-hero { text-align: center; padding: 1.5rem 0 1rem; max-width: 720px; margin: 0 auto; }
.circle-hero h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 900; margin: .8rem 0; }
.circle-hero .lead { margin: 0 auto; }
.circle-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 860px) { .circle-layout { grid-template-columns: 1fr 1fr; } }
.circle-status.on { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: linear-gradient(135deg, var(--success-soft), var(--surface)); }
.campaign-card { display: flex; flex-direction: column; gap: .45rem; color: var(--text); margin: 0; }
.sponsor-row { display: flex; align-items: center; gap: .65rem; }
.sponsor-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--border); }
.sponsor-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; background: var(--accent-soft); color: var(--warn); }
.sponsor-row div { display: grid; line-height: 1.5; }
.match-pill { align-self: flex-start; }
.campaign-hero h1 { margin-top: .8rem; }
.plans { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 1rem; }
.plan { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.plan.featured { border: 2px solid var(--primary); }
.plan-badge { position: absolute; top: -.75rem; inset-inline-start: 1rem; background: var(--primary); color: var(--primary-ink); font-size: .75rem; font-weight: 800; padding: .1rem .7rem; border-radius: 999px; }
.plan-price { font-size: 1.15rem; font-weight: 900; color: var(--primary); }
.plan .checks { flex: 1; }
.lead-status { min-height: 36px; padding: .2rem .5rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.team-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: 0; }
.bar-chart { display: flex; align-items: flex-end; gap: .4rem; height: 140px; padding-top: .5rem; }
.bar-chart div { flex: 1; display: grid; gap: .2rem; align-content: end; text-align: center; font-size: .7rem; color: var(--muted); }
.bar-chart span { display: block; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--surface))); min-height: 3px; }

h2 .num.done { background: var(--success); }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.app-icon { border-radius: 22px; box-shadow: var(--shadow-lg); margin-bottom: .5rem; }

/* On-page confirmation (replaces the browser's confirm(), which some web views block) */
.confirm-backdrop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1rem; background: color-mix(in srgb, #000 45%, transparent); animation: rise .18s ease-out; }
.confirm-box { max-width: 420px; width: 100%; margin: 0; box-shadow: var(--shadow-lg); }
.confirm-box p { font-size: 1rem; line-height: 1.9; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }

/* What real mode still needs */
.readiness { list-style: none; padding: 0; margin: .3rem 0 1rem; display: grid; gap: .4rem; }
.readiness li { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem .75rem; border-radius: 10px; font-size: .9rem; }
.readiness li .icon { margin-top: .3rem; }
.readiness li.ok { background: var(--success-soft); color: var(--success); }
.readiness li.todo { background: var(--danger-soft); color: var(--danger); }
.readiness li a { font-weight: 800; }
.btn:disabled:not(.loading) { cursor: not-allowed; }
