@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-950: #060D20;
  --blue-900: #0B1F4F;
  --blue-800: #0D2B6B;
  --blue-700: #1340A0;
  --blue-600: #1B4FD8;
  --blue-500: #3B82F6;
  --blue-400: #60A5FA;
  --blue-100: #DBEAFE;
  --blue-50:  #EFF6FF;

  --gray-950: #030712;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50:  #F9FAFB;

  --green-600: #059669;
  --red-600:   #DC2626;
  --amber-600: #D97706;

  /* Semantic – light */
  --bg:           var(--gray-50);
  --surface:      #FFFFFF;
  --surface-2:    var(--gray-100);
  --border:       var(--gray-200);
  --text:         var(--gray-900);
  --text-muted:   var(--gray-500);
  --accent:       var(--blue-600);
  --accent-hover: var(--blue-700);
  --danger:       var(--red-600);
  --success:      var(--green-600);
  --warning:      var(--amber-600);

  /* Sidebar */
  --sb-bg:          var(--blue-900);
  --sb-border:      rgba(255,255,255,0.07);
  --sb-text:        rgba(255,255,255,0.62);
  --sb-text-active: #FFFFFF;
  --sb-hover-bg:    rgba(255,255,255,0.06);
  --sb-active-bg:   rgba(255,255,255,0.12);

  /* Layout */
  --sidebar-w: 240px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow:    0 4px 16px rgba(0,0,0,0.08);
}

html.dark {
  --bg:           #0D1117;
  --surface:      #161B22;
  --surface-2:    #1C2433;
  --border:       #21303F;
  --text:         #E6EDF3;
  --text-muted:   #7D8590;
  --accent:       var(--blue-500);
  --accent-hover: var(--blue-600);
  --sb-bg:        var(--blue-950);
  --sb-border:    rgba(255,255,255,0.05);
}

html { font-size: 14px; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ─── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sb-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-logo img { height: 24px; object-fit: contain; }
.sb-logo-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 2px 6px;
}

.sb-section { padding: 16px 12px 4px; }
.sb-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--sb-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.sb-item:hover { background: var(--sb-hover-bg); color: var(--sb-text-active); }
.sb-item.active { background: var(--sb-active-bg); color: var(--sb-text-active); }
.sb-item.danger:hover { background: rgba(220,38,38,0.15); color: #FCA5A5; }
.sb-item svg { flex-shrink: 0; opacity: 0.7; }
.sb-item.active svg, .sb-item:hover svg { opacity: 1; }

.sb-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.sb-spacer { flex: 1; }
.sb-bottom {
  padding: 12px;
  border-top: 1px solid var(--sb-border);
}

/* ─── Main content ─── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--surface-2); }

.user-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
}
.user-chip-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}

.page-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.card-title svg { color: var(--text-muted); }

/* ─── ADSC didactic panel ─── */
.adsc-help-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
}

.adsc-help-bar-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  flex: 1;
}

.adsc-help-panel {
  margin-bottom: 16px;
  padding: 0 4px;
}

.adsc-help-hero {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.adsc-help-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adsc-help-title {
  margin: 6px 0 8px;
  font-size: 18px;
  line-height: 1.2;
  color: var(--text);
}

.adsc-help-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 70ch;
}

.adsc-help-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.adsc-help-pill-list span {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
}

.adsc-help-panel details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.adsc-help-panel summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  list-style: none;
}

.adsc-help-panel summary::-webkit-details-marker {
  display: none;
}

.adsc-help-panel summary::before {
  content: "▸ ";
  color: var(--text-muted);
  margin-right: 4px;
}

.adsc-help-panel details[open] summary::before {
  content: "▾ ";
}

.adsc-help-panel details > :not(summary) {
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-muted);
}

