:root {
  --bg: oklch(14% 0.02 250);
  --bg-2: oklch(18% 0.03 250);
  --panel: oklch(18% 0.03 250 / 0.86);
  --panel-2: oklch(100% 0 0 / 0.05);
  --text: oklch(96% 0.01 250);
  --muted: oklch(80% 0.02 250);
  --line: oklch(80% 0.02 250 / 0.2);
  --accent: oklch(65% 0.15 20);
  --accent-2: oklch(50% 0.15 150);
  --danger: oklch(60% 0.18 20);
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, oklch(65% 0.15 20 / 0.18), transparent 30%),
    radial-gradient(circle at 80% 20%, oklch(50% 0.15 150 / 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

a { color: inherit; }

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 24px;
  position: relative;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 18px;
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eyebrow,
.hero-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 800;
  color: oklch(98% 0 0);
}

.lede {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.lede-copy {
  display: block;
}

.lede-footnote {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.hero-card,
.panel,
.panel-card,
.status,
.summary,
.results {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.hero-card {
  display: flex;
  align-items: start;
  padding: 14px 18px;
  background:
    linear-gradient(135deg, oklch(65% 0.15 20 / 0.2), oklch(50% 0.15 150 / 0.12)),
    var(--panel);
}

.hero-card strong {
  display: block;
  margin: 3px 0 2px;
  font-size: 17px;
}

.hero-copy {
  display: block;
  color: var(--muted);
  line-height: 1.25;
  font-size: 0.85rem;
}

.panel,
.panel-card {
  padding: 20px 24px;
  margin-bottom: 18px;
}

/* Segmented Toggle Control - copied 1:1 from /wrapped & /certificate */
.data-source-toggle {
  display: flex;
  background: oklch(20% 0.03 250 / 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 9999px;
  border: 1px solid oklch(80% 0.02 250 / 0.1);
  margin-bottom: 24px;
  gap: 0;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.toggle-option {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
  border-radius: 9999px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  user-select: none;
}

.toggle-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-option span {
  font-size: 0.95rem;
  font-weight: 700;
  color: oklch(75% 0.02 250);
  position: relative;
  z-index: 2;
  transition: color 0.3s ease;
  letter-spacing: 0.02em;
}

.toggle-option:has(input:checked) {
  background: linear-gradient(135deg, oklch(65% 0.2 30), oklch(55% 0.22 260));
  box-shadow: 0 6px 16px oklch(60% 0.2 145 / 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.toggle-option:has(input:checked) span {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.toggle-option:hover:not(:has(input:checked)) {
  background: oklch(90% 0.02 250 / 0.05);
}

.toggle-option:hover:not(:has(input:checked)) span {
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 0.8fr);
  gap: 20px;
  align-items: end;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type="url"],
select,
textarea {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  color: var(--text);
  background: oklch(13% 0.02 250 / 0.55);
  outline: none;
  font: inherit;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

textarea {
  height: auto;
  padding: 12px 16px;
}

select {
  padding: 0 36px 0 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23889098' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 13px;
}

#configuredSection,
#customSection {
  margin: 0;
  padding: 0;
}

input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: oklch(65% 0.15 20 / 0.65);
  box-shadow: 0 0 0 4px oklch(65% 0.15 20 / 0.14);
}

button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0 22px;
  height: 48px;
  min-height: 48px;
  box-sizing: border-box;
  background: linear-gradient(135deg, oklch(62% 0.18 20), oklch(55% 0.18 15));
  color: white;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 48px;
  cursor: pointer;
  box-shadow: 0 4px 16px oklch(65% 0.15 20 / 0.3);
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, oklch(66% 0.19 20), oklch(58% 0.19 15));
  transform: translateY(-2px);
  box-shadow: 0 8px 24px oklch(65% 0.15 20 / 0.45);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px oklch(65% 0.15 20 / 0.35);
}

.btn-secondary:focus-visible {
  box-shadow: 0 0 0 3px oklch(65% 0.15 20 / 0.35);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: oklch(100% 0 0 / 0.06);
  border-color: oklch(80% 0.02 250 / 0.4);
  color: var(--text);
  box-shadow: none;
}

button.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid oklch(100% 0 0 / 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: button-spin 600ms linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

/* Status Box - 1:1 with /judge-subsidy */
.status {
  padding: 12px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: oklch(96% 0.01 250 / 0.9);
  font-size: 0.95rem;
}

.status[hidden] {
  display: none;
}

.status.error {
  border-color: oklch(60% 0.18 20 / 0.35);
  color: oklch(85% 0.02 250);
}

.status.warning {
  border-color: oklch(78% 0.15 85 / 0.45);
  color: oklch(90% 0.08 85);
}

/* Status message */
.status-msg {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Results section appearance */
.results-section {
  margin-top: 14px;
}

/* Flow Placeholder (matches /judge-subsidy) */
.flow-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 16px 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--panel);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .flow-placeholder {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  .flow-arrow { display: none; }
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flow-step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: oklch(65% 0.15 20 / 0.15);
  border: 1px solid oklch(65% 0.15 20 / 0.4);
  color: oklch(65% 0.15 20);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.flow-step-text {
  display: flex;
  flex-direction: column;
}

.flow-step-text strong {
  font-size: 0.95rem;
}

.flow-step-text span {
  font-size: 0.82rem;
  color: var(--muted);
}

.flow-arrow {
  color: var(--muted);
  font-size: 1.2rem;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: oklch(80% 0.02 250 / 0.35);
}

.kpi-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: oklch(98% 0 0);
  line-height: 1;
}

/* Section Header & Collapsible Sections */
.section-header.collapsible-header {
  user-select: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  transition: opacity 0.2s ease;
}

.section-header .header-text {
  flex: 1;
}

.section-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  color: oklch(98% 0 0);
  letter-spacing: -0.01em;
}

.section-header p.lede {
  margin: 0;
  font-size: 0.88rem;
  text-wrap: pretty;
}

.collapse-toggle {
  background: oklch(20% 0.03 250 / 0.6);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.collapse-toggle:hover {
  background: oklch(28% 0.04 250 / 0.8) !important;
  color: var(--text) !important;
}

.collapse-toggle svg {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-card.collapsed .collapse-toggle svg {
  transform: rotate(-90deg);
}

/* Results Grid - 2 column layout for analytics */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.results-main {
  display: flex;
  flex-direction: column;
}

.results-sidebar {
  display: flex;
  flex-direction: column;
}

/* Outround progression board */
.outround-progression {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.outround-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.outround-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: oklch(100% 0 0 / 0.04);
  color: var(--muted);
  font-size: 0.8rem;
}

.outround-summary strong {
  color: var(--text);
  font-size: 0.92rem;
}

.outround-guide {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.outround-guide span {
  color: oklch(82% 0.14 150);
  font-size: 1rem;
}

.outround-category {
  min-width: 0;
}

.outround-category + .outround-category {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.outround-category-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.outround-category-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.outround-category-header span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.outround-board {
  overflow-x: auto;
  padding: 2px 2px 12px;
  scrollbar-color: oklch(60% 0.05 250) transparent;
  overscroll-behavior-inline: contain;
}

.outround-board:focus-visible {
  outline: 2px solid oklch(75% 0.16 150);
  outline-offset: 4px;
  border-radius: 12px;
}

.outround-rounds {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 16px;
  min-width: min-content;
}

.outround-stage {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: oklch(12% 0.02 250);
  scroll-snap-align: start;
}

.outround-stage-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, oklch(50% 0.15 150 / 0.14), transparent 70%),
    oklch(15% 0.025 250);
}

.outround-stage-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.outround-stage-step {
  grid-column: 1 / -1;
  color: oklch(78% 0.12 150);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.outround-stage-count {
  align-self: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.outround-team-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
}

.outround-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: oklch(17% 0.02 250);
}

.outround-team-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.outround-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.outround-team-advanced {
  border-color: oklch(55% 0.15 150 / 0.34);
  background: oklch(35% 0.15 150 / 0.12);
}

.outround-team-advanced .outround-status {
  color: oklch(86% 0.15 150);
}

.outround-team-eliminated {
  border-color: oklch(56% 0.12 25 / 0.25);
  background: oklch(35% 0.1 25 / 0.1);
}

.outround-team-eliminated .outround-status {
  color: oklch(82% 0.1 25);
}

.outround-team-champion {
  border-color: oklch(72% 0.16 82 / 0.5);
  background: linear-gradient(120deg, oklch(47% 0.13 75 / 0.38), oklch(28% 0.08 75 / 0.12));
}

.outround-team-champion .outround-status {
  color: oklch(90% 0.17 85);
}

.outround-team-runner-up {
  border-color: oklch(74% 0.025 250 / 0.38);
  background: oklch(70% 0.02 250 / 0.1);
}

.outround-team-finalist {
  border-color: oklch(62% 0.04 250 / 0.3);
  background: oklch(45% 0.025 250 / 0.08);
}

.outround-team-runner-up .outround-status,
.outround-team-finalist .outround-status,
.outround-team-recorded .outround-status {
  color: var(--muted);
}

@media (max-width: 640px) {
  .outround-board {
    margin-inline: -12px;
    padding-inline: 12px;
    scroll-snap-type: inline mandatory;
  }

  .outround-rounds {
    grid-auto-columns: minmax(280px, 76vw);
  }

  .outround-stage-header {
    position: sticky;
    top: 0;
    z-index: 1;
  }
}

/* Panel cards expanded by default */
.panel-card {
  padding: 20px 24px;
  margin-bottom: 18px;
}

.panel-card.collapsed {
  padding-bottom: 20px;
}

.panel-card.collapsed > :not(.section-header) {
  display: none !important;
}

/* Motion Card */
.motions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.motion-round-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: oklch(10% 0.02 250 / 0.55);
}

.motion-round-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.motion-round-group-title {
  color: oklch(94% 0.02 250);
  font-size: 0.95rem;
  font-weight: 800;
}

.motion-round-group-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.motion-round-motions {
  display: grid;
  gap: 12px;
}

.motion-card {
  background: oklch(12% 0.02 250);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.motion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.motion-round {
  font-size: 0.8rem;
  font-weight: 800;
  background: oklch(24% 0.04 250);
  padding: 4px 10px;
  border-radius: 6px;
  color: oklch(90% 0.02 250);
}

.motion-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
  line-height: 1.4;
  flex: 1;
}

.balance-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.balance-badge.balanced {
  background: oklch(35% 0.15 150 / 0.3);
  color: oklch(85% 0.18 150);
  border: 1px solid oklch(50% 0.15 150 / 0.5);
}

.balance-badge.biased {
  background: oklch(35% 0.15 20 / 0.3);
  color: oklch(88% 0.18 20);
  border: 1px solid oklch(50% 0.15 20 / 0.5);
}

.balance-badge.outround,
.balance-badge.inconclusive {
  background: oklch(25% 0.04 250 / 0.6);
  color: oklch(75% 0.02 250);
  border: 1px solid oklch(40% 0.05 250 / 0.4);
}

.stat-bars {
  display: flex;
  gap: 4px;
  height: 24px;
  border-radius: 8px;
  overflow: hidden;
  background: oklch(10% 0.02 250);
}

.motion-no-data-note {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: oklch(16% 0.03 250 / 0.6);
  border: 1px dashed oklch(35% 0.04 250 / 0.5);
  border-radius: 8px;
  font-size: 0.8rem;
  color: oklch(75% 0.03 250);
}

.stat-bar-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
}

.seg-og { background: oklch(55% 0.22 260); }
.seg-oo { background: oklch(65% 0.2 140); }
.seg-cg { background: oklch(65% 0.2 30); }
.seg-co { background: oklch(60% 0.22 320); }
.seg-gov { background: oklch(55% 0.22 260); }
.seg-opp { background: oklch(65% 0.2 30); }

.motion-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Distribution Stats Grid */
.dist-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.dist-stat-card {
  background: oklch(12% 0.02 250);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dist-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.dist-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
}

/* Buckets Container */
.buckets-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.bucket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.bucket-label {
  width: 70px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
}

.bucket-bar-wrapper {
  flex: 1;
  height: 18px;
  background: oklch(10% 0.02 250);
  border-radius: 6px;
  overflow: hidden;
}

.bucket-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, oklch(65% 0.2 30), oklch(60% 0.22 260));
  border-radius: 6px;
}

.bucket-count {
  width: 40px;
  font-weight: 800;
  color: white;
}

/* Data Table (matches /judge-subsidy table-shell) */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.9rem;
}

.category-table-wrapper {
  max-width: 980px;
}

.category-table-wrapper .data-table {
  table-layout: fixed;
}

.category-table-wrapper .data-table th:first-child,
.category-table-wrapper .data-table td:first-child {
  width: 32%;
}

.category-table-wrapper .cell-sm-num {
  width: 15%;
}

.category-table-wrapper .cell-num:not(.cell-sm-num) {
  width: 23%;
}

.draw-strength-table-wrapper {
  max-width: 1220px;
}

.draw-strength-table-wrapper .data-table {
  table-layout: fixed;
}

.draw-strength-table-wrapper .data-table th:nth-child(2),
.draw-strength-table-wrapper .data-table td:nth-child(2) {
  width: 52%;
}

.draw-strength-table-wrapper .cell-lg-num {
  width: 28%;
}

.draw-strength-table-wrapper .cell-sm-num {
  width: 12%;
}

.adjudicator-workload-table-wrapper .data-table {
  table-layout: fixed;
}

.adjudicator-workload-table-wrapper .cell-sm-num {
  width: 12.4%;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: oklch(16% 0.03 250);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
  box-shadow: 0 1px 0 var(--line);
}

.data-table td.cell-strong {
  white-space: normal;
  word-break: break-word;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: oklch(100% 0 0 / 0.03);
}

/* Data Table Utility Alignment & Proportional Column Widths */
.cell-num {
  text-align: center !important;
  width: 16%;
}

.cell-sm-num {
  width: 11%;
  text-align: center !important;
}

.cell-lg-num {
  width: 25%;
  text-align: center !important;
}

.cell-rank {
  width: 44px;
  text-align: center !important;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.cell-mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.cell-highlight {
  font-weight: 800;
  color: oklch(95% 0.1 220);
}

.table-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.table-footnote svg {
  flex-shrink: 0;
  opacity: 0.75;
}

/* Stat Grid (Draw Strength & Metrics) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.stat-card {
  background: oklch(12% 0.02 250);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  border-color: oklch(80% 0.02 250 / 0.35);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: oklch(98% 0 0);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* Stage Staffing Grid & Badges */
.stage-staffing-grid {
  margin-bottom: 16px;
}

.stage-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.stage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.3;
}

.badge-subtle {
  background: oklch(100% 0 0 / 0.06);
  border: 1px solid oklch(80% 0.02 250 / 0.18);
  color: oklch(92% 0.02 250);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
}

.badge-outround {
  background: oklch(50% 0.15 150 / 0.2);
  border: 1px solid oklch(50% 0.15 150 / 0.4);
  color: oklch(88% 0.16 150);
}

/* Workload Insight Alert Card */
.workload-insight-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-top: 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: oklch(12% 0.02 250);
  line-height: 1.4;
}

.workload-insight-card .insight-icon {
  flex-shrink: 0;
}

.insight-success {
  border-color: oklch(50% 0.15 150 / 0.35);
  background: oklch(35% 0.15 150 / 0.1);
  color: oklch(92% 0.12 150);
}

.insight-success .insight-icon {
  color: oklch(75% 0.18 150);
}

.insight-warning {
  border-color: oklch(78% 0.15 85 / 0.35);
  background: oklch(40% 0.12 85 / 0.1);
  color: oklch(92% 0.12 85);
}

.insight-warning .insight-icon {
  color: oklch(80% 0.18 85);
}

.insight-info {
  border-color: oklch(70% 0.12 240 / 0.35);
  background: oklch(30% 0.1 240 / 0.1);
  color: oklch(90% 0.08 240);
}

.insight-info .insight-icon {
  color: oklch(75% 0.15 240);
}

/* PR Box */
.pr-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pr-box label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.pr-box select {
  max-width: 240px;
}

.pr-box textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Section headings in analytics panels */
.section-heading {
  margin: 20px 0 4px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.section-heading + .lede {
  margin: 0 0 16px;
  font-size: 0.88rem;
}

/* Spacing utilities for dynamically rendered content */
.spacer-top-sm { margin-top: 12px; }
.spacer-top-md { margin-top: 16px; }
.spacer-top-lg { margin-top: 20px; }

/* Dist header (flex row for scale badge + speech count) */
.dist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.scale-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: oklch(85% 0.15 150);
  background: oklch(35% 0.15 150 / 0.25);
  border: 1px solid oklch(50% 0.15 150 / 0.4);
  padding: 4px 10px;
  border-radius: 999px;
}

.speech-count {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Strong cell for table headers and institution names */
.cell-strong {
  font-weight: 700;
  color: white;
}

.institution-source {
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid oklch(70% 0.08 220 / 0.35);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

.institution-table-wrapper .data-table {
  table-layout: fixed;
}

.institution-table-wrapper .data-table th:first-child,
.institution-table-wrapper .data-table td:first-child {
  width: 34%;
}

.institution-table-wrapper .cell-sm-num {
  width: 12%;
}

.institution-table-wrapper .cell-lg-num {
  width: 20%;
}

.institution-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.15fr) minmax(200px, 0.9fr) auto;
  align-items: end;
  gap: 16px;
  margin: 20px 0 12px;
}

.institution-controls > label:not(.institution-unmatched-toggle) {
  min-width: 0;
}

.institution-controls > label:not(.institution-unmatched-toggle) input[type="search"],
.institution-controls > label:not(.institution-unmatched-toggle) select {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  box-sizing: border-box;
}

.institution-controls > label:not(.institution-unmatched-toggle) {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.institution-unmatched-toggle {
  display: flex !important;
  align-items: center;
  align-self: end;
  gap: 9px;
  padding: 0 0 14px;
  white-space: nowrap;
}

.institution-unmatched-toggle input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

@media (max-width: 760px) {
  .institution-controls {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .institution-unmatched-toggle {
    align-self: start;
    padding: 2px 0 0;
  }
}

.institution-unmatched {
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--muted);
  background: oklch(25% 0.04 250 / 0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.institution-unmatched ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.institution-sample {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

#institutionDataNotice[data-status="estimated"] {
  color: oklch(82% 0.12 85);
}

#institutionDataNotice[data-status="unavailable"] {
  color: oklch(78% 0.14 25);
}

/* Results section appearance */
.results-section {
  margin-top: 14px;
}
#toast {
  visibility: hidden;
  min-width: 260px;
  background-color: oklch(18% 0.03 250 / 0.95);
  backdrop-filter: blur(8px);
  color: white;
  text-align: center;
  border-radius: 12px;
  padding: 12px 18px;
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px oklch(0% 0 0 / 0.5);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

#toast.show {
  visibility: visible;
}

#toast.success { border-color: var(--accent-2); }
#toast.error { border-color: var(--danger); }

/* Average Speaks by Round */
.round-speaks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.round-speak-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: oklch(14% 0.02 250);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.round-speak-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: oklch(90% 0.02 250);
}
.round-speak-badge {
  font-size: 0.85rem;
  font-weight: 800;
  color: white;
  background: oklch(30% 0.05 250);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 6px;
}

/* SVG Speaks Chart */
.speaks-chart-container {
  width: 100%;
  background: oklch(14% 0.02 250);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px 12px 20px;
  margin-top: 20px;
  margin-bottom: 24px;
}

.speaks-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed oklch(22% 0.03 250);
}
.speaks-chart-header .section-heading {
  margin-bottom: 0;
  font-size: 0.95rem;
}
.speaks-overall-badge {
  font-size: 0.8rem;
  color: oklch(75% 0.02 250);
  background: oklch(18% 0.03 250);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 8px;
}
.speaks-overall-badge strong {
  color: var(--accent);
  margin-left: 4px;
}

.speaks-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-point-group circle {
  transition: r 0.2s ease, fill 0.2s ease;
  cursor: pointer;
}

.chart-point-group:hover circle {
  r: 7.5;
  fill: oklch(95% 0.2 230);
}
