/* ═══════════════════════════════════════════════════════════════════════
   FabSoft Reports Dashboard — Apple.com-Inspired Design System
   Mobile-first, iPhone 17 optimized (393pt, Dynamic Island safe areas)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────────────────────── */

:root {
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;

  --text-xs: 0.6875rem;    /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-lg: 1.0625rem;    /* 17px */
  --text-xl: 1.3125rem;    /* 21px */
  --text-2xl: 1.75rem;     /* 28px */
  --text-3xl: 2.5rem;      /* 40px */
  --text-4xl: 3.5rem;      /* 56px */

  --leading-tight: 1.15;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Colors — Light theme */
  --bg-primary: #fbfbfd;
  --bg-secondary: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-sidebar: #1d1d1f;
  --bg-overlay: rgba(0, 0, 0, 0.5);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-inverse: #f5f5f7;
  --text-link: #0066cc;
  --text-link-hover: #0077ed;

  --border-light: #d2d2d7;
  --border-subtle: #e8e8ed;
  --border-focus: #0066cc;
  --border-color: #d2d2d7;
  --bg-tertiary: #f0f0f3;

  /* Semantic colors */
  --color-positive: #34c759;
  --color-positive-bg: #e8f8ed;
  --color-warning: #ff9f0a;
  --color-warning-bg: #fff6e5;
  --color-negative: #ff3b30;
  --color-negative-bg: #ffeceb;
  --color-info: #007aff;
  --color-info-bg: #e5f1ff;

  /* Traffic-light system — 3 colors for instant status recognition */
  --tl-green: #34c759;
  --tl-green-tint: rgba(52, 199, 89, 0.08);
  --tl-green-border: rgba(52, 199, 89, 0.5);
  --tl-yellow: #f0a500;
  --tl-yellow-tint: rgba(240, 165, 0, 0.08);
  --tl-yellow-border: rgba(240, 165, 0, 0.5);
  --tl-red: #ff3b30;
  --tl-red-tint: rgba(255, 59, 48, 0.08);
  --tl-red-border: rgba(255, 59, 48, 0.5);

  /* Grade colors mapped to traffic-light */
  --grade-a: var(--tl-green);
  --grade-b: var(--tl-green);
  --grade-c: var(--tl-yellow);
  --grade-d: var(--tl-red);
  --grade-f: var(--tl-red);

  /* Chart colors */
  --chart-1: #007aff;
  --chart-2: #34c759;
  --chart-3: #ff9f0a;
  --chart-4: #af52de;
  --chart-5: #ff2d55;
  --chart-6: #5ac8fa;
  --chart-7: #ffcc00;
  --chart-8: #ff6482;

  
  /* Semantic aliases (auto-generated by portal-ux-fix) */
  --color-success: var(--color-positive);
  --color-primary: var(--color-info);
  --color-danger: var(--color-negative);

  
  /* Missing variables (auto-generated fallbacks by portal-ux-fix) */
  --text-muted: #86868b;

  /* Spacing scale */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows — Apple-style subtle layering */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* Layout */
  --sidebar-width: 260px;
  --content-max-width: 1200px;
  --header-height: 52px;
  --mobile-nav-height: 56px;

  /* Safe areas (iPhone 17 Dynamic Island) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ── Reset & Base ───────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--text-link-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* ── Layout ─────────────────────────────────────────────────────────── */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: none;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-6) 0;
}

.sidebar-brand {
  padding: 0 var(--space-6) var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: var(--space-4);
}

.sidebar-brand h1 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  color: #fff;
}

.sidebar-brand .subtitle {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  margin-top: var(--space-1);
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav-item a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all var(--duration-fast) var(--ease-out);
  border-left: 3px solid transparent;
}

.sidebar-nav-item a:hover,
.sidebar-nav-item a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--color-info);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-5) var(--space-6) var(--space-2);
}

.main-content {
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: var(--space-6) var(--space-4);
  padding-bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + var(--space-6));
}

/* ── Top Header ─────────────────────────────────────────────────────── */

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-3));
  background: rgba(251, 251, 253, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
}

.top-header-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs .separator {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.desktop-breadcrumbs {
  display: none;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.desktop-breadcrumbs a { color: var(--text-secondary); }
.desktop-breadcrumbs .separator { color: var(--text-tertiary); font-size: var(--text-xs); }

/* ── Mobile Bottom Nav ──────────────────────────────────────────────── */

.mobile-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
  min-width: 56px;
}

.mobile-nav-item.active {
  color: var(--color-info);
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

/* ── Provenance Banner ──────────────────────────────────────────────── */

.provenance-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.provenance-banner .timestamp {
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.provenance-skill-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

.section-provenance {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

/* ── Page Hero ──────────────────────────────────────────────────────── */

.page-hero {
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-4);
}

.page-hero h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.025em;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

/* `.page-hero-sub` is the class several pages (msm-status, scoreboard, funnel,
   healing) actually emit for the hero subtitle; alias it onto the same styling
   as `.subtitle` so it isn't left as an unstyled default <p>. */
.page-hero .subtitle,
.page-hero .page-hero-sub {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.hero-score {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--chart-1), var(--chart-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

/* ── Cards ──────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-5);
  transition: all var(--duration-normal) var(--ease-out);
}

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

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link.skill-card,
.card-link.attention-card {
  display: flex;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Metric Tiles ───────────────────────────────────────────────────── */

.metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.metric-grid > * {
  flex: 1 1 240px;
  min-width: 0;
  max-width: 100%;
}

.metric-tile {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-4);
  transition: all var(--duration-normal) var(--ease-out);
  min-width: 0;
  overflow: hidden;
}

.metric-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Threshold-driven color bands on metric tiles.
   Populated from metric-registry.tileBand(key, value). Reuses existing
   --tl-* palette so colors stay consistent with grade badges and trend dots. */
.metric-tile.tile-band-green  { border-left: 4px solid var(--tl-green-border); background: var(--tl-green-tint); }
.metric-tile.tile-band-yellow { border-left: 4px solid var(--tl-yellow-border); background: var(--tl-yellow-tint); }
.metric-tile.tile-band-red    { border-left: 4px solid var(--tl-red-border); background: var(--tl-red-tint); }

/* Per-tile benchmark line + per-section helper text. Muted on purpose — they
   are framing, not headline values. */
.metric-tile-benchmark {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.section-description {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  margin-top: 2px;
  margin-bottom: var(--space-4);
  max-width: 72ch;
}

/* Own channel gets a green left-border in the SocialBlade comparison table. */
.socialblade-own-row {
  background: var(--tl-green-tint);
  font-weight: var(--weight-medium);
}

/* Self-vs-MSM divergence note reuses dim-overall-narrative but picks up an
   amber left accent so readers know it's a soft-warning. */
.dim-divergence-note {
  border-left: 3px solid var(--tl-yellow-border);
  padding-left: var(--space-3);
}

/* Grade staleness banner sits right under the hero */
.grade-staleness-banner {
  margin-top: var(--space-3);
}

.metric-tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.metric-tile-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: help;
  min-width: 0;
  /* 2-line clip instead of single-line ellipsis so long metric labels (e.g.
     "Click-Through Diagnostics — landing_page_ux_problem") stay readable
     on the tile without breaking row alignment. Tooltip on hover still
     carries the full registry description. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.metric-tile-duration {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.metric-tile-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
  /* 2-line clip so long formatted values (e.g. dates, multi-word grades)
     don't get ellipsis-cut. Numeric metrics typically fit on one line. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.metric-tile-trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.trend-up { color: var(--color-positive); }
.trend-down { color: var(--color-negative); }
.trend-flat { color: var(--text-tertiary); }
.trend-up-bad { color: var(--color-negative); }
.trend-down-good { color: var(--color-positive); }

.sparkline-container {
  height: 32px;
  margin-top: var(--space-2);
}

.metric-tile-sparkline {
  height: 28px;
  margin-top: var(--space-2);
}

.metric-tile-sparkline canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Report Frequency Tabs ──────────────────────────────────────────── */

.report-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 0;
}

.report-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.report-tab-btn:hover {
  color: var(--text-primary);
}

.report-tab-btn.active {
  color: var(--text-link);
  border-bottom-color: var(--text-link);
}

.report-tab-date {
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  color: var(--text-tertiary);
  margin-left: var(--space-1);
}

.report-tab-panel {
  display: none;
}

.report-tab-panel.active {
  display: block;
}

.inline-report-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-sm);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
}

.inline-report-meta + .embedded-report {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* ── Alert Cards ────────────────────────────────────────────────────── */

.alerts-strip {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding: var(--space-2) 0 var(--space-4);
  margin-bottom: var(--space-6);
}

.alerts-strip::-webkit-scrollbar {
  display: none;
}

.alert-card {
  flex: 0 0 auto;
  min-width: 280px;
  max-width: 340px;
  scroll-snap-align: start;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  font-size: var(--text-sm);
}

.alert-card.alert-problem {
  background: var(--color-negative-bg);
  border-left-color: var(--color-negative);
}

.alert-card.alert-concern {
  background: var(--color-warning-bg);
  border-left-color: var(--color-warning);
}

.alert-card.alert-achievement {
  background: var(--color-positive-bg);
  border-left-color: var(--color-positive);
}

.alert-card.alert-info {
  background: var(--color-info-bg);
  border-left-color: var(--color-info);
}

.alert-card-severity {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.alert-card-message {
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
}

/* ── Grade Badges ───────────────────────────────────────────────────── */

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: #fff;
}

.grade-badge.grade-a { background: var(--grade-a); }
.grade-badge.grade-b { background: var(--grade-b); }
.grade-badge.grade-c { background: var(--grade-c); color: var(--text-primary); }
.grade-badge.grade-d { background: var(--grade-d); }
.grade-badge.grade-f { background: var(--grade-f); }
.grade-badge.grade-pending { background: var(--bg-tertiary); color: var(--text-tertiary); border: 1px dashed var(--border-color); }

.grade-badge-sm {
  width: 24px;
  height: 24px;
  font-size: var(--text-sm);
}

/* ── Traffic-Light Utilities ────────────────────────────────────────── */

.tl-border-green { border-left: 4px solid var(--tl-green-border); }
.tl-border-yellow { border-left: 4px solid var(--tl-yellow-border); }
.tl-border-red { border-left: 4px solid var(--tl-red-border); }

.tl-bg-green { background: var(--tl-green-tint); }
.tl-bg-yellow { background: var(--tl-yellow-tint); }
.tl-bg-red { background: var(--tl-red-tint); }

.tl-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tl-dot-green { background: var(--tl-green); }
.tl-dot-yellow { background: var(--tl-yellow); }
.tl-dot-red { background: var(--tl-red); }

/* Grade badge as drill-down link */
a.grade-badge {
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
a.grade-badge:hover {
  transform: scale(1.12);
  box-shadow: var(--shadow-md);
  color: #fff;
}
a.grade-badge.grade-c:hover { color: var(--text-primary); }

/* Weakest-link callout banner */
.weakest-link-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--tl-red-tint);
  border: 1px solid var(--tl-red-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-5);
}
.weakest-link-banner .tl-dot { flex-shrink: 0; }
.weakest-link-banner a { font-weight: var(--weight-semibold); }

/* Clickable stat items (grade distribution) */
a.stat-item {
  text-decoration: none;
  color: inherit;
  transition: all var(--duration-fast) var(--ease-out);
}
a.stat-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Skill Cards (Category pages) ───────────────────────────────────── */

.skill-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

a.skill-card,
.skill-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
}

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

.skill-card-body {
  flex: 1;
  min-width: 0;
}

.skill-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.skill-card-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.skill-card-metric {
  text-align: right;
  min-width: 80px;
}

.skill-card-metric-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

/* ── Category Cards (Dashboard) ─────────────────────────────────────── */

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.category-card {
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
  min-width: 0;
  overflow: hidden;
}

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

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.category-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-card-score {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.category-card-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.mini-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* ── Section Headings ───────────────────────────────────────────────── */

.section {
  margin-bottom: var(--space-6);
}

.section-heading {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-heading-row .section-heading {
  margin-bottom: 0;
}

.section-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

/* ── Charts ─────────────────────────────────────────────────────────── */

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-5);
}

.chart-card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 200px;
}

