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

:root {
  /* ── Brand (from logo: blue→teal gradient) ── */
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #3B82F6;
  --primary-soft: #EFF6FF;
  --primary-glow: rgba(37, 99, 235, 0.08);
  --primary-glow-md: rgba(37, 99, 235, 0.14);
  --primary-glow-strong: rgba(37, 99, 235, 0.22);
  --accent: #06B6D4;
  --accent-soft: #ECFEFF;
  --gradient-brand: linear-gradient(135deg, #1E3A8A 0%, #2563EB 40%, #06B6D4 100%);
  --gradient-btn: linear-gradient(135deg, #2563EB 0%, #0EA5E9 100%);

  /* ── Light Backgrounds ── */
  --bg-root: #F8FAFC;
  --bg-primary: #FFFFFF;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-elevated: #F8FAFC;
  --bg-hover: #EFF6FF;
  --bg-card: #FFFFFF;
  --bg-subtle: #F8FAFC;

  /* ── Borders ── */
  --border-subtle: #E8ECF1;
  --border-default: #E2E8F0;
  --border-hover: #CBD5E1;
  --border-active: #94A3B8;

  /* ── Text hierarchy ── */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-quaternary: #CBD5E1;

  /* ── Semantic ── */
  --success: #16A34A;
  --success-bg: #F0FDF4;
  --success-border: #BBF7D0;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --error-border: #FECACA;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  --info: #2563EB;
  --info-bg: #EFF6FF;

  /* ── Layout ── */
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 56px;
  --header-h: 48px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-md: var(--radius);

  /* ── Motion ── */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.2s;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.02);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.08);

  /* Legacy compat */
  --bg: var(--bg-root);
  --surface: var(--bg-secondary);
  --surface-hover: var(--bg-tertiary);
  --border: var(--border-default);
  --text: var(--text-primary);
  --text-muted: var(--text-secondary);

  /* ── Spacing scale (4px grid) ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
}

/* ════════════════════════════════════════════════════════
   TYPOGRAPHY HIERARCHY
   ════════════════════════════════════════════════════════ */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

h1, .h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

h2, .h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

h3, .h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.caption {
  font-size: 12px;
  font-weight: 500;
}

.micro {
  font-size: 11px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════
   AUTH PAGES (centered)
   ════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  min-height: 100vh;
}

.page { display: none; }
.page.active { display: block; }

#page-login, #page-register, #page-confirm, #page-create-password, #page-verify-whatsapp {
  display: none;
  max-width: 400px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}
#page-login.active, #page-register.active, #page-confirm.active, #page-create-password.active, #page-verify-whatsapp.active {
  display: block;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
}

.logo-img {
  max-width: 280px;
  max-height: 120px;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  image-rendering: auto;
}

.logo-subtitle {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  letter-spacing: 0.2px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.card .subtitle {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-bottom: 24px;
}

/* ════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 14px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--duration) var(--ease);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--text-tertiary);
}

.form-row {
  display: flex;
  gap: 12px;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--gradient-btn);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.loading { pointer-events: none; opacity: 0.6; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Icon button (reusable) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  color: #475569;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}
.btn-icon:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-accent {
  background: var(--primary);
  color: #fff;
}
.btn-accent:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

/* ════════════════════════════════════════════════════════
   MESSAGES
   ════════════════════════════════════════════════════════ */

.message {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  display: none;
}
.message.success {
  display: block;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}
.message.error {
  display: block;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
}
.message.info {
  display: block;
  background: var(--info-bg);
  border: 1px solid rgba(37,99,235,0.16);
  color: var(--info);
}

.link-row {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.link-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.link-row a:hover { text-decoration: underline; }

.wa-code-input {
  text-transform: uppercase;
  letter-spacing: 6px;
  font-size: 20px;
  text-align: center;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════
   APP SHELL -- SIDEBAR LAYOUT
   ════════════════════════════════════════════════════════ */

#page-app {
  display: none;
}
#page-app.active {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #FFFFFF;
  border-right: 1px solid var(--border-default);
  box-shadow: 1px 0 8px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 150;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s var(--ease), min-width 0.25s var(--ease);
}

/* ── Collapsed sidebar ── */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  min-width: var(--sidebar-w-collapsed);
}
.sidebar.collapsed .sidebar-brand-logo { max-width: 32px; max-height: 32px; }
.sidebar.collapsed .sidebar-label { display: none; }
.sidebar.collapsed .nav-tab span,
.sidebar.collapsed .nav-tab .alerts-badge { display: none; }
.sidebar.collapsed .nav-tab { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-tab svg { width: 18px; height: 18px; }
.sidebar.collapsed .nav-tab.active::before { display: none; }
.sidebar.collapsed .sidebar-cta { font-size: 0; padding: 10px; }
.sidebar.collapsed .sidebar-cta::before { content: '+'; font-size: 16px; font-weight: 700; }
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-user .btn-logout { display: none; }
.sidebar.collapsed .sidebar-divider { margin: 6px 8px; }
.sidebar.collapsed .sidebar-brand { padding: 12px 8px; }
.sidebar.collapsed .sidebar-nav { padding: 0 6px; }

/* ── Collapse toggle ── */
.sidebar-collapse-btn {
  display: none;
  position: absolute;
  top: 12px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 160;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #334155;
  transition: all var(--duration);
}
.sidebar-collapse-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
@media (min-width: 901px) {
  .sidebar-collapse-btn { display: flex; }
}
.sidebar.collapsed .sidebar-collapse-btn { right: -12px; }

.sidebar-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.sidebar-brand-logo {
  max-width: 160px;
  max-height: 48px;
  width: 100%;
  height: auto;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  display: block;
  transition: max-width 0.25s var(--ease), max-height 0.25s var(--ease);
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: none;
}
.sidebar-brand-text span { color: var(--primary); }
.sidebar-brand-sub {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
  flex: 1;
}

.sidebar-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  padding: 12px 10px 4px;
  transition: opacity 0.2s;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  position: relative;
}
.nav-tab span { transition: opacity 0.2s; }
.nav-tab svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: all var(--duration);
}
.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.nav-tab:hover svg { opacity: 0.7; }
.nav-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.nav-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 16px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.nav-tab.active svg {
  opacity: 1;
  stroke: var(--primary);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 12px;
}

.sidebar-cta {
  margin: 6px 8px;
  text-align: center;
  width: calc(100% - 16px);
  font-size: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--gradient-btn);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.sidebar-cta:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}
.sidebar-cta:active {
  transform: translateY(0);
}

.sidebar-user {
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  font-size: 9px;
  color: var(--text-tertiary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 140;
}

/* ── Main content area ── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-root);
  transition: margin-left 0.25s var(--ease);
}
.sidebar.collapsed ~ .sidebar-overlay ~ .app-main,
.sidebar.collapsed ~ .app-main {
  margin-left: var(--sidebar-w-collapsed);
}

/* ── Content shell (centered container) ── */
.content-shell {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  flex: 1;
}

/* ── Top bar ── */
.app-topbar {
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-default);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--duration);
}
.sidebar-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  margin-left: auto;
}

.btn-logout {
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  color: #475569;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all var(--duration);
}
.btn-logout:hover { border-color: var(--error-border); color: var(--error); background: var(--error-bg); }

.project-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.project-selector label {
  font-weight: 500;
}

.project-selector select {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--duration);
}
.project-selector select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Page header ── */
.page-header {
  margin-bottom: 16px;
}
.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}
.page-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════
   TAB CONTENT
   ════════════════════════════════════════════════════════ */

.tab-content {
  display: none;
  padding: 20px 0 32px;
  width: 100%;
  animation: pageIn 0.2s var(--ease);
}
.tab-content.active { display: block; }

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

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.tab-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════
   DASHBOARD -- MAIN INSIGHT BANNER
   ════════════════════════════════════════════════════════ */

