/* =========================================
   SafeGTM — Design System v2
   Light-first with dark/system theme support
   ========================================= */

/* ── Light Theme (Default) — SafePaaS Brand ── */
:root {
  /* Surfaces — lavender gray page, white cards */
  --bg:             #F3F2F7;
  --bg-card:        #ffffff;
  --bg-card-hover:  #eceaf2;
  --bg-input:       #ffffff;
  --bg-sidebar:     #ffffff;
  --bg-topbar:      #ffffff;
  --bg-overlay:     rgba(0, 0, 0, 0.35);
  --bg-code:        #eceaf2;

  /* Borders */
  --border:         rgba(0, 0, 0, 0.10);
  --border-light:   rgba(0, 0, 0, 0.20);
  --border-focus:   #58889D;

  /* Text */
  --text:           #000000;
  --text-secondary: #333333;
  --text-muted:     rgba(0, 0, 0, 0.55);
  --text-dim:       rgba(0, 0, 0, 0.35);
  --text-inverse:   #ffffff;

  /* Brand — Steel Blue (trust/authority) */
  --primary:        #58889D;
  --primary-hover:  #56859C;
  --primary-bg:     rgba(88, 136, 157, 0.08);
  --primary-border: rgba(88, 136, 157, 0.25);

  /* Accent — Olive Green (CTA/action) */
  --accent:         #80A14A;
  --accent-hover:   #97B657;
  --accent-bg:      rgba(128, 161, 74, 0.08);

  /* Semantic */
  --success:        #80A14A;
  --success-bg:     rgba(128, 161, 74, 0.08);
  --success-border: rgba(128, 161, 74, 0.25);
  --warning:        #E8A838;
  --warning-bg:     rgba(232, 168, 56, 0.08);
  --warning-border: rgba(232, 168, 56, 0.25);
  --danger:         #CC3366;
  --danger-bg:      rgba(204, 51, 102, 0.08);
  --danger-border:  rgba(204, 51, 102, 0.25);
  --info:           #58889D;
  --info-bg:        rgba(88, 136, 157, 0.08);
  --info-border:    rgba(88, 136, 157, 0.25);

  /* AI / Outreach Manager — Purple (reserved for AI-authored surfaces) */
  --purple:         #8050c8;
  --purple-hover:   #7040b8;
  --purple-bg:      rgba(128, 80, 200, 0.08);
  --purple-border:  rgba(128, 80, 200, 0.25);

  /* Layout */
  --sidebar-w:      248px;
  --topbar-h:       56px;
  /* SGM-196: assistant drawer width — consumed by .assistant-drawer width
     and body.assistant-pinned padding-right so they stay in sync. JS
     keeps this in lockstep with the user's drag-resized width. */
  --assistant-width: 420px;

  /* Shape — SafePaaS radius scale */
  --radius:         8px;
  --radius-lg:      20px;
  --radius-xl:      35px;
  --radius-full:    999px;

  /* Elevation — clean single-layer shadows */
  --shadow-xs:      0 0 6px 0 rgba(0, 0, 0, 0.08);
  --shadow:         0 0 10px 0 rgba(0, 0, 0, 0.10);
  --shadow-md:      0 2px 12px 0 rgba(0, 0, 0, 0.12);
  --shadow-lg:      0 4px 20px 0 rgba(0, 0, 0, 0.12);
  --shadow-xl:      0 8px 30px 0 rgba(0, 0, 0, 0.16);

  /* Motion */
  --transition:     0.15s ease;
  --transition-slow: 0.25s ease;
}

/* ── Dark Theme — SafePaaS Brand (Navy) ────── */
[data-theme="dark"] {
  --bg:             #1A1A2E;
  --bg-card:        #222240;
  --bg-card-hover:  #2A2A4A;
  --bg-input:       #2A2A4A;
  --bg-sidebar:     #222240;
  --bg-topbar:      #222240;
  --bg-overlay:     rgba(0, 0, 0, 0.6);
  --bg-code:        #2A2A4A;

  --border:         rgba(243, 242, 247, 0.10);
  --border-light:   rgba(243, 242, 247, 0.20);
  --border-focus:   #7ABED6;

  --text:           #F3F2F7;
  --text-secondary: #d5d4e0;
  --text-muted:     rgba(243, 242, 247, 0.55);
  --text-dim:       rgba(243, 242, 247, 0.35);

  --primary:        #7ABED6;
  --primary-hover:  #58889D;
  --primary-bg:     rgba(122, 190, 214, 0.10);
  --primary-border: rgba(122, 190, 214, 0.25);

  --accent:         #97B657;
  --accent-hover:   #80A14A;
  --accent-bg:      rgba(151, 182, 87, 0.10);

  --success:        #97B657;
  --success-bg:     rgba(151, 182, 87, 0.10);
  --success-border: rgba(151, 182, 87, 0.25);
  --warning:        #F0B84A;
  --warning-bg:     rgba(240, 184, 74, 0.10);
  --warning-border: rgba(240, 184, 74, 0.25);
  --danger:         #E05588;
  --danger-bg:      rgba(224, 85, 136, 0.10);
  --danger-border:  rgba(224, 85, 136, 0.25);
  --info:           #7ABED6;
  --info-bg:        rgba(122, 190, 214, 0.10);
  --info-border:    rgba(122, 190, 214, 0.25);

  --purple:         #A884E0;
  --purple-hover:   #8050c8;
  --purple-bg:      rgba(168, 132, 224, 0.10);
  --purple-border:  rgba(168, 132, 224, 0.25);

  --shadow-xs:      0 0 6px 0 rgba(0, 0, 0, 0.20);
  --shadow:         0 0 10px 0 rgba(0, 0, 0, 0.25);
  --shadow-md:      0 2px 12px 0 rgba(0, 0, 0, 0.30);
  --shadow-lg:      0 4px 20px 0 rgba(0, 0, 0, 0.35);
  --shadow-xl:      0 8px 30px 0 rgba(0, 0, 0, 0.40);
}

/* System preference fallback (when theme="system") */
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg:             #1A1A2E;
    --bg-card:        #222240;
    --bg-card-hover:  #2A2A4A;
    --bg-input:       #2A2A4A;
    --bg-sidebar:     #222240;
    --bg-topbar:      #222240;
    --bg-overlay:     rgba(0, 0, 0, 0.6);
    --bg-code:        #2A2A4A;
    --border:         rgba(243, 242, 247, 0.10);
    --border-light:   rgba(243, 242, 247, 0.20);
    --border-focus:   #7ABED6;
    --text:           #F3F2F7;
    --text-secondary: #d5d4e0;
    --text-muted:     rgba(243, 242, 247, 0.55);
    --text-dim:       rgba(243, 242, 247, 0.35);
    --primary:        #7ABED6;
    --primary-hover:  #58889D;
    --primary-bg:     rgba(122, 190, 214, 0.10);
    --primary-border: rgba(122, 190, 214, 0.25);
    --accent:         #97B657;
    --accent-hover:   #80A14A;
    --accent-bg:      rgba(151, 182, 87, 0.10);
    --success:        #97B657;
    --success-bg:     rgba(151, 182, 87, 0.10);
    --success-border: rgba(151, 182, 87, 0.25);
    --warning:        #F0B84A;
    --warning-bg:     rgba(240, 184, 74, 0.10);
    --warning-border: rgba(240, 184, 74, 0.25);
    --danger:         #E05588;
    --danger-bg:      rgba(224, 85, 136, 0.10);
    --danger-border:  rgba(224, 85, 136, 0.25);
    --info:           #7ABED6;
    --info-bg:        rgba(122, 190, 214, 0.10);
    --info-border:    rgba(122, 190, 214, 0.25);
    --purple:         #A884E0;
    --purple-hover:   #8050c8;
    --purple-bg:      rgba(168, 132, 224, 0.10);
    --purple-border:  rgba(168, 132, 224, 0.25);
    --shadow-xs:      0 0 6px 0 rgba(0, 0, 0, 0.20);
    --shadow:         0 0 10px 0 rgba(0, 0, 0, 0.25);
    --shadow-md:      0 2px 12px 0 rgba(0, 0, 0, 0.30);
    --shadow-lg:      0 4px 20px 0 rgba(0, 0, 0, 0.35);
    --shadow-xl:      0 8px 30px 0 rgba(0, 0, 0, 0.40);
  }
}

/* ── Auth FOUC Prevention ──────────────────── */
/* When token exists (data-auth="pending"), hide login & sidebar until JS confirms */
[data-auth="pending"] #login-page { display: none !important; }
[data-auth="none"] #sidebar,
[data-auth="none"] #topbar { display: none !important; }

/* Auth loading indicator — centered spinner while verifying session */
#auth-loader {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  z-index: 9999;
}
[data-auth="pending"] #auth-loader { display: flex; }
[data-auth="pending"] #auth-loader .spinner { width: 32px; height: 32px; }

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

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100%;
  font-family: 'Nacelle', 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition-slow), color var(--transition-slow);
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.875rem; }
img { max-width: 100%; }

/* ── Layout ────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-slow), background var(--transition-slow);
  z-index: 100;
  overflow: hidden;
}
#sidebar.collapsed {
  transform: translateX(-100%);
  position: absolute;
  height: 100%;
}

.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
/* SGM-230: in-sidebar collapse toggle. Quiet (transparent border) until
   hover — same visual register as Notion / Linear / Claude Desktop. The
   floating-hamburger over <main> handles re-expand when collapsed. */
.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  margin-left: auto;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.sidebar-collapse-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-secondary);
}
.sidebar-collapse-icon { width: 14px; height: 14px; }
.brand-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.brand-logo-white { display: none; }
[data-theme="dark"] .brand-logo-color { display: none !important; }
[data-theme="dark"] .brand-logo-white { display: block !important; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .brand-logo-color { display: none !important; }
  [data-theme="system"] .brand-logo-white { display: block !important; }
}
/* brand-text removed — logo-only sidebar header */

.nav-links {
  list-style: none;
  padding: 8px;
  flex: 1;
  overflow-y: auto;
}
.nav-links li { margin-bottom: 1px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.nav-link:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}
.nav-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

/* Nav section labels */
.nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  opacity: 0.7;
  list-style: none;
  margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; }
.nav-section-toggle {
  cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
}
.nav-section-toggle:hover { opacity: 1; }
.nav-toggle-icon {
  font-size: 8px;
  transition: transform 0.2s;
  display: inline-block;
}
.nav-section-collapsed .nav-toggle-icon {
  transform: rotate(-90deg);
}

.badge {
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: auto;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
.badge.hidden { display: none; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  /* SGM-226 followup: positioned ancestor for the .sidebar-user-menu popup
     which uses position: absolute + bottom: calc(100% + 6px). Without this
     the popup positions relative to viewport (because no nearer ancestor
     has position) and renders off-screen above the page. */
  position: relative;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.user-avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.btn-logout {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 2px 6px; margin-left: auto; border-radius: var(--radius);
}
.btn-logout:hover { color: var(--danger); background: var(--bg-input); }
.user-avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-bg); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 600; flex-shrink: 0;
}

/* SGM-225: Sidebar bottom — Claude Desktop pattern.
   Identity trigger (left, opens user menu above) + theme button
   (right, cycles light/dark/system). The .profile-menu and .theme-toggle
   from the topbar are gone; their semantics moved here. */
.sidebar-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.sidebar-identity-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  font-family: inherit;
  text-align: left;
  color: var(--text-secondary);
  min-width: 0;
  transition: background var(--transition);
}
.sidebar-identity-trigger:hover { background: var(--bg-card-hover); }
.sidebar-identity-trigger.active {
  background: var(--bg-card-hover);
  border-color: var(--border);
}
.sidebar-identity-name {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-identity-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.sidebar-identity-trigger.active .sidebar-identity-chevron {
  transform: rotate(180deg);
}
/* SGM-226 followup: shared icon-button shape used by the bell + theme buttons
   in the sidebar bottom row. Replaces the per-element .sidebar-theme-btn. */
.sidebar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}
.sidebar-icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}
.sidebar-icon-btn-icon { width: 14px; height: 14px; }
.sidebar-icon-btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  background: var(--danger);
  color: var(--text-inverse);
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-card);
}
.sidebar-icon-btn-badge.hidden { display: none; }
/* Back-compat alias — old class name still referenced in a few places. */
.sidebar-theme-btn { /* deprecated; use .sidebar-icon-btn */ }
.sidebar-theme-btn-icon { width: 14px; height: 14px; }

/* User menu popup — anchored above the sidebar identity row */
.sidebar-user-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 50;
}
.sidebar-user-menu.hidden { display: none; }
.sidebar-user-menu-email {
  padding: 8px 10px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-family-mono, ui-monospace, 'JetBrains Mono', 'SF Mono', monospace);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
}
.sidebar-user-menu-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.sidebar-user-menu-item:hover .sidebar-user-menu-icon { color: var(--primary); }
.sidebar-user-menu-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px -2px;
}

/* Main */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;       /* anchor for floating chrome + hamburger */
}

/* SGM-226: breadcrumb wayfinding component.
   Replaces the parent-context signal the removed topbar #page-title used to
   provide. Sits at the top of detail pages above the page heading. */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.breadcrumb-item {
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.breadcrumb-item:hover {
  color: var(--primary);
  background: var(--primary-bg);
}
.breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 600;
  /* Truncate long entity names so a breadcrumb can't push the action row off
     the right edge on narrow viewports. */
  max-width: 60ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb-sep {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* SGM-226 followup: floating-chrome cluster removed (bell moved to a single
   floating button, theme stays in sidebar bottom, test mode = banner). */
.floating-chrome,
.floating-chrome-pill,
.floating-chrome-pill-dot,
.floating-chrome-btn,
.floating-chrome-btn-icon,
.floating-chrome-badge { display: none; }

/* SGM-226 followup: bell back at top-right of viewport. Single 32px button
   (much smaller than the prior cluster) so action rows only need ~52px of
   right-padding to clear it. Position: absolute relative to #main means it
   sits inside the content viewport, above content's top padding zone. */
.floating-bell {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
  z-index: 50;
  transition: background var(--transition);
}
.floating-bell:hover { background: var(--bg-card-hover); }
.floating-bell.hidden { display: none; }
.floating-bell-icon { width: 14px; height: 14px; }
.floating-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  background: var(--danger);
  color: var(--text-inverse);
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-card);
}
.floating-bell-badge.hidden { display: none; }

/* SGM-226 followup: page action rows reserve right-side space for the
   floating bell. Cluster sits at right: 16px and is 32px wide, so 56px is
   enough horizontal room. Applied to common headers via the shared
   .section-header class + the contacts pagebar. Per-page detail headers
   that render their own inline header div should add the same padding. */
.section-header,
.contact-pagebar {
  padding-right: 56px;
}

/* SGM-226 followup: thin test-mode banner at top of content. Only renders
   when server_mode === 'test'. Full-width strip; click to switch in
   Settings. Replaces the floating warning pill. */
.test-mode-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-border);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.test-mode-banner.hidden { display: none; }
.test-mode-banner:hover { background: color-mix(in srgb, var(--warning) 14%, transparent); }
.test-mode-banner-icon { width: 14px; height: 14px; color: var(--warning); flex-shrink: 0; }
.test-mode-banner-text strong { color: var(--warning); font-weight: 700; }

.floating-hamburger {
  position: absolute;
  top: 10px;        /* SGM-226: align to floating-chrome top */
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
  z-index: 50;
  transition: background var(--transition);
}
.floating-hamburger:hover { background: var(--bg-card-hover); }
.floating-hamburger.hidden { display: none; }

/* Notifications slide-out panel — right edge of viewport.
   Replaces the prior dropdown anchored to the bell. */
.notif-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.10);
  z-index: 60;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.notif-panel.hidden { display: none; }
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.notif-panel-body {
  flex: 1;
  overflow-y: auto;
}
.notif-panel-body .notif-empty { padding: 24px 8px; text-align: center; }

