/* ==============================
   Growity.ai — Shared Styles
   ============================== */

/* ===== Theme tokens ===== */
:root {
  --surface-page: #09090b;
  --surface-card: #0E0E10;
  --surface-sidebar: #0a0a0c;
  --surface-input: #1F1F22;
  --surface-nav: rgba(9,9,11,0.8);
  --surface-dropdown: #18181b;
  --surface-hover: rgba(255,255,255,0.05);
  --surface-subtle: rgba(255,255,255,0.02);
  --surface-muted: rgba(255,255,255,0.03);
  --surface-overlay: rgba(0,0,0,0.6);

  --text-primary: #ffffff;
  --text-secondary: #e4e4e7;
  --text-tertiary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;
  --text-disabled: #3f3f46;

  --border-default: rgba(255,255,255,0.05);
  --border-medium: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.15);

  --scrollbar-thumb: rgba(255,255,255,0.1);
  --scrollbar-thumb-hover: rgba(255,255,255,0.2);
  --toggle-track: #3f3f46;
  --progress-bg: #27272a;

  --shadow-card: none;
  --shadow-dropdown: none;

  --accent-bg: rgba(59,130,246,0.15);
  --accent-text: #60a5fa;
  --accent-border: rgba(59,130,246,0.3);
}

/* Light: pure white canvas, cards separated by borders, no gray backgrounds */
[data-theme="light"] {
  --surface-page: #ffffff;             /* pure white */
  --surface-card: #ffffff;             /* white */
  --surface-sidebar: #ffffff;          /* white */
  --surface-input: #ffffff;            /* white */
  --surface-nav: rgba(255,255,255,0.90);
  --surface-dropdown: #ffffff;         /* white */
  --surface-hover: rgba(0,0,0,0.04);
  --surface-subtle: #ffffff;           /* white */
  --surface-muted: #ffffff;            /* white */
  --surface-overlay: rgba(0,0,0,0.4);

  --text-primary: #111827;            /* gray-900 */
  --text-secondary: #1f2937;          /* gray-800 */
  --text-tertiary: #374151;           /* gray-700 */
  --text-muted: #4b5563;              /* gray-600 */
  --text-faint: #6b7280;              /* gray-500 */
  --text-disabled: #9ca3af;           /* gray-400 */

  --border-default: #e5e7eb;          /* gray-200 */
  --border-medium: #d1d5db;           /* gray-300 */
  --border-strong: #9ca3af;           /* gray-400 */

  --scrollbar-thumb: rgba(0,0,0,0.18);
  --scrollbar-thumb-hover: rgba(0,0,0,0.3);
  --toggle-track: #d1d5db;            /* gray-300 */
  --progress-bg: #e5e7eb;             /* gray-200 */

  --shadow-card: none;
  --shadow-dropdown: none;

  --accent-bg: #eff6ff;               /* blue-50 */
  --accent-text: #2563eb;             /* blue-600 */
  --accent-border: #93c5fd;           /* blue-300 */
}

[data-theme="dark"] {
  --surface-page: #09090b;
  --surface-card: #0E0E10;
  --surface-sidebar: #0a0a0c;
  --surface-input: #1F1F22;
  --surface-nav: rgba(9,9,11,0.8);
  --surface-dropdown: #18181b;
  --surface-hover: rgba(255,255,255,0.05);
  --surface-subtle: rgba(255,255,255,0.02);
  --surface-muted: rgba(255,255,255,0.03);
  --surface-overlay: rgba(0,0,0,0.6);

  --text-primary: #ffffff;
  --text-secondary: #e4e4e7;
  --text-tertiary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;
  --text-disabled: #3f3f46;

  --border-default: rgba(255,255,255,0.05);
  --border-medium: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.15);

  --scrollbar-thumb: rgba(255,255,255,0.1);
  --scrollbar-thumb-hover: rgba(255,255,255,0.2);
  --toggle-track: #3f3f46;
  --progress-bg: #27272a;

  --shadow-card: none;
  --shadow-dropdown: none;

  --accent-bg: rgba(59,130,246,0.15);
  --accent-text: #60a5fa;
  --accent-border: rgba(59,130,246,0.3);
}