.main-insight-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.04) 0%, rgba(37,99,235,0.01) 100%);
}
.main-insight-card.type-negative {
  background: linear-gradient(135deg, rgba(220,38,38,0.06) 0%, rgba(220,38,38,0.02) 100%);
  border-color: var(--error-border);
}
.main-insight-card.type-positive {
  background: linear-gradient(135deg, rgba(22,163,74,0.06) 0%, rgba(22,163,74,0.02) 100%);
  border-color: var(--success-border);
}
.main-insight-card.type-warning {
  background: linear-gradient(135deg, rgba(217,119,6,0.06) 0%, rgba(217,119,6,0.02) 100%);
  border-color: var(--warning-border);
}
.main-insight-card.type-neutral {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
}

.main-insight-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}

.main-insight-text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════
   INSIGHT BANNER (new component)
   ════════════════════════════════════════════════════════ */

.insight-banner {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.02) 100%);
  border: 1px solid rgba(37,99,235,0.15);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}
.insight-banner--warning {
  background: linear-gradient(135deg, rgba(217,119,6,0.06) 0%, rgba(217,119,6,0.02) 100%);
  border-color: var(--warning-border);
}
.insight-banner--negative {
  background: linear-gradient(135deg, rgba(220,38,38,0.06) 0%, rgba(220,38,38,0.02) 100%);
  border-color: var(--error-border);
}
.insight-banner--positive {
  background: linear-gradient(135deg, rgba(22,163,74,0.06) 0%, rgba(22,163,74,0.02) 100%);
  border-color: var(--success-border);
}
.insight-banner--neutral {
  background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.02) 100%);
  border-color: rgba(37,99,235,0.15);
}

.insight-banner__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(0,0,0,0.06);
  color: var(--text-primary);
}
.insight-banner--warning .insight-banner__icon {
  background: var(--warning-bg);
  color: var(--warning);
}
.insight-banner--negative .insight-banner__icon {
  background: var(--error-bg);
  color: var(--error);
}
.insight-banner--positive .insight-banner__icon {
  background: var(--success-bg);
  color: var(--success);
}

.insight-banner__content {
  flex: 1;
  min-width: 0;
}

.insight-banner__text {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════
   DASHBOARD -- KPI CARDS (stat-card + metric-card)
   ════════════════════════════════════════════════════════ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card.accent {
  border-color: rgba(37, 99, 235, 0.2);
  background: linear-gradient(135deg, rgba(37,99,235,0.03) 0%, #FFFFFF 100%);
}

.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text-primary);
}
.stat-card.accent .value { color: var(--primary); }

.stat-card .sublabel,
.stat-card .explanation {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.4;
}

/* Theme cards in analytics — need smaller value to fit in 4-col grid */
.stat-card.theme-card .value {
  font-size: 20px;
  margin-bottom: 2px;
}
.stat-card.theme-card {
  padding: 14px 16px;
}

.stat-card .delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
}
.delta.positive { color: var(--success); background: var(--success-bg); }
.delta.negative { color: var(--error); background: var(--error-bg); }

.stat-explanation {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
  min-height: 20px;
}

/* ── MetricCard (new component, stat-card redesign) ── */
.metric-card {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
}
.metric-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric-card__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.metric-card__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text-primary);
}

.metric-card__explanation {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.4;
}

.metric-card__delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
}
.metric-card__delta.positive { color: var(--success); background: var(--success-bg); }
.metric-card__delta.negative { color: var(--error); background: var(--error-bg); }

/* ════════════════════════════════════════════════════════
   EVOLUTION SECTION
   ════════════════════════════════════════════════════════ */

.evolution-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.evolution-item {
  flex: 1;
  min-width: 140px;
}

.evolution-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.evolution-values {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.evolution-prev { color: var(--text-tertiary); }
.evolution-arrow { color: var(--text-tertiary); font-size: 12px; }
.evolution-curr { color: var(--text-primary); }
.evolution-delta {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.evolution-delta.positive { color: var(--success); background: var(--success-bg); }
.evolution-delta.negative { color: var(--error); background: var(--error-bg); }

/* ════════════════════════════════════════════════════════
   RECOMMENDATION CARD
   ════════════════════════════════════════════════════════ */

.recommendation-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-soft);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.recommendation-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.recommendation-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   SECTIONS & PANELS
   ════════════════════════════════════════════════════════ */

.section-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.section-half {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color var(--duration);
  box-shadow: var(--shadow-xs);
}
.section-half:hover { border-color: var(--border-hover); }

.section-half h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.list-simple {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.list-simple .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.list-simple .item:last-child { border-bottom: none; }
.list-simple .item .val { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

.empty-inline {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 12px 0;
  line-height: 1.6;
  font-style: italic;
}

/* ── Share of Voice bars ── */
.sov-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 55%;
}
.sov-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s var(--ease);
  min-width: 2px;
}
.sov-bar.engine-bar {
  background: var(--info);
}

/* ── Opportunities ── */
.opp-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.opp-item:last-child { border-bottom: none; }

.opp-query {
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 500;
}

.opp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.opp-comp { color: var(--text-secondary); }
.opp-pos { color: var(--text-tertiary); }

/* ── Gaps Prioritized ── */
.gap-priority-group {
  margin-bottom: 12px;
}
.gap-priority-group:last-child { margin-bottom: 0; }

.gap-priority-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 8px;
}
.gap-priority-label.high { background: var(--error-bg); color: var(--error); }
.gap-priority-label.medium { background: var(--warning-bg); color: var(--warning); }
.gap-priority-label.low { background: rgba(107,114,128,0.08); color: var(--text-secondary); }

.gap-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border-subtle);
  line-height: 1.5;
}

.section-full {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  transition: border-color var(--duration);
  box-shadow: var(--shadow-xs);
  width: 100%;
}
.section-full:hover { border-color: var(--border-hover); }

.section-full h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* ════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 2px solid var(--border-subtle);
  background: var(--bg-tertiary);
}
.data-table th:first-child {
  border-radius: 8px 0 0 0;
}
.data-table th:last-child {
  border-radius: 0 8px 0 0;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  font-size: 12px;
}
.data-table tbody tr {
  transition: background var(--duration);
}
.data-table tbody tr:nth-child(even) {
  background: rgba(241,245,249,0.5);
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table input[type="checkbox"] { accent-color: var(--primary); }

/* ── TableCard (new component) ── */
.table-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
}
.table-card .data-table th:first-child { border-radius: 0; }
.table-card .data-table th:last-child { border-radius: 0; }

/* ════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-approved, .badge-completed, .badge-positive { background: var(--success-bg); color: var(--success); }
.badge-pending, .badge-running, .badge-neutral { background: var(--warning-bg); color: var(--warning); }
.badge-rejected, .badge-failed, .badge-negative { background: var(--error-bg); color: var(--error); }
.badge-open, .badge-unknown, .badge-suggested { background: rgba(107,114,128,0.08); color: var(--text-secondary); }
.badge-accepted, .badge-draft { background: var(--primary-glow); color: var(--primary); }
.badge-high { background: var(--error-bg); color: var(--error); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: rgba(107,114,128,0.08); color: var(--text-secondary); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-configured { background: var(--primary-glow); color: var(--primary); }
.badge-needs_attention { background: var(--warning-bg); color: var(--warning); }

/* ════════════════════════════════════════════════════════
   CARD LIST (Projects, Runs, etc.)
   ════════════════════════════════════════════════════════ */

.card-list { display: flex; flex-direction: column; gap: 8px; }

.card-item {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
}
.card-item:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.card-item.selected { border-color: rgba(37, 99, 235, 0.3); background: var(--primary-soft); }

.card-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-item-header h4 { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; color: var(--text-primary); }

.card-item-meta {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.card-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}

.card-item .actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* ════════════════════════════════════════════════════════
   LOADING / EMPTY STATES
   ════════════════════════════════════════════════════════ */

