/* ═══════════════════════════════════════════════
   Copilot Data Flow Map — Zen Design System
   ═══════════════════════════════════════════════ */

.cdf-page {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-16);
}

/* ── Tabs ── */
.cdf-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
}
.cdf-tabs::-webkit-scrollbar { display: none; }
.cdf-tab {
  padding: var(--space-3) var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 150ms ease-out, border-color 150ms ease-out;
}
.cdf-tab:hover { color: var(--text-primary); }
.cdf-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.cdf-panel { min-height: 300px; }
.cdf-section-intro {
  color: var(--text-secondary);
  font-size: var(--text-body);
  margin-bottom: var(--space-4);
  max-width: var(--max-reading);
}
.cdf-section-heading {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--space-12) 0 var(--space-2);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

/* ═══ DATA FLOW TAB ═══ */

/* Scenario picker */
.cdf-scenario-picker {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.cdf-scenario-btn {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: border-color 200ms ease-out, background-color 200ms ease-out, transform 200ms ease-out;
}
.cdf-scenario-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.cdf-scenario-btn.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}
.cdf-scenario-btn svg { color: var(--text-muted); }
.cdf-scenario-btn.active svg { color: var(--accent); }

/* Boundary legend */
.cdf-boundary-legend {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-4);
  font-size: var(--text-caption);
  color: var(--text-tertiary);
}
.cdf-bl-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.cdf-bl-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
}
.cdf-b-microsoft { background: var(--accent); }
.cdf-b-external { background: var(--warning); }
.cdf-b-sub-processor { background: var(--error); }

/* Flow container */
.cdf-flow-container {
  min-height: 120px;
}
.cdf-flow-empty {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-12) 0;
  font-size: var(--text-sm);
}

/* Flow pipeline */
.cdf-flow-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: var(--space-4) 0;
}
.cdf-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  max-width: 160px;
  flex: 1;
  position: relative;
  cursor: pointer;
  transition: transform 200ms ease-out;
}
.cdf-flow-step:hover { transform: translateY(-2px); }

/* Step node */
.cdf-flow-node {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  background: var(--bg-surface);
  position: relative;
  z-index: 1;
  color: var(--text-secondary);
  transition: border-color 200ms ease-out, background-color 200ms ease-out, box-shadow 200ms ease-out;
}
.cdf-flow-node svg {
  width: 28px;
  height: 28px;
}
.cdf-flow-step.active .cdf-flow-node {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 4px 16px var(--accent-subtle);
}
.cdf-flow-step.cdf-step-animated .cdf-flow-node {
  animation: cdf-pulse 600ms ease-out;
}
@keyframes cdf-pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Boundary colouring */
.cdf-flow-node.cdf-b-microsoft { border-color: var(--accent); }
.cdf-flow-node.cdf-b-external { border-color: var(--warning); }
.cdf-flow-node.cdf-b-sub-processor { border-color: var(--error); }
.cdf-flow-node.cdf-b-your-device { border-color: var(--text-muted); }

/* Step label */
.cdf-flow-label {
  margin-top: var(--space-2);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.3;
}

/* Step boundary tag */
.cdf-flow-boundary {
  margin-top: var(--space-1);
  font-size: var(--text-caption);
  font-weight: 500;
  padding: 2px var(--space-1);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cdf-flow-boundary.cdf-b-microsoft { background: var(--accent-subtle); color: var(--accent); }
.cdf-flow-boundary.cdf-b-external { background: var(--bg-elevated); color: var(--warning); }
.cdf-flow-boundary.cdf-b-sub-processor { background: var(--bg-elevated); color: var(--error); }
.cdf-flow-boundary.cdf-b-your-device { background: var(--bg-elevated); color: var(--text-muted); }

/* Arrow between steps — with lock icon */
.cdf-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  color: var(--text-muted);
  font-size: var(--text-caption);
  flex-shrink: 0;
  transition: color 200ms ease-out;
  gap: 2px;
}
.cdf-arrow-text {
  font-size: var(--text-lg);
  color: var(--border-emphasis);
}
.cdf-flow-arrow.cdf-arrow-animated {
  animation: cdf-arrow-pulse 400ms ease-out;
}