.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Section Descriptions ──────────────────────────────────────────── */

.section-description {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--text-muted);
  line-height: var(--leading-normal);
  margin-top: var(--space-1);
}

/* ── Tooltips ───────────────────────────────────────────────────────── */

[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip=""]:hover::after,
[data-tooltip=""]:focus::after {
  display: none;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  border-radius: var(--radius-sm);
  white-space: normal;
  max-width: 320px;
  width: max-content;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
  z-index: 200;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after,
[data-tooltip].tooltip-visible::after {
  opacity: 1;
}

/* ── Heartbeat Timeline ─────────────────────────────────────────────── */

.heartbeat-timeline {
  display: flex;
  gap: 2px;
  align-items: end;
  height: 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-2) 0;
}

.heartbeat-bar {
  flex: 0 0 4px;
  border-radius: 2px;
  min-height: 4px;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.heartbeat-bar.success { background: var(--color-positive); }
.heartbeat-bar.failure { background: var(--color-negative); }

/* ── Tables ─────────────────────────────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: var(--bg-secondary);
}

/* ── Time Range Selector ────────────────────────────────────────────── */

.time-range-selector {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  padding: 2px;
}

.time-range-btn {
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.time-range-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ── Error Page ─────────────────────────────────────────────────────── */

.error-page {
  text-align: center;
  padding: var(--space-20) var(--space-4);
}

.error-page h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.error-page p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
}

/* ── Briefing Cards ─────────────────────────────────────────────────── */

.briefing-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.briefing-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.briefing-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.briefing-icon.severity-high { background: var(--color-negative-bg); color: var(--color-negative); }
.briefing-icon.severity-medium { background: var(--color-warning-bg); color: var(--color-warning); }
.briefing-icon.severity-positive { background: var(--color-positive-bg); color: var(--color-positive); }
.briefing-icon.severity-low { background: var(--color-info-bg); color: var(--color-info); }

/* ── Empty State ────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  opacity: 0.3;
}

.empty-state-sm {
  padding: var(--space-6) var(--space-4);
}
.empty-state-sm svg {
  width: 32px;
  height: 32px;
}

/* ── Stat Summary Row ───────────────────────────────────────────────── */

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.stat-item {
  text-align: center;
  padding: var(--space-3);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-width: 0;
  overflow: hidden;
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Login Page ─────────────────────────────────────────────────────── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-6);
  background: var(--bg-primary);
}

.login-card {
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-card h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-4);
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--color-info);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  width: 100%;
}

.login-btn:hover {
  background: var(--text-link-hover);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive — Tablet (768px+)
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  .stat-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-row-5 {
    grid-template-columns: repeat(5, 1fr);
  }

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

  .skill-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .chart-canvas-wrap {
    height: 260px;
  }

  .page-hero h1 {
    font-size: var(--text-2xl);
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive — Desktop (1024px+)
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .mobile-nav {
    display: none;
  }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: var(--space-8) var(--space-10);
    padding-bottom: var(--space-10);
    max-width: calc(var(--content-max-width) + var(--sidebar-width) + var(--space-20));
  }

  .top-header {
    display: none;
  }

  .desktop-breadcrumbs {
    display: flex;
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .skill-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-hero h1 {
    font-size: var(--text-3xl);
  }

  .page-hero {
    padding: var(--space-6) var(--space-4) var(--space-4);
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Responsive — Large Desktop (1400px+)
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 1400px) {
  .skill-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Animations ─────────────────────────────────────────────────────── */

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

.animate-in {
  animation: fadeIn var(--duration-normal) var(--ease-out) both;
}

.animate-in:nth-child(2) { animation-delay: 50ms; }
.animate-in:nth-child(3) { animation-delay: 100ms; }
.animate-in:nth-child(4) { animation-delay: 150ms; }
.animate-in:nth-child(5) { animation-delay: 200ms; }
.animate-in:nth-child(6) { animation-delay: 250ms; }

/* ── Utility ────────────────────────────────────────────────────────── */

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

.text-positive { color: var(--color-positive); }
.text-negative { color: var(--color-negative); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-grade-a { color: var(--grade-a); }
.text-grade-b { color: var(--grade-b); }
.text-grade-c { color: var(--grade-c); }
.text-grade-d { color: var(--grade-d); }
.text-grade-f { color: var(--grade-f); }
.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.ml-auto { margin-left: auto; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* Shared page-level theme helpers */
.hero-stack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.hero-badge-lg {
  width: 56px;
  height: 56px;
  font-size: var(--text-2xl);
}

.hero-badge-md {
  width: 48px;
  height: 48px;
  font-size: var(--text-xl);
}

.hero-score-lg {
  font-size: var(--text-3xl);
}

.section-meta {
  font-size: var(--text-sm);
}

.stat-suffix {
  font-size: var(--text-sm);
}

.metric-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.stat-row-5 {
  grid-template-columns: repeat(2, 1fr);
}

.scroll-card {
  max-height: 400px;
  overflow-y: auto;
}

.chart-canvas-wrap-tall {
  height: 300px;
}

.report-subtitle {
  margin-top: var(--space-2);
}

/* ── Needs Attention Section ───────────────────────────────────────── */

.attention-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.attention-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid transparent;
  transition: all var(--duration-normal) var(--ease-out);
}

.attention-card.attention-grade-d {
  border-left-color: var(--grade-d);
  background: linear-gradient(90deg, rgba(255, 159, 10, 0.06) 0%, var(--bg-card) 50%);
}

.attention-card.attention-grade-f {
  border-left-color: var(--grade-f);
  background: linear-gradient(90deg, rgba(255, 59, 48, 0.06) 0%, var(--bg-card) 50%);
}

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

.attention-badge {
  flex-shrink: 0;
}

.attention-body {
  flex: 1;
  min-width: 0;
}

.attention-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

.attention-score {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.all-healthy-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-positive-bg);
  color: var(--color-positive);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

/* ── Category Card Score Group ─────────────────────────────────────── */

.category-card-score-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Metric Unit Labels ────────────────────────────────────────────── */

.metric-tile-unit {
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--text-tertiary);
  margin-left: var(--space-1);
}

/* ── Grade-tinted dimension tiles (traffic-light borders) ─────────── */

.dim-tile {
  border-left: 4px solid transparent;
  transition: all var(--duration-normal) var(--ease-out);
}

.dim-tile:has(.grade-a),
.dim-tile:has(.grade-b) { border-left-color: var(--tl-green-border); }
.dim-tile:has(.grade-c) { border-left-color: var(--tl-yellow-border); }
.dim-tile:has(.grade-d),
.dim-tile:has(.grade-f) { border-left-color: var(--tl-red-border); }

a.dim-tile { text-decoration: none; color: inherit; cursor: pointer; }
a.dim-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── D/F grade badge pulse (traffic-light red) ────────────────────── */

@keyframes gradePulseRed {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(255, 59, 48, 0); }
}

@keyframes gradePulseYellow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 165, 0, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(240, 165, 0, 0); }
}

.grade-badge.grade-f {
  animation: gradePulseRed 2.5s ease-in-out infinite;
}

.grade-badge.grade-d {
  animation: gradePulseRed 3s ease-in-out infinite;
}

.grade-badge.grade-c {
  animation: gradePulseYellow 3.5s ease-in-out infinite;
}

/* ── Sidebar Grade Legend ──────────────────────────────────────────── */

.sidebar-grade-legend {
  margin: var(--space-6) var(--space-4) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: var(--space-4);
}

.sidebar-legend-toggle {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: var(--space-2) var(--space-2);
  list-style: none;
}

.sidebar-legend-toggle::-webkit-details-marker { display: none; }
.sidebar-legend-toggle::marker { display: none; content: ''; }

.sidebar-legend-toggle::before {
  content: '▸ ';
  transition: transform var(--duration-fast) var(--ease-out);
  display: inline-block;
}

.sidebar-grade-legend[open] .sidebar-legend-toggle::before {
  content: '▾ ';
}

.sidebar-legend-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
}

.sidebar-legend-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.sidebar-legend-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.8);
  line-height: var(--leading-tight);
}

.sidebar-legend-desc {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.4);
  line-height: var(--leading-normal);
  margin-top: 1px;
}

/* ── Responsive: attention grid ────────────────────────────────────── */

@media (min-width: 768px) {
  .attention-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .attention-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Report navigation ───────────────────────────────────────────── */

.report-nav {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-6);
}

.report-nav-link {
  font-size: var(--text-sm);
  color: var(--text-link);
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease-out);
}