.loading-indicator {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}
.loading-indicator::before {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-default);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
  font-size: 13px;
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
}
.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

/* ── Filter row ── */
.filter-row {
  margin-bottom: 14px;
}
.filter-row select {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--duration);
}
.filter-row select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ════════════════════════════════════════════════════════
   PAGE HEADER (reusable)
   ════════════════════════════════════════════════════════ */

.pg-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.pg-header__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1.2;
}
.pg-header__desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.pg-header__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   SUMMARY BAR (reusable)
   ════════════════════════════════════════════════════════ */

.summary-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.summary-item {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
  min-width: 0;
}
.summary-item__value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text-primary);
}
.summary-item__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.summary-item--success .summary-item__value { color: var(--success); }
.summary-item--danger .summary-item__value { color: var(--error); }
.summary-item--warning .summary-item__value { color: var(--warning); }
.summary-item--muted .summary-item__value { color: var(--text-secondary); }
.summary-item--accent .summary-item__value { color: var(--primary); }

/* ════════════════════════════════════════════════════════
   FILTERS TOOLBAR (reusable)
   ════════════════════════════════════════════════════════ */

.filters-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filters-toolbar select {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--duration);
  height: 34px;
}
.filters-toolbar select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.filters-toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 34px;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  transition: border-color var(--duration);
}
.filters-toolbar__search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.filters-toolbar__search svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.filters-toolbar__search input {
  border: none;
  background: none;
  outline: none;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  width: 100%;
  padding: 0;
}
.filters-toolbar__search input::placeholder {
  color: var(--text-tertiary);
}

/* ════════════════════════════════════════════════════════
   QUERY ROW CARDS
   ════════════════════════════════════════════════════════ */

.qrow-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: all var(--duration) var(--ease);
}
.qrow:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}
.qrow.qrow--selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.qrow__check {
  flex-shrink: 0;
}
.qrow__check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.qrow__body {
  flex: 1;
  min-width: 0;
}
.qrow__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qrow__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.qrow__badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qrow__priority {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.qrow__priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.qrow__priority-dot--high { background: var(--error); }
.qrow__priority-dot--medium { background: var(--warning); }
.qrow__priority-dot--low { background: var(--border-active); }
.qrow__priority-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.qrow__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--duration);
}
.qrow:hover .qrow__actions,
.qrow__actions:focus-within {
  opacity: 1;
}

.qrow__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  cursor: pointer;
  color: #475569;
  transition: all var(--duration);
  padding: 0;
}
.qrow__action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.qrow__action-btn--approve:hover {
  border-color: var(--success-border);
  color: var(--success);
  background: var(--success-bg);
}
.qrow__action-btn--reject:hover {
  border-color: var(--error-border);
  color: var(--error);
  background: var(--error-bg);
}

/* ════════════════════════════════════════════════════════
   BULK ACTION BAR (reusable)
   ════════════════════════════════════════════════════════ */

.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--text-primary);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 200;
  animation: bulkBarIn 0.2s var(--ease);
}
@keyframes bulkBarIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.bulk-bar__count {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.bulk-bar__count strong {
  font-weight: 700;
}
.bulk-bar__actions {
  display: flex;
  gap: 6px;
}

/* ════════════════════════════════════════════════════════
   FILTER TABS (reusable)
   ════════════════════════════════════════════════════════ */

.filter-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-default);
  overflow-x: auto;
}
.filter-tab {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.filter-tab:hover {
  color: var(--text-primary);
}
.filter-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.filter-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.filter-tab__count--warning { background: var(--warning); color: #fff; }
.filter-tab__count--success { background: var(--success); color: #fff; }
.filter-tab__count--accent { background: var(--accent); color: #fff; }
.filter-tab__count--danger { background: var(--error); color: #fff; }

/* ── Run Schedule Card ── */
.run-schedule-card {
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.run-schedule-card__body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.run-schedule-card__info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.run-schedule-card__info svg { color: var(--accent); flex-shrink: 0; }
.run-schedule-card__info strong { color: var(--text-primary); }
.run-schedule-card__freq {
  display: flex;
  align-items: center;
  gap: 8px;
}
.run-schedule-card__freq label {
  font-size: 12px;
  color: var(--text-secondary);
}
.run-schedule-card__freq select {
  padding: 4px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  background: var(--bg-card);
}

/* ── Run Progress Card ── */
.run-progress-card {
  margin-bottom: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.run-progress-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.run-progress-card__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.run-progress-card__pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.run-progress-card__track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}
.run-progress-card__fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px;
  transition: width 0.5s ease;
}
.run-progress-card__footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.run-progress-card__footer span:last-child { color: var(--text-tertiary); }

/* ── Table Pagination ── */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.table-pagination__btns {
  display: flex;
  gap: 8px;
}

/* ── Form card ── */
.form-card {
  margin-bottom: 20px;
}
.form-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-content {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 900px; }
.modal-sm { max-width: 400px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-footer { margin-top: 16px; text-align: right; }
.btn-close {
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  color: #475569;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--duration);
}
.btn-close:hover { color: var(--error); border-color: var(--error-border); background: var(--error-bg); }

/* ════════════════════════════════════════════════════════
   ANSWER DETAIL MODAL (Premium)
   ════════════════════════════════════════════════════════ */

.answer-modal {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);
  overflow: hidden;
}

.answer-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.answer-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.answer-modal-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.5;
}

.answer-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Score strip ── */
.answer-score-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.answer-score-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
  min-width: 120px;
  flex: 1;
}
.answer-score-card .score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}
.answer-score-card .score-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.answer-score-card .score-value .badge {
  font-size: 11px;
}

/* ── Section blocks ── */
.answer-section {
  margin-bottom: 24px;
}
.answer-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.answer-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

/* ── Answer body card ── */
.answer-body-card {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 20px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 380px;
  overflow-y: auto;
}
.answer-body-card::-webkit-scrollbar { width: 5px; }
.answer-body-card::-webkit-scrollbar-track { background: transparent; }
.answer-body-card::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.answer-highlight-target {
  background: var(--primary-glow-strong);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}
.answer-highlight-competitor {
  background: #fef3c7;
  color: #92400e;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Brands chips ── */
.answer-brands-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Source cards ── */
.answer-source-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.answer-source-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: #FFFFFF;
  transition: border-color var(--duration);
  text-decoration: none;
  color: inherit;
}
.answer-source-card:hover {
  border-color: var(--primary);
}
.answer-source-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-tertiary);
}
.answer-source-info {
  flex: 1;
  min-width: 0;
}
.answer-source-domain {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.answer-source-url {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.answer-source-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.source-own { background: var(--primary-glow); color: var(--primary); border: 1px solid var(--primary-glow-strong); }
.source-competitor { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.source-third { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.source-ugc { background: var(--info-bg); color: var(--info); border: 1px solid rgba(37,99,235,0.18); }

/* ── Parser grid ── */
.answer-parser-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.answer-parser-card {
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #FFFFFF;
}
.answer-parser-card.full-width {
  grid-column: 1 / -1;
}
.answer-parser-card .parser-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.answer-parser-card .parser-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-primary);
}
.answer-parser-card .parser-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.answer-parser-card .parser-chip {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-secondary);
}

/* ── Actions footer ── */
.answer-actions {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.answer-actions .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.answer-actions .btn[disabled]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}
.answer-actions .btn {
  position: relative;
  font-size: 12px;
}

/* ── Separator ── */
.answer-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0 0 24px 0;
}

/* ── Mobile responsive ── */
@media (max-width: 640px) {
  .answer-modal { max-width: 100%; border-radius: 12px; max-height: 92vh; }
  .answer-score-strip { flex-direction: column; }
  .answer-parser-grid { grid-template-columns: 1fr; }
  .answer-modal-header { padding: 16px 16px 12px; }
  .answer-modal-body { padding: 16px; }
  .answer-actions { padding: 12px 16px; }
}

