:root {
  color-scheme: light dark;
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e7edf5;
  --muted: #93a4b8;
  --border: #334155;
  --accent: #3b82f6;
  --pos: #22c55e;
  --natural: #94a3b8;
  --neg: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(180deg, #0b1017 0%, #111827 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; flex-direction: column; min-width: 220px; }
.tagline { color: var(--muted); font-size: 0.85rem; }

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.site-header nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--text);
}

.site-header nav a.active {
  background: var(--surface-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1, h2 { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-secondary { background: var(--surface-2); }
.btn-small { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.btn-danger { border-color: #7f1d1d; color: #fecaca; }

.inline-form { display: inline; }

.panel, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.panel.narrow { max-width: 420px; margin: 3rem auto; }

.card-grid {
  display: grid;
  gap: 1rem;
}

.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid.two-col { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; }
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat, .metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.stat span, .metric span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.stat strong.ok { color: var(--pos); }
.stat strong.warn, .warn { color: var(--warn); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.room-badge {
  display: inline-block;
  background: var(--surface-2);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.vote-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  margin: 1rem 0 0.5rem;
}

.vote-bar.empty {
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.vote-bar .segment.pos { background: var(--pos); }
.vote-bar .segment.natural { background: var(--natural); }
.vote-bar .segment.neg { background: var(--neg); }

.vote-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-size: 0.85rem;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--surface-2);
}

.pill.pos { color: var(--pos); }
.pill.neg { color: var(--neg); }
.pill.natural { color: var(--natural); }

.stack-form {
  display: grid;
  gap: 0.75rem;
}

.stack-form label {
  display: grid;
  gap: 0.35rem;
}

input[type="text"],
input[type="password"] {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  font: inherit;
}

.error { color: #fecaca; }

.speaker-report .metric-row {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
}

.footnote { margin-top: 2rem; font-size: 0.9rem; }

.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-section-header h2 {
  margin-bottom: 0.25rem;
}

.settings-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.section-jumps {
  display: flex;
  gap: 0.75rem;
}

.section-jumps a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.section-jumps a:hover {
  text-decoration: none;
  background: var(--border);
}

.status-grid.compact {
  margin-bottom: 1rem;
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.banner.error, p.error.banner {
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid #7f1d1d;
}

.success.banner {
  background: rgba(22, 101, 52, 0.35);
  border: 1px solid #166534;
  color: #bbf7d0;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.action-details {
  display: inline-block;
}

.action-details summary {
  list-style: none;
  cursor: pointer;
}

.action-details summary::-webkit-details-marker {
  display: none;
}

.compact-form {
  margin-top: 0.75rem;
  min-width: 220px;
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: 8px;
}

code {
  background: #0b1220;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
