/* ── Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Sartorius wordmark: hidden in default theme, shown via sartorius.css */
.sart-wordmark { display: none; }

:root {
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-light:  #eff6ff;
  --blue-border: #bfdbfe;
  --green:       #059669;
  --red:         #dc2626;
  --amber:       #d97706;
  --bg:          #f1f5f9;
  --card-bg:     #ffffff;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --muted:       #64748b;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.08);
  --shadow-lg:   0 4px 12px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
  background: var(--blue);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon { font-size: 26px; line-height: 1; }

.header-title h1 { font-size: 1.15rem; font-weight: 700; }
.header-sub     { font-size: 0.78rem; opacity: 0.8; }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Countdown badge */
.countdown-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: 5px 14px;
  text-align: center;
  min-width: 120px;
}

.countdown-badge .cd-label { font-size: 0.68rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.countdown-badge .cd-time  { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown-badge.urgent    { background: rgba(220,38,38,.3); border-color: #fca5a5; }

/* Vote badge */
.vote-badge {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: 5px 16px;
  text-align: center;
  min-width: 90px;
}

.badge-label { font-size: 0.68rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; display: block; }
.badge-count { font-size: 1.5rem; font-weight: 800; line-height: 1.1; display: block; }
.badge-count.empty { color: #fca5a5; }

/* ── Closed banner ───────────────────────────────────────── */
.closed-banner {
  background: #fef3c7;
  border-bottom: 2px solid #fbbf24;
  color: #92400e;
  text-align: center;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 13px 20px;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Tab panels ──────────────────────────────────────────── */
.tab-panel {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.hidden { display: none !important; }

/* ── Vote layout (split: main + sidebar) ─────────────────── */
.vote-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.93rem;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}

.category-filters { display: flex; flex-wrap: wrap; gap: 6px; }

.cat-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.cat-btn:hover  { border-color: var(--blue); color: var(--blue); }
.cat-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Instructions ────────────────────────────────────────── */
.instructions {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 16px;
}

/* ── Ideas grid ──────────────────────────────────────────── */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.idea-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}

.idea-card.voted {
  border-color: var(--blue-border);
  background: var(--blue-light);
}

.idea-card.closed { opacity: .7; pointer-events: none; }

.idea-card-top { display: flex; align-items: flex-start; gap: 8px; }

.idea-number {
  flex-shrink: 0;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
  margin-top: 3px;
}

.idea-title { font-size: 0.92rem; font-weight: 600; line-height: 1.35; }
.idea-desc  { font-size: 0.81rem; color: var(--muted); line-height: 1.45; }

.idea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.category-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vote-controls { display: flex; align-items: center; gap: 5px; }

.vote-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
  font-weight: 600;
}

.vote-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.vote-btn:disabled              { opacity: .3; cursor: not-allowed; }
.vote-btn.plus:not(:disabled)  { border-color: var(--blue); color: var(--blue); }

.vote-count      { min-width: 24px; text-align: center; font-size: 0.95rem; font-weight: 700; color: var(--blue); }
.vote-count.zero { color: var(--muted); font-weight: 400; }

.global-votes { font-size: 0.72rem; color: var(--muted); text-align: right; }

/* ── Standings sidebar ───────────────────────────────────── */
.standings-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.standings-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.standings-header h2 { font-size: 0.88rem; font-weight: 700; }
.standings-updated   { font-size: 0.72rem; color: var(--muted); }

.standings-list { padding: 8px 0; }

.standing-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  transition: background .1s;
}

.standing-row:hover { background: var(--bg); }

.standing-rank   { font-size: 0.85rem; font-weight: 700; color: var(--muted); text-align: center; }
.standing-medal  { font-size: 1rem; text-align: center; }
.standing-title  { font-size: 0.82rem; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.standing-votes  { font-size: 0.9rem; font-weight: 800; color: var(--blue); white-space: nowrap; }

/* ── Full results tab ────────────────────────────────────── */
.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.results-stats { font-size: 0.9rem; color: var(--muted); }
.results-stats strong { color: var(--text); }

.refresh-info {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.82rem;
  color: var(--blue);
  cursor: pointer;
  transition: background .12s;
}
.refresh-btn:hover { background: var(--blue-light); }

.results-list { display: flex; flex-direction: column; gap: 10px; }

.result-row {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.result-row.top-3 { border-color: var(--blue-border); }

.result-rank       { font-size: 1.1rem; font-weight: 800; color: var(--muted); text-align: center; }
.result-rank.medal { font-size: 1.35rem; }

.result-body   { min-width: 0; }
.result-title  { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }

.result-category {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.result-supporters { font-size: 0.75rem; color: var(--muted); }

.progress-bar  { height: 5px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 999px; transition: width .5s ease; }

.result-votes      { font-size: 1.35rem; font-weight: 800; color: var(--blue); text-align: right; white-space: nowrap; }
.result-votes span { display: block; font-size: 0.68rem; font-weight: 500; color: var(--muted); }

/* ── Utility ─────────────────────────────────────────────── */
.loading   { color: var(--muted); padding: 32px 0; text-align: center; font-size: 0.9rem; }
.error-msg { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 0.88rem; }
.no-results { color: var(--muted); text-align: center; padding: 40px 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .vote-layout { grid-template-columns: 1fr; }
  .standings-sidebar { position: static; max-height: 320px; }
}

@media (max-width: 600px) {
  .header-title h1       { font-size: 0.95rem; }
  .badge-count           { font-size: 1.2rem; }
  .countdown-badge       { min-width: 90px; }
  .countdown-badge .cd-time { font-size: 0.88rem; }
  .ideas-grid            { grid-template-columns: 1fr; }
  .result-row            { grid-template-columns: 32px 1fr auto; }
  .result-title          { font-size: 0.86rem; }
  .result-votes          { font-size: 1.1rem; }
  .header-right          { gap: 6px; }
}

/* ── Passcode overlay ────────────────────────────────────── */
.passcode-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.passcode-screen.hidden { display: none; }

.passcode-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.passcode-icon { font-size: 40px; line-height: 1; margin-bottom: 4px; }
.passcode-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.passcode-sub { font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.passcode-prompt { font-size: 0.95rem; color: var(--text); }

.passcode-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.passcode-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color .15s;
}
.passcode-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.passcode-btn {
  width: 100%;
  padding: 10px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.passcode-btn:hover { background: var(--blue-hover); }

.passcode-error {
  width: 100%;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: var(--red);
  font-size: 0.88rem;
  text-align: center;
}
.passcode-error.hidden { display: none; }