.report-nav-link:hover:not(.disabled) {
  background: var(--bg-card-hover);
}

.report-nav-link.disabled {
  color: var(--text-tertiary);
  cursor: default;
  opacity: 0.5;
}

.btn-sm {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-link);
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease-out);
}

.btn-sm:hover {
  background: var(--bg-card-hover);
}

/* ── Embedded report content ─────────────────────────────────────── */

.embedded-report {
  max-width: 100%;
  overflow-x: auto;
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  line-height: 1.6;
  color: var(--text-primary);
}

.embedded-report > div[style*="max-width"] {
  max-width: 100% !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.embedded-report h1,
.embedded-report h2,
.embedded-report h3,
.embedded-report h4 {
  color: var(--text-primary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.embedded-report h1 { font-size: 1.5rem; }
.embedded-report h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: var(--space-2); }
.embedded-report h3 { font-size: 1.1rem; }

.embedded-report table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: var(--text-sm);
}

.embedded-report th,
.embedded-report td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.embedded-report th {
  background: var(--bg-secondary);
  font-weight: var(--weight-semibold);
}

.embedded-report tr:hover td {
  background: var(--bg-card-hover);
}

.embedded-report a {
  color: var(--text-link);
}

.embedded-report img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.embedded-report pre,
.embedded-report code {
  font-size: var(--text-xs);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
}

.embedded-report pre {
  padding: var(--space-3);
  overflow-x: auto;
}

.embedded-report pre[style*="color"] {
  background: transparent;
  font-size: 12px;
}

.embedded-report div[style*="background"] {
  overflow-x: auto;
}

.embedded-report div[style*="background"] pre {
  background: transparent;
}

.embedded-report ul,
.embedded-report ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.embedded-report hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5em 0;
}

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-tertiary);
}

.empty-state h3 {
  margin-top: var(--space-4);
  color: var(--text-secondary);
}

.empty-state p {
  margin-top: var(--space-2);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Actionable Items ──────────────────────────────────────────────── */

.action-stats-badge {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
  vertical-align: middle;
  color: var(--text-secondary);
}
.action-stats-done { color: var(--color-success) !important; }

.action-groups { display: flex; flex-direction: column; gap: var(--space-4); }

.action-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.action-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.action-group-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-group-count {
  font-size: var(--text-xs);
  background: var(--bg-primary);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
}

.action-list { display: flex; flex-direction: column; }

.action-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-out);
}
.action-item:last-child { border-bottom: none; }
.action-item:hover { background: var(--bg-card-hover); }

.action-checkbox-wrap {
  display: flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.action-item-content { flex: 1; min-width: 0; }

.action-issue {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.4;
}

.action-fix {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: 1.4;
}

.action-meta {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
}

.action-persona {
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}

.action-type {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  font-weight: var(--weight-medium);
}

.action-type-manual {
  background: rgba(234, 179, 8, 0.1);
  color: var(--color-warning);
}

.action-priority {
  color: var(--text-tertiary);
  font-weight: var(--weight-semibold);
}

.action-status-indicator {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spinner for in-progress */
.action-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: actionSpin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes actionSpin { to { transform: rotate(360deg); } }

/* Completed / Failed states */
.action-item-done { opacity: 0.7; }
.action-check-icon { color: var(--color-success); flex-shrink: 0; padding-top: 2px; }
.action-fail-icon { color: var(--color-danger); flex-shrink: 0; padding-top: 2px; }
.action-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.action-item-pending { opacity: 0.8; }

/* Toggle for completed items */
.action-completed-toggle {
  margin-top: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.action-completed-toggle summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  user-select: none;
  list-style: none;
}
.action-completed-toggle summary::-webkit-details-marker { display: none; }
.action-completed-toggle summary::before {
  content: '▸';
  transition: transform var(--duration-fast) var(--ease-out);
}
.action-completed-toggle[open] summary::before { transform: rotate(90deg); }

.action-list-history .action-item { padding: var(--space-2) var(--space-4); }

.action-retry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-sm);
  background: rgba(255, 59, 48, 0.08);
  color: var(--color-danger);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  padding: 0;
}
.action-retry-btn:hover {
  background: rgba(255, 59, 48, 0.15);
}
.action-retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-status-label {
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
}
.action-status-failed-label {
  background: rgba(255, 59, 48, 0.1);
  color: var(--color-danger);
}
.action-status-pending-label {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
}
.action-stats-pending {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
}
.action-stats-failed {
  background: rgba(255, 59, 48, 0.1);
  color: var(--color-danger);
}

@media (max-width: 640px) {
  .action-group-header { padding: var(--space-2) var(--space-3); }
  .action-item { padding: var(--space-2) var(--space-3); }
}

/* Skip-to-content link (auto-generated by portal-ux-fix) */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  color: var(--text-link);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.skip-to-content:focus {
  position: fixed;
  left: var(--space-4);
  top: var(--space-4);
  width: auto;
  height: auto;
  overflow: visible;
}

/* Focus-visible styles for keyboard accessibility (auto-generated by portal-ux-fix) */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion preference (auto-generated by portal-ux-fix) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Paid Ads Control Page
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Status badges ─────────────────────────────────────────────────── */
.pads-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pads-status-live       { background: var(--color-positive-bg); color: var(--color-positive); border: 1px solid var(--tl-green-border); }
.pads-status-ready      { background: var(--color-info-bg);     color: var(--color-info);     border: 1px solid rgba(0,122,255,.3); }
.pads-status-paused     { background: var(--color-warning-bg);  color: #b37800;               border: 1px solid rgba(255,159,10,.3); }
.pads-status-proposed   { background: var(--bg-secondary);      color: var(--text-secondary);  border: 1px solid var(--border-subtle); }
.pads-status-pending    { background: var(--color-warning-bg);  color: #b37800;               border: 1px solid rgba(255,159,10,.3); }
.pads-status-blocked    { background: var(--color-negative-bg); color: var(--color-negative);  border: 1px solid var(--tl-red-border); }
.pads-status-rejected   { background: var(--color-negative-bg); color: var(--color-negative);  border: 1px solid var(--tl-red-border); }

/* ── Generic small badges (ok/warn/err/info/neutral) ───────────── */
.pads-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.pads-badge-ok      { background: var(--color-positive-bg); color: var(--color-positive); }
.pads-badge-warn    { background: var(--color-warning-bg);  color: #b37800; }
.pads-badge-err     { background: var(--color-negative-bg); color: var(--color-negative); }
.pads-badge-info    { background: var(--color-info-bg);     color: var(--color-info); }
.pads-badge-neutral  { background: var(--bg-secondary);      color: var(--text-secondary); }
.pads-badge-warning  { background: #fef3c7;                  color: #92400e; }
.pads-badge-success  { background: #d1fae5;                  color: #065f46; }
.pads-badge-pending  { background: #ede9fe;                  color: #5b21b6; }

/* ── Blocker panel ─────────────────────────────────────────────────── */
.pads-blocker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.pads-blocker-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-negative-bg);
  border: 1px solid var(--tl-red-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.pads-blocker-type {
  font-size: var(--text-xs);
  text-transform: uppercase;
  font-weight: var(--weight-semibold);
  color: var(--color-negative);
  min-width: 80px;
}
.pads-blocker-reason {
  color: var(--text-secondary);
  margin-left: auto;
}
.pads-blocker-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-negative);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  margin-left: var(--space-2);
}
.pads-pending-count {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: #b37800;
  background: var(--color-warning-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
  margin-left: var(--space-2);
}

/* ── Tables ────────────────────────────────────────────────────────── */
.pads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.pads-table th {
  text-align: left;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}
.pads-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.pads-table .text-right { text-align: right; }
.pads-table .text-muted { color: var(--text-tertiary); }
.pads-platform-name { font-weight: var(--weight-medium); }

/* ── Card grid & proposal cards ────────────────────────────────────── */
.pads-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}
.pads-proposal-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pads-proposal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.pads-platform-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.pads-proposal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.pads-rationale {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-info);
  line-height: var(--leading-relaxed);
}
.pads-creative-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.pads-creative-mini {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.pads-creative-variant {
  padding: var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.pads-creative-field {
  margin-top: var(--space-2);
}
.pads-creative-field-label {
  display: block;
  font-size: 10px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 3px;
}
.pads-headline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pads-headline-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  background: var(--surface-accent);
  color: var(--text-link);
  border: 1px solid var(--border-accent);
  white-space: nowrap;
}
.pads-creative-headline {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--text-link);
  margin-bottom: 2px;
}
.pads-creative-body {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

/* ── Proposal landing-page links & keyword tags ───────────────────── */
.pads-proposal-targeting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
}
.pads-proposal-targeting .pads-keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.pads-proposal-lp-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-warning, #e6a817);
  margin-top: var(--space-2);
}
.pads-proposal-lps {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.pads-proposal-lps-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pads-proposal-lps-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}
.pads-proposal-lps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.pads-link-lp {
  font-size: var(--text-xs);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.pads-link-lp .pads-variant-label {
  margin-bottom: 0;
}
.pads-proposal-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-1);
}
.pads-keyword-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.pads-keyword-more {
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 1px 4px;
}
.pads-variant-label {
  display: inline-block;
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* ── Enhanced orphaned LP rows ────────────────────────────────────── */
.pads-lp-row-enhanced {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  background: var(--surface-primary);
}
.pads-lp-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.pads-lp-row-proposal {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  padding-top: 4px;
  border-top: 1px dashed var(--border-subtle);
  margin-top: 2px;
}
.pads-lp-proposal-label {
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}
.pads-lp-proposal-link {
  color: var(--text-link);
  text-decoration: none;
}
.pads-lp-proposal-link:hover { text-decoration: underline; }
.pads-lp-row-unmatched {
  color: var(--text-tertiary);
  font-style: italic;
}

/* ── Campaign cards ────────────────────────────────────────────────── */
.pads-platform-group {
  margin-bottom: var(--space-6);
}
.pads-platform-heading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  text-transform: capitalize;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.pads-campaign-card {
  margin-bottom: var(--space-4);
}
.pads-campaign-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.pads-campaign-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

/* ── Campaign KPI mini row ─────────────────────────────────────────── */
.pads-campaign-kpi {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3);
}
.pads-kpi-item {
  display: flex;
  flex-direction: column;
  min-width: 70px;
}
.pads-kpi-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pads-kpi-value {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}

/* ── A/B variant grid (side-by-side proofread cards) ───────────────── */
.pads-variants-wrap {
  margin-top: var(--space-3);
}
.pads-variants-heading {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.pads-ab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}
.pads-ad-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pads-variant-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  color: var(--color-info);
  letter-spacing: 0.04em;
}
.pads-ad-headline {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-link);
  line-height: var(--leading-tight);
}
.pads-ad-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}
.pads-ad-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
}