.adsc-help-panel table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.adsc-help-panel th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.adsc-help-panel td {
  padding: 8px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.didactic-note {
  background: var(--blue-50);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12.5px;
  color: var(--text);
  margin-top: 10px;
}

html.dark .didactic-note {
  background: rgba(59, 130, 246, 0.07);
}

.phase-mapping {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0;
}

.phase-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.phase-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.phase-sub {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
}

.phase-sub:last-child {
  border-bottom: none;
}

.phase-driven {
  font-size: 11px;
  color: var(--accent);
}

.phase-driven code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.phase-desc {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
}

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

.adsc-lever-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
}

.adsc-lever-card h4 {
  margin: 10px 0 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.adsc-lever-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.adsc-lever-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.adsc-lever-top code {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--accent);
}

.adsc-lever-phase {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.adsc-pipeline-shell {
  margin: 14px 0 8px;
}

.adsc-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.adsc-lede {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 68ch;
  margin-bottom: 18px;
  line-height: 1.6;
}

.adsc-flow-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adsc-flow-meta .rail {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.adsc-pipeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  align-items: stretch;
  position: relative;
  column-gap: 28px;
}

.adsc-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 2;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.adsc-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.25);
  border-color: var(--accent);
}

.adsc-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.adsc-step-index {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.adsc-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--step-color, var(--accent));
  flex-shrink: 0;
}

.adsc-step-name {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.adsc-step-role {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

.adsc-policies {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adsc-policies li {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--blue-800);
  background: var(--blue-50);
  padding: 5px 9px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
  line-height: 1.3;
}

html.dark .adsc-policies li {
  color: var(--blue-100);
  background: rgba(59, 130, 246, 0.12);
}

.adsc-connector {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  z-index: 3;
  pointer-events: none;
}

.adsc-connector svg {
  width: 14px;
  height: 14px;
  display: block;
}

.adsc-connector.c1 { left: calc(25% - 14px); }
.adsc-connector.c2 { left: calc(50% - 14px); }
.adsc-connector.c3 { left: calc(75% - 14px); }

.adsc-legend {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}

.adsc-legend-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adsc-legend-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adsc-legend-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.adsc-legend-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.adsc-vt-shell {
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(27, 79, 216, 0.08), transparent 28%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  overflow: hidden;
}

.adsc-vt-shell-legacy {
  background: linear-gradient(180deg, #f8f5ff, #f1ecfb);
}

html.dark .adsc-vt-shell-legacy {
  background: linear-gradient(180deg, rgba(35, 30, 52, 0.94), rgba(24, 22, 36, 0.98));
}

.adsc-vt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.adsc-vt-header-simple {
  border-bottom: none;
  padding-bottom: 8px;
}

.adsc-vt-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adsc-vt-header h4 {
  margin: 6px 0 0;
  font-size: 20px;
  line-height: 1.1;
  color: var(--text);
}

.adsc-vt-badge {
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--blue-50);
  border: 1px solid rgba(27, 79, 216, 0.15);
  border-radius: 999px;
  padding: 5px 9px;
}

html.dark .adsc-vt-badge {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.18);
}

.adsc-vt-shell-legacy .adsc-vt-badge {
  color: #5b3db5;
  background: #ece6ff;
  border-color: rgba(91, 61, 181, 0.2);
}

.adsc-vt-body {
  padding: 18px;
}

.adsc-vt-body-stack {
  display: grid;
  gap: 28px;
}

.adsc-vt-section {
  display: grid;
  gap: 12px;
}

.adsc-vt-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adsc-vt-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  color: var(--text);
}

.adsc-vt-subtitle {
  margin: 0;
  max-width: 68ch;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

.adsc-vt-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 16px;
}

.adsc-vt-inline-note,
.adsc-vt-callout {
  background: var(--blue-50);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
}

html.dark .adsc-vt-inline-note,
html.dark .adsc-vt-callout {
  background: rgba(59, 130, 246, 0.08);
}

.adsc-vt-detail-title {
  margin: 4px 0 8px;
  font-size: 17px;
  color: var(--text);
}

.adsc-vt-detail-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

.adsc-vt-cycle-card {
  display: grid;
  gap: 12px;
}

.adsc-vt-cycle-visual {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
}

