/* ============================================================
   ChangeOS Design System — styles.css
   Based on Reinvention Navigator Style Guide
   ============================================================ */

/* --- Self-hosted Inter font (eliminates third-party CDN dependency) --- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1D7F, U+1D80-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Design Tokens --- */
:root {
  /* Brand Colors */
  --primary-blue: #007bff;
  --deep-purple: #6f42c1;
  --light-purple: #a78bfa;
  --cyan-teal: #00bcd4;
  --danger-red: #dc3545;
  --warning-orange: #ffc107;
  --success-green: #28a745;

  /* Neutrals */
  --charcoal: #2d3748;
  --dark-gray: #343a40;
  --medium-gray: #6c757d;
  --light-gray: #f7f8fa;
  --white: #ffffff;
  --fafafa: #fafafa;
  --border-subtle: #e5e7eb;

  /* Semantic */
  --trend-up: #6ee7b7;
  --trend-down: #fca5a5;

  /* Typography */
  --font-family:
    "Inter", "Graphik Medium", "Graphik", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Border Radius */
  --radius-card: 12px;
  --radius-modal: 16px;
  --radius-button: 24px;
  --radius-input: 6px;
  --radius-filter: 8px;
  --radius-table: 8px;
  --radius-pill: 12px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover:
    0 3px 8px rgba(0, 0, 0, 0.09), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-button-hover: 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-tooltip: 0 2px 8px rgba(0, 0, 0, 0.12);

  /* Spacing (8px grid) */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* --- Apple-Inspired Enhancements --- */

  /* Easing */
  --ease-apple: cubic-bezier(0.4, 0, 0.2, 1);

  /* Glass Effects */
  --glass-white: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.45);
  --blur-nav: blur(24px);
  --blur-modal: blur(12px);

  /* Enhanced Shadows */
  --shadow-card-apple:
    0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover-apple:
    0 4px 10px rgba(0, 0, 0, 0.09), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-button-glow: 0 2px 8px rgba(45, 55, 72, 0.18);

  /* Agent Gradient Pairs */
  --gradient-atlas: linear-gradient(135deg, #9b73f7, #7c78ee);
  --gradient-echo: linear-gradient(135deg, #60a5fa, #38bdf8);
  --gradient-writer: linear-gradient(135deg, #34d399, #14b8a6);
  --gradient-sage: linear-gradient(135deg, #f87171, #fb7185);
  --gradient-beacon: linear-gradient(135deg, #2dd4bf, #22d3ee);
  --gradient-connect: linear-gradient(135deg, #c084fc, #f472b6);
  --gradient-reviewer: linear-gradient(135deg, #F59E0B, #D97706);

  /* Enhanced Radius */
  --radius-card-apple: 16px;

  /* Progress Gradient */
  --gradient-progress: linear-gradient(90deg, #8b5cf6, #c4b5fd);
}

/* --- Animated border angle property --- */
@property --border-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes card-border-spin {
  to {
    --border-angle: 360deg;
  }
}

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

/* --- Global --- */
html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  background: var(--white);
  color: var(--dark-gray);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle animated gradient orbs behind page */
body::before {
  content: "";
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(
      circle at 15% 50%,
      rgba(111, 66, 193, 0.04) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 85% 20%,
      rgba(0, 123, 255, 0.03) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(0, 188, 212, 0.03) 0%,
      transparent 50%
    );
  animation: ambientShift 30s ease infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes ambientShift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(3%, 2%);
  }
  66% {
    transform: translate(-2%, 3%);
  }
}

/* --- App Shell --- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.top-nav {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Primary nav tier */
.nav-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-accenture-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0;
  text-transform: none;
}

.nav-brand-tagline {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  font-style: italic;
}

/* Right-side nav group: links + avatar */
.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-filter);
  transition:
    color 0.2s var(--ease-apple),
    background 0.2s var(--ease-apple);
  border-bottom: 2px solid transparent;
  position: relative;
}

.nav-link:hover {
  color: #111827;
  background: #f3f4f6;
}

.nav-link.active {
  color: #111827;
  font-weight: 600;
  background: #f3f4f6;
  border-bottom-color: #6f42c1;
}

.nav-link-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
  opacity: 0.6;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}

.dashboard-header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 10px;
}

.page-project-label {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.page-project-label strong {
  color: #111827;
  font-weight: 600;
}

.connection-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.connection-indicator #connectionText {
  display: inline;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--medium-gray);
}

.connection-dot.connected {
  background: var(--success-green);
}

.connection-dot.disconnected {
  background: var(--danger-red);
}

/* JS-rendered connection status (overwrites innerHTML) */
.connection-status-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.connection-status-text {
  display: inline;
  color: #6b7280;
}

.connection-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--medium-gray);
  flex-shrink: 0;
}

.connection-status-dot.connected {
  background: var(--success-green);
}

.connection-status-dot.disconnected {
  background: var(--danger-red);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.page-content {
  display: none;
}

.page-content.active {
  display: block;
  animation: pageEnter 0.35s var(--ease-apple) forwards;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container {
  padding: var(--spacing-xl) 40px var(--spacing-2xl);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
/* Inline page header (title + subtitle on one line) */
.page-header-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.page-header-inline .page-title {
  margin-bottom: 0;
  font-size: 24px;
}

.page-header-inline .page-subtitle {
  margin-bottom: 0;
}

.page-header-separator {
  color: var(--border-subtle);
  font-size: 18px;
  font-weight: 300;
}

.page-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--dark-gray);
  line-height: 1.15;
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 15px;
  font-weight: 400;
  color: var(--medium-gray);
  margin-bottom: var(--spacing-xl);
}

.section-heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.2px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-card-apple);
  box-shadow: var(--shadow-card-apple);
  padding: var(--spacing-lg);
  transition:
    box-shadow 0.35s var(--ease-apple),
    transform 0.35s var(--ease-apple);
}

.card:hover {
  box-shadow: var(--shadow-card-hover-apple);
  transform: translateY(-2px);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--charcoal);
  color: var(--white);
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition:
    width 0.5s var(--ease-apple),
    height 0.5s var(--ease-apple);
}

.btn-primary:hover::after {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  background: #1a202c;
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--charcoal);
  border: 1px solid var(--charcoal);
}

.btn-secondary:hover {
  background: var(--light-gray);
}

.btn-success {
  background: var(--charcoal);
  color: var(--white);
}

.btn-success:hover {
  background: #1a202c;
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-hover);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-outlined {
  background: transparent;
  color: var(--charcoal);
  border: 1px solid var(--border-subtle);
}

.btn-outlined:hover {
  border-color: var(--charcoal);
  background: var(--light-gray);
}

/* ============================================================
   DASHBOARD LAYOUT — flush sidebar, full-bleed
   ============================================================ */
.dashboard-layout {
  display: flex;
  gap: 0;
  align-items: stretch;
  height: 100%;
}

.dashboard-sidebar {
  width: 320px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #2d3748 0%, #6f42c1 100%);
  border-radius: 0;
  border: none;
  border-right: none;
  color: rgba(255, 255, 255, 0.88);
  overflow: hidden;
  flex-shrink: 0;
  align-self: stretch;
  transition:
    width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed: icon-rail only */
.dashboard-sidebar.collapsed {
  width: 44px;
  min-width: 44px;
}

/* ---- Sidebar header row (collapse toggle only) ---- */
.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 6px;
  min-height: 42px;
  flex-shrink: 0;
}

