/* White theme (light in every OS mode). The reveal stage keeps its own dark colours. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: rgba(255, 255, 255, .92);
  --surface-solid: #ffffff;
  --surface-2: #f5f6fa;
  --text: #141831;
  --muted: #5b6283;
  --glass-edge: #e7e9f2;
  --border: rgba(20, 24, 60, .10);
  --primary: #5145e5;
  --primary-2: #9b5cf6;
  --primary-ink: #ffffff;
  --primary-soft: rgba(81, 69, 229, .09);
  --danger: #d92d3a;
  --success: #138a48;
  --warn: #b45309;
  --bar: rgba(81, 69, 229, .22);
  --radius: 18px;
  --blur: 18px;
  --glass-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 28px rgba(16, 24, 40, .07);
  --shadow: var(--glass-shadow);
  --blob-1: rgba(124, 92, 255, .45);
  --blob-2: rgba(56, 189, 248, .38);
  --blob-3: rgba(244, 114, 182, .32);
  --blob-4: rgba(52, 211, 153, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .92em; }
img { max-width: 100%; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 40px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: var(--primary-ink); font-size: 1rem; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a:not(.btn) { color: var(--text); }
.footer { color: var(--muted); font-size: .85rem; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: var(--primary-ink); border: 1px solid transparent;
  padding: .6em 1.1em; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .4em .8em; font-size: .9rem; }
.btn-lg { padding: .8em 1.6em; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: .2em .55em; border-radius: 8px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 0 0; text-decoration: underline; font: inherit; }

input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .6em .75em; margin-top: 4px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
input[type=radio], input[type=checkbox] { width: auto; margin: 0; accent-color: var(--primary); }
label { display: block; font-weight: 500; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.choice { display: flex; gap: 10px; align-items: center; font-weight: 400; padding: 5px 0; }
.indent { padding-left: 28px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 180px; }
.row > .grow, .grow { flex: 3 1 260px; }
.row-between { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.inline { display: inline-flex; gap: 6px; margin: 0; }
.push { margin-left: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.empty { text-align: center; padding: 40px 20px; }
.auth-card { max-width: 420px; margin: 20px auto; }
.form-wide { max-width: 720px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.alert-success { color: var(--success); border-color: currentColor; background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.alert-error { color: var(--danger); border-color: currentColor; background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert-info { color: var(--primary); border-color: currentColor; background: var(--primary-soft); }

.badge { display: inline-block; vertical-align: middle; font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: .25em .7em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge-open { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: var(--success); }
.badge-scheduled { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); }
.badge-ended, .badge-closed { background: var(--surface-2); color: var(--muted); }
.badge-draft { background: var(--primary-soft); color: var(--primary); }

.page-head, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head { align-items: center; margin-top: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.event-card { color: var(--text); display: block; margin: 0; transition: transform .12s, border-color .12s; }
.event-card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); }
.event-card h3 { margin-top: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* home */
.hero { text-align: center; padding: 40px 0 28px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.02em; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; margin: 0 auto 1.2em; }
.join { display: flex; gap: 8px; max-width: 520px; margin: 0 auto 12px; }
.join input { margin: 0; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0 36px; }
.features .card { margin: 0; }

/* event management */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-num { display: block; font-size: 1.7rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: .85rem; }
.share { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.share-body { flex: 1 1 360px; min-width: 0; }
.copy-row { display: flex; gap: 8px; margin: 4px 0 10px; }
.copy-row input { margin: 0; min-width: 0; }
.qr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
.big-code { font-size: 1.15rem; font-weight: 700; letter-spacing: .08em; }
.category-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.option-list { list-style: none; padding: 0; margin: 0 0 8px; }
.option-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 4px 0; }
details form { padding: 10px 0 4px; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.danger-zone { margin-top: 32px; }
.delete-row { margin-top: 18px; }
.print-cards { display: none; }

/* ballot */
.ballot-head { text-align: center; margin-bottom: 24px; }
.ballot-head h1 { margin-top: 10px; }
.hint { background: var(--primary-soft); color: var(--primary); padding: .3em .8em; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.choice-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; font-weight: 400; transition: border-color .12s, background .12s;
}
.choice-card:hover { border-color: var(--primary); }
.choice-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.choice-card.disabled { opacity: .5; cursor: not-allowed; }
.choice-card select { width: 64px; margin: 0; flex: none; }
.choice-img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex: none; }
.choice-text { display: flex; flex-direction: column; min-width: 0; }
.submit-bar {
  position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.code-input { text-align: center; font-size: 1.4rem; letter-spacing: .12em; text-transform: uppercase; }
.thanks { text-align: center; padding: 40px 20px; }
.thanks-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: var(--success); }
.receipt code { font-size: 1.4rem; letter-spacing: .1em; padding: .3em .8em; }