.adsc-vt-cycle-node {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.adsc-vt-cycle-node:hover,
.adsc-vt-cycle-node.active {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

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

.adsc-vt-lever-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.adsc-vt-lever-card:hover,
.adsc-vt-lever-card.open {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.adsc-vt-lever-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adsc-vt-phase {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--blue-50);
  color: var(--accent);
}

html.dark .adsc-vt-phase {
  background: rgba(59, 130, 246, 0.12);
}

.adsc-vt-lever-head code {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--accent);
}

.adsc-vt-lever-card h5 {
  margin: 12px 0 6px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}

.adsc-vt-lever-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
}

.adsc-vt-lever-body {
  display: none;
  margin-top: 12px;
}

.adsc-vt-lever-card.open .adsc-vt-lever-body {
  display: grid;
  gap: 10px;
}

.adsc-vt-lever-body pre,
.adsc-vt-journey-detail pre,
.adsc-vt-screen {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre-wrap;
}

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

.adsc-vt-roadmap-step {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 8px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.adsc-vt-roadmap-step.active,
.adsc-vt-roadmap-step.done {
  border-color: var(--accent);
}

.adsc-vt-roadmap-step.done {
  background: rgba(27, 79, 216, 0.04);
}

.adsc-vt-roadmap-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.adsc-vt-roadmap-step.active .adsc-vt-roadmap-circle,
.adsc-vt-roadmap-step.done .adsc-vt-roadmap-circle {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.adsc-vt-roadmap-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.adsc-vt-topology-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adsc-vt-topology-stage {
  background:
    radial-gradient(circle at top center, rgba(27, 79, 216, 0.05), transparent 38%),
    var(--surface-2);
}

.adsc-vt-progress {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.adsc-vt-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--blue-400));
  transition: width 0.22s ease;
}

.adsc-vt-walkthrough-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adsc-vt-counter {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.adsc-vt-screen .hl {
  background: rgba(27, 79, 216, 0.14);
  border: 1px dashed rgba(27, 79, 216, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
}

html.dark .adsc-vt-screen .hl {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.35);
}

.adsc-vt-canonical-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.adsc-vt-figure-card {
  display: grid;
  gap: 12px;
  background:
    radial-gradient(circle at 85% 8%, rgba(27, 79, 216, 0.08), transparent 20%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
}

.adsc-vt-figure-card-legacy {
  background: linear-gradient(180deg, #fbf9ff, #f3eefc);
}

html.dark .adsc-vt-figure-card-legacy {
  background: linear-gradient(180deg, rgba(42, 36, 63, 0.9), rgba(28, 24, 43, 0.96));
}

.adsc-vt-figure-stage {
  position: relative;
  width: 100%;
  min-height: 280px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0.06)),
    var(--surface);
}

.adsc-vt-figure-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.adsc-vt-svg-stage {
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.10)),
    var(--surface);
}

.adsc-vt-inline-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.adsc-vt-inline-svg .zone .zone-hit {
  transition: stroke 0.14s ease, fill 0.14s ease;
}

.adsc-vt-inline-svg .zone .zone-indicator {
  transition: opacity 0.14s ease;
}

.adsc-vt-inline-svg .zone:focus-visible .zone-hit {
  stroke-width: 22;
}

.adsc-vt-inline-svg .zone:focus-visible .zone-indicator {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(27, 79, 216, 0.28));
}

.adsc-vt-loading {
  min-height: 320px;
  width: 100%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
}

.adsc-vt-loading.error {
  color: var(--danger);
}

.adsc-vt-detail-card {
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 10px;
}

.adsc-vt-preview-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adsc-vt-topology-note,
.adsc-vt-walkthrough-card {
  display: grid;
  gap: 10px;
}