.dashboard-sidebar.collapsed .sidebar-header-row {
  justify-content: center;
}

/* ---- Sidebar toggle button ---- */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
  border-radius: 6px;
  transition:
    color 0.2s,
    background 0.2s;
}

.sidebar-toggle-btn:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-chevron-closed {
  display: none;
}
.sidebar-chevron-open {
  display: block;
}
.dashboard-sidebar.collapsed .sidebar-chevron-open {
  display: none;
}
.dashboard-sidebar.collapsed .sidebar-chevron-closed {
  display: block;
}

/* ---- Scrollable sidebar content ---- */
.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  transition: opacity 0.15s ease;
}

.dashboard-sidebar.collapsed .sidebar-content {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---- Sidebar accordion groups ---- */
.sidebar-group {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-group:last-child {
  border-bottom: none;
}

.sidebar-group-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s;
  font-family: inherit;
}

.sidebar-group-hdr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-group-hdr > svg:first-child {
  color: rgba(255, 255, 255, 0.38);
  flex-shrink: 0;
}

.sidebar-group-hdr > span {
  flex: 1;
}

.sg-chevron {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.32);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-group.open .sg-chevron {
  transform: rotate(180deg);
}

.sidebar-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-group.open .sidebar-group-body {
  max-height: 600px;
}

.sg-body-inner {
  padding: 2px 16px 14px;
}

.sg-row-space-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sg-inline-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  margin-right: 4px;
  transition:
    background 0.15s,
    color 0.15s;
}

.sg-inline-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
}

/* ---- Dashboard main content area (flex child of .dashboard-layout) ---- */
.dashboard-main-area {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ---- Dashboard main content (inside #dashboardPage) ---- */
.dashboard-main {
  min-width: 0;
  padding: var(--spacing-xl) 36px var(--spacing-2xl);
}

/* ---- Dashboard header + KPI strip ---- */
.dashboard-main-header {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-kpi-strip {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.kpi-stat {
  display: flex;
  flex-direction: column;
  padding: 0 28px;
}

.kpi-stat:first-child {
  padding-left: 0;
}

.kpi-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark-gray);
  line-height: 1.1;
  letter-spacing: -0.3px;
}

.kpi-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7280;
  margin-top: 3px;
}

.kpi-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.kpi-strip-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 28px;
  padding-left: 28px;
  border-left: 1px solid var(--border-subtle);
}

/* Legacy sidebar heading */
.sidebar-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.4);
  margin: 0 0 var(--spacing-sm) 0;
}

/* ---- Sidebar nav links (top of sidebar) ---- */
.sidebar-nav {
  padding: 8px 0 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
  font-family: inherit;
}

.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-nav-link.active {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid #a78bfa;
  padding-left: 13px;
}

.sidebar-nav-link svg {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.15s;
}

.sidebar-nav-link:hover svg,
.sidebar-nav-link.active svg {
  color: rgba(255, 255, 255, 0.65);
}

/* Collapsed sidebar: hide labels, center icons */
.dashboard-sidebar.collapsed .sidebar-nav-link {
  justify-content: center;
  padding: 10px 0;
}
.dashboard-sidebar.collapsed .sidebar-nav-link.active {
  border-left: none;
  padding-left: 0;
  border-bottom: 2px solid #a78bfa;
}
.dashboard-sidebar.collapsed .sidebar-nav-label {
  display: none;
}

/* ---- Sub-section labels inside accordion body ---- */
.sg-sub-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.35);
  margin: 0 0 6px 0;
}

/* ---- Activity log toolbar (clear button row) ---- */
.sg-log-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

/* ---- Header controls: HITL + Run button ---- */
.dashboard-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-lg);
  margin-bottom: 14px;
}

.header-run-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Inline HITL toggle in header */
.hitl-toggle-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.hitl-inline-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.dashboard-sidebar .upload-area {
  padding: 14px 12px;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
}

.dashboard-sidebar .upload-area:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.09);
}

.dashboard-sidebar .upload-icon {
  font-size: 22px;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.4);
}

.dashboard-sidebar .upload-text {
  font-size: 13px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.7);
}

.dashboard-sidebar .upload-hint {
  display: none;
}

.dashboard-sidebar .project-name-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.88);
}

.dashboard-sidebar .project-name-input {
  font-size: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
}

.dashboard-sidebar .quality-buttons {
  flex-direction: row;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
}

.dashboard-sidebar .quality-btn {
  padding: 6px 12px;
  font-size: 13px;
  flex: 1;
  color: rgba(255, 255, 255, 0.45);
}

.dashboard-sidebar .quality-btn .quality-tier-label {
  display: none;
}

.dashboard-sidebar .activity-log {
  min-height: 80px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 12px;
  padding: 4px 0;
  background: transparent;
  border: none;
}

/* --- Dark sidebar theme overrides --- */
.dashboard-sidebar .project-name-display {
  background: transparent;
  border: none;
  padding: 0;
}

.dashboard-sidebar .project-name-input:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

.dashboard-sidebar .file-item {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.82);
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}

.dashboard-sidebar .file-item > div {
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-sidebar .file-item .file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 200px;
  font-size: 12px;
}

.dashboard-sidebar .file-item .btn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 11px;
}

.dashboard-sidebar .file-name {
  color: rgba(255, 255, 255, 0.82);
}

.dashboard-sidebar .file-size {
  color: rgba(255, 255, 255, 0.4);
}

.dashboard-sidebar .quality-btn:hover {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-sidebar .quality-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-sidebar .btn-primary {
  background: #6f42c1;
  color: var(--white);
}

.dashboard-sidebar .btn-primary:hover {
  background: #5a32a3;
  box-shadow: 0 4px 14px rgba(111, 66, 193, 0.4);
}

.dashboard-sidebar .btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
}

.dashboard-sidebar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

/* Stop button (appears during cascade execution) */
.btn-stop {
  background: #dc3545;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.btn-stop::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition:
    width 0.5s var(--ease-apple),
    height 0.5s var(--ease-apple);
}

.btn-stop:hover::after {
  width: 300px;
  height: 300px;
}

.btn-stop:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(220, 53, 69, 0.35);
}

.btn-stop:disabled {
  background: #e5a0a7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dashboard-sidebar .btn-stop {
  background: #dc3545;
  color: var(--white);
}

.dashboard-sidebar .btn-stop:hover {
  background: #c82333;
  box-shadow: 0 4px 14px rgba(220, 53, 69, 0.35);
}

.dashboard-sidebar .btn-stop:disabled {
  background: #e5a0a7;
  color: rgba(255, 255, 255, 0.7);
}

.dashboard-sidebar .sidebar-run-hint {
  color: rgba(255, 255, 255, 0.4);
}

