:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #eef3f8;
  --text: #17202a;
  --muted: #5d6b7a;
  --line: #d9e1ea;
  --primary: #145c52;
  --primary-strong: #0e463f;
  --primary-soft: #dff3ef;
  --accent: #9b2c4a;
  --warning: #8a5a10;
  --danger: #9f2636;
  --shadow: 0 18px 40px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(20, 92, 82, 0.06), rgba(245, 247, 250, 0) 36%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.session-actions,
.results-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand span,
.metric-block span,
.metric-block small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand div span,
.session-name {
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.12);
  position: relative;
}

.brand-mark::before {
  content: "";
  width: 16px;
  height: 10px;
  border-left: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.brand-mark.large::before {
  width: 24px;
  height: 14px;
  border-left-width: 4px;
  border-bottom-width: 4px;
}

.workspace {
  width: min(1180px, calc(100vw - 32px));
  margin: 30px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.main-panel,
.side-panel,
.callback-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.main-panel {
  padding: clamp(18px, 3vw, 30px);
}

.side-panel {
  padding: 18px;
  align-self: start;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: 0;
}

.status-badge {
  min-width: 112px;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-badge.ready {
  border-color: rgba(20, 92, 82, 0.28);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.status-badge.closed {
  border-color: rgba(138, 90, 16, 0.3);
  background: #fff3d8;
  color: var(--warning);
}

.message {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.message.error {
  border-color: rgba(159, 38, 54, 0.24);
  background: #fff0f2;
  color: var(--danger);
}

.message.success {
  border-color: rgba(20, 92, 82, 0.24);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.vote-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.vote-form legend {
  width: 1px;
  height: 1px;
  overflow: hidden;
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.candidate-option {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  background: #ffffff;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.candidate-option:hover {
  border-color: rgba(20, 92, 82, 0.42);
  box-shadow: 0 8px 20px rgba(23, 32, 42, 0.06);
}

.candidate-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  margin: 2px 0 0;
}

.candidate-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.candidate-option strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.candidate-option span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.button,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 40px;
  border-radius: 8px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button {
  padding: 0 15px;
  font-weight: 700;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  color: #ffffff;
  background: var(--primary);
}

.button.primary:not(:disabled):hover {
  background: var(--primary-strong);
}

.button.secondary {
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--text);
}

.button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--surface-muted);
  border-color: var(--line);
  color: var(--text);
}

.metric-block {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.metric-block:first-child {
  padding-top: 0;
}

.metric-block span,
.results-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric-block strong {
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.2;
}

.metric-block small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.results-block {
  padding-top: 16px;
}

.results-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.results-list {
  display: grid;
  gap: 12px;
}

.result-row {
  display: grid;
  gap: 6px;
}

.result-row header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-muted);
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.callback-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.callback-box {
  width: min(430px, 100%);
  padding: 30px;
  text-align: center;
}

.callback-box h1 {
  margin-top: 18px;
  font-size: 26px;
}

.callback-box p {
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar,
  .session-actions,
  .panel-header,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
  }

  .session-actions {
    gap: 8px;
  }

  .workspace {
    grid-template-columns: 1fr;
    margin-top: 18px;
  }

  .button {
    width: 100%;
  }
}