/* ─── Grid ─── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* ─── Form elements ─── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(from var(--accent) l c h / 0.12);
}
textarea {
  min-height: 90px; resize: vertical;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
}
input[type="password"] { letter-spacing: 0.1em; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  border-radius: var(--radius); padding: 8px 14px;
  cursor: pointer; border: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }
.btn-outline {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--blue-50); }
html.dark .btn-outline:hover { background: rgba(59,130,246,0.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-danger-ghost {
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ─── Status / Feedback ─── */
.status-msg {
  font-size: 12px; color: var(--text-muted);
  min-height: 18px; margin-top: 8px;
  display: flex; align-items: center; gap: 5px;
}
.status-msg.error { color: var(--danger); }
.status-msg.success { color: var(--success); }

.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: 20px; letter-spacing: 0.02em;
}
.badge-blue { background: var(--blue-50); color: var(--blue-700); }
.badge-green { background: #ECFDF5; color: #065F46; }
.badge-red { background: #FEF2F2; color: #991B1B; }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }
.badge-warm { background: #FFF7ED; color: #9A3412; }
html.dark .badge-blue { background: rgba(59,130,246,0.12); color: var(--blue-400); }
html.dark .badge-green { background: rgba(5,150,105,0.12); color: #34D399; }
html.dark .badge-red { background: rgba(220,38,38,0.12); color: #FCA5A5; }
html.dark .badge-warm { background: rgba(217,119,6,0.16); color: #FDBA74; }

/* ─── Tables ─── */
.table-wrap {
  overflow-x: auto; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); max-height: 320px;
}
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  text-align: left;
}
tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top; word-break: break-word; overflow-wrap: anywhere;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ─── KV Grid ─── */
.kv-grid { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; }
.kv-key { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; }
.kv-val { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; }

/* ─── Divider ─── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ─── Stat cards ─── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── Wizard steps ─── */
.wizard-steps {
  display: flex; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.step-item {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 0 12px 0 0;
}
.step-item:last-child { flex: 0; padding: 0; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
  border: 2px solid var(--border);
  transition: all 0.2s;
}
.step-info { flex: 1; min-width: 0; }
.step-name { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.step-desc { font-size: 11px; color: var(--text-muted); opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-connector { height: 2px; flex: 1; background: var(--border); border-radius: 1px; margin: 0 8px; }

.step-item.active .step-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.step-item.active .step-name { color: var(--text); }
.step-item.done .step-num { background: var(--success); color: #fff; border-color: var(--success); }
.step-item.done .step-name { color: var(--text-muted); }
.step-connector.done { background: var(--success); }
.step-connector.active { background: var(--accent); }

/* ─── Alert / info box ─── */
.alert {
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 13px; border: 1px solid;
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.alert-info { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-800); }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
html.dark .alert-info { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.2); color: var(--blue-400); }
html.dark .alert-warning { background: rgba(217,119,6,0.08); border-color: rgba(217,119,6,0.2); color: #FCD34D; }

/* ─── Context Studio AI / inference panels ─── */
.studio-ai-shell { margin-bottom: 20px; }
.studio-ai-note,
.inference-note {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
}

.studio-ai-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

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

.studio-mode-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.studio-mode-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.studio-mode-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(from var(--accent) l c h / 0.12);
}

.studio-mode-cap {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.studio-mode-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.studio-mode-copy {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.studio-mode-body {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 16px;
}

.studio-mode-body.active { display: block; }

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

.studio-panel-section,
.inference-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.studio-section-title,
.inference-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

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

.studio-transcript {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.studio-transcript.empty {
  font-size: 12.5px;
  color: var(--text-muted);
  display: block;
}

.studio-message {
  display: grid;
  gap: 4px;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.studio-message.user {
  background: var(--blue-50);
  margin-left: auto;
}

.studio-message.assistant {
  background: var(--surface-2);
  margin-right: auto;
}

html.dark .studio-message.user {
  background: rgba(59,130,246,0.12);
}

.studio-message-role {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.studio-message-text {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.studio-json-preview,
.studio-result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
  color: var(--text-muted);
  min-height: 84px;
  overflow: auto;
}

.switch-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.switch-row input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  flex-shrink: 0;
}

.switch-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.switch-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.switch-help {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

.inference-stack {
  display: grid;
  gap: 14px;
}

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

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

.studio-inline-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 900px) {
  .studio-mode-grid,
  .studio-panel-grid,
  .studio-provider-grid,
  .inference-grid,
  .inference-guardrails {
    grid-template-columns: 1fr;
  }

  .studio-message {
    max-width: 100%;
  }
}

/* ─── Contextual help ─── */
.help-tooltip {
  position: fixed;
  z-index: 2000;
  background: var(--gray-900);
  color: #f1f5f9;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 9px 13px;
  border-radius: var(--radius);
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  text-wrap: pretty;
}
html.dark .help-tooltip { background: #1e2d40; border: 1px solid #2d4060; }
.help-tooltip.visible { opacity: 1; }

.help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 9px; font-weight: 700; cursor: help;
  margin-left: 5px; flex-shrink: 0; vertical-align: middle;
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.help-icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Bottom help bar */
.help-bar {
  position: fixed; bottom: 0;
  left: var(--sidebar-w); right: 0;
  background: var(--blue-900);
  color: rgba(255,255,255,0.82);
  font-size: 12px; padding: 7px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: flex-start; gap: 8px;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
  line-height: 1.45;
}
.help-bar.visible { opacity: 1; }
.help-bar-icon { flex-shrink: 0; opacity: 0.6; margin-top: 1px; }
.help-bar-label {
  font-weight: 700; color: rgba(255,255,255,0.5);
  margin-right: 6px; white-space: nowrap; flex-shrink: 0;
}
.help-bar-text { flex: 1; }

/* Highlight focused field with data-help */
[data-help]:focus {
  border-color: var(--accent) !important;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Utilities ─── */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ─── Theme toggle icon ─── */
.icon-sun { display: none; }
.icon-moon { display: block; }
html.dark .icon-sun { display: block; }
html.dark .icon-moon { display: none; }

.diag-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 28, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.diag-modal {
  width: min(640px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.28);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.diag-modal h3 {
  margin: 0;
  font-size: 18px;
}

.diag-modal p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.diag-modal-summary {
  display: grid;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12px;
}

.diag-modal-summary strong {
  color: var(--text);
}

.diag-modal-danger {
  color: var(--danger-500);
  font-weight: 700;
}

.diag-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── ARIA Souverain UI refresh ─── */
:root,
html:not(.dark) {
  --orange: #e07a2f;
  --orange-hover: #c66a26;
  --orange-soft: rgba(224, 122, 47, 0.16);
  --green: #6b8f71;
  --gold: #c9a84c;
  --blue: #5b7fa5;
  --red: #c0504d;
  --bg: #d5cec0;
  --surface: #faf8f5;
  --surface-1: var(--surface);
  --surface-2: #f0ebe4;
  --border: #cec7b8;
  --text: #3a3632;
  --text-muted: #7a736b;
  --accent: var(--orange);
  --accent-hover: var(--orange-hover);
  --success: var(--green);
  --warning: var(--gold);
  --danger: var(--red);
  --danger-500: var(--danger);
  --info: var(--blue);
  --sb-bg: #29261b;
  --sb-text: rgba(246, 244, 239, 0.62);
  --sb-text-active: #f6f4ef;
  --sb-hover-bg: rgba(224, 122, 47, 0.1);
  --sb-active-bg: rgba(224, 122, 47, 0.16);
  --sb-label: rgba(246, 244, 239, 0.34);
}

html.dark {
  --orange: #f08a3c;
  --orange-hover: #ff9c50;
  --orange-soft: rgba(240, 138, 60, 0.18);
  --green: #86a889;
  --gold: #d7ba62;
  --blue: #7fa0c0;
  --red: #df6b68;
  --surface-1: var(--surface);
  --danger-500: var(--danger);
  --sb-bg: #191714;
  --sb-text: rgba(246, 244, 239, 0.58);
  --sb-text-active: #f6f4ef;
  --sb-hover-bg: rgba(240, 138, 60, 0.12);
  --sb-active-bg: rgba(240, 138, 60, 0.2);
  --sb-label: rgba(246, 244, 239, 0.36);
}

body {
  background-image:
    radial-gradient(circle at 18% 12%, rgba(224, 122, 47, 0.12), transparent 26rem),
    radial-gradient(circle at 92% 2%, rgba(107, 143, 113, 0.11), transparent 22rem);
  background-attachment: fixed;
}

.sb-section-label { color: var(--sb-label); }
.sb-item { position: relative; }
.sb-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
}

.health-ok { color: var(--success); }
.health-warn { color: var(--warning); }
.health-error { color: var(--danger); }
.health-unknown { color: var(--text-muted); }

.badge-live {
  background: var(--success);
  color: white;
  box-shadow: 0 0 0 0 rgba(107, 143, 113, 0.4);
  animation: diag-live-pulse 2.4s infinite;
}

@keyframes diag-live-pulse {
  70% { box-shadow: 0 0 0 9px rgba(107, 143, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 143, 113, 0); }
}

.page-content > section {
  animation: diag-fade-in-up 180ms ease-out both;
}

@keyframes diag-fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--orange-soft);
  border-color: var(--accent);
  color: var(--text);
}

.stat-spark {
  width: 100%;
  height: 32px;
  margin-top: 10px;
  display: block;
  overflow: visible;
}

.metrics-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
}

.segmented button.active {
  color: white;
  background: var(--accent);
}

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

.overview-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.placeholder-panel {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
}

.placeholder-panel strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 16px;
}

.muted-text {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.pilotage-header .muted-text {
  max-width: 760px;
}

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

.slo-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.slo-item span,
.slo-item small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.slo-item strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
  margin: 5px 0;
}

.slo-ok {
  border-color: rgba(107, 143, 113, 0.38);
  background: rgba(107, 143, 113, 0.08);
}

.slo-warn {
  border-color: rgba(191, 125, 58, 0.42);
  background: rgba(191, 125, 58, 0.1);
}

.slo-danger {
  border-color: rgba(169, 74, 74, 0.42);
  background: rgba(169, 74, 74, 0.1);
}

.topology-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: stretch;
}

.topology-canvas {
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 20% 20%, rgba(191, 125, 58, 0.12), transparent 28%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
  overflow: auto;
  padding: 12px;
}

.topology-canvas svg {
  display: block;
  width: 100%;
  min-width: 680px;
  height: 100%;
  min-height: 300px;
}

.topology-edge {
  fill: none;
  stroke: rgba(112, 91, 72, 0.36);
  stroke-width: 2.4;
}

.topology-node rect {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1.4;
  filter: drop-shadow(0 10px 18px rgba(49, 39, 31, 0.12));
}

.topology-node-root rect {
  fill: rgba(191, 125, 58, 0.13);
  stroke: var(--accent);
}

.topology-node text {
  fill: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.topology-node .topology-node-sub {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.topology-side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.topology-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
}

.topology-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topology-legend span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.timeline-list,
.notification-list {
  display: grid;
  gap: 12px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.timeline-dot {
  width: 11px;
  height: 11px;
  margin-top: 3px;
  border-radius: 999px;
  background: var(--text-muted);
  box-shadow: 0 0 0 5px rgba(112, 91, 72, 0.08);
}

.timeline-ok .timeline-dot { background: var(--success); }
.timeline-warn .timeline-dot { background: var(--warning); }
.timeline-danger .timeline-dot { background: var(--danger); }

.timeline-title {
  font-weight: 800;
  color: var(--text);
}

.timeline-meta,
.timeline-error {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.timeline-error {
  color: var(--danger);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.notification-item strong,
.notification-item span {
  display: block;
}

.notification-item strong {
  color: var(--text);
  margin-bottom: 4px;
}

.notification-item span,
.notification-item em {
  color: var(--text-muted);
  font-size: 12px;
}

.notification-ok { border-color: rgba(107, 143, 113, 0.38); }
.notification-warn { border-color: rgba(191, 125, 58, 0.46); }
.notification-danger { border-color: rgba(169, 74, 74, 0.48); }

.tour-launch {
  border-color: rgba(191, 125, 58, 0.28);
  color: var(--accent);
}

.import-wizard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 4px;
}

.import-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.import-step span {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 12px;
  background: var(--surface-2);
}

.import-step strong {
  color: var(--text);
  font-size: 13px;
}

.import-step small {
  color: var(--text-muted);
  font-size: 11px;
}

.import-step.active {
  border-color: rgba(191, 125, 58, 0.5);
  background: linear-gradient(135deg, var(--orange-soft), var(--surface));
  color: var(--text);
  transform: translateY(-1px);
}

.import-step.completed {
  border-color: rgba(107, 143, 113, 0.45);
  background: rgba(107, 143, 113, 0.1);
}

.import-step.completed span {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

.import-step.error {
  border-color: rgba(169, 74, 74, 0.5);
  background: rgba(169, 74, 74, 0.08);
}

.import-step.error span {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.anomaly-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.anomaly-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.anomaly-cell strong {
  font-size: 12px;
  color: var(--text);
}

.anomaly-cell span {
  color: var(--text-muted);
  font-size: 12px;
}

.anomaly-cell small {
  color: var(--text-faint);
  font-size: 11px;
}

.anomaly-ok {
  border-color: rgba(107, 143, 113, 0.42);
  background: rgba(107, 143, 113, 0.1);
}

.anomaly-info {
  border-color: rgba(95, 124, 149, 0.38);
  background: rgba(95, 124, 149, 0.08);
}

.anomaly-warn {
  border-color: rgba(191, 125, 58, 0.5);
  background: rgba(191, 125, 58, 0.1);
}

.anomaly-danger {
  border-color: rgba(169, 74, 74, 0.55);
  background: rgba(169, 74, 74, 0.1);
}

.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(20, 16, 13, 0.45);
  pointer-events: none;
}

.tour-card {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 16px;
  border: 1px solid rgba(191, 125, 58, 0.35);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(20, 16, 13, 0.28);
}

.tour-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.tour-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

.tour-actions .tour-count {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 12px;
}

.tour-target {
  position: relative;
  z-index: 9999;
  outline: 3px solid rgba(191, 125, 58, 0.55);
  outline-offset: 4px;
  border-radius: 16px;
}

/* ─── Responsive ─── */
@media (max-width: 800px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-left .health,
  .badge-live { display: none; }
  .overview-grid { grid-template-columns: 1fr; }
  .slo-grid,
  .topology-layout {
    grid-template-columns: 1fr;
  }
  .topology-canvas svg {
    min-width: 620px;
  }
  .grid-2, .grid-auto { grid-template-columns: 1fr; }
  .diag-modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .phase-mapping { grid-template-columns: 1fr; }
  .adsc-lever-grid { grid-template-columns: 1fr; }
  .adsc-pipeline {
    grid-template-columns: 1fr;
    row-gap: 14px;
  }
  .adsc-connector {
    position: static;
    transform: none;
    margin: -4px auto;
    rotate: 90deg;
  }
  .adsc-flow-meta {
    flex-wrap: wrap;
    gap: 10px;
  }
  .adsc-flow-meta .rail {
    display: none;
  }
  .adsc-legend {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .adsc-vt-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .adsc-vt-canonical-layout {
    grid-template-columns: 1fr;
  }
  .adsc-vt-figure-stage {
    min-height: 220px;
  }
  .adsc-vt-lever-grid,
  .adsc-vt-roadmap {
    grid-template-columns: 1fr;
  }
  .adsc-vt-walkthrough-nav {
    flex-wrap: wrap;
  }
  .adsc-vt-counter {
    width: 100%;
    text-align: center;
    order: 3;
  }
  .import-wizard {
    grid-template-columns: 1fr;
  }
  .tour-card {
    right: 16px !important;
    bottom: 16px !important;
    left: 16px !important;
    top: auto !important;
    max-width: none;
  }
}