#content {
  flex: 1;
  overflow-y: auto;
  /* SGM-226 followup: 56px topbar removal goal restored — bell + theme
     moved into sidebar bottom, no floating cluster overlapping content,
     so content padding-top returns to 16px. Test-mode banner sits above
     #content (when shown), so it adds its own height without forcing
     content to reserve space when in production. */
  padding: 16px 24px 24px;
  transition: background var(--transition-slow);
}
/* Login page fills entire viewport — break out of #content padding + overflow */
#login-page {
  margin: -16px -24px -24px -24px;
  padding: 0;
  overflow: hidden;
}

/* ── Buttons — SafePaaS Brand ─────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  box-shadow: var(--shadow-xs);
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled, .btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--accent, var(--success));
  border-color: var(--accent, var(--success));
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-primary:hover {
  background: var(--accent-hover, #97B657);
  border-color: var(--accent-hover, #97B657);
}
.btn-primary:active {
  background: #6E8E3E;
  transform: scale(0.97);
}
.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.btn-success:hover { background: var(--accent-hover, #97B657); border-color: var(--accent-hover, #97B657); }
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
.btn-danger:hover { opacity: 0.9; }
.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: white;
}
.btn-warning:hover { opacity: 0.9; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; text-transform: none; letter-spacing: normal; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  box-shadow: none;
}
.btn-outline-primary {
  background: transparent;
  border: 2px solid var(--accent, var(--success));
  color: var(--accent, var(--success));
  text-transform: none;
  letter-spacing: normal;
}
.btn-outline-primary:hover {
  background: var(--accent, var(--success));
  color: white;
}
.btn-outline-danger {
  background: transparent;
  border-color: var(--danger-border);
  color: var(--danger);
  text-transform: none;
  letter-spacing: normal;
}
.btn-outline-danger:hover {
  background: var(--danger-bg);
}
/* Button loading state */
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}

/* ── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
input[type="url"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: 0.875rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
input::placeholder, textarea::placeholder {
  color: var(--text-dim);
}
textarea { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  width: auto;
  min-width: 160px;
  padding: 7px 12px;
}

/* ── SGM-234: signal reader pane (feed-reader UX) ─────────────────────
   Linear/Gmail-style split. Container has .signals-split which is a
   flex row holding the list area + a hidden reader pane. When the
   parent container has .has-reader-open, the list shrinks to 40% and
   the reader fades in at 60%. */

.signals-split {
  display: flex;
  gap: 0;
  align-items: stretch;
}
.signals-list-area {
  flex: 1 1 100%;
  min-width: 0;
  transition: flex-basis var(--transition);
}
.signal-reader-pane {
  flex: 0 0 0;
  width: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
  transition: flex-basis var(--transition), width var(--transition), padding var(--transition);
  padding: 0;
  position: relative;
  font-family: var(--font-family-app);
}
.has-reader-open .signals-list-area {
  flex: 0 0 40%;
}
.has-reader-open .signal-reader-pane {
  /* SGM-234 followup: flex column so header + tabs stay fixed, middle
     scrolls, and the actions footer stays sticky at the bottom of the
     pane. position: sticky pins the whole pane within its scroll
     container so it doesn't disappear as the page scrolls past. */
  flex: 0 0 60%;
  width: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  /* Just enough headroom for the test-mode banner; nothing more.
     Previous (100vh - 240px) was too aggressive — content got cut. */
  max-height: calc(100vh - 80px);
  overflow: hidden; /* outer pane never scrolls; inner area does */
}
@media (max-width: 1100px) {
  .has-reader-open .signals-list-area { flex: 0 0 35%; }
  .has-reader-open .signal-reader-pane { flex: 0 0 65%; }
}

/* Header sits above the tabs, never scrolls */
.reader-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.reader-header .reader-meta-line { margin-bottom: 0; }

/* Tabs row */
.reader-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}
.reader-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px; /* overlap the bottom border so active tab "owns" it */
  transition: color var(--transition), border-color var(--transition);
}
.reader-tab:hover { color: var(--text-secondary); }
.reader-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Scrollable middle */
.reader-scroll-area {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 28px 16px;
  min-height: 0; /* required for flex children with overflow */
}
.reader-tab-panel.hidden { display: none; }

/* Sticky footer: actions row always visible at the bottom of the pane */
.reader-footer {
  flex-shrink: 0;
  padding: 12px 28px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.reader-footer .reader-actions-row {
  margin: 0;
  padding: 0;
  border-top: none;
}

/* Selected row highlight in the table */
tr.signal-row-selected {
  background: var(--primary-bg) !important;
  box-shadow: inset 3px 0 0 0 var(--primary);
}

/* Reader chrome */
.reader-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
  transition: background var(--transition), color var(--transition);
}
.reader-close:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.reader-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.reader-error {
  padding: 24px;
  text-align: center;
}

.reader-meta-line {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding-right: 36px;
}
.reader-meta-line strong { color: var(--text-secondary); font-weight: 600; }

/* Status pills inside the reader — same visual language as the table */
.reader-pill {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.reader-pill-pending   { background: var(--warning-bg); color: var(--warning); }
.reader-pill-failed    { background: var(--danger-bg);  color: var(--danger); }
.reader-pill-completed { background: var(--success-bg); color: var(--success); }
.reader-pill-default   { background: var(--bg-card-hover); color: var(--text-muted); }

.reader-headline {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
  margin: 8px 0 12px;
  max-width: 60ch;
}
.reader-byline {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.55;
}
.reader-byline strong { color: var(--text-secondary); font-weight: 600; }
.reader-byline a, .reader-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.reader-byline a:hover, .reader-link:hover { text-decoration: underline; }

.reader-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 65ch;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.reader-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}
.reader-tag {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--bg-card-hover);
  color: var(--text-muted);
}
.reader-mono-tag {
  font-family: var(--font-family-mono);
  font-size: 11px;
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-secondary);
}

/* SEC EDGAR formatting */
.reader-form-row { display: flex; gap: 14px; align-items: center; margin: 8px 0 12px; flex-wrap: wrap; }
.reader-form-pill {
  display: inline-flex;
  padding: 4px 12px;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--primary-border);
  border-radius: 6px;
  font-family: var(--font-family-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.reader-form-company { font-size: 14px; color: var(--text-muted); }

/* ARTW tech stack table */
.reader-tech-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0 16px;
  background: var(--bg-card-hover);
  border-radius: var(--radius);
  overflow: hidden;
}
.reader-tech-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.reader-tech-table td {
  padding: 8px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.reader-tech-table .reader-tech-vendor { font-weight: 600; color: var(--text); }
.reader-tech-cat-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 14px 0 4px;
}

/* Pixel-style stat rows */
.reader-pixel-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card-hover);
  border-radius: var(--radius);
  font-size: 12px;
  margin: 6px 0;
}
.reader-pixel-stat-label { color: var(--text-muted); min-width: 120px; }
.reader-pixel-stat-value { font-weight: 600; color: var(--text); flex: 1; min-width: 0; word-break: break-all; }
.reader-progress-bar { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.reader-progress-fill { height: 100%; background: var(--primary); transition: width var(--transition); }

/* Score change visualization */
.reader-score-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--bg-card-hover);
  border-radius: var(--radius);
  margin: 8px 0 16px;
}
.reader-score-num { font-family: var(--font-family-mono); font-size: 24px; font-weight: 700; }
.reader-score-up    { color: var(--success); }
.reader-score-down  { color: var(--danger); }
.reader-score-arrow { color: var(--text-muted); font-size: 18px; }

.reader-stat-card {
  background: var(--bg-card-hover);
  padding: 12px;
  border-radius: var(--radius);
  text-align: center;
}
.reader-stat-num {
  font-family: var(--font-family-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.reader-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

/* AI section */
.reader-ai-section {
  background: var(--primary-bg);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 16px 0;
}
.reader-ai-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.reader-ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.reader-ai-reasoning { font-size: 12px; color: var(--text-secondary); margin-top: 8px; line-height: 1.55; font-style: italic; }

/* Processing logs timeline */
.reader-logs-section { margin: 18px 0; }
.reader-logs-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.reader-logs-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
  border-left: 1px solid var(--border);
}
.reader-logs-item {
  position: relative;
  padding: 4px 0 12px 16px;
}
.reader-logs-item:last-child { padding-bottom: 0; }
.reader-logs-dot {
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--primary);
}
.reader-logs-text { font-size: 12px; }
.reader-logs-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.reader-logs-event { font-weight: 600; color: var(--text); }
.reader-logs-ts { font-family: var(--font-family-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.reader-logs-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

/* Actions row */
.reader-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: inherit;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.reader-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.reader-btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.reader-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--text-inverse);
}

/* Raw data toggle */
.reader-raw-details { margin-top: 14px; }
.reader-raw-summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 6px 0;
  list-style: none;
}
.reader-raw-summary::-webkit-details-marker { display: none; }
.reader-raw-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform var(--transition);
}
.reader-raw-details[open] .reader-raw-summary::before { content: "▾ "; }
.reader-raw-data {
  background: var(--bg-code);
  padding: 12px;
  border-radius: var(--radius);
  font-family: var(--font-family-mono);
  font-size: 11px;
  color: var(--text-secondary);
  overflow-x: auto;
  line-height: 1.5;
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre;
}

/* ── End SGM-234 reader pane ──────────────────────────────────────── */

/* ── SGM-232: cross-page list-page header ────────────────────────────
   Compact title row + diagnostic strip. Replaces the per-page stat-card
   grid. Same shape as the contacts SGM-224 redesign (the .contact-*
   classes still exist for backwards compat; .list-* is the new generic
   name shared across contacts / accounts / prospects / signals / etc.) */

.list-pagebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 2px;
}

/* SGM-309 PR-F: Campaigns list tabs (Active / Drafts / Archived) */
.camp-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 12px 0 0;
}
.camp-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  position: relative;
  top: 1px;
}
.camp-tab:hover { background: var(--bg-card-hover); color: var(--text-secondary); }
.camp-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}
.camp-tab-count {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-family-mono);
}
.camp-tab.active .camp-tab-count {
  background: var(--primary-bg);
  color: var(--primary);
}
.list-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
}
.list-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.list-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: ui-monospace, 'JetBrains Mono', 'SF Mono', monospace;
}
.list-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.list-diag-strip {
  padding: 6px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.list-diag-strip strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.list-diag-sep {
  color: var(--text-dim);
}

/* ── SGM-231 follow-up: cross-page list-controls bar ─────────────────────
   Standard layout pattern for any list/table page (contacts, accounts,
   prospects, signals, etc.):
     [search]  [+Add filter] [+Add sort]  ...  [saved views right-aligned]
     [pills row below]
   Use these classes on any future list page to inherit the pattern. */

.list-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  position: relative; /* anchor for the FilterBuilder popovers */
}
.list-controls-search {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.list-controls-search:focus {
  outline: none;
  border-color: var(--border-focus);
}
.list-controls-filter {
  flex: 0 0 auto;
  position: relative; /* popover anchor */
}
.list-controls-filter .fb-row { margin-bottom: 0; }
.list-controls-saved-views {
  flex: 0 0 auto;
  margin-left: auto; /* right-align */
}
.list-controls-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
  min-height: 0;
}
.list-controls-pills:empty { display: none; }

/* ── Saved views (dropdown) — cross-page reusable ────────────────────
   Trigger button + popover menu. Pattern:
     [⌘ Views ▾]
     ┌─────────────────────┐
     │ ✓ Default — no filt │
     │ ─────────────────── │
     │   Tier 1 CFOs   🗑  │
     │   Hot leads     🗑  │
     │ ─────────────────── │
     │ + Save current...   │
     └─────────────────────┘
   HIG-friendly: explicit Default item replaces the toggle metaphor;
   trash icon for delete is visually distinct from the × symbol that
   humans read as "dismiss this filter". */

.list-views-wrap {
  position: relative;
  display: inline-block;
}

.list-views-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.list-views-trigger:hover,
.list-views-trigger.active {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}
.list-views-trigger-icon { width: 14px; height: 14px; color: var(--text-muted); }
.list-views-trigger-chevron {
  width: 14px; height: 14px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.list-views-trigger.active .list-views-trigger-chevron {
  transform: rotate(180deg);
}

.list-views-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 200;
  max-height: 420px;
  overflow-y: auto;
}

.list-views-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.list-views-item:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}
.list-views-item.active {
  background: var(--primary-bg);
  color: var(--primary);
}
.list-views-item-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--primary);
}
.list-views-item-text {
  flex: 1;
  min-width: 0;
}
.list-views-item-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-views-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}
.list-views-item-meta-inline {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.list-views-item-delete {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.list-views-item:hover .list-views-item-delete {
  opacity: 1;
}
.list-views-item-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}
.list-views-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.list-views-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--transition);
}
.list-views-action:hover { background: var(--primary-bg); }
.list-views-action-icon { width: 14px; height: 14px; }
/* ── End list-controls-row ──────────────────────────────────────────── */

/* ── SGM-231: FilterBuilder (shared filter+sort UI) ─────────────────────
   Generic styles — will be reused for accounts / prospects / signals
   when those pages adopt the same component. All values are tokens. */

.contact-filter-builder { margin-bottom: 14px; }

.fb-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
  position: relative;
}

.fb-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.fb-add-btn:hover {
  background: var(--primary-bg);
  border-style: solid;
  border-color: var(--primary);
}
.fb-icon { width: 12px; height: 12px; }

.fb-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 28px;
}
.fb-pills:empty { display: none; }

.fb-pills-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}

.fb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.fb-pill[data-fb-kind="sort"] {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(128, 161, 74, 0.25);
}
.fb-pill-field { font-weight: 700; }
.fb-pill-op {
  color: var(--text-muted);
  font-weight: 400;
  padding: 0 2px;
  font-size: 11px;
}
.fb-pill-value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
}
.fb-pill-x {
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
  transition: opacity var(--transition);
}
.fb-pill-x:hover { opacity: 1; }

.fb-clear-all {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 6px;
  font-family: inherit;
}
.fb-clear-all:hover { color: var(--text-secondary); }

/* ── Popover (field picker → operator + value) ── */
.fb-popover {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 12px;
  min-width: 320px;
  max-width: 380px;
  font-size: 12px;
  z-index: 200;
}

.fb-popover-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  margin-bottom: 8px;
}
.fb-popover-search:focus {
  outline: none;
  border-color: var(--border-focus);
}

.fb-popover-list { max-height: 360px; overflow-y: auto; }

.fb-popover-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 8px 4px 4px;
}

.fb-popover-item {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fb-popover-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}

.fb-popover-item-type {
  font-size: 9px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fb-popover-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.fb-popover-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.fb-popover-back {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fb-popover-back:hover {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
}

.fb-popover-row { margin-bottom: 10px; }
.fb-popover-row:last-of-type { margin-bottom: 0; }
.fb-popover-row-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.fb-popover-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
.fb-popover-row-flex {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fb-popover-select,
.fb-popover-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}
.fb-popover-select:focus,
.fb-popover-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.fb-input-pair {
  display: flex;
  gap: 8px;
  align-items: center;
}
.fb-input-pair .fb-popover-input { flex: 1; }

.fb-checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  background: var(--bg-input);
}
.fb-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.fb-checkbox-item input { cursor: pointer; }

.fb-quick-row {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.fb-quick-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.fb-quick-btn:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-border);
}

