:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --ink: #17201b;
  --muted: #657069;
  --line: #dce3dc;
  --green: #1f7a4d;
  --green-dark: #155d3a;
  --amber: #b46613;
  --red: #b83d45;
  --blue: #2d5f9f;
  --shadow: 0 20px 60px rgba(23, 32, 27, 0.09);
}

* {
  box-sizing: border-box;
}

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

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

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

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.nav,
.nav form,
.row-actions,
.sticky-actions,
.meta-row,
.review-title,
.subsection-heading,
.attempt-row {
  align-items: center;
  display: flex;
}

.brand {
  font-weight: 800;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 8px;
  color: white;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.nav {
  color: var(--muted);
  gap: 18px;
  font-weight: 650;
}

.shell {
  margin: 0 auto;
  max-width: 1120px;
  padding: 34px 24px 72px;
}

.split {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.panel,
.form-card,
.question-card,
.stat,
.table-wrap,
.review-item,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  min-height: 420px;
  padding: 48px;
}

.eyebrow {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 12px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 5.4rem);
}

h2 {
  font-size: 1.05rem;
}

.metric-strip,
.stats-grid {
  display: grid;
  gap: 14px;
}

.metric-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 48px;
}

.metric-strip div,
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.metric-strip strong,
.stat strong {
  display: block;
  font-size: 1.8rem;
}

.metric-strip span,
.stat span,
.muted {
  color: var(--muted);
}

.lead-copy {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 640px;
}

.form-card,
.editor-form {
  display: grid;
  gap: 18px;
}

.form-card {
  align-self: start;
  padding: 28px;
}

.compact {
  margin: 0 auto;
  max-width: 430px;
  width: 100%;
}

label {
  color: var(--muted);
  display: grid;
  gap: 8px;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.13);
}

.primary-button,
.secondary-button,
.danger-button,
.link-button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-dark);
}

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

.secondary-button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff2f2;
  border: 1px solid #f0c5c8;
  color: var(--red);
}

.small {
  min-height: 34px;
  padding: 0 12px;
}

.icon-button {
  min-width: 42px;
  padding: 0;
}

.link-button {
  background: transparent;
  color: var(--muted);
  min-height: auto;
  padding: 0;
}

.alert {
  border-radius: 8px;
  font-weight: 700;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.alert-error {
  background: #fff2f2;
  color: var(--red);
}

.alert-success {
  background: #e9f8ef;
  color: var(--green-dark);
}

.page-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-heading h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
}

.pill,
.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

.pill {
  background: var(--surface-2);
}

.assessment-form,
.review-list,
.attempt-list {
  display: grid;
  gap: 16px;
}

.question-card {
  padding: 24px;
}

.question-card legend {
  display: grid;
  font-size: 1.16rem;
  font-weight: 800;
  gap: 8px;
  padding: 0;
}

.question-card legend span {
  color: var(--green);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.meta-row {
  color: var(--muted);
  gap: 10px;
  margin: 14px 0 18px;
}

.meta-row span {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 10px;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  font-weight: 650;
  gap: 12px;
  grid-template-columns: 20px 1fr;
  padding: 14px;
}

.option input,
.checkbox-line input,
.option-line input[type="radio"] {
  width: auto;
}

.sticky-actions {
  background: rgba(246, 247, 244, 0.9);
  bottom: 0;
  gap: 12px;
  justify-content: flex-end;
  padding: 18px 0 0;
  position: sticky;
}

.result-hero {
  background: var(--green);
  border-radius: 8px;
  color: white;
  margin-bottom: 18px;
  padding: 42px;
}

.result-hero .eyebrow,
.result-hero p {
  color: rgba(255, 255, 255, 0.82);
}

.result-hero h1 {
  font-size: clamp(4rem, 10vw, 8rem);
}

.review-item {
  border-left: 6px solid var(--line);
  box-shadow: none;
  padding: 20px;
}

.review-item.correct {
  border-left-color: var(--green);
}

.review-item.incorrect {
  border-left-color: var(--red);
}

.review-title {
  gap: 12px;
  justify-content: space-between;
}

.review-title span {
  color: var(--muted);
  font-weight: 800;
}

.login-wrap {
  align-items: center;
  display: flex;
  min-height: 60vh;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 18px;
}

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

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

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

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

.actions-col {
  width: 260px;
}

.row-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.live {
  background: #e9f8ef;
  color: var(--green-dark);
}

.paused {
  background: #fff7e8;
  color: var(--amber);
}

.subsection-heading {
  gap: 16px;
  justify-content: space-between;
  margin: 24px 0 12px;
}

.subsection-heading a {
  color: var(--green);
  font-weight: 800;
}

.attempt-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  justify-content: space-between;
  padding: 16px;
}

.editor-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

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

.wide {
  grid-column: 1 / -1;
}

.option-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.copy-field {
  background: var(--surface-2);
  color: var(--green-dark);
  font-weight: 700;
}

#optionList {
  display: grid;
  gap: 10px;
}

.option-line {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 20px minmax(0, 1fr) 42px;
}

.checkbox-line {
  align-items: center;
  color: var(--ink);
  display: flex;
}

.setting-line {
  align-items: start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 14px;
  grid-template-columns: 20px 1fr;
  padding: 18px;
}

.setting-line input {
  margin-top: 4px;
  width: auto;
}

.setting-line span {
  display: grid;
  gap: 6px;
}

.setting-line em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.question-select-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.question-select-row {
  align-items: start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 12px;
  grid-template-columns: 20px 1fr;
  padding: 14px;
}

.question-select-row input {
  margin-top: 4px;
  width: auto;
}

.question-select-row span {
  display: grid;
  gap: 5px;
}

.question-select-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.empty-state {
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .shell {
    padding: 22px 16px 54px;
  }

  .split,
  .form-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
    padding: 28px;
  }

  .page-heading,
  .review-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .sticky-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .sticky-actions > * {
    width: 100%;
  }
}
