/*
 * clair_ui.css — Clair Design System
 * Clair (Gemini Autumn) 3.2.0 · IT CROWD S.A.S
 *
 * 13 layers — load order is architectural:
 *  1.  Reset + base
 *  2.  Custom properties (light + dark)
 *  3.  Layout — report (two-pane)
 *  4.  Layout — landing
 *  5.  Header / footer
 *  6.  Navigation
 *  7.  Section cards
 *  8.  Compartment groups
 *  9.  Resource items
 * 10.  Tables
 * 11.  Badges + states
 * 12.  Drift indicators
 * 13.  Utilities
 *
 * Generator contract:
 *   Generators use ONLY class names defined here.
 *   No <style> tags. No style= attributes. No !important.
 */

/* ============================================================
   1. RESET + BASE
   ============================================================ */

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  /* No scroll-behavior: smooth — smooth scroll over 50,000px of report content
     produces a "reeling" effect as content flies past at high speed.
     Nav jumps use instant teleport + arrival flash (see _clairNavScroll in clair_ui.js). */
  scroll-padding-top: calc(var(--header-height) + 12px);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}


/* ============================================================
   2. CUSTOM PROPERTIES
   ============================================================ */

:root {
  /* --- Sidebar state (JS-driven via toggleSidebar) --- */
  --sidebar-current-width: 200px;
  /* --- Report nav state (JS-driven via toggleReportNav) --- */
  --report-nav-width: 160px;

  /* --- Surfaces --- */
  --bg-page:         #f4f5f7;
  --bg-card:         #ffffff;
  --bg-card-alt:     #f8f9fa;
  --bg-alt:          #f8f9fa;  /* alias — used by compute/bv inline table headers */
  --bg-header:       #ffffff;
  --bg-nav:          #ffffff;

  /* --- Borders --- */
  --border:          #e2e4e8;
  --border-strong:   #c9cdd4;

  /* --- Text --- */
  --text-primary:    #1a1d23;
  --text-secondary:  #5a6070;
  --text-muted:      #8a919e;

  /* --- Brand --- */
  --accent:          #1a56db;
  --accent-soft:     #e8eeff;
  
  /* --- Status --- */
  --state-running:   #16a34a;
  --state-stopped:   #dc2626;
  --state-warning:   #d97706;
  --state-unknown:   #6b7280;

  /* --- Drift --- */
  --drift-new:       #16a34a;
  --drift-deleted:   #dc2626;
  --drift-changed:   #d97706;
  --drift-ok:        #6b7280;

  /* --- Spacing tokens --- */
  --section-header-height:     44px;
  --section-header-padding:    10px 16px;
  --section-body-padding:      14px 16px;
  --section-gap:               10px;
  --compartment-header-height: 34px;
  --compartment-header-padding: 6px 12px;
  --resource-item-height:      32px;
  --resource-item-padding:     6px 12px;
  --table-row-height:          32px;
  --table-cell-padding:        6px 10px;
  --nav-width:                 160px;
  --header-height:             80px;
  --footer-height:             36px;

  /* --- Radius --- */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;

  /* --- Transition --- */
  --transition:  0.15s ease;
}

[data-theme="dark"] {
  /* IT CROWD Grey — uniform dark grey across ALL surfaces, no tint */
  --bg-page:         #28282e;  /* IT CROWD dark grey — sidebar, page, footer, all uniform */
  --bg-card:         #323238;  /* cards float above the uniform base */
  --bg-card-alt:     #38383e;  /* table alt rows, nested surfaces */
  --bg-alt:          #38383e;  /* alias — used by compute/bv inline table headers */
  --bg-header:       #28282e;  /* same as page — unified chrome, no dark bar */
  --bg-nav:          #28282e;
  --border:          #404048;  /* clear border on uniform grey */
  --border-strong:   #4e4e58;
  --text-primary:    #e8e8ec;
  --text-secondary:  #9898a4;
  --text-muted:      #5c5c68;
  --accent:          #4d7aff;
  --accent-soft:     #1e2040;
}


/* ============================================================
   3. LAYOUT — REPORT (two-pane)
   ============================================================ */