.fb-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.fb-popover-btn {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}
.fb-popover-btn:hover { background: var(--bg-card-hover); }
.fb-popover-btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.fb-popover-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
/* ── End SGM-231 FilterBuilder ─────────────────────────────────────── */

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Stat Cards ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.stat-card:hover {
  box-shadow: var(--shadow);
}
.stat-card .stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.stat-card .stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.stat-card.primary  { border-left: 3px solid var(--primary); }
.stat-card.success  { border-left: 3px solid var(--success); }
.stat-card.warning  { border-left: 3px solid var(--warning); }
.stat-card.danger   { border-left: 3px solid var(--danger); }
.stat-card.info     { border-left: 3px solid var(--info); }
.stat-card.primary .stat-value  { color: var(--primary); }
.stat-card.success .stat-value  { color: var(--success); }
.stat-card.warning .stat-value  { color: var(--warning); }
.stat-card.danger .stat-value   { color: var(--danger); }
.stat-card.info .stat-value     { color: var(--info); }

/* ── Tables ─────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
thead {
  background: var(--bg-card-hover);
}
th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
}
tbody tr {
  transition: background var(--transition);
}
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; }

/* Clickable table rows */
tr[data-action] { cursor: pointer; }
tr[data-action]:hover { background: var(--primary-bg); }

/* ── Status Pills ──────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  line-height: 1.6;
}
.pill-active, .pill-approved, .pill-completed, .pill-connected, .pill-running {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.pill-pending, .pill-waiting, .pill-draft {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.pill-failed, .pill-rejected, .pill-error, .pill-disconnected {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.pill-inactive, .pill-paused {
  background: var(--bg-card-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.pill-high   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.pill-medium { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.pill-low    { background: var(--info-bg);    color: var(--info);    border: 1px solid var(--info-border); }

/* ── Tier Badges ───────────────────────────── */
.tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
}
.tier-1 { background: var(--primary-bg); color: var(--primary); }
.tier-2 { background: var(--warning-bg); color: var(--warning); }
.tier-3 { background: var(--bg-card-hover); color: var(--text-muted); }

/* ── Score Bar ─────────────────────────────── */
.score-bar {
  width: 72px;
  height: 5px;
  background: var(--bg-card-hover);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── Progress Bar ─────────────────────────── */
.progress {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── Tabs ─────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ── AI Strategy Box ─────────────────────── */
.ai-box {
  background: rgba(128, 80, 200, 0.06);
  border: 1px solid rgba(128, 80, 200, 0.20);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
[data-theme="dark"] .ai-box {
  background: rgba(160, 120, 240, 0.08);
  border-color: rgba(160, 120, 240, 0.25);
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .ai-box {
    background: rgba(160, 120, 240, 0.08);
    border-color: rgba(160, 120, 240, 0.25);
  }
}
.ai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #8050c8;
  font-size: 0.875rem;
  margin-bottom: 8px;
}
[data-theme="dark"] .ai-header { color: #b794f4; }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] .ai-header { color: #b794f4; }
}
.ai-reasoning {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Campaign/Outreach UI Components ─────── */
/* SGM-158: three-mode taxonomy pills. Tokenised so dark mode flips automatically. */
.pill-apollosequence  { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-border); }
.pill-gtmsignaldriven { background: var(--purple-bg);  color: var(--purple);  border: 1px solid var(--purple-border); }
.pill-gtmmanual       { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
/* Legacy — kept for any stale rows before migration 083 runs (old 'gtm_managed' value). */
.pill-gtmmanaged      { background: var(--purple-bg);  color: var(--purple);  border: 1px solid var(--purple-border); }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.contact-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.8125rem; color: var(--text-inverse); flex-shrink: 0; }
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: 0.8125rem; }
.contact-title { font-size: 0.75rem; color: var(--text-muted); }
.seq-step { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 6px; border: 1px solid var(--border); background: var(--bg-input); font-size: 0.8125rem; }
.seq-day { font-weight: 700; color: var(--primary); min-width: 48px; }
.seq-channel { min-width: 24px; display: flex; align-items: center; gap: 4px; }
.seq-content { flex: 1; color: var(--text-secondary); }
.seq-status { min-width: 60px; text-align: right; }
.ch { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; font-size: 10px; color: var(--text-inverse); }
.ch-email { background: var(--primary); }
.ch-linkedin { background: #0a66c2; }
.ch-apollo { background: #6366f1; }
.collision { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.approval-split { display: grid; grid-template-columns: 280px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; min-height: 400px; }
.approval-split-list { background: var(--bg-card-hover); border-right: 1px solid var(--border); overflow-y: auto; }
.approval-split-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); }
.approval-split-item:hover { background: var(--bg-card); }
.approval-split-item.active { background: var(--bg-card); border-left: 3px solid var(--primary); }
.approval-split-editor { padding: 20px; overflow-y: auto; }
.approval-split-editor .form-group { margin-bottom: 16px; }
.email-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg-input); min-height: 200px; font-size: 0.875rem; line-height: 1.6; }
.email-preview[contenteditable] { outline: none; }
.email-preview[contenteditable]:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-bg); }

/* ── Grid Layouts ──────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 1024px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Detail View ───────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 24px;
  margin-bottom: 20px;
}
/* SGM-227: each grid cell needs min-width:0 to actually respect its
   column's 1fr — without it, long content forces the cell wider and
   bleeds into the next column. word-break/overflow-wrap then keeps
   long emails + multi-word titles inside their own cell. */
.detail-item {
  min-width: 0;
}
.detail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.detail-value {
  font-size: 0.875rem;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* ── Section Headers ───────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Empty State ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
}
.empty-state p { font-size: 0.875rem; }

/* ── Modal ─────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
#modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.2s ease;
}
/* SGM-320: AI compose modal needs more room for multi-paragraph descriptions */
#modal[data-flavor="ai-gen"] { max-width: 720px; }
/* SGM-427 (2026-05-13 19:35 IST): inbox preview modal — shows the
   recipient-side rendering with Gmail-style chrome around the 640px
   email canvas. 640 (email) + ~80 (sender info margins each side) +
   ~40 (modal padding) ≈ 800. Setting to 960px for a comfortable
   buffer + zoom room without dominating the viewport (90% width on
   1080px+ displays). */
#modal[data-flavor="inbox-preview"] { max-width: 960px; }
#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
#modal-header h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
#modal-body { padding: 24px; }
#modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Toast ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.3s ease;
}
.toast-success { background: var(--success); color: white; }
.toast-error   { background: var(--danger); color: white; }
.toast-info    { background: var(--primary); color: white; }
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Login — Split Layout ─────────────────── */
.login-split {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Left panel — brand gradient */
.login-brand-panel {
  flex: 1;
  background: linear-gradient(180deg, #96bfd0 0%, #58889D 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}
.login-brand-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
}
.login-brand-logo {
  height: 40px;
  width: auto;
  margin-bottom: 40px;
  opacity: 0.95;
}
.login-brand-headline {
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 20px 0;
}
.login-brand-sub {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin: 0 0 40px 0;
  font-weight: 400;
}
.login-brand-features {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9375rem;
  font-weight: 500;
}
.login-feature-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  font-size: 1rem;
  flex-shrink: 0;
}
.login-brand-footer {
  position: absolute;
  bottom: 30px;
  left: 60px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Right panel — form */
.login-form-panel {
  flex: 0 0 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  background: var(--bg);
}
.login-form-content {
  width: 100%;
  max-width: 380px;
}
.login-logo {
  margin-bottom: 30px;
}
.login-logo-img {
  height: 40px;
  width: auto;
}
.login-form-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 5px 0;
  color: var(--text);
  letter-spacing: -0.01em;
}
.login-form-content .text-muted { margin-bottom: 30px; }
.login-form-content .form-group { text-align: left; }
.login-form-content .btn-primary { margin-top: 10px; }
.remember-me {
  margin-top: -4px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-muted);
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
#google-signin-btn {
  display: flex;
  justify-content: center;
}

/* Login responsive — stack on mobile */
@media (max-width: 860px) {
  .login-split { flex-direction: column; }
  .login-brand-panel {
    padding: 40px 30px;
    min-height: auto;
  }
  .login-brand-headline { font-size: 1.75rem; }
  .login-brand-features { display: none; }
  .login-brand-footer { display: none; }
  .login-form-panel {
    flex: 1 1 auto;
    padding: 40px 30px;
  }
}

/* ── Utilities ─────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.8125rem; }
.text-error { color: var(--danger); font-size: 0.8125rem; margin-top: 12px; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.6875rem; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.nowrap { white-space: nowrap; }

/* ── Loading Spinner ───────────────────────── */
.loading {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* toggle-switch styles consolidated below (line ~1444) */

/* ── Code Editor ───────────────────────────── */
textarea.code-editor {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  min-height: 200px;
  resize: vertical;
  background: var(--bg-code);
  tab-size: 2;
}

/* ── Tab Bar ───────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-bar button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-bar button:hover { color: var(--text); }
.tab-bar button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ── Collapsible Sections ─────────────────── */
.app-category.collapsed .collapse-body { display: none; }
.app-category.collapsed .collapse-icon { transform: rotate(-90deg); }
.collapse-icon { font-size: 0.65rem; color: var(--text-muted); }

/* ── Pill Selector (Multi-Select) ──────────── */
.pill-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.pill-selector .pill-option {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  transition: all var(--transition);
  user-select: none;
}
.pill-selector .pill-option.selected {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary);
}
.pill-selector .pill-option:hover {
  border-color: var(--border-light);
}

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

/* ── Accordion (Details/Summary) ───────────── */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
details summary {
  padding: 12px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  background: var(--bg);
}
details summary:hover {
  color: var(--text);
  background: var(--bg-card-hover);
}
details summary::before {
  content: '›';
  font-size: 1rem;
  font-weight: 600;
  transition: transform var(--transition);
  width: 16px;
  text-align: center;
  color: var(--text-dim);
}
details[open] summary::before {
  transform: rotate(90deg);
}
details summary::-webkit-details-marker { display: none; }
details > div, details > pre, details > p {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* ── Pre / Code blocks ─────────────────────── */
pre {
  background: var(--bg-code);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

/* ── Confidence / Progress Bar ─────────────── */
.confidence-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-card-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.confidence-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ── Agent Cards Grid ──────────────────────── */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.agent-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Integration Cards Grid ────────────────── */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
/* ── Conversation History ──────────────────── */
.conversation-block {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.conversation-block.assistant {
  background: var(--primary-bg);
  border-left: 3px solid var(--primary);
}
.conversation-block.user {
  background: var(--bg);
  border-left: 3px solid var(--border-light);
}
.conversation-block .role-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── Email Preview (Approvals) ─────────────── */
.email-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 780px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.email-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.email-field {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  font-size: 0.8125rem;
}
.email-field-label {
  color: var(--text-dim);
  font-weight: 500;
  min-width: 60px;
  flex-shrink: 0;
}
.email-field-value {
  color: var(--text);
}
.email-subject {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}
.email-body {
  padding: 24px;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* ── Bar Chart ─────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 8px 0;
}
.bar-chart-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.bar-chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  transition: height 0.3s ease;
  min-height: 2px;
}
.bar-chart-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ── Page-level Action Bar ─────────────────── */
.page-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.page-action-bar h2 {
  font-size: 0.9375rem;
  font-weight: 600;
}

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

/* ── Focus Visible (Accessibility) ─────────── */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
  }
  #sidebar:not(.collapsed) {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  #content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .agents-grid,
  .integrations-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
}

/* ── Execution Timeline ───────────────────── */
.execution-timeline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.timeline-step {
  display: flex;
  gap: 14px;
  min-height: 56px;
}
.timeline-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 32px;
}
.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}
.timeline-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  min-height: 20px;
}
.timeline-completed .timeline-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.timeline-active .timeline-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  animation: pulse-ring 1.5s ease-in-out infinite;
}
.timeline-failed .timeline-dot {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88, 136, 157, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(88, 136, 157, 0); }
}
.timeline-content {
  padding-bottom: 16px;
  flex: 1;
  min-width: 0;
}
.timeline-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 32px;
}
.timeline-detail {
  font-size: 0.78rem;
  line-height: 1.5;
  margin-top: 2px;
}

/* ── Conversation blocks ─────────────────── */
.conversation-block {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.82rem;
  line-height: 1.6;
}
.conversation-block.user {
  background: var(--bg);
  border: 1px solid var(--border);
}
.conversation-block.assistant {
  background: color-mix(in srgb, var(--primary) 6%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
}
.role-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  color: var(--text-muted);
}

/* ── Status segmented control (SGM-599: contact Active/Inactive) ── */
.status-seg {
  display: inline-flex;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg-input);
}
.status-seg button {
  padding: 7px 18px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: none;
}
.status-seg button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.status-seg button.is-on[data-status="active"]   { background: var(--success-bg); color: var(--success); }
.status-seg button.is-on[data-status="inactive"] { background: var(--bg-code); color: var(--text-secondary); }

/* ── Toggle Switch ─────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Integration Card ─────────────────────── */
.integration-card-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
}
.integration-card-controls .toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.integration-card-controls .toggle-group .toggle-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.toggle-label-on  { color: var(--success); }
.toggle-label-off { color: var(--text-dim); }
.integration-card-controls .pill-selector {
  margin-top: 0;
  flex: 1;
  justify-content: flex-end;
}
.integration-card-controls .pill-selector .pill-option {
  font-size: 0.6875rem;
  padding: 3px 10px;
}
.pill-option.mode-auto.selected {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.pill-option.mode-approval.selected {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}
.integration-disabled { opacity: 0.5; }
.integration-disabled .integration-card-controls { pointer-events: none; opacity: 0.5; }

/* ── Type-Specific Integration Cards ─────── */
.intg-card {
  transition: border-color var(--transition), box-shadow var(--transition);
}
.intg-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.intg-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.intg-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.intg-card-meta {
  flex: 1;
  min-width: 0;
}
.intg-card-name {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.intg-card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}
.intg-card-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}
.intg-stat {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.intg-health {
  display: flex;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 8px;
}
.intg-card-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.intg-card-controls .toggle-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.intg-card-controls .toggle-group .toggle-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.intg-card-controls .pill-selector {
  margin-top: 0;
  flex: 1;
  justify-content: flex-end;
}
.intg-card-controls .pill-selector .pill-option {
  font-size: 0.6875rem;
  padding: 3px 10px;
}
.intg-disabled { opacity: 0.5; }
.intg-disabled .intg-card-controls { pointer-events: none; opacity: 0.5; }

/* ── Agent List ──────────────────────────── */
.agent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.agent-list-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-color: var(--primary);
}
.agent-list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.agent-list-info { flex: 1; min-width: 0; }
.agent-list-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-list-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.agent-list-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.agent-meta-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-muted);
}
.agent-meta-stat {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.agent-list-chevron {
  font-size: 1.2rem;
  color: var(--text-muted);
}

/* ── Agent Detail Header ─────────────────── */
.agent-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Agent Performance Bar ───────────────── */
.agent-perf-bar {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.agent-perf-item {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-right: 1px solid var(--border);
}
.agent-perf-item:last-child { border-right: none; }
.agent-perf-val {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.agent-perf-lbl {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Agent Capability Warnings ────────────── */
.agent-warnings {
  background: color-mix(in srgb, var(--warning) 8%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--border));
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.agent-warnings-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 6px;
}
.agent-warning-item {
  font-size: 0.78rem;
  color: var(--text);
  padding: 3px 0 3px 18px;
  position: relative;
}
.agent-warning-item::before {
  content: '\2022';
  position: absolute;
  left: 4px;
  color: var(--warning);
}

/* ── Agent Collapsible Sections ──────────── */
.agent-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.agent-section-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}
.agent-section-toggle:hover { background: var(--bg); }
.agent-section-icon { font-size: 1rem; }
.agent-section-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.agent-section-chevron {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.agent-section.collapsed .agent-section-chevron { transform: rotate(-90deg); }
.agent-section-body {
  padding: 0 18px 16px;
  transition: max-height 0.2s;
}
.agent-section.collapsed .agent-section-body {
  display: none;
}

/* ── Agent Forms ─────────────────────────── */
.agent-form-row {
  display: flex;
  gap: 14px;
  margin-bottom: 0;
}
.agent-form-field {
  margin-bottom: 12px;
}
.agent-form-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.agent-form-field input,
.agent-form-field textarea,
.agent-form-field select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.84rem;
  font-family: inherit;
}
.agent-form-field textarea { resize: vertical; }

/* ── Agent Prompt (view mode) ────────────── */
.agent-prompt {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text);
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Agent Prompt Editor (edit mode) ─────── */
.agent-prompt-editor {
  width: 100%;
  min-height: 200px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
}

/* ── Agent Checkbox Grid/List ────────────── */
.agent-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.agent-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.agent-checkbox-card:hover { background: var(--bg); }
.agent-checkbox-card.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--bg-card));
}
.agent-checkbox-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.agent-checkbox-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1rem;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .agent-list-meta { display: none; }
  .agent-perf-bar { flex-wrap: wrap; }
  .agent-perf-item { min-width: 33%; }
  .agent-checkbox-grid { grid-template-columns: 1fr; }
  .agent-form-row { flex-direction: column; gap: 0; }
}