.dashboard-sidebar .activity-log .log-entry {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

/* --- Sidebar scope / format / HITL — dark theme overrides --- */
.dashboard-sidebar .scope-buttons {
  background: rgba(0, 0, 0, 0.2);
}

.dashboard-sidebar .scope-btn {
  color: rgba(255, 255, 255, 0.45);
}

.dashboard-sidebar .scope-btn:hover {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-sidebar .scope-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-sidebar .scope-hint {
  color: rgba(255, 255, 255, 0.38);
}

.dashboard-sidebar .format-buttons {
  background: rgba(0, 0, 0, 0.2);
}

.dashboard-sidebar .format-btn {
  color: rgba(255, 255, 255, 0.45);
}

.dashboard-sidebar .format-btn:hover:not(.format-btn-disabled) {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-sidebar .format-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-sidebar .hitl-toggle-slider {
  background: rgba(255, 255, 255, 0.15);
}

.dashboard-sidebar .hitl-toggle-label {
  color: rgba(255, 255, 255, 0.5);
}

/* Sidebar run button */
.sidebar-run-section {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-run-btn {
  width: 100%;
  font-size: 15px;
  padding: 14px 24px;
}

.sidebar-run-hint {
  font-size: 12px;
  color: var(--medium-gray);
  text-align: center;
  margin-top: var(--spacing-xs);
  line-height: 1.4;
}

/* Agent grid narrower with sidebar */
.dashboard-main .agents-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: stretch;
}

/* ============================================================
   UPLOAD SECTION
   ============================================================ */

.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-card-apple);
  padding: var(--spacing-2xl) var(--spacing-lg);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-apple);
  background: var(--fafafa);
}

.upload-area:hover {
  border-color: #9ca3af;
  background: var(--light-gray);
  transform: scale(1.005);
}

.upload-area.dragover {
  border-color: var(--charcoal);
  background: #e5e7eb;
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(45, 55, 72, 0.08);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: var(--spacing-sm);
  color: var(--medium-gray);
}

.upload-text {
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-xs);
}

.upload-hint {
  font-size: 12px;
  color: var(--medium-gray);
}

.file-input {
  display: none;
}

/* Uploaded files list */
.uploaded-files {
  margin-top: var(--spacing-md);
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--light-gray);
  border-radius: var(--radius-filter);
  margin-bottom: var(--spacing-sm);
}

.file-name {
  font-weight: 500;
  color: var(--dark-gray);
  font-size: 13px;
}

.file-size {
  color: var(--medium-gray);
  font-size: 12px;
  margin-left: 8px;
}

/* ============================================================
   QUALITY SELECTOR
   ============================================================ */
.quality-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--medium-gray);
}

.quality-buttons {
  display: flex;
  gap: 0;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 12px;
}

.quality-btn {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--medium-gray);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  text-align: center;
}

.quality-btn:hover {
  color: var(--dark-gray);
}

.quality-btn.active {
  background: var(--white);
  color: var(--dark-gray);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.quality-btn .quality-tier-label {
  display: block;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 2px;
}

.quality-btn.active .quality-tier-label {
  opacity: 0.8;
}

/* ============================================================
   DELIVERABLE SCOPE SELECTOR
   ============================================================ */
.scope-buttons {
  display: flex;
  gap: 0;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: 10px;
  width: 100%;
}

.scope-btn {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  text-align: center;
  line-height: 1.3;
}

.scope-btn:hover {
  color: rgba(255, 255, 255, 0.85);
}

.scope-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.scope-count {
  display: block;
  font-size: 10px;
  font-weight: 400;
  opacity: 0.5;
  margin-top: 1px;
}

.scope-btn.active .scope-count {
  opacity: 0.8;
}

.scope-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  margin-top: 6px;
  line-height: 1.3;
}

/* Output Format buttons (multi-select toggle) */
.format-buttons {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 3px;
}

.format-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  text-align: center;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.format-btn:hover:not(.format-btn-disabled) {
  color: rgba(255, 255, 255, 0.85);
}

.format-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.format-btn-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.format-label {
  display: block;
  font-size: 9px;
  font-weight: 400;
  opacity: 0.5;
  margin-top: 0;
}

.format-btn.active .format-label {
  opacity: 0.8;
}

/* HITL toggle */
.hitl-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}
.hitl-toggle input[type="checkbox"] {
  display: none;
}
.hitl-toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.hitl-toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  transition:
    transform 0.2s,
    background 0.2s;
}
.hitl-toggle input:checked + .hitl-toggle-slider {
  background: var(--deep-purple, #6f42c1);
}
.hitl-toggle input:checked + .hitl-toggle-slider::after {
  transform: translateX(16px);
  background: #fff;
}
.hitl-toggle-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.3;
}

/* Light-background variant (used in KPI strip) */
.hitl-toggle-light .hitl-toggle-slider {
  background: #d1d5db;
}
.hitl-toggle-light .hitl-toggle-slider::after {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.hitl-toggle-light input:checked + .hitl-toggle-slider {
  background: var(--deep-purple, #6f42c1);
}
.hitl-toggle-light .hitl-toggle-label {
  color: #374151;
  font-size: 13px;
}

/* Run button */
.run-section {
  text-align: center;
  margin-top: var(--spacing-lg);
}

.run-hint {
  font-size: 13px;
  color: var(--medium-gray);
  margin-top: var(--spacing-sm);
  line-height: 1.5;
}

/* ============================================================
   CONNECTION STATUS BANNER
   ============================================================ */
.connection-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-filter);
  margin-bottom: var(--spacing-lg);
  font-size: 14px;
}

.connection-banner.warning {
  background: #fef3c7;
  border: 1px solid #fcd34d;
}

.connection-banner.success {
  background: #d1fae5;
  border: 1px solid var(--success-green);
}

.connection-banner.error {
  background: #fee2e2;
  border: 1px solid var(--danger-red);
}

.connection-banner-icon {
  font-size: 18px;
}

.connection-banner-text strong {
  display: block;
  font-size: 14px;
}

.connection-banner-text p {
  font-size: 13px;
  color: var(--medium-gray);
  margin-top: 2px;
}

/* ============================================================
   PROJECT NAME
   ============================================================ */

.project-name-display {
  padding: 10px 14px;
  background: var(--light-gray);
  border-radius: var(--radius-input);
  border: 1px solid var(--border-subtle);
}

.project-name-text {
  color: var(--dark-gray);
  font-size: 16px;
  font-weight: 500;
}

.project-name-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-name-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-input);
  font-size: 16px;
  font-family: var(--font-family);
  color: var(--dark-gray);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.project-name-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.project-edit-actions {
  display: flex;
  gap: 10px;
}

