:root {
  --canvas: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --ink: #151922;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #e2e7ec;
  --line-strong: #cfd6de;
  --sidebar: #15171c;
  --sidebar-soft: #22252d;
  --brand: #00a88f;
  --brand-strong: #007d6b;
  --brand-soft: #e8f8f4;
  --blue: #3678e5;
  --violet: #7165e8;
  --amber: #c77b13;
  --danger: #c83f56;
  --success: #14875f;
  --shadow: 0 10px 26px rgba(19, 28, 38, 0.07);
  --sidebar-width: 244px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
}

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

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

button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

button:hover:not(:disabled) {
  border-color: #9ca8b5;
  background: var(--surface-subtle);
}

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

button[aria-busy="true"] {
  cursor: progress;
}

button[aria-busy="true"]::after {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -2px;
  animation: busy-spin 700ms linear infinite;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(54, 120, 229, 0.3);
  outline-offset: 2px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--ink);
}

input:hover,
select:hover {
  border-color: #9ca8b5;
}

label,
.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
dt,
pre {
  margin: 0;
}

h1 {
  font-size: 1.08rem;
  line-height: 1.3;
}

h2 {
  font-size: 1.65rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  line-height: 1.35;
}

h4 {
  margin-bottom: 12px;
  font-size: 0.86rem;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 10px;
  z-index: 100;
  transform: translateY(-150%);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-direction: column;
  background: var(--sidebar);
  color: #f4f7fa;
  border-right: 1px solid #292c34;
}

.brand-row {
  display: flex;
  align-items: center;
  min-height: 76px;
  gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid #292c34;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid #5ae0c8;
  border-radius: 8px;
  background: #093e38;
  color: #76ead5;
  font-size: 0.9rem;
  font-weight: 900;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row strong {
  font-size: 1rem;
}

.brand-row span {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 0.7rem;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.environment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 14px 10px;
  border: 1px solid #343844;
  border-radius: 7px;
  padding: 11px 12px;
  background: var(--sidebar-soft);
}

.environment-card strong,
.environment-card span {
  display: block;
}

.environment-card strong {
  font-size: 0.8rem;
}

.environment-card span {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 0.68rem;
}

.live-dot,
.connection-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #45d6a6;
  box-shadow: 0 0 0 3px rgba(69, 214, 166, 0.13);
}

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

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 10px;
  border-color: transparent;
  padding: 0 12px;
  background: transparent;
  color: #aeb7c3;
  text-align: left;
  font-size: 0.82rem;
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover:not(:disabled) {
  border-color: transparent;
  background: #242832;
  color: #ffffff;
}

.nav-item.active {
  border-color: #31594f;
  background: #1e332f;
  color: #72e3cf;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 16px 18px 20px;
  border-top: 1px solid #292c34;
}

.sidebar-footer div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.69rem;
}

.sidebar-footer div span {
  color: #7f8998;
}

.sidebar-footer div strong {
  color: #dce3eb;
  font-size: 0.69rem;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #75dbc9;
  font-size: 0.72rem;
  font-weight: 750;
  text-decoration: none;
}

.sidebar-footer a svg {
  width: 13px;
  height: 13px;
}

.sidebar-scrim {
  display: none;
}

.main-shell {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.topbar-title,
.topbar-actions {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-title {
  gap: 12px;
}

.topbar-title span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions {
  gap: 12px;
}

.mobile-menu {
  display: none;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  padding: 0;
  place-items: center;
}

.icon-button.mobile-menu,
.icon-button.sidebar-close {
  display: none;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 252px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 3px;
  background: #f3f5f7;
}

.mode-switch button {
  min-height: 32px;
  border: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
}

.mode-switch button:hover:not(:disabled) {
  border: 0;
  background: transparent;
}

.mode-switch button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
}

.connection-chip {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.connection-chip.offline .connection-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(200, 63, 86, 0.12);
}

#mainContent {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 26px 52px;
}

.safety-banner {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  border: 1px solid #d9e7e3;
  border-radius: 7px;
  padding: 8px 12px;
  background: #f4fbf9;
  color: #28534c;
  font-size: 0.73rem;
}

.safety-banner > div:first-child,
.safety-items {
  display: flex;
  align-items: center;
}

.safety-banner > div:first-child {
  gap: 8px;
  white-space: nowrap;
}

.safety-banner svg {
  width: 16px;
  height: 16px;
  color: var(--brand-strong);
}

