:root {
  --azure: #005daa;
  --azure-soft: #e8f2fb;
  --steel: #1e293b;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --parchment: #f7f3ea;
  --rose: #be123c;
  --amber: #b45309;
  --emerald: #047857;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  color: #172033;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 93, 170, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
  margin: 0;
  min-height: 100vh;
}

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

button {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 20px clamp(16px, 3vw, 32px) 40px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 14px 18px;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--azure), var(--steel));
  border-radius: 8px;
  color: var(--white);
  display: inline-flex;
  flex: 0 0 auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  letter-spacing: 0.04em;
  width: 48px;
}

.eyebrow {
  color: var(--azure);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  margin: 0;
  text-transform: uppercase;
}

.brand-title,
h1,
h2,
h3,
p {
  margin: 0;
}

.brand-title {
  color: var(--steel);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 900;
  line-height: 1.05;
}

.top-actions,
.hero-actions,
.status-actions,
.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  align-items: center;
  background: var(--azure);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--white);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  background: #004f91;
  transform: translateY(-1px);
}

.button.secondary {
  background: var(--white);
  border-color: var(--slate-200);
  color: var(--steel);
}

.button.secondary:hover {
  background: var(--slate-50);
  border-color: var(--azure);
}

.button.danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: var(--rose);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  background: linear-gradient(135deg, var(--steel), var(--azure));
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--white);
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.15fr) minmax(290px, 0.85fr);
  margin-top: 18px;
  overflow: hidden;
  padding: clamp(24px, 4vw, 42px);
  position: relative;
}

.hero:after {
  background: rgba(255, 255, 255, 0.08);
  content: "";
  height: 280px;
  position: absolute;
  right: -120px;
  top: -120px;
  transform: rotate(16deg);
  width: 360px;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  color: #bae6fd;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.96;
  max-width: 850px;
}

.hero-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.05rem;
  line-height: 1.65;
  margin-top: 18px;
  max-width: 780px;
}

.hero-panel {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  color: var(--steel);
  padding: 15px;
}

.hero-stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.hero-stat span {
  color: var(--slate-600);
  display: block;
  font-size: 0.85rem;
  font-weight: 800;
  margin-top: 4px;
}

.panel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.panel,
.status-panel,
.question-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 20px;
}

.panel h2 {
  color: var(--slate-950);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.panel p,
.muted {
  color: var(--slate-600);
  line-height: 1.6;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.pill {
  background: var(--azure-soft);
  border: 1px solid rgba(0, 93, 170, 0.15);
  border-radius: 999px;
  color: var(--azure);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 5px 9px;
}

.status-panel {
  margin-top: 18px;
  overflow: hidden;
}

.status-header {
  align-items: end;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 20px;
}

.status-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1;
}

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

table {
  border-collapse: collapse;
  width: 100%;
}

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

th {
  background: var(--slate-50);
  color: var(--slate-500);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--slate-700);
  font-size: 0.92rem;
}

.chapter-cell strong {
  color: var(--slate-950);
  display: block;
  font-size: 1rem;
}

.chapter-cell span {
  color: var(--slate-500);
  display: block;
  margin-top: 2px;
}

.score-badge,
.level-badge,
.small-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  justify-content: center;
  min-width: 78px;
  padding: 6px 10px;
}

.score-strong,
.level-1 {
  background: #ecfdf5;
  color: var(--emerald);
}

.score-watch,
.level-2,
.level-3 {
  background: #fffbeb;
  color: var(--amber);
}

.score-risk,
.level-4 {
  background: #fff1f2;
  color: var(--rose);
}

.small-badge {
  background: var(--slate-100);
  color: var(--slate-700);
  min-width: 0;
}

.check-grid {
  display: grid;
  gap: 5px;
  min-width: 210px;
}

.check-item {
  align-items: center;
  display: flex;
  gap: 7px;
  line-height: 1.2;
}

.check-dot {
  border-radius: 999px;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.check-dot.on {
  background: var(--emerald);
}

.check-dot.off {
  background: var(--slate-300);
}

.empty-state {
  color: var(--slate-500);
  padding: 34px 20px;
  text-align: center;
}

.question-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr);
  margin-top: 18px;
}

.question-sidebar {
  align-self: start;
  background: var(--steel);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--white);
  padding: 18px;
  position: sticky;
  top: 108px;
}

.question-sidebar h2 {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.1;
}

.progress-track {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  height: 9px;
  margin-top: 18px;
  overflow: hidden;
}

.progress-fill {
  background: var(--azure);
  height: 100%;
  transition: width 180ms ease;
}

.step-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.step-chip {
  align-items: center;
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  font-size: 0.85rem;
  font-weight: 800;
  gap: 8px;
}

.step-chip span {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.step-chip.active {
  color: var(--white);
}

.step-chip.active span {
  background: var(--azure);
}

.question-card {
  min-height: 560px;
  padding: clamp(20px, 4vw, 34px);
}

.question-card h1 {
  color: var(--slate-950);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  max-width: 860px;
}

.question-help {
  color: var(--slate-600);
  font-size: 1rem;
  line-height: 1.65;
  margin-top: 12px;
  max-width: 760px;
}

.field-block {
  margin-top: 24px;
}

.field-block label {
  color: var(--slate-800);
  display: grid;
  font-size: 0.9rem;
  font-weight: 900;
  gap: 8px;
}

.input,
.textarea,
.select {
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  color: var(--slate-900);
  min-height: 46px;
  padding: 10px 12px;
  width: 100%;
}

.textarea {
  min-height: 130px;
  resize: vertical;
}

.choice-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.choice-button {
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  color: var(--slate-700);
  display: grid;
  gap: 4px;
  padding: 15px;
  text-align: left;
}

.choice-button strong {
  color: var(--slate-950);
  font-size: 1rem;
}

.choice-button.selected {
  background: var(--azure-soft);
  border-color: var(--azure);
}

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

.question-actions {
  border-top: 1px solid var(--slate-200);
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 18px;
}

.review-grid {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.review-item {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 14px;
}

.review-item strong {
  color: var(--slate-950);
  display: block;
  margin-bottom: 4px;
}

.toast {
  background: var(--steel);
  border-radius: 8px;
  bottom: 20px;
  box-shadow: var(--shadow);
  color: var(--white);
  font-weight: 800;
  left: 50%;
  padding: 12px 16px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 20;
}

@media (max-width: 920px) {
  .hero,
  .question-layout,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .question-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .status-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .hero-actions,
  .status-actions {
    width: 100%;
  }

  .button {
    flex: 1 1 auto;
  }

  .inline-fields {
    grid-template-columns: 1fr;
  }
}
