:root {
  /* ─── Premium Color Palette (Outfit/Inter) ─── */
  --bg: #09090b;
  --bg-subtle: #121214;
  --bg-elevated: #1a1a1c;
  --glass: rgba(26, 26, 28, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-glow: rgba(59, 130, 246, 0.35);
  
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --main-bg-gradient: radial-gradient(circle at top right, #1a1a1f, var(--bg));
  --hover-soft: rgba(255, 255, 255, 0.04);
  --hover-soft-strong: rgba(255, 255, 255, 0.06);
  --row-hover: rgba(255, 255, 255, 0.02);
  --table-head-bg: rgba(255, 255, 255, 0.03);
  --form-section-bg: rgba(255, 255, 255, 0.02);
  --modal-overlay: rgba(0, 0, 0, 0.7);
  --modal-footer-bg: rgba(0, 0, 0, 0.2);
  --loading-overlay-bg: rgba(0, 0, 0, 0.85);
  --spinner-track: rgba(255, 255, 255, 0.1);
  --on-primary: #ffffff;
}

/* ─── Clay Palette (light, cream-tinted) ─── */
body[data-theme="clay"] {
  --bg: #fffaf0;
  --bg-subtle: #faf5e8;
  --bg-elevated: #f5f0e0;
  --glass: rgba(255, 250, 240, 0.85);
  --glass-border: rgba(10, 10, 10, 0.1);

  --primary: #0a0a0a;
  --primary-hover: #1f1f1f;
  --primary-glow: rgba(184, 164, 237, 0.45);

  --text: #0a0a0a;
  --text-muted: #6a6a6a;
  --text-dim: #9a9a9a;

  --accent: #ff4d8b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(10, 10, 10, 0.06);
  --shadow-lg: 0 12px 32px rgba(10, 10, 10, 0.1);

  --main-bg-gradient: radial-gradient(circle at top right, #faf5e8, var(--bg));
  --hover-soft: rgba(10, 10, 10, 0.04);
  --hover-soft-strong: rgba(10, 10, 10, 0.06);
  --row-hover: rgba(10, 10, 10, 0.025);
  --table-head-bg: rgba(10, 10, 10, 0.04);
  --form-section-bg: rgba(10, 10, 10, 0.025);
  --modal-overlay: rgba(26, 58, 58, 0.45);
  --modal-footer-bg: rgba(10, 10, 10, 0.04);
  --loading-overlay-bg: rgba(255, 250, 240, 0.85);
  --spinner-track: rgba(10, 10, 10, 0.1);
  --on-primary: #ffffff;
  --card-hover-border: rgba(10, 10, 10, 0.18);
}

body[data-theme="clay"] .sidebar {
  background: var(--bg-subtle);
}

body[data-theme="clay"] .badge--pending { background: rgba(245, 158, 11, 0.18); color: #b45309; }
body[data-theme="clay"] .badge--generating { background: rgba(59, 130, 246, 0.18); color: #1d4ed8; }
body[data-theme="clay"] .badge--completed { background: rgba(16, 185, 129, 0.18); color: #047857; }
body[data-theme="clay"] .badge--failed { background: rgba(239, 68, 68, 0.18); color: #b91c1c; }

body[data-theme="clay"] .seo-pill--pass { color: #047857; }
body[data-theme="clay"] .seo-pill--warn { color: #b45309; }
body[data-theme="clay"] .seo-pill--fail { color: #b91c1c; }
body[data-theme="clay"] .seo-pill--stale { color: #6d28d9; }
body[data-theme="clay"] .seo-row--pass .seo-row__icon { color: #047857; }
body[data-theme="clay"] .seo-row--fail .seo-row__icon { color: #b91c1c; }

/* ─── Airtable Palette (white canvas, near-black ink, coral accent) ─── */
body[data-theme="airtable"] {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-border: #dddddd;

  --primary: #181d26;
  --primary-hover: #0d1218;
  --primary-glow: rgba(27, 97, 201, 0.22);

  --text: #181d26;
  --text-muted: #41454d;
  --text-dim: #9297a0;

  --accent: #aa2d00;
  --success: #006400;
  --warning: #d9a441;
  --danger: #aa2d00;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(24, 29, 38, 0.05);
  --shadow-lg: 0 8px 24px rgba(24, 29, 38, 0.08);

  --main-bg-gradient: #ffffff;
  --hover-soft: rgba(24, 29, 38, 0.04);
  --hover-soft-strong: rgba(24, 29, 38, 0.06);
  --row-hover: rgba(24, 29, 38, 0.025);
  --table-head-bg: #f8fafc;
  --form-section-bg: #f8fafc;
  --modal-overlay: rgba(24, 29, 38, 0.5);
  --modal-footer-bg: #f8fafc;
  --loading-overlay-bg: rgba(255, 255, 255, 0.85);
  --spinner-track: rgba(24, 29, 38, 0.1);
  --on-primary: #ffffff;
  --card-hover-border: #9297a0;
}

body[data-theme="airtable"] .sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--glass-border);
}

body[data-theme="airtable"] .badge--pending { background: rgba(217, 164, 65, 0.18); color: #8a5a00; }
body[data-theme="airtable"] .badge--generating { background: rgba(27, 97, 201, 0.15); color: #1a3866; }
body[data-theme="airtable"] .badge--completed { background: rgba(0, 100, 0, 0.15); color: #006400; }
body[data-theme="airtable"] .badge--failed { background: rgba(170, 45, 0, 0.15); color: #aa2d00; }

body[data-theme="airtable"] .seo-pill--pass { color: #006400; }
body[data-theme="airtable"] .seo-pill--warn { color: #8a5a00; }
body[data-theme="airtable"] .seo-pill--fail { color: #aa2d00; }
body[data-theme="airtable"] .seo-pill--stale { color: #1a3866; }
body[data-theme="airtable"] .seo-row--pass .seo-row__icon { color: #006400; }
body[data-theme="airtable"] .seo-row--fail .seo-row__icon { color: #aa2d00; }

/* ─── Claude Palette (warm cream canvas, coral accent, dark navy product chrome) ─── */
body[data-theme="claude"] {
  --bg: #faf9f5;
  --bg-subtle: #f5f0e8;
  --bg-elevated: #efe9de;
  --glass: rgba(250, 249, 245, 0.9);
  --glass-border: #e6dfd8;

  --primary: #cc785c;
  --primary-hover: #a9583e;
  --primary-glow: rgba(204, 120, 92, 0.28);

  --text: #141413;
  --text-muted: #6c6a64;
  --text-dim: #8e8b82;

  --accent: #5db8a6;
  --success: #5db872;
  --warning: #d4a017;
  --danger: #c64545;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(20, 20, 19, 0.06);
  --shadow-lg: 0 10px 28px rgba(20, 20, 19, 0.1);

  --main-bg-gradient: var(--bg);
  --hover-soft: rgba(20, 20, 19, 0.04);
  --hover-soft-strong: rgba(20, 20, 19, 0.06);
  --row-hover: rgba(20, 20, 19, 0.025);
  --table-head-bg: #f5f0e8;
  --form-section-bg: #f5f0e8;
  --modal-overlay: rgba(24, 23, 21, 0.5);
  --modal-footer-bg: #f5f0e8;
  --loading-overlay-bg: rgba(250, 249, 245, 0.85);
  --spinner-track: rgba(20, 20, 19, 0.1);
  --on-primary: #ffffff;
  --card-hover-border: #cc785c;
}

body[data-theme="claude"] .sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--glass-border);
}

body[data-theme="claude"] .badge--pending { background: rgba(212, 160, 23, 0.18); color: #8a6500; }
body[data-theme="claude"] .badge--generating { background: rgba(204, 120, 92, 0.2); color: #a9583e; }
body[data-theme="claude"] .badge--completed { background: rgba(93, 184, 114, 0.18); color: #2f6f3f; }
body[data-theme="claude"] .badge--failed { background: rgba(198, 69, 69, 0.18); color: #8a2a2a; }

body[data-theme="claude"] .seo-pill--pass { color: #2f6f3f; }
body[data-theme="claude"] .seo-pill--warn { color: #8a6500; }
body[data-theme="claude"] .seo-pill--fail { color: #8a2a2a; }
body[data-theme="claude"] .seo-pill--stale { color: #a9583e; }
body[data-theme="claude"] .seo-row--pass .seo-row__icon { color: #2f6f3f; }
body[data-theme="claude"] .seo-row--fail .seo-row__icon { color: #8a2a2a; }

/* ─── Mintlify Palette (airy white canvas, near-black text, brand-green accent) ─── */
body[data-theme="mintlify"] {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.05);

  --primary: #0d0d0d;
  --primary-hover: #000000;
  --primary-glow: rgba(24, 226, 153, 0.35);

  --text: #0d0d0d;
  --text-muted: #666666;
  --text-dim: #888888;

  --accent: #18e299;
  --success: #0fa76e;
  --warning: #c37d0d;
  --danger: #d45656;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 6px 18px rgba(0, 0, 0, 0.06);

  --main-bg-gradient: #ffffff;
  --hover-soft: rgba(0, 0, 0, 0.04);
  --hover-soft-strong: rgba(0, 0, 0, 0.06);
  --row-hover: rgba(0, 0, 0, 0.025);
  --table-head-bg: #fafafa;
  --form-section-bg: #fafafa;
  --modal-overlay: rgba(13, 13, 13, 0.45);
  --modal-footer-bg: #fafafa;
  --loading-overlay-bg: rgba(255, 255, 255, 0.85);
  --spinner-track: rgba(0, 0, 0, 0.08);
  --on-primary: #ffffff;
  --card-hover-border: rgba(0, 0, 0, 0.12);
}

body[data-theme="mintlify"] .sidebar {
  background: #ffffff;
  border-right: 1px solid var(--glass-border);
}

body[data-theme="mintlify"] .sidebar__nav a.active {
  color: var(--text);
  background: #d4fae8;
  box-shadow: inset 0 0 0 1px #18e299;
}

body[data-theme="mintlify"] .badge--pending { background: rgba(195, 125, 13, 0.15); color: #8a5800; }
body[data-theme="mintlify"] .badge--generating { background: #d4fae8; color: #0fa76e; }
body[data-theme="mintlify"] .badge--completed { background: #d4fae8; color: #0fa76e; }
body[data-theme="mintlify"] .badge--failed { background: rgba(212, 86, 86, 0.15); color: #b03333; }

body[data-theme="mintlify"] .seo-pill--pass { color: #0fa76e; }
body[data-theme="mintlify"] .seo-pill--warn { color: #8a5800; }
body[data-theme="mintlify"] .seo-pill--fail { color: #b03333; }
body[data-theme="mintlify"] .seo-pill--stale { color: #3772cf; }
body[data-theme="mintlify"] .seo-row--pass .seo-row__icon { color: #0fa76e; }
body[data-theme="mintlify"] .seo-row--fail .seo-row__icon { color: #b03333; }

/* ─── Sentry Palette (deep purple-black IDE atmosphere with lime accent) ─── */
body[data-theme="sentry"] {
  --bg: #1f1633;
  --bg-subtle: #150f23;
  --bg-elevated: #2a1f44;
  --glass: rgba(54, 45, 89, 0.55);
  --glass-border: #362d59;

  --primary: #79628c;
  --primary-hover: #6a5fc1;
  --primary-glow: rgba(194, 239, 78, 0.3);

  --text: #ffffff;
  --text-muted: #cfcfdb;
  --text-dim: #9b94b8;

  --accent: #c2ef4e;
  --success: #c2ef4e;
  --warning: #ffb287;
  --danger: #fa7faa;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 13px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 12px 28px rgba(22, 15, 36, 0.55);

  --main-bg-gradient: radial-gradient(circle at top right, #2a1f44, var(--bg));
  --hover-soft: rgba(255, 255, 255, 0.05);
  --hover-soft-strong: rgba(255, 255, 255, 0.08);
  --row-hover: rgba(255, 255, 255, 0.03);
  --table-head-bg: rgba(54, 45, 89, 0.4);
  --form-section-bg: rgba(54, 45, 89, 0.25);
  --modal-overlay: rgba(15, 10, 30, 0.75);
  --modal-footer-bg: rgba(21, 15, 35, 0.6);
  --loading-overlay-bg: rgba(15, 10, 30, 0.85);
  --spinner-track: rgba(255, 255, 255, 0.12);
  --on-primary: #ffffff;
  --card-hover-border: #6a5fc1;
}

body[data-theme="sentry"] .sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--glass-border);
}

body[data-theme="sentry"] .btn--primary {
  border: 1px solid #584674;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 14px var(--primary-glow);
}
body[data-theme="sentry"] .btn--primary:hover {
  background: var(--primary-hover);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}

body[data-theme="sentry"] .sidebar__nav a.active {
  background: rgba(106, 95, 193, 0.25);
  box-shadow: inset 0 0 0 1px #6a5fc1;
}

body[data-theme="sentry"] .badge--pending { background: rgba(255, 178, 135, 0.18); color: #ffb287; }
body[data-theme="sentry"] .badge--generating { background: rgba(106, 95, 193, 0.25); color: #c2ef4e; }
body[data-theme="sentry"] .badge--completed { background: rgba(194, 239, 78, 0.18); color: #c2ef4e; }
body[data-theme="sentry"] .badge--failed { background: rgba(250, 127, 170, 0.18); color: #fa7faa; }

body[data-theme="sentry"] .seo-pill--pass { background: rgba(194, 239, 78, 0.15); color: #c2ef4e; border-color: rgba(194, 239, 78, 0.35); }
body[data-theme="sentry"] .seo-pill--warn { background: rgba(255, 178, 135, 0.15); color: #ffb287; border-color: rgba(255, 178, 135, 0.35); }
body[data-theme="sentry"] .seo-pill--fail { background: rgba(250, 127, 170, 0.15); color: #fa7faa; border-color: rgba(250, 127, 170, 0.35); }
body[data-theme="sentry"] .seo-pill--stale { background: rgba(106, 95, 193, 0.18); color: #b8aef0; border-color: rgba(106, 95, 193, 0.4); }
body[data-theme="sentry"] .seo-row--pass .seo-row__icon { color: #c2ef4e; }
body[data-theme="sentry"] .seo-row--fail .seo-row__icon { color: #fa7faa; }

/* ─── Vercel Palette (gallery-white canvas, near-black text, shadow-as-border) ─── */
body[data-theme="vercel"] {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.08);

  --primary: #171717;
  --primary-hover: #000000;
  --primary-glow: rgba(0, 114, 245, 0.22);

  --text: #171717;
  --text-muted: #4d4d4d;
  --text-dim: #808080;

  --accent: #0072f5;
  --success: #0bda51;
  --warning: #de1d8d;
  --danger: #ff5b4f;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 8px -8px rgba(0, 0, 0, 0.08), 0 16px 32px rgba(0, 0, 0, 0.06);

  --main-bg-gradient: #ffffff;
  --hover-soft: rgba(0, 0, 0, 0.04);
  --hover-soft-strong: rgba(0, 0, 0, 0.06);
  --row-hover: rgba(0, 0, 0, 0.025);
  --table-head-bg: #fafafa;
  --form-section-bg: #fafafa;
  --modal-overlay: hsla(0, 0%, 12%, 0.5);
  --modal-footer-bg: #fafafa;
  --loading-overlay-bg: rgba(255, 255, 255, 0.85);
  --spinner-track: rgba(0, 0, 0, 0.08);
  --on-primary: #ffffff;
  --card-hover-border: rgba(0, 0, 0, 0.18);
}

body[data-theme="vercel"] .sidebar {
  background: #ffffff;
  border-right: 1px solid #ebebeb;
}

body[data-theme="vercel"] .card {
  border: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 2px rgba(0, 0, 0, 0.04);
}
body[data-theme="vercel"] .card:hover {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
}

body[data-theme="vercel"] .sidebar__nav a.active {
  background: #fafafa;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  color: var(--text);
}

body[data-theme="vercel"] .badge--pending { background: #fff8e1; color: #b45309; }
body[data-theme="vercel"] .badge--generating { background: #ebf5ff; color: #0068d6; }
body[data-theme="vercel"] .badge--completed { background: #ecfdf3; color: #008a3c; }
body[data-theme="vercel"] .badge--failed { background: #fff0ee; color: #b3251c; }

body[data-theme="vercel"] .seo-pill--pass { background: #ecfdf3; color: #008a3c; border-color: rgba(0, 138, 60, 0.25); }
body[data-theme="vercel"] .seo-pill--warn { background: #fff8e1; color: #b45309; border-color: rgba(180, 83, 9, 0.25); }
body[data-theme="vercel"] .seo-pill--fail { background: #fff0ee; color: #b3251c; border-color: rgba(179, 37, 28, 0.25); }
body[data-theme="vercel"] .seo-pill--stale { background: #ebf5ff; color: #0068d6; border-color: rgba(0, 104, 214, 0.25); }
body[data-theme="vercel"] .seo-row--pass .seo-row__icon { color: #008a3c; }
body[data-theme="vercel"] .seo-row--fail .seo-row__icon { color: #b3251c; }

/* ─── Starbucks Palette (warm-cream canvas, four-tier green system, gold rewards accent) ─── */
body[data-theme="starbucks"] {
  --bg: #f2f0eb;
  --bg-subtle: #edebe9;
  --bg-elevated: #ffffff;
  --glass: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.1);

  --primary: #00754A;
  --primary-hover: #006241;
  --primary-glow: rgba(0, 117, 74, 0.3);

  --text: rgba(0, 0, 0, 0.87);
  --text-muted: rgba(0, 0, 0, 0.58);
  --text-dim: rgba(0, 0, 0, 0.45);

  --accent: #cba258;
  --success: #00754A;
  --warning: #fbbc05;
  --danger: #c82014;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 0 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 12px rgba(0, 0, 0, 0.14);

  --main-bg-gradient: var(--bg);
  --hover-soft: rgba(0, 0, 0, 0.05);
  --hover-soft-strong: rgba(0, 0, 0, 0.08);
  --row-hover: rgba(0, 0, 0, 0.03);
  --table-head-bg: #edebe9;
  --form-section-bg: #faf6ee;
  --modal-overlay: rgba(30, 57, 50, 0.55);
  --modal-footer-bg: #edebe9;
  --loading-overlay-bg: rgba(242, 240, 235, 0.85);
  --spinner-track: rgba(0, 0, 0, 0.1);
  --on-primary: #ffffff;
  --card-hover-border: #00754A;
}

body[data-theme="starbucks"] .sidebar {
  background: #1E3932;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
body[data-theme="starbucks"] .sidebar__brand h1 {
  background: linear-gradient(135deg, #ffffff, #cba258);
  -webkit-background-clip: text;
  background-clip: text;
}
body[data-theme="starbucks"] .sidebar__brand p {
  color: rgba(255, 255, 255, 0.7);
}
body[data-theme="starbucks"] .sidebar__nav a {
  color: rgba(255, 255, 255, 0.78);
}
body[data-theme="starbucks"] .sidebar__nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
body[data-theme="starbucks"] .sidebar__nav a.active {
  color: #ffffff;
  background: rgba(0, 117, 74, 0.55);
  box-shadow: inset 0 0 0 1px #cba258;
}
body[data-theme="starbucks"] .sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
body[data-theme="starbucks"] .sidebar__settings {
  color: rgba(255, 255, 255, 0.78);
  border-color: rgba(255, 255, 255, 0.12);
}
body[data-theme="starbucks"] .sidebar__settings:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

body[data-theme="starbucks"] .btn {
  border-radius: 9999px;
}
body[data-theme="starbucks"] .btn--icon {
  border-radius: 50%;
}
body[data-theme="starbucks"] .btn--primary {
  border: 1px solid var(--primary);
}
body[data-theme="starbucks"] .btn:active {
  transform: scale(0.95);
}

body[data-theme="starbucks"] .badge {
  border-radius: 9999px;
}
body[data-theme="starbucks"] .badge--pending { background: rgba(251, 188, 5, 0.18); color: #8a5e00; }
body[data-theme="starbucks"] .badge--generating { background: rgba(0, 117, 74, 0.16); color: #006241; }
body[data-theme="starbucks"] .badge--completed { background: #d4e9e2; color: #006241; }
body[data-theme="starbucks"] .badge--failed { background: rgba(200, 32, 20, 0.15); color: #c82014; }

body[data-theme="starbucks"] .seo-pill--pass { background: #d4e9e2; color: #006241; border-color: rgba(0, 98, 65, 0.35); }
body[data-theme="starbucks"] .seo-pill--warn { background: rgba(251, 188, 5, 0.18); color: #8a5e00; border-color: rgba(138, 94, 0, 0.3); }
body[data-theme="starbucks"] .seo-pill--fail { background: rgba(200, 32, 20, 0.13); color: #c82014; border-color: rgba(200, 32, 20, 0.35); }
body[data-theme="starbucks"] .seo-pill--stale { background: #faf6ee; color: #8a6a1f; border-color: rgba(203, 162, 88, 0.4); }
body[data-theme="starbucks"] .seo-row--pass .seo-row__icon { color: #006241; }
body[data-theme="starbucks"] .seo-row--fail .seo-row__icon { color: #c82014; }

/* ─── PostHog Palette (warm sage-cream canvas, olive ink, hidden orange hover accent) ─── */
body[data-theme="posthog"] {
  --bg: #fdfdf8;
  --bg-subtle: #eeefe9;
  --bg-elevated: #ffffff;
  --glass: rgba(253, 253, 248, 0.92);
  --glass-border: #bfc1b7;

  --primary: #1e1f23;
  --primary-hover: #2c2d33;
  --primary-glow: rgba(245, 78, 0, 0.28);

  --text: #23251d;
  --text-muted: #4d4f46;
  --text-dim: #9ea096;

  --accent: #F54E00;
  --success: #4d7c0f;
  --warning: #F7A501;
  --danger: #b3251c;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;

  --shadow-sm: 0 1px 0 rgba(35, 37, 29, 0.05);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  --main-bg-gradient: var(--bg);
  --hover-soft: #f4f4f4;
  --hover-soft-strong: #eeefe9;
  --row-hover: rgba(35, 37, 29, 0.03);
  --table-head-bg: #eeefe9;
  --form-section-bg: #eeefe9;
  --modal-overlay: rgba(35, 37, 29, 0.55);
  --modal-footer-bg: #eeefe9;
  --loading-overlay-bg: rgba(253, 253, 248, 0.85);
  --spinner-track: rgba(35, 37, 29, 0.1);
  --on-primary: #ffffff;
  --card-hover-border: #65675e;
}

body[data-theme="posthog"] .sidebar {
  background: #eeefe9;
  border-right: 1px solid var(--glass-border);
}

body[data-theme="posthog"] .card {
  border: 1px solid var(--glass-border);
}

body[data-theme="posthog"] .sidebar__nav a:hover,
body[data-theme="posthog"] .btn--secondary:hover,
body[data-theme="posthog"] .activity-item--clickable:hover {
  color: #F54E00;
}

body[data-theme="posthog"] .btn--primary:hover {
  background: var(--primary);
  color: #F7A501;
  opacity: 0.9;
}

body[data-theme="posthog"] .sidebar__nav a.active {
  background: #e5e7e0;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}

body[data-theme="posthog"] .badge--pending { background: rgba(247, 165, 1, 0.18); color: #8a5e00; }
body[data-theme="posthog"] .badge--generating { background: rgba(245, 78, 0, 0.15); color: #b03a00; }
body[data-theme="posthog"] .badge--completed { background: rgba(77, 124, 15, 0.16); color: #3d6300; }
body[data-theme="posthog"] .badge--failed { background: rgba(179, 37, 28, 0.15); color: #b3251c; }

body[data-theme="posthog"] .seo-pill--pass { background: rgba(77, 124, 15, 0.14); color: #3d6300; border-color: rgba(77, 124, 15, 0.35); }
body[data-theme="posthog"] .seo-pill--warn { background: rgba(247, 165, 1, 0.16); color: #8a5e00; border-color: rgba(138, 94, 0, 0.3); }
body[data-theme="posthog"] .seo-pill--fail { background: rgba(179, 37, 28, 0.13); color: #b3251c; border-color: rgba(179, 37, 28, 0.3); }
body[data-theme="posthog"] .seo-pill--stale { background: rgba(245, 78, 0, 0.12); color: #b03a00; border-color: rgba(245, 78, 0, 0.3); }
body[data-theme="posthog"] .seo-row--pass .seo-row__icon { color: #3d6300; }
body[data-theme="posthog"] .seo-row--fail .seo-row__icon { color: #b3251c; }

/* ─── Base Styles ─── */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4, .outfit {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; outline: none; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row--between { justify-content: space-between; }

/* ─── Layout ─── */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--glass-border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  position: relative;
}

.sidebar__brand h1 {
  margin: 0;
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--text), var(--text-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar__brand p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.sidebar__nav a {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar__nav a:hover {
  color: var(--text);
  background: var(--hover-soft);
}

.sidebar__nav a.active {
  color: var(--text);
  background: var(--primary-glow);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.sidebar__footer {
  margin-top: auto;
  border-top: 1px solid var(--glass-border);
  padding-top: 24px;
}

/* ─── Main Content Area ─── */
.main {
  background: var(--main-bg-gradient);
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.topbar h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
}

.topbar p {
  margin: 8px 0 0;
  font-size: 1rem;
}

/* ─── Dashboard Components ─── */
.card {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--card-hover-border, rgba(255, 255, 255, 0.15));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.grid {
  display: grid;
  gap: 24px;
}

.grid--clients {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid--two {
  grid-template-columns: 1fr 1fr;
}

/* ─── Inputs & Buttons ─── */
.btn {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn--primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn--secondary {
  background: transparent;
  border-color: var(--glass-border);
}

.btn--secondary:hover {
  background: var(--hover-soft-strong);
  border-color: var(--text-dim);
}

.btn--danger {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn--danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn--icon {
  padding: 8px;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.btn--icon svg {
  display: block;
}

.input, .select, .textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: var(--transition);
}

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

/* ─── Form sections, radios, checkboxes ─── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group > label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--form-section-bg);
}
.form-section__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.9;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.radio, .checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-size: 0.9rem;
}
.radio:hover, .checkbox:hover {
  background: var(--hover-soft);
}
.radio input, .checkbox input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

@media (min-width: 720px) {
  .radio-group { flex-direction: row; flex-wrap: wrap; }
}

/* ─── Tables ─── */
.table-wrap {
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 16px;
  text-align: left;
  background: var(--table-head-bg);
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.95rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--row-hover); }

/* ─── Badges ─── */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
}

.badge--pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge--generating { background: rgba(59, 130, 246, 0.15); color: #60a5fa; animation: pulse 2s infinite; }
.badge--completed { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge--failed { background: rgba(239, 68, 68, 0.15); color: #f87171; }

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

/* ─── SEO Checks ─── */
.seo-summary { min-height: 24px; }
.seo-summary__empty { font-size: 0.8rem; }
.seo-summary__time { font-size: 0.75rem; margin-top: 4px; }

.seo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seo-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.seo-pill--pass { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.seo-pill--warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.seo-pill--fail { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.seo-pill--skip { background: rgba(161, 161, 170, 0.12); color: var(--text-muted); border-color: var(--glass-border); }
.seo-pill--stale { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.3); }

.seo-row {
  display: grid;
  grid-template-columns: 24px 220px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9rem;
}
.seo-row:last-child { border-bottom: none; }

.seo-row__icon {
  font-weight: 700;
  text-align: center;
  font-size: 1rem;
}

.seo-row--pass .seo-row__icon { color: #34d399; }
.seo-row--fail .seo-row__icon { color: #f87171; }
.seo-row--skip .seo-row__icon { color: var(--text-dim); }

.seo-row__label { font-weight: 500; }
.seo-row__detail { color: var(--text-muted); font-size: 0.85rem; word-break: break-word; }

/* ─── Tabs ─── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.tab {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ─── Modals ─── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--modal-overlay);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-root.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 640px;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition);
}

.modal__header,
.modal__footer {
  flex: 0 0 auto;
}

.modal-root.open .modal {
  transform: scale(1);
}

.modal__header {
  padding: 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__body {
  padding: 24px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.modal__footer {
  padding: 24px;
  background: var(--modal-footer-bg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ─── Loading ─── */
.loading-overlay {
  background: var(--loading-overlay-bg);
  backdrop-filter: blur(4px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--spinner-track);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Login Screen ─── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--main-bg-gradient);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 8px;
}

.login-brand h1 {
  margin: 0;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--text), var(--text-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-brand p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.85;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: var(--transition);
}

.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
}

.btn--block {
  width: 100%;
}

/* ─── Responsiveness ─── */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    align-items: center;
    padding: 16px 24px;
    gap: 20px;
  }
  .sidebar__nav { flex-direction: row; }
  .sidebar__footer, .sidebar__brand p { display: none; }
}

/* ─── Job Indicators ─── */
.job-indicators {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.job-indicator {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.2s ease-out;
}
.job-indicator__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.job-indicator__title {
  font-size: 0.95rem;
}
.job-indicator__status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 999px;
}
.job-indicator__bar {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.job-indicator__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}
.job-indicator__step {
  margin-top: 6px;
  font-size: 0.8rem;
}
.job-indicator--done .job-indicator__fill { background: var(--success); }
.job-indicator--failed .job-indicator__fill { background: var(--danger); }

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

.activity-item--clickable {
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.activity-item--clickable:hover {
  background: var(--bg-elevated);
  border-color: var(--primary-glow);
}

/* ─── Sidebar Settings (gear) ─── */
.sidebar__settings {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  font-weight: 500;
}
.sidebar__settings:hover {
  color: var(--text);
  background: var(--hover-soft);
  border-color: var(--text-dim);
}
.sidebar__settings svg {
  flex: 0 0 auto;
}

/* ─── Theme Picker ─── */
.theme-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.theme-option {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.theme-option:hover {
  border-color: var(--text-dim);
}
.theme-option.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}
.theme-option__name {
  font-weight: 600;
  color: var(--text);
}
.theme-option__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.theme-option__swatches {
  display: flex;
  gap: 6px;
}
.theme-option__swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}