/* results */
.bar-row { margin: 12px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.bar-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--bar); border-radius: 999px; transition: width .6s ease; }
.leader .bar span { background: var(--primary); }
.leader .bar-label { font-weight: 700; }
.crown { color: var(--warn); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.6s infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .3; } }
.verify { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 28px; }
body.presenting .topbar, body.presenting .footer, body.presenting .verify, body.presenting .page-head .actions a { display: none; }
body.presenting main.wrap { max-width: 1400px; }
body.presenting { font-size: 20px; }

@media (max-width: 600px) {
  .join { flex-direction: column; }
  .category-head { flex-direction: column; }
  .hint { white-space: normal; }
  .topbar nav { gap: 10px; }
  .submit-bar .btn { width: 100%; }
}

@media print {
  body { background: #fff; color: #000; }
  .topbar, .footer, main > *:not(#tokens), #tokens > *:not(.print-cards) { display: none !important; }
  .print-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .print-card { border: 1px dashed #999; padding: 14px; break-inside: avoid; font-size: 12px; }
  .print-card code { font-size: 16px; font-weight: 700; }
}

/* ---------------------------------------------------------------- admin */
.alert-warning { color: var(--warn); border-color: currentColor; background: color-mix(in srgb, var(--warn) 10%, var(--surface)); font-weight: 500; }
.alert-admin { color: var(--text); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.announcement { padding: 10px 0; font-size: .93rem; font-weight: 500; border-bottom: 1px solid var(--border); }
.announcement-info { background: var(--primary-soft); color: var(--primary); }
.announcement-warning { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); }
.announcement-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); }
.topbar nav a.nav-admin { color: var(--warn); font-weight: 700; }
.badge-suspended { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.nowrap { white-space: nowrap; }

.admin-tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px var(--border); margin: -4px 0 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.admin-tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.admin-tabs a:hover { color: var(--text); text-decoration: none; }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

a.stat { color: var(--text); transition: border-color .12s; }
a.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat-live .stat-num { color: var(--success); }
.section-head.tight { margin: 0 0 10px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.admin-grid > .card { margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 6px; }
.spark-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.spark-bar { width: 100%; max-width: 36px; min-height: 2px; background: var(--primary); border-radius: 6px 6px 2px 2px; }
.spark-val { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark-label { font-size: .72rem; color: var(--muted); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input { flex: 2 1 220px; margin: 0; }
.toolbar select { flex: 0 1 170px; margin: 0; }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.bulk-bar select, .bulk-bar input { width: auto; margin: 0; padding: .4em .6em; font-size: .9rem; }
th.check, td.check { width: 36px; padding-right: 0; }
tr.row-selected td { background: var(--primary-soft); }
tr.row-muted td { opacity: .6; }
td .btn-sm { margin: 2px 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 20px; }
.tag { display: inline-block; font: 600 .72rem ui-monospace, Consolas, monospace; background: var(--surface-2); color: var(--muted); padding: .15em .5em; border-radius: 6px; margin-right: 6px; }
.kv { width: 100%; }
.kv th { text-transform: none; letter-spacing: 0; font-size: .9rem; width: 40%; padding: 7px 0; }
.kv td { padding: 7px 0; }

/* --------------------------------------------------------- paid voting */
.badge-paid { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); }
.badge-pay-success { background: color-mix(in srgb, var(--success) 15%, var(--surface)); color: var(--success); }
.badge-pay-pending, .badge-pay-abandoned { background: var(--surface-2); color: var(--muted); }
.badge-pay-failed, .badge-pay-mismatch, .badge-pay-reversed { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.pay-panel { border-color: var(--primary); }
.pay-panel .submit-bar { position: static; box-shadow: none; margin: 14px 0 10px; }
.qty-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pay-total { font-size: 1.5rem; margin-left: 6px; font-variant-numeric: tabular-nums; }
.nominee-link { margin-left: auto; padding: 0; }

/* ================================================================ glass */
body { min-height: 100vh; position: relative; isolation: isolate; background: var(--bg); }
/* Soft colour field behind the glass. */
body::before {
  content: ""; position: fixed; inset: -12%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 42% at 12% 16%, var(--blob-1), transparent 70%),
    radial-gradient(34% 40% at 88% 10%, var(--blob-2), transparent 70%),
    radial-gradient(42% 44% at 82% 86%, var(--blob-3), transparent 70%),
    radial-gradient(34% 36% at 14% 88%, var(--blob-4), transparent 70%);
  filter: blur(24px);
  animation: glass-drift 30s ease-in-out infinite alternate;
}
@keyframes glass-drift { to { transform: translate3d(2.5%, -2%, 0) scale(1.07) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

/* Frosted surfaces */
.card, .stat, .submit-bar, .auth-card, .table-wrap {
  background: var(--surface);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
.card { border-radius: var(--radius); }
.stat { border-radius: var(--radius); }
.topbar {
  background: color-mix(in srgb, var(--surface-solid) 50%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: 0 4px 24px rgba(20, 20, 60, .06);
}
.alert, .announcement {
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
}
.alert { border-radius: 14px; }
.footer { border-top-color: var(--border); }

/* Brand */
.brand-mark { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 14px -4px var(--primary); color: #fff; }
.hero h1 {
  background: linear-gradient(120deg, var(--text) 20%, var(--primary) 60%, var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Buttons */
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 6px 20px -8px var(--primary), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 26px -8px var(--primary), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn:active { transform: translateY(0); }
.btn:disabled { transform: none; }
.btn-ghost, .btn-icon {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-ghost:hover, .btn-icon:hover { box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-icon { color: var(--muted); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #f0577f); box-shadow: 0 6px 20px -8px var(--danger); }

/* Fields */
input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
}
input[type=radio], input[type=checkbox] { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
select option { background: var(--surface-solid); color: var(--text); }
fieldset { border-color: var(--border); background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.copy-row input[readonly] { color: var(--muted); }

/* Ballot choices: tinted glass tiles (no extra blur — they sit inside a card) */
.choice-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.choice-card:hover { border-color: color-mix(in srgb, var(--primary) 60%, transparent); transform: translateY(-1px); }
.choice-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, transparent), color-mix(in srgb, var(--primary-2) 12%, transparent));
  box-shadow: 0 0 0 3px var(--primary-soft), 0 8px 24px -12px var(--primary);
}
.choice-card.disabled:hover { transform: none; }
.submit-bar { border-radius: var(--radius); }
.pay-panel { border-color: color-mix(in srgb, var(--primary) 50%, var(--glass-edge)); }
.thanks-icon { box-shadow: 0 0 0 8px color-mix(in srgb, var(--success) 10%, transparent), 0 10px 30px -10px var(--success); }

/* Cards & lists */
.event-card:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--glass-edge)); box-shadow: 0 14px 40px -14px var(--primary), inset 0 1px 0 rgba(255, 255, 255, .5); }
a.stat:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--glass-edge)); }
.badge { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
tr.row-selected td { background: var(--primary-soft); }
table th { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }

/* Results */
.bar { background: var(--surface-2); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); }
.leader .bar span { background: linear-gradient(90deg, var(--primary), var(--primary-2)); box-shadow: 0 0 14px -2px var(--primary); }
.spark-bar { background: linear-gradient(180deg, var(--primary-2), var(--primary)); box-shadow: 0 0 12px -4px var(--primary); }
.qr { box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .35); border-radius: 14px; }
.admin-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); text-shadow: 0 0 18px var(--primary-soft); }

/* Browsers without backdrop-filter: make surfaces opaque enough to read. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: rgba(255, 255, 255, .9); --surface-2: rgba(255, 255, 255, .7); }
}

@media print {
  body::before { display: none; }
  body { background: #fff; }
  .card, .stat, .table-wrap { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; background: #fff; }
}

/* ------------------------------------------------- nominees & photos */
.option-list li.option-row { flex-wrap: wrap; }
.option-text { flex: 1 1 200px; min-width: 0; }
.option-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.option-actions .link-btn { padding: 0; }
.option-edit { flex-basis: 100%; margin: 0 0 0 46px; }
.option-edit summary { font-size: .85rem; }
.thumb { flex: none; }
.thumb-empty {
  display: inline-grid; place-items: center; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); border: 1px solid var(--border);
}

.nominee-hero { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 28px; align-items: center; padding: 24px; }
.nominee-photo { aspect-ratio: 1; border-radius: calc(var(--radius) - 4px); overflow: hidden; background: var(--primary-soft); border: 1px solid var(--glass-edge); box-shadow: 0 20px 50px -24px var(--primary); }
.nominee-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nominee-initial { display: grid; place-items: center; height: 100%; font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--primary-2) 18%, transparent)); }
.nominee-category { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--primary); margin: 6px 0 4px; }
.nominee-body h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
.lead-left { font-size: 1.05rem; color: var(--muted); }
.standing { display: flex; gap: 24px; flex-wrap: wrap; margin: 16px 0 18px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.standing .stat-num { font-size: 1.5rem; }
.standing .stat-label { display: block; }
.share-card { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.btn.share-whatsapp { background: linear-gradient(135deg, #25d366, #128c7e); box-shadow: 0 6px 20px -8px #25d366; }
.qr-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sibling-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sibling { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; color: var(--text); }
.sibling:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 55%, var(--glass-edge)); }
@media (max-width: 680px) {
  .nominee-hero { grid-template-columns: 1fr; }
  .nominee-photo { max-width: 320px; width: 100%; margin: 0 auto; }
  .option-edit { margin-left: 0; }
}

/* --------------------------------------------------------- vote packages */
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.package {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 10px 12px; cursor: pointer;
  text-align: center; font-weight: 400; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.package:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.package input { position: absolute; opacity: 0; pointer-events: none; }
.package:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.package.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, transparent), color-mix(in srgb, var(--primary-2) 12%, transparent));
  box-shadow: 0 0 0 3px var(--primary-soft), 0 8px 24px -12px var(--primary);
}
.package-votes { font-weight: 800; font-size: 1.1rem; }
.package-price { font-variant-numeric: tabular-nums; }
.package-save { font-size: .75rem; font-weight: 700; color: var(--success); }
.package-flag {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px;
  color: #fff; background: linear-gradient(135deg, var(--warn), #f97316);
}
input[readonly][data-qty] { opacity: .7; }

