:root {
  color-scheme: light;
  --canvas: #f4f5f1;
  --surface: #ffffff;
  --surface-soft: #eef1ed;
  --ink: #18211b;
  --muted: #637068;
  --line: #d7ddd7;
  --line-strong: #b8c2ba;
  --sidebar: #1f2923;
  --sidebar-muted: #aebbb2;
  --green: #2f6b4f;
  --green-soft: #e5f1e9;
  --blue: #2e647f;
  --blue-soft: #e6f0f5;
  --gold: #96671e;
  --gold-soft: #f5eddb;
  --red: #9a403c;
  --red-soft: #f7e8e7;
  --shadow: 0 18px 44px rgba(27, 40, 31, 0.12);
  --sidebar-width: 244px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

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

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(46, 100, 127, 0.24);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  background: var(--sidebar);
  color: #f5f7f5;
}

.product-mark {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 18px;
}

.product-monogram {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 5px;
  background: #f5f7f5;
  color: var(--sidebar);
  font-size: 12px;
  font-weight: 800;
}

.product-mark strong,
.product-mark small {
  display: block;
  letter-spacing: 0;
}

.product-mark strong {
  font-size: 13px;
}

.product-mark small {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.app-nav {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  gap: 4px;
  overflow-y: auto;
  padding: 18px 12px;
}

.nav-section-label {
  padding: 0 12px 5px;
  color: #829087;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-section-break {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-top: 15px;
}

.app-nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  border-radius: 5px;
  padding: 0 12px;
  color: var(--sidebar-muted);
  text-decoration: none;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.app-nav a[aria-current="page"] {
  box-shadow: inset 3px 0 0 #79a988;
}

.app-nav svg,
.button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 18px 20px;
}

.environment-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #eef4ef;
  font-size: 12px;
  font-weight: 700;
}

.environment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fba8e;
  box-shadow: 0 0 0 4px rgba(127, 186, 142, 0.12);
}

.sidebar-footer small {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--sidebar-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

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

.page-identity {
  min-width: 0;
}

.page-identity span,
.page-identity strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-identity span {
  color: var(--muted);
  font-size: 11px;
}

.page-identity strong {
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.mode-badge,
.status-badge,
.category-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.mode-badge {
  border: 1px solid var(--line);
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--muted);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.button {
  min-height: 38px;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.button:hover,
.icon-button:hover {
  border-color: #89968c;
  background: #f8faf8;
}

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

.button-primary:hover {
  border-color: #245a40;
  background: #245a40;
}

.button-danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.button-danger:hover {
  border-color: #733b38;
  background: #733b38;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
}

.menu-button {
  display: none;
}

.workspace {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 24px;
}

.loading-state,
.empty-state,
.error-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.loading-mark {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.view-head,
.toolbar,
.panel-head,
.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.view-head {
  margin-bottom: 20px;
}

.view-head h1,
.panel-head h2,
.report-head h2,
.dialog-head h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.15;
}

.view-head h1 {
  font-size: 24px;
}

.view-head p,
.panel-head p,
.report-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.view-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.training-scenario-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -6px 0 14px;
  border: 1px solid #cbdce4;
  border-left: 4px solid var(--blue);
  border-radius: 5px;
  padding: 11px 12px;
  background: var(--blue-soft);
}

.training-scenario-banner > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.training-scenario-banner > div > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--blue);
}

.training-scenario-banner small,
.training-scenario-banner strong,
.training-scenario-banner em {
  display: block;
}

.training-scenario-banner small {
  color: var(--blue);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.training-scenario-banner strong {
  margin-top: 1px;
  font-size: 11px;
}

.training-scenario-banner em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card,
.panel,
.table-panel,
.filters,
.model-table {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.kpi-card {
  min-height: 112px;
  padding: 16px;
}

.kpi-card span,
.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  margin-top: 9px;
  font-size: 24px;
  line-height: 1.1;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.74fr) minmax(520px, 1.26fr);
  gap: 16px;
}

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

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2,
.report-head h2,
.dialog-head h2 {
  font-size: 17px;
}

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

.status-bars {
  display: grid;
  gap: 14px;
}

.status-bar-row {
  display: grid;
  grid-template-columns: 84px minmax(100px, 1fr) 106px;
  align-items: center;
  gap: 10px;
}

.status-bar-row > span:first-child {
  font-weight: 700;
}

.status-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: #e8ece8;
}

.status-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--blue);
}

