:root {
  --brand: #0f766e;
  --brand-dark: #0b5c56;
  --brand-light: #e6f4f2;
  --ink: #1f2933;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f7fafa;
  --card: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --ok: #15803d;
  --gold: #b45309;
  --gold-bg: #fffbeb;
  --radius: 12px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }

.brand-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--brand); color: #fff;
}
.brand-header .logo { font-weight: 800; letter-spacing: 0.5px; font-size: 18px; }
.brand-header .sub { font-size: 12px; opacity: 0.9; }
.ethos {
  font-size: 12px; color: var(--brand-dark); background: var(--brand-light);
  padding: 8px 14px; text-align: center; font-style: italic;
}

.container { max-width: 640px; margin: 0 auto; padding: 20px; }
.container.wide { max-width: 1080px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}

h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--brand-dark); }
.hint { color: var(--muted); font-size: 13px; }
.step-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 6px; }

.progress-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 12px 0 20px; }
.progress-fill { height: 100%; background: var(--brand); transition: width 0.2s ease; }
.progress-label { font-size: 12px; color: var(--muted); text-align: right; margin-top: -14px; margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 22px; border-radius: 10px; border: none; font-size: 16px; font-weight: 700;
  cursor: pointer; background: var(--brand); color: #fff; min-height: 48px; text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); min-height: auto; padding: 8px 10px; font-size: 14px; }
.btn.danger { background: var(--danger); }
.btn.small { min-height: 36px; padding: 8px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local],
select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
select { min-height: 48px; }
textarea { min-height: 90px; resize: vertical; }

.choice-group { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; margin: 0;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 15px; font-weight: 400;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.choice:hover { border-color: var(--brand); }
.choice.selected { border-color: var(--brand); background: var(--brand-light); font-weight: 600; }
.choice input { accent-color: var(--brand); pointer-events: none; }
.choice.big { padding: 18px 16px; font-size: 17px; font-weight: 700; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .check-grid { grid-template-columns: 1fr; } }
.check-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 11px; margin: 0;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-weight: 400; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.check-item.selected { border-color: var(--brand); background: var(--brand-light); }
.check-item input { accent-color: var(--brand); pointer-events: none; margin-top: 2px; }
.check-item.disabled { opacity: 0.4; cursor: not-allowed; }

.callout { border-radius: 8px; padding: 12px 14px; font-size: 13px; margin: 12px 0; }
.callout.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.callout.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.callout.ok { background: #ecfdf5; color: var(--ok); border: 1px solid #bbf7d0; }
.callout.brand { background: var(--brand-light); color: var(--brand-dark); border: 1px solid #bfe4e0; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li { margin-bottom: 3px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.open { background: #dcfce7; color: #166534; }
.badge.closed { background: #e2e8f0; color: #334155; }
.badge.upcoming { background: #fef3c7; color: #92400e; }
.badge.voted { background: #dcfce7; color: #166534; }
.badge.not-voted { background: #f1f5f9; color: #64748b; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.stat-card .label { font-size: 12px; color: var(--muted); }

.center-screen { min-height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-icon { font-size: 48px; margin-bottom: 8px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto; }

.link-box { display: flex; gap: 8px; align-items: center; background: var(--brand-light); border-radius: 8px; padding: 10px 12px; font-size: 13px; word-break: break-all; }

footer.ethos-footer { text-align: center; padding: 20px; font-size: 12px; color: var(--muted); }

.reason-count { font-size: 12px; color: var(--muted); margin-top: 6px; }
.reason-count.limit { color: var(--warn); font-weight: 700; }

.winner-banner {
  background: linear-gradient(135deg, var(--gold-bg), #fff); border: 1px solid #fde68a; border-radius: var(--radius);
  padding: 22px; text-align: center; margin-bottom: 16px;
}
.winner-banner .trophy { font-size: 40px; }
.winner-banner .name { font-size: 24px; font-weight: 800; color: var(--brand-dark); margin: 6px 0 2px; }
.winner-banner .home { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------- admin app */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: var(--brand); color: #fff; flex-wrap: wrap;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar .logo { font-weight: 800; letter-spacing: 0.5px; font-size: 18px; }
.topbar .sub { font-size: 12px; opacity: 0.9; }
.topbar-status { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.tab-nav { display: flex; gap: 2px; background: var(--card); border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.tab-btn:hover { color: var(--brand-dark); }
.tab-btn.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); font-size: 11px; margin: 2px 3px 2px 0; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr !important; }
}

@media (max-width: 700px) {
  .container { padding: 14px; }
  .card { padding: 16px; }
}
