:root {
  --bg: #0b0c0b;
  --surface: #141714;
  --surface-2: #1b1f1b;
  --line: #2a302a;
  --text: #f1f4f0;
  --muted: #a4aea3;
  --faint: #7d877c;
  --green: #40d435;
  --green-ink: #071006;
  --green-soft: rgba(64, 212, 53, 0.12);
  --gold: #e7c46a;
  --danger: #ff7a6b;
  --radius: 16px;
  --radius-sm: 10px;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --tabbar: 68px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
/* App shell: the page itself never scrolls, only #app does, so the bottom bar can't drift on iPhone. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
#app { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { max-width: 640px; margin: 0 auto; padding: 0 18px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
.shell.wide { max-width: 1120px; padding-bottom: 48px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-words { display: flex; flex-direction: column; line-height: 1; font-weight: 800; letter-spacing: .14em; }
.brand-words b { font-size: 17px; }
.brand-words span { font-size: 10.5px; color: var(--green); margin-top: 3px; letter-spacing: .22em; }
.lang-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-toggle button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.lang-toggle button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; transform: translateZ(0); background: rgba(11, 12, 11, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar nav { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 12px; font-weight: 700; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--green); }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; line-height: 1.15; }
.eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.title { font-size: clamp(30px, 8vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.ref { font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: -.005em; }

/* ---------- cards ---------- */
.stack > * + * { margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip.green { background: var(--green-soft); border-color: rgba(64, 212, 53, .35); color: var(--green); }
.chip.gold { background: rgba(231, 196, 106, .1); border-color: rgba(231, 196, 106, .35); color: var(--gold); }

.hero { padding: 6px 0 4px; }
.hero .title { margin-top: 6px; }
.progress { margin-top: 14px; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width .4s ease; }
.bar.gold > i { background: var(--gold); }
.progress-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: 13px; color: var(--muted); }

.reading { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.reading:first-of-type { border-top: 0; padding-top: 4px; }
.reading .what { flex: 1; min-width: 0; }
.reading .label { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.reading .ref { display: block; margin-top: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: #3c443c; }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 17px; border-radius: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.done { background: var(--green-soft); border-color: rgba(64, 212, 53, .45); color: var(--green); }
.btn svg { width: 18px; height: 18px; flex: none; }
.read-link { flex: none; }

.note { border-left: 3px solid var(--gold); }
.note .body { white-space: pre-wrap; margin: 6px 0 0; }
.note .body + .lang-label { margin-top: 14px; }
.lang-label { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.field, div.field { display: grid; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 16px; font-weight: 500; color: var(--text); min-height: 48px; }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--green); outline: none; }
.pin { letter-spacing: .4em; font-weight: 800; }
.hint { font-size: 13px; color: var(--faint); font-weight: 500; }
.error { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1em; }
.choice { display: grid; gap: 10px; }
.choice button { color: var(--text); font-weight: 500; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.choice button[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.choice b { display: block; font-size: 16px; font-weight: 700; }
.choice span { display: block; font-size: 14px; color: var(--muted); margin-top: 3px; }
.links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.links a, .linkbtn { color: var(--green); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 0; font-size: 14px; }

/* ---------- welcome ---------- */
.welcome { padding-top: 8px; }
.welcome .title { font-size: clamp(34px, 10vw, 48px); }
.welcome .lead { font-size: 17px; color: var(--muted); margin: 12px 0 22px; }
.features { display: grid; gap: 10px; margin: 22px 0; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature i { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 14px; }
.feature p { margin: 3px 0 0; font-size: 15px; }
.countdown { display: flex; align-items: baseline; gap: 8px; }
.countdown b { font-size: 34px; font-weight: 800; color: var(--green); letter-spacing: -.02em; }

/* ---------- board ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .chipbtn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.filters .chipbtn[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.avatar.on { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.person .who { flex: 1; min-width: 0; }
.person .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .meta { font-size: 13px; color: var(--faint); margin-top: 1px; }
.status { flex: none; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 999px; }
.status.yes { background: var(--green-soft); color: var(--green); }
.status.no { background: var(--surface-2); color: var(--faint); }

/* ---------- plan ---------- */
.months { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.months::-webkit-scrollbar { display: none; }
.months button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.months button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.dayrow { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.dayrow:first-child { border-top: 0; }
.dayrow:hover { background: var(--surface-2); }
.dayrow.today { background: rgba(64, 212, 53, .06); }
.daynum { flex: none; width: 46px; text-align: center; }
.daynum b { display: block; font-size: 19px; font-weight: 800; line-height: 1; }
.daynum span { font-size: 11.5px; color: var(--faint); font-weight: 700; text-transform: uppercase; }
.dayrow .refs { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.dayrow .refs b { color: var(--text); font-weight: 700; }
.tick { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.tick.on { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.tick svg { width: 16px; height: 16px; }
.notedot { color: var(--gold); font-weight: 800; font-size: 12px; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; }
.admin-tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 9px 15px; border-radius: 999px; font-weight: 700; }
.admin-tabs button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 800; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.actions { white-space: nowrap; text-align: right; }
table.t tr.inactive td { opacity: .55; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.check input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); }
.check .nm { flex: 1; }
.check .nm small { display: block; color: var(--faint); font-size: 12.5px; }
.check label.def { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.check input[type=radio] { accent-color: var(--green); }
.share-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.share-box code { background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; font-size: 15px; word-break: break-all; flex: 1; min-width: 220px; }
.qr { background: #fff; padding: 12px; border-radius: 14px; width: 200px; height: 200px; }
.qr img, .qr svg { width: 100%; height: 100%; display: block; }
.banner { border: 1px solid rgba(231, 196, 106, .4); background: rgba(231, 196, 106, .08); color: var(--gold); padding: 12px 14px; border-radius: 12px; font-size: 14px; }

/* ---------- toast / modal ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-weight: 700; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: grid; place-items: center; z-index: 40; padding: 18px; }
.modal { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; max-height: 90dvh; overflow: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.back svg { width: 18px; height: 18px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 12px; height: 74px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 720px) {
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
@media (max-width: 380px) {
  .row2 { grid-template-columns: 1fr; }
  .stat b { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.read-link.opened { color: var(--green, #40d435); border-color: rgba(64,212,53,.45); }
.read-link.opened svg { width: 16px; height: 16px; }
.center { text-align: center; }

#reader { position: fixed; inset: 0; z-index: 100; background: var(--bg, #0b0c0b); display: flex; flex-direction: column; }
#reader[hidden] { display: none; }
.reader-bar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.reader-bar b { flex: 1; min-width: 0; font-family: "Source Serif 4", Georgia, serif; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
#readerframe { flex: 1; width: 100%; border: 0; background: #fff; }
body.reading-open { overflow: hidden; }

.status { white-space: nowrap; }

.credit { text-align: center; font-size: 14px; color: var(--faint); opacity: .9; margin: 32px 0 0; letter-spacing: .01em; }
#ptr { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translate(-50%, 0); width: 36px; height: 36px; border-radius: 50%; background: var(--card, #1a1d1a); border: 1px solid var(--line, #2a2e2a); color: var(--faint, #9aa39a); display: grid; place-items: center; opacity: 0; z-index: 60; pointer-events: none; transition: opacity .15s; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
#ptr.armed { color: var(--green, #3dd23d); }
#ptr.spin svg { animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }
.invite { background: #f6f1e4; color: #1d3a1a; border-radius: 18px; padding: 18px 18px 16px; margin: 0 0 22px; border-left: 6px solid #2f9e27; }
.invite-en { font-weight: 800; font-size: 19px; line-height: 1.3; }
.invite-es { font-weight: 700; font-size: 17px; line-height: 1.3; color: #2f6e28; margin-top: 8px; }
.invite-langs { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; color: #5d6b5a; margin-top: 10px; text-transform: uppercase; }
.homecard { display: block; text-decoration: none; color: var(--text); border: 1.5px solid rgba(64, 212, 53, .55); background: var(--green-soft); }
.hsteps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; }
.hsteps li { counter-increment: s; position: relative; padding-left: 44px; line-height: 1.45; font-size: 15.5px; }
.hsteps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #0b0b0b; font-weight: 800; display: grid; place-items: center; font-size: 15px; }
.shareico { vertical-align: -4px; color: #3b82f6; }
[hidden] { display: none !important; }
.langpick { background: var(--surface); border: 1.5px solid rgba(64, 212, 53, .45); border-radius: 18px; padding: 14px; }
.langpick-q { font-weight: 800; font-size: 15px; margin: 0 0 10px; text-align: center; }
.langpick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.langpick-row button { display: grid; gap: 3px; padding: 14px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.langpick-row button b { font-size: 19px; }
.langpick-row button span { font-size: 12.5px; color: var(--muted); }
.langpick-row button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #0b0b0b; }
.langpick-row button[aria-pressed="true"] span { color: #0b0b0b; opacity: .8; }
.planone { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--green); background: var(--green-soft); }
.planone span { color: var(--muted); font-size: 14px; line-height: 1.4; }