/* ============================================================
   AGENT CARDS
   ============================================================ */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.agent-card {
  background: var(--white);
  border-radius: var(--radius-card-apple);
  box-shadow: var(--shadow-card-apple);
  padding: 0;
  border: 1.5px solid rgba(167, 139, 250, 0.35);
  transition:
    box-shadow 0.35s var(--ease-apple),
    transform 0.35s var(--ease-apple),
    border-color 0.3s;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Hide top gradient band — replaced by card outline border */
.agent-gradient-header {
  display: none;
}

/* Working state: spinning gradient outline */
.agent-card[data-state="working"] {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--white), var(--white)) padding-box,
    conic-gradient(
        from var(--border-angle),
        transparent 20%,
        var(--gc1, #9b73f7) 40%,
        var(--gc2, #7c78ee) 60%,
        transparent 80%
      )
      border-box;
  animation: card-border-spin 3s linear infinite;
}

/* Per-agent gradient colours for the spinning border */
.agent-card[data-agent="atlas"][data-state="working"] {
  --gc1: #9b73f7;
  --gc2: #7c78ee;
}
.agent-card[data-agent="beacon"][data-state="working"] {
  --gc1: #2dd4bf;
  --gc2: #22d3ee;
}
.agent-card[data-agent="connect"][data-state="working"] {
  --gc1: #c084fc;
  --gc2: #f472b6;
}
.agent-card[data-agent="echo"][data-state="working"] {
  --gc1: #60a5fa;
  --gc2: #38bdf8;
}
.agent-card[data-agent="sage"][data-state="working"] {
  --gc1: #f87171;
  --gc2: #fb7185;
}
.agent-card[data-agent="writer"][data-state="working"] {
  --gc1: #34d399;
  --gc2: #14b8a6;
}

/* Completed / partial: subtle static agent-colour border */
.agent-card[data-agent="atlas"][data-state="completed"],
.agent-card[data-agent="atlas"][data-state="partial"] {
  border-color: #c4b5fd;
}
.agent-card[data-agent="beacon"][data-state="completed"],
.agent-card[data-agent="beacon"][data-state="partial"] {
  border-color: #99f6e4;
}
.agent-card[data-agent="connect"][data-state="completed"],
.agent-card[data-agent="connect"][data-state="partial"] {
  border-color: #e9d5ff;
}
.agent-card[data-agent="echo"][data-state="completed"],
.agent-card[data-agent="echo"][data-state="partial"] {
  border-color: #bfdbfe;
}
.agent-card[data-agent="sage"][data-state="completed"],
.agent-card[data-agent="sage"][data-state="partial"] {
  border-color: #fecaca;
}
.agent-card[data-agent="writer"][data-state="completed"],
.agent-card[data-agent="writer"][data-state="partial"] {
  border-color: #a7f3d0;
}

/* Error / stopped */
.agent-card[data-state="error"] {
  border-color: var(--danger-red);
}
.agent-card[data-state="stopped"] {
  border-color: #d1d5db;
}

/* ============================================================
   REVIEWER CARD — full-width banner, 2-column body
   ============================================================ */

/* Span all 3 grid columns */
.agent-card-reviewer {
  grid-column: 1 / -1;
}

/* 2-column body: left info panel / right deliverables */
.agent-card-reviewer .agent-card-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto auto auto auto;
  column-gap: 28px;
  align-items: start;
  overflow: visible;
}

.agent-card-reviewer .agent-header     { grid-column: 1; grid-row: 1; }
.agent-card-reviewer .progress-bar     { grid-column: 1; grid-row: 2; margin-top: 10px; }
.agent-card-reviewer .agent-activity   { grid-column: 1; grid-row: 3; }
.agent-card-reviewer .agent-metrics    { grid-column: 1; grid-row: 4; }

.agent-card-reviewer .output-files {
  grid-column: 2;
  grid-row: 1 / 5;
  border-left: none;
  border-top: none;
  padding-left: 0;
  margin-left: 0;
  margin-top: 0;
}

#deliverables-reviewer {
  max-height: none;
  overflow-y: visible;
}

.agent-card-reviewer .reviewer-chat-section {
  grid-column: 2;
  grid-row: 5;
  border-left: 1px solid var(--border-subtle);
  padding-left: 24px;
}

/* Reviewer working state spinning border */
.agent-card[data-agent="reviewer"][data-state="working"] {
  --gc1: #F59E0B;
  --gc2: #D97706;
}

/* Reviewer completed / partial border */
.agent-card[data-agent="reviewer"][data-state="completed"],
.agent-card[data-agent="reviewer"][data-state="partial"] {
  border-color: #fde68a;
}

.agent-card:hover {
  box-shadow: var(--shadow-card-hover-apple);
  transform: translateY(-1px);
}

/* Inner content area */
.agent-card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Gradient header band at top of each agent card */
.agent-gradient-header {
  height: 6px;
  width: 100%;
  transition: height 0.3s var(--ease-apple);
}

.agent-card:hover .agent-gradient-header {
  height: 8px;
}

.agent-gradient-header.atlas {
  background: var(--gradient-atlas);
}
.agent-gradient-header.echo {
  background: var(--gradient-echo);
}
.agent-gradient-header.writer {
  background: var(--gradient-writer);
}
.agent-gradient-header.sage {
  background: var(--gradient-sage);
}
.agent-gradient-header.beacon {
  background: var(--gradient-beacon);
}
.agent-gradient-header.connect {
  background: var(--gradient-connect);
}
.agent-gradient-header.reviewer { background: linear-gradient(135deg, #F59E0B, #D97706); }

/* Agent header */
.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  transition:
    transform 0.3s var(--ease-apple),
    box-shadow 0.3s var(--ease-apple);
}

.agent-card:hover .agent-avatar {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agent-avatar.atlas {
  background: var(--gradient-atlas);
}
.agent-avatar.echo {
  background: var(--gradient-echo);
}
.agent-avatar.writer {
  background: var(--gradient-writer);
}
.agent-avatar.sage {
  background: var(--gradient-sage);
}
.agent-avatar.beacon {
  background: var(--gradient-beacon);
}
.agent-avatar.connect {
  background: var(--gradient-connect);
}
.agent-avatar.reviewer { background: linear-gradient(135deg, #F59E0B, #D97706); }

.agent-title h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 1px;
}

.agent-role {
  font-size: 12px;
  font-weight: 400;
  color: #4b5563;
}

.agent-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Phase badge */
.phase-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 500;
  background: var(--light-gray);
  color: #374151;
  border: 1px solid var(--border-subtle);
}

.phase-badge.phase-active {
  background: var(--deep-purple);
  color: var(--white);
  border-color: var(--deep-purple);
}

/* Status badges */
.status-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.25s var(--ease-apple);
}

.status-idle {
  background: rgba(241, 245, 249, 0.85);
  color: #475569;
}

.status-working {
  background: rgba(254, 243, 199, 0.85);
  color: #92400e;
  animation: pulse 2s infinite;
}

.status-complete,
.status-completed {
  background: rgba(209, 250, 229, 0.85);
  color: #065f46;
}

.status-error {
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
}

.status-waiting {
  background: rgba(237, 233, 254, 0.85);
  color: #5b21b6;
}

.status-partial {
  background: rgba(254, 243, 199, 0.85);
  color: #92400e;
}

.status-stopped {
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-progress);
  border-radius: 3px;
  transition: width 0.5s var(--ease-apple);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  bottom: -2px;
  background: inherit;
  border-radius: 3px;
  filter: blur(4px);
  opacity: 0.4;
  z-index: -1;
}

/* Agent activity */
.agent-activity {
  color: #4b5563;
  font-size: 12px;
  margin-bottom: 6px;
  min-height: 18px;
  line-height: 1.4;
}

.activity-progress {
  font-weight: 600;
  color: var(--deep-purple);
  margin-right: 4px;
}

.activity-meta {
  font-size: 12px;
  color: #6b7280;
}

/* Agent metrics — compact inline row */
.agent-metrics {
  display: flex;
  gap: 20px;
  margin-bottom: 6px;
}

.metric-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
}

.metric-item span {
  font-size: 11px;
  font-weight: 400;
  color: #6b7280;
}

.metric-item strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark-gray);
}

/* Output files / deliverables */
.output-files {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  margin-top: 6px;
}

.output-files h4 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--medium-gray);
  margin-bottom: 4px;
}

.output-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--light-gray);
  border-radius: var(--radius-input);
  margin-bottom: 2px;
  font-size: 12px;
}