/* Boundary zone bar — coloured segments */
.cdf-zone-bar {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-4);
  height: 28px;
  border: 1px solid var(--border);
}
.cdf-zone-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0 var(--space-2);
  white-space: nowrap;
}
.cdf-zs-microsoft, .cdf-zs-your-device { background: var(--accent-subtle); color: var(--accent); }
.cdf-zs-external { background: var(--bg-elevated); color: var(--warning); }
.cdf-zs-sub-processor { background: var(--bg-elevated); color: var(--error); }

/* Narrative — copy-pasteable security summary */
.cdf-narrative {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.cdf-narrative-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.cdf-narrative-copy {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 2px var(--space-2);
  cursor: pointer;
  transition: background-color 150ms ease-out;
}
.cdf-narrative-copy:hover { background: var(--accent-subtle); }
.cdf-narrative p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* What's NOT sent */
.cdf-not-sent {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.cdf-not-sent-header {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.cdf-not-sent ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.cdf-not-sent li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-left: var(--space-4);
  position: relative;
}
.cdf-not-sent li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 600;
}
@keyframes cdf-arrow-pulse {
  0% { opacity: 0; transform: translateX(-8px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Step detail panel */
.cdf-step-detail {
  margin-top: var(--space-6);
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.cdf-step-detail-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}
.cdf-step-detail-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}
.cdf-step-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.cdf-step-detail-item {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}
.cdf-step-detail-item h4 {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 var(--space-1);
}
.cdf-step-detail-item p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ═══ COMPARE TAB ═══ */
.cdf-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.cdf-compare-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.cdf-compare-header {
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cdf-compare-header h3 {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.cdf-compare-openai { background: var(--accent-subtle); }
.cdf-compare-anthropic { background: var(--bg-elevated); }
.cdf-compare-badge {
  font-size: var(--text-caption);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
}
.cdf-badge-sub {
  background: var(--bg-elevated);
  color: var(--warning);
}
.cdf-compare-body {
  padding: var(--space-4) var(--space-6);
}
.cdf-compare-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  gap: var(--space-4);
}
.cdf-compare-row:last-child { border-bottom: none; }
.cdf-compare-row strong {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.cdf-compare-row span {
  color: var(--text-primary);
  text-align: right;
}
.cdf-compare-callout {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.cdf-compare-callout strong { color: var(--text-primary); }

/* ═══ CONTROLS TAB ═══ */
.cdf-controls-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cdf-control-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.cdf-control-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.cdf-control-header h3 {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.cdf-control-cat {
  font-size: var(--text-caption);
  font-weight: 500;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cdf-control-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-3);
}
.cdf-control-action {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}
.cdf-control-action strong { color: var(--text-primary); }
.cdf-control-impact {
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-elevated);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.cdf-control-link {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-top: var(--space-2);
  display: inline-block;
}
.cdf-control-link:hover { text-decoration: underline; }

/* ═══ COMPLIANCE TAB ═══ */
.cdf-cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.cdf-cert-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.cdf-cert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}
.cdf-cert-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.cdf-cert-status {
  font-size: var(--text-caption);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.cdf-cert-status-certified {
  background: var(--bg-elevated);
  color: var(--success);
}
.cdf-cert-status-compliant {
  background: var(--bg-elevated);
  color: var(--accent);
}
.cdf-cert-status-partial {
  background: var(--bg-elevated);
  color: var(--warning);
}
.cdf-cert-desc {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}
.cdf-cert-scope {
  font-size: var(--text-caption);
  color: var(--text-secondary);
}
.cdf-cert-notes {
  font-size: var(--text-caption);
  color: var(--warning);
  font-style: italic;
  margin-top: var(--space-1);
}

/* ═══ FAQ ═══ */
.cdf-faq-list {
  max-width: var(--max-reading);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cdf-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.cdf-faq-q {
  padding: var(--space-4) var(--space-6);
  font-weight: 600;
  font-size: var(--text-body);
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
.cdf-faq-q::-webkit-details-marker { display: none; }
.cdf-faq-q::after { content: "+"; font-size: var(--text-lg); color: var(--text-muted); }
.cdf-faq-item[open] .cdf-faq-q::after { content: "−"; }
.cdf-faq-a {
  padding: 0 var(--space-6) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}
.cdf-faq-a p { margin: 0; }

/* ═══ RISK BADGES (on scenarios) ═══ */
.cdf-risk-badge {
  font-size: var(--text-caption);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cdf-risk-low { background: var(--bg-elevated); color: var(--success); }
.cdf-risk-medium { background: var(--bg-elevated); color: var(--warning); }
.cdf-risk-high { background: var(--bg-elevated); color: var(--error); }

/* ═══ ANIMATED DATA PACKET ═══ */
@keyframes cdf-packet {
  0% { left: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
.cdf-flow-pipeline { position: relative; }
.cdf-packet {
  position: absolute;
  top: 28px;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--accent);
  animation: cdf-packet 3s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

/* ═══ WHAT CAN COPILOT SEE? ═══ */
.cdf-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.cdf-access-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.cdf-access-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.cdf-access-icon { font-size: var(--text-lg); }
.cdf-access-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.cdf-access-risk {
  margin-left: auto;
}
.cdf-access-desc {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}
.cdf-access-restrict {
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.5;
}
.cdf-access-restrict strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

/* ═══ DATA RESIDENCY ═══ */
.cdf-residency-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.cdf-residency-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}
.cdf-residency-select {
  max-width: 280px;
}
.cdf-residency-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
.cdf-residency-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.cdf-residency-card h3 {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
}
.cdf-residency-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  gap: var(--space-3);
}
.cdf-residency-row:last-child { border-bottom: none; }
.cdf-residency-row strong { color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
.cdf-residency-row span { color: var(--text-primary); text-align: right; }
.cdf-residency-note {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-left: 3px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

/* ═══ READINESS CHECKLIST ═══ */
.cdf-checklist-score {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.cdf-score-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.cdf-score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 200ms ease-out, background-color 200ms ease-out;
}
.cdf-score-fill.score-high { background: var(--success); }
.cdf-score-fill.score-medium { background: var(--warning); }
.cdf-score-fill.score-low { background: var(--error); }
.cdf-score-text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.cdf-checklist-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  max-width: var(--max-reading);
}
.cdf-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 150ms ease-out;
}
.cdf-checklist-item:hover { border-color: var(--border-emphasis); }
.cdf-checklist-item.checked { border-color: var(--success); }
.cdf-check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-emphasis);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
  margin-top: 2px;
}
.cdf-checklist-item.checked .cdf-check-box {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.cdf-check-content { flex: 1; }
.cdf-check-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.cdf-check-desc {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  line-height: 1.4;
}
.cdf-check-priority {
  font-size: var(--text-caption);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.cdf-priority-critical { background: var(--bg-elevated); color: var(--error); }
.cdf-priority-important { background: var(--bg-elevated); color: var(--warning); }
.cdf-checklist-actions {
  display: flex;
  gap: var(--space-3);
}

/* ═══ COMPARE SCENARIOS ═══ */
.cdf-compare-picker {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.cdf-compare-pick {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 200px;
}
.cdf-compare-pick label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
}
.cdf-compare-pick select {
  max-width: 300px;
}
.cdf-compare-vs {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-muted);
  padding-top: var(--space-4);
}
.cdf-compare-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}
.cdf-scn-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.cdf-scn-card h3 {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.cdf-scn-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.cdf-scn-row:last-child { border-bottom: none; }
.cdf-scn-row strong { color: var(--text-secondary); font-weight: 500; }
.cdf-scn-row span { color: var(--text-primary); text-align: right; }
.cdf-scn-narrative {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ DOCS HUB ═══ */
.cdf-docs-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.cdf-docs-category {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.cdf-docs-cat-header {
  padding: var(--space-3) var(--space-6);
  background: var(--bg-elevated);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.cdf-docs-links {
  padding: var(--space-2) 0;
}
.cdf-docs-link {
  display: block;
  padding: var(--space-3) var(--space-6);
  text-decoration: none;
  transition: background-color 150ms ease-out;
}
.cdf-docs-link:hover { background: var(--accent-subtle); }
.cdf-docs-link-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
}
.cdf-docs-link-desc {
  font-size: var(--text-caption);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ═══ PRINT BUTTON ═══ */
.cdf-print-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
}
.cdf-print-btn:hover { border-color: var(--border-emphasis); color: var(--text-primary); }

/* ═══ PRINT STYLESHEET ═══ */
@media print {
  .cdf-tabs, .cdf-print-btn, .cdf-freshness,
  .cdf-packet, .cdf-scenario-picker, .cdf-narrative-copy,
  .cdf-checklist-actions, .cdf-compare-picker { display: none !important; }
  .cdf-panel { display: block !important; page-break-inside: avoid; margin-bottom: 24px; }
  .cdf-panel::before {
    content: attr(aria-labelledby);
    display: block;
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-3);
    border-bottom: 2px solid currentColor;
    padding-bottom: var(--space-1);
  }
  .cdf-page { max-width: 100%; padding: 0; }
  * { color: #000 !important; background: #fff !important; border-color: #ccc !important; }
}

/* Freshness */
.cdf-freshness {
  margin-top: var(--space-8);
  padding: var(--space-4);
  text-align: center;
  border-top: 1px solid var(--border);
}
.cdf-freshness p { font-size: var(--text-caption); color: var(--text-muted); margin: 0; }
.cdf-freshness a { color: var(--accent); text-decoration: none; }
.cdf-freshness a:hover { text-decoration: underline; }

/* ── TL;DR Key Facts ── */
.cdf-arch-tldr {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.cdf-arch-tldr-title {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
}
.cdf-arch-tldr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}
.cdf-arch-fact {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.cdf-arch-fact-icon {
  flex-shrink: 0;
  font-size: var(--text-body);
  margin-top: 1px;
}
.cdf-arch-fact em {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Visual Stack Overview ── */
.cdf-arch-overview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.cdf-arch-overview::-webkit-scrollbar { display: none; }
.cdf-arch-ov-layer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms ease-out, background-color 150ms ease-out, transform 150ms ease-out;
}
.cdf-arch-ov-layer:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.cdf-arch-ov-layer.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.cdf-arch-ov-crosscut {
  border-style: dashed;
}
.cdf-arch-ov-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
}
.cdf-arch-ov-layer.active .cdf-arch-ov-num {
  background: var(--accent);
  color: white;
}
.cdf-arch-ov-name {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-secondary);
}
.cdf-arch-ov-layer.active .cdf-arch-ov-name {
  color: var(--accent);
}
.cdf-arch-ov-arrow {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 0 var(--space-1);
  flex-shrink: 0;
}

/* ── Prompt Evolution Strip ── */
.cdf-arch-prompt-evo {
  margin-bottom: var(--space-6);
}
.cdf-arch-evo-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}
.cdf-arch-evo-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 36px;
}
.cdf-arch-evo-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  text-align: center;
  line-height: 1.3;
  position: relative;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.cdf-arch-evo-step:last-child { border-right: none; }
.cdf-arch-evo-step.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}
.cdf-arch-evo-step.passed {
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}

/* ── Cross-cutting layer treatment ── */
.cdf-arch-layer[data-layer="responsible-ai"] {
  border-style: dashed;
  position: relative;
}
.cdf-arch-layer[data-layer="responsible-ai"]::before {
  content: 'Applies across all layers';
  position: absolute;
  top: -10px;
  right: var(--space-4);
  font-size: 10px;
  font-weight: 600;
  color: var(--warning);
  background: var(--bg-page);
  padding: 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Admin takeaway emphasis ── */
.cdf-arch-detail-card.cdf-arch-admin-card {
  border-left: 3px solid var(--accent);
  background: var(--accent-subtle);
}
.cdf-arch-detail-card.cdf-arch-admin-card h4 {
  color: var(--accent);
}

/* ═══ ARCHITECTURE TAB ═══ */

.cdf-arch-seo-summary {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* Prompt journey indicator */
.cdf-arch-prompt-journey {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.cdf-arch-prompt-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Layer stack */
.cdf-arch-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Individual layer */
.cdf-arch-layer {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}
.cdf-arch-layer:hover {
  border-color: var(--border-emphasis);
}
.cdf-arch-layer.active {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-subtle);
}

/* Layer header (clickable) */
.cdf-arch-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms ease-out;
}
.cdf-arch-header:hover {
  background: var(--bg-elevated);
}

.cdf-arch-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: border-color 200ms ease-out, color 200ms ease-out, background-color 200ms ease-out;
}
.cdf-arch-layer.active .cdf-arch-number {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.cdf-arch-titles {
  flex: 1;
  min-width: 0;
}
.cdf-arch-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.cdf-arch-subtitle {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: 2px;
}

.cdf-arch-type-badge {
  font-size: var(--text-caption);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.cdf-arch-type-core {
  background: var(--accent-subtle);
  color: var(--accent);
}
.cdf-arch-type-cross-cutting {
  background: var(--bg-elevated);
  color: var(--warning);
}

.cdf-arch-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 200ms ease-out;
}
.cdf-arch-layer.active .cdf-arch-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Prompt stage pill (in header) */
.cdf-arch-prompt-pill {
  font-size: var(--text-caption);
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  display: none;
}
.cdf-arch-layer.active .cdf-arch-prompt-pill {
  display: none;
}
@media (min-width: 769px) {
  .cdf-arch-prompt-pill { display: block; }
  .cdf-arch-layer.active .cdf-arch-prompt-pill { display: none; }
}

/* Layer body (expanded content) */
.cdf-arch-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 200ms ease-out;
}
.cdf-arch-layer.active .cdf-arch-body {
  max-height: 2000px;
  transition: max-height 400ms ease-out;
}

.cdf-arch-content {
  padding: 0 var(--space-6) var(--space-6);
  border-top: 1px solid var(--border);
}

/* Description */
.cdf-arch-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: var(--space-4) 0;
  max-width: var(--max-reading);
}

/* Detail grid (inputs, outputs, security, admin) */
.cdf-arch-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.cdf-arch-detail-card {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.cdf-arch-detail-card h4 {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0 0 var(--space-1);
}
.cdf-arch-detail-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Prompt transformation */
.cdf-arch-prompt-stage {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: var(--space-4) 0;
  font-family: var(--font-mono, monospace);
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.5;
}
.cdf-arch-prompt-stage strong {
  color: var(--accent);
  font-family: var(--font-sans, sans-serif);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

/* Sub-components */
.cdf-arch-subs-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--space-6) 0 var(--space-2);
}
.cdf-arch-subs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.cdf-arch-sub {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.cdf-arch-sub-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.cdf-arch-sub-detail {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 2px;
}

/* Deep dive callout */
.cdf-arch-deep-dive {
  margin: var(--space-6) 0 0;
  padding: var(--space-4) var(--space-6);
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
}
.cdf-arch-deep-dive-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-2);
}
.cdf-arch-deep-dive p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 var(--space-2);
}
.cdf-arch-deep-dive p:last-child { margin-bottom: 0; }
.cdf-arch-deep-dive em {
  display: block;
  margin-top: var(--space-2);
  font-style: italic;
  color: var(--text-muted);
}

/* Source links */
.cdf-arch-sources {
  margin-top: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.cdf-arch-source {
  font-size: var(--text-caption);
  color: var(--accent);
  text-decoration: none;
  padding: 2px var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 150ms ease-out;
}
.cdf-arch-source:hover {
  border-color: var(--accent);
}

/* Arrow between layers */
.cdf-arch-arrow {
  display: flex;
  justify-content: center;
  padding: var(--space-1) 0;
  color: var(--text-muted);
}
.cdf-arch-arrow svg {
  width: 20px;
  height: 20px;
}

/* Copy button area */
.cdf-arch-actions {
  margin-top: var(--space-6);
  display: flex;
  gap: var(--space-3);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .cdf-page { padding: var(--space-4) var(--space-4) var(--space-12); }
  /* Scenario picker: smaller buttons, tighter gap */
  .cdf-scenario-picker { gap: var(--space-2); }
  .cdf-scenario-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    flex: 1 1 calc(50% - var(--space-2));
    min-width: 0;
    justify-content: center;
  }
  .cdf-scenario-btn svg { width: 14px; height: 14px; }
  /* Hide noise on mobile */
  .cdf-section-intro { display: none; }
  .cdf-boundary-legend { display: none; }
  .cdf-compare-callout { font-size: var(--text-sm); padding: var(--space-3); }
  /* Grids: single column */
  .cdf-compare-grid { grid-template-columns: 1fr; }
  .cdf-step-detail-grid { grid-template-columns: 1fr; }
  .cdf-cert-grid { grid-template-columns: 1fr; }
  .cdf-access-grid { grid-template-columns: 1fr; }
  .cdf-residency-result { grid-template-columns: 1fr; }
  .cdf-arch-detail-grid { grid-template-columns: 1fr; }
  .cdf-arch-tldr-grid { grid-template-columns: 1fr; }
  /* Flow pipeline: horizontal scroll */
  .cdf-flow-pipeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-2);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .cdf-flow-step { min-width: 80px; }
  .cdf-flow-node { width: 48px; height: 48px; }
  .cdf-flow-icon svg { width: 20px; height: 20px; }
  .cdf-flow-label { font-size: 0.65rem; }
  .cdf-flow-boundary { font-size: 0.55rem; }
  /* Architecture tab */
  .cdf-arch-header { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .cdf-arch-content { padding: 0 var(--space-4) var(--space-4); }
  .cdf-arch-number { width: 30px; height: 30px; font-size: var(--text-caption); }
  /* Overview mini-map: wrap layers, hide arrows */
  .cdf-arch-overview { flex-wrap: wrap; gap: var(--space-1); justify-content: center; }
  .cdf-arch-ov-arrow { display: none; }
  .cdf-arch-ov-item { font-size: 0.6rem; padding: 3px 6px; }
  /* TL;DR and evolution strip */
  .cdf-arch-tldr { padding: var(--space-3) var(--space-4); }
  .cdf-arch-evo-step { font-size: 9px; padding: var(--space-1); }
  /* Checklist */
  .cdf-checklist-items { font-size: var(--text-sm); }
  /* Controls grid */
  .cdf-controls-grid { grid-template-columns: 1fr; }
  /* Residency picker */
  .cdf-residency-select { max-width: 100%; width: 100%; }
  .cdf-residency-picker { flex-direction: column; }
  /* Residency cards */
  .cdf-residency-card { padding: var(--space-4); }
  /* Compare cards */
  .cdf-compare-card { margin-bottom: var(--space-4); }
  .cdf-compare-callout { font-size: var(--text-sm); padding: var(--space-3); }
  /* Docs grid */
  .cdf-docs-grid { grid-template-columns: 1fr; }
  /* Section heading and intro: tighter */
  .cdf-section-heading { font-size: var(--text-body); margin: var(--space-8) 0 var(--space-2); }
  .cdf-section-intro { font-size: var(--text-sm); }
  /* Access grid items */
  .cdf-access-card { padding: var(--space-3); }
  /* Print button area */
  .cdf-freshness { font-size: 0.65rem; }
}