.status-bar-row:nth-child(2) .status-bar-fill { background: var(--green); }
.status-bar-row:nth-child(3) .status-bar-fill { background: var(--red); }
.status-bar-row:nth-child(4) .status-bar-fill { background: var(--gold); }
.status-bar-row:nth-child(5) .status-bar-fill { background: #7a7f7b; }

.status-bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.toolbar,
.filters {
  margin-bottom: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
}

.field {
  display: grid;
  min-width: 150px;
  gap: 5px;
}

.field-search {
  min-width: min(100%, 280px);
  flex: 1 1 280px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.report-selector {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 7px 10px;
  background: #ffffff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.table-panel {
  overflow: hidden;
}

.table-meta {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid #e4e8e4;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f3f0;
  color: #536057;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

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

tbody tr[data-account-id] {
  cursor: pointer;
}

tbody tr[data-account-id]:hover,
tbody tr[data-assessment-id]:hover {
  background: #f7f9f7;
}

.cell-primary {
  color: var(--ink);
  font-weight: 700;
}

.cell-secondary {
  color: var(--muted);
}

.cell-money,
.cell-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.status-badge {
  padding: 3px 7px;
  background: var(--surface-soft);
  color: #506057;
}

.status-open { background: var(--blue-soft); color: var(--blue); }
.status-paid { background: var(--green-soft); color: var(--green); }
.status-delinquent { background: var(--red-soft); color: var(--red); }
.status-adjusted { background: var(--gold-soft); color: var(--gold); }
.status-cancelled { background: #eceeed; color: #5f6661; }

.report-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
}

.report-library,
.report-workspace {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.report-library {
  align-self: start;
  overflow: hidden;
}

.report-library-head {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.report-library-head strong,
.report-library-head span {
  display: block;
}

.report-library-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.report-list {
  display: grid;
  padding: 6px;
}

.report-list button {
  display: grid;
  gap: 3px;
  border: 0;
  border-radius: 4px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.report-list button:hover,
.report-list button[aria-current="true"] {
  background: var(--surface-soft);
}

.report-list button[aria-current="true"] {
  box-shadow: inset 3px 0 0 var(--green);
}

.report-list button span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.report-workspace {
  overflow: hidden;
}

.report-head {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.report-head > div:first-child {
  min-width: 0;
}

.report-question {
  border-bottom: 1px solid var(--line);
  padding: 11px 16px;
  background: #f8faf8;
  color: var(--muted);
  font-size: 12px;
}

.report-question strong {
  color: var(--ink);
}

.report-table-region {
  min-height: 360px;
}

.sql-details {
  border-top: 1px solid var(--line);
}

.sql-details summary {
  cursor: pointer;
  padding: 11px 16px;
  color: var(--muted);
  font-weight: 700;
}

.sql-details pre {
  overflow-x: auto;
  max-height: 360px;
  margin: 0;
  padding: 16px;
  background: #202821;
  color: #edf3ee;
  font: 12px/1.55 "SFMono-Regular", Consolas, monospace;
}

.category-badge {
  padding: 3px 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.model-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  margin-bottom: 16px;
}

.model-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-financial-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.mini-stat {
  border-left: 3px solid var(--green);
  padding: 8px 12px;
  background: var(--surface-soft);
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.account-reconciliation-note {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  background: var(--blue-soft);
  color: #274f65;
  font-size: 10px;
  line-height: 1.45;
}

.account-reconciliation-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.account-exception-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 8px;
  border-left: 3px solid var(--gold);
  padding: 9px 10px;
  background: #fff8e6;
  color: #674b0f;
}

.account-exception-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.account-exception-note span,
.account-exception-note strong,
.account-exception-note small {
  display: block;
}

.account-exception-note small {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.45;
}

.reconciliation-labels {
  display: flex;
  min-width: 160px;
  flex-wrap: wrap;
  gap: 4px;
}

.reconciliation-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 7px;
  background: var(--surface-soft);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.25;
}

.reconciliation-ok {
  border-color: #a9c8b2;
  background: #edf7f0;
  color: #245f38;
}

.reconciliation-warning {
  border-color: #dfc47c;
  background: #fff8e6;
  color: #674b0f;
}

.reconciliation-danger {
  border-color: #d7aaa7;
  background: #fff0ef;
  color: #7f2e29;
}

.reconciliation-neutral {
  color: var(--muted);
}

.model-figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.model-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 720px;
  object-fit: contain;
}

.model-figure figcaption {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--muted);
  font-size: 11px;
}

dialog {
  width: min(920px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 27, 21, 0.54);
}

.payment-dialog {
  width: min(620px, calc(100% - 32px));
}

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

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.dialog-body {
  max-height: calc(100vh - 180px);
  overflow: auto;
  padding: 18px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
}

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

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

.account-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.account-summary address {
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
}

.account-tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 10px;
}

.account-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.account-tabs button[aria-selected="true"] {
  border-color: var(--green);
  color: var(--ink);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}

.toast {
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  border-radius: 5px;
  padding: 11px 13px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.toast-error {
  border-left-color: var(--red);
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(18, 27, 21, 0.48);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.learning-guide {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.guide-intro,
.guide-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px;
}

.guide-intro {
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.guide-intro > div,
.guide-next > div {
  max-width: 800px;
}

.guide-intro h2 {
  margin: 4px 0 0;
  font-size: 21px;
  letter-spacing: 0;
  line-height: 1.2;
}

.guide-intro p,
.guide-next p {
  margin: 7px 0 0;
  color: var(--muted);
}

.guide-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-actions a {
  text-decoration: none;
}

.model-guide-actions {
  margin-top: 14px;
}

.first-use-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b9c9be;
  border-left: 3px solid var(--green);
  background: #f5f9f6;
}

.first-use-banner > div {
  display: flex;
  align-items: center;
  gap: 11px;
}

.first-use-banner svg {
  width: 19px;
  height: 19px;
  color: var(--green);
}

.first-use-banner span,
.first-use-banner strong,
.first-use-banner small {
  display: block;
}

.first-use-banner small {
  margin-top: 2px;
  color: var(--muted);
}

.first-use-banner a {
  flex: 0 0 auto;
  text-decoration: none;
}

.first-use-path {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.first-use-path a {
  display: flex;
  min-width: 0;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.first-use-path a:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.first-use-path a > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.first-use-path strong,
.first-use-path small {
  display: block;
}

.first-use-path strong {
  font-size: 10px;
}

.first-use-path small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.paired-learning-cycle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.paired-learning-cycle > div {
  min-width: 0;
  padding: 16px;
  border-top: 3px solid var(--green);
  background: var(--surface-soft);
}

.paired-learning-cycle > div:nth-of-type(2) { border-top-color: var(--blue); }
.paired-learning-cycle > div:nth-of-type(3) { border-top-color: var(--gold); }

.paired-learning-cycle > svg {
  width: 16px;
  color: var(--muted);
}

.paired-learning-cycle div > svg {
  width: 18px;
  height: 18px;
  margin-bottom: 12px;
  color: var(--green);
}

.paired-learning-cycle span,
.paired-learning-cycle strong,
.paired-learning-cycle small {
  display: block;
}

.paired-learning-cycle span {
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.paired-learning-cycle strong {
  margin-top: 5px;
  font-size: 10px;
}

.paired-learning-cycle small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.first-session-list,
.first-use-notes ul {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.first-session-list li {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(0, 1.3fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.first-session-list span,
.first-use-notes li {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.first-use-notes {
  padding: 18px;
  border-left: 3px solid var(--blue);
  background: #f4f8fa;
}

.first-use-notes h3 {
  margin: 6px 0 0;
  font-size: 15px;
}

.first-use-notes li {
  position: relative;
  padding: 7px 0 7px 16px;
  border-bottom: 1px solid #d9e2e6;
}

.first-use-notes li::before {
  position: absolute;
  top: 12px;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.scenario-clue-details {
  margin-top: 12px;
  border-top: 1px solid #d9e2e6;
  padding-top: 10px;
}

.scenario-clue-details summary,
.scenario-clue-note summary {
  cursor: pointer;
  font-weight: 800;
}

.scenario-clue-details p,
.scenario-clue-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.scenario-clue-details code,
.scenario-clue-note code {
  color: var(--ink);
  font-weight: 800;
}

.scenario-clue-note {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  padding: 10px 12px;
  background: var(--blue-soft);
}

.scenario-clue-note summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #274f65;
  list-style-position: inside;
}

.scenario-clue-note summary svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.guide-section {
  padding: 22px 24px 24px;
  border-bottom: 1px solid var(--line);
}

.guide-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.guide-section-head.compact {
  margin-bottom: 14px;
}

.guide-section-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.guide-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.guide-step {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.system-story {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr) auto minmax(130px, 1fr) auto minmax(130px, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 8px;
}

.system-story > div {
  min-width: 0;
  border-top: 3px solid var(--blue);
  padding: 14px;
  background: var(--blue-soft);
}

.system-story > div:nth-of-type(2) {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.system-story > div:nth-of-type(3),
.system-story > div:nth-of-type(4) {
  border-color: var(--green);
  background: var(--green-soft);
}

.system-story > div:nth-of-type(5) {
  border-color: var(--red);
  background: var(--red-soft);
}

.system-story > div > svg {
  width: 18px;
  height: 18px;
}

.system-story > div > span,
.system-story > div > strong,
.system-story > div > code {
  display: block;
}

.system-story > div > span {
  margin-top: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.system-story > div > strong {
  margin-top: 2px;
  font-size: 12px;
}

.system-story > div > code {
  overflow: hidden;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
}

.system-story > svg {
  width: 14px;
  color: var(--muted);
}

.guide-lenses {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.guide-lenses > div {
  border-left: 3px solid var(--green);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.guide-lenses > div:nth-child(2) { border-left-color: var(--blue); }
.guide-lenses > div:nth-child(3) { border-left-color: var(--gold); }
.guide-lenses > div:nth-child(4) { border-left-color: var(--red); }

.guide-lenses span,
.guide-lenses strong {
  display: block;
}

.guide-lenses span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.guide-lenses strong {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.guide-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  border-left: 3px solid var(--gold);
  padding: 11px 13px;
  background: var(--gold-soft);
  color: #5e4a27;
}

.guide-note-blue {
  border-left-color: var(--blue);
  background: var(--blue-soft);
  color: #274f65;
}

.guide-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.guide-note p {
  margin: 0;
  font-size: 11px;
}

.guide-first-visit {
  margin: -4px 0 18px;
}

.guide-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.guide-table th {
  position: static;
}

.guide-table th,
.guide-table td {
  white-space: normal;
}

.guide-table td:first-child {
  font-weight: 700;
}

.guide-table a {
  color: var(--blue);
  font-weight: 750;
}

.role-tag {
  display: inline-flex;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.role-master { background: var(--blue-soft); color: var(--blue); }
.role-lookup { background: var(--gold-soft); color: var(--gold); }
.role-obligation { background: var(--red-soft); color: var(--red); }
.role-activity { background: var(--green-soft); color: var(--green); }

.record-trace {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  background: var(--line);
  list-style: none;
}

.record-trace li {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.record-trace span,
.record-trace strong,
.record-trace code,
.record-trace small {
  display: block;
}

.record-trace span {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.record-trace strong {
  margin-top: 5px;
  font-size: 12px;
}

.record-trace code {
  overflow-wrap: anywhere;
  margin-top: 9px;
  color: var(--blue);
  font-size: 9px;
}

.record-trace small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.guide-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  gap: 24px;
  align-items: start;
}

.phrase-dictionary {
  margin: 0;
  border: 1px solid var(--line);
}

.phrase-dictionary > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.55fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
}

.phrase-dictionary > div:last-child {
  border-bottom: 0;
}

.phrase-dictionary dt {
  color: var(--muted);
  font-size: 11px;
}

.phrase-dictionary dd {
  margin: 0;
}

.phrase-dictionary code {
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
}

.join-safety {
  padding: 18px;
  background: var(--surface-soft);
}

.join-safety h3 {
  margin: 4px 0 0;
  font-size: 15px;
  letter-spacing: 0;
}

.join-safety ol,
.join-safety ul {
  display: grid;
  gap: 10px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.join-safety li {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.join-safety li strong,
.join-safety li span {
  font-size: 10px;
}

.join-safety li span {
  color: var(--muted);
}

.guide-small-note {
  margin: 15px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.knowledge-checks {
  border: 1px solid var(--line);
}

.knowledge-checks details {
  border-bottom: 1px solid var(--line);
}

.knowledge-checks details:last-child {
  border-bottom: 0;
}

.knowledge-checks summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 750;
}

.knowledge-checks details[open] summary {
  background: var(--surface-soft);
}

.knowledge-checks p {
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 11px 14px;
  color: var(--muted);
  font-size: 11px;
}

.guide-next {
  background: var(--green-soft);
}

.guide-next strong {
  display: block;
  font-size: 15px;
}

.operations-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.operations-flow > div {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.operations-flow span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
}

.operations-flow strong,
.operations-flow small {
  display: block;
}

.operations-flow strong {
  margin-top: 10px;
  font-size: 11px;
}

.operations-flow small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.case-ledger {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.case-ledger > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 13px;
}

.case-ledger > div:last-child {
  border-right: 0;
}

.case-ledger span,
.case-ledger strong,
.case-ledger small {
  display: block;
}

.case-ledger span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.case-ledger strong {
  margin-top: 4px;
  font-size: 15px;
}

.case-ledger small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.record-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.record-comparison > div {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
}

.record-comparison svg {
  width: 18px;
  height: 18px;
  color: var(--green);
}

.record-comparison span,
.record-comparison strong,
.record-comparison code {
  display: block;
}

.record-comparison span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.record-comparison strong {
  margin-top: 3px;
  font-size: 12px;
}

.record-comparison p {
  margin: 7px 0;
  color: var(--muted);
  font-size: 10px;
}

.record-comparison code {
  color: var(--blue);
  font-size: 9px;
}

.control-gates {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.control-gates li {
  border-top: 3px solid var(--gold);
  padding: 13px;
  background: var(--gold-soft);
}

.control-gates li:nth-child(2) { border-color: var(--blue); background: var(--blue-soft); }
.control-gates li:nth-child(3) { border-color: var(--red); background: var(--red-soft); }
.control-gates li:nth-child(4),
.control-gates li:nth-child(5) { border-color: var(--green); background: var(--green-soft); }

.control-gates span,
.control-gates strong {
  display: block;
}

.control-gates span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.control-gates strong {
  margin-top: 4px;
  font-size: 11px;
}

.control-gates p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.practice-paths {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.practice-paths a {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
}

.practice-paths a:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.practice-paths svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--green);
}

.practice-paths span,
.practice-paths strong,
.practice-paths small {
  display: block;
  min-width: 0;
}

.practice-paths strong {
  font-size: 10px;
}

.practice-paths small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.operator-analyst-cycle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) 20px minmax(0, 1fr) 20px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  background: #f8faf8;
}

.operator-analyst-cycle > div {
  min-width: 0;
  padding: 12px;
}

.operator-analyst-cycle > svg {
  width: 14px;
  height: 14px;
  color: var(--line-strong);
}

.operator-analyst-cycle span,
.operator-analyst-cycle strong,
.operator-analyst-cycle small {
  display: block;
}

.operator-analyst-cycle span {
  color: var(--green);
  font-size: 8px;
  font-weight: 850;
}

.operator-analyst-cycle strong {
  margin-top: 2px;
  font-size: 10px;
}

.operator-analyst-cycle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.paired-scenario-list {
  margin-top: 14px;
  border: 1px solid var(--line);
}

.paired-scenario-list article {
  display: grid;
  grid-template-columns: 28px minmax(220px, 1.35fr) minmax(160px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.paired-scenario-list article:last-child {
  border-bottom: 0;
}

.paired-scenario-number {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
}

.paired-scenario-operation,
.paired-scenario-analysis {
  min-width: 0;
}

.paired-scenario-operation small,
.paired-scenario-operation strong,
.paired-scenario-analysis small,
.paired-scenario-analysis strong {
  display: block;
}

.paired-scenario-operation small,
.paired-scenario-analysis small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.paired-scenario-operation strong,
.paired-scenario-analysis strong {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.45;
}

.paired-scenario-analysis strong {
  color: var(--blue);
}

.lab-guide-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 14px;
  border-left: 3px solid var(--blue);
  padding: 8px 11px;
  background: var(--blue-soft);
  font-size: 10px;
}

.lab-guide-links > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.lab-guide-links svg {
  width: 15px;
  height: 15px;
}

.lab-guide-links a {
  color: var(--blue);
  font-weight: 750;
}

.lab-guide-links + .training-progress {
  margin-top: 0;
}

.training-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -8px 0 16px;
}

.training-progress > span {
  display: block;
  width: min(360px, 100%);
  height: 6px;
  overflow: hidden;
  border-radius: 2px;
  background: #dfe5df;
}

.training-progress > span > span {
  display: block;
  height: 100%;
  background: var(--green);
}

.training-progress strong {
  color: var(--muted);
  font-size: 11px;
}

.training-reset-trigger {
  min-height: 32px;
  margin-left: auto;
  padding: 0 10px;
  font-size: 10px;
  white-space: nowrap;
}

.training-reset-trigger svg,
.training-reset-actions svg {
  width: 14px;
  height: 14px;
}

.training-reset-confirmation {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: -8px 0 16px;
  border: 1px solid #ddb6b2;
  border-left: 3px solid var(--red);
  padding: 11px 12px;
  background: var(--red-soft);
  color: #663532;
}

.training-reset-confirmation[hidden] {
  display: none;
}

.training-reset-confirmation > svg {
  width: 18px;
  height: 18px;
  color: var(--red);
}

.training-reset-confirmation strong,
.training-reset-confirmation span {
  display: block;
}

.training-reset-confirmation strong {
  font-size: 10px;
}

.training-reset-confirmation span {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.45;
}

.training-reset-actions {
  display: flex;
  gap: 7px;
}

.training-reset-actions .button {
  min-height: 34px;
  white-space: nowrap;
}

.mobile-exercise-picker {
  display: none;
  gap: 5px;
  margin: 0 0 12px;
}

.mobile-exercise-picker > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.mobile-exercise-picker select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 36px 0 11px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 750;
}

.training-layout {
  display: grid;
  grid-template-columns: 248px minmax(440px, 1fr) 276px;
  gap: 14px;
  align-items: start;
}

.training-library,
.training-workbench,
.schema-browser,
.bi-spec-panel,
.bi-preview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.training-library {
  overflow: hidden;
}

.training-library-head {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
}

.training-library-head strong,
.training-library-head span {
  display: block;
}

.training-library-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.training-library-subhead {
  border-top: 1px solid var(--line);
  background: var(--blue-soft);
}

.training-list-optional .exercise-sequence {
  color: var(--blue);
}

.training-list {
  display: grid;
  gap: 3px;
  padding: 6px;
}

.training-list-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 0;
  border-radius: 4px;
  padding: 10px 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.training-list-item:hover,
.training-list-item[aria-current="true"] {
  background: var(--surface-soft);
}

.training-list-item[aria-current="true"] {
  box-shadow: inset 3px 0 0 var(--green);
}

.training-list-item strong,
.training-list-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.training-list-item strong {
  font-size: 11px;
}

.training-list-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.exercise-sequence {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.exercise-sequence svg {
  width: 13px;
  height: 13px;
}

.training-workbench {
  container-type: inline-size;
  overflow: hidden;
}

.scenario-path {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.scenario-stage {
  display: grid;
  min-width: 0;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px 9px;
  align-content: start;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 11px 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.scenario-stage:last-child {
  border-right: 0;
}

.scenario-stage:hover {
  background: var(--surface-soft);
}

.scenario-stage[aria-current="step"] {
  background: var(--surface);
  box-shadow: inset 0 -3px 0 var(--green);
}

.scenario-stage[data-stage-target="analyze"][aria-current="step"] {
  box-shadow: inset 0 -3px 0 var(--blue);
}

.scenario-stage[data-stage-target="explain"][aria-current="step"] {
  box-shadow: inset 0 -3px 0 var(--gold);
}

.scenario-stage:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.scenario-stage-number,
.learning-stage-number {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}

.scenario-stage-number {
  width: 26px;
  height: 26px;
  grid-row: 1 / 3;
}

.scenario-stage-number svg {
  width: 13px;
  height: 13px;
}

.scenario-stage small,
.scenario-stage strong,
.scenario-stage em {
  display: block;
  min-width: 0;
}

.scenario-stage small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  text-transform: uppercase;
}

.scenario-stage strong {
  margin-top: 1px;
  font-size: 10px;
}

.scenario-stage em {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-stage p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.scenario-stage.is-complete .scenario-stage-number {
  border-color: #98b7a5;
  background: var(--green-soft);
  color: var(--green);
}

.learning-stage-panel[hidden],
.schema-browser[hidden] {
  display: none;
}

.stage-navigation {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  background: var(--surface-soft);
}

.stage-navigation > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.stage-navigation > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.stage-navigation .button {
  min-height: 34px;
  white-space: nowrap;
}

.learning-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.learning-stage-title {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
}

.learning-stage-number {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-color: var(--green);
  color: var(--green);
}

.learning-stage-title h3 {
  margin: 4px 0 0;
  font-size: 13px;
  letter-spacing: 0;
  line-height: 1.3;
}

.learning-stage-title p {
  max-width: 680px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.operational-task {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.operational-stage-head {
  border-bottom: 1px solid var(--line);
}

.operational-stage-head .button {
  white-space: nowrap;
}

.operational-task-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.operational-instructions,
.operational-evidence {
  min-width: 0;
  margin: 0;
  padding: 14px 16px;
}

.operational-instructions ol {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.operational-instructions li {
  padding-left: 3px;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.operational-instructions li span {
  color: var(--ink);
  font-weight: 500;
  line-height: 1.5;
}

.dataset-handoff {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  background: var(--blue-soft);
}

.dataset-handoff svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--blue);
}

.dataset-handoff p {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.operational-evidence {
  border: 0;
  border-top: 1px solid var(--line);
  background: #f8faf8;
}

.operational-evidence legend {
  padding: 0;
  font-size: 10px;
  font-weight: 800;
}

.operational-evidence > p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 8px;
}

.operational-evidence label {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 8px 0;
  cursor: pointer;
  font-size: 9px;
  line-height: 1.45;
}

.operational-evidence input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--green);
}

.operational-evidence > small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.operations-to-sql {
  display: flex;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 11px 16px;
  background: var(--gold-soft);
}

.operations-to-sql svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--gold);
}

.operations-to-sql span {
  display: block;
  color: var(--gold);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.operations-to-sql p {
  margin: 3px 0 0;
  color: #655333;
  font-size: 9px;
  line-height: 1.45;
}

.analysis-stage-head {
  border-bottom: 1px solid var(--line);
  background: var(--blue-soft);
}

.analysis-stage-head .learning-stage-number {
  border-color: var(--blue);
  color: var(--blue);
}

.exercise-head,
.bi-panel-head,
.bi-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.exercise-head {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.exercise-head h2,
.schema-browser-head h2,
.bi-panel-head h2,
.bi-preview-head h2 {
  margin: 6px 0 0;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.2;
}

.exercise-head p {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.source-badge {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.exercise-contract,
.bi-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.exercise-contract > div,
.bi-summary-strip > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 10px 14px;
}

.exercise-contract > div:last-child,
.bi-summary-strip > div:last-child {
  border-right: 0;
}

.exercise-contract span,
.exercise-contract strong,
.bi-summary-strip span,
.bi-summary-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-contract span,
.bi-summary-strip span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.exercise-contract strong,
.bi-summary-strip strong {
  margin-top: 3px;
  font-size: 11px;
}

.report-contract {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.report-contract-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 16px 13px;
}

.report-contract-head h3 {
  margin: 5px 0 0;
  font-size: 14px;
  letter-spacing: 0;
}

.report-contract-head p {
  max-width: 660px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.construction-guide {
  border-top: 1px solid var(--line);
}

.construction-guide > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.construction-guide > summary::-webkit-details-marker {
  display: none;
}

.construction-guide > summary > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.construction-guide > summary svg {
  width: 15px;
  height: 15px;
  color: var(--green);
}

.construction-guide > summary strong {
  font-size: 10px;
}

.construction-guide > summary small {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.construction-guide[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.construction-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
}

.construction-intro > div:first-child > strong {
  display: block;
  font-size: 12px;
}

.base-table-callout {
  flex: 0 0 auto;
  border-left: 3px solid var(--green);
  padding: 3px 0 3px 10px;
}

.base-table-callout span,
.base-table-callout code {
  display: block;
}

.base-table-callout span,
.request-map-labels,
.join-contract > span,
.expected-contract > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.base-table-callout code {
  margin-top: 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.request-map-labels,
.request-map-row {
  display: grid;
  grid-template-columns: 26px minmax(150px, 0.9fr) minmax(220px, 1.25fr) minmax(140px, 0.8fr);
  gap: 10px;
}

.request-map-labels {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 7px 14px;
  background: #f8faf8;
}

.request-map-row {
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

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

.request-map-step {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.request-map-meaning strong,
.request-map-meaning small {
  display: block;
}

.request-map-meaning strong {
  font-size: 10px;
}

.request-map-meaning small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.request-map-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.request-map-output {
  display: contents;
}

.request-map-fields code,
.expected-contract code {
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
}

.request-map-source code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 9px;
  line-height: 1.45;
}

.request-mobile-label {
  display: none;
}

.join-contract,
.expected-contract {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  background: #fbfcfb;
}

.join-contract > div,
.expected-contract > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
}

.join-contract > div > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.join-contract code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 9px;
}

.join-contract b {
  color: var(--green);
  font-size: 10px;
}

.join-contract small {
  color: var(--muted);
  font-size: 9px;
}

.expected-contract {
  border-top-color: #d8e2e7;
  background: var(--blue-soft);
}

.expected-contract > div > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.expected-contract b {
  color: var(--muted);
  font-size: 8px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
}

.editor-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.editor-head > div:first-child span {
  color: var(--muted);
  font-size: 10px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.editor-actions .button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 10px;
}

.editor-actions .button svg {
  width: 14px;
  height: 14px;
}

.sql-editor {
  display: block;
  width: 100%;
  min-height: 310px;
  resize: vertical;
  border: 0;
  border-top: 1px solid #37453b;
  border-bottom: 1px solid #37453b;
  border-radius: 0;
  padding: 16px;
  background: #202821;
  color: #edf3ee;
  caret-color: #ffffff;
  font: 12px/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

.sql-editor:focus {
  outline: 3px solid rgba(46, 100, 127, 0.25);
  outline-offset: -3px;
}

.hint-callout {
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  background: var(--gold-soft);
}

.hint-callout span {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.hint-callout p {
  margin: 3px 0 0;
  color: #5e4a27;
  font-size: 11px;
}

.query-result {
  border-bottom: 1px solid var(--line);
}

.training-placeholder {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.training-placeholder svg {
  width: 20px;
  height: 20px;
}

.validation-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
}

.validation-passed { background: var(--green-soft); color: var(--green); }
.validation-review { background: var(--gold-soft); color: #755018; }
.validation-reference { background: var(--blue-soft); color: var(--blue); }

.validation-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.validation-icon svg {
  width: 15px;
  height: 15px;
}

.validation-banner strong,
.validation-banner span {
  display: block;
}

.validation-banner span {
  margin-top: 2px;
  font-size: 10px;
}

.validation-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.validation-checks > div {
  display: flex;
  gap: 8px;
  border-right: 1px solid var(--line);
  padding: 10px 12px;
}

.validation-checks > div:last-child {
  border-right: 0;
}

.validation-checks svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--green);
}

.validation-checks strong,
.validation-checks small {
  display: block;
}

.validation-checks strong {
  font-size: 10px;
}

.validation-checks small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.query-error {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--red-soft);
  color: var(--red);
}

.query-error > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.query-error p {
  margin: 4px 0 0;
  color: #75423f;
}

.interpretation-panel {
  display: grid;
  gap: 9px;
  padding: 14px;
  background: #f8faf8;
}

.interpretation-panel textarea {
  min-height: 92px;
}

.reflection-copy label,
.reflection-copy small {
  display: block;
}

.reflection-copy label {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
}

.reflection-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-style: italic;
  line-height: 1.45;
}

.reflection-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reflection-save-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.reflection-save-note svg {
  width: 13px;
  height: 13px;
}

.schema-browser {
  overflow: hidden;
  padding-bottom: 12px;
}

.schema-browser-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 13px;
}

.schema-purpose {
  margin: 0;
  padding: 11px 13px 0;
  color: var(--muted);
  font-size: 10px;
}

.schema-grain {
  margin: 10px 13px;
  border-left: 3px solid var(--green);
  padding: 7px 9px;
  background: var(--surface-soft);
}

.schema-grain span,
.schema-grain strong {
  display: block;
}

.schema-grain span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.schema-grain strong {
  margin-top: 2px;
  font-size: 10px;
}

.schema-browser > .field {
  margin: 0 13px 10px;
}

.schema-column-list {
  max-height: 300px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schema-column-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #e6eae6;
  padding: 7px 13px;
}

.schema-column-list > div:last-child {
  border-bottom: 0;
}

.schema-column-list code {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
}

.schema-column-list span {
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.relationship-list {
  display: grid;
  gap: 6px;
  padding: 10px 13px;
}

.relationship-list span {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.relationship-list svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.sample-details {
  border-top: 1px solid var(--line);
}

.sample-details summary {
  cursor: pointer;
  padding: 9px 13px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.sample-details th,
.sample-details td {
  padding: 7px 9px;
  font-size: 9px;
}

.bi-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.bi-workspace {
  display: grid;
  grid-template-columns: minmax(350px, 0.72fr) minmax(420px, 1.28fr);
  gap: 14px;
}

.bi-spec-panel,
.bi-preview-panel {
  overflow: hidden;
}

.bi-panel-head,
.bi-preview-head {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

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

.acceptance-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: #f8faf8;
}

.acceptance-list > strong {
  font-size: 10px;
  text-transform: uppercase;
}

.acceptance-list label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.acceptance-list input {
  margin: 2px 0 0;
  accent-color: var(--green);
}

.bi-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding: 11px 14px;
}

.bi-summary-strip {
  border-bottom: 1px solid var(--line);
}

.bi-visual {
  min-height: 430px;
  overflow: auto;
  padding: 14px;
}

.bi-bars {
  display: grid;
  gap: 13px;
}

.bi-bars > div {
  display: grid;
  grid-template-columns: 120px minmax(100px, 1fr) 100px;
  gap: 10px;
  align-items: center;
}

.bi-bars > div > span:first-child {
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-bars strong {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bi-bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 2px;
  background: #e5e9e5;
}

.bi-bar-track span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.bi-kpi-preview {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  gap: 8px;
}

.bi-kpi-preview span,
.bi-kpi-preview small {
  color: var(--muted);
}

.bi-kpi-preview strong {
  font-size: 42px;
  line-height: 1;
}

.lineage-band {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.lineage-band svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--green);
}

.lineage-band code {
  color: var(--ink);
}

.lab-mode-tabs {
  display: inline-flex;
  gap: 2px;
  margin: -8px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 3px;
  background: var(--surface);
}

.lab-mode-tabs button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 3px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
}

.lab-mode-tabs button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.lab-mode-tabs button[aria-selected="true"] {
  background: var(--green);
  color: #ffffff;
}

.lab-mode-tabs svg {
  width: 14px;
  height: 14px;
}

.lab-mode-tabs + .lab-guide-links {
  margin-top: 0;
}

.foundation-terms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.foundation-terms > div {
  min-width: 0;
  border-top: 3px solid var(--blue);
  padding: 14px;
  background: var(--blue-soft);
}

.foundation-terms > div:nth-child(2),
.foundation-terms > div:nth-child(5) {
  border-color: var(--green);
  background: var(--green-soft);
}

.foundation-terms > div:nth-child(3),
.foundation-terms > div:nth-child(6) {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.foundation-terms svg {
  width: 18px;
  height: 18px;
}

.foundation-terms span,
.foundation-terms strong,
.foundation-terms small {
  display: block;
}

.foundation-terms span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.foundation-terms strong {
  margin-top: 3px;
  font-size: 12px;
}

.foundation-terms small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.sql-symbols,
.later-tools {
  margin: 0;
  border: 1px solid var(--line);
}

.sql-symbols > div,
.later-tools > div {
  display: grid;
  grid-template-columns: minmax(125px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
}

.sql-symbols > div:last-child,
.later-tools > div:last-child {
  border-bottom: 0;
}

.sql-symbols dt,
.sql-symbols dd {
  margin: 0;
  font-size: 10px;
}

.sql-symbols dt,
.later-tools code {
  color: var(--blue);
  font-weight: 750;
}

.sql-symbols dd,
.later-tools span {
  color: var(--muted);
}

.beginner-note,
.terminal-prompt-example {
  border-left: 3px solid var(--gold);
  padding: 18px;
  background: var(--gold-soft);
  color: #5e4a27;
}

.beginner-note-blue,
.terminal-prompt-example {
  border-left-color: var(--blue);
  background: var(--blue-soft);
  color: #274f65;
}

.beginner-note svg {
  width: 20px;
  height: 20px;
}

.beginner-note h3 {
  margin: 5px 0 0;
  font-size: 15px;
  letter-spacing: 0;
}

.beginner-note p,
.terminal-prompt-example p {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.55;
}

.sql-anatomy {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
}

.foundation-code {
  min-width: 0;
  overflow-x: auto;
  margin: 0;
  border: 1px solid #37453b;
  padding: 17px;
  background: #202821;
  color: #edf3ee;
  font: 11px/1.75 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.foundation-code span {
  color: #9ed9b2;
  font-weight: 800;
}

.sql-anatomy ol,
.query-order,
.foundation-workflow {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sql-anatomy ol {
  display: grid;
  border: 1px solid var(--line);
}

.sql-anatomy li {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.sql-anatomy li:last-child {
  border-bottom: 0;
}

.sql-anatomy li code {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.sql-anatomy li span {
  color: var(--muted);
  font-size: 10px;
}

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

.order-comparison > div {
  border: 1px solid var(--line);
}

.order-comparison > div > .eyebrow {
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.query-order {
  display: grid;
}

.query-order li {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
}

.query-order li:last-child {
  border-bottom: 0;
}

.query-order code {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.query-order-logical code {
  color: var(--blue);
}

.query-order span {
  color: var(--muted);
  font-size: 10px;
}

.clause-library {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.clause-library > div {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
}

.clause-library code,
.clause-library strong,
.clause-library span {
  display: block;
}

.clause-library code {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
}

.clause-library strong {
  margin-top: 7px;
  font-size: 11px;
}

.clause-library span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.operator-list {
  border: 1px solid var(--line);
}

.operator-list > .eyebrow {
  display: block;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.operator-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}

.operator-list > div:last-child {
  border-bottom: 0;
}

.operator-list code {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.operator-list div span {
  color: var(--muted);
  font-size: 10px;
}

.join-example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.join-example > div {
  border-left: 3px solid var(--blue);
  padding: 11px 13px;
  background: var(--blue-soft);
}

.join-example > div:last-child {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.join-example span,
.join-example code {
  display: block;
}

.join-example span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.join-example code {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 10px;
}

.join-example > svg {
  width: 16px;
  color: var(--muted);
}

.foundation-join-lenses {
  margin-top: 12px;
}

.aggregate-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 12px;
  background: var(--line);
}

.aggregate-strip > div {
  padding: 12px;
  background: var(--surface-soft);
  text-align: center;
}

.aggregate-strip code,
.aggregate-strip span {
  display: block;
}

.aggregate-strip code {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.aggregate-strip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.later-tools code,
.later-tools span {
  font-size: 10px;
}

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

.command-comparison > div {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--line);
  padding: 12px;
}

.command-comparison span {
  display: block;
  width: 100%;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.command-comparison code {
  border-radius: 3px;
  padding: 4px 6px;
  background: var(--surface-soft);
  color: var(--blue);
  font-size: 9px;
}

.terminal-prompt-example > code {
  display: block;
  margin-top: 9px;
  overflow-x: auto;
  padding: 10px;
  background: #202821;
  color: #edf3ee;
  font-size: 10px;
}

.foundation-workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.foundation-workflow li {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
}

.foundation-workflow li > span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
}

.foundation-workflow strong,
.foundation-workflow small {
  display: block;
}

.foundation-workflow strong {
  margin-top: 9px;
  font-size: 10px;
}

.foundation-workflow small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.sandbox-layout {
  display: grid;
  grid-template-columns: 248px minmax(440px, 1fr) 276px;
  gap: 14px;
  align-items: start;
}

.sandbox-controls {
  overflow: hidden;
}

.sandbox-control-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.sandbox-rules {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px;
  background: var(--surface-soft);
}

.sandbox-rules ul {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding-left: 17px;
  color: var(--muted);
  font-size: 9px;
}

.sandbox-history-head {
  padding: 12px 12px 7px;
}

.sandbox-history-head strong,
.sandbox-history-head small {
  display: block;
}

.sandbox-history-head strong {
  font-size: 10px;
}

.sandbox-history-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.sandbox-history {
  display: grid;
  gap: 3px;
  padding: 0 6px 6px;
}

.sandbox-history-item {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  border-radius: 3px;
  padding: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.sandbox-history-item:hover {
  background: var(--surface-soft);
}

.sandbox-history-item > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sandbox-history-item strong,
.sandbox-history-item small {
  font-size: 9px;
}

.sandbox-history-item small {
  color: var(--muted);
}

.sandbox-history-item code {
  overflow: hidden;
  color: var(--blue);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sandbox-history-empty {
  padding: 8px 6px 12px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.sandbox-workbench {
  min-width: 0;
}

.sandbox-demo-note {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  background: var(--blue-soft);
  color: #274f65;
}

.sandbox-demo-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sandbox-demo-note strong,
.sandbox-demo-note p {
  font-size: 10px;
}

.sandbox-demo-note p {
  margin: 3px 0 0;
  color: var(--muted);
}

@container (min-width: 760px) {
  .operational-task-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  }

  .operational-evidence {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

@container (max-width: 720px) {
  .editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-head > div:first-child {
    width: 100%;
  }

  .editor-actions {
    justify-content: flex-start;
    width: 100%;
  }
}

@container (max-width: 640px) {
  .request-map-labels {
    display: none;
  }

  .request-map-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px 14px;
  }

  .request-map-step {
    grid-row: 1 / 3;
  }

  .request-map-meaning,
  .request-map-output {
    grid-column: 2;
  }

  .request-map-output {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .request-mobile-label {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .join-contract,
  .expected-contract {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

@container (max-width: 520px) {
  .scenario-path {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scenario-stage {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 5px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding: 9px 7px;
  }

  .scenario-stage:last-child {
    border-right: 0;
  }

  .scenario-stage-number {
    width: 21px;
    height: 21px;
    grid-row: 1;
  }

  .scenario-stage small,
  .scenario-stage p {
    display: none;
  }

  .scenario-stage strong {
    margin-top: 0;
    font-size: 9px;
  }

  .scenario-stage em {
    overflow: visible;
    font-size: 7px;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
  }

  .learning-stage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .operational-stage-head .button {
    justify-content: center;
    width: 100%;
  }
}

@media (min-width: 1181px) and (max-width: 1420px) {
  .training-layout {
    grid-template-columns: minmax(0, 1fr) 276px;
  }

  .training-layout:not([data-active-stage="analyze"]) {
    grid-template-columns: 1fr;
  }

  .training-library {
    grid-column: 1 / -1;
  }

  .training-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (min-width: 1421px) {
  .training-layout:not([data-active-stage="analyze"]) {
    grid-template-columns: 248px minmax(440px, 1fr);
  }
}

@media (max-width: 1420px) {
  .mobile-exercise-picker {
    display: grid;
  }

  .training-layout > .training-library {
    display: none;
  }
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

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

  .sandbox-layout > .schema-browser {
    grid-column: 1 / -1;
  }

  .schema-browser {
    grid-column: 1 / -1;
  }

  .bi-workspace {
    grid-template-columns: 1fr;
  }

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

  .record-trace,
  .operations-flow,
  .control-gates,
  .practice-paths,
  .foundation-workflow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .main-shell {
    margin-left: 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .report-layout,
  .model-intro,
  .training-layout,
  .sandbox-layout,
  .bi-layout,
  .guide-two-column {
    grid-template-columns: 1fr;
  }

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

  .system-story > svg {
    display: none;
  }

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

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

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

  .case-ledger > div {
    border-bottom: 1px solid var(--line);
  }

  .schema-browser {
    grid-column: auto;
  }

  .sandbox-layout > .schema-browser {
    grid-column: auto;
  }

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

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

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

  .sql-anatomy,
  .order-comparison {
    grid-template-columns: 1fr;
  }

  .paired-scenario-list article {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }

  .paired-scenario-analysis {
    grid-column: 2;
  }

  .paired-scenario-list .button {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

@media (max-width: 680px) {
  .training-reset-confirmation {
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
  }

  .training-reset-actions {
    grid-column: 1 / -1;
  }

  .training-reset-actions .button {
    flex: 1 1 0;
  }

  .stage-navigation {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-navigation > div,
  .stage-navigation .button {
    width: 100%;
  }

  .stage-navigation .button {
    justify-content: center;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar-actions .mode-badge {
    display: none;
  }

  .button span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workspace {
    padding: 16px 12px 24px;
  }

  .view-head,
  .panel-head,
  .report-head,
  .guide-intro,
  .guide-next {
    align-items: stretch;
    flex-direction: column;
  }

  .guide-intro,
  .guide-next,
  .guide-section {
    padding: 18px 16px;
  }

  .guide-actions {
    flex: 1 1 auto;
  }

  .system-story,
  .guide-lenses,
  .first-use-path,
  .record-trace,
  .operations-flow,
  .case-ledger,
  .record-comparison,
  .control-gates,
  .practice-paths {
    grid-template-columns: 1fr;
  }

  .paired-learning-cycle {
    grid-template-columns: 1fr;
  }

  .paired-learning-cycle > svg {
    display: none;
  }

  .first-use-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .first-use-banner .button {
    justify-content: center;
  }

  .first-session-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .training-scenario-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .training-scenario-banner .button {
    justify-content: center;
  }

  .operator-analyst-cycle {
    grid-template-columns: 1fr;
  }

  .operator-analyst-cycle > svg {
    justify-self: center;
    transform: rotate(90deg);
  }

  .paired-scenario-list article {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .paired-scenario-analysis,
  .paired-scenario-list .button {
    grid-column: 2;
    grid-row: auto;
  }

  .paired-scenario-list .button {
    justify-content: center;
  }

  .foundation-terms,
  .clause-library,
  .aggregate-strip,
  .foundation-workflow,
  .command-comparison {
    grid-template-columns: 1fr;
  }

  .sql-symbols > div,
  .later-tools > div,
  .sql-anatomy li,
  .query-order li,
  .operator-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .join-example {
    grid-template-columns: 1fr;
  }

  .join-example > svg {
    transform: rotate(90deg);
    justify-self: center;
  }

  .lab-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .lab-mode-tabs button {
    justify-content: center;
  }

  .case-ledger > div {
    border-right: 0;
  }

  .case-ledger > div:last-child {
    border-bottom: 0;
  }

  .phrase-dictionary > div,
  .join-safety li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .lab-guide-links {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .view-meta {
    white-space: normal;
  }

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

  .kpi-card {
    min-height: 98px;
    padding: 13px;
  }

  .kpi-card strong {
    font-size: 19px;
  }

  .status-bar-row {
    grid-template-columns: 70px minmax(80px, 1fr);
  }

  .status-bar-value {
    grid-column: 2;
    font-size: 11px;
    text-align: left;
  }

  .report-list,
  .model-principles,
  .payment-form-grid,
  .training-list,
  .exercise-contract,
  .validation-checks,
  .bi-form-grid,
  .bi-summary-strip {
    grid-template-columns: 1fr;
  }

  .exercise-contract > div,
  .validation-checks > div,
  .bi-summary-strip > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .exercise-contract > div:last-child,
  .validation-checks > div:last-child,
  .bi-summary-strip > div:last-child {
    border-bottom: 0;
  }

  .report-contract-head {
    align-items: stretch;
    flex-direction: column;
  }

  .construction-guide > summary,
  .construction-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .construction-guide > summary small {
    text-align: left;
  }

  .base-table-callout {
    align-self: stretch;
  }

  .request-map-labels {
    display: none;
  }

  .request-map-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px 14px;
  }

  .request-map-step {
    grid-row: 1 / 3;
  }

  .request-map-meaning,
  .request-map-output {
    grid-column: 2;
  }


  .request-map-output {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .request-mobile-label {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .join-contract,
  .expected-contract {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .editor-head,
  .interpretation-panel {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .editor-head {
    flex-direction: column;
  }

  .editor-actions {
    justify-content: flex-start;
  }

  .reflection-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .sql-editor {
    min-height: 260px;
  }

  .bi-bars > div {
    grid-template-columns: 88px minmax(80px, 1fr);
  }

  .bi-bars strong {
    grid-column: 2;
    text-align: left;
  }

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

  .account-summary {
    grid-template-columns: 1fr;
  }

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

  .account-financial-summary .mini-stat:last-child {
    grid-column: 1 / -1;
  }

  .account-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .account-tabs button {
    min-width: 0;
    padding: 8px 4px;
    font-size: 9px;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .page-identity span {
    display: none;
  }

  .topbar-actions .button {
    width: 38px;
    padding: 0;
  }

  .topbar-actions .button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
}

@media print {
  .sidebar,
  .topbar,
  .filters,
  .report-library,
  .dialog-actions {
    display: none !important;
  }

  .main-shell {
    margin: 0;
  }

  .workspace {
    max-width: none;
    padding: 0;
  }

  .report-layout {
    display: block;
  }

  .report-workspace,
  .table-panel {
    border: 0;
  }
}
