:root {
  color-scheme: light;
  --bg: #f5efe5;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffdf9;
  --line: #dacbb5;
  --line-strong: #b79d7b;
  --ink: #1f1c17;
  --muted: #6e6558;
  --accent: #8f2f1f;
  --accent-strong: #642014;
  --accent-soft: #f1ddd3;
  --good: #2f6c52;
  --danger: #a3282f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Baskerville, "Palatino Linotype", "Book Antiqua", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(163, 40, 47, 0.08), transparent 26%),
    radial-gradient(circle at top right, rgba(47, 108, 82, 0.1), transparent 24%),
    linear-gradient(180deg, #f9f4eb 0%, #f3ebdf 100%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 80px;
}

.hero {
  padding: 18px 0 24px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
legend,
strong {
  margin: 0;
  font-weight: 600;
}

h1 {
  max-width: 15ch;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.5rem;
}

.lede,
.muted,
#session-status,
small {
  color: var(--muted);
}

.compact {
  max-width: 42ch;
}

.grid {
  display: grid;
  gap: 18px;
}

.two-column {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stack {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(58, 44, 24, 0.08);
}

.nested {
  background: var(--panel-strong);
  box-shadow: none;
}

.subtle {
  background: rgba(255, 248, 239, 0.88);
  box-shadow: none;
}

.callout {
  border-color: var(--line-strong);
  background: linear-gradient(135deg, rgba(143, 47, 31, 0.09), rgba(255, 255, 255, 0.72));
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.section-head.tight {
  align-items: center;
}

label {
  display: grid;
  gap: 8px;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: white;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

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

.compact-button {
  justify-self: start;
  padding-inline: 14px;
}

.hidden {
  display: none !important;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.role-card.inactive {
  opacity: 0.7;
}

.role-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.role-toggle span {
  display: grid;
  gap: 4px;
}

.role-toggle-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.role-toggle input {
  width: auto;
  transform: scale(1.15);
}

.role-count {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.85rem;
}

.template-summary {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(143, 47, 31, 0.08), rgba(255, 255, 255, 0.92));
}

.template-summary-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.template-summary-head p {
  margin: 6px 0 0;
}

.question-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.question-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-row-prompt textarea {
  min-height: 88px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.score-pill {
  background: rgba(47, 108, 82, 0.12);
  color: var(--good);
}

.danger-pill {
  background: rgba(163, 40, 47, 0.12);
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

a {
  color: var(--accent-strong);
}

.block {
  gap: 12px;
}

.block legend {
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.block-head {
  display: grid;
  gap: 4px;
}

.question-prompt {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.rating-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rating-chip {
  position: relative;
}

.rating-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.rating-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fffaf4;
  color: var(--muted);
  font-weight: 600;
  gap: 6px;
  text-align: center;
}

.rating-chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.report-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.report-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.metric {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.plain-list li {
  display: grid;
  gap: 4px;
}

.email-preview {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffaf4;
}

.email-preview summary {
  cursor: pointer;
  color: var(--accent-strong);
}

.email-preview pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  font-family: "Courier New", monospace;
  font-size: 0.86rem;
}

.danger {
  color: var(--danger);
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .panel {
    padding: 18px;
  }

  .section-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .status-panel {
    align-items: start;
    flex-direction: column;
  }

  .template-summary-head,
  .role-toggle-meta {
    display: grid;
  }

  h1 {
    max-width: none;
  }
}