/* Cap the pending deliverables list so cards don't grow unbounded */
[id^="deliverables-"] {
  max-height: 174px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}
[id^="deliverables-"]::-webkit-scrollbar {
  width: 4px;
}
[id^="deliverables-"]::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.empty-state {
  color: #9ca3af;
  font-size: 11px;
  font-style: italic;
  padding: 2px 0;
}

/* Deliverable items (rendered by app.js) */
.deliverable-completed {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.deliverable-pending {
  background: var(--light-gray) !important;
  border-color: var(--border-subtle) !important;
}

.deliverable-item {
  transition:
    background 0.2s var(--ease-apple),
    transform 0.2s var(--ease-apple);
}

.deliverable-item:hover {
  transform: translateX(2px);
}

/* ============================================================
   HUMAN-IN-THE-LEAD REVIEW PANEL
   ============================================================ */
.agent-review-panel {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: var(--radius-card-apple);
  animation: reviewPanelEnter 0.4s var(--ease-apple);
}

@keyframes reviewPanelEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 400px;
  }
}

.review-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--spacing-sm);
}

.review-panel-icon {
  font-size: 18px;
  line-height: 1;
}

.review-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #92400e;
}

.review-panel-subtitle {
  font-size: 13px;
  color: #78716c;
  margin-bottom: var(--spacing-md);
  line-height: 1.4;
}

.review-feedback-area {
  width: 100%;
  min-height: 72px;
  max-height: 160px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--dark-gray);
  background: var(--white);
  resize: vertical;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  margin-bottom: var(--spacing-sm);
}

.review-feedback-area:focus {
  outline: none;
  border-color: var(--deep-purple);
  box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.12);
}

.review-feedback-area::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.review-panel-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.review-btn-approve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  background: #059669;
  color: var(--white);
}

.review-btn-approve:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.review-btn-revise {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid #d97706;
  border-radius: var(--radius-button);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s var(--ease-apple);
  background: transparent;
  color: #d97706;
}

.review-btn-revise:hover {
  background: #fef3c7;
  transform: translateY(-1px);
}

.review-panel-approved {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--spacing-sm) var(--spacing-md);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-card-apple);
  margin-top: var(--spacing-md);
  font-size: 13px;
  font-weight: 500;
  color: #065f46;
}

/* Status badge for review-needed */
.status-review {
  background: rgba(254, 243, 199, 0.9);
  color: #92400e;
  animation: pulse 2.5s infinite;
}

/* ============================================================
   EXECUTIVE SUMMARY PANEL (post-cascade synthesis)
   ============================================================ */
.exec-summary-panel {
  background: var(--white);
  border-radius: var(--radius-card-apple);
  box-shadow:
    0 4px 20px rgba(111, 66, 193, 0.12),
    0 0 1px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--spacing-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.exec-summary-panel-visible {
  opacity: 1;
  transform: translateY(0);
}

.exec-summary-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) var(--spacing-xl);
  background: linear-gradient(135deg, #2d3748 0%, #6f42c1 100%);
  color: var(--white);
}

.exec-summary-icon {
  font-size: 24px;
  line-height: 1;
}

.exec-summary-title-group {
  flex: 1;
}

.exec-summary-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.exec-summary-subtitle {
  font-size: 12px;
  opacity: 0.7;
  margin: 2px 0 0;
}

.exec-summary-status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  white-space: nowrap;
}

.exec-summary-badge-complete {
  background: #28a745;
}

.exec-summary-content {
  padding: var(--spacing-xl);
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.7;
  font-size: 14px;
  color: var(--dark-gray);
}

.exec-summary-content h1 {
  font-size: 1.4rem;
  margin: 1.5rem 0 0.75rem;
  color: #2d3748;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 0.4rem;
}

.exec-summary-content h2 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.6rem;
  color: #6f42c1;
}

.exec-summary-content h3 {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.5rem;
  color: #2d3748;
}

.exec-summary-content p {
  margin-bottom: 0.75rem;
}

.exec-summary-content ul,
.exec-summary-content ol {
  margin: 0.5rem 0 1rem 1.25rem;
}

.exec-summary-content li {
  margin-bottom: 0.35rem;
}

.exec-summary-content strong {
  color: #1a202c;
}

.exec-summary-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 13px;
}

.exec-summary-content th,
.exec-summary-content td {
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  text-align: left;
}

.exec-summary-content th {
  background: #f7f8fa;
  font-weight: 600;
  color: #2d3748;
}

.exec-summary-loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: #6c757d;
}

.exec-summary-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-subtle);
  border-top-color: #6f42c1;
  border-radius: 50%;
  animation: execSpin 0.8s linear infinite;
  margin: 0 auto var(--spacing-md);
}

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

.exec-summary-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-xl);
  border-top: 1px solid var(--border-subtle);
  background: #fafbfc;
}

.exec-summary-actions .btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.exec-summary-actions .btn-primary {
  background: #6f42c1;
  color: var(--white);
}

.exec-summary-actions .btn-primary:hover {
  background: #5a32a3;
}

.exec-summary-actions .btn-secondary {
  background: var(--white);
  color: var(--dark-gray);
  border: 1px solid var(--border-subtle);
}

.exec-summary-actions .btn-secondary:hover {
  background: #f0f0f0;
}

.exec-summary-actions .btn-collapse {
  margin-left: auto;
}

.exec-summary-panel.exec-summary-collapsed .exec-summary-content,
.exec-summary-panel.exec-summary-collapsed .exec-summary-actions {
  display: none;
}

.exec-summary-panel.exec-summary-collapsed .exec-summary-header {
  cursor: pointer;
}

/* ============================================================
   ACTIVITY LOG (card-style entries with dot indicators)
   ============================================================ */
.activity-log {
  background: var(--light-gray);
  border-radius: var(--radius-filter);
  padding: var(--spacing-sm);
  max-height: 200px;
  overflow-y: auto;
  font-family: var(--font-family);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  background: var(--white);
  border-radius: 6px;
  color: var(--dark-gray);
}

.log-entry::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.log-entry.system::before {
  background: var(--medium-gray);
}
.log-entry.success::before {
  background: var(--success-green);
}
.log-entry.error::before {
  background: var(--danger-red);
}
.log-entry.warning::before {
  background: var(--warning-orange);
}

/* ============================================================
   HISTORY PAGE
   ============================================================ */
.coming-soon-card {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-card-apple);
  padding: var(--spacing-2xl);
  text-align: center;
  background: var(--fafafa);
}

.coming-soon-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-sm);
}

.coming-soon-text {
  font-size: 14px;
  color: var(--medium-gray);
  line-height: 1.6;
}

/* History cards */
.history-loading {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--medium-gray);
  font-size: 14px;
}

.history-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card-apple);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
  transition: box-shadow 0.2s var(--ease-apple);
}

.history-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.history-card-header {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--fafafa);
}

.history-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.history-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-gray);
  margin: 0;
}

.history-card-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xs);
  font-size: 13px;
  color: var(--medium-gray);
}

.history-config {
  font-size: 12px;
  color: var(--medium-gray);
}

.history-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-button);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-status-complete {
  background: var(--success-green);
  color: var(--white);
}

.history-status-partial {
  background: var(--warning-orange);
  color: var(--dark-gray);
}

.history-status-running {
  background: var(--deep-purple);
  color: var(--white);
}

.history-status-failed {
  background: var(--danger-red);
  color: var(--white);
}

