:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #617086;
  --line: #d8dee8;
  --panel: #ffffff;
  --paper: #f5f7fa;
  --blue: #1769aa;
  --accent: #1769aa;
  --green: #177a63;
  --red: #a84337;
  --gold: #8b6b16;
  --shadow: 0 12px 34px rgba(23, 32, 42, 0.09);
}

* {
  box-sizing: border-box;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 250, 0.94);
  backdrop-filter: blur(12px);
}

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

.topbar h1 {
  font-size: 22px;
  font-weight: 760;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0;
  text-transform: uppercase;
}

nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid transparent;
}

nav a:hover {
  border-color: var(--line);
  background: #fff;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.button-link:hover {
  border-color: #b9c6d8;
  background: #f7fbff;
}

main {
  padding: 28px clamp(18px, 4vw, 48px) 56px;
}

section[id] {
  scroll-margin-top: 96px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.3fr);
  gap: 20px;
  align-items: stretch;
}

.overview-copy,
.workspace,
.canvas-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview-copy {
  padding: 24px;
}

.overview-copy h2 {
  max-width: 620px;
  font-size: clamp(30px, 4.5vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.overview-copy p {
  max-width: 680px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 15px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.notes-grid {
  display: grid;
  gap: 12px;
  align-content: stretch;
}

.stat {
  min-height: 124px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.note-card {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.note-card h3 {
  margin-top: 14px;
  font-size: 22px;
}

.note-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.canvas-band {
  margin-top: 20px;
  padding: 10px;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 280px;
}

.workspace {
  margin-top: 22px;
  padding: 20px;
}

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

.section-head h2 {
  font-size: 28px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select {
  min-width: 190px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
}

.split-view {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}

.side-panel,
.main-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-label {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.list {
  overflow: auto;
}

.list button {
  width: 100%;
  min-height: 50px;
  display: block;
  border: 0;
  border-bottom: 1px solid #eef1f5;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.list button:hover,
.list button.active {
  background: #edf5fb;
}

.list .meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.main-panel {
  min-width: 0;
  padding: 18px;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.pill.blue {
  color: var(--blue);
  background: #eef7ff;
}

.pill.green {
  color: var(--green);
  background: #eef9f5;
}

.pill.red {
  color: var(--red);
  background: #fff3f1;
}

.table-wrap {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-table {
  margin-top: 12px;
}

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

.audit-table code {
  white-space: nowrap;
}

.audit-table tbody tr {
  cursor: default;
}

.tall-table {
  max-height: 620px;
}

.compact-table {
  max-height: 520px;
}

.wrap-cell {
  min-width: 220px;
  max-width: 520px;
  white-space: normal;
}

.audit-summary {
  margin: 14px 0 0;
}

.audit-large {
  color: var(--ink) !important;
  font-size: 26px !important;
  font-weight: 820;
}

.audit-downloads {
  align-items: end;
}

.fatal-error {
  margin: 24px;
  padding: 16px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: #fff6f4;
  color: var(--red);
  white-space: pre-wrap;
}

.template-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}

.template-hero h2 {
  max-width: 860px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.04;
  letter-spacing: 0;
}

.template-total {
  display: grid;
  align-content: center;
  min-height: 150px;
  padding: 18px;
  border: 1px solid #b9d2e8;
  border-radius: 8px;
  background: #f0f8ff;
}

.template-total span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.template-total strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 56px;
  line-height: 0.95;
}

.template-total p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

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

.template-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.template-card summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  list-style-position: inside;
}

.template-card summary:hover {
  background: #f8fbfe;
}

.template-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
}

.template-summary-copy {
  min-width: 0;
}

.template-number {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
}

.template-summary-copy h3 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.template-body {
  padding: 16px;
}

.template-body > p {
  max-width: 920px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

.template-body h4 {
  margin: 16px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--muted);
}

.variation-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.variation-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: #fcfdff;
}

.variation-row code {
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.variation-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.variation-content > span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.variation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.variation-path {
  min-width: 0;
  color: #53647a;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.notes-table {
  max-height: none;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  z-index: 1;
}

.field-help-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 760;
  cursor: help;
  text-align: left;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.field-help-button:hover {
  color: var(--blue);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f1f8fc;
}

.json-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.json-details summary {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.field-dialog {
  width: min(780px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
  color: var(--ink);
}

.field-dialog::backdrop {
  background: rgba(23, 32, 42, 0.32);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.dialog-head h2 {
  font-size: 22px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

#fieldDialogBody {
  padding: 16px 18px 18px;
}

.dialog-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.dialog-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.dialog-section h3 {
  font-size: 16px;
}

.dialog-section p,
.muted-text {
  color: var(--muted);
  font-size: 14px;
}

.source-note {
  color: var(--blue) !important;
  font-size: 12px !important;
  font-weight: 720;
}

.field-warning {
  padding: 10px 12px;
  border: 1px solid #f1c7c0;
  border-radius: 8px;
  background: #fff3f1;
  color: var(--red) !important;
}

.dialog-table {
  max-height: 320px;
  margin-top: 2px;
}

pre {
  margin: 0;
  overflow: auto;
  background: #111827;
  color: #e7edf5;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
}

.tasks-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}

.task-detail {
  display: grid;
  gap: 16px;
}

.task-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.task-block h3 {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-size: 15px;
  color: var(--ink);
}

.task-block .body {
  padding: 14px;
}

.scenario-block {
  border-color: #c8d5e3;
}

.scenario-block h3 {
  background: #eef5fb;
  color: #0f4f83;
}

.scenario-text {
  max-width: 96ch;
  padding: 18px 20px 20px !important;
}

.task-block .scenario-text p {
  color: #24364a;
  font-size: 15px;
  line-height: 1.72;
  max-width: 92ch;
}

.task-block .scenario-text p + p {
  margin-top: 14px;
}

.doc-grid,
.action-grid {
  display: grid;
  gap: 8px;
}

.doc-card,
.action-card {
  border: 1px solid #e6ebf1;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.doc-card strong,
.action-card strong {
  display: block;
  margin-bottom: 4px;
}

.doc-card p,
.action-card p,
.task-block p {
  color: var(--muted);
  font-size: 13px;
}

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

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.metric-strip strong {
  display: block;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-strip span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-strip p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.section-note {
  max-width: 880px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 8px;
}

.code-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.code-grid h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.code-grid p,
.code-grid li {
  color: var(--muted);
  font-size: 14px;
}

.pipeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
  background: #fff;
}

.pipeline h3 {
  margin-bottom: 12px;
}

.pipeline-list {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
}

.pipeline-list li {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid #edf1f6;
  padding-top: 10px;
}

.pipeline-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.pipeline-list strong {
  color: var(--ink);
}

.pipeline-list span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.code-snippet {
  margin-top: 14px;
  border-radius: 8px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  gap: 14px;
}

.prompt-grid article {
  min-width: 0;
}

.prompt-grid h3,
.prompt-facts h3 {
  margin-bottom: 8px;
}

.prompt-pre {
  max-height: 380px;
  border: 1px solid #223049;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-pre.tall {
  max-height: 560px;
}

.tool-sections {
  display: grid;
  gap: 18px;
}

.tool-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.tool-group-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.tool-group-head h3 {
  font-size: 17px;
}

.tool-group-head p {
  max-width: 760px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.tool-list {
  display: grid;
}

.tool-row {
  border-bottom: 1px solid #edf0f4;
}

.tool-row:last-child {
  border-bottom: 0;
}

.tool-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  cursor: pointer;
}

.tool-row summary strong {
  display: block;
  margin-bottom: 5px;
}

.tool-row summary code {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tool-row[open] summary {
  background: #f7fbff;
}

.tool-badges,
.tool-params {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-body {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.tool-body p {
  color: var(--muted);
  font-size: 14px;
}

.tool-body pre {
  max-height: 280px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.file-list,
ol {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 960px) {
  .topbar {
    position: static;
  }

  .topbar,
  .section-head,
  .overview {
    display: block;
  }

  section[id] {
    scroll-margin-top: 18px;
  }

  nav,
  .toolbar {
    justify-content: start;
    margin-top: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    margin-top: 14px;
  }

  .split-view,
  .tasks-layout,
  .code-grid,
  .prompt-grid,
  .template-hero,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .pipeline-list li {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .tool-row summary,
  .tool-group-head {
    display: block;
  }

  .tool-badges {
    margin-top: 10px;
  }

  .template-card summary,
  .variation-row {
    grid-template-columns: 1fr;
  }

  .template-total strong {
    font-size: 44px;
  }

  .side-panel {
    max-height: 360px;
  }

  input,
  select {
    width: 100%;
    min-width: 0;
  }
}