/* Sparkline target lines — theme-aware */
.sparkline-target { stroke: rgba(255,255,255,0.06); }
[data-theme="light"] .sparkline-target { stroke: #e5e7eb; }

/* Light theme: sidebar border separator */
[data-theme="light"] #sidebar-container > aside,
[data-theme="light"] #sidebar-container > div { border-right: 1px solid #e5e7eb; }

/* Active nav item */
[data-theme="light"] .nav-active {
  background: #eff6ff;
  color: #2563eb;
}
[data-theme="light"] .nav-active svg { color: #2563eb !important; }

/* Light theme: -400 → -600 text (sharp on white, exact Tailwind values)
   !important needed to beat Tailwind CDN JIT which injects styles dynamically */
[data-theme="light"] .text-emerald-300 { color: #059669 !important; } /* emerald-600 */
[data-theme="light"] .text-emerald-400 { color: #059669 !important; } /* emerald-600 */
[data-theme="light"] .text-red-400 { color: #dc2626 !important; }     /* red-600 */
[data-theme="light"] .text-amber-400 { color: #d97706 !important; }   /* amber-600 */
[data-theme="light"] .text-purple-400 { color: #9333ea !important; }  /* purple-600 */
[data-theme="light"] .text-cyan-400 { color: #0891b2 !important; }    /* cyan-600 */
[data-theme="light"] .text-blue-400 { color: #2563eb !important; }    /* blue-600 */
[data-theme="light"] .text-rose-400 { color: #e11d48 !important; }    /* rose-600 */
[data-theme="light"] .text-green-400 { color: #16a34a !important; }   /* green-600 */
[data-theme="light"] .text-red-400\/60 { color: rgb(220 38 38 / 0.6) !important; }

/* Light theme: /10 → -50, /20 → -100 backgrounds (exact Tailwind) */
[data-theme="light"] .bg-emerald-500\/10 { background-color: #ecfdf5 !important; } /* emerald-50 */
[data-theme="light"] .bg-emerald-500\/20 { background-color: #d1fae5 !important; } /* emerald-100 */
[data-theme="light"] .bg-red-500\/10 { background-color: #fef2f2 !important; }     /* red-50 */
[data-theme="light"] .bg-red-500\/20 { background-color: #fee2e2 !important; }     /* red-100 */
[data-theme="light"] .bg-red-500\/5 { background-color: #fef2f2 !important; }      /* red-50 */
[data-theme="light"] .bg-amber-500\/10 { background-color: #fffbeb !important; }   /* amber-50 */
[data-theme="light"] .bg-amber-500\/20 { background-color: #fef3c7 !important; }   /* amber-100 */
[data-theme="light"] .bg-purple-500\/10 { background-color: #faf5ff !important; }  /* purple-50 */
[data-theme="light"] .bg-purple-500\/20 { background-color: #f3e8ff !important; }  /* purple-100 */
[data-theme="light"] .bg-blue-500\/10 { background-color: #eff6ff !important; }    /* blue-50 */
[data-theme="light"] .bg-blue-500\/20 { background-color: #dbeafe !important; }    /* blue-100 */
[data-theme="light"] .bg-cyan-500\/10 { background-color: #ecfeff !important; }    /* cyan-50 */
[data-theme="light"] .bg-zinc-500\/10 { background-color: #ffffff !important; }    /* white */
[data-theme="light"] .bg-white\/10 { background-color: #ffffff !important; }       /* white */

/* Light theme: /20 borders → -200 (exact Tailwind) */
[data-theme="light"] .border-emerald-500\/20 { border-color: #a7f3d0 !important; } /* emerald-200 */
[data-theme="light"] .border-red-500\/20 { border-color: #fecaca !important; }     /* red-200 */
[data-theme="light"] .border-amber-500\/20 { border-color: #fde68a !important; }   /* amber-200 */
[data-theme="light"] .border-blue-500\/20 { border-color: #bfdbfe !important; }    /* blue-200 */
[data-theme="light"] .border-purple-500\/20 { border-color: #e9d5ff !important; }  /* purple-200 */
[data-theme="light"] .border-zinc-500\/20 { border-color: #e5e7eb !important; }    /* gray-200 */

/* Dark island: restore dark-theme Tailwind colors inside [data-theme="dark"]
   nested within a light-theme page. Higher specificity beats the light overrides above. */
[data-theme="light"] [data-theme="dark"] .text-emerald-300 { color: #6ee7b7 !important; }
[data-theme="light"] [data-theme="dark"] .text-emerald-400 { color: #34d399 !important; }
[data-theme="light"] [data-theme="dark"] .text-red-400 { color: #f87171 !important; }
[data-theme="light"] [data-theme="dark"] .text-amber-400 { color: #fbbf24 !important; }
[data-theme="light"] [data-theme="dark"] .text-purple-400 { color: #c084fc !important; }
[data-theme="light"] [data-theme="dark"] .text-cyan-400 { color: #22d3ee !important; }
[data-theme="light"] [data-theme="dark"] .text-blue-400 { color: #60a5fa !important; }
[data-theme="light"] [data-theme="dark"] .text-rose-400 { color: #fb7185 !important; }
[data-theme="light"] [data-theme="dark"] .text-green-400 { color: #4ade80 !important; }
[data-theme="light"] [data-theme="dark"] .text-violet-300 { color: #c4b5fd !important; }
[data-theme="light"] [data-theme="dark"] .text-violet-400 { color: #a78bfa !important; }
[data-theme="light"] [data-theme="dark"] .text-indigo-300 { color: #a5b4fc !important; }
[data-theme="light"] [data-theme="dark"] .text-fuchsia-400 { color: #e879f9 !important; }
[data-theme="light"] [data-theme="dark"] .bg-emerald-500\/10 { background-color: rgb(16 185 129 / 0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-emerald-500\/20 { background-color: rgb(16 185 129 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .bg-red-500\/10 { background-color: rgb(239 68 68 / 0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-red-500\/20 { background-color: rgb(239 68 68 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .bg-violet-500\/10 { background-color: rgb(139 92 246 / 0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-amber-500\/10 { background-color: rgb(245 158 11 / 0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-blue-500\/10 { background-color: rgb(59 130 246 / 0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-white\/10 { background-color: rgba(255,255,255,0.1) !important; }
[data-theme="light"] [data-theme="dark"] .bg-zinc-500\/10 { background-color: rgba(255,255,255,0.1) !important; }
[data-theme="light"] [data-theme="dark"] .border-emerald-500\/20 { border-color: rgb(16 185 129 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .border-red-500\/20 { border-color: rgb(239 68 68 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .border-violet-500\/20 { border-color: rgb(139 92 246 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .border-amber-500\/20 { border-color: rgb(245 158 11 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .border-blue-500\/20 { border-color: rgb(59 130 246 / 0.2) !important; }
[data-theme="light"] [data-theme="dark"] .border-fuchsia-500\/20 { border-color: rgb(217 70 239 / 0.2) !important; }

/* Theme toggle — sliding segmented control */
.tw {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: var(--surface-subtle);
}
.tw button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}
.tw button svg { height: 14px; width: 14px; }
.tw button.active { color: var(--text-primary); }
.tw-sl {
  position: absolute;
  top: 3px;
  height: calc(100% - 6px);
  border-radius: 7px;
  background: var(--surface-card);
  transition: left 0.2s ease, width 0.2s ease;
}

/* Select — custom chevron visible in both themes */
select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}

/* Base */
* { font-family: 'Inter', sans-serif; }
::selection { background: rgba(59, 130, 246, 0.3); }
body { background: var(--surface-page); }
body.app-layout { overflow-x: hidden; }
body.app-layout main { display: flex; flex-direction: column; }
body.auth-pending { visibility: hidden; }
body.app-layout { opacity: 0; }
body.app-ready { opacity: 1; transition: opacity 0.15s ease; }

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

/* Tab active indicator */
.tab-active {
  color: var(--text-primary);
  border-bottom: 2px solid #3b82f6;
}

/* Segmented tab active state — visible in light mode where card/muted are both white */
[data-theme="light"] .period-tab.font-medium,
[data-theme="light"] .l2-filter-tab.font-medium,
[data-theme="light"] .testing-mode-tab.font-medium,
[data-theme="light"] .setup-testing-tab.font-medium,
[data-theme="light"] .chart-period-tab.font-medium {
  background: #f3f4f6;
}

/* Mini chart bars animation */
@keyframes grow-bar {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.chart-bar {
  transform-origin: bottom;
  animation: grow-bar 0.6s ease-out forwards;
}

/* Toggle switch */
.toggle-track {
  background-color: var(--toggle-track);
  cursor: pointer;
  transition: background-color 0.2s;
}
.toggle-track.active {
  background-color: #3b82f6;
}
.toggle-thumb {
  transition: transform 0.2s;
}
.toggle-track.active .toggle-thumb {
  transform: translateX(16px);
}

/* Small toggle (campaigns page) */
.toggle-sm { width: 32px; height: 18px; border-radius: 9px; position: relative; cursor: pointer; transition: background 0.2s; }
.toggle-sm::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: white; transition: transform 0.2s;
}
.toggle-sm.on { background: #22c55e; }
.toggle-sm.off { background: var(--toggle-track); }
.toggle-sm.on::after { transform: translateX(14px); }

/* Fade-up animations (public pages only) */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.5s ease-out forwards; }
.fade-up-1 { animation-delay: 0.05s; opacity: 0; }
.fade-up-2 { animation-delay: 0.12s; opacity: 0; }
.fade-up-3 { animation-delay: 0.19s; opacity: 0; }
.fade-up-4 { animation-delay: 0.26s; opacity: 0; }

/* Disable fade-up in app pages */
body.app-layout .fade-up,
body.app-layout .fade-up-1,
body.app-layout .fade-up-2,
body.app-layout .fade-up-3,
body.app-layout .fade-up-4,
body.app-layout .fade-up-5,
body.app-layout .fade-up-6 { animation: none; opacity: 1; transform: none; }
.fade-up-5 { animation-delay: 0.33s; opacity: 0; }
.fade-up-6 { animation-delay: 0.40s; opacity: 0; }

/* Pulse ring (dashboard) */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.4; }
}
.pulse-ring { animation: pulse-ring 3s ease-in-out infinite; }

/* Dashed border pattern */
.dashed-border {
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='12' ry='12' stroke='%23ffffff0d' stroke-width='2' stroke-dasharray='8%2c 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e");
  border-radius: 12px;
}
[data-theme="light"] .dashed-border {
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='12' ry='12' stroke='%2300000014' stroke-width='2' stroke-dasharray='8%2c 6' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e");
}

/* Login / auth page animations */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fade-in-up 0.5s ease-out forwards; }
.animate-fade-in-delay-1 { animation: fade-in-up 0.5s ease-out 0.1s forwards; opacity: 0; }
.animate-fade-in-delay-2 { animation: fade-in-up 0.5s ease-out 0.2s forwards; opacity: 0; }
.animate-fade-in-delay-3 { animation: fade-in-up 0.6s ease-out 0.45s forwards; opacity: 0; }

/* Auth button */
.auth-btn {
  transition: all 0.15s ease;
}
.auth-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.auth-btn:active {
  transform: scale(0.985);
}

/* Magic link input */
.magic-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

/* SSO code input */
.code-input {
  caret-color: var(--text-primary);
  transition: all 0.15s ease;
}
.code-input:focus {
  border-color: rgba(59, 130, 246, 0.5);
  background: var(--surface-hover);
}
.code-input.filled {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

/* Radio card */
.radio-card { cursor: pointer; transition: all 0.2s; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card.selected { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.05); }
.radio-card .radio-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.radio-card.selected .radio-dot { border-color: #3b82f6; }
.radio-card.selected .radio-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; }

/* Input field */
.input-field:focus { border-color: rgba(59,130,246,0.5); }

/* Clickable table row */
.row-link { cursor: pointer; }
.row-link:hover { background: var(--surface-subtle); }

/* Activity row highlight (methodology drawer source) */
.activity-highlight { position: relative; }
.activity-highlight::after {
  content: '';
  position: absolute;
  inset: -6px -8px;
  border-radius: 8px;
  border: 1px solid rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.05);
  pointer-events: none;
  animation: activity-highlight-in 0.4s ease-out;
}
@keyframes activity-highlight-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Deviation bar */
.deviation-bar { position: relative; height: 4px; border-radius: 2px; overflow: hidden; }

/* Breadcrumb separator */
.bc-sep { color: var(--text-disabled); margin: 0 2px; }

/* Level container fade (public pages only) */
.level-container { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
body.app-layout .level-container { animation: none; }

/* Channel select card (campaign setup) */
.channel-option { cursor: pointer; transition: all 0.2s; }
.channel-option:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.channel-option.selected { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.05); }

/* Step indicator (campaign setup) */
.step-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; transition: all 0.3s; }
.step-dot.pending { background: var(--surface-hover); border: 1px solid var(--border-medium); color: var(--text-muted); }
.step-dot.active { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); color: #60a5fa; }
.step-dot.done { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.step-line { height: 2px; flex: 1; background: var(--border-default); transition: background 0.3s; }
.step-line.done { background: rgba(16,185,129,0.3); }

/* Step content fade */
.step-content { animation: fadeUp 0.25s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
body.app-layout .step-content { animation: none; }

/* Range slider */
input[type="range"] { -webkit-appearance: none; height: 4px; border-radius: 2px; background: var(--border-medium); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #3b82f6; cursor: pointer; border: 2px solid #1e3a5f; }

/* Onboarding step card */
.step-card { transition: all 0.3s ease; }
.step-card.active { border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.03); }
.step-card.completed { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.03); }

/* Spin slow */
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
.animate-spin-slow { animation: spin-slow 1.5s linear infinite; }

/* Onboarding pulse ring */
@keyframes pulse-ring-box {
  0% { box-shadow: none; }
  70% { box-shadow: none; }
  100% { box-shadow: none; }
}

/* Custom select chevron */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select option {
  background: var(--surface-dropdown);
  color: var(--text-secondary);
}

/* Row hover (admin) */
.row-hover:hover { background: var(--surface-subtle); }

/* Sparkline path animation (analytics) */
@keyframes drawLine {
  from { stroke-dashoffset: 300; }
  to { stroke-dashoffset: 0; }
}
.spark-line { stroke-dasharray: 300; animation: drawLine 1.5s ease-out forwards; }

/* Heatmap cell (analytics) */
.heat-cell { transition: all 0.15s; border-radius: 3px; }
.heat-cell:hover { transform: scale(1.3); z-index: 10; }

/* Campaign dropdown (analytics) */
#campaign-dd-options {
  animation: ddIn 0.15s ease-out;
  transform-origin: top right;
}
@keyframes ddIn {
  from { opacity: 0; transform: scaleY(0.95) translateY(-4px); }
  to { opacity: 1; transform: scaleY(1) translateY(0); }
}
.camp-dd-option[data-selected="true"] { background: rgba(59, 130, 246, 0.05); }
.camp-dd-option[data-selected="true"] .camp-dd-check { opacity: 1; }

/* Print styles (report) */
@media print {
  body.app-layout { overflow: visible; }
  #sidebar-container, #header-container, #footer-container,
  #copy-toast, #share-btn, .period-tab, #channel-dropdown { display: none !important; }
  .rounded-xl { break-inside: avoid; }
}

/* Alerts dropdown animation */
.alerts-dropdown { animation: alerts-slide-down 0.2s ease-out; }
@keyframes alerts-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar drawer (mobile/tablet) */
@media (max-width: 1023px) {
  #sidebar-container > aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  body.sidebar-open #sidebar-container > aside {
    transform: translateX(0);
  }
}

/* Sidebar overlay */
#sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--surface-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
body.sidebar-open #sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Table scroll (mobile) */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile bottom navigation */
.mobile-bottom-nav-inner {
  height: 3.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
#mobile-bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-active {
  color: #60a5fa;
}
.bottom-nav-item:active {
  opacity: 0.7;
}
@media (max-width: 1023px) {
  body.app-layout main {
    padding-bottom: 4rem;
  }
}

/* Import flow row transitions */
.import-row {
  transition: all 0.4s ease;
  overflow: hidden;
}
.import-row.collapsing {
  opacity: 0;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  border-color: transparent !important;
}
.import-row.expanding {
  animation: import-row-expand 0.4s ease forwards;
}
@keyframes import-row-expand {
  from { opacity: 0; max-height: 0; transform: translateY(-8px); }
  to { opacity: 1; max-height: 80px; transform: translateY(0); }
}
.import-row.dimmed {
  opacity: 0.4;
}
.import-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  animation: import-badge-in 0.3s ease forwards;
}
@keyframes import-badge-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
.import-channel-header {
  animation: import-header-slide 0.35s ease forwards;
}
@keyframes import-header-slide {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.import-summary-bar {
  transition: width 1s ease;
}

/* Import simulation — progress bar */
.sim-progress-track {
  height: 3px;
  border-radius: 2px;
  background: var(--border-default);
  overflow: hidden;
}
.sim-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: #3b82f6;
  transition: background 0.5s;
}
.sim-progress-bar.done {
  background: #22c55e;
}

/* Import simulation — KPI cards */
.sim-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: var(--surface-card);
}
@media (min-width: 640px) {
  .sim-kpi-card { padding: 16px 12px; }
}
.sim-kpi-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (min-width: 640px) {
  .sim-kpi-label { font-size: 11px; }
}
.sim-kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
@media (min-width: 640px) {
  .sim-kpi-value { font-size: 24px; }
}
.sim-kpi-delta {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  min-height: 14px;
}
@media (min-width: 640px) {
  .sim-kpi-delta { font-size: 11px; min-height: 16px; }
}
.sim-kpi-delta.up { color: #22c55e; }
.sim-kpi-delta.down { color: #22c55e; }
.sim-kpi-delta.spend { color: #f59e0b; }

/* Import simulation — commentary */
.sim-commentary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(59,130,246,0.05);
  border: 1px solid rgba(59,130,246,0.12);
  margin-bottom: 16px;
  transition: opacity 0.3s;
}
@media (min-width: 640px) {
  .sim-commentary { align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 20px; }
}
.sim-commentary-icon {
  width: 16px;
  height: 16px;
  color: #60a5fa;
  flex-shrink: 0;
  margin-top: 1px;
}
.sim-commentary span {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
@media (min-width: 640px) {
  .sim-commentary span { font-size: 13px; }
}

/* Import simulation — summary banner */
.sim-summary {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(16,185,129,0.2);
  background: rgba(16,185,129,0.05);
  animation: import-row-expand 0.4s ease forwards;
}

/* Import simulation — row fade-out for dead channels */
.import-row.dying {
  opacity: 0.4;
  transition: opacity 0.6s ease;
}
.import-row.dead {
  opacity: 0;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  border-color: transparent !important;
  transition: all 0.5s ease;
}

/* Report highlight row */
.report-highlight {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
}

/* ==============================
   Public Pages — Prose / Typography
   ============================== */

/* Article prose container */
.prose { color: var(--text-tertiary); line-height: 1.8; }
.prose h2 { color: var(--text-primary); font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-default); }
.prose h3 { color: var(--text-secondary); font-size: 1.2rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.prose h4 { color: var(--text-secondary); font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.prose p { margin: 0.75rem 0; }
.prose a { color: #60a5fa; text-decoration: none; transition: color 0.15s; }
.prose a:hover { color: #93c5fd; }
.prose strong { color: var(--text-secondary); font-weight: 600; }
.prose ul, .prose ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--text-faint); }
.prose hr { border: none; border-top: 1px solid var(--border-default); margin: 2.5rem 0; }
.prose blockquote { border-left: 3px solid #3b82f6; padding: 0.75rem 1rem; margin: 1rem 0; background: rgba(59,130,246,0.05); border-radius: 0 8px 8px 0; }
.prose code { background: var(--surface-hover); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.9em; color: var(--text-secondary); }
.prose pre { background: var(--surface-muted); border: 1px solid var(--border-default); border-radius: 8px; padding: 1rem 1.25rem; overflow-x: auto; margin: 1rem 0; }
.prose pre code { background: none; padding: 0; font-size: 0.85rem; color: var(--text-tertiary); }

/* Prose tables */
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.prose thead th { text-align: left; padding: 0.6rem 0.75rem; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border-medium); white-space: nowrap; }
.prose tbody td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-default); }
.prose tbody tr:hover { background: var(--surface-subtle); }

/* Table of contents sidebar */
.toc { position: sticky; top: 5rem; }
.toc a { display: block; padding: 0.3rem 0; color: var(--text-muted); font-size: 0.85rem; text-decoration: none; transition: color 0.15s; border-left: 2px solid transparent; padding-left: 0.75rem; }
.toc a:hover { color: var(--text-secondary); }
.toc a.active { color: #60a5fa; border-left-color: #3b82f6; }

/* Docs sidebar navigation */
.docs-sidebar { position: sticky; top: 5rem; }
.docs-sidebar a { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-radius: 6px; color: var(--text-tertiary); font-size: 0.9rem; text-decoration: none; transition: all 0.15s; }
.docs-sidebar a:hover { color: var(--text-secondary); background: var(--surface-hover); }
.docs-sidebar a.active { color: #60a5fa; background: rgba(59,130,246,0.08); font-weight: 500; }
.docs-sidebar .section-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding: 0.5rem 0.75rem; margin-top: 1rem; }

/* Blog article card */
.article-card { border: 1px solid var(--border-default); border-radius: 12px; background: var(--surface-subtle); padding: 1.5rem; transition: all 0.2s; }
.article-card:hover { border-color: var(--border-medium); background: var(--surface-hover); transform: translateY(-2px); }

/* Docs section card */
.doc-card { border: 1px solid var(--border-default); border-radius: 12px; background: var(--surface-subtle); padding: 1.5rem; transition: all 0.2s; }
.doc-card:hover { border-color: var(--border-medium); background: var(--surface-hover); }
.doc-card.coming-soon { opacity: 0.5; pointer-events: none; }