/* ---------------------------------------------------------------- import */
.sheet-example { font-size: .82rem; }
.sheet-example th, .sheet-example td { padding: 6px 10px; white-space: nowrap; }
.tight-list { margin: 0; padding-left: 18px; }
.tight-list li { margin: 3px 0; }

/* ---------------------------------------------------------- hosting fees */
.fee-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  border-color: color-mix(in srgb, var(--warn) 45%, var(--glass-edge)); }
.fee-card h2 { margin-bottom: .2em; }
.fee-card p { margin: 0; }
.fee-note { margin: -6px 0 14px; }
.fee-summary { display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline; margin-bottom: 12px; }
.fee-table { margin: 0 0 8px; box-shadow: none; }

/* ---------------------------------------------------------------- plans */
.plan-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.plan-option {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); font-weight: 400; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.plan-option:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 60%, transparent); }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--primary-soft); }
.plan-option-name { font-weight: 800; }
.plan-option-price { font-weight: 600; color: var(--primary); }
.plan-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-card-head p { margin: 0; }
.plan-card h2 { margin: 2px 0 4px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0 8px; }
.meter-label { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 4px; }
.meter .bar span { background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.meter.full .bar span { background: var(--danger); }
.meter.full .meter-label { color: var(--danger); font-weight: 600; }
.plan-change form { padding-top: 10px; }
.plan-admin.inactive { opacity: .75; }
.nav-pricing { color: var(--muted) !important; }

.pricing-hero { padding-bottom: 12px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: stretch; margin-bottom: 18px; }
.price-card { position: relative; display: flex; flex-direction: column; margin: 0; padding: 26px 22px; }
.price-card.featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), 0 20px 50px -20px var(--primary); }
.price { font-size: 2.3rem; font-weight: 800; margin: 10px 0 14px; letter-spacing: -.02em; }
.price-cur { font-size: 1rem; font-weight: 700; color: var(--muted); }
.price-per { font-size: .9rem; font-weight: 500; color: var(--muted); }
.price-features { list-style: none; padding: 0; margin: 0 0 20px; flex: 1; }
.price-features li { padding: 7px 0 7px 24px; position: relative; border-top: 1px solid var(--border); font-size: .93rem; }
.price-features li::before { content: "✓"; position: absolute; left: 2px; color: var(--success); font-weight: 800; }
.price-features li.off { color: var(--muted); text-decoration: line-through; opacity: .7; }
.price-features li.off::before { content: "✕"; color: var(--muted); }
@media (max-width: 600px) { .nav-pricing { display: none; } }

