:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #e3e8ee;
  --text: #172033;
  --muted: #687386;
  --blue: #2563eb;
  --blue-dark: #1746b0;
  --orange: #f59e0b;
  --green: #10b981;
  --red: #dc2626;
  --shadow: 0 8px 24px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button {
  font: inherit;
}

.topbar {
  min-height: 86px;
  padding: 18px clamp(20px, 4vw, 64px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.product-tag,
.section-label {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.topbar h1 {
  margin: 5px 0 0;
  font-size: clamp(24px, 3vw, 34px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-status {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.dashboard {
  width: min(1440px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.intro-panel {
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.intro-panel h2,
.panel-header h3,
.audit-header h3 {
  margin: 7px 0 8px;
}

.intro-panel p,
.audit-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.intro-copy {
  max-width: 680px;
}

.vote-actions {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
  margin-inline: auto;
}

.vote-button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: 0.18s ease;
}

.vote-button:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.vote-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.vote-button span {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.vote-a span {
  background: var(--blue);
}

.vote-b span {
  background: var(--orange);
}

.kpi-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  padding: 20px;
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: clamp(28px, 4vw, 42px);
}

.visual-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.65fr 0.85fr;
  gap: 16px;
}

.chart-panel,
.donut-panel,
.audit-panel {
  padding: 22px;
}

.panel-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.horizontal-chart {
  padding-top: 24px;
  display: grid;
  gap: 28px;
}

.chart-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.chart-row-title strong {
  font-size: 22px;
}

.chart-row small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.bar {
  height: 22px;
  border-radius: 5px;
  background: #eef1f5;
  overflow: hidden;
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s ease;
}

#chartABar {
  background: var(--blue);
}

#chartBBar {
  background: var(--orange);
}

.donut-wrap {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 20px;
}

.donut {
  --a: 0deg;
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 var(--a), var(--orange) var(--a) 360deg);
  position: relative;
  display: grid;
  place-items: center;
}

.donut::after {
  content: "";
  position: absolute;
  width: 104px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
}

.donut span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut strong,
.donut small {
  display: block;
}

.donut strong {
  font-size: 30px;
}

.donut small {
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-a {
  background: var(--blue);
}

.legend-b {
  background: var(--orange);
}

.audit-panel {
  margin-top: 16px;
}

.audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.primary-button,
.ghost-button {
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  border: 0;
  color: #fff;
  background: var(--blue);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: default;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
}

.audit-result {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.audit-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.audit-summary article {
  padding: 18px;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid var(--line);
}

.audit-summary span,
.audit-summary small {
  display: block;
  color: var(--muted);
}

.audit-summary strong {
  display: block;
  margin: 7px 0 3px;
  font-size: 30px;
}

.warning-card {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}

.warning-card strong {
  color: var(--red);
}

.comparison-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

.comparison-table th,
.comparison-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.comparison-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.disclaimer {
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 13px 16px;
  border-radius: 9px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: none;
}

@media (max-width: 920px) {
  .audit-header {
    align-items: stretch;
    flex-direction: column;
  }

  .vote-actions {
    min-width: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .visual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .topbar-actions .primary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .dashboard {
    width: min(100% - 20px, 1440px);
    margin-top: 10px;
  }

  .kpi-grid,
  .audit-summary {
    grid-template-columns: 1fr;
  }

  .vote-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .vote-button {
    padding: 14px 10px;
    flex-direction: column;
  }

  .intro-panel,
  .chart-panel,
  .donut-panel,
  .audit-panel {
    padding: 18px;
  }
}
