:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #64707d;
  --line: #d9e1e8;
  --panel: #ffffff;
  --soft: #f5f7f9;
  --accent: #1f6f78;
  --accent-strong: #155d66;
  --warn: #b54c36;
  --amber: #9a6a12;
  --green: #28724f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #edf5f6 0, rgba(237, 245, 246, 0) 260px),
    var(--soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topbar-left {
  align-items: center;
  display: flex;
  gap: 22px;
}

.brand {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.topnav {
  display: flex;
  gap: 14px;
}

.topnav a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

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

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto;
}

h1,
h2 {
  margin: 0 0 12px;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

button,
.button-link,
.ghost-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

button:hover,
.button-link:hover,
.ghost-button:hover {
  background: var(--accent-strong);
}

.secondary,
.ghost-button {
  background: #e6ecef;
  color: var(--ink);
}

.narrow-panel,
.info-panel,
.report-section,
.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.narrow-panel {
  max-width: 560px;
  margin: 0 auto;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  background: #ffffff;
}

textarea {
  min-height: 88px;
}

.toolbar,
.detail-grid,
.report-header,
.progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.toolbar-actions,
.test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subtle,
.hint {
  color: var(--muted);
}

.error {
  color: var(--warn);
  font-weight: 700;
}

.success,
.notice {
  border-left: 4px solid var(--accent);
  background: #eef7f8;
  padding: 12px 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 30px;
}

.filter-bar {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 0.7fr) auto auto;
  margin-bottom: 16px;
  padding: 16px;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-count {
  color: var(--muted);
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.test-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #f0f8f7;
  border: 1px solid #b9d9d7;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 16px;
}

.code-display {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.muted-box {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  margin: 0;
  padding: 10px 12px;
}

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

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

.actions {
  display: flex;
  gap: 10px;
}

.nowrap {
  white-space: nowrap;
}

.raw-action,
.mono-id {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.mono-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-width: 260px;
  overflow-wrap: anywhere;
}

.audit-table td {
  vertical-align: top;
}

.status,
.risk-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #e7f2f3;
  color: var(--accent-strong);
  font-weight: 700;
}

.status-completed {
  background: #e7f4ec;
  color: #1f6b46;
}

.status-in_progress {
  background: #fff4df;
  color: #8a5b00;
}

.status-expired,
.status-revoked {
  background: #f2e9e6;
  color: #9a3f2d;
}

.report-hero {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.report-scorebox {
  min-width: 220px;
  border: 1px solid #b9d9d7;
  border-radius: 8px;
  background: #f0f8f7;
  padding: 16px;
}

.report-scorebox span,
.report-scorebox small {
  color: var(--muted);
  display: block;
  font-weight: 700;
}

.report-scorebox strong {
  color: var(--accent-strong);
  display: block;
  font-size: 28px;
  line-height: 1.25;
  margin: 6px 0;
}

.report-layout {
  display: grid;
  gap: 16px;
}

.report-summary {
  border-left: 5px solid var(--accent);
}

.report-validity {
  border-left: 5px solid var(--amber);
}

.report-dimensions {
  border-left: 5px solid var(--green);
}

.lead-copy {
  font-size: 17px;
  margin: 0 0 16px;
}

.analysis-callout {
  border: 1px solid #ead8b5;
  border-radius: 8px;
  background: #fffaf0;
  padding: 16px;
}

.analysis-callout p {
  margin: 8px 0 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.summary-list,
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.report-meta .summary-list {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-list div,
.dimension-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.summary-list dt {
  color: var(--muted);
}

.summary-list dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.dimension-item {
  display: flex;
  justify-content: space-between;
}

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

.dimension-insight,
.scenario-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.dimension-insight header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dimension-insight header span,
.scenario-item span {
  border-radius: 999px;
  background: #f3efe2;
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 9px;
  white-space: nowrap;
}

.dimension-insight p,
.scenario-item p {
  margin: 8px 0 0;
}

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

.scenario-item h3 {
  font-size: 17px;
  margin: 8px 0 4px;
}

.probe-list {
  margin: 12px 0 0;
  padding-left: 22px;
}

.probe-list li + li {
  margin-top: 10px;
}

.report-section + .report-section {
  margin-top: 16px;
}

.assessment-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.stepper span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 7px 10px;
  text-align: center;
}

.stepper .active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.progress-meter {
  min-width: 220px;
}

.progress-meter span {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
  text-align: right;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8eb;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 180ms ease;
}

.question-card {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.question-card h2 {
  font-size: 17px;
}

.option-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
}

.option-row label,
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.option-row input,
.checkbox-line input {
  width: auto;
  min-height: auto;
}

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

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

  .topbar-left {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
  }

  .topbar form {
    padding-bottom: 12px;
  }

  .toolbar,
  .test-panel,
  .detail-grid,
  .report-header,
  .progress-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .option-row,
  .metric-grid,
  .info-grid,
  .dimension-insights,
  .choice-pair,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-wrap: wrap;
  }

  .progress-meter {
    min-width: 100%;
  }

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

@media print {
  @page {
    margin: 14mm;
  }

  body {
    background: #ffffff;
    color: #111111;
  }

  .topbar,
  .report-actions,
  .no-print {
    display: none !important;
  }

  .page {
    margin: 0;
    width: 100%;
  }

  .report-header {
    align-items: flex-start;
    border-bottom: 1px solid #cfd7de;
    flex-direction: row;
    margin-bottom: 12px;
  }

  .report-section,
  .report-scorebox,
  .dimension-insight,
  .scenario-item,
  .summary-list div {
    break-inside: avoid;
    box-shadow: none;
  }

  .report-section {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 17px;
  }

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