/* ── Integration Detail Page ─────────────── */
.intg-detail-header {
  margin-bottom: 20px;
}
.intg-back-link {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 12px;
  transition: color 0.15s;
}
.intg-back-link:hover { color: var(--primary); }
.intg-detail-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.intg-detail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.intg-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .intg-detail-grid { grid-template-columns: 1fr; }
}
.intg-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.intg-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.intg-health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.intg-health-stat {
  text-align: center;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius);
}
.intg-health-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.intg-health-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.intg-config-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.intg-config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.intg-config-row:last-child { border-bottom: none; }
.intg-config-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.intg-config-value {
  font-size: 0.78rem;
  color: var(--text);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.intg-feed-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.intg-feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius);
}
.intg-feed-url {
  flex: 1;
  font-size: 0.78rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.intg-feed-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.intg-feed-remove:hover { color: var(--danger); }
.intg-add-item {
  display: flex;
  gap: 8px;
  align-items: center;
}
.intg-add-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.82rem;
}
.intg-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
}
.intg-meta-list code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}
.intg-danger-zone {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
}

/* ── Signal Loop: Review Cards ────────────── */
.review-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-card {
  padding: 16px 20px;
  border-left: 3px solid var(--warning);
  transition: border-color 0.15s ease;
}

.review-card:hover {
  border-left-color: var(--primary);
}

.review-card-body {
  display: flex;
  align-items: center;
  gap: 20px;
}

.review-card-main {
  flex: 1;
  min-width: 0;
}

.review-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 4px;
}

.review-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.review-card-routing {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.review-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Signal Loop: Threshold Controls ─────── */
.threshold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.threshold-item label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 6px;
}

.threshold-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.threshold-control input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.threshold-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.threshold-value {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  min-width: 52px;
  text-align: right;
}

/* ── Signal Loop: Status pills ───────────── */
.pill-running { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.pill-inactive { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); }
.pill-pending_review, .pill-pendingreview { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.pill-dispatched { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.pill-dismissed { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); }
.pill-ignored { background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--border); }

/* ── Signal Loop: Section headers ────────── */
.section-header .badge-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warning);
  color: var(--text-inverse);
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Quota Ring ────────────────────────────── */
.quota-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quota-ring svg { position: absolute; top: 0; left: 0; }
.quota-ring-value {
  position: relative;
  z-index: 1;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.quota-ring-label {
  position: absolute;
  bottom: -14px;
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Status Dot ───────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Integration Monitoring ───────────────── */
.integration-health-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 0;
  font-size: 0.75rem;
}
.integration-health-bar .health-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}
.integration-health-bar .health-stat strong {
  color: var(--text);
  font-weight: 600;
}

/* Monitoring section in detail modal */
.monitoring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.monitoring-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.monitoring-card .mon-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.monitoring-card .mon-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.monitoring-card .mon-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* API log row status */
.api-log-success { color: var(--success); }
.api-log-error { color: var(--danger); }
.api-log-timeout { color: var(--warning); }

/* ── Workflow Editor ───────────────────────── */
.wf-editor {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.wf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  gap: 12px;
  flex-shrink: 0;
}
.wf-toolbar-left { display: flex; align-items: center; gap: 12px; }
.wf-toolbar-right { display: flex; align-items: center; gap: 8px; }
.wf-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 6px;
}
.wf-zoom-btn { padding: 2px 6px !important; min-width: 24px; font-size: 1rem; line-height: 1; }
.wf-zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.wf-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.wf-zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
}
.wf-zoom-label { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.wf-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.wf-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.wf-palette {
  width: 140px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 8px;
  overflow-y: auto;
  flex-shrink: 0;
}
.wf-palette-section { margin-bottom: 12px; }
.wf-palette-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.wf-palette-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: grab;
  font-size: 0.8rem;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.wf-palette-item:hover { background: var(--bg-input); }
.wf-palette-item:active { cursor: grabbing; }
.wf-palette-icon { font-size: 1rem; width: 20px; text-align: center; }
.wf-palette-text { font-weight: 500; }

.wf-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
.wf-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}

.wf-config {
  width: 280px;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  overflow-y: auto;
  flex-shrink: 0;
}
.wf-conflict-banner {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.78rem;
}
.wf-conflict-item { padding: 2px 0; }
.wf-conflict-error { color: var(--danger); }
.wf-conflict-warn { color: var(--warning); }
.wf-config-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
}
.wf-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.wf-config-body {
  padding: 12px;
}
.wf-config-body .form-group { margin-bottom: 10px; }
.wf-config-body label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-input-sm {
  padding: 5px 8px;
  font-size: 0.82rem;
}

/* SVG node styling */
.wf-node { cursor: pointer; }
.wf-node:hover .wf-node-body { filter: brightness(1.05); }
.wf-node-selected .wf-node-body { filter: brightness(1.08); }
.wf-node-label { pointer-events: none; }
.wf-node-subtitle { pointer-events: none; }
.wf-node-icon { pointer-events: none; }

/* Ports */
.wf-port {
  fill: var(--bg-card);
  stroke: var(--text-muted);
  stroke-width: 2;
  cursor: crosshair;
  transition: fill 0.15s;
}
.wf-port:hover {
  fill: var(--primary);
  stroke: var(--primary);
  r: 9;
}
.wf-port-false {
  stroke: var(--danger);
}

/* Edges */
.wf-edge {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  cursor: pointer;
  transition: stroke 0.15s;
}
.wf-edge:hover {
  stroke: var(--primary);
  stroke-width: 2.5;
}
.wf-edge-label {
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
  pointer-events: none;
}
.wf-temp-edge {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 6 3;
  pointer-events: none;
}

/* ── Schedule Picker ────────────────────────── */
.schedule-picker .form-group { margin-bottom: 10px; }
.schedule-day-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.schedule-day-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.schedule-day-btn input[type="checkbox"] { display: none; }
.schedule-day-btn span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}
.schedule-day-btn input:checked + span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.schedule-day-btn:hover span {
  border-color: var(--primary);
}
.schedule-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-input));
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 8px;
}
.schedule-preview-icon { font-size: 1rem; }

/* ── Variable Picker (Workflow Editor) ─────── */
.wf-var-insert-btn {
  margin-top: 4px;
  font-size: 0.75rem;
  padding: 3px 8px;
  color: var(--primary);
  border: 1px dashed var(--primary-border);
  background: var(--primary-bg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.wf-var-insert-btn:hover {
  background: color-mix(in srgb, var(--primary) 15%, var(--bg-input));
  border-style: solid;
}
.wf-var-picker {
  max-height: 360px;
  overflow-y: auto;
}
.wf-var-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  letter-spacing: 0.04em;
}
.wf-var-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: background 0.12s;
}
.wf-var-option:hover {
  background: var(--bg-card-hover);
}
.wf-var-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.wf-var-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
}

/* Connections section in config panel */
.wf-connections-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.wf-connections-section > label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Notification Bell + Dropdown ──────────── */
.notif-bell-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-bell-btn svg {
  width: 18px;
  height: 18px;
}
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: var(--danger);
  border-radius: 10px;
  pointer-events: none;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: -40px;
  width: 360px;
  max-height: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0,0,0,.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.notif-dropdown-header .btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
  font-weight: 500;
}
.notif-dropdown-header .btn-link:hover {
  text-decoration: underline;
}
.notif-dropdown-body {
  overflow-y: auto;
  max-height: 380px;
  flex: 1;
}
.notif-empty {
  padding: 24px 14px;
  text-align: center;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover {
  background: var(--bg-input);
}
.notif-item.unread {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.notif-item.unread:hover {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.notif-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-top: 2px;
}
.notif-icon.info    { background: color-mix(in srgb, var(--info) 15%, transparent);    color: var(--info); }
.notif-icon.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.notif-icon.warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.notif-icon.error   { background: color-mix(in srgb, var(--danger) 15%, transparent);  color: var(--danger); }
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-time {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 3px;
}
.notif-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 8px;
}

/* ── Workflow Timeline ─────────────────────── */
.workflow-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}
.timeline-step {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 4px;
}
.timeline-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 24px;
  flex-shrink: 0;
}
.timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin: 4px 0;
  min-height: 20px;
}
.timeline-content {
  flex: 1;
  padding: 6px 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

/* ── Print ─────────────────────────────────── */
@media print {
  #sidebar, #topbar, #toast-container { display: none !important; }
  #content { padding: 0; overflow: visible; }
  .btn { display: none; }
}

/* =========================================================
   Workflow Editor v2 — SafePaaS Brand Design
   ========================================================= */

/* ── Full-screen overlay ───────────────────── */
.wfe {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ── Top Bar (56px) ────────────────────────── */
.wfe-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wfe-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.wfe-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.wfe-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.wfe-back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.wfe-topbar-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wfe-topbar-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfe-topbar-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.wfe-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}
.wfe-status-active {
  background: var(--success-bg);
  color: var(--success);
}
.wfe-status-paused {
  background: var(--warning-bg);
  color: var(--warning);
}
.wfe-status-draft {
  background: var(--bg);
  color: var(--text-muted);
}
.wfe-tb-btn {
  padding: 6px 12px !important;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all var(--transition);
}
.wfe-tb-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-card));
}
.wfe-tb-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}
.wfe-save-btn {
  padding: 7px 22px !important;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.wfe-save-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(0,0,0,0.16);
  transform: translateY(-1px);
}
.wfe-save-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ── Body Layout ───────────────────────────── */
.wfe-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Left Palette ─────────────────────────── */
.wfe-palette {
  width: 220px;
  min-width: 140px;
  max-width: 360px;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.wfe-pal-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.wfe-pal-search input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  font-size: 0.78rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.wfe-pal-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
}
.wfe-pal-search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 3px;
  display: none;
}
.wfe-pal-search-clear.visible { display: block; }
.wfe-pal-search-clear:hover { color: var(--text); background: var(--bg-card-hover); }
.wfe-pal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 12px;
}
.wfe-pal-section {
  margin-bottom: 10px;
}
.wfe-pal-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
  padding: 4px 4px 4px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.wfe-pal-label:hover { color: var(--text); }
.wfe-pal-chevron {
  font-size: 0.6rem;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}
.wfe-pal-section.collapsed .wfe-pal-chevron { transform: rotate(-90deg); }
.wfe-pal-section.collapsed .wfe-pal-items { display: none; }
.wfe-pal-items { }
.wfe-pal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: grab;
  font-size: 0.78rem;
  transition: all var(--transition);
  margin-bottom: 1px;
  border: 1px solid transparent;
}
.wfe-pal-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wfe-pal-item:active {
  cursor: grabbing;
  transform: scale(0.97);
}
.wfe-pal-item.filtered-out { display: none; }
.wfe-pal-section.filtered-out { display: none; }
.wfe-pal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.wfe-pal-text {
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.wfe-pal-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
  flex-shrink: 0;
}
.wfe-pal-status-text {
  font-size: 0.58rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
}

/* ── Resize Handles ──────────────────────────── */
.wfe-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  transition: background 0.15s;
}
.wfe-resize-handle:hover,
.wfe-resize-handle.dragging {
  background: var(--primary);
  opacity: 0.4;
}
.wfe-resize-handle::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -3px; right: -3px;
}

/* ── Sidebar Toggle ──────────────────────────── */
.wfe-sb-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(100%);
  width: 20px;
  height: 48px;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  z-index: 3;
  transition: all var(--transition);
}
.wfe-sb-toggle:hover { background: var(--bg-card-hover); color: var(--text); }

/* ── Context Menu ────────────────────────────── */
.wfe-ctx-menu {
  position: fixed;
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 160px;
  padding: 4px 0;
  font-size: 0.82rem;
}
.wfe-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: inherit;
  font-family: inherit;
}
.wfe-ctx-item:hover { background: var(--bg-card-hover); }
.wfe-ctx-item.danger { color: var(--danger); }
.wfe-ctx-item.danger:hover { background: var(--danger-bg); }
.wfe-ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }
.wfe-ctx-shortcut { margin-left: auto; font-size: 0.68rem; color: var(--text-dim, var(--text-muted)); opacity: 0.6; }

.wfe-tool-badge {
  padding: 6px 10px;
  background: color-mix(in srgb, var(--primary) 5%, var(--bg));
  border-radius: 6px;
  margin-bottom: 10px;
}
.wfe-agent-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.wfe-agent-tools .pill {
  font-size: 0.68rem;
  padding: 2px 8px;
}

/* ── I/O Tab ─────────────────────────────────── */
.wfe-io-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.06em;
  margin: 12px 0 6px;
}
.wfe-io-section-title:first-child { margin-top: 0; }
.wfe-io-var {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 5px;
  margin-bottom: 2px;
  transition: background var(--transition);
  cursor: pointer;
}
.wfe-io-var:hover { background: var(--bg-card-hover); }
.wfe-io-var-name {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 500;
}
.wfe-io-var-code {
  font-size: 0.68rem;
  font-family: monospace;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--bg));
  padding: 1px 6px;
  border-radius: 3px;
}
.wfe-io-var-code:hover { background: color-mix(in srgb, var(--primary) 16%, var(--bg)); }
.wfe-io-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.wfe-io-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

/* ── Run History Tab ─────────────────────────── */
.wfe-step-hist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.wfe-step-hist-item:hover { background: var(--bg-card-hover); }
.wfe-step-hist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.wfe-step-hist-meta {
  flex: 1;
  min-width: 0;
}
.wfe-step-hist-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wfe-step-hist-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.wfe-step-hist-expand {
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: monospace;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}

/* ── Canvas ────────────────────────────────── */
.wfe-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
.wfe-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  background: var(--bg);
}

/* Zoom controls — bottom-left */
.wfe-zoom-ctrl {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  backdrop-filter: blur(8px);
}
.wfe-zoom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition);
}
.wfe-zoom-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
}
.wfe-zoom-label {
  min-width: 40px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Minimap — bottom-right */
.wfe-minimap {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 150px;
  height: 90px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  opacity: 0.9;
  backdrop-filter: blur(8px);
}
.wfe-minimap:empty {
  display: none;
}

/* ── SVG Nodes ─────────────────────────────── */
.wfe-node {
  cursor: pointer;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08));
}
.wfe-node:hover {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.12));
}
.wfe-node:hover .wfe-node-body {
  filter: none;
}
.wfe-node-selected {
  filter: drop-shadow(0 0 0 rgba(0,0,0,0)) drop-shadow(0 2px 8px rgba(0,0,0,0.08));
}
.wfe-node-selected .wfe-node-body {
  filter: none;
}

/* Ports */
.wfe-port {
  fill: var(--bg-card);
  stroke: var(--border);
  stroke-width: 2;
  cursor: crosshair;
  transition: all 0.15s;
  r: 6;
}
.wfe-port:hover {
  fill: var(--primary);
  stroke: var(--primary);
  r: 8;
}
.wfe-port-false {
  stroke: var(--danger);
}
.wfe-port-false:hover {
  fill: var(--danger);
  stroke: var(--danger);
}