.history-card-body {
  padding: var(--spacing-md) var(--spacing-lg);
}

.history-agents-row,
.history-formats-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  flex-wrap: wrap;
}

.history-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--medium-gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 60px;
}

.history-agent-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--charcoal);
  color: var(--white);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}

.history-format-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}

.history-format-md {
  background: #e8f5e9;
  color: #2e7d32;
}
.history-format-html {
  background: #e3f2fd;
  color: #1565c0;
}
.history-format-pptx {
  background: #f3e5f5;
  color: #7b1fa2;
}

.history-none {
  font-size: 12px;
  color: var(--medium-gray);
  font-style: italic;
}

.history-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
}

/* ============================================================
   ANALYTICS PAGE
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.kpi-card {
  background: var(--charcoal);
  border-radius: var(--radius-card-apple);
  padding: var(--spacing-lg);
  min-height: 120px;
  max-height: 140px;
  position: relative;
  overflow: hidden;
  color: var(--white);
  transition:
    box-shadow 0.3s var(--ease-apple),
    transform 0.3s var(--ease-apple);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.05)
  );
  border-radius: 50%;
  transform: translate(40%, -40%);
  z-index: 0;
}

.kpi-card > * {
  position: relative;
  z-index: 1;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--spacing-sm);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: var(--spacing-xs);
}

.kpi-trend {
  font-size: 13px;
  font-weight: 500;
}

.kpi-trend.positive {
  color: var(--trend-up);
}
.kpi-trend.negative {
  color: var(--trend-down);
}

/* Chart containers */
.chart-card {
  background: var(--light-gray);
  border-radius: var(--radius-card-apple);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.chart-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-xs);
}

.chart-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--medium-gray);
  margin-bottom: var(--spacing-lg);
}

.chart-placeholder {
  height: 280px;
  background: var(--white);
  border-radius: var(--radius-filter);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--medium-gray);
  font-size: 14px;
}

.kpi-value-small {
  font-size: 16px;
}

/* Analytics bar charts */
.analytics-bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.analytics-bar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.analytics-bar-label {
  min-width: 70px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-gray);
  text-align: right;
}

.analytics-bar-track {
  flex: 1;
  height: 24px;
  background: var(--white);
  border-radius: var(--radius-filter);
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--deep-purple), var(--light-purple));
  border-radius: var(--radius-filter);
  transition: width 0.6s var(--ease-apple);
  min-width: 4px;
}

.analytics-bar-fill-timeline {
  background: linear-gradient(90deg, var(--cyan-teal), #4dd0e1);
}

.analytics-bar-value {
  min-width: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-gray);
  text-align: right;
}

.analytics-format-stat {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  margin-right: var(--spacing-sm);
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-section {
  background: var(--white);
  border-radius: var(--radius-card-apple);
  box-shadow: var(--shadow-card-apple);
  padding: var(--spacing-lg) var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  transition: box-shadow 0.3s var(--ease-apple);
}

.settings-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-subtle);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--light-gray);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info {
  flex: 1;
}

.setting-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--dark-gray);
  margin-bottom: 2px;
}

.setting-description {
  font-size: 13px;
  color: var(--medium-gray);
}

.setting-control {
  margin-left: var(--spacing-lg);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch.active {
  background: var(--charcoal);
}

.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch.active .toggle-slider {
  transform: translateX(24px);
}

/* Form controls */
.setting-select,
.setting-input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-input);
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--dark-gray);
  background: var(--white);
  min-width: 150px;
  cursor: pointer;
}

.setting-select:focus,
.setting-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ============================================================
   PREVIEW MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: var(--blur-modal);
  -webkit-backdrop-filter: var(--blur-modal);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 20px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: modalEnter 0.35s var(--ease-apple);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--white);
  border-radius: var(--radius-modal) var(--radius-modal) 0 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--charcoal);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--medium-gray);
  padding: 4px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: var(--spacing-xl);
  background: var(--fafafa);
  overflow-y: auto;
  flex: 1;
  border-radius: 0 0 var(--radius-modal) var(--radius-modal);
}

.modal-body pre {
  background: var(--white);
  border-radius: var(--radius-filter);
  padding: var(--spacing-lg);
  font-family: "SF Mono", "Fira Code", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--dark-gray);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .nav-primary {
    padding: 0 20px;
  }

  .nav-context {
    padding: 0 20px;
  }

  .container {
    padding: var(--spacing-lg) 20px;
  }

  .agents-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .dashboard-layout {
    flex-direction: column;
  }

  .dashboard-sidebar {
    width: 100%;
    min-width: auto;
    padding: var(--spacing-md);
    border-right: none;
    border-bottom: none;
    border-radius: var(--radius-card-apple);
    margin-bottom: var(--spacing-md);
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }

  .dashboard-main .agents-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-kpi-strip {
    flex-wrap: wrap;
    gap: 12px;
  }

  .kpi-divider {
    display: none;
  }

  .nav-brand-tagline {
    display: none;
  }
}

@media (max-width: 768px) {
  .agents-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .nav-links {
    gap: 0;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 13px;
  }

  .nav-link-icon {
    display: none;
  }
}

@media (max-width: 640px) {
  .nav-primary {
    height: 48px;
  }

  .nav-brand-name {
    font-size: 15px;
  }

  .nav-actions {
    display: none;
  }

  .page-title {
    font-size: 24px;
  }

  .quality-buttons {
    flex-direction: column;
    border-radius: 16px;
  }

  .quality-btn {
    border-radius: 12px;
  }

  .agent-metrics {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
}

/* ============================================================
   FOCUS STATES (Accessibility)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Remove outline for mouse clicks */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
.main-content::-webkit-scrollbar,
.dashboard-main-area::-webkit-scrollbar,
.activity-log::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 5px;
}

.main-content::-webkit-scrollbar-track,
.dashboard-main-area::-webkit-scrollbar-track,
.activity-log::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb,
.dashboard-main-area::-webkit-scrollbar-thumb,
.activity-log::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb:hover,
.dashboard-main-area::-webkit-scrollbar-thumb:hover,
.activity-log::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.22);
}

/* ============================================================
   CONNECTION STATUS (added from main — missing in sfm_ux)
   ============================================================ */
.connection-status-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-card-apple);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s var(--ease-apple);
}

.connection-status-inline.connected {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.connection-status-inline.disconnected {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #FCA5A5;
}

.connection-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.connection-status-dot.connected {
    background: var(--success-green);
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.4);
}

.connection-status-dot.disconnected {
    background: var(--danger-red);
    animation: pulse 2s infinite;
}

.connection-status-text {
    font-size: 13px;
    line-height: 1.3;
}

/* ============================================================
   DASHBOARD KPI CARDS (added from main — missing in sfm_ux)
   ============================================================ */
.dashboard-kpi-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.dashboard-kpi {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px var(--spacing-md);
    background: var(--white);
    border-radius: var(--radius-card-apple);
    box-shadow: var(--shadow-card-apple);
}

.dashboard-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark-gray);
    line-height: 1.2;
}

.dashboard-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--charcoal);
    opacity: 0.55;
    margin-top: 2px;
}

/* ============================================================
   DELIVERABLE SELECT-ALL (added from main — missing in sfm_ux)
   ============================================================ */