.safety-items {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  color: #50716b;
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.view-heading h2 {
  margin-bottom: 6px;
}

.view-heading p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--brand-strong);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.heading-actions,
.button-row,
.icon-text,
.button-link,
.text-button {
  display: flex;
  align-items: center;
}

.heading-actions,
.button-row {
  flex-wrap: wrap;
  gap: 8px;
}

.icon-text,
.button-link {
  justify-content: center;
  gap: 8px;
}

.button-link {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
}

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

.primary:hover:not(:disabled) {
  border-color: #303846;
  background: #303846;
}

.secondary {
  background: var(--surface);
}

.danger-text {
  border-color: #f0ccd3;
  color: var(--danger);
}

.danger-text:hover:not(:disabled) {
  border-color: #dc9fac;
  background: #fff7f8;
}

.text-button {
  min-height: 32px;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.76rem;
}

.text-button:hover:not(:disabled) {
  border: 0;
  background: transparent;
}

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

.position-band,
.runtime-band {
  margin-bottom: 18px;
  border-radius: 8px;
  background: #1d2028;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.position-band {
  padding: 22px 24px;
}

.position-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

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

.position-head strong {
  margin-top: 5px;
  font-size: 1.1rem;
}

.position-kicker {
  color: #9ea8b7;
  font-size: 0.64rem;
  font-weight: 800;
}

.state-pill {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b5e5da;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.position-band .state-pill {
  border-color: #405149;
  background: #213932;
  color: #72e3cf;
}

.state-pill.neutral {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
}

.state-pill.warning {
  border-color: #efd6aa;
  background: #fff8e9;
  color: #9c6112;
}

.position-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.position-metrics > div {
  min-width: 0;
  border-left: 1px solid #383d48;
  padding: 0 18px;
}

.position-metrics > div:first-child {
  border-left: 0;
  padding-left: 0;
}

.position-metrics span,
.position-metrics strong {
  display: block;
}

.position-metrics span {
  margin-bottom: 6px;
  color: #9ea8b7;
  font-size: 0.69rem;
}

.position-metrics strong {
  overflow-wrap: anywhere;
  font-size: 1.28rem;
}

.overview-grid,
.split-layout,
.developer-grid,
.two-column-detail,
.learning-layout,
.contract-grid {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.overview-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  margin-bottom: 18px;
}

.split-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  margin-bottom: 18px;
}

.developer-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  margin-bottom: 18px;
}

.two-column-detail {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

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

.panel {
  min-width: 0;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(19, 28, 38, 0.035);
}

.overview-grid .panel,
.split-layout .panel,
.developer-grid .panel {
  margin-bottom: 0;
}

.panel-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading > span:not(.state-pill) {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.workflow-list {
  display: grid;
}

.workflow-list button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 62px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 2px;
  text-align: left;
}

.workflow-list button:first-child {
  border-top: 0;
}

.workflow-list button:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--surface-subtle);
}

.step-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.66rem;
}

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

.workflow-list strong {
  margin-bottom: 3px;
  font-size: 0.81rem;
}

.workflow-list small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.step-state {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1f3f5;
  color: var(--muted);
  font-size: 0.64rem;
}

.workflow-list button.complete .step-index {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.workflow-list button.complete .step-state {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.workflow-list button.current .step-index {
  border-color: var(--blue);
  background: #edf4ff;
  color: var(--blue);
}

.workflow-list button.current .step-state {
  background: #edf4ff;
  color: var(--blue);
}

.posture-list,
.key-value-list {
  display: grid;
}

.posture-list > div,
.key-value-list > div {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.77rem;
}

.posture-list > div:first-child,
.key-value-list > div:first-child {
  border-top: 0;
}

.posture-list span,
.key-value-list span {
  color: var(--muted);
}

.posture-list strong,
.key-value-list strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.health-label {
  color: var(--success) !important;
}

.activity-table,
.request-log {
  display: grid;
  min-height: 96px;
}

.activity-row,
.request-row {
  display: grid;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 11px 2px;
  font-size: 0.74rem;
}

.activity-row {
  grid-template-columns: 10px minmax(180px, 1fr) minmax(180px, 1.1fr) auto;
}

.request-row {
  grid-template-columns: 64px minmax(200px, 1fr) 56px minmax(160px, auto);
}

.activity-row:first-child,
.request-row:first-child {
  border-top: 0;
}

.activity-row span,
.request-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-row .activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

.activity-row .activity-dot.audit {
  background: var(--amber);
}

.activity-row time,
.request-row .request-id {
  color: var(--muted);
  font-size: 0.68rem;
}

.empty-row {
  display: grid;
  min-height: 92px;
  place-items: center;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.detail-list {
  display: grid;
  min-width: 0;
}

.detail-list > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 0.65fr);
  min-height: 46px;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.detail-list > div:first-child {
  border-top: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.76rem;
  font-weight: 750;
}

.action-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-subtle);
}