/* ── Platform deep links ──────────────────────────────────────────── */
.pads-campaign-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.pads-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-info);
  border: 1px solid rgba(0,122,255,.3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.pads-ext-link:hover {
  background: var(--color-info);
  color: #fff;
  border-color: var(--color-info);
}
.pads-ad-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.pads-link-platform {
  color: var(--color-info);
  font-weight: var(--weight-medium);
}
.pads-ext-id {
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
  opacity: .6;
}
.pads-platform-dash-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-info);
  text-decoration: none;
  text-transform: none;
  opacity: .7;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.pads-platform-dash-link:hover { opacity: 1; }
.pads-platform-name-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-info);
  text-decoration: none;
  font-weight: var(--weight-semibold);
}
.pads-platform-name-link:hover { text-decoration: underline; }

/* ── Media preview ─────────────────────────────────────────────────── */
.pads-media-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  max-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pads-media-img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
}
.pads-media-video {
  padding: var(--space-3);
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}
.pads-media-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-align: center;
  word-break: break-all;
}
.pads-media-path {
  word-break: break-all;
}

.pads-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-link);
  text-decoration: none;
}
.pads-link:hover { text-decoration: underline; }
.pads-link-sm { font-size: var(--text-xs); }

/* ── Landing page section within campaigns ─────────────────────────── */
.pads-lp-section {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.pads-lp-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
}
.pads-lp-row:last-child { border-bottom: none; }
.pads-lp-slug {
  font-weight: var(--weight-medium);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.pads-verify-error {
  font-size: var(--text-xs);
  color: var(--color-negative);
  margin-left: auto;
}

/* ── Helpers ───────────────────────────────────────────────────────── */
.subtitle-inline {
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--text-tertiary);
}
.empty-state {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-style: italic;
  padding: var(--space-4) 0;
}
.table-wrap { overflow-x: auto; }

/* ── Paid Ads navigation strip ─────────────────────────────────────── */
.pads-nav-strip { margin-top: var(--space-4); }
.pads-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid rgba(0,122,255,.25);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
}
.pads-nav-btn strong { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.pads-nav-btn small { display: block; font-size: var(--text-xs); opacity: .7; margin-top: 2px; }
.pads-nav-btn > svg:last-child { margin-left: auto; opacity: .5; }
.pads-nav-btn:hover {
  background: var(--color-info);
  color: #fff;
  border-color: var(--color-info);
}
.pads-nav-btn:hover small { opacity: .9; }
.pads-nav-btn:hover > svg:last-child { opacity: 1; }

/* Responsive: stack A/B grid on narrow screens */
@media (max-width: 600px) {
  .pads-ab-grid { grid-template-columns: 1fr; }
  .pads-card-grid { grid-template-columns: 1fr; }
  .pads-blocker-card { flex-wrap: wrap; }
  .pads-campaign-kpi { gap: var(--space-3); }
  .pads-lp-row { flex-wrap: wrap; }
}

/* ── Use Case Strategist Pipeline ──────────────────────────────────── */
.ucs-funnel-bar {
  display: flex;
  gap: 3px;
  height: 52px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.ucs-funnel-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  transition: flex var(--duration-normal) var(--ease-out);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.ucs-funnel-label { font-size: 10px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 4px; }
.ucs-funnel-count { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.ucs-funnel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.ucs-legend-item { display: flex; align-items: center; gap: 4px; }
.ucs-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.ucs-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.ucs-kpi-card {
  padding: var(--space-3) var(--space-4);
}
.ucs-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}
.ucs-kpi-name { font-size: var(--text-sm); color: var(--text-secondary); font-weight: var(--weight-medium); }
.ucs-kpi-value { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-primary); }
.ucs-kpi-threshold { font-size: var(--text-xs); color: var(--text-tertiary); margin-left: var(--space-2); font-weight: var(--weight-normal); }

.ucs-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-3);
}
.ucs-case-card { padding: var(--space-3) var(--space-4); }
.ucs-case-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.ucs-stage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ucs-case-grade { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.ucs-case-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-2) 0;
  line-height: 1.5;
}
.ucs-case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}
.ucs-case-meta span { display: flex; align-items: center; gap: 3px; }
.ucs-case-footer {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
}

.ucs-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-4);
}

.ucs-nav-strip { margin-top: var(--space-4); }
.ucs-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(16, 185, 129, .08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, .25);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
}
.ucs-nav-btn strong { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.ucs-nav-btn small { display: block; font-size: var(--text-xs); opacity: .7; margin-top: 2px; }
.ucs-nav-btn > svg:last-child { margin-left: auto; opacity: .5; }
.ucs-nav-btn:hover {
  background: #059669;
  color: #fff;
  border-color: #059669;
}
.ucs-nav-btn:hover small { opacity: .9; }
.ucs-nav-btn:hover > svg:last-child { opacity: 1; }

.ucs-stage-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 640px;
}
.ucs-stage-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.ucs-stage-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  margin-top: 2px;
}
.ucs-stage-info {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}
.ucs-stage-info strong {
  display: block;
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
}
.ucs-stage-info em {
  font-style: normal;
  background: var(--bg-card-hover);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: var(--text-xs);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.ucs-stage-arrow {
  display: flex;
  justify-content: center;
  padding: 4px 0 4px 7px;
  color: var(--text-tertiary);
}

@media (max-width: 600px) {
  .ucs-case-grid { grid-template-columns: 1fr; }
  .ucs-kpi-grid { grid-template-columns: 1fr 1fr; }
  .ucs-bottom-grid { grid-template-columns: 1fr; }
  .ucs-funnel-label { display: none; }
}

/* ── Office badges ─────────────────────────────────────────────────── */
.office-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
}
.office-badge-main {
  background: rgba(147, 51, 234, .12);
  color: #7c3aed;
  border: 1px solid rgba(147, 51, 234, .25);
}
.office-badge-remote {
  background: rgba(59, 130, 246, .10);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, .20);
}
.office-badge-both {
  background: rgba(16, 185, 129, .10);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, .20);
}
.office-filter-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.office-filter-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-secondary);
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
}
.office-filter-btn:hover {
  border-color: var(--border-primary);
  color: var(--text-primary);
}
.office-filter-btn.active {
  background: var(--text-primary);
  color: var(--surface-primary);
  border-color: var(--text-primary);
}

/* ── Status color utilities ────────────────────────────────────────── */

.text-green  { color: var(--green-500, #22c55e); }
.text-red    { color: var(--red-500, #ef4444); }
.text-yellow { color: var(--yellow-600, #ca8a04); }
.text-danger { color: var(--danger, #dc3545); }
.text-warning { color: var(--warning, #ffc107); }

/* ── Home page quick links ─────────────────────────────────────────── */
.quick-links-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.quick-link-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--duration-normal) var(--ease-out);
}
.quick-link-card > svg:first-child { color: var(--color-info); flex-shrink: 0; }
.quick-link-card strong { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.quick-link-card small { display: block; font-size: var(--text-xs); color: var(--color-muted); margin-top: 1px; }
.quick-link-card > svg:last-child { margin-left: auto; opacity: .4; flex-shrink: 0; }
.quick-link-card:hover {
  border-color: var(--color-info);
  background: var(--color-info-bg);
}
.quick-link-card:hover > svg:last-child { opacity: 1; color: var(--color-info); }

/* ── Paid-ads landing page clarity section ─────────────────────────── */

.pads-lp-clarity { margin-left: 1rem; margin-top: 0.25rem; }

/* ── Tier border color classes (system-tree) ───────────────────────── */

.tier-border-green   { border-left: 4px solid #22c55e; }
.tier-border-blue    { border-left: 4px solid #06b6d4; }
.tier-border-purple  { border-left: 4px solid #8b5cf6; }
.tier-border-orange  { border-left: 4px solid #f97316; }
.tier-border-yellow  { border-left: 4px solid #eab308; }
.tier-border-grey    { border-left: 4px solid #64748b; }
.tier-border-red     { border-left: 4px solid #ef4444; }

/* ── Sidebar unread badge ──────────────────────────────────────────── */
.memo-unread-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: var(--weight-bold);
  line-height: 18px;
  text-align: center;
}

/* ── Memo App (threaded) ───────────────────────────────────────────── */
.memo-app {
  display: flex;
  height: calc(100vh - 140px);
  min-height: 480px;
  max-width: 1100px;
  margin: 0 auto;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-primary);
}

/* Thread list (left panel) */
.memo-thread-list {
  width: 320px;
  min-width: 260px;
  border-right: 1px solid var(--border-secondary);
  display: flex;
  flex-direction: column;
  background: var(--surface-secondary);
}
.memo-thread-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
}
.memo-thread-list-header h2 {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  margin: 0;
}
.memo-new-thread-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.memo-new-thread-btn:hover { background: #1d4ed8; }
.memo-thread-items {
  flex: 1;
  overflow-y: auto;
}
.memo-thread-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-8) var(--space-4);
  font-size: var(--text-sm);
}
.memo-thread-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.memo-thread-item:hover { background: rgba(0,0,0,.03); }
.memo-thread-item.active {
  background: rgba(37,99,235,.08);
  border-left: 3px solid #2563eb;
}
.memo-thread-item.has-unread .memo-thread-title { font-weight: var(--weight-bold); }
.memo-thread-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: 2px;
}
.memo-thread-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.memo-thread-time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}
.memo-thread-item-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.memo-thread-preview {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.memo-thread-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-bold);
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
.memo-thread-count {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.memo-thread-count::before { content: '('; }
.memo-thread-count::after { content: ')'; }

/* Conversation panel (right) */
.memo-conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.memo-conv-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
  background: var(--surface-primary);
}
.memo-conv-title { flex: 1; min-width: 0; }
.memo-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
}
.memo-delete-btn:hover {
  background: var(--status-danger-bg, #fee2e2);
  color: var(--status-danger, #dc2626);
}
.memo-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.memo-back-btn:hover { background: rgba(0,0,0,.05); }
.memo-conv-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Message area */
.memo-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-4);
  scroll-behavior: smooth;
}
.memo-chat-loading, .memo-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-8) 0;
  font-size: var(--text-sm);
}
.memo-empty svg { opacity: 0.3; margin-bottom: var(--space-2); }

/* Date dividers */
.memo-date-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-3);
}
.memo-date-divider::before,
.memo-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-secondary);
}
.memo-date-divider span {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Bubble rows */
.memo-bubble-row { display: flex; margin-bottom: var(--space-2); }
.memo-bubble-sent { justify-content: flex-end; }
.memo-bubble-received { justify-content: flex-start; }

/* Bubbles */
.memo-bubble {
  max-width: 75%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.5;
  word-break: break-word;
}
.memo-bubble-sent .memo-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.memo-bubble-received .memo-bubble {
  background: var(--surface-secondary);
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}
.memo-bubble.memo-unread { border-left: 3px solid #ef4444; }
.memo-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 2px;
}
.memo-bubble-source { font-size: 11px; font-weight: var(--weight-semibold); opacity: 0.8; }
.memo-bubble-sent .memo-bubble-source { color: rgba(255,255,255,.7); }
.memo-bubble-time { font-size: 10px; opacity: 0.6; white-space: nowrap; }
.memo-bubble-subject { font-weight: var(--weight-semibold); margin-bottom: 2px; font-size: var(--text-sm); }
.memo-urgent-tag {
  display: inline-block;
  background: #ef4444;
  color: #fff;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-right: 4px;
}
.memo-bubble-body { font-size: var(--text-sm); line-height: 1.55; }

/* Input bar */
.memo-chat-input-bar {
  border-top: 1px solid var(--border-secondary);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-primary);
}
.memo-input-subject {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-secondary);
  padding: var(--space-1) 0 var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: transparent;
  outline: none;
  box-sizing: border-box;
}
.memo-input-subject::placeholder { color: var(--text-tertiary); }
.memo-input-row { display: flex; flex-direction: column; }
.memo-input-body {
  width: 100%;
  border: none;
  resize: vertical;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: transparent;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  min-height: 100px;
}
.memo-input-body::placeholder { color: var(--text-tertiary); }
.memo-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2);
}
.memo-input-footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.memo-urgent-toggle {
  font-size: 11px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.memo-urgent-toggle input { margin: 0; }
.memo-send-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}
.memo-send-btn:hover { background: #1d4ed8; }
.memo-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.memo-send-status { font-size: 12px; color: var(--text-tertiary); }

/* ── Mobile: stack panels, show/hide with .thread-open ─────────── */
@media (max-width: 768px) {
  .memo-app { flex-direction: column; height: calc(100vh - 100px); }
  .memo-thread-list { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border-secondary); }
  .memo-conversation { display: none; }
  .memo-app.thread-open .memo-thread-list { display: none; }
  .memo-app.thread-open .memo-conversation { display: flex; }
  .memo-app.thread-open .memo-back-btn { display: flex; }
  .memo-input-body { min-height: 72px; }
}

