:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #202421;
  --muted: #667069;
  --line: #d9ded7;
  --surface: #ffffff;
  --surface-2: #eef5ef;
  --green: #1f7a52;
  --blue: #2e6f9e;
  --amber: #a66513;
  --red: #a13f3f;
  --violet: #6f5ca8;
  --shadow: 0 10px 24px rgba(34, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  padding: 0 0.85rem;
  cursor: pointer;
}

button:hover {
  border-color: #9aa89f;
}

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

button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem max(1rem, calc((100vw - 1280px) / 2));
  background: rgba(246, 247, 244, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  background: #23352d;
  color: #fff;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.2rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1rem;
}

.brand p,
.latest-message,
.metric span,
.panel-title span,
.footer {
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  color: var(--ink);
}

.nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
}

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 1rem;
  align-items: stretch;
  padding: 0.35rem 0 0.2rem;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem 0;
}

.hero-copy h2 {
  max-width: 760px;
  font-size: 2rem;
  line-height: 1.08;
}

.hero-copy p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.button-link:hover {
  border-color: #9aa89f;
  text-decoration: none;
}

.button-link.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.record-card {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.trust-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.trust-list div {
  display: grid;
  grid-template-columns: minmax(92px, 0.38fr) minmax(0, 1fr);
  gap: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid #edf0ec;
}

.trust-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.trust-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.mini-trend {
  display: grid;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid #edf0ec;
}

.mini-trend-head {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  align-items: baseline;
}

.mini-trend-head span,
.mini-trend p {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-trend-head strong {
  overflow-wrap: anywhere;
}

.hero-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.report-metric {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 132px;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-metric.success {
  border-color: #a9d2bd;
  background: #f0faf4;
}

.report-metric.attention {
  border-color: #e4c994;
  background: #fff9ed;
}

.report-metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-metric strong,
.report-metric .headline-link {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.3rem;
}

.headline-link {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.headline-link::after {
  content: " detail";
  margin-left: 0.25rem;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.headline-link:hover {
  color: var(--blue);
  text-decoration: none;
}

.report-metric p {
  color: var(--muted);
  font-size: 0.88rem;
}

.parent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.parent-card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-height: 178px;
}

.parent-card .panel-title span {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  font-size: 0.78rem;
}

.parent-card p {
  color: var(--muted);
}

.priority-card {
  border-color: #a9d2bd;
  background: #f7fcf8;
}

.inline-action {
  justify-self: start;
  border: 1px solid #b7c8dc;
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  background: #eef5fb;
  color: var(--blue);
  font-weight: 800;
}

.inline-action:hover {
  text-decoration: none;
  border-color: var(--blue);
}

.subsection-head {
  display: grid;
  gap: 0.15rem;
  margin-top: 1rem;
}

.week-plan {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.plan-card {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  min-height: 178px;
}

.plan-primary {
  border-color: #a9d2bd;
  background: #f7fcf8;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.topic-pills a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.topic-pills a:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}

.progress-grid,
.definition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.progress-card,
.definition-card {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.progress-card strong,
.progress-card .headline-link {
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.progress-card p,
.definition-card p {
  color: var(--muted);
}

.progress-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
}

.progress-meter span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.effort-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.effort-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.explanation-band {
  padding-top: 0.7rem;
}

.band-copy {
  max-width: 820px;
  margin-top: 0.45rem;
  color: var(--muted);
}

.surface-workspace {
  margin-top: 1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.control-panel,
.summary-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.control-panel,
.summary-panel,
.panel {
  padding: 1rem;
}

.panel-head,
.section-head,
.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8faf9;
  font-size: 0.8rem;
  white-space: nowrap;
}

.status-pill.running {
  border-color: #b7c8dc;
  background: #edf5ff;
  color: var(--blue);
}

.status-pill.ok {
  border-color: #b4d7c4;
  background: #ecf8f1;
  color: var(--green);
}

.status-pill.warn {
  border-color: #e7c991;
  background: #fff7e7;
  color: var(--amber);
}

.status-pill.error {
  border-color: #e4b3b3;
  background: #fff0f0;
  color: var(--red);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 0.55rem 0.65rem;
}

textarea {
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.operator {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.operator summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
}

.operator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: end;
}

.operator-actions {
  display: grid;
  gap: 0.5rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric {
  display: grid;
  gap: 0.25rem;
  min-height: 76px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

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

.metric strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.latest-message {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border-left: 4px solid var(--blue);
  background: #f3f8fc;
  border-radius: 0 7px 7px 0;
}

.band {
  margin-top: 1rem;
  padding-top: 0.35rem;
}

.guardrails {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.guardrails span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
}

.report-grid,
.student-grid,
.write-grid,
.proof-grid,
.launch-grid,
.progress-grid,
.definition-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.75rem;
}

.report-grid > *,
.student-grid > *,
.write-grid > *,
.proof-grid > *,
.launch-grid > *,
.progress-grid > *,
.definition-grid > *,
.parent-grid > *,
.week-plan > *,
.hero-metrics > *,
.workspace > * {
  min-width: 0;
}

.report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.proof-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.proof-card {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

.proof-card-wide {
  grid-column: span 2;
}

.proof-card dl {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.proof-card dl div {
  display: grid;
  grid-template-columns: minmax(115px, 0.45fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding-top: 0.45rem;
  border-top: 1px solid #edf0ec;
}

.proof-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.proof-card dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.write-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.launch-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

.panel-copy {
  margin-top: 0.65rem;
  color: var(--muted);
}

.evidence-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.evidence-strip span {
  border: 1px solid #b4d7c4;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: #eef8f2;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.rerun-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.rerun-panel div {
  display: grid;
  gap: 0.25rem;
}

.rerun-panel span {
  color: var(--muted);
  font-size: 0.86rem;
}

.rerun-panel a {
  flex: 0 0 auto;
  border: 1px solid #b7c8dc;
  border-radius: 7px;
  padding: 0.5rem 0.65rem;
  background: #eef5fb;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
}

.guardrail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.guardrail-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 0.78rem;
}

.convergence-wrap {
  margin-top: 1rem;
}

.convergence-table {
  min-width: 1160px;
}

.question-cell {
  min-width: 220px;
}

.question-cell strong {
  display: block;
  margin-bottom: 0.25rem;
}

.question-cell span,
.answer-note {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.answer-cell {
  min-width: 190px;
}

.answer-cell pre,
.sql-output {
  max-width: 100%;
  margin: 0.35rem 0 0;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f8;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.76rem;
}

.answer-cell details {
  margin-top: 0.45rem;
}

.answer-cell summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.verdict-cell {
  min-width: 108px;
}

.quadrants {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  min-height: 220px;
  margin-top: 0.75rem;
}

.quadrant-card {
  display: grid;
  align-content: space-between;
  gap: 0.45rem;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: linear-gradient(180deg, #ffffff, #f7fbf8);
}

.quadrant-card strong {
  overflow-wrap: anywhere;
}

.quadrant-card .value-line {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  white-space: nowrap;
}

.badge.green {
  border-color: #b4d7c4;
  color: var(--green);
  background: #eef8f2;
}

.badge.blue {
  border-color: #b7c8dc;
  color: var(--blue);
  background: #eef5fb;
}

.badge.amber {
  border-color: #e7c991;
  color: var(--amber);
  background: #fff7e7;
}

.badge.red {
  border-color: #e4b3b3;
  color: var(--red);
  background: #fff0f0;
}

.timeline,
.stack,
.key-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.timeline-row,
.stack-row,
.key-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 0.65rem;
}

.timeline-row {
  display: grid;
  gap: 0.45rem;
}

.timeline-bar {
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
  background: #e9eee9;
}

.timeline-bar span {
  display: block;
  width: var(--bar-width);
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  min-width: 0;
}

.row-title strong,
.row-title span {
  overflow-wrap: anywhere;
  min-width: 0;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 0;
}

.row-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #f4f6f4;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.json-output {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1f2722;
  color: #eaf2ec;
  font-size: 0.82rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  align-content: center;
  justify-content: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .workspace,
  .report-grid,
  .student-grid,
  .write-grid,
  .proof-grid,
  .launch-grid,
  .progress-grid,
  .definition-grid,
  .week-plan,
  .report-hero {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .parent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .proof-card-wide {
    grid-column: auto;
  }

  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .nav {
    justify-content: flex-start;
  }

  .control-grid,
  .operator-grid,
  .quadrants,
  .metric-grid,
  .hero-metrics,
  .parent-grid,
  .week-plan,
  .progress-grid,
  .definition-grid {
    grid-template-columns: 1fr;
  }

  .metric.wide {
    grid-column: auto;
  }

  .proof-card dl div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .trust-list div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .hero-copy {
    order: 1;
  }

  .hero-metrics {
    order: 2;
  }

  .record-card {
    order: 3;
  }

  .hero-copy h2 {
    font-size: 1.45rem;
  }

  .section-head,
  .panel-head,
  .panel-title,
  .row-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .guardrails {
    justify-content: flex-start;
  }

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