.action-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.action-title svg {
  color: var(--blue);
}

.action-title strong,
.action-title span {
  display: block;
}

.action-title strong {
  font-size: 0.82rem;
}

.action-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.action-panel input,
.action-panel select {
  margin-bottom: 10px;
}

.helper,
.decision-reason,
.policy-note {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.helper {
  margin-top: 10px;
}

.decision-reason {
  margin: 14px 0;
  border-left: 3px solid var(--line-strong);
  padding-left: 10px;
}

.policy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.policy-note svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--brand-strong);
}

.data-strip {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.data-strip.four {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.data-strip.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.data-strip > div {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 14px;
}

.data-strip > div:first-child {
  border-left: 0;
}

.data-strip span,
.data-strip strong,
.learning-stats span,
.learning-stats strong,
.behavior-grid span,
.behavior-grid strong,
.repayment-layout span,
.repayment-layout strong,
.runtime-band span,
.runtime-band strong {
  display: block;
}

.data-strip span,
.learning-stats span,
.behavior-grid span,
.repayment-layout span,
.runtime-band span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.69rem;
}

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

.learning-layout {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  margin-bottom: 14px;
}

.score-panel {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 16px;
  background: #f6faf9;
}

.score-panel strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.12rem;
}

.score-panel p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.score-ring {
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0deg, var(--brand) 180deg, #dde5e3 180deg, #dde5e3 360deg);
}

.score-ring span {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.35rem;
  font-weight: 850;
}

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

.learning-stats > div {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 16px;
}

.learning-stats > div:first-child {
  border-left: 0;
}

.learning-stats strong {
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.behavior-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.behavior-grid > div {
  min-width: 0;
  padding: 12px 0;
}

.behavior-grid strong {
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf1;
}

.meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 220ms ease;
}

.learning-detail {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.compact-list {
  display: grid;
  min-width: 0;
}

.compact-item {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 10px 2px;
}

.compact-item:first-child {
  border-top: 0;
}

.compact-item strong,
.compact-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.compact-item strong {
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.compact-item span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.history-bars {
  display: flex;
  height: 142px;
  align-items: end;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
  padding: 24px 4px 0;
}

.history-bar {
  position: relative;
  width: 22px;
  min-width: 22px;
  border-radius: 4px 4px 0 0;
  background: var(--blue);
}

.history-bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.59rem;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.5fr) auto;
  align-items: end;
  gap: 10px;
}

.inline-form input,
.inline-form select {
  margin: 0;
}

.rail-status {
  margin-top: 12px;
}

.repayment-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(150px, 0.5fr));
  align-items: end;
  gap: 20px;
}

