:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --primary: #22d3ee;
  --primary-dark: #0891b2;
  --danger: #f87171;
  --success: #4ade80;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2 { font-weight: 600; margin: 0 0 0.5em; }

a { color: var(--primary); }

.container { max-width: 900px; margin: 0 auto; padding: 24px 16px 64px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar h1 { flex: 1; margin: 0; font-size: 1.4rem; }

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

label { display: block; margin: 12px 0 4px; font-size: 0.9rem; color: var(--text-dim); }

input[type="text"], input[type="password"], input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--surface-light);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

textarea { min-height: 70px; resize: vertical; }

button {
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #003844;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: var(--surface-light); color: var(--text); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); margin-top: 8px; }
button.link-btn { background: transparent; color: var(--text-dim); text-decoration: underline; margin-top: 0; padding: 6px; }

.error { color: var(--danger); margin-top: 8px; min-height: 1.2em; }

.center-box {
  max-width: 380px;
  margin: 15vh auto 0;
  text-align: center;
  padding: 0 16px;
}
.center-box .subtitle { color: var(--text-dim); margin-bottom: 24px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-draft { background: #475569; color: #e2e8f0; }
.badge-open { background: #065f46; color: #6ee7b7; }
.badge-closed { background: #7f1d1d; color: #fca5a5; }
.badge-area { background: #164e63; color: #67e8f9; margin: 0 0 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--surface-light); }
th { color: var(--text-dim); font-weight: 500; font-size: 0.85rem; }

.sessions-table td a { white-space: nowrap; }

.qr-card { text-align: center; }
.qr-card img.qrcode { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; }
.url-hint { color: var(--text-dim); font-size: 0.85rem; word-break: break-all; }

.status-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.actions-list { list-style: none; padding: 0; margin: 16px 0 0; }
.actions-list li {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.actions-list p { margin: 4px 0 0; color: var(--text-dim); font-size: 0.9rem; }

/* Voter page */
.voter-container { max-width: 480px; margin: 0 auto; padding: 24px 16px 64px; }
.voter-container h1 { font-size: 1.3rem; text-align: center; margin-bottom: 20px; }
.status-message {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
}
.progress { text-align: center; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 8px; }

.scale-group { margin-bottom: 20px; }
.scale-label { display: block; margin-bottom: 8px; font-weight: 600; }
.scale-buttons { display: flex; gap: 8px; }
.scale-btn {
  flex: 1;
  margin-top: 0;
  padding: 14px 0;
  background: var(--surface-light);
  color: var(--text);
  border-radius: 8px;
  font-size: 1.1rem;
}
.scale-btn.selected { background: var(--primary); color: #003844; }

.review-list { list-style: none; padding: 0; margin-top: 20px; }
.review-list li {
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.review-list li:hover { background: var(--surface-light); }

/* Presenter screen */
.presenter-container { max-width: 1100px; margin: 0 auto; padding: 32px; }
.presenter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.presenter-header h1 { font-size: 2rem; }
.presenter-meta { display: flex; gap: 20px; align-items: center; font-size: 1.1rem; color: var(--text-dim); }
.conn-status { font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-light); }
.conn-status.connected { background: #065f46; color: #6ee7b7; }

.qr-big { text-align: center; margin-bottom: 32px; }
.qr-big img { width: 180px; height: 180px; background: #fff; padding: 10px; border-radius: 10px; }
.qr-big p { color: var(--text-dim); margin-top: 8px; }

.ranking-table.big th, .ranking-table.big td { font-size: 1.2rem; padding: 14px 12px; }
.ranking-table.big tbody tr:first-child td { color: var(--success); font-weight: 700; }