/* -------------------------------------------------------------- installer */
.install { max-width: 860px; }
.checklist { list-style: none; padding: 0; margin: 0; columns: 2 280px; }
.checklist li { padding: 4px 0; break-inside: avoid; }
.checklist li span { display: inline-block; width: 1.2em; font-weight: 800; }
.checklist li.ok span { color: var(--success); }
.checklist li.bad { color: var(--danger); }

/* Plain white page: no colour field behind the content (the reveal stage keeps it). */
body:not(.reveal)::before { display: none; }
.topbar { background: rgba(255, 255, 255, .88); box-shadow: 0 1px 0 var(--glass-edge); }

/* ---------------------------------------- registration fee & commission */
.reg-fee-card h2 { margin: 2px 0 12px; }
.fee-formula { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.fee-formula span { display: flex; flex-direction: column; padding: 12px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.fee-formula strong { font-size: 1.35rem; }
.fee-formula small { color: var(--muted); }
.fee-formula b { color: var(--muted); font-size: 1.3rem; }
.pricing-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 28px; }
.pricing-split h2 { margin: 2px 0 4px; }
.fee-lines { width: 100%; margin: 6px 0 12px; }
.fee-lines td { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.fee-lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.fee-lines tr.total td { font-weight: 800; border-bottom: 2px solid var(--text); }
.earnings { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.earnings div { display: flex; flex-direction: column; }
.earnings strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.earnings .net { color: var(--success); }

/* -------------------------------------------------- USSD simulator, payouts */
.phone { max-width: 300px; margin: 0 auto; padding: 18px 14px 14px; border-radius: 28px; background: #111426; box-shadow: 0 20px 50px -20px rgba(0,0,0,.5); }
.phone-screen { min-height: 190px; padding: 14px; border-radius: 12px; background: #e9f0e4; color: #14231a; font: 14px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.phone-input { display: flex; gap: 6px; margin-top: 10px; }
.phone-input input { margin: 0; background: #fff; }
hr.soft { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.payout-current { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.payout-current h2 { margin: 2px 0 4px; }
.payout-note { margin: 12px 0 0; }
.golive li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.golive li:first-child { border-top: 0; }
.golive .mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.golive .ok .mark { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.golive .todo .mark { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.golive .info .mark { background: var(--primary-soft); color: var(--primary); }