/* ── Content preview ── */
.content-preview {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 20px 24px;
  max-height: 60vh;
  overflow-y: auto;
}
.content-preview h1, .content-preview h2, .content-preview h3 {
  color: var(--text-primary);
  margin: 16px 0 8px;
}
.content-preview h1 { font-size: 20px; }
.content-preview h2 { font-size: 17px; }
.content-preview h3 { font-size: 15px; text-transform: none; letter-spacing: 0; border-bottom: none; padding-bottom: 0; }
.content-preview p { margin-bottom: 12px; }
.content-preview ul, .content-preview ol { padding-left: 20px; margin-bottom: 12px; }
.content-preview li { margin-bottom: 4px; }

/* ════════════════════════════════════════════════════════
   RUN CARDS
   ════════════════════════════════════════════════════════ */

.run-card {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
}
.run-card:hover { border-color: var(--border-hover); }
.run-card-info { flex: 1; }
.run-card-info .run-date { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.run-card-info .run-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.run-card-actions { display: flex; gap: 8px; align-items: center; }

/* ════════════════════════════════════════════════════════
   SCORE HISTORY CHART
   ════════════════════════════════════════════════════════ */

.score-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  padding: 8px 0;
}

.score-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.score-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 6px 6px 0 0;
  transition: height 0.3s var(--ease);
  position: relative;
}

.score-bar.up {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
}
.score-bar.down {
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
}
.score-bar.flat {
  background: linear-gradient(180deg, #93C5FD 0%, var(--primary) 100%);
}
.score-bar.latest {
  box-shadow: 0 0 8px var(--primary-glow-md);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.score-bar-label {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  font-weight: 500;
}

.score-bar-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── Dashboard Quick Actions ── */
.dash-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ── ActionCard (new component) ── */
.action-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}
.action-card__header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.action-card__body {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.action-card__primary {
  display: flex;
  gap: 8px;
}
.action-card__secondary {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ════════════════════════════════════════════════════════
   HIGH IMPACT QUERIES
   ════════════════════════════════════════════════════════ */

.hi-query {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 12px;
  transition: border-color var(--duration);
}
.hi-query:hover { border-color: var(--border-hover); }

.hi-query-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.hi-query-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.hi-query-tag.opportunity { background: var(--warning-bg); color: var(--warning); }
.hi-query-tag.winning { background: var(--success-bg); color: var(--success); }
.hi-query-tag.losing { background: var(--error-bg); color: var(--error); }

/* ════════════════════════════════════════════════════════
   ONBOARDING OVERLAY
   ════════════════════════════════════════════════════════ */

.onboarding-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.onboarding-card, .onboarding-box {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.onboarding-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.onboarding-header p {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-bottom: 32px;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.onboarding-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-tertiary);
  transition: color 0.3s var(--ease);
}

.onboarding-step.active { color: var(--text-primary); font-weight: 500; }
.onboarding-step.done { color: var(--success); }
.onboarding-step.failed { color: var(--error); }

.ob-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.ob-pending { border: 2px solid var(--border-default); }
.ob-active {
  border: 2px solid var(--primary);
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.ob-done { background: var(--success); color: white; }
.ob-done::after { content: '\2713'; }
.ob-failed { background: var(--error); color: white; }
.ob-failed::after { content: '\2717'; }

/* ── Auth button centering ─────────────────────────────── */
.auth-btn-center {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.auth-btn-center .btn {
  min-width: 180px;
  padding: 10px 24px;
  font-size: 14px;
}

/* ── Premium onboarding card ──────────────────────────── */
.onboarding-premium {
  text-align: center;
  animation: obCardFadeIn 0.6s ease both;
}

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

/* ── Coffee Scene ─────────────────────────────────────── */
.coffee-scene {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto 32px;
  width: 120px;
  height: 120px;
}

/* Cup body */
.coffee-scene .coffee-cup {
  position: absolute;
  bottom: 14px;
  width: 72px;
  height: 52px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%);
  border: 2px solid var(--border-default);
  border-radius: 4px 4px 20px 20px;
  z-index: 2;
  overflow: hidden;
}

/* Liquid inside the cup */
.coffee-liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, #8B6914 0%, #6B4F10 50%, #5C4010 100%);
  border-radius: 0 0 18px 18px;
  animation: coffeePulse 3s ease-in-out infinite;
}

.coffee-liquid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  width: 80%;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  border-radius: 50%;
  animation: coffeeShimmer 4s ease-in-out infinite;
}

@keyframes coffeePulse {
  0%, 100% { height: 58%; }
  50%      { height: 63%; }
}

@keyframes coffeeShimmer {
  0%, 100% { left: 10%; opacity: 0.3; }
  50%      { left: 20%; opacity: 0.6; }
}

/* Handle */
.coffee-scene .coffee-handle {
  position: absolute;
  right: -14px;
  top: 10px;
  width: 16px;
  height: 24px;
  border: 2.5px solid var(--border-default);
  border-left: none;
  border-radius: 0 10px 10px 0;
  z-index: 1;
}

/* Saucer */
.coffee-saucer {
  position: absolute;
  bottom: 4px;
  width: 90px;
  height: 10px;
  background: linear-gradient(180deg, #F1F5F9 0%, #E2E8F0 100%);
  border: 2px solid var(--border-default);
  border-radius: 50%;
  z-index: 3;
}

/* Steam container */
.coffee-steam {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 4;
}

/* Individual steam lines — wavy rising vapor */
.coffee-steam span {
  display: block;
  width: 2.5px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(148,163,184,0) 0%, rgba(148,163,184,0.35) 40%, rgba(148,163,184,0) 100%);
}

.steam-1 {
  height: 22px;
  animation: steamFloat 2.4s ease-in-out infinite;
}

.steam-2 {
  height: 28px;
  animation: steamFloat 2.4s ease-in-out 0.5s infinite;
}

.steam-3 {
  height: 20px;
  animation: steamFloat 2.4s ease-in-out 1.0s infinite;
}

@keyframes steamFloat {
  0% {
    opacity: 0;
    transform: translateY(8px) scaleX(1);
  }
  15% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.35;
    transform: translateY(-10px) scaleX(1.3) translateX(2px);
  }
  85% {
    opacity: 0.1;
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scaleX(0.8) translateX(-2px);
  }
}

/* ── Text ─────────────────────────────────────────────── */
.onboarding-premium h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.4px;
}

.onboarding-premium .ob-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 28px;
}

/* ── Steps ────────────────────────────────────────────── */
.onboarding-premium .onboarding-steps {
  margin-bottom: 20px;
}

.onboarding-premium .onboarding-step {
  padding: 9px 0;
  transition: all 0.35s ease;
}

.onboarding-premium .onboarding-step.active span:last-child {
  color: var(--primary);
  font-weight: 600;
}

.onboarding-premium .onboarding-step.done span:last-child {
  color: var(--text-secondary);
}

.onboarding-premium .onboarding-step.failed span:last-child {
  color: var(--error);
}

/* ── WhatsApp notice ──────────────────────────────────── */
.onboarding-premium .ob-whatsapp-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.onboarding-premium .ob-whatsapp-notice svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #25D366;
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .onboarding-card {
    padding: 28px 20px;
  }
  .coffee-scene {
    width: 100px;
    height: 100px;
    margin-bottom: 24px;
  }
  .coffee-scene .coffee-cup {
    width: 60px;
    height: 44px;
  }
  .coffee-saucer {
    width: 76px;
    height: 8px;
  }
  .coffee-scene .coffee-handle {
    width: 13px;
    height: 20px;
    right: -12px;
    top: 8px;
  }
  .onboarding-premium h2 {
    font-size: 18px;
  }
}

/* ════════════════════════════════════════════════════════
   IMPACT SECTION
   ════════════════════════════════════════════════════════ */

.impact-section {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  transition: border-color var(--duration);
  box-shadow: var(--shadow-xs);
}
.impact-section:hover { border-color: var(--border-hover); }