/* ── Dimension Narratives ──────────────────────────────────────── */
.dim-overall-narrative {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  margin-bottom: var(--space-4);
}
.dim-detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.dim-detail-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.dim-detail-card .metric-tile {
  width: 100%;
}
.dim-narrative {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin: 0;
  padding: var(--space-1) var(--space-3);
}
.dim-narrative-card {
  border-left: 3px solid var(--accent);
}
.dim-narrative-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: var(--space-2) 0 0;
}

/* ── Third-Party Campaign Dashboard ───────────────────────────────── */
.tpc-nav-strip { margin-top: var(--space-4); }
.tpc-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(139, 92, 246, .08);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, .25);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.tpc-nav-btn strong { display: block; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.tpc-nav-btn small { display: block; font-size: var(--text-xs); opacity: .7; margin-top: 2px; }
.tpc-nav-btn > svg:last-child { margin-left: auto; opacity: .5; }
.tpc-nav-btn:hover {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}
.tpc-nav-btn:hover small { opacity: .9; }
.tpc-nav-btn:hover > svg:last-child { opacity: 1; }

.tpc-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
}
.tpc-kpi-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-3);
  text-align: center;
}
.tpc-kpi-value {
  display: block;
  font-size: 2rem;
  font-weight: var(--weight-bold);
  line-height: 1.1;
}
.tpc-kpi-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.tpc-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
@media (max-width: 700px) {
  .tpc-bottom-grid { grid-template-columns: 1fr; }
}

.tpc-channel-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--space-2);
  vertical-align: middle;
}

.tpc-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--border);
}
.tpc-timeline-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  position: relative;
}
.tpc-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  position: absolute;
  left: calc(-1 * var(--space-4) - 6px);
}
.tpc-timeline-content {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--text-sm);
}
.tpc-timeline-event {
  font-weight: var(--weight-semibold);
}
.tpc-timeline-campaign {
  color: var(--text-secondary);
}
.tpc-timeline-transition {
  font-size: var(--text-xs);
  padding: 1px 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}
.tpc-timeline-date {
  font-size: var(--text-xs);
}

/* ── Keyword Dashboard ─────────────────────────────────────────────── */

.keyword-dashboard { margin-top: 1rem; }

.kw-stats-row {
  display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.kw-stat-card {
  flex: 1; min-width: 140px; padding: 1rem 1.25rem;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  text-align: center; border: 1px solid var(--border);
}
.kw-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.kw-stat-label { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 0.25rem; }

.kw-filters {
  display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center;
}
.kw-filters select, .kw-filters input {
  padding: 0.35rem 0.5rem; font-size: var(--text-sm);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-primary); color: var(--text-primary);
}

.kw-table { width: 100%; font-size: var(--text-sm); }
.kw-table th { white-space: nowrap; }
.kw-table th.kw-sortable { cursor: pointer; user-select: none; }
.kw-table th.kw-sortable:hover { color: var(--accent); }
.kw-table th.kw-sortable a { color: inherit; text-decoration: none; }