/* Edges */
.wfe-edge {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
  stroke-linecap: round;
  cursor: pointer;
  transition: stroke 0.15s, stroke-width 0.15s;
}
.wfe-edge:hover {
  stroke: var(--primary);
  stroke-width: 2.5;
}
.wfe-edge-label {
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-muted);
  text-anchor: middle;
  pointer-events: none;
}
.wfe-edge-label-yes {
  fill: var(--accent);
}
.wfe-edge-label-no {
  fill: var(--danger);
}
.wfe-temp-edge {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-dasharray: 8 4;
  stroke-linecap: round;
  pointer-events: none;
}

/* ── Right Sidebar (320px) ─────────────────── */
.wfe-sidebar {
  width: 320px;
  min-width: 240px;
  max-width: 480px;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, border 0.2s ease;
}
.wfe-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  border-left: none !important;
  overflow: hidden;
}
.wfe-sb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
}

/* Sidebar header */
.wfe-sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: color-mix(in srgb, var(--primary) 6%, var(--bg-card));
  border-top: 3px solid var(--primary);
}
.wfe-sb-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wfe-sb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1rem;
  flex-shrink: 0;
}
.wfe-sb-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfe-sb-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wfe-sb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.wfe-sb-close:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

/* Sidebar tabs */
.wfe-sb-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wfe-sb-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.wfe-sb-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--primary) 4%, var(--bg-card));
}
.wfe-sb-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Sidebar body */
.wfe-sb-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}
.wfe-sb-body .form-group {
  margin-bottom: 12px;
}
.wfe-sb-body label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sidebar footer */
.wfe-sb-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.wfe-sb-test {
  color: var(--primary) !important;
  border: 1px solid var(--primary-border) !important;
  background: var(--primary-bg) !important;
}
.wfe-sb-test:hover {
  background: color-mix(in srgb, var(--primary) 15%, var(--bg-card)) !important;
}
.wfe-sb-delete {
  color: var(--danger) !important;
  border: 1px solid var(--danger-border) !important;
  background: var(--danger-bg) !important;
}
.wfe-sb-delete:hover {
  background: color-mix(in srgb, var(--danger) 15%, var(--bg-card)) !important;
}

/* ── Sidebar Form Inputs ───────────────────── */
.wfe-input,
.wfe-select,
.wfe-textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.82rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
}
.wfe-input:focus,
.wfe-select:focus,
.wfe-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.wfe-textarea {
  resize: vertical;
  min-height: 60px;
}
.wfe-select {
  cursor: pointer;
}

.wfe-section-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}
.wfe-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  font-size: 0.78rem;
  color: var(--text);
  margin-top: 8px;
}

/* Connection rows */
.wfe-conn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.wfe-conn-del {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background var(--transition);
}
.wfe-conn-del:hover {
  background: var(--danger-bg);
}

/* I/O tab */
.wfe-io-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.wfe-io-row:last-child {
  border-bottom: none;
}
.wfe-io-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.wfe-io-code {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
}

/* Agent cards in sidebar */
.wfe-agent-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}
.wfe-agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
}
.wfe-agent-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wfe-agent-card.selected {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.wfe-agent-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.wfe-agent-info {
  flex: 1;
  min-width: 0;
}
.wfe-agent-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfe-agent-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfe-agent-check {
  color: var(--accent);
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* Delay presets */
.wfe-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.wfe-preset-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.wfe-preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.wfe-preset-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Audit Log Panel (slide-out from right) ── */
.wfe-audit-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.wfe-audit-panel.open {
  transform: translateX(0);
}
.wfe-audit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.wfe-audit-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: all var(--transition);
}
.wfe-audit-close:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}
.wfe-audit-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.wfe-audit-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 24px;
}

/* Run cards */
.wfe-run-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  overflow: hidden;
}
.wfe-run-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.wfe-run-header:hover {
  background: var(--bg-card-hover);
}
.wfe-run-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wfe-run-meta {
  flex: 1;
  min-width: 0;
}
.wfe-run-id {
  display: block;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.wfe-run-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wfe-run-status {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-muted);
}

/* Run detail (expanded) */
.wfe-run-detail {
  border-top: 1px solid var(--border);
}
.wfe-run-detail:empty {
  border-top: none;
}

/* Step timeline in run detail */
.wfe-step-timeline {
  padding: 10px 12px;
}
.wfe-step-run {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.wfe-step-run:last-child {
  border-bottom: none;
}
.wfe-step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.wfe-step-info {
  flex: 1;
  min-width: 0;
}
.wfe-step-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wfe-step-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.wfe-step-type {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 3px;
}
.wfe-step-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.wfe-step-output {
  margin-top: 4px;
}
.wfe-step-output summary {
  font-size: 0.72rem;
  color: var(--primary);
  cursor: pointer;
}
.wfe-step-output pre {
  font-size: 0.7rem;
  background: var(--bg);
  padding: 8px;
  border-radius: 4px;
  margin-top: 4px;
  max-height: 150px;
  overflow: auto;
  line-height: 1.4;
}
.wfe-step-error {
  margin-top: 4px;
  padding: 6px 8px;
  border-left: 3px solid var(--danger);
  background: var(--danger-bg);
  border-radius: 0 4px 4px 0;
  font-size: 0.75rem;
  color: var(--danger);
}

/* Run summary bar */
.wfe-run-summary {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 12px;
  background: var(--bg);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 900px) {
  .wfe-palette { width: 160px; min-width: 120px; }
  .wfe-sidebar { width: 280px; min-width: 200px; }
  .wfe-audit-panel { width: 320px; }
}
@media (max-width: 700px) {
  .wfe-palette { display: none; }
  .wfe-sidebar { width: 100%; min-width: 100%; position: absolute; right: 0; top: 0; height: 100%; z-index: 5; }
  .wfe-audit-panel { width: 100%; }
  .wfe-resize-handle { display: none; }
}

/* ── Workflow Detail Page (SGM-97) ────────────────────────────────── */

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 0.85rem; }
.breadcrumb-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.breadcrumb-link:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-dim, var(--text-muted)); font-size: 0.75rem; }
.breadcrumb-current { color: var(--text-muted); font-weight: 400; }

/* Detail header */
.wf-detail-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.wf-detail-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.wf-detail-desc { font-size: 0.9rem; color: var(--text-secondary, var(--text-muted)); margin: 0; cursor: pointer; }
.wf-detail-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Inline edit hints */
.edit-hint { font-size: 0.8rem; color: var(--text-dim, var(--text-muted)); opacity: 0; transition: opacity 0.15s; margin-left: 4px; }
*:hover > .edit-hint { opacity: 1; }

/* Inline edit controls */
.wf-inline-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-inline-input {
  padding: 6px 12px; border: 1px solid var(--primary); border-radius: 6px;
  background: var(--bg-card, #fff); color: var(--text); font-size: 0.9rem;
  outline: none; width: 100%; max-width: 500px;
}
.wf-inline-input:focus { box-shadow: 0 0 0 3px rgba(88, 136, 157, 0.15); }
.wf-inline-input-lg { font-size: 1.1rem; font-weight: 600; }
.wf-inline-select {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card, #fff); color: var(--text); font-size: 0.85rem;
  min-width: 160px; cursor: pointer;
}
.wf-inline-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(88, 136, 157, 0.15); }
.wf-edit-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Trigger badge */
.wf-trigger-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--bg-card, #fff);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.85rem; color: var(--text-secondary, var(--text));
  cursor: pointer; transition: border-color 0.15s;
}
.wf-trigger-badge:hover { border-color: var(--primary); }

/* Tabs */
.wf-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.wf-tab {
  padding: 10px 20px; font-size: 0.9rem; font-weight: 400;
  color: var(--text-muted); cursor: pointer;
  border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; transition: all 0.15s;
}
.wf-tab:hover { color: var(--text-secondary, var(--text)); }
.wf-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* Embedded workflow graph container */
.wf-embed-container {
  position: relative; height: 380px; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; background: var(--bg-card, #fff);
}
.wfe-embed-wrap { width: 100%; height: 100%; position: relative; }
.wfe-embed-svg { width: 100%; height: 100%; }
.wfe-embed-zoom {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-card, #fff); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Run card (clickable) */
.wf-run-card { cursor: pointer; padding: 14px 20px; transition: border-color 0.15s, box-shadow 0.15s; }
.wf-run-card:hover { border-color: var(--primary); box-shadow: 0 1px 6px rgba(88, 136, 157, 0.12); }

/* Step execution timeline */
.wf-step-exec { display: flex; gap: 14px; min-height: 52px; }
.wf-step-rail { display: flex; flex-direction: column; align-items: center; width: 28px; flex-shrink: 0; }
.wf-step-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.wf-step-dot-pulse { animation: wf-pulse 1.5s infinite; }
@keyframes wf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.wf-step-line { width: 2px; flex: 1; background: var(--border); min-height: 12px; }
.wf-step-body { flex: 1; padding-bottom: 20px; min-width: 0; }
.wf-step-body-last { padding-bottom: 0; }
.wf-step-exec:last-child .wf-step-line { display: none; }
.wf-step-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; font-size: 0.9rem; }
.wf-step-duration { margin-left: auto; font-size: 0.8rem; color: var(--text-muted); font-family: monospace; }

/* Agent response block */
.wf-agent-response {
  margin-top: 10px; padding: 14px 18px;
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.wf-agent-response-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent); margin-bottom: 8px;
}

/* Raw output toggle */
.wf-raw-toggle { margin-top: 8px; }
.wf-raw-toggle summary {
  font-size: 0.8rem; color: var(--primary); cursor: pointer; font-weight: 500;
}
.wf-raw-toggle pre {
  font-size: 0.75rem; background: var(--bg-code, var(--bg-input));
  padding: 10px 14px; border-radius: 8px; overflow-x: auto;
  max-height: 240px; margin-top: 6px; border: 1px solid var(--border);
  font-family: monospace; color: var(--text-secondary, var(--text));
}

/* Error banner */
.wf-error-banner {
  padding: 12px 16px; background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-left: 3px solid var(--danger); border-radius: 0 8px 8px 0;
  margin-bottom: 20px; font-size: 0.85rem;
}

/* Markdown body */
.markdown-body { font-size: 0.9rem; line-height: 1.65; color: var(--text-secondary, var(--text)); }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: var(--text); margin: 16px 0 8px; font-weight: 600; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }
.markdown-body h1 { font-size: 1.15rem; }
.markdown-body h2 { font-size: 1.05rem; }
.markdown-body h3 { font-size: 0.95rem; }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 10px; padding-left: 24px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body code {
  background: var(--bg-code, var(--bg-input)); padding: 2px 6px;
  border-radius: 4px; font-size: 0.85rem; font-family: monospace;
}
.markdown-body pre {
  background: var(--bg-code, var(--bg-input)); padding: 12px 16px;
  border-radius: 8px; overflow-x: auto; margin: 8px 0 12px;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote {
  border-left: 3px solid var(--border); padding-left: 14px;
  color: var(--text-muted); margin: 8px 0 12px;
}
.markdown-body strong { color: var(--text); font-weight: 600; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
.markdown-body th {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  color: var(--primary); text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.markdown-body td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }


/* -- Step Health Table -- */
.sh-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-card); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.sh-table th { text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); }
.sh-table td { padding: 14px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sh-table tr:last-child td { border-bottom: none; }
.sh-table tbody tr { transition: var(--transition); }
.sh-table tbody tr:hover { background: var(--bg-card-hover); }
.sh-order { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); font-size: 11px; font-weight: 700; }
.sh-step { display: inline-flex; align-items: center; gap: 8px; }
.sh-icon { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.sh-name { font-weight: 600; }
.sh-subtype { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.sh-dur { display: flex; align-items: center; gap: 8px; }
.sh-bar { height: 4px; border-radius: 2px; opacity: 0.5; min-width: 4px; }
.sh-dur-text { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sh-fail { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sh-fail-high { color: var(--danger); font-weight: 600; }

/* ── Awareness Dashboard v3 (ApexCharts) ──────────────────────────── */

/* Loading */
.aw-loading { display: flex; justify-content: center; padding: 80px 0; }

/* KPI Strip */
.aw-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 10px; margin-bottom: 14px; }
.aw-kpi {
  display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; transition: box-shadow 0.2s, transform 0.15s;
  border-left: 3px solid var(--kc, var(--primary)); cursor: pointer; overflow: hidden;
}
.aw-kpi:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); transform: translateY(-1px); }
.aw-kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.aw-kpi-val { font-size: 24px; font-weight: 700; line-height: 1; color: var(--kc); font-variant-numeric: tabular-nums; }
.aw-kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 5px; }
.aw-kpi-sub { font-size: 10px; color: var(--text-muted); opacity: 0.6; margin-top: 4px; }
.aw-kpi-spark { flex-shrink: 0; }

/* Cards */
.aw-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow: hidden; margin-bottom: 0;
}
.aw-card-hero { margin-bottom: 14px; }
.aw-card-full { margin-bottom: 14px; }
.aw-card-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.aw-card-h h3 { font-size: 13px; font-weight: 700; color: var(--text); margin: 0; }
.aw-card-sub { font-size: 11px; color: var(--text-muted); }
.aw-link { font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 500; }
.aw-link:hover { text-decoration: underline; }

/* Chart containers */
.aw-chart-hero { min-height: 300px; }
.aw-chart-md { min-height: 260px; }
.aw-chart-sm { min-height: 220px; }

/* Layout grid */
.aw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

/* Tier badge */
.aw-tier {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 20px; border-radius: 4px; font-size: 10px; font-weight: 700;
  background: color-mix(in srgb, var(--tc) 15%, transparent);
  color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent);
}

/* Score bar */
.aw-score { display: flex; align-items: center; gap: 6px; min-width: 90px; }
.aw-score-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.aw-score-fill { height: 100%; border-radius: 3px; }
.aw-score span { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; min-width: 22px; }

/* Top accounts table */
.aw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.aw-table th {
  text-align: left; padding: 8px 10px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.aw-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.aw-table-row:hover { background: var(--primary-bg); }
.aw-table-row:last-child td { border-bottom: none; }

/* Stale assignments */
.aw-stale { margin-top: 10px; border: 1px solid var(--danger-border); border-radius: var(--radius); overflow: hidden; }
.aw-stale-head {
  padding: 8px 12px; background: var(--danger-bg); font-size: 12px; font-weight: 600; color: var(--danger);
  display: flex; align-items: center; gap: 6px;
}
.aw-stale-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  text-decoration: none; font-size: 12px; border-top: 1px solid var(--danger-border);
  transition: background 0.1s;
}
.aw-stale-row:hover { background: var(--danger-bg); }
.aw-stale-name { flex: 1; font-weight: 500; color: var(--text); }
.aw-stale-who { color: var(--text-muted); }
.aw-stale-days { font-weight: 700; color: var(--danger); min-width: 30px; text-align: right; }

/* Responsive */
@media (max-width: 1024px) {
  .aw-row { grid-template-columns: 1fr; }
  .aw-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .aw-kpis { grid-template-columns: repeat(2, 1fr); }
  .aw-kpi-val { font-size: 20px; }
  .aw-chart-hero { min-height: 220px; }
  .aw-chart-md, .aw-chart-sm { min-height: 200px; }
  .aw-table { font-size: 12px; }
  .aw-table th, .aw-table td { padding: 6px; }
}

/* ── SGM-189: Assistant sidebar ──────────────────────────────────── */

.assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-inverse, #fff);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform var(--transition), background var(--transition);
}
.assistant-fab:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}
.assistant-fab .assistant-fab-icon {
  display: inline-block;
  line-height: 1;
}

.assistant-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--assistant-width);
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1000;
}
.assistant-drawer.open {
  transform: translateX(0);
}
/* SGM-196: pinned drawer is always visible (no transform-out on .open
   absence) and sheds its overlay shadow since it's now part of page chrome. */