.impact-headline {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.4;
  letter-spacing: -0.3px;
}

.impact-headline.type-negative { color: var(--error); }
.impact-headline.type-warning { color: var(--warning); }
.impact-headline.type-positive { color: var(--success); }
.impact-headline.type-neutral { color: var(--text-primary); }

.impact-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 16px;
}

.impact-comparison {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.impact-comparison .impact-vs-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.impact-missing {
  flex: 1;
  font-size: 12px;
}

.impact-missing .missing-title {
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.impact-missing .missing-query {
  color: var(--error);
  padding: 6px 0;
  font-size: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.impact-missing .missing-query:last-child { border-bottom: none; }

.impact-cta {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ════════════════════════════════════════════════════════
   SCORE META SECTION (inline metric pills)
   ════════════════════════════════════════════════════════ */

.score-meta-section {
  margin: 12px 0 16px;
  padding: 16px 20px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.score-meta-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.score-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 10px 16px;
  border-radius: 10px;
  min-width: 100px;
}
.score-meta-item--danger {
  background: var(--error-bg);
}
.score-meta-item--danger .score-meta-value {
  color: var(--error);
}
.score-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.score-meta-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════
   DEEP OPPORTUNITIES (numbered list with accent border)
   ════════════════════════════════════════════════════════ */

.deep-opp-section {
  margin: 0 0 24px;
  padding: 24px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  border-left: 4px solid var(--warning);
  box-shadow: var(--shadow-xs);
}
.deep-opp-header {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.deep-opp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deep-opp-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.deep-opp-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.deep-opp-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.deep-opp-text {
  color: var(--text-primary);
  padding-top: 2px;
}

/* ════════════════════════════════════════════════════════
   COMPETITOR SoV CARDS
   ════════════════════════════════════════════════════════ */

.sov-comp-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.sov-comp-item:last-child { border-bottom: none; }

.sov-comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.sov-comp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.sov-comp-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.sov-comp-bar-wrap {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin-bottom: 6px;
  overflow: hidden;
}
.sov-comp-bar-wrap .sov-bar {
  height: 100%;
  border-radius: 3px;
}
.sov-comp-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.sov-comp-meta span {
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════
   LEADERBOARD (new component)
   ════════════════════════════════════════════════════════ */

.leaderboard {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration);
}
.leaderboard__row:nth-child(even) {
  background: rgba(241,245,249,0.5);
}
.leaderboard__row:hover {
  background: var(--bg-hover);
}
.leaderboard__row:last-child {
  border-bottom: none;
}

.leaderboard__row--you {
  background: var(--primary-glow) !important;
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.leaderboard__rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.leaderboard__rank--1 {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}
.leaderboard__rank--2 {
  background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
  color: white;
}
.leaderboard__rank--3 {
  background: linear-gradient(135deg, #d4a574 0%, #b8860b 100%);
  color: white;
}

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

.leaderboard__value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}

.leaderboard__bar {
  flex: 0 0 120px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.leaderboard__bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s var(--ease);
}
.leaderboard__row--you .leaderboard__bar-fill {
  background: var(--primary-dark);
}

.leaderboard__bar-wrap {
  flex: 0 0 100px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.leaderboard__bar-wrap .sov-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s var(--ease);
}

.leaderboard__stats {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 140px;
  justify-content: flex-end;
}

.leaderboard__sov {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.leaderboard__mentions {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.leaderboard__row--alt {
  background: rgba(241,245,249,0.5);
}

/* ════════════════════════════════════════════════════════
   VISIBILITY CHART (new component, Chart.js container)
   ════════════════════════════════════════════════════════ */

.visibility-chart {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}
.visibility-chart__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.visibility-chart__title {
  font-size: 16px;
  font-weight: 600;
}
.visibility-chart__canvas {
  width: 100%;
  height: 280px;
}
.visibility-chart__canvas-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}
.visibility-chart__canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.visibility-chart__legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}
.visibility-chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--duration);
}
.visibility-chart__legend-item:hover {
  color: var(--text-primary);
}
.visibility-chart__legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ── ChartCard (new component) ── */
.chart-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 24px;
}
.chart-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}
.chart-card__header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.chart-card__body {
  padding: 16px 24px 24px;
}

/* ════════════════════════════════════════════════════════
   TEMPLATES
   ════════════════════════════════════════════════════════ */

.template-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.template-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.template-card-header h4 { font-size: 13px; font-weight: 700; color: var(--text-primary); }

.template-card p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   ACTION PLAN
   ════════════════════════════════════════════════════════ */

.plan-summary-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary);
}
.plan-summary-icon {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}
.plan-summary-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.plan-summary-text p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}
.plan-summary-projection {
  margin-top: 10px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

.plan-impact-card {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  margin-bottom: 24px;
}
.plan-impact-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 600;
}
.plan-impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.plan-impact-item {
  text-align: center;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
}
.plan-impact-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.plan-impact-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.plan-impact-projection {
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* Filter buttons */
.plan-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.plan-filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.plan-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.plan-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Action cards */
.plan-action-card {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.plan-action-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.plan-action-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.plan-action-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.plan-action-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.plan-layer-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.plan-action-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.plan-meta-item {
  font-size: 12px;
  color: var(--text-secondary);
}
.plan-gain {
  color: var(--success);
  font-weight: 600;
}
.plan-action-why {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}
.plan-action-steps {
  margin: 8px 0 0 0;
  padding-left: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.plan-action-steps li {
  margin-bottom: 2px;
}

/* Quick wins */
.plan-qw-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--duration);
}
.plan-qw-item:hover {
  border-color: var(--border-hover);
}
.plan-qw-check {
  font-size: 16px;
  flex-shrink: 0;
}

/* Content plan */
.plan-content-item {
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color var(--duration);
}
.plan-content-item:hover {
  border-color: var(--border-hover);
}
.plan-content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.plan-content-priority {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.plan-content-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.plan-content-query {
  font-size: 11px;
  color: var(--text-muted);
}

/* Competitive strategy */
.plan-comp-card {
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.plan-comp-enemy {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.plan-comp-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--error);
}
.plan-comp-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.plan-comp-detail {
  margin-bottom: 12px;
}
.plan-comp-detail p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   KANBAN
   ════════════════════════════════════════════════════════ */

.kanban-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.plan-kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.plan-kanban-5 {
  grid-template-columns: repeat(5, minmax(260px, 1fr));
}
.plan-kanban-6 {
  grid-template-columns: repeat(6, minmax(260px, 1fr));
}
.kanban-col {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  min-width: 260px;
}
.kanban-col-impact {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.kanban-col-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 12px;
  padding: 8px 4px;
  border-bottom: 2px solid var(--border-default);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-tertiary);
  z-index: 1;
}
.kanban-count {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  min-width: 18px;
  text-align: center;
}
.kanban-card {
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
  line-height: 1.4;
}
.kanban-card-query {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-style: italic;
}
.kanban-card-competitor {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.kanban-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.kanban-card-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.btn-kanban {
  padding: 4px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  background: #FFFFFF;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-kanban-fwd:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(2px);
}
.btn-kanban-back:hover {
  border-color: var(--text-muted);
  color: var(--text-secondary);
  transform: translateX(-2px);
}
.btn-kanban:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.kanban-empty {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 20px 0;
}

/* Impact indicators */
.impact-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.impact-improved {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
}
.impact-worsened {
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
}
.impact-unchanged {
  color: var(--text-muted);
  background: var(--bg-tertiary);
}
.kanban-card-impact {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
}
.kanban-card-url {
  font-size: 11px;
  color: var(--primary);
  word-break: break-all;
  margin-top: 4px;
}

/* Impact summary bar */
.kanban-impact-summary {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  margin-top: 12px;
}
.kanban-impact-stat {
  font-size: 13px;
  color: var(--text-secondary);
}
.kanban-impact-stat strong {
  font-size: 18px;
  display: block;
  margin-bottom: 2px;
}

/* Badge types for tasks */
.badge-action { background: rgba(37, 99, 235, 0.15); color: var(--primary); }
.badge-content { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-optimization { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* ════════════════════════════════════════════════════════
   AI GROWTH ASSISTANT
   ════════════════════════════════════════════════════════ */

.assistant-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-xs);
}
.assistant-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.assistant-focus {
  background: var(--primary-glow);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.assistant-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.assistant-priority-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.assistant-priority-item:last-child { border-bottom: none; }
.assistant-priority-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.assistant-priority-content { flex: 1; }
.assistant-priority-text { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.assistant-priority-reason { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.assistant-priority-impact {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.assistant-priority-impact.high { background: rgba(239,68,68,0.1); color: var(--error); }
.assistant-priority-impact.medium { background: rgba(245,158,11,0.1); color: #f59e0b; }
.assistant-priority-impact.low { background: var(--bg-tertiary); color: var(--text-muted); }

.assistant-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  border-left: 3px solid transparent;
}
.assistant-alert.critical {
  background: rgba(239,68,68,0.06);
  border-left-color: var(--error);
  color: var(--error);
}
.assistant-alert.warning {
  background: rgba(245,158,11,0.06);
  border-left-color: #f59e0b;
  color: #d97706;
}
.assistant-alert.info {
  background: var(--primary-glow);
  border-left-color: var(--primary);
  color: var(--primary);
}
.assistant-alert-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.assistant-alert.critical .assistant-alert-icon { background: var(--error); color: white; }
.assistant-alert.warning .assistant-alert-icon { background: #f59e0b; color: white; }
.assistant-alert.info .assistant-alert-icon { background: var(--primary); color: white; }

.assistant-action-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.assistant-action-item:last-child { border-bottom: none; }
.assistant-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.assistant-action-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.assistant-action-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}
.assistant-cta {
  margin-top: 16px;
  text-align: center;
}

/* ════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════ */

.alerts-badge {
  background: var(--error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

.alert-item {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 4px solid transparent;
  transition: box-shadow var(--duration);
}
.alert-item:hover {
  box-shadow: var(--shadow-sm);
}
.alert-item.critical {
  background: rgba(239,68,68,0.05);
  border-left-color: var(--error);
}
.alert-item.warning {
  background: rgba(245,158,11,0.05);
  border-left-color: #f59e0b;
}
.alert-item.info {
  background: var(--primary-glow);
  border-left-color: var(--primary);
}
.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.alert-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}
.alert-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.alert-more {
  font-size: 12px;
  color: var(--primary);
  text-align: center;
  padding: 8px;
  cursor: pointer;
}
.alerts-synthetic-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 4px 10px;
  background: var(--primary-glow);
  border-radius: 20px;
  display: inline-block;
}

/* ════════════════════════════════════════════════════════
   BENCHMARK
   ════════════════════════════════════════════════════════ */

.benchmark-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-xs);
}
.benchmark-header {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.benchmark-headline {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.benchmark-risk {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.benchmark-risk-critical { background: rgba(239,68,68,0.08); color: var(--error); }
.benchmark-risk-warning { background: rgba(245,158,11,0.08); color: #b45309; }
.benchmark-risk-info { background: var(--primary-glow); color: var(--primary); }
.benchmark-incomplete { border-color: rgba(245,158,11,0.3); }
.benchmark-completion-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(245,158,11,0.06);
  border-radius: 8px;
  margin-bottom: 14px;
  border-left: 3px solid #f59e0b;
}
.benchmark-coverage-progress { margin-bottom: 14px; }
.benchmark-coverage-badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.benchmark-coverage-complete { background: rgba(34,197,94,0.08); color: #16a34a; }
.coverage-widget {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}
.coverage-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.coverage-widget-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.coverage-widget-pct { font-size: 18px; }
.coverage-complete { border-color: rgba(34,197,94,0.3); }
.coverage-partial { border-color: rgba(245,158,11,0.3); }
.coverage-low { border-color: rgba(239,68,68,0.3); }
.benchmark-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.benchmark-stat { text-align: center; }
.benchmark-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.benchmark-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.benchmark-opportunity {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: rgba(245,158,11,0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid #f59e0b;
}
.benchmark-pressure {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: rgba(239,68,68,0.04);
  border-radius: 8px;
  margin-bottom: 14px;
  border-left: 3px solid var(--error);
}
.benchmark-actions-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.benchmark-actions { display: flex; flex-direction: column; gap: 6px; }
.benchmark-action-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.benchmark-action-item:last-child { border-bottom: none; }
.benchmark-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.benchmark-action-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.benchmark-action-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════
   ENGINE DETAIL
   ════════════════════════════════════════════════════════ */

.engine-detail-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.engine-detail-item:last-child { border-bottom: none; }
.engine-detail-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.engine-detail-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ════════════════════════════════════════════════════════
   DASHBOARD V2 — COMPLETE REWRITE
   ════════════════════════════════════════════════════════ */

/* Container */
.db2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Insight Banner ── */
.db2-insight {
  background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.01) 100%);
  border: 1px solid rgba(37,99,235,0.12);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.db2-insight--warning {
  background: linear-gradient(135deg, rgba(217,119,6,0.06) 0%, rgba(217,119,6,0.01) 100%);
  border-color: rgba(217,119,6,0.15);
}
.db2-insight--negative {
  background: linear-gradient(135deg, rgba(220,38,38,0.05) 0%, rgba(220,38,38,0.01) 100%);
  border-color: rgba(220,38,38,0.15);
}
.db2-insight--positive {
  background: linear-gradient(135deg, rgba(22,163,74,0.06) 0%, rgba(22,163,74,0.01) 100%);
  border-color: rgba(22,163,74,0.15);
}
.db2-insight--neutral {
  background: linear-gradient(135deg, rgba(37,99,235,0.06) 0%, rgba(37,99,235,0.01) 100%);
  border-color: rgba(37,99,235,0.12);
}
.db2-insight__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(37,99,235,0.1);
  color: var(--primary);
}
.db2-insight--warning .db2-insight__icon { background: rgba(217,119,6,0.1); color: var(--warning); }
.db2-insight--negative .db2-insight__icon { background: rgba(220,38,38,0.08); color: var(--error); }
.db2-insight--positive .db2-insight__icon { background: rgba(22,163,74,0.08); color: var(--success); }
.db2-insight__body {
  flex: 1;
  min-width: 0;
}
.db2-insight__title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.db2-insight__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.db2-insight__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ── KPI Grid ── */
.db2-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.db2-kpi {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-xs);
}
.db2-kpi:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}
.db2-kpi--accent {
  border-color: rgba(37,99,235,0.15);
  background: linear-gradient(135deg, rgba(37,99,235,0.03) 0%, #FFFFFF 100%);
}
.db2-kpi__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.db2-kpi__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.db2-kpi__value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text-primary);
}
.db2-kpi--accent .db2-kpi__value {
  color: var(--primary);
}
.db2-kpi__delta {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.db2-kpi__delta--up { color: var(--success); background: var(--success-bg); }
.db2-kpi__delta--down { color: var(--error); background: var(--error-bg); }
.db2-kpi__explain {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
  line-height: 1.4;
  min-height: 16px;
}

/* ── Section Card (reusable wrapper) ── */
.db2-card {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}
.db2-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.db2-card__header {
  padding: 14px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.db2-card__title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.db2-card__body {
  padding: 12px 16px 16px;
}

/* ── Visibility Chart ── */
.db2-chart {
  position: relative;
}
.db2-chart__canvas {
  width: 100%;
  height: 220px;
}

/* ── Leaderboard ── */
.db2-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.db2-lb__row {
  display: grid;
  grid-template-columns: 36px 1fr 140px 100px;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.db2-lb__row:last-child { border-bottom: none; }
.db2-lb__rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.db2-lb__rank--1 { background: linear-gradient(135deg, #FDE68A, #F59E0B); color: #92400E; }
.db2-lb__rank--2 { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); color: #374151; }
.db2-lb__rank--3 { background: linear-gradient(135deg, #FED7AA, #F97316); color: #7C2D12; }
.db2-lb__rank--you {
  background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(37,99,235,0.3));
  color: var(--primary);
  font-weight: 800;
}
.db2-lb__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db2-lb__name--you {
  color: var(--primary);
  font-weight: 700;
}
.db2-lb__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.db2-lb__bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.db2-lb__bar-fill--comp {
  background: var(--text-tertiary);
}
.db2-lb__sov {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Next Actions ── */
.db2-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.db2-action {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.db2-action:last-child { border-bottom: none; }
.db2-action__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.db2-action__content {
  flex: 1;
  min-width: 0;
}
.db2-action__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.db2-action__desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.5;
}
.db2-action__badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.db2-action__badge--high { background: var(--error-bg); color: var(--error); }
.db2-action__badge--medium { background: var(--warning-bg); color: var(--warning); }
.db2-action__badge--low { background: rgba(107,114,128,0.08); color: var(--text-secondary); }

/* ── Two-column layout ── */
.db2-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Quick Actions Bar ── */
.db2-quickbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 11px 11px;
}

/* ── Score Meta ── */
.db2-score-meta {
  display: flex;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--border-subtle);
}
.db2-score-meta__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.db2-score-meta__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.db2-score-meta__value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.db2-score-meta__value--danger { color: var(--error); }

/* ── Dashboard message ── */
.db2-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  display: none;
}
.db2-msg.success { display: block; background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.db2-msg.error { display: block; background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error); }

/* ── Dashboard V2 Responsive ── */
@media (max-width: 1024px) {
  .db2-kpis { grid-template-columns: repeat(2, 1fr); }
  .db2-row { grid-template-columns: 1fr; }
  .db2-lb__row { grid-template-columns: 36px 1fr 100px 80px; }
}
@media (max-width: 640px) {
  .db2-kpis { grid-template-columns: 1fr; }
  .db2-insight { flex-direction: column; padding: 20px; }
  .db2-lb__row { grid-template-columns: 28px 1fr 70px; }
  .db2-lb__bar { display: none; }
  .db2 { gap: 16px; }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .app-main {
    margin-left: 0 !important;
  }
  .sidebar-toggle {
    display: block;
  }
  .sidebar-collapse-btn { display: none !important; }
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .section-row { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .content-shell { padding: 0 16px; }
  .tab-content { padding: 16px 0 24px; }
  .run-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .app-topbar { padding: 0 var(--sp-4); }
  .impact-details { grid-template-columns: 1fr; gap: 16px; }
  .evolution-grid { flex-direction: column; gap: 12px; }
  .plan-impact-grid { grid-template-columns: 1fr; }
  .plan-kanban, .plan-kanban-5, .plan-kanban-6 { grid-template-columns: 1fr; }
  .plan-filter-row { flex-wrap: wrap; }
  .kanban-header-row { flex-direction: column; }
  .kanban-impact-summary { flex-wrap: wrap; }
  .leaderboard__bar { flex: 0 0 80px; }
  .action-card__body { flex-direction: column; }
  .action-card__secondary { margin-left: 0; }
  .visibility-chart__legend { flex-wrap: wrap; gap: 8px; }
  .pg-header { flex-direction: column; gap: 10px; }
  .pg-header__actions { flex-wrap: wrap; }
  .summary-bar { flex-wrap: wrap; }
  .summary-item { min-width: calc(50% - 8px); }
  .filters-toolbar { flex-wrap: wrap; }
  .filters-toolbar__search { max-width: none; }
  .qrow__actions { opacity: 1; }
  .qrow__priority-label { display: none; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .tab-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .leaderboard__row { padding: 10px 12px; }
  .leaderboard__bar { display: none; }
  .score-meta-grid { flex-direction: column; }
  .score-meta-item { min-width: 0; }
}

/* ════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ════════════════════════════════════════════════════════
   MIXED SENTIMENT BADGE
   ════════════════════════════════════════════════════════ */
.badge-mixed { background: rgba(37,99,235,0.1); color: var(--primary); }

/* ════════════════════════════════════════════════════════
   ANSWER MENTION TABS
   ════════════════════════════════════════════════════════ */
.mention-tab.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}
.mention-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.mention-tab-count {
  display: inline-block;
  min-width: 18px;
  text-align: center;
}

/* ════════════════════════════════════════════════════════
   ANSWER ROW CLICKABLE
   ════════════════════════════════════════════════════════ */
.answer-row:hover {
  background: var(--bg-hover);
}
.answer-row td {
  transition: background 0.15s;
}

/* ════════════════════════════════════════════════════════
   ANALYTICS SECTION
   ════════════════════════════════════════════════════════ */
.analytics-section {
  padding-bottom: 24px;
}
.analytics-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ════════════════════════════════════════════════════════
   KEYWORD TAGS
   ════════════════════════════════════════════════════════ */
.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}
.keyword-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: default;
}
.keyword-tag small {
  opacity: 0.6;
  font-size: 0.85em;
}
.keyword-positive {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.keyword-negative {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE: ANALYTICS KEYWORDS
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .analytics-section div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ════════════════════════════════════════════════════════
   KANBAN EXECUTION BUTTONS
   ════════════════════════════════════════════════════════ */
.btn-kanban-exec {
  font-size: 10px;
  padding: 2px 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn-kanban-exec:hover {
  background: var(--accent);
  color: #fff;
}

/* ════════════════════════════════════════════════════════
   RECOMMENDATION STATUS BADGES
   ════════════════════════════════════════════════════════ */
.badge-pendente, .badge-open { background: var(--warning, #f59e0b); color: #fff; }
.badge-aceita, .badge-accepted { background: var(--success); color: #fff; }
.badge-em\ execução, .badge-in_progress { background: var(--accent); color: #fff; }
.badge-concluída, .badge-completed { background: var(--text-muted); color: #fff; }
.badge-descartada, .badge-dismissed { background: var(--text-tertiary); color: #fff; }

/* ════════════════════════════════════════════════════════
   ALERTS PAGE
   ════════════════════════════════════════════════════════ */
.alert-read { opacity: 0.6; }

/* ════════════════════════════════════════════════════════
   CHAT QUICK-ACTION BUTTONS
   ════════════════════════════════════════════════════════ */
.chat-quick-btn {
  font-size: 13px;
  padding: 8px 16px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  background: #FFFFFF;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chat-quick-btn:hover {
  background: var(--primary-soft);
  border-color: #2563EB;
  color: #1D4ED8;
}

/* ════════════════════════════════════════════════════════
   CHAT — ACTION PANEL
   ════════════════════════════════════════════════════════ */

/* Container */
.chat-msg-assistant .chat-bubble-rich {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  padding: 20px;
  border-radius: 16px 16px 16px 4px;
  max-width: min(90%, 640px);
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.action-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

/* Header */
.ap-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ap-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.3;
}
.ap-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.ap-badge.urgent  { background: #FEE2E2; color: #DC2626; }
.ap-badge.high    { background: #FEF3C7; color: #D97706; }
.ap-badge.medium  { background: #DBEAFE; color: #2563EB; }
.ap-badge.low     { background: #D1FAE5; color: #059669; }

/* Summary */
.ap-summary {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.65;
  color: #374151;
}
.ap-summary strong { color: #111827; }

/* Callout */
.ap-callout {
  background: #FFFBEB;
  border-left: 3px solid #F59E0B;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: #92400E;
  line-height: 1.5;
}

/* Priority Section */
.ap-priority {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 12px;
  padding: 16px;
}
.ap-priority.p1 { background: #FEF2F2; border: 1px solid #FECACA; }
.ap-priority.p2 { background: #FFFBEB; border: 1px solid #FDE68A; }
.ap-priority.p3 { background: #F0FDF4; border: 1px solid #BBF7D0; }
.ap-priority.neutral { background: #F8FAFC; border: 1px solid #E2E8F0; }

.ap-priority-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ap-priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ap-priority.p1 .ap-priority-dot { background: #EF4444; }
.ap-priority.p2 .ap-priority-dot { background: #F59E0B; }
.ap-priority.p3 .ap-priority-dot { background: #10B981; }
.ap-priority.neutral .ap-priority-dot { background: #6B7280; }

.ap-priority-label {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}
.ap-priority-sublabel {
  font-size: 12px;
  color: #6B7280;
  margin-top: -4px;
}

/* Query Card */
.query-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.query-card:hover {
  border-color: #2563EB;
  box-shadow: 0 4px 12px rgba(37,99,235,0.10);
  transform: translateY(-2px);
}
.query-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}
.query-card-reason {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.5;
  margin-bottom: 8px;
}
.query-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.qc-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.qc-tag.gap        { background: #FEE2E2; color: #DC2626; }
.qc-tag.competitor  { background: #FEF3C7; color: #D97706; }
.qc-tag.approved    { background: #D1FAE5; color: #059669; }
.qc-tag.comparison  { background: #DBEAFE; color: #1D4ED8; }
.qc-tag.purchase    { background: #DBEAFE; color: #2563EB; }
.qc-tag.open-window { background: #ECFDF5; color: #065F46; }

.query-card-actions {
  display: flex;
  gap: 8px;
}
.qc-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.qc-btn.primary {
  background: #2563EB;
  color: #FFFFFF;
}
.qc-btn.primary:hover { background: #1D4ED8; }
.qc-btn.secondary {
  background: #F3F4F6;
  color: #374151;
  border: 1px solid #D1D5DB;
}
.qc-btn.secondary:hover {
  background: var(--primary-soft);
  border-color: #2563EB;
  color: #1D4ED8;
}

/* Action Checklist */
.ap-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.ap-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #374151;
  line-height: 1.55;
  padding: 10px 12px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  transition: border-color 0.15s;
}
.ap-check-item:hover { border-color: #2563EB; }
.ap-check-icon {
  min-width: 22px;
  height: 22px;
  background: #2563EB;
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.ap-check-text { flex: 1; }
.ap-check-text strong { color: #111827; }

/* Timing label inside checklist */
.ap-check-when {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #DBEAFE;
  color: #1D4ED8;
  white-space: nowrap;
  align-self: center;
}

/* Score bar */
.ap-score-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
}
.ap-score-value {
  font-size: 28px;
  font-weight: 800;
  color: #DC2626;
  line-height: 1;
}
.ap-score-label {
  font-size: 12px;
  color: #6B7280;
}
.ap-score-label strong { color: #111827; }
.ap-score-track {
  flex: 1;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
}
.ap-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Chat Turn Blocks */
.chat-turn {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid #E5E7EB;
}
.chat-turn:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.chat-turn-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9CA3AF;
  margin-bottom: 6px;
}

.chat-user-question {
  background: var(--primary-soft);
  border: 1px solid #BFDBFE;
  color: #1E40AF;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.5;
}

.chat-assistant-answer {
  background: transparent;
}

/* Loading skeleton */
.chat-loading-skeleton {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  font-size: 13px;
  color: #6B7280;
}
.chat-loading-dot {
  display: inline-flex;
  gap: 4px;
}
.chat-loading-dot span {
  width: 6px;
  height: 6px;
  background: #2563EB;
  border-radius: 50%;
  animation: chatPulse 1.2s ease-in-out infinite;
}
.chat-loading-dot span:nth-child(2) { animation-delay: 0.15s; }
.chat-loading-dot span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .chat-msg-assistant .chat-bubble-rich { max-width: 95%; padding: 14px; }
  .ap-priority { padding: 12px; }
  .query-card-actions { flex-direction: column; }
  .qc-btn { width: 100%; text-align: center; }
  .chat-user-question { padding: 10px 14px; }
}

/* ════════════════════════════════════════════════════════
   PREMIUM DESIGN SYSTEM ENHANCEMENTS
   ════════════════════════════════════════════════════════ */

/* ── Loading Skeleton (universal) ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}
.skeleton-text:last-child { width: 60%; }
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.skeleton-kpi {
  height: 100px;
  border-radius: var(--radius-lg);
}

/* ── Improved Empty State ── */
.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius);
  max-width: 520px;
  margin: 24px auto;
}
.empty-state::before {
  content: '';
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--primary-soft);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232563EB' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px;
}
.empty-state .btn {
  margin-top: 16px;
}

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

/* ── Tab Header Premium ── */
.tab-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tab-header h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--gradient-btn);
  border-radius: 2px;
}

/* ── Premium Data Table ── */
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody tr {
  animation: fadeIn 0.3s ease;
}

/* ── Topbar glass effect enhancement ── */
.app-topbar {
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* ── Card hover micro-interactions ── */
.stat-card,
.metric-card,
.section-half,
.section-full,
.plan-action-card,
.kanban-card,
.template-card,
.benchmark-card,
.assistant-card {
  will-change: transform, box-shadow;
}

/* ── Focus ring for accessibility ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Smooth page transitions ── */
.tab-content {
  animation: pageIn 0.25s var(--ease);
}

/* ── Selection color ── */
::selection {
  background: rgba(37, 99, 235, 0.15);
  color: var(--text-primary);
}

/* ── Improved filter row ── */
.filter-row select,
.filter-row input {
  height: 36px;
  border-radius: var(--radius-sm);
}

/* ── Status dot utility ── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot--success { background: var(--success); }
.status-dot--warning { background: var(--warning); }
.status-dot--error { background: var(--error); }
.status-dot--info { background: var(--primary); }

/* ── Gradient text utility ── */
.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Card group spacing consistency ── */
.card-list .card-item,
.run-card,
.alert-item,
.plan-action-card {
  transition: all 0.2s var(--ease);
}

/* ── Badge pill improvement ── */
.badge {
  line-height: 1;
  white-space: nowrap;
}

/* ── Admin Backoffice Shell ── */
.admin-shell, .agency-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary, #0f0f23);
}
.admin-sidebar, .agency-sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-card, #1a1a3e);
  border-right: 1px solid var(--border, #2a2a5a);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.admin-sidebar-brand, .agency-sidebar-brand {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border, #2a2a5a);
}
.admin-sidebar-brand strong, .agency-sidebar-brand strong {
  display: block;
  font-size: 15px;
  color: var(--text-primary, #e2e2ff);
}
.admin-sidebar-brand small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #8888bb);
  margin-top: 2px;
}
.admin-sidebar-nav, .agency-sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}
.admin-nav-tab, .agency-nav-tab {
  display: block;
  padding: 10px 20px;
  color: var(--text-secondary, #8888bb);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}
.admin-nav-tab:hover, .agency-nav-tab:hover {
  color: var(--text-primary, #e2e2ff);
  background: rgba(99,102,241,0.08);
}
.admin-nav-tab.active, .agency-nav-tab.active {
  color: var(--accent, #818CF8);
  border-left-color: var(--accent, #818CF8);
  background: rgba(99,102,241,0.12);
}
.admin-sidebar-footer, .agency-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #2a2a5a);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-sidebar-footer a, .agency-sidebar-footer a {
  color: var(--text-secondary, #8888bb);
  text-decoration: none;
  font-size: 12px;
}
.admin-sidebar-footer a:hover, .agency-sidebar-footer a:hover {
  color: var(--accent, #818CF8);
}
.admin-main, .agency-main {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  max-height: 100vh;
}
.admin-tab-content, .agency-tab-content {
  display: none;
}
.admin-tab-content.active, .agency-tab-content.active {
  display: block;
}