.repayment-layout > div:not(:first-child) {
  min-height: 42px;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.repayment-layout strong {
  font-size: 0.94rem;
}

.evidence-summary {
  margin-bottom: 18px;
}

.evidence-list,
.timeline {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.timeline-item {
  min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  padding: 10px 10px 10px 12px;
}

.timeline-item:first-child {
  border-top: 0;
}

.timeline-item.audit {
  border-left-color: var(--amber);
}

.timeline-item strong,
.timeline-item span {
  display: block;
  overflow-wrap: anywhere;
}

.timeline-item strong {
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.4;
}

.inspector {
  width: 100%;
  min-width: 0;
  max-height: 560px;
  overflow: auto;
  border-radius: 7px;
  padding: 16px;
  background: #171a20;
  color: #d3e8e3;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.7rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.runtime-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.runtime-band > div {
  min-width: 0;
  border-left: 1px solid #383d48;
  padding: 16px 18px;
}

.runtime-band > div:first-child {
  border-left: 0;
}

.runtime-band span {
  color: #9ea8b7;
}

.runtime-band strong {
  overflow-wrap: anywhere;
  font-size: 0.77rem;
}

.code-panel pre {
  min-height: 260px;
  overflow: auto;
  border-radius: 7px;
  padding: 18px;
  background: #171a20;
  color: #d7ebe6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.65;
}

.copy-button {
  min-height: 36px;
  width: 36px;
  min-width: 36px;
}

.capability-list {
  display: grid;
}

.capability-list > div {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px 2px;
}

.capability-list > div:first-child {
  border-top: 0;
}

.capability-list svg {
  width: 17px;
  height: 17px;
  color: var(--success);
}

.capability-list strong,
.capability-list small {
  display: block;
}

.capability-list strong {
  margin-bottom: 3px;
  font-size: 0.77rem;
}

.capability-list small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.request-row .method {
  color: var(--violet);
  font-weight: 850;
}

.request-row .status-ok {
  color: var(--success);
  font-weight: 850;
}

.request-row .status-error {
  color: var(--danger);
  font-weight: 850;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid #3b414c;
  border-radius: 8px;
  padding: 12px 14px;
  background: #171a20;
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.2);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #78424c;
  background: #2c1b20;
}

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

@media (max-width: 1180px) {
  .position-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 18px;
  }

  .position-metrics > div:nth-child(4) {
    border-left: 0;
    padding-left: 0;
  }

  .overview-grid,
  .split-layout,
  .developer-grid,
  .two-column-detail {
    grid-template-columns: 1fr;
  }

  .data-strip.six,
  .runtime-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .data-strip.six > div:nth-child(4),
  .runtime-band > div:nth-child(4) {
    border-left: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .icon-button.sidebar-close,
  .icon-button.mobile-menu {
    display: inline-grid;
  }

  .sidebar-close {
    border-color: #343844;
    background: #22252d;
    color: #dbe2ea;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: rgba(12, 15, 20, 0.56);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .sidebar-scrim:hover:not(:disabled) {
    border-color: transparent;
    background: rgba(12, 15, 20, 0.56);
  }

  body.nav-open .sidebar-scrim {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .main-shell {
    grid-column: 1;
  }

  .topbar {
    padding: 10px 16px;
  }

  #mainContent {
    padding: 16px 16px 42px;
  }

  .connection-chip {
    display: none;
  }

  .data-strip.four,
  .learning-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-strip.four > div:nth-child(3),
  .learning-stats > div:nth-child(3) {
    border-left: 0;
  }

  .learning-layout,
  .contract-grid,
  .repayment-layout {
    grid-template-columns: 1fr;
  }

  .repayment-layout > div:not(:first-child) {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 12px;
    padding-left: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .mode-switch {
    width: 164px;
  }

  .mode-switch button {
    padding: 0 6px;
    font-size: 0.64rem;
  }

  .topbar-title span {
    display: none;
  }

  h1 {
    font-size: 0.96rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .safety-banner,
  .view-heading,
  .panel-heading.stacked-mobile {
    align-items: stretch;
    flex-direction: column;
  }

  .safety-banner {
    gap: 9px;
  }

  .safety-items {
    justify-content: flex-start;
  }

  .view-heading {
    gap: 14px;
  }

  .heading-actions,
  .view-heading > button,
  .view-heading > .button-link {
    width: 100%;
  }

  .heading-actions button {
    flex: 1 1 0;
  }

  .position-band {
    padding: 18px;
  }

  .position-head {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 18px;
  }

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

  .position-metrics > div {
    border-left: 0;
    padding: 0;
  }

  .position-metrics > div:last-child {
    grid-column: 1 / -1;
  }

  .panel {
    padding: 15px;
  }

  .workflow-list button {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .workflow-list .step-state {
    display: none;
  }

  .data-strip.four,
  .data-strip.six,
  .learning-stats,
  .behavior-grid,
  .runtime-band {
    grid-template-columns: 1fr;
  }

  .data-strip > div,
  .learning-stats > div,
  .runtime-band > div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .data-strip > div:first-child,
  .learning-stats > div:first-child,
  .runtime-band > div:first-child {
    border-top: 0;
  }

  .runtime-band > div {
    border-color: #383d48;
  }

  .score-panel {
    grid-template-columns: 96px minmax(0, 1fr);
    padding: 12px;
  }

  .score-ring {
    width: 90px;
    height: 90px;
  }

  .score-ring span {
    width: 66px;
    height: 66px;
    font-size: 1.15rem;
  }

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

  .inline-form button,
  .button-row button {
    flex: 1 1 100%;
    width: 100%;
  }

  .detail-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .activity-row,
  .request-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .activity-row > *:nth-child(n + 3),
  .request-row > *:nth-child(n + 3) {
    grid-column: 2;
  }

  .request-row .method {
    grid-column: 1;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
