:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #111111;
  --muted: #626260;
  --faint: #7b7b78;
  --border: #dedbd6;
  --accent: #ff5600;
  --blue: #65b5ff;
  --green: #0bdf50;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  background: color-mix(in srgb, var(--bg) 94%, white);
  border-bottom: 1px solid var(--border);
}

a {
  color: inherit;
  text-decoration: none;
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

nav a,
button,
select {
  border: 1px solid var(--text);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

nav a {
  padding: 8px 10px;
  font-size: 14px;
}

button {
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

button:hover,
nav a:hover {
  transform: scale(1.04);
  background: var(--text);
  color: #ffffff;
}

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 40px;
  align-items: end;
  padding: 36px 0 32px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 0;
  font-size: clamp(42px, 7vw, 84px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 0.98;
}

h2 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.05;
}

.summary {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.note {
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.note p {
  max-width: 980px;
  margin-bottom: 0;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.control-group {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  background: var(--bg);
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.meta dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.meta div {
  display: grid;
  gap: 2px;
}

.meta dt {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.meta dd {
  margin: 0;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.profiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profiles article,
.event-context {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.profiles article {
  min-height: 180px;
  padding: 18px;
}

.profiles p:last-child,
.event-context p:last-child {
  margin-bottom: 0;
}

.event-context {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

#event-domain {
  color: var(--muted);
}

.comparison {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.comparison-head,
.variant-row {
  display: grid;
  grid-template-columns: 180px minmax(320px, 1fr) minmax(320px, 1fr);
  min-width: 900px;
}

.comparison-head {
  z-index: 10;
  background: var(--text);
  color: #ffffff;
}

.comparison-head span {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.variant-row {
  border-top: 1px solid var(--border);
}

.variant-meta,
.feedback-cell {
  padding: 14px;
}

.variant-meta {
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.feedback-cell + .feedback-cell {
  border-left: 1px solid var(--border);
}

.variant-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.pill.gentle {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--border));
}

.pill.strong {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
}

.case-tools {
  margin-top: 14px;
}

.case-toggle {
  min-height: 34px;
  padding: 0 10px;
  background: #ffffff;
  border-color: var(--border);
  color: var(--muted);
  font-size: 13px;
}

.case-details {
  grid-column: 1 / -1;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.case-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-block {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.detail-block h4 {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-sections {
  display: grid;
  gap: 14px;
}

.input-sections section {
  display: grid;
  gap: 8px;
}

.input-sections h5 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.input-sections dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.input-field {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.input-field dt {
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.input-field dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.input-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.input-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.empty-value {
  color: var(--faint);
}

.detail-block pre {
  overflow: auto;
  max-height: 360px;
  margin: 0;
  color: var(--text);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-label {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}

.feedback-text {
  margin: 0;
  white-space: pre-wrap;
}

.vote-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.vote-button {
  min-height: 34px;
  padding: 0 10px;
  background: #ffffff;
  border-color: var(--border);
  color: var(--muted);
  font-size: 13px;
}

.vote-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  min-height: 22px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
}

.vote-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.vote-button.selected {
  border-color: var(--text);
  background: var(--text);
  color: #ffffff;
}

.vote-button.selected span {
  background: #ffffff;
  color: var(--text);
}

.vote-button:disabled:hover {
  transform: none;
  background: #ffffff;
  color: var(--muted);
}

.vote-button.selected:disabled:hover {
  background: var(--text);
  color: #ffffff;
}

@media (max-width: 980px) {
  .hero,
  .workspace,
  .profiles {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .event-context {
    align-items: stretch;
    flex-direction: column;
  }

  .case-detail-grid {
    grid-template-columns: 1fr;
  }

  .input-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding-inline: 16px;
  }
}