.clair-layout {
  display: flex;
  position: relative;   /* anchor for the report nav edge toggle button */
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.clair-nav {
  width: var(--report-nav-width);
  min-width: var(--report-nav-width);
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width var(--transition), min-width var(--transition);
}

/* Collapsed report nav — icon strip only */
.clair-nav.collapsed {
  width: 56px;
  min-width: 56px;
}

/* Hide text labels and section header when nav is collapsed */
.clair-nav.collapsed .clair-nav-label,
.clair-nav.collapsed .clair-nav-item-label {
  display: none;
}

/* Center items in collapsed state */
.clair-nav.collapsed .clair-nav-item {
  justify-content: center;
  padding: 8px 4px;
}

/* Report nav edge toggle — same pattern as landing sidebar toggle.
   Uses position:fixed so it remains visible at all scroll positions —
   anchored below the sticky header. Left driven by CSS variable. */
.clair-report-nav-edge-toggle {
  position: fixed;
  left: calc(var(--report-nav-width) - 10px);
  top: calc(var(--header-height) + 24px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: left var(--transition), background var(--transition),
              border-color var(--transition), color var(--transition);
  user-select: none;
}

.clair-report-nav-edge-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.clair-main {
  flex: 1;
  min-width: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

/* Drift bar — sits above plugin sections */
.clair-drift-bar {
  margin-bottom: 4px;
}


/* ============================================================
   4. LAYOUT — LANDING (sidebar + content)
   ============================================================ */

.clair-landing-layout {
  display: flex;
  position: relative;   /* anchor for the edge toggle button */
  min-height: calc(100vh - var(--header-height) - var(--landing-footer-height, 160px));
}

/* --- Logo image in header --- */
.clair-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition);
}

.clair-logo-link:hover {
  opacity: 0.85;
}

.clair-logo {
  height: 48px;
  width: 48px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

/* --- App identity block: name + version / subtitle --- */
.clair-app-identity {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.clair-app-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clair-version-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 5px;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Code name tag — replaces version badge in header */
.clair-codename {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* --- Sidebar --- */
.clair-landing-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width var(--transition), min-width var(--transition);
}

.clair-landing-sidebar.collapsed {
  width: 70px;
  min-width: 70px;
  overflow: hidden;
}

.clair-sidebar-inner {
  padding: 8px 0;
  min-width: 200px;
  width: 200px;
}

/* Collapsed sidebar inner — shrink to icon strip */
.clair-landing-sidebar.collapsed .clair-sidebar-inner {
  min-width: 70px;
  width: 70px;
}

/* Hide text-only elements when collapsed */
.clair-landing-sidebar.collapsed .clair-nav-label-spaced,
.clair-landing-sidebar.collapsed .clair-tenancy-item-name,
.clair-landing-sidebar.collapsed .clair-tenancy-item-meta,
.clair-landing-sidebar.collapsed .clair-nav-label {
  display: none;
}

/* Home icon in collapsed mode */
.clair-landing-sidebar.collapsed .clair-nav-home {
  justify-content: center;
  padding: 8px 4px;
}

/* Monogram badge — hidden by default, shown only when sidebar is collapsed */
.clair-tenancy-monogram {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 32px;
  flex-shrink: 0;
  background: var(--bg-card-alt);
}

.clair-landing-sidebar.collapsed .clair-tenancy-monogram {
  display: block;
}

.clair-monogram-red  { color: #C41230 !important; }
.clair-monogram-dark { color: #1a1d23 !important; }

[data-theme="dark"] .clair-monogram-dark { color: #ffffff !important; }

/* Collapsed tenancy item — center the monogram */
.clair-landing-sidebar.collapsed .clair-tenancy-item {
  justify-content: center;
  align-items: center;
  padding: 8px 4px;
  border-left: none;
}

.clair-landing-sidebar.collapsed .clair-tenancy-item.active {
  background: var(--accent-soft);
}

/* Collapsed nav icon (emoji in home button) */
.clair-nav-icon {
  flex-shrink: 0;
}

/* Sidebar edge toggle — small circle with triangle on sidebar right edge.
   Sibling of <aside> in layout div. Uses position:fixed so it remains
   visible at all scroll positions — anchored below the sticky header.
   Left position driven by CSS variable (JS updates on collapse/expand)
   so it transitions smoothly with the sidebar width. */
.clair-sidebar-edge-toggle {
  position: fixed;
  left: calc(var(--sidebar-current-width) - 10px);
  top: calc(var(--header-height) + 24px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  font-size: 9px;
  line-height: 1;
  color: var(--text-muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: left var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}

.clair-sidebar-edge-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Home button */
.clair-nav-home {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 4px;
}

.clair-nav-home:hover {
  background: var(--bg-card-alt);
  color: var(--text-primary);
}

.clair-nav-home.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Tenancy list items in sidebar */
.clair-tenancy-item {
  display: flex;
  flex-direction: column;
  padding: 6px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-left: 3px solid transparent;
}

.clair-tenancy-item:hover {
  background: var(--bg-card-alt);
}

.clair-tenancy-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.clair-tenancy-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clair-tenancy-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.clair-tenancy-item.active .clair-tenancy-item-name {
  color: var(--accent);
}

/* --- Content panels --- */
.clair-landing-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.clair-panel {
  display: none;
  flex-direction: column;
  flex: 1;
}

.clair-panel.active {
  display: flex;
}

/* Welcome panel */
.clair-welcome {
  padding: 40px 32px 32px;
  width: 100%;
  box-sizing: border-box;
}

/* Hero row: IT CROWD logo | intro text | Clair logo */
.clair-welcome-hero {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  margin: 0 auto 36px;
  max-width: 960px;
}

/* Square logo flanks — height driven by intro box via flex stretch */
.clair-welcome-logo-wrap {
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.clair-welcome-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 3D globe spin — perspective on wrapper gives genuine depth */
.clair-welcome-logo-wrap {
  perspective: 600px;
}

/* Base state — transition smoothly winds back to 0deg on mouse-out */
.clair-welcome-logo-img {
  will-change: transform;
  transform-origin: center center;
  transform: rotateY(0deg);
  transition: transform 0.5s ease-out;
}

/* Hover — animation overrides the transition while mouse is over */
.clair-welcome-logo-wrap:hover .clair-welcome-logo-img {
  animation: clair-logo-spinY 4s linear infinite;
  transition: none;
}

@keyframes clair-logo-spinY {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

/* Accessibility — suppress animation for users with vestibular sensitivity */
@media (prefers-reduced-motion: reduce) {
  .clair-welcome-logo-img {
    animation: none;
    transition: none;
    will-change: auto;
  }
}

/* Centered intro block — title, subtitle, description */
.clair-welcome-intro {
  flex: 1;
  min-width: 0;
  max-width: 600px;
  text-align: center;
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 32px 40px;
}

.clair-welcome-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.clair-welcome-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 14px;
}

.clair-welcome-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.clair-welcome-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* Plugin overview cards — fluid grid, elastic on resize and zoom */
.clair-plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
  width: 100%;
}

.clair-plugin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.clair-plugin-card:hover,
.clair-plugin-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--accent);
}

.clair-plugin-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.clair-plugin-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.clair-plugin-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Tenancy panel (when a tenancy is selected) */
.clair-tenancy-panel {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.clair-tenancy-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.clair-tenancy-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Available reports list */
.clair-reports-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.clair-reports-header {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.clair-report-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.clair-report-item:last-of-type {
  border-bottom: none;
}

.clair-report-item-label {
  flex: 1;
  color: var(--text-primary);
}

.clair-report-item-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.clair-reports-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.clair-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.clair-btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.clair-btn-primary:hover {
  opacity: 0.9;
}

.clair-btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.clair-btn-secondary:hover {
  background: var(--bg-card-alt);
  border-color: var(--border-strong);
}

.clair-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(40%);
}

/* ── Sidebar running indicator dot ───────────────────────────────────── */
.clair-nav-job-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--state-running);
  margin-left: auto;
  flex-shrink: 0;
  animation: clair-pulse 1.2s ease-in-out infinite;
}
@keyframes clair-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Generate Report button (larger than .clair-btn) ─────────────────── */
.clair-btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  transition: opacity var(--transition);
}
.clair-btn-generate:hover   { opacity: 0.88; }
.clair-btn-generate:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

/* ── Job status strip ─────────────────────────────────────────────────── */
.clair-job-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.clair-job-strip--running {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
}
[data-theme="dark"] .clair-job-strip--running {
  background: #0a1f10;
  border-color: #166534;
  color: #4ade80;
}
.clair-job-strip--failed {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
[data-theme="dark"] .clair-job-strip--failed {
  background: #280c0c;
  border-color: #7f1d1d;
  color: #f87171;
}
.clair-job-elapsed {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.clair-job-progress {
  flex: 1;
  font-weight: 400;
  color: inherit;
  opacity: 0.82;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clair-job-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: clair-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes clair-spin { to { transform: rotate(360deg); } }

/* ── Report links bar ─────────────────────────────────────────────────── */
.clair-report-links-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.clair-report-links-bar-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}
.clair-report-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity var(--transition);
}
.clair-report-link-btn--html {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.clair-report-link-btn--pdf {
  background: #fff5f5;
  color: #c0392b;
  border: 1px solid #e57373;
}
[data-theme="dark"] .clair-report-link-btn--pdf {
  background: #280c0c;
  color: #f87171;
  border-color: #7f1d1d;
}
.clair-report-link-btn:hover { opacity: 0.82; }

/* Toast notification */
.clair-toast {
  position: fixed;
  top: 76px;
  right: 20px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  z-index: 9999;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: clair-toast-in 0.28s ease;
  transition: opacity 0.4s ease;
}

.clair-toast-info {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text-primary);
}

.clair-toast-hide {
  opacity: 0;
}

@keyframes clair-toast-in {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Resource summary cards grid */
.clair-summary-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.clair-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
  width: 100%;
}

.clair-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
  transition: transform 0.25s ease,
              box-shadow 0.25s ease,
              border-color 0.20s ease,
              z-index 0s;
}

.clair-summary-card:hover {
  z-index: 10;
  transform: translateY(-3px) scale(1.13);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  border-color: var(--accent);
}

.clair-summary-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clair-summary-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #C41230;
}

.clair-summary-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.clair-summary-card-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 0;
}

.clair-summary-stat {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.clair-summary-stat-value {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.clair-drift-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

.clair-drift-pill.no-drift {
  background: color-mix(in srgb, var(--state-running) 12%, transparent);
  color: var(--state-running);
}

.clair-drift-pill.drift-detected {
  background: color-mix(in srgb, var(--state-stopped) 12%, transparent);
  color: var(--state-stopped);
}

.clair-drift-pill.first-report {
  background: color-mix(in srgb, var(--state-warning) 14%, transparent);
  color: var(--state-warning);
}

/* ---- Report selection list ---- */

.clair-report-select-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
}

.clair-report-list {
  height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.clair-report-list-item {
  padding: 9px 16px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: background var(--transition);
}

.clair-report-list-item:last-of-type {
  border-bottom: none;
}

.clair-report-list-item:hover {
  background: var(--bg-card-alt);
}

.clair-report-list-item[aria-selected="true"],
.clair-report-list-item.selected {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 500;
}

.clair-report-list-empty {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Sidebar nav label with top padding */
.clair-nav-label-spaced {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Plugin card icon — uniform Brand Crimson tint (Phosphor SVG icons, #C41230) */
.plugin-icon-global,
.plugin-icon-iam,
.plugin-icon-vcn,
.plugin-icon-cpe,
.plugin-icon-bv,
.plugin-icon-compute,
.plugin-icon-lb,
.plugin-icon-db,
.plugin-icon-adb,
.plugin-icon-fs,
.plugin-icon-os,
.plugin-icon-vaults,
.plugin-icon-fsdr,
.plugin-icon-topology,
.plugin-icon-finops   { background: rgba(196,18,48,.10); color: #C41230; }

/* MySQL DBaaS — same IT CROWD crimson as all plugin icons; dolphin shape differentiates from Oracle DB */
.plugin-icon-mysql    { background: rgba(196,18,48,.10); color: #C41230; }

/* PostgreSQL DBaaS — same IT CROWD crimson; 2-ring cylinder distinct from Oracle/MySQL */
.plugin-icon-postgres { background: rgba(196,18,48,.10); color: #C41230; }

/* Dark mode — icon container: neutral grey overlay so crimson reads clearly on dark cards */
[data-theme="dark"] .plugin-icon-global,
[data-theme="dark"] .plugin-icon-iam,
[data-theme="dark"] .plugin-icon-vcn,
[data-theme="dark"] .plugin-icon-cpe,
[data-theme="dark"] .plugin-icon-bv,
[data-theme="dark"] .plugin-icon-compute,
[data-theme="dark"] .plugin-icon-lb,
[data-theme="dark"] .plugin-icon-db,
[data-theme="dark"] .plugin-icon-adb,
[data-theme="dark"] .plugin-icon-fs,
[data-theme="dark"] .plugin-icon-os,
[data-theme="dark"] .plugin-icon-vaults,
[data-theme="dark"] .plugin-icon-fsdr,
[data-theme="dark"] .plugin-icon-topology,
[data-theme="dark"] .plugin-icon-finops,
[data-theme="dark"] .plugin-icon-mysql,
[data-theme="dark"] .plugin-icon-postgres { background: rgba(255,255,255,0.10); }

/* ============================================================
   4b. TOPOLOGY MAPPER — card grid + resource pills + SVG thumb
   ============================================================ */

/* 2-column responsive card grid — drops to 1 col on narrow viewports */
.topo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 4px 0 8px;
}
@media (max-width: 900px) {
  .topo-grid { grid-template-columns: 1fr; }
}

/* Individual compartment card */
.topo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
}

/* ── Card header: monogram + compartment name + region badges ── */
.topo-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}

.topo-monogram {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #0063be;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.topo-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topo-comp-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topo-region-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.topo-region-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 10px;
  background: #e8f0fb;
  color: #0063be;
  border: 1px solid #b8d0f0;
  white-space: nowrap;
}

[data-theme="dark"] .topo-region-badge {
  background: #1a2a4a;
  color: #7ab8ff;
  border-color: #2a4070;
}

/* ── Resource pills row ── */
/* ── Resource pills row (above the diagram) ── */
.topo-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.topo-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  line-height: 1.5;
}

/* Per-resource-type colour variants */
.topo-pill-vcn        { background: #e8f0fb; color: #0063be; border: 1px solid #c0d8f4; }
.topo-pill-compute    { background: #e8eeff; color: #312d8e; border: 1px solid #c0c8f0; }
.topo-pill-lb         { background: #fff0f0; color: #c81428; border: 1px solid #f0c0c8; }
.topo-pill-db         { background: #f0eeff; color: #5c35a8; border: 1px solid #d0c8f0; }
.topo-pill-adb        { background: #e8fff5; color: #007a5e; border: 1px solid #b0e8d8; }
.topo-pill-buckets    { background: #fff8f0; color: #c25a00; border: 1px solid #f0d8b0; }
.topo-pill-fs         { background: #f0f8ff; color: #0077c8; border: 1px solid #b8e0f8; }
.topo-pill-vaults     { background: #fdf0ff; color: #7c3aed; border: 1px solid #e0c0f8; }
.topo-pill-fsdr       { background: #f0f4f8; color: #475569; border: 1px solid #d0dae4; }

[data-theme="dark"] .topo-pill-vcn     { background: #0a2040; color: #7ab8ff; border-color: #1a3a60; }
[data-theme="dark"] .topo-pill-compute { background: #1a1a40; color: #a0a8ff; border-color: #2a2a60; }
[data-theme="dark"] .topo-pill-lb      { background: #401020; color: #ff8090; border-color: #601828; }
[data-theme="dark"] .topo-pill-db      { background: #1e1040; color: #c0a8ff; border-color: #2e1860; }
[data-theme="dark"] .topo-pill-adb     { background: #0a2818; color: #60d8a8; border-color: #1a4028; }
[data-theme="dark"] .topo-pill-buckets { background: #402010; color: #ffb070; border-color: #603018; }
[data-theme="dark"] .topo-pill-fs      { background: #0a2040; color: #70c8ff; border-color: #1a3050; }
[data-theme="dark"] .topo-pill-vaults  { background: #2a1040; color: #d090ff; border-color: #3a1858; }
[data-theme="dark"] .topo-pill-fsdr    { background: #1a2030; color: #90a8c0; border-color: #2a3040; }

/* ── SVG thumbnail — full card width, height driven by SVG proportions ──
   width:100% fills the card with zero side whitespace.
   height:auto lets the portrait SVG set its own height — no fixed container
   means no object-fit centering, no dead flanks.                          */
.topo-diagram-wrap {
  display: block;
  position: relative;
  margin: 10px 12px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow-y: auto;          /* scrollable — user browses diagram vertically */
  overflow-x: hidden;        /* no horizontal scroll needed (width:100%) */
  max-height: 380px;         /* viewport cap — scroll reveals the rest */
  background: #fafafa;
  cursor: default;           /* default cursor so scrolling feels natural */
  text-decoration: none;
}

[data-theme="dark"] .topo-diagram-wrap {
  background: #242428;
}

.topo-diagram-img {
  display: block;
  width: 100%;               /* fills full card width — zero side whitespace */
  height: auto;              /* portrait SVG sets its own height; clipped by max-height */
}

/* Persistent open badge — top-right corner, always visible, scroll-safe */
.topo-open-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(15, 25, 50, 0.65);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.2px;
  z-index: 2;
}

/* Subtle accent border on hover — diagram stays fully visible */
.topo-diagram-wrap:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* No-diagram placeholder */
.topo-no-diagram {
  margin: 10px 12px 12px;
  border-radius: 6px;
  border: 1.5px dashed var(--border);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}


/* ============================================================
   5. HEADER / FOOTER
   ============================================================ */

.clair-header {
  min-height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

/* Vertical divider between app identity and tenancy name in report header */
.clair-header-divider {
  width: 1px;
  min-height: 40px;
  align-self: stretch;
  background: var(--border-strong);
  flex-shrink: 0;
  margin: 8px 4px;
}

/* Tenancy name + date block (right of divider) */
.clair-report-tenancy-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* Tenancy name shown in report header (right of divider) */
.clair-report-tenancy {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Report generation date shown below tenancy name */
.clair-report-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* App subtitle below Clair / Gemini Autumn */
.clair-app-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.clair-header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

/* Logo pair: IT CROWD + Clair icon side-by-side (Clair Identity Block) */
.clair-logo-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Thin separator between the two logos */
.clair-logo-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.clair-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.clair-header-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Report footer — slim single bar */
.clair-footer-slim {
  height: var(--footer-height);
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
  gap: 12px;
}

/* Landing footer — full 4-column */
.clair-footer {
  background: var(--bg-card);
  border-top: 3px solid var(--accent);
  margin-top: auto;
}

.clair-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  padding: 28px 32px 20px;
  max-width: 72rem;
  margin: 0 auto;
}

.clair-footer-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.clair-footer-col p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.clair-footer-col-item {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.clair-footer-col-item-label {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.clair-footer-link {
  font-size: 12px;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
  transition: opacity var(--transition);
}

.clair-footer-link:hover {
  opacity: 0.75;
}

.clair-footer-version {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.clair-copyright {
  border-top: 1px solid var(--border);
  padding: 10px 32px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}


/* ============================================================
   6. NAVIGATION
   ============================================================ */

.clair-nav-section {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
}

.clair-nav-section:last-child {
  border-bottom: none;
}

.clair-nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 12px 2px;
}

/* Plugin icon inside nav items — Phosphor SVG icons, color via currentColor */
.clair-nav-section-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: #C41230;
}

/* Slightly larger when it is the only content (collapsed state) */
.clair-nav.collapsed .clair-nav-section-icon {
  width: 32px;
  height: 32px;
  font-size: 20px;
  border-radius: 7px;
}

/* Text label next to icon — hidden in collapsed state */
.clair-nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clair-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.clair-nav-item:hover {
  background: var(--bg-card-alt);
  color: var(--text-primary);
}

.clair-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.clair-nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}


/* ============================================================
   7. SECTION CARDS
   ============================================================ */

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  scroll-margin-top: 74px;
}

.section-header {
  height: var(--section-header-height);
  padding: var(--section-header-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
  transition: background var(--transition);
  gap: 10px;
}

.section-header:hover {
  background: var(--bg-card-alt);
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.section-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #C41230;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
}

.section-toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
  line-height: 1;
}

/* Collapsed state */
.section-card.collapsed .section-content {
  display: none;
}

.section-card.collapsed .section-toggle-icon {
  transform: rotate(-90deg);
}

/* Nav teleport arrival — left accent bar + header tint, fades out over 0.8s.
   Gives the eye a clear anchor point after an instant long-range jump. */
@keyframes clair-section-arrive {
  0%   { box-shadow: inset 4px 0 0 var(--accent, #0063be);
         background: rgba(0, 99, 190, 0.07); }
  50%  { box-shadow: inset 4px 0 0 var(--accent, #0063be);
         background: rgba(0, 99, 190, 0.07); }
  100% { box-shadow: inset 4px 0 0 transparent;
         background: transparent; }
}
.section-card.section-arriving {
  animation: clair-section-arrive 0.8s ease-out forwards;
}

/* Content area */
.section-content {
  border-top: 1px solid var(--border);
}

.section-body {
  padding: var(--section-body-padding);
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* ============================================================
   8. COMPARTMENT GROUPS
   ============================================================ */

.compartment-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.compartment-header {
  height: var(--compartment-header-height);
  padding: var(--compartment-header-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card-alt);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  gap: 8px;
}

.compartment-header:hover {
  background: var(--border);
}

.compartment-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compartment-count {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.compartment-toggle {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.compartment-body {
  background: var(--bg-card);
}

/* Collapsed compartment */
.compartment-group.collapsed .compartment-body {
  display: none;
}

.compartment-group.collapsed .compartment-toggle {
  transform: rotate(-90deg);
}


/* ============================================================
   9. RESOURCE ITEMS
   ============================================================ */

.resource-item {
  display: flex;
  align-items: center;
  min-height: var(--resource-item-height);
  padding: var(--resource-item-padding);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  transition: background var(--transition);
}

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

.resource-item:hover {
  background: var(--bg-card-alt);
}

.resource-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-type {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.resource-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-detail {
  font-size: 12px;
  color: var(--text-secondary);
}


/* ============================================================
   10. TABLES
   ============================================================ */

.clair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.clair-table thead tr {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-strong);
}

.clair-table th {
  padding: var(--table-cell-padding);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.clair-table td {
  padding: var(--table-cell-padding);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}

.clair-table tbody tr:last-child td {
  border-bottom: none;
}

.clair-table tbody tr {
  height: var(--table-row-height);
  transition: background var(--transition);
}

.clair-table tbody tr:hover {
  background: var(--bg-card-alt);
}

/* Pagination controls */
.clair-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.clair-pagination-btn {
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.clair-pagination-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.clair-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.clair-pagination-info {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}


/* ============================================================
   11. BADGES + STATES
   ============================================================ */

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

/* State classes — used on .count-badge or standalone spans */
.state-running  { color: var(--state-running);  background: color-mix(in srgb, var(--state-running) 12%, transparent); }
.state-stopped  { color: var(--state-stopped);  background: color-mix(in srgb, var(--state-stopped) 12%, transparent); }
.state-warning  { color: var(--state-warning);  background: color-mix(in srgb, var(--state-warning) 12%, transparent); }
.state-unknown  { color: var(--state-unknown);  background: color-mix(in srgb, var(--state-unknown) 12%, transparent); }
.state-active   { color: var(--state-running);  background: color-mix(in srgb, var(--state-running) 12%, transparent); }
.state-inactive { color: var(--state-unknown);  background: color-mix(in srgb, var(--state-unknown) 12%, transparent); }
.state-deleted  { color: var(--state-stopped);  background: color-mix(in srgb, var(--state-stopped) 12%, transparent); }
/* Critical Announcements priority badges */
.state-critical { color: #e65100; background: color-mix(in srgb, #e65100 12%, transparent); }
.state-medium   { color: #0d47a1; background: color-mix(in srgb, #0d47a1 12%, transparent); }

/* Indicator pills — e.g. DG model (DG Group / Associative DG) */
.clair-pill {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}
.pill-info { color: #0369a1; background: color-mix(in srgb, #0369a1 12%, transparent); }
.pill-warn { color: var(--state-warning); background: color-mix(in srgb, var(--state-warning) 12%, transparent); }
[data-theme="dark"] .pill-info { color: #38bdf8; background: color-mix(in srgb, #38bdf8 12%, transparent); }

/* ---- Critical Announcements sub-section ---- */
.clair-announcements-block {
  margin-bottom: 1.25rem;
}
.clair-sub-section-header {
  font-size:      0.78rem;
  font-weight:    600;
  color:          var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding:        0.5rem 0 0.35rem;
  border-bottom:  1px solid var(--border);
  margin-bottom:  0.75rem;
}

/* Theme toggle button */
.clair-theme-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.clair-theme-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Expand/Collapse all toggle */
.clair-toggle-all {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.clair-toggle-all:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Download ZIP button — appears in clair-header-right alongside theme/expand controls */
.clair-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.72rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.4;
}
.clair-download-btn:hover {
  background: var(--accent);
  color: #fff;
}
[data-theme="dark"] .clair-download-btn:hover {
  color: var(--bg-page);
}


/* ============================================================
   12. DRIFT INDICATORS
   ============================================================ */

.drift-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.drift-bar-header {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.drift-bar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.drift-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.drift-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}

.drift-new      { color: var(--drift-new);     background: color-mix(in srgb, var(--drift-new) 12%, transparent); }
.drift-deleted  { color: var(--drift-deleted);  background: color-mix(in srgb, var(--drift-deleted) 12%, transparent); }
.drift-changed  { color: var(--drift-changed);  background: color-mix(in srgb, var(--drift-changed) 12%, transparent); }
.drift-ok       { color: var(--drift-ok);       background: color-mix(in srgb, var(--drift-ok) 12%, transparent); }

.drift-item {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  font-size: 12px;
}

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

.drift-item-label {
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.drift-item-type {
  color: var(--text-muted);
  font-size: 11px;
}


/* ============================================================
   13. UTILITIES
   ============================================================ */

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state p {
  margin: 0;
}

.loading {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monospace {
  font-family: 'Cascadia Code', 'Consolas', 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
}

.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary  { color: var(--text-primary); }
.text-accent   { color: var(--accent); }

.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.gap-8         { gap: 8px; }
.gap-4         { gap: 4px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ============================================================
   14. CHART UTILITIES (p00_global and future plugins)
   ============================================================ */

/* Side-by-side two-column layout (table + chart, regions + compartments, etc.) */
.clair-side-by-side {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.clair-side-by-side > * {
  flex: 1;
  min-width: 0;
}

/* Pie chart legend */
.clair-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.clair-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.clair-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Swatch colors — must match _PALETTE order in g00_global_master.py */
.clair-swatch-0  { background: #4d7aff; }
.clair-swatch-1  { background: #11998e; }
.clair-swatch-2  { background: #f39c12; }
.clair-swatch-3  { background: #e74c3c; }
.clair-swatch-4  { background: #9b59b6; }
.clair-swatch-5  { background: #1abc9c; }
.clair-swatch-6  { background: #e67e22; }
.clair-swatch-7  { background: #3498db; }
.clair-swatch-8  { background: #e91e63; }
.clair-swatch-9  { background: #00bcd4; }
.clair-swatch-10 { background: #8bc34a; }
.clair-swatch-11 { background: #ff5722; }

/* Chart container — 3D lift effect matching plugin cards */
.clair-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 16px;
  margin-top: 12px;
  overflow: visible;
}

/* SVG tooltip — CSS-only, triggered by data-tooltip on wrapper element */
.clair-tooltip-wrap {
  position: relative;
  display: inline-block;
}

.clair-tooltip-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-card);
  font-size: 11px;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  white-space: pre;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  max-width: 200px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

.clair-tooltip-wrap:hover::after {
  opacity: 1;
}

/* Compartment tree depth indentation — 8 levels (covers all real OCI tenancies) */
.clair-depth-0 { padding-left: 0px; }
.clair-depth-1 { padding-left: 16px; }
.clair-depth-2 { padding-left: 32px; }
.clair-depth-3 { padding-left: 48px; }
.clair-depth-4 { padding-left: 64px; }
.clair-depth-5 { padding-left: 80px; }
.clair-depth-6 { padding-left: 96px; }
.clair-depth-7 { padding-left: 112px; }
.clair-depth-8 { padding-left: 128px; }

/* Tree connector — vertical guide line for child rows */
.clair-tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-primary);
}

.clair-tree-connector {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}


/* ============================================================
   Sub-group (nested compartment-group inside a parent)
   Used by IAM groups, IAM policies per-item
   ============================================================ */

/* Wrapper padding so nested items are indented */
.compartment-group > .compartment-body {
  padding: 6px;
  gap: 4px;
  display: flex;
  flex-direction: column;
}

/* Sub-group header: slightly different bg + left accent border */
.clair-sub-group > .compartment-header {
  background: var(--bg-page);
  font-size: 12px;
  height: 30px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

/* Restore body background for sub-groups */
.clair-sub-group > .compartment-body {
  background: var(--bg-card);
  padding: 0;
}

/* Matching rule display in dynamic groups table */
.iam-matching-rule {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.4;
}


/* ============================================================
   p01_iam — Policy statement list
   ============================================================ */

/* Container for all statements of one policy */
.iam-policy-stmts {
  padding: 6px 8px;
}

/* Individual policy statement line */
.iam-policy-stmt {
  font-size: 12px;
  font-family: 'Courier New', 'Consolas', monospace;
  color: var(--text-primary);
  background: var(--bg-card-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 5px 10px;
  margin-bottom: 4px;
  line-height: 1.45;
  word-break: break-word;
}

.iam-policy-stmt:last-child {
  margin-bottom: 0;
}

/* Shared row layout — left-aligned name + description inside any compartment-header.
   Used by: Groups, Policies, and any future plugin with name+desc rows. */
.clair-row-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.clair-col-name {
  flex: 0 0 220px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clair-col-desc {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ============================================================
   Show-more / show-less toggle for inline lists inside table cells
   Uses CSS content:attr(data-more) so no JS is required.
   Collapsed : shows "+N more…"  (from data-more attribute)
   Expanded  : shows "▲ show less"
   ============================================================ */
details.pg-more > summary.pg-more {
  display: block;
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0;
  margin-top: 3px;
}
details.pg-more > summary.pg-more::marker,
details.pg-more > summary.pg-more::-webkit-details-marker {
  display: none;
}
details.pg-more > summary.pg-more::before {
  content: attr(data-more);
  color: var(--accent, #4a9eff);
  font-size: 0.84em;
  font-weight: 500;
}
details.pg-more[open] > summary.pg-more::before {
  content: "\25B2 show less";
  color: var(--accent, #4a9eff);
  font-size: 0.84em;
  font-weight: 500;
}


/* ═══════════════════════════════════════════════════════════════════════
   CLAIR AI NARRATIVE BANDS — registered 2026-04-23
   Appended after each plugin section card. Not inside the section card.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Narrative Band ── */
.clair-narrative-band {
  margin: 0 0 var(--section-gap) 0;
  padding: 1.1rem 1.5rem 1.1rem 1.25rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-top: none;
  border-right: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  position: relative;
}

.clair-narrative-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.clair-narrative-ai-icon {
  width: 14px; height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.clair-narrative-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.clair-narrative-plugin {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.clair-narrative-plugin::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.clair-narrative-meta {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.clair-narrative-body p {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 0.7rem;
}

.clair-narrative-body p:last-child {
  margin-bottom: 0;
}

/* ── Executive Dictamen ── */
.clair-dictamen {
  margin: 1.5rem 0 0 0;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.clair-dictamen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.clair-dictamen-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.clair-dictamen-icon {
  width: 18px; height: 18px;
  color: #ffffff;
  flex-shrink: 0;
}

.clair-dictamen-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
}

.clair-dictamen-meta {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.06em;
}

.clair-dictamen-body {
  padding: 1.5rem;
}

.clair-dictamen-body p {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.clair-dictamen-body p:last-child {
  margin-bottom: 0;
}

.clair-dictamen-footer {
  padding: 0.7rem 1.5rem;
  background: var(--bg-card-alt);
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── PDF overrides for narrative elements ── */
@media print {
  .clair-narrative-band { break-inside: avoid; }
  .clair-dictamen       { break-inside: avoid; break-before: auto; }
}

/* ============================================================
   W4 — Zone 1: Two-column Tenancy Report Panel (web app only)
   ============================================================ */

.clair-zone1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.clair-zone1-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clair-zone1-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.clair-rptlist-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: -4px;
}

/* .clair-report-list core styles updated inline above (height, border, radius, bg) */

.clair-report-list--drift {
  opacity: 0.65;
}

.clair-report-row {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}

.clair-report-row:last-child {
  border-bottom: none;
}

.clair-report-row:hover {
  background: var(--bg-card-alt);
}

.clair-report-row.selected {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding-left: 9px; /* compensate 3px border */
}

.clair-report-ts {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.clair-report-dur {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.clair-report-author {
  display: inline-block;
  margin-left: 7px;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  vertical-align: middle;
  opacity: 0.85;
}

.clair-report-new-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent, #2563eb);
  border-radius: 3px;
  vertical-align: middle;
  line-height: 1.5;
  white-space: nowrap;
}

/* Override the inherited empty-state to be centred inside the fixed-height list */
.clair-report-list .clair-report-list-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  box-sizing: border-box;
}

.clair-zone1-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}

.clair-btn-show,
.clair-btn-drift {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.clair-btn-show:hover:not(:disabled),
.clair-btn-drift:hover:not(:disabled) {
  background: var(--bg-card-alt);
  border-color: var(--accent);
  color: var(--accent);
}

.clair-btn-show:disabled,
.clair-btn-drift:disabled {
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.55;
}

/* Info strip variant for drift notice */
.clair-job-strip--info {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Icon-only Generate Report button (Zone 1 actions, primary action) */
.clair-btn-icon-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}
.clair-btn-icon-generate:hover {
  opacity: 0.88;
  transform: scale(1.06);
}
.clair-btn-icon-generate:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  transform: none;
}


/* ═══════════════════════════════════════════════════════════════════════
   DRIFT ANALYSIS BADGES — registered 2026-04-30 (P3-01)
   Uses existing --drift-* CSS variables (defined in :root above).
   ═══════════════════════════════════════════════════════════════════════ */

.drift-badge-added,
.drift-badge-removed,
.drift-badge-modified,
.drift-badge-unchanged {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm, 4px);
  white-space: nowrap;
  line-height: 1.4;
}

.drift-badge-added {
  background: color-mix(in srgb, var(--drift-new) 14%, transparent);
  color: var(--drift-new);
}

.drift-badge-removed {
  background: color-mix(in srgb, var(--drift-deleted) 14%, transparent);
  color: var(--drift-deleted);
}

.drift-badge-modified {
  background: color-mix(in srgb, var(--drift-changed) 14%, transparent);
  color: var(--drift-changed);
}

.drift-badge-unchanged {
  background: transparent;
  color: var(--drift-ok);
}

/* ── Drift Change Summary Banner ── */
.drift-change-banner {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 0;
}

.drift-banner-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 24px;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  min-width: 100px;
}

.drift-banner-count {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.drift-banner-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

.drift-banner-added   .drift-banner-count { color: var(--drift-new);     }
.drift-banner-removed .drift-banner-count { color: var(--drift-deleted);  }
.drift-banner-modified .drift-banner-count { color: var(--drift-changed); }
.drift-banner-unchanged .drift-banner-count { color: var(--drift-ok);    }

.drift-banner-added   .drift-banner-label { color: var(--drift-new);     }
.drift-banner-removed .drift-banner-label { color: var(--drift-deleted);  }
.drift-banner-modified .drift-banner-label { color: var(--drift-changed); }
.drift-banner-unchanged .drift-banner-label { color: var(--drift-ok);    }

/* ── Drift report typography ── */
.clair-report-h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 16px 0 8px 0;
  line-height: 1.4;
}

.clair-report-footer {
  margin-top: 32px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.clair-footer-line1 {
  font-weight: 600;
  margin-bottom: 2px;
}

.clair-footer-line2 {
  font-weight: 400;
}


/* ═══════════════════════════════════════════════════════════════════════
   DRIFT INTELLIGENCE REPORT — Executive Layout
   Registered 02-MAY-2026. All classes prefixed drift-.
   Covers: Dashboard, Situation Overview, Finding Cards, Silent Risk,
           Recommended Actions, Appendix, Score tiles, AI narrative slot.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Executive Health Dashboard ── */
.drift-exec-dashboard {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 12px 0;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 8px);
}

.drift-exec-status {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 20px;
  border-radius: var(--radius-md, 6px);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drift-exec-status-critical {
  background: color-mix(in srgb, #dc2626 16%, transparent);
  color: #dc2626;
  border: 2px solid #dc2626;
}

.drift-exec-status-warning {
  background: color-mix(in srgb, #d97706 16%, transparent);
  color: #b45309;
  border: 2px solid #d97706;
}

.drift-exec-status-evolving {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 2px solid var(--accent);
}

.drift-exec-status-stable {
  background: color-mix(in srgb, #16a34a 12%, transparent);
  color: #15803d;
  border: 2px solid #16a34a;
}

.drift-exec-status-label {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

/* Metric tiles row */
.drift-exec-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.drift-metric-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  min-width: 90px;
}

.drift-metric-count {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}

.drift-metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: center;
}

.drift-metric-high   .drift-metric-count { color: #dc2626; }
.drift-metric-medium .drift-metric-count { color: #d97706; }
.drift-metric-silent .drift-metric-count { color: #7c3aed; }
.drift-metric-total  .drift-metric-count { color: var(--text-primary); }

/* CUSP / COIN score tiles */
.drift-exec-scores {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}

.drift-score-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  min-width: 80px;
}

.drift-score-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.drift-score-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.drift-score-delta {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
}

.drift-score-better { color: #15803d; }
.drift-score-worse  { color: #dc2626; }
.drift-score-neutral { color: var(--text-muted); }

.drift-score-currency {
  font-size: 0.65rem;
  color: var(--text-muted);
  align-self: center;
  padding: 4px 6px;
}

/* ── Situation Overview ── */
.drift-section-overview .section-header { background: var(--bg-card-alt); }

.drift-overview-para {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  padding: 0;
}

.drift-overview-para:last-child { margin-bottom: 0; }

/* ── Section header accent colours ── */
.drift-section-high    .section-header { border-left: 4px solid #dc2626; }
.drift-section-medium  .section-header { border-left: 4px solid #d97706; }
.drift-section-low     .section-header { border-left: 4px solid var(--accent); }
.drift-section-silent  .section-header { border-left: 4px solid #7c3aed; }
.drift-section-recs    .section-header { border-left: 4px solid #16a34a; }
.drift-section-overview .section-header { border-left: 4px solid var(--accent); }

/* ── Finding Cards grid ── */
.drift-findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.drift-finding-card {
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drift-finding-card-high {
  border-left: 4px solid #dc2626;
  background: color-mix(in srgb, #dc2626 4%, var(--bg-card));
}

.drift-finding-card-medium {
  border-left: 4px solid #d97706;
  background: color-mix(in srgb, #d97706 4%, var(--bg-card));
}

.drift-finding-card-low {
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-card));
}

.drift-finding-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drift-finding-headline {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.drift-severity-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm, 4px);
  white-space: nowrap;
  text-transform: uppercase;
}

.drift-severity-high {
  background: color-mix(in srgb, #dc2626 18%, transparent);
  color: #dc2626;
}

.drift-severity-medium {
  background: color-mix(in srgb, #d97706 18%, transparent);
  color: #b45309;
}

.drift-severity-low {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.drift-plugin-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.drift-finding-resource {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.drift-finding-context {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.55;
}

.drift-finding-action {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 6px 10px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm, 4px);
  border-left: 3px solid var(--border-strong);
}

.drift-action-label {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 4px;
}

.drift-finding-changes {
  margin-top: 4px;
}

/* ── Low Signal table ── */
.drift-low-table {
  width: 100%;
  table-layout: fixed;
}

/* ── Silent Risk cards ── */
.drift-silent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  padding: 4px 0;
}

.drift-silent-card {
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drift-silent-card-medium {
  border-left: 4px solid #d97706;
  background: color-mix(in srgb, #d97706 4%, var(--bg-card));
}

.drift-silent-card-low {
  border-left: 4px solid #7c3aed;
  background: color-mix(in srgb, #7c3aed 4%, var(--bg-card));
}

.drift-silent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.drift-silent-rule-id {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm, 4px);
  white-space: nowrap;
}

.drift-silent-headline {
  font-size: 0.87rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.drift-silent-context {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  font-style: italic;
}

/* ── Recommended Actions 3-column ── */
.drift-rec-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

.drift-rec-column {
  border-radius: var(--radius-md, 6px);
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  padding: 12px 14px;
}

.drift-rec-immediate  { border-top: 3px solid #dc2626; }
.drift-rec-shortterm  { border-top: 3px solid #d97706; }
.drift-rec-strategic  { border-top: 3px solid #1a56db; }

.drift-rec-col-header {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.drift-rec-col-timeframe {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  margin-left: 4px;
}

.drift-rec-list {
  list-style: disc;
  padding-left: 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drift-rec-item {
  font-size: 0.83rem;
  color: var(--text-primary);
  line-height: 1.5;
  list-style: disc;
}

.drift-rec-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* ── Appendix (collapsed details) ── */
.drift-appendix {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
}

.drift-appendix-summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border);
  user-select: none;
  list-style: none;
}

.drift-appendix-summary::-webkit-details-marker { display: none; }

.drift-appendix-body {
  padding: 12px;
}

/* ── AI Narrative slot ── */
.drift-ai-narrative {
  margin: 12px 0;
  padding: 16px;
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: var(--radius-lg, 8px);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-primary);
}

/* ==========================================================================
   FEEDBACK FAB — P3-27 · Clair (Gemini Spring)
   Floating action button + modal form + unread badge
   All class names prefixed .cfb- to avoid collision with existing rules.
   ========================================================================== */

/* ── Unread badge (operator header indicator) ── */
.cfb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--accent, #C41230);
  color: #ffffff;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
  margin-right: 8px;
  white-space: nowrap;
}
.cfb-badge:hover   { opacity: 0.88; transform: scale(1.05); }
.cfb-badge:active  { transform: scale(0.97); }

/* ── Floating action button ── */
#clair-feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: var(--accent, #C41230);
  color: #ffffff;
  border: none;
  border-radius: 28px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(196,18,48,0.35);
  transition: box-shadow 0.2s, transform 0.15s, opacity 0.2s;
  user-select: none;
}
#clair-feedback-fab:hover  { box-shadow: 0 6px 22px rgba(196,18,48,0.45); transform: translateY(-2px); }
#clair-feedback-fab:active { transform: scale(0.97); }

/* ── Modal overlay ── */
.cfb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.cfb-overlay.cfb-open { display: flex; }

/* ── Modal dialog ── */
.cfb-dialog {
  background: var(--bg-card, #ffffff);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
  width: min(580px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Modal header ── */
.cfb-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.cfb-dialog-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #1a1d23);
  margin: 0;
}
.cfb-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.cfb-close-btn:hover { background: var(--bg-alt, #f1f5f9); }

/* ── Modal body (scrollable) ── */
.cfb-dialog-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── Form elements ── */
.cfb-row       { display: flex; gap: 12px; margin-bottom: 14px; }
.cfb-field     { display: flex; flex-direction: column; flex: 1; }
.cfb-label     { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary, #6b7280); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.cfb-label .cfb-req          { color: var(--accent, #C41230); margin-left: 2px; }
.cfb-label .cfb-readonly-hint { font-size: 0.70rem; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-secondary, #9ca3af); margin-left: 4px; }
.cfb-input-readonly { background: var(--bg-alt, #f1f5f9) !important; color: var(--text-secondary, #6b7280) !important; cursor: default; border-color: var(--border, #e5e7eb) !important; }
.cfb-input,
.cfb-select,
.cfb-textarea  {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 0.85rem;
  color: var(--text-primary, #1a1d23);
  background: var(--bg-page, #f8f9fa);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.cfb-input:focus,
.cfb-select:focus,
.cfb-textarea:focus {
  outline: none;
  border-color: var(--accent, #C41230);
  box-shadow: 0 0 0 2px rgba(196,18,48,0.12);
}
.cfb-input.cfb-invalid,
.cfb-select.cfb-invalid,
.cfb-textarea.cfb-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.12);
}
.cfb-textarea  { resize: vertical; min-height: 90px; }
.cfb-select    { appearance: none; cursor: pointer; }

/* ── Radio groups ── */
.cfb-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.cfb-radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.cfb-radio-label:has(input:checked) {
  border-color: var(--accent, #C41230);
  background: rgba(196,18,48,0.07);
  font-weight: 600;
}
.cfb-radio-label input[type="radio"] { accent-color: var(--accent, #C41230); }

/* ── Checkbox group (sections) ── */
.cfb-checkbox-group { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.cfb-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 3px 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 5px;
  transition: border-color 0.15s;
}
.cfb-checkbox-label:has(input:checked) { border-color: var(--accent, #C41230); background: rgba(196,18,48,0.06); }
.cfb-checkbox-label input { accent-color: var(--accent, #C41230); }

/* ── Inline field error ── */
.cfb-error { font-size: 0.75rem; color: #ef4444; margin-top: 3px; display: none; }
.cfb-error.cfb-visible { display: block; }

/* ── Email domain warning ── */
.cfb-warn { font-size: 0.75rem; color: #f59e0b; margin-top: 3px; display: none; }
.cfb-warn.cfb-visible { display: block; }

/* ── Modal footer ── */
.cfb-dialog-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 10px;
}
.cfb-status-msg { font-size: 0.8rem; color: var(--text-secondary, #6b7280); flex: 1; }
.cfb-btn-row    { display: flex; gap: 8px; }
.cfb-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
}
.cfb-btn:active  { transform: scale(0.97); }
.cfb-btn-cancel  { background: var(--bg-alt, #f1f5f9); color: var(--text-primary, #1a1d23); }
.cfb-btn-submit  { background: var(--accent, #C41230); color: #ffffff; }
.cfb-btn-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.cfb-btn-copy    { background: var(--bg-alt, #f1f5f9); color: var(--text-primary, #1a1d23); }

/* ── Tier 3 clipboard fallback textarea ── */
.cfb-copy-area {
  width: 100%;
  min-height: 160px;
  font-family: monospace;
  font-size: 0.78rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 7px;
  padding: 10px;
  background: var(--bg-page, #f8f9fa);
  color: var(--text-primary, #1a1d23);
  resize: vertical;
  box-sizing: border-box;
}

/* ── Unread list modal items ── */
.cfb-unread-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 0.83rem;
}
.cfb-unread-item:last-child { border-bottom: none; }
.cfb-unread-meta  { color: var(--text-secondary, #6b7280); font-size: 0.75rem; margin-top: 2px; }
.cfb-unread-subj  { font-weight: 600; color: var(--text-primary, #1a1d23); }
.cfb-type-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.cfb-type-felicitation  { background: #d1fae5; color: #065f46; }
.cfb-type-inaccuracy    { background: #fee2e2; color: #991b1b; }
.cfb-type-question      { background: #dbeafe; color: #1e40af; }
.cfb-type-complaint     { background: #fef3c7; color: #92400e; }
.cfb-type-requirement   { background: #ede9fe; color: #5b21b6; }

/* ── Dark mode overrides — all cfb- rules ── */
[data-theme="dark"] .cfb-badge             { background: var(--accent, #C41230); }
[data-theme="dark"] #clair-feedback-fab    { background: var(--accent, #C41230); }
[data-theme="dark"] .cfb-dialog            { background: #28282e; }
[data-theme="dark"] .cfb-dialog-header,
[data-theme="dark"] .cfb-dialog-footer     { border-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .cfb-input,
[data-theme="dark"] .cfb-select,
[data-theme="dark"] .cfb-textarea          { background: #1e1e24; border-color: rgba(255,255,255,0.15); color: #e5e7eb; }
[data-theme="dark"] .cfb-input-readonly    { background: #2a2a34 !important; color: rgba(229,231,235,0.55) !important; border-color: rgba(255,255,255,0.10) !important; }
[data-theme="dark"] .cfb-input:focus,
[data-theme="dark"] .cfb-select:focus,
[data-theme="dark"] .cfb-textarea:focus    { border-color: var(--accent, #C41230); }
[data-theme="dark"] .cfb-radio-label,
[data-theme="dark"] .cfb-checkbox-label   { border-color: rgba(255,255,255,0.15); color: #e5e7eb; }
[data-theme="dark"] .cfb-radio-label:has(input:checked),
[data-theme="dark"] .cfb-checkbox-label:has(input:checked) { background: rgba(196,18,48,0.18); border-color: var(--accent, #C41230); }
[data-theme="dark"] .cfb-close-btn        { color: #9ca3af; }
[data-theme="dark"] .cfb-close-btn:hover  { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .cfb-btn-cancel,
[data-theme="dark"] .cfb-btn-copy         { background: rgba(255,255,255,0.10); color: #e5e7eb; }
[data-theme="dark"] .cfb-copy-area        { background: #1e1e24; border-color: rgba(255,255,255,0.15); color: #e5e7eb; }
[data-theme="dark"] .cfb-unread-item      { border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .cfb-overlay          { background: rgba(0,0,0,0.65); }

/* ── User identity chip (header right) ─────────────────────────────────────── */
.clair-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 780px;
  min-width: 0;
}

/* Column container: stacks full_name/email or display_name/key vertically */
.clair-user-col {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.clair-user-fullname {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.clair-user-email {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.clair-user-sep {
  color: var(--text-muted);
  flex-shrink: 0;
}

.clair-user-tenancy-display {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.clair-user-tenancy {
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.clair-user-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.clair-user-badge--god {
  background: #C41230;
  color: #fff;
}

.clair-user-badge--free {
  background: rgba(196,18,48,0.12);
  color: #C41230;
  border: 1px solid rgba(196,18,48,0.3);
}

.clair-user-badge--readonly {
  background: rgba(120,100,0,0.12);
  color: #7a6500;
  border: 1px solid rgba(120,100,0,0.3);
}

[data-theme="dark"] .clair-user-badge--readonly {
  background: rgba(255,210,0,0.12);
  color: #f5c400;
  border-color: rgba(255,210,0,0.3);
}

.clair-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #C41230;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  font-size: 1.1rem;
}

.clair-logout-btn:hover {
  color: #C41230;
  background: rgba(196,18,48,0.12);
}

[data-theme="dark"] .clair-user-chip {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}

/* ── Free tier quota stack ─────────────────────────────────────────────── */
.clair-quota-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.clair-quota-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.clair-quota-item {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s;
}

.clair-quota-item--maxed {
  color: #C41230;
  font-weight: 700;
}

.clair-quota-sep-inner {
  color: var(--border);
  font-size: 0.65rem;
}

[data-theme="dark"] .clair-quota-item {
  color: rgba(255,255,255,0.45);
}

[data-theme="dark"] .clair-quota-item--maxed {
  color: #e84060;
}

[data-theme="dark"] .clair-quota-sep-inner {
  color: rgba(255,255,255,0.2);
}

/* ============================================================
   CLAIR TOUR & HELP MECHANISM — GA-TOUR-01
   01-JUN-2026 · Clair (Gemini Autumn) 3.2.0
   ============================================================ */

/* Help button in header toolbar — mirrors .clair-theme-btn */
.clair-help-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.clair-help-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Tour overlays — full-screen backdrops */
.clair-tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.clair-tour-overlay[style*="flex"] {
  display: flex !important;
}

/* Welcome modal card */
.clair-tour-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 540px;
  padding: 28px 30px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

/* Help panel — wider to fit card grid */
.clair-tour-help-modal {
  max-width: 660px;
}

/* Modal header row: title + lang toggle + close */
.clair-tour-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clair-tour-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  line-height: 1.3;
}

.clair-tour-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.clair-tour-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-alt);
}

/* Slide counter — "1 / 3" */
.clair-tour-slide-counter {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-top: -6px;
}

/* Slide body text */
.clair-tour-slide-body {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 72px;
}

/* Don't show again row */
.clair-tour-dont-show {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.clair-tour-dont-show label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}

.clair-tour-dont-show input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* Navigation button row */
.clair-tour-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.clair-tour-nav-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.clair-tour-nav-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.clair-tour-nav-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.clair-tour-nav-primary:hover {
  background: #a50f28;
  border-color: #a50f28;
  color: #ffffff;
}

/* Language toggle — ES | EN pill */
.clair-tour-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.clair-tour-lang-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border: none;
  background: var(--bg-card-alt);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  letter-spacing: 0.04em;
}

.clair-tour-lang-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.clair-tour-lang-btn.active {
  background: var(--accent);
  color: #ffffff;
}

/* Reference panel card grid */
.clair-tour-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.clair-tour-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clair-tour-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.clair-tour-card-body {
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Dark mode overrides — all use existing CSS vars, verified present */
[data-theme="dark"] .clair-tour-modal {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .clair-tour-nav-primary {
  background: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .clair-tour-nav-primary:hover {
  background: #e84060;
  border-color: #e84060;
}

/* Print / PDF: hide all tour elements */
@media print {
  .clair-help-btn,
  #clair-tour-welcome,
  #clair-tour-help {
    display: none !important;
  }
}
