:root {
  --bg: #121212;
  --panel: #1a1a1a;
  --panel-2: #0f0f0f;
  --line: #2c2c2c;
  --text: #ffffff;
  --muted: #b5b5b5;
  --green: #2e9e6b;
  --green-bg: #1b2a23;
  --green-line: #2a6b4c;
  --red: #ff7b72;
  --amber: #f2c14e;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.4;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.wide { max-width: 1400px; }
h1, h2, h3, p { margin: 0; }
a { color: #8fd3b3; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

.hero { background: var(--panel-2); border-radius: 14px; padding: 20px 16px; text-align: center; }
.hero h1 { font-size: 26px; }
.hero p { color: var(--muted); margin-top: 4px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.steps b { display: block; font-size: 15px; }
.steps span { font-size: 12px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 14px; }

.progress-head { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; }
.progress-head .count { font-size: 34px; font-weight: 700; }
.bar { height: 10px; background: #262626; border-radius: 99px; overflow: hidden; margin: 10px 0 12px; }
.bar > div { height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; padding: 4px; text-align: center; overflow: hidden;
}
.tile.done { background: var(--green-bg); border-color: var(--green-line); color: #fff; }
.tile.done .check { color: #37d67a; font-size: 22px; line-height: 1; }
.tile.done .vname { font-size: 11px; line-height: 1.15; margin-top: 4px; max-height: 2.4em; overflow: hidden; word-break: break-word; }

.pill { border-radius: 99px; background: #1f1f1f; color: var(--muted); text-align: center; padding: 12px; margin-top: 14px; }
.pill.won { background: var(--green-bg); color: #fff; border: 1px solid var(--green-line); }

.banner { border-radius: 12px; padding: 14px; margin-top: 14px; font-weight: 600; text-align: center; }
.banner.ok { background: var(--green-bg); border: 1px solid var(--green-line); }
.banner.warn { background: #2e2710; border: 1px solid #6b5a1c; color: var(--amber); }
.banner.err { background: #2e1513; border: 1px solid #6b2a25; color: var(--red); }

label { display: block; font-size: 15px; margin-top: 14px; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], textarea {
  width: 100%; margin-top: 6px; padding: 14px; font-size: 17px; color: var(--text);
  background: var(--panel-2); border: 1px solid #444; border-radius: 10px;
}
input:focus, textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
.check-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; color: var(--text); font-size: 15px; }
.check-row input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--green); }

button, .btn {
  display: inline-block; width: 100%; margin-top: 16px; padding: 16px; font-size: 18px; font-weight: 700;
  color: #fff; background: var(--green); border: 0; border-radius: 12px; cursor: pointer; text-align: center; text-decoration: none;
}
button.secondary, .btn.secondary { background: #2a2a2a; border: 1px solid #444; font-weight: 600; }
button.danger { background: #7a2a25; }
button.inline { width: auto; margin: 0; padding: 8px 12px; font-size: 14px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 14px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Public dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dash-head h1 { font-size: clamp(24px, 3.2vw, 46px); }
.dash-head p { color: var(--muted); font-size: clamp(15px, 1.5vw, 22px); }
.dash { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 900px) { .dash { grid-template-columns: minmax(240px, 0.8fr) 1fr 1fr; } }
.dash .card { margin-top: 0; }
.dash h2 { font-size: clamp(18px, 1.8vw, 28px); margin-bottom: 8px; }
.dash td, .dash th { font-size: clamp(16px, 1.6vw, 26px); }
.qr { background: #fff; border-radius: 12px; padding: 14px; }
.qr img { display: block; width: 100%; height: auto; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: clamp(26px, 3vw, 48px); line-height: 1.1; }
.stat span { color: var(--muted); font-size: clamp(12px, 1.1vw, 18px); }
.rank { color: var(--muted); width: 2.2em; }

/* Admin */
.tabs { display: flex; gap: 8px; margin-top: 12px; }
.tabs button { margin: 0; padding: 12px 6px; font-size: 15px; background: #2a2a2a; }
.tabs button.on { background: var(--green); }
.code-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.code-row .ref { font-weight: 700; width: 3em; flex: none; }
.code-row .name { flex: 1; }
.code-row.off .name { text-decoration: line-through; color: var(--muted); }