.kw-score-bar {
  display: inline-block; height: 6px; border-radius: 3px; vertical-align: middle;
  margin-right: 0.4rem; min-width: 4px;
}
.kw-score-high { background: var(--green, #22c55e); }
.kw-score-med  { background: var(--yellow, #eab308); }
.kw-score-low  { background: var(--red, #ef4444); }

.kw-badge {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500;
}
.kw-badge-active     { background: rgba(34,197,94,0.15); color: var(--green, #22c55e); }
.kw-badge-discovered { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.kw-badge-deprecated { background: rgba(239,68,68,0.15); color: var(--red, #ef4444); }
.kw-badge-negative   { background: rgba(156,163,175,0.15); color: var(--text-tertiary); }

/* Channel-source / drift / action chips — same chip shape as .kw-badge.
   Previously these three columns referenced classes that did not exist, so
   they rendered as unstyled raw text. */
.kw-channel, .kw-drift, .kw-action {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500;
}
/* Channel source (classifyChannelSource: organic|paid|social|mixed|none|other) */
.kw-channel-organic { background: rgba(34,197,94,0.15);  color: var(--green, #22c55e); }
.kw-channel-paid    { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.kw-channel-social  { background: rgba(168,85,247,0.15); color: #a855f7; }
.kw-channel-mixed   { background: rgba(234,179,8,0.15);  color: var(--yellow, #eab308); }
.kw-channel-none,
.kw-channel-other   { background: rgba(107,114,128,0.15); color: var(--text-tertiary); }
/* Drift (classifyDrift: on-canon|pending|irrelevant) */
.kw-drift-on-canon   { background: rgba(34,197,94,0.15);  color: var(--green, #22c55e); }
.kw-drift-pending    { background: rgba(234,179,8,0.15);  color: var(--yellow, #eab308); }
.kw-drift-irrelevant { background: rgba(239,68,68,0.15);  color: var(--red, #ef4444); }
/* Action (recommendAction: promote|monitor|audit|demote) */
.kw-action-promote { background: rgba(34,197,94,0.15);  color: var(--green, #22c55e); }
.kw-action-monitor { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.kw-action-audit   { background: rgba(234,179,8,0.15);  color: var(--yellow, #eab308); }
.kw-action-demote  { background: rgba(239,68,68,0.15);  color: var(--red, #ef4444); }

.kw-loading { text-align: center; padding: 2rem; color: var(--text-tertiary); }

/* ── Content Inventory (Titles + Descriptions) Dashboard ─────────────── */

.ci-dashboard { margin-top: 1rem; }

.ci-stats-row {
  display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.ci-stat-card {
  flex: 1; min-width: 140px; padding: 1rem 1.25rem;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  text-align: center; border: 1px solid var(--border);
}
.ci-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.ci-stat-label { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 0.25rem; }

.ci-filters {
  display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center;
}
.ci-filters select, .ci-filters input {
  padding: 0.35rem 0.5rem; font-size: var(--text-sm);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-primary); color: var(--text-primary);
}
.ci-filters input[type="search"] { min-width: 16rem; flex: 1; }

.ci-page-caption { font-size: var(--text-sm); margin: 0 0 0.5rem; }
.ci-pager {
  display: flex; gap: 0.75rem; align-items: center; margin: 0.75rem 0 1.5rem;
}
.ci-pager [aria-disabled="true"] {
  opacity: 0.45; pointer-events: none; cursor: default;
}
.ci-platform-targets summary {
  cursor: pointer; font-size: var(--text-sm); color: var(--text-secondary);
}
.ci-targets-table { width: auto; font-size: var(--text-xs); margin-top: 0.5rem; }
.ci-targets-table td, .ci-targets-table th { padding: 0.25rem 0.75rem; }

.ci-table { width: 100%; font-size: var(--text-sm); }
.ci-table th.ci-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ci-table th.ci-sortable:hover { color: var(--accent); }
.ci-table th.ci-sortable a { color: inherit; text-decoration: none; }
.ci-table th { white-space: nowrap; }
.ci-table td:first-child {
  max-width: 480px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  padding-right: 0.75rem;
}
/* Clamp the inner wrapper, not the td — display:-webkit-box on a table-cell
   pulls it out of table layout and collides the other columns. */
.ci-table .ci-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ci-table td.ci-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.ci-dashboard[data-content-type="description"] .ci-table {
  table-layout: fixed;
}
.ci-dashboard[data-content-type="description"] .ci-table th:first-child,
.ci-dashboard[data-content-type="description"] .ci-table td:first-child {
  width: 48%;
  max-width: none;
}
.ci-dashboard[data-content-type="description"] .ci-table th:not(:first-child),
.ci-dashboard[data-content-type="description"] .ci-table td:not(:first-child) {
  white-space: nowrap;
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-text-expand { margin: 0; }
.ci-text-expand > summary {
  cursor: pointer;
  list-style: none;
}
.ci-text-expand > summary::-webkit-details-marker { display: none; }
.ci-text-expand > summary::after {
  content: " more";
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 500;
}
.ci-text-expand[open] > summary::after { content: " less"; }
.ci-text-expand[open] .ci-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.ci-score-bar {
  display: inline-block; height: 6px; border-radius: 3px; vertical-align: middle;
  margin-right: 0.4rem; min-width: 4px;
}
.ci-score-high { background: var(--green, #22c55e); }
.ci-score-med  { background: var(--yellow, #eab308); }
.ci-score-low  { background: var(--red, #ef4444); }

.ci-badge {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500;
}
.ci-badge-active     { background: rgba(34,197,94,0.15); color: var(--green, #22c55e); }
.ci-badge-discovered { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.ci-badge-deprecated { background: rgba(239,68,68,0.15); color: var(--red, #ef4444); }
.ci-badge-declining  { background: rgba(251,146,60,0.15); color: #fb923c; }
.kw-badge-declining  { background: rgba(251,146,60,0.15); color: #fb923c; }

.ci-loading, .kw-loading { text-align: center; padding: 2rem; color: var(--text-tertiary); }

/* Relevance status chip (derived from row.status) */
.ci-relevance {
  display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 600;
}
.ci-relevance-ok     { background: rgba(34,197,94,0.15);  color: var(--green, #22c55e); }
.ci-relevance-new    { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.ci-relevance-review { background: rgba(234,179,8,0.15);  color: var(--yellow, #eab308); }
.ci-relevance-bad    { background: rgba(239,68,68,0.15);  color: var(--red, #ef4444); }
.ci-relevance-warn   { background: rgba(251,146,60,0.15); color: #fb923c; }

/* Per-row platform-length compliance chip (active when platform filter set) */
.ci-compliance {
  display: inline-block; margin-left: 0.4rem; padding: 0 5px;
  border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 600;
}
.ci-compliance-pass { background: rgba(34,197,94,0.15);  color: var(--green, #22c55e); }
.ci-compliance-warn { background: rgba(234,179,8,0.15);  color: var(--yellow, #eab308); }
.ci-compliance-fail { background: rgba(239,68,68,0.15);  color: var(--red, #ef4444); }

/* Intelligence Panels — auto-fit so 3, 4, or 5 panels lay out cleanly */
.ci-intelligence-panels, .kw-intelligence-panels {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin: 1rem 0;
}
.ci-panel, .kw-panel {
  /* Theme-aware surface (matches .kw-stat-card). Previously hardcoded a dark
     #1e1e2e fallback for --card-bg (undefined in this theme), so the panels
     rendered as dark cards with dark text — illegible on the light page. */
  background: var(--bg-secondary); border-radius: var(--radius-md, 8px);
  padding: 1rem; border: 1px solid var(--border);
}
.ci-panel h3, .kw-panel h3 { font-size: 0.85rem; margin: 0 0 0.5rem; color: var(--text-secondary); }
.mover-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 0.82rem; }
.mover-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0.5rem; }
.mover-delta { font-weight: 600; white-space: nowrap; }
.mover-delta.up { color: var(--green, #22c55e); }
.mover-delta.down { color: var(--red, #ef4444); }
.freshness-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 0.82rem; }
.source-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0.5rem; }
.freshness-badge { font-weight: 600; font-size: 0.78rem; padding: 1px 6px; border-radius: 4px; }
.freshness-badge.fresh { background: rgba(34,197,94,0.15); color: var(--green, #22c55e); }
.freshness-badge.aging { background: rgba(234,179,8,0.15); color: var(--yellow, #eab308); }
.freshness-badge.stale { background: rgba(239,68,68,0.15); color: var(--red, #ef4444); }
.status-chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 500; margin: 2px; }
.status-chip.status-active     { background: rgba(34,197,94,0.15); color: var(--green, #22c55e); }
.status-chip.status-discovered { background: rgba(59,130,246,0.15); color: var(--blue, #3b82f6); }
.status-chip.status-deprecated { background: rgba(239,68,68,0.15); color: var(--red, #ef4444); }
.status-chip.status-declining  { background: rgba(251,146,60,0.15); color: #fb923c; }
.status-chip.status-negative   { background: rgba(107,114,128,0.15); color: #6b7280; }
@media (max-width: 768px) {
  .ci-intelligence-panels, .kw-intelligence-panels { grid-template-columns: 1fr; }
}

/* ── Workforce Activity Dashboard ─────────────────────────────────────── */

.wf-kpi-row {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem;
}
.wf-kpi-card {
  flex: 1 1 140px; background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb); border-radius: var(--radius-md, 10px);
  padding: 1rem 1.25rem; text-align: center; min-width: 120px;
}
.wf-kpi-card.wf-kpi-good { border-color: #34c759; background: rgba(52,199,89,0.06); }
.wf-kpi-value { font-size: 1.75rem; font-weight: 700; color: var(--color-text, #1d1d1f); line-height: 1.2; }
.wf-kpi-label { font-size: 0.75rem; color: var(--color-text-secondary, #86868b); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.03em; }

.wf-table-wrap { overflow-x: auto; margin: 1rem 0; }
.wf-table {
  width: 100%; border-collapse: collapse; font-size: 0.875rem;
}
.wf-table th {
  text-align: left; padding: 0.625rem 0.75rem; font-weight: 600; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary, #86868b);
  border-bottom: 2px solid var(--color-border, #e5e7eb);
}
.wf-table td {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border-light, #f0f0f0);
  vertical-align: middle;
}
.wf-table-sm td, .wf-table-sm th { padding: 0.375rem 0.5rem; font-size: 0.8125rem; }
.wf-table-hover tbody tr:hover { background: rgba(0,113,227,0.04); }
.wf-clickable { cursor: pointer; }
.wf-mono { font-family: var(--font-mono, 'SF Mono', monospace); font-size: 0.8125rem; }

.wf-badge {
  display: inline-block; padding: 0.15em 0.5em; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.4;
}
.wf-badge-sm { font-size: 0.6875rem; padding: 0.1em 0.4em; }
.wf-badge-green { background: rgba(52,199,89,0.15); color: #1a8a3a; }
.wf-badge-red { background: rgba(255,59,48,0.15); color: #d62d20; }
.wf-badge-amber { background: rgba(255,159,10,0.15); color: #b86e00; }
.wf-badge-gray { background: rgba(142,142,147,0.15); color: #636366; }
.wf-badge-outline { background: transparent; border: 1px solid var(--color-border, #e5e7eb); color: var(--color-text-secondary, #86868b); }

.wf-version { font-size: 0.6875rem; color: var(--color-text-tertiary, #aeaeb2); margin-left: 0.25rem; }

.wf-agreement { font-weight: 600; padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.8125rem; }
.wf-agreement-good { color: #1a8a3a; background: rgba(52,199,89,0.12); }
.wf-agreement-fair { color: #b86e00; background: rgba(255,159,10,0.12); }
.wf-agreement-poor { color: #d62d20; background: rgba(255,59,48,0.12); }

/* Daily-hours matrix (last 10 workdays on /workforce) */
.wf-daily-matrix td.numeric, .wf-daily-matrix th.numeric {
  font-variant-numeric: tabular-nums; text-align: right;
}
.wf-daily-matrix .wf-low-agreement { background: rgba(255, 215, 0, 0.12); }
.wf-daily-matrix .wf-anomaly-glyph {
  margin-left: 0.25em; color: #b86e00; font-size: 0.875em; cursor: help;
}
.wf-section-subtitle {
  font-size: 0.8125rem; color: var(--color-text-secondary, #86868b);
  margin: 0.25rem 0 0.75rem; line-height: 1.4;
}
.wf-section-subtitle code {
  font-family: var(--font-mono, 'SF Mono', monospace); font-size: 0.95em;
  background: var(--color-surface-alt, #f5f5f7); padding: 0.05em 0.3em; border-radius: 3px;
}

/* Payroll view: right-align numeric columns; per-employee daily blocks */
.wf-table td.numeric, .wf-table th.numeric {
  font-variant-numeric: tabular-nums; text-align: right;
}
.wf-employee-daily { margin-top: 1rem; }
.wf-employee-daily h4 { margin: 0 0 0.4rem; font-size: 0.9375rem; }
.wf-employee-daily h4 a { color: inherit; text-decoration: none; }
.wf-employee-daily h4 a:hover { text-decoration: underline; }
.wf-table tr.wf-day-empty td { color: var(--color-text-secondary, #86868b); }

.wf-chart-container { position: relative; height: 260px; margin: 1rem 0; }

.wf-comparison-stats {
  display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--color-border-light, #f0f0f0);
}
.wf-stat { text-align: center; }
.wf-stat-value { display: block; font-size: 1.25rem; font-weight: 700; color: var(--color-text, #1d1d1f); }
.wf-stat-label { display: block; font-size: 0.75rem; color: var(--color-text-secondary, #86868b); }

.wf-readiness-panel {
  background: var(--color-surface, #fff); border: 1px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-md, 10px); padding: 1.5rem;
}
.wf-readiness-gauge { margin-bottom: 1.25rem; }
.wf-gauge-track {
  height: 8px; background: var(--color-border-light, #f0f0f0); border-radius: 4px;
  overflow: hidden;
}
.wf-gauge-fill { height: 100%; background: linear-gradient(90deg, #0071e3, #34c759); border-radius: 4px; transition: width 0.6s ease; }
.wf-gauge-label { text-align: center; margin-top: 0.5rem; font-size: 0.8125rem; color: var(--color-text-secondary, #86868b); }

.wf-readiness-checks { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.wf-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; padding: 0.4rem 0; }
.wf-check-pass { color: #1a8a3a; }
.wf-check-fail { color: #d62d20; }

.wf-readiness-verdict {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
  border-radius: 8px; font-weight: 600; font-size: 0.9375rem;
}
.wf-verdict-ready { background: rgba(52,199,89,0.1); color: #1a8a3a; }
.wf-verdict-not-ready { background: rgba(255,159,10,0.1); color: #b86e00; }

.wf-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.wf-two-col h4 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary, #86868b); margin-bottom: 0.75rem; }
.wf-app-list { display: flex; flex-direction: column; gap: 0.25rem; }
.wf-app-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.375rem 0.5rem; border-radius: 6px; font-size: 0.8125rem;
}
.wf-app-item:hover { background: rgba(0,113,227,0.04); }
.wf-app-name { font-weight: 500; color: var(--color-text, #1d1d1f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.wf-url { font-family: var(--font-mono, monospace); font-size: 0.75rem; }
.wf-app-days { font-size: 0.75rem; color: var(--color-text-secondary, #86868b); white-space: nowrap; }

@media (max-width: 768px) {
  .wf-kpi-row { gap: 0.5rem; }
  .wf-kpi-card { flex: 1 1 100px; padding: 0.75rem; }
  .wf-kpi-value { font-size: 1.25rem; }
  .wf-two-col { grid-template-columns: 1fr; }
  .wf-comparison-stats { gap: 1rem; }
}

/* ── System Health Dashboard ──────────────────────────────────────────── */

.sh-banner { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; border-radius: 12px; margin-bottom: 1.5rem; }
.sh-banner-healthy { background: linear-gradient(135deg, #dcfce7, #f0fdf4); border: 1px solid #86efac; color: #15803d; }
.sh-banner-degraded { background: linear-gradient(135deg, #fef3c7, #fffbeb); border: 1px solid #fcd34d; color: #a16207; }
.sh-banner-critical { background: linear-gradient(135deg, #fee2e2, #fef2f2); border: 1px solid #fca5a5; color: #b91c1c; }
.sh-banner-text h2 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.sh-banner-text p { margin: 0; font-size: 0.875rem; opacity: 0.85; }
.sh-banner-time { margin-left: auto; font-size: 0.75rem; opacity: 0.7; white-space: nowrap; }

.sh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.sh-card { background: var(--color-card-bg, #fff); border: 1px solid var(--color-border, #e5e5e5); border-radius: 10px; padding: 1.25rem; text-align: center; }
.sh-card-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary, #86868b); margin-bottom: 0.5rem; }
.sh-card-value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--color-text-primary, #1d1d1f); }
.sh-card-sub { font-size: 0.75rem; color: var(--color-text-secondary, #86868b); margin-top: 0.25rem; }

.sh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.5rem; align-items: start; }
.sh-section { background: var(--color-card-bg, #fff); border: 1px solid var(--color-border, #e5e5e5); border-radius: 10px; padding: 1.25rem; overflow-x: auto; }
/* Wide drill-down sections (multi-column tables) span the full grid width so their
   columns aren't clipped/squeezed inside a single narrow auto-fit track. */
.sh-section.sh-section-wide { grid-column: 1 / -1; }
.sh-section h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 600; margin: 0 0 1rem; color: var(--color-text-primary, #1d1d1f); }

.sh-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.sh-table th { text-align: left; font-weight: 600; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--color-border, #e5e5e5); color: var(--color-text-secondary, #86868b); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.sh-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border-light, #f2f2f2); }
.sh-table code { font-size: 0.8rem; background: var(--color-inline-code-bg, #f5f5f5); padding: 0.15em 0.4em; border-radius: 4px; }

.sh-empty { color: var(--color-text-secondary, #86868b); font-style: italic; font-size: 0.875rem; }

.sh-status-pill { display: inline-block; padding: 0.15em 0.6em; border-radius: 99px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.sh-status-stale { background: #fef3c7; color: #a16207; }
.sh-status-failed { background: #fee2e2; color: #b91c1c; }
.sh-status-never-run { background: #f3f4f6; color: #6b7280; }
.sh-status-pending { background: #dbeafe; color: #1d4ed8; }
.sh-status-resolved, .sh-status-fixed, .sh-status-healthy { background: #dcfce7; color: #15803d; }
/* .sh-status-healthy is built by a template literal in app/dev-architecture (healPill,
   countPill) and app/system-health, so it never appeared in a grep for the class name
   and was missed when the management-bus states below were styled. Every "good" pill
   rendered as a colourless outline — including all 18 zero-direct provider pills, whose
   entire job is to read green. */
/* Management-bus + auto-fix states (were emitted unstyled — colorless pills) */
.sh-status-detected { background: #dbeafe; color: #1d4ed8; }
.sh-status-escalated { background: #fef3c7; color: #a16207; }
.sh-status-critical { background: #b91c1c; color: #fff; }
.sh-status-waiting-human { background: #ede9fe; color: #6d28d9; }
.sh-status-queued { background: #dbeafe; color: #1d4ed8; }
.sh-status-awaiting-verification { background: #fef3c7; color: #a16207; }
.sh-status-verify-failed { background: #fee2e2; color: #b91c1c; }

.sh-fix-list { display: flex; flex-direction: column; gap: 0.5rem; }
.sh-fix-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--color-row-bg, #fafafa); font-size: 0.8rem; }
.sh-fix-skill { font-weight: 600; min-width: 100px; }
.sh-fix-desc { flex: 1; color: var(--color-text-secondary, #86868b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-fix-status { font-size: 0.7rem; text-transform: uppercase; font-weight: 600; }

.sh-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem; }
.sh-metric { text-align: center; padding: 0.75rem; background: var(--color-row-bg, #fafafa); border-radius: 8px; }
.sh-metric-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary, #86868b); margin-bottom: 0.25rem; overflow-wrap: anywhere; }
.sh-metric-value { font-size: 1.25rem; font-weight: 700; color: var(--color-text-primary, #1d1d1f); }

@media (max-width: 768px) {
  .sh-cards { grid-template-columns: repeat(2, 1fr); }
  .sh-grid { grid-template-columns: 1fr; }
  .sh-banner { flex-wrap: wrap; }
  .sh-banner-time { width: 100%; margin-left: 0; text-align: right; }
}

/* ── Skill Description ────────────────────────────────────────────── */
.skill-description {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem;
  margin: -0.5rem 0 1.5rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary, #86868b);
  background: var(--color-row-bg, #fafafa);
  border-radius: 10px;
  border: 1px solid var(--color-border-light, #f2f2f2);
}
.skill-description-role { font-weight: 600; color: var(--color-text-primary, #1d1d1f); }
.skill-description-sep { color: var(--color-border, #e5e5e5); margin: 0 0.15rem; }
.skill-description a { color: var(--color-link, #007aff); text-decoration: none; }
.skill-description a:hover { text-decoration: underline; }
.skill-description-prose {
  font-size: 0.875rem;
  line-height: var(--leading-snug, 1.4);
  color: var(--color-text-secondary, #86868b);
  max-width: 72ch;
  margin: -0.5rem 0 1.5rem;
  padding: 0 1.25rem;
}

/* ── Grade Trend Chart ────────────────────────────────────────────── */
.grade-trend-chart {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-light, #f2f2f2);
}
.grade-trend-chart .chart-canvas-wrap { height: 220px; }
.subsection-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary, #1d1d1f);
  margin: 0 0 0.75rem;
}

/* ── Direct Reports Grid ──────────────────────────────────────────── */
.direct-reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.direct-report-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  background: var(--color-card-bg, #fff);
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.direct-report-card:hover {
  border-color: var(--color-link, #007aff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.direct-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.direct-report-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary, #1d1d1f);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direct-report-score { line-height: 1; }
.direct-report-score-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary, #1d1d1f);
}
.direct-report-score-unit {
  font-size: 0.75rem;
  color: var(--color-text-secondary, #86868b);
  margin-left: 1px;
}
.direct-report-weak {
  font-size: 0.7rem;
  color: var(--color-text-secondary, #86868b);
  background: #fef3c7;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}
.direct-report-sparkline { margin-top: auto; }

@media (max-width: 768px) {
  .direct-reports-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-description { font-size: 0.8rem; padding: 0.5rem 1rem; }
}

/* ── Video Brainstorming Styles ─────────────────────────────────────── */

/* Status & score utility classes */
.bs-status-badge { padding: 0.2em 0.6em; border-radius: 6px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.bs-status-completed { background: #d1fae5; color: #065f46; }
.bs-status-failed { background: #fee2e2; color: #991b1b; }
.bs-status-progress { background: #dbeafe; color: #1e40af; }

.bs-score-high { color: #059669; font-weight: 600; }
.bs-score-mid { color: #d97706; font-weight: 600; }
.bs-score-low { color: #dc2626; font-weight: 600; }

/* ── List page: session cards ── */
.bs-session-card-link { text-decoration: none; color: inherit; display: block; margin-bottom: 1rem; }
.bs-session-card-link:hover .bs-session-card { border-color: var(--color-primary, #0071e3); box-shadow: 0 2px 12px rgba(0,113,227,0.1); }

.bs-session-card {
  border: 1px solid var(--color-border, #d2d2d7);
  border-radius: 12px;
  padding: 1.25rem;
  background: var(--color-surface, #fff);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bs-session-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap; }
.bs-session-card-topic { font-size: 1.1rem; font-weight: 600; color: var(--color-text-primary, #1d1d1f); }
.bs-session-card-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.bs-session-card-stats { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.bs-stat { text-align: center; }
.bs-stat-value { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.bs-stat-label { font-size: 0.7rem; color: var(--color-text-secondary, #86868b); text-transform: uppercase; letter-spacing: 0.03em; }

.bs-slot-score-bar { display: flex; gap: 0.4rem; }
.bs-slot-pip {
  flex: 1;
  text-align: center;
  padding: 0.4rem 0.25rem;
  border-radius: 6px;
  background: #f5f5f7;
  border: 1px solid transparent;
}
.bs-slot-pip.bs-score-high { background: #d1fae5; border-color: #a7f3d0; }
.bs-slot-pip.bs-score-mid { background: #fef3c7; border-color: #fde68a; }
.bs-slot-pip.bs-score-low { background: #fee2e2; border-color: #fca5a5; }
.bs-pip-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary, #86868b); }
.bs-pip-score { font-size: 1rem; font-weight: 700; }

/* ── Detail page: summary cards ── */
.bs-session-summary { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }

/* ── Sections ── */
.bs-section { margin-bottom: 2.5rem; }
.bs-section h3 { font-size: 1.1rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.bs-converged-badge { background: #d1fae5; color: #065f46; padding: 0.15em 0.5em; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.bs-converge-reason { font-size: 0.75rem; font-weight: 400; }

/* ── Chart container ── */
.bs-chart-container { position: relative; height: 280px; max-width: 800px; }

/* ── Progression table ── */
.bs-progression-table td, .bs-progression-table th { padding: 0.5rem 0.75rem; }
.bs-progression-table .text-center { text-align: center; }

/* ── Iteration slot table ── */
.bs-slot-table .bs-slot-name { font-weight: 600; white-space: nowrap; }
.bs-slot-table .bs-reasoning { font-size: 0.85rem; color: var(--color-text-secondary, #86868b); line-height: 1.4; }

.bs-fix-badge { padding: 0.2em 0.6em; border-radius: 4px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.bs-fix-rewrite { background: #ede9fe; color: #5b21b6; }
.bs-fix-swap { background: #fef3c7; color: #92400e; }

/* ── Fix detail cards (before/after) ── */
.bs-fix-details { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }
.bs-fix-detail-card {
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: #fafafa;
}
.bs-fix-detail-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.bs-fix-diff { font-size: 0.85rem; line-height: 1.5; }
.bs-diff-label { font-weight: 600; font-size: 0.75rem; text-transform: uppercase; color: var(--color-text-secondary, #86868b); margin-right: 0.25rem; }
.bs-fix-old { color: #991b1b; background: #fef2f2; padding: 0.3rem 0.5rem; border-radius: 4px; margin-bottom: 0.3rem; }
.bs-fix-new { color: #065f46; background: #ecfdf5; padding: 0.3rem 0.5rem; border-radius: 4px; }

/* ── Final slot assignment cards ── */
.bs-final-card {
  border: 1px solid var(--color-border, #d2d2d7);
  border-radius: 12px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--color-surface, #fff);
}
.bs-final-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: #f5f5f7;
  border-bottom: 1px solid var(--color-border, #e5e5e5);
}
.bs-final-slot-name { font-weight: 700; font-size: 1rem; }
.bs-final-slot-score { font-size: 0.95rem; }
.bs-final-constraints { margin-left: auto; display: flex; gap: 0.3rem; }

.bs-tag { background: #e5e5ea; color: var(--color-text-secondary, #6e6e73); padding: 0.15em 0.5em; border-radius: 4px; font-size: 0.7rem; }
.bs-tag-sm { background: #e5e5ea; color: var(--color-text-secondary, #6e6e73); padding: 0.1em 0.4em; border-radius: 3px; font-size: 0.65rem; display: inline-block; margin-right: 0.25rem; margin-bottom: 0.15rem; }

.bs-final-card-body { padding: 1rem 1.25rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.bs-final-section-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-secondary, #86868b); font-weight: 600; margin-bottom: 0.4rem; }

.bs-final-narration blockquote {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--color-primary, #0071e3);
  font-style: italic;
  color: var(--color-text-secondary, #6e6e73);
  font-size: 0.9rem;
  line-height: 1.5;
}

.bs-clip-info { font-size: 0.85rem; line-height: 1.5; }
.bs-clip-title { font-weight: 600; margin-bottom: 0.25rem; }
.bs-clip-source { color: var(--color-text-secondary, #86868b); font-size: 0.8rem; margin-bottom: 0.5rem; }
.bs-clip-visual { margin-bottom: 0.5rem; line-height: 1.4; }
.bs-clip-transcript { font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: 0.4rem; font-style: italic; }
.bs-clip-topics { margin-top: 0.4rem; }
.bs-clip-similarity { font-size: 0.8rem; color: var(--color-text-secondary); margin-top: 0.4rem; }

.bs-iteration-section { border-top: 1px solid var(--color-border, #e5e5e5); padding-top: 1.5rem; }

.bs-error-card { border-color: #fca5a5; background: #fef2f2; }
.bs-error-card .metric-label { color: #991b1b; }

@media (max-width: 768px) {
  .bs-final-card-body { grid-template-columns: 1fr; }
  .bs-session-card-stats { flex-wrap: wrap; }
  .bs-slot-score-bar { flex-wrap: wrap; }
}

/* ── Paid Ads Control: review cards + ad-preview mockups ─────────────────
   Ported from the Express view's inline <style> (views/paid-ads-control.ejs
   L839-916) — the EJS carried these itself, so the Phase-6 port of the page
   markup left them behind; first live proposal (#870, 2026-07-18) surfaced
   the gap. Class names match app/skill/paid-ads/ads/page.tsx and
   components/PadsReviewActions.tsx verbatim. */
.pads-review-list { display: flex; flex-direction: column; gap: 1.25rem; }
.pads-review-card { border-left: 4px solid var(--accent-primary, #3b82f6); padding: 1.25rem; }
.pads-review-card-header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.pads-staging-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.pads-staging-live { background: #d1fae5; color: #065f46; }
.pads-staging-failed { background: #fef3c7; color: #92400e; }
.pads-staging-manual { background: #e5e7eb; color: #374151; }
.pads-dashboard-link { display: inline-flex; align-items: center; gap: 3px; font-size: 0.8rem; font-weight: 600; color: #2563eb; text-decoration: none; padding: 2px 8px; border-radius: 10px; background: #eff6ff; }
.pads-dashboard-link:hover { background: #dbeafe; text-decoration: underline; }
.pads-review-card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.pads-review-card-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; color: var(--text-muted, #6b7280); margin-bottom: 0.75rem; }
.pads-review-actions { display: flex; gap: 0.75rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-light, #e5e7eb); }
.pads-btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.25rem; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s, transform 0.1s; background: var(--bg-secondary, #f3f4f6); color: var(--text-primary, #1f2937); }
.pads-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.pads-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.pads-btn-approve { background: #059669; color: #fff; }
.pads-btn-reject { background: #dc2626; color: #fff; }
.pads-reject-reason { margin-top: 0.75rem; padding: 0.75rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; }
.pads-reject-reason__label { display: block; font-size: 0.85rem; font-weight: 600; color: #991b1b; margin-bottom: 0.4rem; }
.pads-reject-reason__input { width: 100%; padding: 0.5rem; border: 1px solid #fca5a5; border-radius: 4px; font-size: 0.85rem; resize: vertical; font-family: inherit; background: #fff; }
.pads-reject-reason__input:focus { outline: none; border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220,38,38,0.15); }
.pads-reject-reason__actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.pads-queuing-list { display: flex; flex-direction: column; gap: 0.5rem; }
.pads-queuing-card { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; }
.pads-keywords-detail { margin: 0.5rem 0; }
.pads-keywords-detail summary { cursor: pointer; font-size: 0.85rem; color: var(--text-muted, #6b7280); }
.pads-error-pre { font-size: 0.75rem; background: var(--bg-secondary, #f9fafb); border: 1px solid var(--border-light, #e5e7eb); border-radius: 4px; padding: 0.5rem; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow-y: auto; }

/* Ad Preview Mockups */
.pads-ad-preview { margin: 0.75rem 0; border: 1px solid var(--border-light, #e5e7eb); border-radius: 8px; overflow: hidden; max-width: 480px; }
.pads-ad-preview__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted, #6b7280); background: var(--bg-secondary, #f9fafb); padding: 6px 12px; border-bottom: 1px solid var(--border-light, #e5e7eb); }

/* Search ad (Google / Bing) */
.pads-search-ad { padding: 12px 14px; background: #fff; font-family: Arial, sans-serif; }
.pads-search-ad__sponsor { font-size: 11px; font-weight: 700; color: #202124; margin-bottom: 1px; }
.pads-search-ad__sponsor::before { content: "Ad"; display: inline-block; font-size: 10px; font-weight: 700; color: #202124; border: 1px solid #202124; border-radius: 3px; padding: 0 3px; margin-right: 6px; vertical-align: middle; }
.pads-search-ad__url { font-size: 12px; color: #202124; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pads-search-ad__headline { font-size: 18px; line-height: 1.3; color: #1a0dab; font-weight: 400; margin-bottom: 4px; white-space: normal; overflow: visible; }
.pads-search-ad__desc { font-size: 13px; color: #4d5156; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Social ad (Meta / LinkedIn / Reddit) */
.pads-social-ad { background: #fff; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.pads-social-ad__header { padding: 10px 12px 6px; font-size: 13px; color: #1c1e21; }
.pads-social-ad__sponsored { font-size: 11px; color: #65676b; margin-left: 4px; }
.pads-social-ad__text { padding: 0 12px 8px; font-size: 14px; color: #1c1e21; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pads-social-ad__image { display: block; width: 100%; aspect-ratio: 1.91/1; object-fit: cover; background: #f0f2f5; }
.pads-social-ad__noimage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; aspect-ratio: 1.91/1; background: #f0f2f5; color: #9ca3af; font-size: 13px; }
.pads-social-ad__cta-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #f0f2f5; }
.pads-social-ad__cta-domain { font-size: 11px; color: #65676b; text-transform: uppercase; }
.pads-social-ad__cta-headline { font-size: 14px; font-weight: 600; color: #1c1e21; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.pads-social-ad__cta-desc { font-size: 12px; color: #65676b; margin-top: 2px; max-width: 280px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pads-social-ad__cta-btn { display: inline-block; padding: 5px 14px; background: #e4e6eb; color: #050505; font-size: 13px; font-weight: 600; border-radius: 5px; white-space: nowrap; flex-shrink: 0; }

/* ── How It Works (skill page) ───────────────────────────────────── */
.how-it-works-meta { font-size: 0.8rem; color: var(--color-text-secondary, #86868b); margin: 0 0 0.5rem; }
.how-it-works-summary { font-size: 0.9rem; line-height: 1.5; max-width: 80ch; margin: 0 0 0.75rem; }
.how-it-works-part { border: 1px solid var(--color-border-light, #f2f2f2); border-radius: 10px; padding: 0.5rem 1rem; margin-bottom: 0.5rem; background: var(--color-row-bg, #fafafa); }
.how-it-works-part > summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.how-it-works-steps, .how-it-works-sections { margin: 0.5rem 0 0.25rem; padding-left: 1.4rem; font-size: 0.875rem; line-height: 1.5; max-width: 90ch; }
.how-it-works-steps li, .how-it-works-sections li { margin-bottom: 0.4rem; }
.how-it-works-when { color: var(--color-text-secondary, #86868b); font-style: italic; }
.how-it-works-script { margin-left: 0.4rem; font-size: 0.75rem; color: var(--color-text-secondary, #86868b); }