.deliverable-select-all input[type="checkbox"],
.deliverable-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.deliverable-select-all {
    position: sticky;
    top: 0;
    background: var(--white, #fff);
    z-index: 1;
}

/* ============================================================
   ITERATION SYSTEM (added from main — missing in sfm_ux)
   ============================================================ */
.iteration-panel-container {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.iteration-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.iteration-panel-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--medium-gray);
    display: flex;
    align-items: center;
    gap: 8px;
}

.iteration-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--deep-purple);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
}

.iteration-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(111, 66, 193, 0.3);
    background: rgba(111, 66, 193, 0.06);
    color: var(--deep-purple);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.iteration-upload-btn:hover {
    background: rgba(111, 66, 193, 0.12);
    border-color: rgba(111, 66, 193, 0.5);
}

.iteration-panel-toggle {
    font-size: 12px;
    color: var(--medium-gray);
    transition: transform 0.2s var(--ease-apple);
}

.iteration-panel-toggle.expanded {
    transform: rotate(180deg);
}

.iteration-panel-body {
    padding-top: var(--spacing-sm);
}

.iteration-upload-zone {
    border: 2px dashed rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-filter);
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    background: var(--fafafa);
    margin-bottom: var(--spacing-sm);
}

.iteration-upload-zone:hover {
    border-color: var(--deep-purple);
    background: #F5F3FF;
}

.iteration-upload-zone.dragover {
    border-color: var(--deep-purple);
    background: #EDE9FE;
}

.iteration-upload-text {
    font-size: 13px;
    color: var(--medium-gray);
}

.iteration-upload-hint {
    font-size: 11px;
    color: var(--medium-gray);
    opacity: 0.6;
    margin-top: 2px;
}

.iteration-file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.iteration-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--light-gray);
    border-radius: var(--radius-input);
    font-size: 13px;
}

.iteration-file-name {
    color: var(--dark-gray);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.iteration-file-remove {
    background: none;
    border: none;
    color: var(--medium-gray);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.iteration-file-remove:hover {
    color: var(--danger-red);
}

.iteration-run-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: var(--radius-button);
    background: var(--deep-purple);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.25s var(--ease-apple);
    margin-bottom: var(--spacing-sm);
}

.iteration-run-btn:hover:not(:disabled) {
    background: #5B21B6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

.iteration-run-btn:disabled {
    background: #D1D5DB;
    color: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.iteration-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iteration-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--medium-gray);
    padding: 4px 0;
}

.iteration-history-icon {
    font-size: 14px;
}

.iteration-history-icon.completed { color: var(--success-green); }
.iteration-history-icon.running { color: var(--warning-orange); animation: pulse 2s infinite; }
.iteration-history-icon.error { color: var(--danger-red); }

/* ============================================================
   REVIEWER CHAT (added from main — missing in sfm_ux)
   ============================================================ */
.reviewer-chat-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.reviewer-chat-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--medium-gray);
    margin-bottom: var(--spacing-sm);
}

.reviewer-chat-messages {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--fafafa);
    border-radius: var(--radius-filter);
}

.reviewer-chat-msg {
    padding: 8px 12px;
    border-radius: var(--radius-filter);
    font-size: 13px;
    line-height: 1.5;
    max-width: 85%;
}

.reviewer-chat-msg-user {
    background: var(--deep-purple);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.reviewer-chat-msg-reviewer {
    background: var(--white);
    color: var(--dark-gray);
    border: 1px solid var(--border-subtle);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.reviewer-chat-input-row {
    display: flex;
    gap: var(--spacing-sm);
}

.reviewer-chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-button);
    font-size: 13px;
    font-family: var(--font-family);
    color: var(--dark-gray);
    transition: border-color 0.2s;
}

.reviewer-chat-input:focus {
    outline: none;
    border-color: var(--deep-purple);
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.12);
}

.reviewer-chat-send {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-button);
    background: var(--deep-purple);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}

.reviewer-chat-send:hover {
    background: #5B21B6;
}

.reviewer-chat-send:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
}

/* ============================================================
   ENGAGEMENT PAGE (added from main — missing in sfm_ux)
   ============================================================ */