.assistant-drawer.pinned {
  transform: translateX(0);
  box-shadow: none;
}
/* SGM-196: when body has the pinned flag, content reflows to leave room
   for the drawer on the right. Mirrors the left navigation sidebar's
   layout pattern. */
body.assistant-pinned {
  padding-right: var(--assistant-width);
  transition: padding-right var(--transition);
}

/* SGM-196: drag-to-resize handle on the drawer's left edge. Invisible
   by default; primary-tinted line on hover; solid primary during active
   drag. JS toggles .active during a drag. */
.assistant-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  transition: background var(--transition);
  z-index: 1;
}
.assistant-resize-handle:hover {
  background: var(--primary-border);
}
.assistant-resize-handle.active {
  background: var(--primary);
}

.assistant-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
}
/* SGM-196: header now has two flex children — bot-icon+title group on
   the left, action buttons on the right. The existing space-between on
   .assistant-header pushes them apart automatically. */
.assistant-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.assistant-header-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.assistant-header-icon svg {
  width: 18px;
  height: 18px;
}
.assistant-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.assistant-header-actions {
  display: flex;
  gap: 4px;
}
.assistant-header-actions .icon-btn {
  width: 28px;
  height: 28px;
  font-size: 14px;
}
/* SGM-196: pin button takes a highlighted "active" state when the
   drawer is pinned, so the toggle state is unambiguous at a glance. */
.assistant-header-actions .icon-btn.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.assistant-threads {
  display: none;
  border-bottom: 1px solid var(--border);
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
}
.assistant-drawer.show-threads .assistant-threads {
  display: block;
}
.assistant-thread {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.assistant-thread:last-child { border-bottom: 0; }
.assistant-thread:hover {
  background: var(--bg-card-hover);
}
.assistant-thread.active {
  background: var(--primary-bg);
  border-left: 3px solid var(--primary);
  padding-left: 13px;
}
.assistant-thread-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assistant-thread-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.assistant-thread-empty {
  padding: 16px;
  text-align: center;
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}
.assistant-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  color: var(--primary);
}
.assistant-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.assistant-empty-sub {
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.assistant-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.assistant-suggestion {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
}
.assistant-suggestion:hover {
  background: var(--primary-bg);
  border-color: var(--primary-border);
  color: var(--primary);
}

.assistant-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
.assistant-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}
.assistant-msg-assistant {
  align-self: flex-start;
  align-items: flex-start;
}
.assistant-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.assistant-msg-user .assistant-msg-bubble {
  background: var(--primary-bg);
  color: var(--text);
  border: 1px solid var(--primary-border);
}
.assistant-msg-assistant .assistant-msg-bubble {
  background: var(--bg-card-hover);
  color: var(--text);
}
.assistant-msg-assistant .assistant-msg-bubble p:first-child { margin-top: 0; }
.assistant-msg-assistant .assistant-msg-bubble p:last-child { margin-bottom: 0; }
.assistant-msg-assistant .assistant-msg-bubble pre {
  background: var(--bg-code);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  overflow-x: auto;
}
.assistant-msg-assistant .assistant-msg-bubble code {
  background: var(--bg-code);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.assistant-msg-assistant .assistant-msg-bubble ul,
.assistant-msg-assistant .assistant-msg-bubble ol {
  margin: 6px 0;
  padding-left: 22px;
}
.assistant-msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.assistant-msg-thinking .assistant-msg-bubble {
  background: var(--bg-card-hover);
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}
.assistant-thinking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  animation: assistant-thinking 1.2s infinite ease-in-out;
}
.assistant-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.assistant-thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes assistant-thinking {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

.assistant-input-form {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  align-items: flex-end;
}
#assistant-input {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
}
#assistant-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.assistant-send-btn {
  background: var(--primary);
  color: var(--text-inverse, #fff);
  border: none;
  border-radius: var(--radius);
  padding: 0 14px;
  height: 40px;
  cursor: pointer;
  font-size: 12px;
  transition: background var(--transition);
}
.assistant-send-btn:hover { background: var(--primary-hover); }
.assistant-send-btn:disabled { opacity: 0.5; cursor: default; }

.assistant-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 4px 4px;
  margin: 8px 0;
}
.assistant-chart-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 8px 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  border-radius: var(--radius);
}

@media (max-width: 600px) {
  .assistant-drawer { width: 100vw !important; }
  .assistant-fab { bottom: 16px; right: 16px; }
  /* SGM-196: at narrow viewports there's no room for content alongside
     the drawer, so pin + resize are disabled. The drawer reverts to the
     full-width overlay behavior. */
  .assistant-resize-handle { display: none; }
  #assistant-pin-btn { display: none; }
  body.assistant-pinned { padding-right: 0; }
  .assistant-drawer.pinned { transform: translateX(100%); }
  .assistant-drawer.pinned.open { transform: translateX(0); }
}

/* SGM-224: contacts list redesign — compact header + overflow menu + CSV import */
.contact-pagebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 2px;
}
.contact-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
}
.contact-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.contact-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: ui-monospace, 'JetBrains Mono', 'SF Mono', monospace;
}
.contact-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
/* SGM-237: generic .list-overflow-* aliases. The .contact-overflow-*
   set was added in SGM-224 and only used on contacts; accounts and
   future list pages should adopt the .list-* names instead. Both
   selectors share rules so the contacts page keeps working unchanged. */
.contact-overflow-anchor,
.list-overflow-anchor {
  position: relative;
}
.contact-overflow-panel,
.list-overflow-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 100;
  padding: 6px;
}
.contact-overflow-item,
.list-overflow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}
.contact-overflow-item:hover,
.list-overflow-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.contact-overflow-item:hover .contact-overflow-icon,
.contact-overflow-item:hover .list-overflow-icon,
.list-overflow-item:hover .list-overflow-icon,
.list-overflow-item:hover .contact-overflow-icon {
  color: var(--primary);
}
.contact-overflow-divider,
.list-overflow-divider {
  height: 1px;
  background: var(--border);
  margin: 4px -2px;
}
.contact-overflow-icon,
.list-overflow-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.contact-diag-strip {
  padding: 6px 0 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.contact-diag-strip strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.contact-diag-sep {
  color: var(--text-dim);
}

/* CSV import modal — drop zone + banners + mapping table */
.csv-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.csv-dropzone-drag {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.csv-stats-banner {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  margin-bottom: 4px;
  font-size: 13px;
  align-items: baseline;
  flex-wrap: wrap;
}
.csv-info-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--info-bg);
  border: 1px solid var(--primary-border);
  font-size: 13px;
  color: var(--text-secondary);
}
.csv-warn-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  font-size: 13px;
  color: var(--text-secondary);
}
.csv-info-banner strong, .csv-warn-banner strong {
  color: var(--text);
}

/* SGM-220: send-status drawer (right-anchored, slides in) */
@keyframes camp-drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.camp-status-pill:hover,
.camp-status-chip:hover {
  filter: brightness(1.06);
}
.camp-status-pill:focus-visible,
.camp-status-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.camp-contact-row:hover {
  background: var(--bg-card-hover, var(--bg));
}

/* ── SGTM-1: Report Issue (sidebar entry + modal) ────────────────── */
/* Sidebar entry — visually separated from main nav since it's an action,
   not a route. Uses the same shape as a nav-link but renders a button. */
.nav-feedback-row {
  list-style: none;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.nav-feedback-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 15px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.nav-feedback-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

/* Collapsed sidebar — hide the label on the feedback button just like nav-links */
#sidebar.collapsed .nav-feedback-btn span {
  display: none;
}
#sidebar.collapsed .nav-feedback-btn {
  justify-content: center;
  padding: 10px 0;
}

/* ── Feedback modal form ────────────────────────────────────────── */
.feedback-form .feedback-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.feedback-required {
  color: var(--danger);
  font-weight: 500;
}

/* Type radio cards */
.feedback-type-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.feedback-type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
}
.feedback-type-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}
.feedback-type-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.feedback-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.feedback-type-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  color: var(--text-muted);
}
.feedback-type-card.selected .feedback-type-icon {
  color: var(--primary);
}
.feedback-type-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.feedback-type-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Screenshot input + preview */
.feedback-screenshot-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.feedback-screenshot-row input[type="file"] {
  font-size: 0.8125rem;
}
.feedback-screenshot-preview {
  position: relative;
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 240px;
  background: var(--bg);
}
.feedback-screenshot-preview img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}
.feedback-screenshot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feedback-screenshot-remove i {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.feedback-screenshot-remove:hover {
  background: rgba(0, 0, 0, 0.85);
}

/* Meta row — shows Page + Reporter at the bottom of the form */
.feedback-meta {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.feedback-meta-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 0.75rem;
  line-height: 1.6;
}
.feedback-meta-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 70px;
}
.feedback-meta-value {
  color: var(--text);
  word-break: break-all;
}

/* Toast warning variant — used when issue is created but screenshot failed */
.toast-warning {
  background: var(--warning);
  color: #1a1a1a;
}
.toast-link {
  color: inherit;
  text-decoration: underline;
  margin-left: 4px;
  font-weight: 600;
}
.toast-link:hover {
  text-decoration: none;
}
.toast-warn-line {
  font-size: 0.75rem;
  font-weight: 400;
  margin-top: 4px;
  opacity: 0.9;
}

/* ============================================================================
   SGM-284: User edit form — multi-role assignment + Effective Permissions
   ============================================================================ */
.form-meta {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.form-meta-warn {
  color: var(--warning);
  font-weight: 600;
}
.role-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-card);
}
.role-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms;
  min-height: 44px;
  box-sizing: border-box;
}
.role-row:hover {
  background: var(--bg-card-hover);
}
.role-row.checked {
  background: var(--primary-bg);
}
.role-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.role-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-family-mono, ui-monospace, monospace);
}
.role-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.pill-system {
  background: var(--bg-code);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.pill-custom {
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

.effective-panel {
  margin: 18px 0 14px;
  padding: 12px 14px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-border);
  border-radius: 8px;
}
.effective-panel summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.effective-panel summary::-webkit-details-marker {
  display: none;
}
.effective-panel summary::marker {
  display: none;
}
.effective-panel .caret {
  font-size: 0.625rem;
  transition: transform 120ms;
}
.effective-panel[open] .caret {
  transform: rotate(90deg);
}
.json-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: var(--font-family-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--text);
  margin: 10px 0 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-disabled,
button.btn-primary:disabled {
  background: var(--text-dim);
  border-color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.65;
}

/* ============================================================================
   SGM-244 Phase 2A v5: LinkedIn Dashboard styles
   ============================================================================ */
.li-dashboard { padding: 16px 24px 64px; max-width: 1280px; margin: 0 auto; }
.li-header { margin-bottom: 24px; }
.li-title { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.li-title h2 { margin: 0; font-size: 24px; font-weight: 700; color: var(--text); }
.li-pill {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 6px 14px; border-radius: var(--radius-full);
  background: rgba(0,0,0,0.04); color: var(--pc, var(--text-muted));
  font-size: 12px; font-weight: 600; line-height: 1.2;
}
.li-pill-sub { font-size: 10px; font-weight: 400; color: var(--text-muted); }
.li-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.li-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; background: transparent; border: none;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.li-tab:hover { color: var(--text); background: var(--bg-card-hover); }
.li-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.li-tab i { width: 16px; height: 16px; }

.li-tab-content { min-height: 300px; }

.li-tiles {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .li-tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .li-tiles { grid-template-columns: 1fr; } }
.li-tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 4px;
}
.li-tile-val { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.li-tile-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.li-tile-sub { font-size: 11px; color: var(--text-muted); }

.li-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.li-section header { display: flex; gap: 12px; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; }
.li-section header h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.li-section-sub { font-size: 12px; color: var(--text-muted); }

.li-feed { display: flex; flex-direction: column; gap: 8px; }
.li-feed-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card);
}
.li-feed-type {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--primary-bg); color: var(--primary);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.li-feed-type[data-type="linkedin_post_comment"] { background: var(--info-bg); color: var(--info); }
.li-feed-type[data-type="linkedin_post_reaction"] { background: var(--warning-bg); color: var(--warning); }
.li-feed-type[data-type="linkedin_post_share"] { background: var(--success-bg); color: var(--success); }
.li-feed-type[data-type="linkedin_post_mention"] { background: var(--primary-bg); color: var(--primary); }
.li-feed-type[data-type="linkedin_admin_comment"] { background: var(--accent-bg); color: var(--accent); }
.li-feed-title { font-size: 13px; font-weight: 600; color: var(--text); }
.li-feed-account { font-size: 12px; color: var(--text-muted); }
.li-feed-excerpt { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.li-feed-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-family: var(--font-family-mono); }
.li-empty { text-align: center; color: var(--text-muted); padding: 24px; font-size: 13px; }

.li-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.li-actions .btn i { width: 14px; height: 14px; margin-right: 4px; }

.li-table { width: 100%; border-collapse: collapse; }
.li-table th, .li-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.li-table th { font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
.li-post-content { max-width: 400px; }

.li-tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--bg-code); color: var(--text-secondary);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.li-tag[data-status="pending"] { background: var(--warning-bg); color: var(--warning); }
.li-tag[data-status="publishing"] { background: var(--primary-bg); color: var(--primary); }
.li-tag[data-status="published"] { background: var(--success-bg); color: var(--success); }
.li-tag[data-status="failed"] { background: var(--danger-bg); color: var(--danger); }
.li-tag[data-status="cancelled"] { background: var(--bg-code); color: var(--text-muted); }
.li-tag[data-status="on"] { background: var(--success-bg); color: var(--success); }
.li-tag[data-status="off"] { background: var(--bg-code); color: var(--text-muted); }

.li-comments { display: flex; flex-direction: column; gap: 12px; }
.li-comment-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px;
}
.li-comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.li-comment-actor { font-size: 13px; font-weight: 600; color: var(--text); }
.li-comment-text { font-size: 13px; color: var(--text-secondary); margin: 6px 0 12px; line-height: 1.5; }
.li-comment-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.li-comment-draft {
  margin-top: 12px; padding: 10px; background: var(--bg-code); border-radius: var(--radius);
}
.li-draft-content { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.li-reply-edit {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); color: var(--text); font-family: inherit; font-size: 13px; resize: vertical;
}

.li-defs { display: grid; grid-template-columns: minmax(200px, max-content) 1fr; gap: 8px 16px; margin: 0; }
.li-defs dt { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.li-defs dd { font-size: 13px; color: var(--text); margin: 0; }
.li-defs code { font-family: var(--font-family-mono); font-size: 12px; padding: 1px 6px; background: var(--bg-code); border-radius: 3px; }
.li-admin-result { margin-top: 12px; }
.li-admin-result pre {
  background: var(--bg-code); padding: 12px; border-radius: var(--radius);
  font-family: var(--font-family-mono); font-size: 12px; overflow-x: auto; max-height: 400px;
}
.li-error { color: var(--danger); font-weight: 600; font-size: 13px; }

/* Modal */
.li-modal-overlay {
  position: fixed; inset: 0; background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.li-modal {
  background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  width: 640px; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column;
}
.li-modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.li-modal-h h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
.li-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.li-modal-body label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.li-modal-body input[type="text"], .li-modal-body input[type="datetime-local"], .li-modal-body input[type="file"], .li-modal-body textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); color: var(--text); font-family: inherit; font-size: 13px;
}
.li-modal-body textarea { resize: vertical; }
.li-modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--border); }
.li-radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.li-radio-group label { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; }
.li-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.li-image-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.li-image-preview {
  padding: 8px 12px; background: var(--bg-code); border-radius: var(--radius);
  font-size: 12px; color: var(--text-secondary);
}
.li-image-error { color: var(--danger); font-size: 12px; }