/* --- Hero Banner --- */
.engagement-hero {
    background: linear-gradient(135deg, #2d3748 0%, #6f42c1 100%);
    padding: 56px 48px 40px;
    position: relative;
    overflow: hidden;
}
.engagement-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}
.engagement-hero-inner { position: relative; max-width: 900px; }
.engagement-draft-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 16px;
}
.engagement-hero-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 42px;
    font-weight: 400;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.1;
}
.engagement-hero-org {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 28px;
    color: rgba(255,255,255,0.75);
    margin: 0 0 12px;
}
.engagement-hero-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.55);
    margin: 0 0 20px;
    letter-spacing: 0.03em;
}
.engagement-hero-meta {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.engagement-hero-sep { color: rgba(255,255,255,0.3); }
.engagement-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.engagement-hero-btn {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.engagement-hero-btn:hover { background: rgba(255,255,255,0.18); }

/* --- Sticky TOC Nav --- */
.engagement-toc {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid #E9ECEF;
    display: flex;
    gap: 0;
    padding: 0 48px;
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.engagement-toc::-webkit-scrollbar { display: none; }
.engagement-toc-link {
    font-size: 13px;
    font-weight: 500;
    color: #6C757D;
    text-decoration: none;
    padding: 14px 16px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.engagement-toc-link:hover { color: #343A40; }
.engagement-toc-link.active { color: #A100FF; border-bottom-color: #A100FF; }
.engagement-toc-link.toc-placeholder { opacity: 0.45; cursor: default; pointer-events: none; }

/* --- Sections --- */
.engagement-sections { padding: 0 0 64px; }
.engagement-section {
    display: flex;
    gap: 32px;
    padding: 48px 48px 40px;
    border-bottom: 1px solid #F1F3F5;
}
.engagement-section-placeholder { opacity: 0.5; }
.engagement-section-accent {
    flex: 0 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4px;
}
.engagement-section-num {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 22px;
    color: #A100FF;
    line-height: 1;
    margin-bottom: 12px;
}
.engagement-section-accent::after {
    content: '';
    flex: 1;
    width: 1px;
    background: repeating-linear-gradient(to bottom, #dee2e6 0px, #dee2e6 4px, transparent 4px, transparent 8px);
    min-height: 32px;
}
.engagement-section-body { flex: 1; min-width: 0; }
.engagement-section-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 26px;
    font-weight: 400;
    color: #212529;
    margin: 0 0 6px;
}
.engagement-section-subtitle { font-size: 14px; color: #6C757D; margin: 0 0 28px; }
.engagement-coming-soon { font-size: 14px; color: #ADB5BD; font-style: italic; }

/* --- Section 05: Agent Cards Grid --- */
.engagement-agents-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 1100px) { .engagement-agents-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px)  { .engagement-agents-grid { grid-template-columns: 1fr; } }

.engagement-agent-card {
    border: 1.5px solid rgba(167, 139, 250, 0.30);
    border-radius: var(--radius-card-apple);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.35s var(--ease-apple), transform 0.35s var(--ease-apple), border-color 0.3s;
    background: var(--white);
    box-shadow: var(--shadow-card-apple);
    border-top: 3px solid var(--agent-color, #A100FF);
}
.engagement-agent-card:hover {
    box-shadow: var(--shadow-card-hover-apple);
    transform: translateY(-1px);
}
.engagement-agent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    gap: 12px;
}
.engagement-agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--gradient-atlas);
    flex-shrink: 0;
    transition: transform 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}
.engagement-agent-card:hover .engagement-agent-avatar {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.engagement-agent-avatar.atlas   { background: var(--gradient-atlas); }
.engagement-agent-avatar.echo    { background: var(--gradient-echo); }
.engagement-agent-avatar.writer  { background: var(--gradient-writer); }
.engagement-agent-avatar.sage    { background: var(--gradient-sage); }
.engagement-agent-avatar.beacon  { background: var(--gradient-beacon); }
.engagement-agent-avatar.connect { background: var(--gradient-connect); }
.engagement-agent-avatar.reviewer { background: var(--gradient-reviewer); }
.engagement-agent-name-group { flex: 1; min-width: 0; }
.engagement-agent-name { font-size: 14px; font-weight: 600; color: var(--dark-gray); }
.engagement-agent-role { font-size: 12px; color: var(--medium-gray); margin-top: 1px; }

/* SVG Progress Ring */
.engagement-ring-wrap {
    flex-shrink: 0;
    position: relative;
    width: 52px;
    height: 52px;
}
.engagement-ring-wrap svg {
    transform: rotate(-90deg);
}
.engagement-ring-track { fill: none; stroke: rgba(0,0,0,0.07); stroke-width: 4; }
.engagement-ring-fill {
    fill: none;
    stroke: var(--agent-color, #A100FF);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}
.engagement-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    line-height: 1.1;
    text-align: center;
}

.engagement-agent-deliverables {
    padding: 0 16px 12px;
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.engagement-agent-deliverable-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: #495057;
}
.engagement-deliverable-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #DEE2E6;
}
.engagement-deliverable-dot.done { background: #28A745; }
.engagement-agent-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(248, 250, 252, 0.8);
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 12px;
    color: var(--medium-gray);
}
.engagement-agent-footer-count { font-weight: 600; color: var(--dark-gray); }

/* Reviewer Bar */
.engagement-reviewer-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1.5px solid rgba(167, 139, 250, 0.30);
    border-top: 3px solid var(--agent-color, #6F42C1);
    border-radius: var(--radius-card-apple);
    background: var(--white);
    box-shadow: var(--shadow-card-apple);
    cursor: pointer;
    transition: box-shadow 0.35s var(--ease-apple), transform 0.35s var(--ease-apple);
}
.engagement-reviewer-bar:hover {
    box-shadow: var(--shadow-card-hover-apple);
    transform: translateY(-1px);
}
.engagement-reviewer-bar-info { flex: 1; min-width: 0; }
.engagement-reviewer-bar-name { font-size: 14px; font-weight: 600; color: var(--dark-gray); }
.engagement-reviewer-bar-desc { font-size: 12px; color: var(--medium-gray); margin-top: 2px; }
.engagement-reviewer-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 10px;
    background: #F1F3F5;
    color: #6C757D;
}
.engagement-reviewer-status.working { background: #FFF3CD; color: #856404; }
.engagement-reviewer-status.completed { background: rgba(111,66,193,0.1); color: #6F42C1; }

/* ============================================================
   ENGAGEMENT MODALS (added from main — missing in sfm_ux)
   ============================================================ */
.eng-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    backdrop-filter: blur(2px);
}
.eng-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 201;
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}
.eng-modal-wide { max-width: 760px; }
.eng-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #F1F3F5;
    flex-shrink: 0;
}
.eng-modal-title-group { display: flex; align-items: center; gap: 14px; }
.eng-modal-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: #fff;
    background: var(--agent-color, #A100FF);
    flex-shrink: 0;
}
.eng-modal-name { font-size: 18px; font-weight: 700; color: #212529; }
.eng-modal-role { font-size: 13px; color: #6C757D; margin-top: 2px; }
.eng-modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: #ADB5BD; line-height: 1; padding: 4px;
}
.eng-modal-close:hover { color: #495057; }
.eng-modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.eng-modal-loading { color: #6C757D; font-size: 14px; }

.eng-spec-md { font-size: 13px; color: #343A40; line-height: 1.65; }
.eng-spec-md h1, .eng-spec-md h2 { font-size: 14px; font-weight: 700; color: #A100FF; margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #F1F3F5; }
.eng-spec-md h3, .eng-spec-md h4 { font-size: 13px; font-weight: 600; color: #343A40; margin: 12px 0 4px; }
.eng-spec-md p { margin-bottom: 8px; }
.eng-spec-md ul, .eng-spec-md ol { padding-left: 18px; margin-bottom: 10px; }
.eng-spec-md li { margin-bottom: 3px; }
.eng-spec-md strong { color: #212529; }

.eng-spec-mission { font-size: 14px; color: #343A40; line-height: 1.65; margin-bottom: 24px; }
.eng-spec-section-title {
    font-size: 12px; font-weight: 700; letter-spacing: 0.07em;
    text-transform: uppercase; color: #A100FF; margin-bottom: 12px;
}
.eng-spec-deliverables-list { list-style: none; padding: 0; margin: 0 0 24px; }
.eng-spec-deliverables-list li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 7px 0; border-bottom: 1px solid #F8F9FA;
    font-size: 13px; color: #343A40;
}
.eng-spec-deliverables-list li::before {
    content: '\2192'; color: var(--agent-color, #A100FF);
    flex-shrink: 0; font-weight: 600;
}
.eng-spec-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
    background: rgba(161,0,255,0.08); color: #A100FF;
    border-radius: 10px; padding: 3px 10px;
    margin-bottom: 12px;
}
.eng-spec-principles-list { list-style: none; padding: 0; margin: 0; }
.eng-spec-principles-list li {
    font-size: 13px; color: #495057;
    padding: 5px 0 5px 16px;
    position: relative; line-height: 1.5;
    border-bottom: 1px solid #F8F9FA;
}
.eng-spec-principles-list li::before {
    content: '\00B7'; position: absolute; left: 4px;
    color: #A100FF; font-size: 18px; line-height: 1.1;
}

/* DCC framework modal markdown rendering */
.eng-framework-md h1, .eng-framework-md h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    color: #212529;
}
.eng-framework-md h3 { color: #495057; font-size: 15px; }
.eng-framework-md p, .eng-framework-md li { font-size: 14px; color: #495057; line-height: 1.65; }
.eng-framework-md table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 16px 0; }
.eng-framework-md th { background: #F8F9FA; padding: 8px 12px; text-align: left; font-weight: 600; }
.eng-framework-md td { padding: 7px 12px; border-bottom: 1px solid #F1F3F5; }
.eng-framework-md blockquote {
    border-left: 3px solid #A100FF; margin: 12px 0; padding: 8px 16px;
    background: rgba(161,0,255,0.04); color: #6C757D; font-style: italic;
}

/* --- Print mode (engagement) --- */
@media print {
    body.printing-engagement .top-nav,
    body.printing-engagement .engagement-toc,
    body.printing-engagement .engagement-hero-actions,
    body.printing-engagement .engagement-draft-pill,
    body.printing-engagement .engagement-section-placeholder,
    body.printing-engagement .eng-modal,
    body.printing-engagement .eng-modal-backdrop { display: none !important; }
    body.printing-engagement .engagement-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body.printing-engagement .engagement-agent-card { break-inside: avoid; }
}