/* SGM-244 v5 redesign: post-centric Engagement tab */
.li-post-list { display: flex; flex-direction: column; gap: 12px; }
.li-post-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 20px; box-shadow: var(--shadow-xs);
}
.li-post-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.li-post-card-text { flex: 1; font-size: 14px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.li-post-card-link {
  flex-shrink: 0; display: inline-flex; align-items: center; padding: 4px;
  color: var(--text-muted); border-radius: var(--radius); text-decoration: none;
}
.li-post-card-link:hover { color: var(--primary); background: var(--primary-bg); }
.li-post-card-link i { width: 18px; height: 18px; }
.li-post-card-meta {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 10px;
}
.li-post-card-date { font-family: var(--font-family-mono); }
.li-post-card-engagement { display: inline-flex; gap: 12px; align-items: center; }
.li-post-card-engagement span { display: inline-flex; align-items: center; gap: 4px; }
.li-post-card-breakdown { color: var(--text-secondary); font-size: 11px; }
.li-post-card-meta button { margin-left: auto; }
.li-post-card-detail { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.li-post-card-loading { text-align: center; color: var(--text-muted); padding: 12px; font-size: 12px; font-style: italic; }
.li-post-card-section { margin-bottom: 16px; }
.li-post-card-section h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.li-actor-list, .li-comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.li-actor-list li { display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; background: var(--bg-code); border-radius: var(--radius); font-size: 12px; }
.li-actor-list li a { color: var(--primary); text-decoration: none; }
.li-actor-list li a:hover { text-decoration: underline; }
.li-comment-list li { padding: 8px 12px; background: var(--bg-code); border-radius: var(--radius); }
.li-comment-actor { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: 12px; }
.li-comment-actor a { color: var(--primary); text-decoration: none; font-weight: 600; }
.li-comment-message { font-size: 13px; color: var(--text); white-space: pre-wrap; line-height: 1.5; }
.li-empty-sm { text-align: center; color: var(--text-muted); font-size: 12px; padding: 12px; }

/* SGM-244 v5: post text show-more toggle */
.li-post-card-text-wrap { flex: 1; }
.li-post-card-toggle {
  margin-top: 6px; padding: 2px 0; background: transparent; border: none;
  color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; padding-left: 0;
}
.li-post-card-toggle:hover { text-decoration: underline; }

/* SGM-244 v5 hotfix #12: engagement metadata status banner.
   Surfaces server-side cache state (fresh / stale / rate_limited / no_data)
   instead of silently rendering 0s when LinkedIn rate-limits us. */
.li-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
  font-size: 13px; line-height: 1.5;
}
.li-banner i[data-lucide] { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; }
.li-banner-info {
  background: color-mix(in srgb, var(--info) 10%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
  color: var(--text);
}
.li-banner-info i[data-lucide] { color: var(--info); }
.li-banner-warn {
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--text);
}
.li-banner-warn i[data-lucide] { color: var(--warning); }

/* ── SGM-454: Manual campaign Overview detailed-stats panel ─────────────── */
.camp-os-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.camp-os-panel-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.camp-os-panel-h h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.camp-os-panel-h .camp-os-sub {
  font-size: 11px;
  color: var(--text-muted);
}
@media (max-width: 900px) {
  .camp-os-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Intent / funnel signal cards — the operational "did anyone bite?" answer */
.camp-os-intent-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .camp-os-intent-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
.camp-os-intent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.camp-os-intent-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.camp-os-intent-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.camp-os-intent-unit {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 1px;
}
.camp-os-intent-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Top CTA — single-URL hero card */
.camp-os-cta-hero {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.camp-os-cta-url {
  display: inline-block;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
  text-decoration: none;
}
.camp-os-cta-url:hover {
  text-decoration: underline;
}
.camp-os-cta-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.camp-os-cta-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.camp-os-cta-stat-v {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.camp-os-cta-stat-unit {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}
.camp-os-cta-stat-l {
  font-size: 11px;
  color: var(--text-muted);
}

/* Multi-CTA stacked list */
.camp-os-cta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.camp-os-cta-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.camp-os-cta-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.camp-os-cta-bar-fill {
  height: 100%;
  border-radius: var(--radius);
  transition: width 0.3s;
}
.camp-os-cta-bar-fill.primary   { background: var(--primary); }
.camp-os-cta-bar-fill.secondary { background: var(--info); }
.camp-os-cta-bar-fill.neutral   { background: var(--text-muted); }
.camp-os-cta-row-stats {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
}
.camp-os-cta-row-stats strong {
  color: var(--text);
}

/* ── SGM-459 Phase 1B-2: Scoring Rules admin page ───────────────────────── */
.scoring-rules-page {
  max-width: 1320px;
  margin: 0 auto;
}
.sr-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.sr-header-row .page-title {
  margin: 0 0 4px 0;
  font-size: 22px;
  color: var(--text);
}
.sr-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 76ch;
  line-height: 1.5;
}
.sr-permission-banner {
  background: var(--bg-input);
  border-left: 3px solid var(--info);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* URL tester strip */
.sr-tester {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.sr-tester-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.sr-tester-label i {
  width: 16px;
  height: 16px;
}
.sr-tester-input-row {
  display: flex;
  gap: 10px;
}
.sr-tester-input-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.sr-tester-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.sr-tester-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sr-tester-result-match {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-left: 3px solid var(--success);
}
.sr-tester-result-default {
  background: var(--bg-input);
  border-left: 3px solid var(--text-muted);
}
.sr-tester-event {
  color: var(--primary);
  font-weight: 600;
}
.sr-tester-score {
  background: var(--bg-card);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  margin-left: 6px;
}
.sr-tester-pending {
  color: var(--text-muted);
  font-style: italic;
}

/* Filter bar */
.sr-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.sr-filter-bar select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
}
.sr-filter-spacer {
  flex: 1;
}
.sr-count {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Channel groups */
.sr-group {
  margin-bottom: 24px;
}
.sr-group-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.sr-group-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sr-group-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Rules table */
.sr-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sr-table thead {
  background: var(--bg-input);
}
.sr-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.sr-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.sr-table tbody tr:last-child td {
  border-bottom: none;
}
.sr-table tbody tr:hover {
  background: color-mix(in srgb, var(--bg-input) 60%, transparent);
}
.sr-col-score {
  width: 80px;
  text-align: center;
}
.sr-col-desc {
  color: var(--text-muted);
  max-width: 280px;
}
.sr-col-status {
  width: 90px;
}
.sr-col-actions {
  width: 90px;
  text-align: right;
}
.sr-score-display {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sr-score-pos {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
}
.sr-score-neg {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}
.sr-pill-hi {
  display: inline-block;
  background: var(--warning);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.5px;
}
.sr-pattern-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sr-pattern-chip {
  display: inline-block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 8px;
  font-size: 12px;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text);
}
.sr-no-patterns {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}
.sr-status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sr-status-on {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.sr-status-off {
  background: var(--bg-input);
  color: var(--text-muted);
}

/* Toggle switch (replaces the status pill when user has update permission) */
.sr-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  cursor: pointer;
}
.sr-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.sr-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: 0.15s;
}
.sr-toggle-slider::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.15s;
}
.sr-toggle input:checked + .sr-toggle-slider {
  background: color-mix(in srgb, var(--success) 25%, transparent);
  border-color: var(--success);
}
.sr-toggle input:checked + .sr-toggle-slider::before {
  transform: translateX(18px);
  background: var(--success);
}

/* Icon buttons */
.sr-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.15s;
}
.sr-icon-btn:hover {
  background: var(--bg-input);
  color: var(--text);
  border-color: var(--border);
}
.sr-icon-btn.sr-icon-danger:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}
.sr-icon-btn i {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Edit form (inside modal) */
.sr-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sr-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.sr-form-row-full {
  grid-template-columns: 1fr;
}
.sr-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sr-form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.sr-form-field label small {
  font-weight: 400;
  color: var(--text-muted);
}
.sr-form-field input[type="text"],
.sr-form-field input[type="number"],
.sr-form-field select,
.sr-form-field textarea {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.sr-form-field input:focus,
.sr-form-field select:focus,
.sr-form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.sr-form-field input[readonly],
.sr-form-field select[disabled] {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}
.sr-form-field textarea {
  font-family: var(--font-mono, ui-monospace, monospace);
  resize: vertical;
}
.sr-form-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.sr-form-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.sr-form-field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

/* Mobile reflow */
@media (max-width: 720px) {
  .sr-form-row { grid-template-columns: 1fr; }
  .sr-table { font-size: 12px; }
  .sr-col-desc { display: none; }
  .sr-header-row { flex-direction: column; }
}

/* ── SGM-462 Phase 1C-3: Intent Alerts toggle ──────────────────────────── */
/* CSS-driven so the visual state reacts to the checkbox automatically — no
   need for JS to update inline styles. Hides the native input and renders a
   track + thumb that respond to :checked via sibling selectors. */
.alerts-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.alerts-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.alerts-toggle .alerts-toggle-track {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s;
}
.alerts-toggle .alerts-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.alerts-toggle input:checked + .alerts-toggle-track {
  background: color-mix(in srgb, var(--success) 25%, transparent);
  border-color: var(--success);
}
.alerts-toggle input:checked + .alerts-toggle-track::after {
  transform: translateX(24px);
  background: var(--success);
}
.alerts-toggle .alerts-toggle-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  min-width: 64px;
}
.alerts-toggle input:checked ~ .alerts-toggle-label {
  color: var(--success);
}

/* ── Account Profile + Opportunities tabs (SGM-X, 2026-05-16) ──────────────
   Renders the widened enrichment data from migration 279 across 5
   conditional sections plus an Opportunities table. Empty data hides the
   whole .ap-section per the no-placeholders rule. */

.ap-page { display: flex; flex-direction: column; gap: 16px; padding: 4px 0 12px; }

.ap-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.ap-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ap-section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ap-section-header > [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.ap-grid-2 {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  align-items: start;
}

.ap-logo {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ap-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ap-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  align-items: baseline;
}
.ap-row + .ap-row { border-top: 1px dashed var(--border); }
.ap-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.ap-value {
  color: var(--text);
  word-break: break-word;
}
.ap-value a { color: var(--primary); text-decoration: none; }
.ap-value a:hover { text-decoration: underline; }

.ap-subsection {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.ap-sublabel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.ap-chip {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  margin: 1px 2px 1px 0;
}
.ap-chip-soft {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  margin: 1px 2px 1px 0;
}
.ap-chip-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.ap-chip-stat strong { color: var(--text); font-weight: 700; }
.ap-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.ap-social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.ap-social {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--primary);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
}
.ap-social:hover { background: var(--primary-bg); border-color: var(--primary-border); }
.ap-social [data-lucide] { width: 13px; height: 13px; }

.ap-seo-description {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  font-style: italic;
}

.ap-growth {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius);
  font-weight: 600;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}
.ap-growth.pos {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}
.ap-growth.neg {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.ap-renewal-warn { color: var(--danger); font-weight: 600; font-size: 11px; margin-left: 6px; }
.ap-renewal-ok   { color: var(--success); font-weight: 600; font-size: 11px; margin-left: 6px; }

/* Empty-marker for "show all fields, mark blanks" rendering (2026-05-16) */
.ap-empty {
  color: var(--text-dim);
  font-style: italic;
  user-select: none;
}

.ap-bool {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius);
}
.ap-bool.yes {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}
.ap-bool.no {
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-muted);
}

/* BANT + ERP checklist chips: explicit yes / no / unknown so the user
   can tell the difference between "Lead said no" and "no data". */
.ap-bant-chip {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius);
  margin: 2px 4px 2px 0;
  border: 1px solid var(--border);
}
.ap-bant-chip.yes {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
}
.ap-bant-chip.no {
  background: var(--bg-input);
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}
.ap-bant-chip.unknown {
  background: var(--bg-input);
  color: var(--text-dim);
  font-style: italic;
}

.ap-social-empty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
}
.ap-social-empty [data-lucide] { width: 13px; height: 13px; }

.ap-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 4px;
}

.ap-exec-table,
.ap-opp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ap-exec-table th,
.ap-opp-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
}
.ap-exec-table td,
.ap-opp-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 12px;
  color: var(--text);
}
.ap-exec-table tbody tr:last-child td,
.ap-opp-table tbody tr:last-child td { border-bottom: none; }
.ap-exec-table tbody tr:hover,
.ap-opp-table tbody tr:hover { background: var(--bg-input); }

/* Mobile reflow */
@media (max-width: 720px) {
  .ap-grid-2 { grid-template-columns: 1fr; }
  .ap-row { grid-template-columns: 1fr; gap: 2px; padding: 6px 0; }
  .ap-label { font-size: 10px; }
  .ap-opp-table, .ap-exec-table { font-size: 11px; }
  .ap-section { padding: 14px 14px; }
}

/* ── Applications tab Option B sub-sections (SGM-X, 2026-05-16) ──────────
   Three sources stack in the Applications tab: SFDC Confirmed (highest
   trust), Apollo Detected (medium trust), ARTW Inventory (existing
   premium-locked grouping). Each renders inside an .apps-source-group. */
.apps-source-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.apps-source-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.apps-source-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.apps-source-header > [data-lucide] {
  width: 14px;
  height: 14px;
  color: var(--primary);
}
.apps-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  margin-left: auto;
}
.apps-source-badge.trust-high {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.apps-source-badge.trust-med {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}
.apps-source-badge.trust-low {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.apps-source-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}
.apps-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.apps-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.apps-tag-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  font-size: 12px;
}
.apps-tag-list code {
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apps-empty-source {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* ============================================================================
   SGM-522 — Run Trace: Skills Loaded panel
   Per-step manifest of skills that were in the agent's plugin-dir scope at
   run time. Renders inside .rt-step cards, between .rt-meta and the tool
   calls section. All colors/radii/spacing from the SafeGTM token system.
   ============================================================================ */
.rt-skills .rt-skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.rt-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
  cursor: help;
  max-width: 360px;
}
.rt-skill-chip:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}
.rt-skill-name {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.rt-skill-version {
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.rt-skill-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--warning);
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
}
.rt-skill-disabled {
  opacity: 0.55;
  border-style: dashed;
}

/* ────────────────────────────────────────────────────────────────────
   SGM-532 (PR-2 of SGM-528 Epic): Signal Article Reader tab
   Visual spec: ~/.claude/mockups/safegtm/2026-05-23-signal-article-reader-tab.html
   Token Map: ~/.claude/plans/safegtm/2026-05-23-sgm-528-epic-arc.md §PR-2
   ──────────────────────────────────────────────────────────────────── */
.article-band {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--primary-bg);
  border-bottom: 1px solid var(--primary-border);
  font-size: 12px; color: var(--text-muted);
  flex-wrap: wrap;
}
.article-band-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.article-band-pill {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: var(--radius-full); font-size: 11px; font-weight: 600;
  background: var(--success-bg); color: var(--success);
  border: 1px solid var(--success-border);
}
.article-source-link {
  color: var(--primary); text-decoration: none; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.article-source-link:hover { color: var(--primary-hover); text-decoration: underline; }

.article-canvas { max-width: 720px; margin: 0 auto; padding: 32px 32px 48px; }
.article-image {
  width: 100%; max-height: 360px; object-fit: cover;
  border-radius: var(--radius-lg); margin-bottom: 24px;
  background: var(--bg-card-hover);
  display: block;
}
.article-image-fallback {
  width: 100%; min-height: 180px; border-radius: var(--radius-lg);
  background: var(--bg-code);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 12px; margin-bottom: 24px;
  border: 1px dashed var(--border-light);
}
.article-headline {
  font-size: 28px; font-weight: 700; line-height: 1.25;
  color: var(--text); margin: 0 0 12px; letter-spacing: -0.01em;
}
.article-byline {
  font-size: 13px; color: var(--text-muted);
  margin: 0 0 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article-byline strong { color: var(--text-secondary); }
.article-body {
  font-size: 15px; line-height: 1.7; color: var(--text-secondary);
}
.article-body p { margin: 0 0 16px; }
.article-body h2 { font-size: 20px; font-weight: 600; color: var(--text); margin: 24px 0 12px; }
.article-body h3 { font-size: 17px; font-weight: 600; color: var(--text); margin: 20px 0 10px; }
.article-body a { color: var(--primary); }
.article-body a:hover { color: var(--primary-hover); }
.article-body blockquote {
  margin: 16px 0; padding: 8px 16px;
  border-left: 3px solid var(--primary-border);
  color: var(--text-muted); font-style: italic;
}
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 12px 0; }
.article-body code {
  background: var(--bg-code); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-family-mono); font-size: 13px;
}
.article-body pre {
  background: var(--bg-code); padding: 12px;
  border-radius: var(--radius); overflow-x: auto;
  font-family: var(--font-family-mono); font-size: 12px; line-height: 1.5;
}
.article-footer-meta {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* State cards (empty / error / blocked / not_found / permission) */
.article-state-card {
  max-width: 480px; margin: 48px auto; padding: 32px 24px;
  text-align: center;
}
.article-state-icon {
  width: 56px; height: 56px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 24px;
}
.article-state-icon.muted   { background: var(--bg-code);  color: var(--text-muted); }
.article-state-icon.danger  { background: var(--danger-bg); color: var(--danger); }
.article-state-icon.warning { background: var(--warning-bg); color: var(--warning); }
.article-state-icon.info    { background: var(--info-bg);   color: var(--info); }
.article-state-card h3 {
  font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 8px;
}
.article-state-card p {
  font-size: 13px; color: var(--text-muted); line-height: 1.55; margin: 0 0 20px;
}
.article-state-card .article-reason {
  font-family: var(--font-family-mono); font-size: 11px;
  color: var(--text-dim); margin-bottom: 16px;
}
.article-state-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.article-state-actions .btn-primary,
.article-state-actions .btn-secondary,
.article-state-actions .btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none; min-height: 44px;
}
.article-state-actions .btn-primary {
  background: var(--accent); color: var(--text-inverse); border-color: var(--accent);
}
.article-state-actions .btn-primary:hover { background: var(--accent-hover); }
.article-state-actions .btn-secondary {
  background: var(--bg-card); color: var(--text-secondary); border-color: var(--border-light);
}
.article-state-actions .btn-secondary:hover { background: var(--bg-card-hover); }
.article-state-actions .btn-ghost {
  background: transparent; color: var(--text-muted);
}
.article-state-actions .btn-ghost:hover { color: var(--text-secondary); background: var(--bg-card-hover); }
.article-footer-meta .btn-ghost {
  background: transparent; color: var(--text-muted);
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border-light); border-radius: var(--radius);
  cursor: pointer;
}
.article-footer-meta .btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-secondary); }

/* Loading skeleton */
.article-skeleton {
  background: linear-gradient(90deg, var(--bg-card-hover) 0%, var(--bg-code) 50%, var(--bg-card-hover) 100%);
  background-size: 200% 100%; border-radius: var(--radius);
  animation: article-shimmer 1.4s infinite;
}
@keyframes article-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.article-skeleton-image    { height: 240px; margin-bottom: 24px; }
.article-skeleton-headline { height: 28px; width: 80%; margin-bottom: 12px; }
.article-skeleton-byline   { height: 14px; width: 50%; margin-bottom: 28px; }
.article-skeleton-line     { height: 14px; margin-bottom: 10px; }
.article-skeleton-line.w95 { width: 95%; }
.article-skeleton-line.w90 { width: 92%; }
.article-skeleton-line.w85 { width: 85%; }
.article-skeleton-line.w70 { width: 70%; }

/* Offline banner inside the Article tab */
.article-offline-banner {
  padding: 10px 24px; background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-border);
  color: var(--warning); font-size: 12px; font-weight: 500;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.article-offline-banner strong { color: var(--warning); }

/* ────────────────────────────────────────────────────────────────────
   SGM-533 (PR-3 of SGM-528 Epic): AI Summary panel inside Article tab.
   Renders ABOVE the article body when signal_articles.summary_haiku is
   populated by agt_article_summariser.
   ──────────────────────────────────────────────────────────────────── */
.article-summary-panel {
  margin: 0 0 24px;
  padding: 20px 24px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
}
.article-summary-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 12px;
}
.article-summary-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--info);
}
.article-summary-action {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.article-summary-action-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(128, 161, 74, 0.25); }
.article-summary-action-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.article-summary-action-info    { background: var(--bg-card);    color: var(--info);    border: 1px solid var(--primary-border); }
.article-summary-action-muted   { background: var(--bg-code);    color: var(--text-muted); border: 1px solid var(--border); }
.article-summary-lead {
  margin: 0 0 16px; color: var(--text); font-size: 15px; line-height: 1.55;
}
.article-summary-section { margin: 0 0 14px; }
.article-summary-section:last-child { margin-bottom: 0; }
.article-summary-section-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px;
}
.article-summary-bullets {
  margin: 0; padding: 0 0 0 18px; color: var(--text-secondary);
}
.article-summary-bullets li { margin: 0 0 4px; line-height: 1.5; }
.article-summary-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.article-summary-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  border: 1px solid transparent;
}
.article-summary-chip-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.article-summary-chip-success { background: var(--success-bg); color: var(--success); border-color: rgba(128, 161, 74, 0.25); }
.article-summary-entities {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-card); border-radius: var(--radius); padding: 10px 12px;
  margin-top: 8px;
}
.article-summary-entities > div { margin: 0 0 4px; line-height: 1.5; }
.article-summary-entities > div:last-child { margin-bottom: 0; }
.article-summary-entities strong { color: var(--text-secondary); font-weight: 600; }

/* ── SGM-554/555: audit / change-history timeline (contact + account History tabs) ──
   Audit-prefixed class names so nothing collides with the shared stylesheet's
   generic classes — the original .badge collided with the global .badge
   { margin-left:auto } (SGM-555 layout bug). */
.audit-tl { position: relative; margin: 0; padding: 0 0 0 6px; list-style: none; }
.audit-tl-item { position: relative; padding: 0 0 18px 26px; border-left: 1px solid var(--border); }
.audit-tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.audit-tl-dot { position: absolute; left: -6px; top: 2px; width: 11px; height: 11px; border-radius: var(--radius-full); border: 2px solid var(--bg-card); }
.audit-tl-dot.create { background: var(--success); }
.audit-tl-dot.update { background: var(--primary); }
.audit-tl-dot.delete { background: var(--danger); }
.audit-tl-dot.merge  { background: var(--warning); }
.audit-tl-dot.tag    { background: var(--text-dim); }
.audit-tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audit-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--radius-full); line-height: 1.6; margin: 0; }
.audit-badge.create { background: var(--success-bg); color: var(--success); }
.audit-badge.update { background: var(--primary-bg); color: var(--primary); }
.audit-badge.delete { background: var(--danger-bg); color: var(--danger); }
.audit-badge.merge  { background: var(--warning-bg); color: var(--warning); }
.audit-badge.tag    { background: var(--bg-code); color: var(--text-secondary); }
.audit-src { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: var(--radius-full); background: var(--bg-code); color: var(--text-secondary); }
.audit-src.agent { background: var(--purple-bg); color: var(--purple); }
.audit-src.sync  { background: var(--info-bg); color: var(--info); }
.audit-actor { color: var(--text-secondary); font-weight: 600; font-size: 12.5px; }
.audit-ts { color: var(--text-dim); font-size: 11.5px; margin-left: auto; }
.audit-diff { margin: 6px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.audit-diff .audit-k { color: var(--text-muted); }
.audit-diff .audit-from { color: var(--text-muted); text-decoration: line-through; }
.audit-diff .audit-arrow { color: var(--text-dim); margin: 0 5px; }
.audit-diff .audit-to { color: var(--text); font-weight: 500; }
.audit-diff .audit-muted { color: var(--text-muted); }

/* ============================================================================
   Campaign Performance Report (SGM-592) — /#campaign-report
   Ported verbatim from the approved mockup
   ~/.claude/mockups/safegtm/2026-06-23-campaign-report.html. All :root tokens,
   no raw hex. (.btn/.btn-primary/.btn-ghost reuse the app's existing classes.)
   ============================================================================ */
.cr-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cr-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 3px; }
.cr-title .cr-count { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 8px; }
.cr-sub { font-size: 12.5px; color: var(--text-muted); margin: 0; max-width: 92ch; line-height: 1.5; }
.cr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* filter bar */
.cr-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; background: var(--primary-bg); border: 1px solid var(--primary-border); border-radius: var(--radius); margin-bottom: 18px; }
.cr-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-full); font-size: 12.5px; color: var(--text-secondary); cursor: pointer; position: relative; }
.cr-filter b { font-weight: 600; color: var(--text); }
.cr-filter .x { color: var(--text-dim); font-weight: 700; cursor: pointer; }
.cr-filter select { border: none; background: transparent; font: inherit; color: var(--text); cursor: pointer; outline: none; }
.cr-search { flex: 1; min-width: 160px; min-height: 38px; padding: 0 14px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-full); font-size: 12.5px; color: var(--text); }
/* custom date-range popover (Range pill) */
.cr-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px; min-width: 260px; cursor: default; }
.cr-pop label { display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 4px; }
.cr-pop input[type=date] { width: 100%; min-height: 34px; padding: 0 10px; margin-bottom: 10px; background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius); font: inherit; color: var(--text); }
.cr-pop-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cr-preset { font-size: 11.5px; padding: 4px 10px; border-radius: var(--radius-full); border: 1px solid var(--border-light); background: var(--bg-input); color: var(--text-secondary); cursor: pointer; }
.cr-preset.active { background: var(--primary-bg); border-color: var(--primary-border); color: var(--primary); font-weight: 600; }

/* KPI band */
.cr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.cr-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; position: relative; overflow: hidden; }
.cr-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.cr-kpi.k-accent::before { background: var(--accent); }
.cr-kpi.k-warn::before { background: var(--warning); }
.cr-kpi-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px; }
.cr-kpi-val { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1; }
.cr-kpi-delta { font-size: 11px; font-weight: 600; margin-top: 5px; font-family: var(--font-family-mono); }
.cr-kpi-delta.up { color: var(--success); } .cr-kpi-delta.down { color: var(--danger); } .cr-kpi-delta.flat { color: var(--text-dim); }

/* data table */
.cr-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.cr { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
table.cr thead th { text-align: right; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 11px 12px; background: var(--bg-code); border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; }
table.cr thead th:first-child, table.cr tbody td:first-child { text-align: left; }
table.cr thead th .sort { color: var(--primary); }
table.cr tbody td { text-align: right; padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.cr tbody tr:hover td { background: var(--bg-card-hover); cursor: pointer; }
.cr-cname { font-weight: 600; color: var(--text); }
.cr-mode { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--radius-full); margin-left: 7px; vertical-align: middle; }
.cr-mode.m-manual { background: var(--accent-bg); color: var(--accent); }
.cr-mode.m-signal { background: var(--primary-bg); color: var(--primary); }
.cr-mode.m-apollo { background: var(--info-bg); color: var(--info); }
.cr-rate-good { color: var(--success); font-weight: 600; }
.cr-rate-mid { color: var(--warning); font-weight: 600; }
.cr-rate-low { color: var(--danger); font-weight: 600; }
.cr-totalrow td { font-weight: 700; color: var(--text); background: var(--primary-bg); border-top: 2px solid var(--primary-border); border-bottom: none; cursor: default; }
.cr-totalrow:hover td { background: var(--primary-bg); }
.cr-attr-note { font-size: 10.5px; color: var(--text-dim); margin: 8px 0 0; line-height: 1.5; }

/* drill-in: funnel + narrative */
.cr-drill { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-top: 20px; }
.cr-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.cr-card h4 { font-size: 13px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 7px; color: var(--text); }
.cr-card h4 .cr-aitag { font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); background: var(--accent-bg); padding: 2px 7px; border-radius: var(--radius-full); }
.cr-funnel-step { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.cr-funnel-bar { height: 26px; border-radius: var(--radius); background: var(--primary); display: flex; align-items: center; padding: 0 9px; color: var(--text-inverse); font-size: 11px; font-weight: 600; font-family: var(--font-family-mono); min-width: 30px; }
.cr-funnel-label { width: 92px; font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; }
.cr-narr p { font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); margin: 0 0 9px; }
.cr-narr .cr-narr-lead { color: var(--text); font-weight: 600; }
.cr-narr ul { margin: 0 0 4px; padding-left: 18px; }
.cr-narr li { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); margin-bottom: 5px; }
.cr-tip { font-size: 11px; color: var(--text-dim); font-style: italic; }

/* state notices */
.cr-notice { text-align: center; padding: 46px 24px; }
.cr-notice .cr-ic { width: 46px; height: 46px; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.cr-notice h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.cr-notice p { font-size: 13px; color: var(--text-muted); margin: 0 auto 16px; max-width: 46ch; line-height: 1.55; }
.cr-ic-empty { background: var(--primary-bg); color: var(--primary); }
.cr-ic-error { background: var(--danger-bg); color: var(--danger); }
@media (max-width: 760px) { .cr-kpis { grid-template-columns: repeat(2, 1fr); } .cr-drill { grid-template-columns: 1fr; } }

/* ============================================================================
   Content Analytics Report (SGM-594) — /#content-report
   Reuses the SGM-592 cr-* component language (KPI band / cards / funnel bars /
   table / narrative). Only the content-specific primitives below are new:
   numbered section headers, the 2-col card grid, topic tags, journey rows.
   Ported from ~/.claude/mockups/safegtm/2026-06-23-content-report.html. All
   :root tokens, no raw hex.
   ============================================================================ */
.cr-kpi.k-purple::before { background: var(--purple); }
.cr-kpis-3 { grid-template-columns: repeat(3, 1fr); }

/* numbered section headers (1 Consumption · 2 Funnel · 3 Performance) */
.cr-section { font-size: 14px; font-weight: 700; color: var(--text); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; }
.cr-section:first-child { margin-top: 6px; }
.cr-section-n { width: 20px; height: 20px; border-radius: var(--radius-full); background: var(--primary); color: var(--text-inverse); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-family-mono); }

/* card grids */
.cr-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.cr-cards-1 { grid-template-columns: 1fr; }

/* content path under the asset name in the top-content table */
.cr-path { font-family: var(--font-family-mono); font-size: 11px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; max-width: 42ch; }
.cr-hi { color: var(--warning); font-weight: 700; }

/* topic tags — content topics colored, structural topics neutral */
.cr-topic { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--radius-full); margin-left: 7px; vertical-align: middle; }
.cr-topic.t-blog { background: var(--primary-bg); color: var(--primary); }
.cr-topic.t-article { background: var(--info-bg); color: var(--info); }
.cr-topic.t-case { background: var(--accent-bg); color: var(--accent); }
.cr-topic.t-ebook { background: var(--purple-bg); color: var(--purple); }
.cr-topic.t-webinar { background: var(--warning-bg); color: var(--warning); }
.cr-topic.t-sol, .cr-topic.t-news, .cr-topic.t-page { background: var(--bg-code); color: var(--text-secondary); }

/* journey / leaderboard rows (funnel journeys, buying signals, topic influence) */
.cr-journey { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 9px; padding: 8px 10px; background: var(--bg-code); border-radius: var(--radius); }
.cr-journey:last-child { margin-bottom: 0; }
.cr-jnode { padding: 3px 9px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-full); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; color: var(--text-secondary); }
.cr-jnode.conv { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); font-weight: 600; }
.cr-jarr { color: var(--text-dim); flex-shrink: 0; }
.cr-jn { margin-left: auto; font-family: var(--font-family-mono); font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

@media (max-width: 760px) { .cr-cards { grid-template-columns: 1fr; } .cr-kpis-3 { grid-template-columns: repeat(2, 1fr); } }

