/* ════════════════════════════════════════════════════════════════════
   Marketing OS — Glass / Aurora Design System
   ════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────── */
:root {
  /* base surfaces */
  --bg:           #07070e;
  --bg-elevated:  #12121d;
  --bg-surface:   #181826;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.16);
  --text:         #f1f1fa;
  --text-2:       #a6a6c8;
  --text-3:       #62627e;

  /* accents */
  --accent:       #7c6af7;
  --accent-h:     #9182ff;
  --accent-2:     #3b9bf6;
  --accent-3:     #d761f0;
  --accent-dim:   rgba(124,106,247,0.14);
  --accent-glow:  0 0 28px rgba(124,106,247,0.30);

  /* status */
  --green:        #22c55e;
  --amber:        #eab308;
  --red:          #ef4444;
  --blue:         #3b82f6;

  /* glass tokens — the heart of the look */
  --glass-bg:        rgba(20,20,34,0.55);
  --glass-bg-strong: rgba(20,20,34,0.74);
  --glass-border:    rgba(255,255,255,0.09);
  --glass-hi:        rgba(255,255,255,0.10);
  --glass-blur:      18px;
  /* beveled "liquid glass" rim — layered insets fake refracted edges (via 21st.dev inspiration) */
  --glass-shadow:    0 10px 34px rgba(0,0,0,0.42),
                     inset 0 1px 0 var(--glass-hi),
                     inset 1px 1px 1px -0.5px rgba(255,255,255,0.07),
                     inset -1px -1px 1px -0.5px rgba(0,0,0,0.55),
                     inset 0 0 14px 2px rgba(255,255,255,0.02);

  /* geometry */
  --sidebar-w:    240px;
  --nav-h:        58px;
  --r:            12px;
  --r-lg:         18px;
  --shadow-card:  var(--glass-shadow);
  --shadow-modal: 0 30px 90px rgba(0,0,0,0.6), 0 0 0 1px var(--glass-border), inset 0 1px 0 var(--glass-hi);
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Aurora background — fixed, drifting colour fields behind everything */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(38% 46% at 12% 8%,  rgba(124,106,247,0.30), transparent 70%),
    radial-gradient(34% 42% at 88% 12%, rgba(59,155,246,0.24),  transparent 70%),
    radial-gradient(42% 48% at 78% 88%, rgba(215,97,240,0.18),  transparent 70%),
    radial-gradient(40% 46% at 8%  92%, rgba(6,182,212,0.16),   transparent 70%);
  filter: saturate(1.15);
  animation: aurora-drift 26s ease-in-out infinite alternate;
}
/* fine grain so the gradients never band */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes aurora-drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2.5%, 1.5%, 0) scale(1.08); }
  100% { transform: translate3d(-2%, -2%, 0) scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

a { color: inherit; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(5,5,9,0.94);
  backdrop-filter: blur(22px) saturate(1);
  -webkit-backdrop-filter: blur(22px) saturate(1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--glass-border);
  transition: transform 0.32s cubic-bezier(0.22,1,0.36,1);
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(110deg, #b3a6ff 0%, #7c6af7 45%, #4ea3ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-logo .logo-sub {
  font-size: 0.67rem;
  color: var(--text-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  -webkit-text-fill-color: var(--text-3);
}
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section-label {
  padding: 14px 20px 6px;
  font-size: 0.62rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  margin: 1px 10px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  position: relative;
  transition: color 0.18s, background 0.18s, transform 0.18s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(100deg, var(--accent-dim), rgba(59,155,246,0.07));
  box-shadow: inset 0 0 0 1px rgba(124,106,247,0.22);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-h), var(--accent-2));
  box-shadow: 0 0 12px rgba(124,106,247,0.7);
}
.nav-item .nav-icon {
  font-size: 0.96rem;
  width: 20px;
  text-align: center;
  opacity: 0.9;
}
.nav-divider { border: none; border-top: 1px solid var(--border); margin: 8px 14px; }

/* Brand dot — reused by the brand switcher (old .brand-tab/.brand-add-btn rules
   removed; that markup was replaced by the profile switcher). */
.brand-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }

/* ── Collapsible nav folders ──────────────────────────────────────── */
.nav-group { margin: 2px 0; }
.nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: calc(100% - 20px); margin: 6px 10px 2px; padding: 7px 10px;
  background: transparent; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.62rem; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 1.2px; border-radius: 8px;
}
.nav-group-toggle:hover { color: var(--text-2); background: rgba(255,255,255,0.04); }
.nav-caret { font-size: 0.6rem; opacity: 0.65; transition: transform .2s; }
.nav-group:not(.open) > .nav-group-toggle .nav-caret { transform: rotate(-90deg); }
.nav-group-body { max-height: 0; overflow: hidden; }
/* ── collapsible sidebar: « shrinks it to an icon rail (remembered); hover an icon for its name ── */
.credit-warn { margin-left: 10px; font-size: .74rem; font-weight: 800; padding: 4px 11px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.credit-warn.out { background: rgba(248,113,113,.16); color: #f87171; border: 1px solid rgba(248,113,113,.5); }
.credit-warn.low { background: rgba(251,191,36,.14); color: #fbbf24; border: 1px solid rgba(251,191,36,.45); }
[data-theme="light"] .credit-warn.out { color: #b91c1c; } [data-theme="light"] .credit-warn.low { color: #a16207; }
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-rail-btn { border: 1px solid var(--border); background: none; color: var(--text-3); border-radius: 8px; width: 28px; height: 26px;
  cursor: pointer; font-size: .9rem; line-height: 1; margin-bottom: 10px; transition: color .15s, background .15s; }
.sb-rail-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
html.sb-rail { --sidebar-w: 68px; }
html.sb-rail .sidebar-logo { padding: 16px 8px 12px; text-align: center; }
html.sb-rail .sidebar-logo .logo-mark { font-size: 0; } html.sb-rail .sidebar-logo .logo-mark::first-letter { font-size: 1.3rem; }
html.sb-rail .sidebar-logo .logo-sub, html.sb-rail .os-switch, html.sb-rail .back-home { display: none; }
html.sb-rail .sb-top { justify-content: center; }
html.sb-rail .sb-rail-btn { transform: rotate(180deg); }
html.sb-rail .nav-item { font-size: 0; justify-content: center; padding: 10px 0; margin: 1px 8px; gap: 0; }
html.sb-rail .nav-item .nav-icon { font-size: 1.05rem; width: auto; }
html.sb-rail .nav-item .fav-star, html.sb-rail .nav-item .fav-t, html.sb-rail .nav-badge, html.sb-rail .badge { display: none; }
html.sb-rail .nav-group-toggle { font-size: 0; height: 1px; padding: 0; margin: 8px 14px; background: var(--border); pointer-events: none; }
html.sb-rail .nav-group-body { max-height: none !important; }
html.sb-rail .nav-section-label, html.sb-rail .fav-hint, html.sb-rail .nav-caret { display: none; }
html.sb-rail .nav-group-body > div:not(.nav-item) { display: none; }   /* in-group sub-labels like "Manage" */
html.sb-rail .sidebar-nav .nav-item { padding-right: 0; }
html.sb-rail .brand-switcher-name, html.sb-rail .sidebar .brand-name { display: none; }
.nav-group.open > .nav-group-body { max-height: 760px; }
.sidebar-nav.nav-anim .nav-group-body { transition: max-height .26s cubic-bezier(0.22,1,0.36,1); }

/* ── Brand switcher / profile menu (sidebar footer) ───────────────── */
.sidebar-profile { position: relative; padding: 10px; border-top: 1px solid var(--border); }
.profile-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 10px; cursor: pointer; font-family: inherit;
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.profile-trigger:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.05); }
.profile-trigger img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.profile-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-caret { opacity: 0.6; font-size: 0.7rem; transition: transform .2s; }
.sidebar-profile.open .profile-caret { transform: rotate(180deg); }
.profile-alldot { background: linear-gradient(120deg, #7c6af7, #4ea3ff); box-shadow: none; }
.switcher-popover {
  position: absolute; left: 10px; right: 10px; bottom: 100%; margin-bottom: 8px;
  background: var(--bg-surface, #12121a); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; z-index: 120;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.55);
  max-height: calc(100vh - 120px); overflow-y: auto;
}
.switcher-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; color: var(--text-2); text-decoration: none;
  font-size: 0.82rem; font-weight: 500;
}
.switcher-item:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.switcher-item.active { color: var(--text); background: rgba(255,255,255,0.05); }
.switcher-item img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.switcher-item .switcher-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-check { color: var(--accent-h); font-size: 0.78rem; }
.switcher-alldot, .switcher-ic { width: 18px; text-align: center; opacity: 0.7; flex-shrink: 0; }
.switcher-item.add { color: var(--accent-h); }
.switcher-divider { height: 1px; background: var(--border); margin: 5px 6px; }

/* Respect reduced-motion for the new sidebar transitions */
@media (prefers-reduced-motion: reduce) {
  .sidebar-nav.nav-anim .nav-group-body,
  .nav-caret,
  .profile-caret { transition: none; }
}

/* ── Per-widget quick-refresh button ──────────────────────────────── */
.mos-refresh {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  color: var(--text-2); background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); transition: color .15s, background .15s, border-color .15s;
}
.mos-refresh:hover { color: var(--text); border-color: var(--border-hover); background: rgba(255,255,255,0.07); }
.mos-refresh.in-header { position: absolute; top: 0; right: 0; }
.mos-refresh-ico { display: inline-block; font-size: 0.95rem; line-height: 1; }
.mos-refresh.is-running { cursor: default; color: var(--text-3); }
.mos-refresh.is-running .mos-refresh-ico { animation: mos-spin .8s linear infinite; }
.mos-refresh.is-success { color: var(--green); border-color: rgba(34,197,94,0.4); }
.mos-refresh.is-error { color: var(--red); border-color: rgba(239,68,68,0.4); }
@keyframes mos-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mos-refresh.is-running .mos-refresh-ico { animation: none; } }

/* ── Per-graph "last updated" chip ────────────────────────────────── */
.last-updated {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.7rem; font-weight: 500; color: var(--text-3);
  white-space: nowrap; cursor: default;
}
.last-updated .lu-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}
.last-updated.is-stale .lu-dot { background: var(--text-3); box-shadow: none; }
/* header actions cluster (chip + refresh button, top-right of a page-header) */
.ph-actions { position: absolute; top: 0; right: 0; display: flex; align-items: center; gap: 12px; }
/* a chip sitting on a card/section header */
.section-head .last-updated, .card-header .last-updated { margin-left: auto; }

/* ── Main Layout ───────────────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;   /* a flex item defaults to min-width:auto — one wide table/chart would push every page past the screen */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Nav ───────────────────────────────────────────────────────── */
.topnav {
  background: rgba(10,10,18,0.55);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 26px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topnav-hist { display: inline-flex; gap: 4px; margin-right: 4px; }
/* ⏳ activity panel */
.act-wrap { position: relative; }
.act-btn { position: relative; width: 38px; height: 34px; border-radius: 10px; border: 1px solid var(--glass-border, rgba(255,255,255,.1));
  background: rgba(255,255,255,.04); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.act-btn.busy { border-color: rgba(197,240,90,.55); box-shadow: 0 0 0 3px rgba(197,240,90,.12); }
.act-btn.busy .act-ico { animation: act-spin 2.4s linear infinite; display: inline-block; }
.act-btn.nudge { animation: act-nudge .9s ease-in-out 3; }
@keyframes act-nudge { 50% { box-shadow: 0 0 0 7px rgba(197,240,90,.28); transform: scale(1.08); } }
@keyframes act-spin { 0%,40% { transform: rotate(0deg); } 50%,90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.act-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #c5f05a;
  color: #111; font-size: .66rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.act-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(440px, calc(100vw - 24px)); max-height: 72vh; overflow: auto;
  background: var(--bg-surface, #15151f); border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5); padding: 12px; z-index: 1000; }
.act-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.act-h b { font-size: .92rem; }
.act-at { font-size: .7rem; color: var(--text-3); margin-left: auto; }
.act-x { background: transparent; border: 0; color: var(--text-2); cursor: pointer; font-size: .9rem; }
.act-empty { font-size: .82rem; color: var(--text-3); padding: 14px 4px; text-align: center; }
.act-card { border: 1px solid var(--border, rgba(255,255,255,.08)); border-radius: 11px; padding: 10px 12px; margin-bottom: 8px; }
.act-card.done { opacity: .75; } .act-card.failed { border-color: rgba(248,113,113,.4); }
.act-t { display: flex; align-items: center; gap: 7px; font-size: .84rem; min-width: 0; }
.act-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-t em { margin-left: auto; font-style: normal; font-size: .68rem; color: var(--text-3); white-space: nowrap; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: #c5f05a; flex-shrink: 0; }
.act-card.running .act-dot { animation: act-pulse 1.2s ease-in-out infinite; }
.act-card.done .act-dot { background: #4ade80; } .act-card.failed .act-dot { background: #f87171; }
@keyframes act-pulse { 50% { opacity: .3; } }
.act-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; margin: 8px 0 6px; position: relative; }
.act-bar i { display: block; height: 100%; background: #c5f05a; border-radius: 4px; transition: width .5s; }
.act-card.done .act-bar i { background: #4ade80; } .act-card.failed .act-bar i { background: #f87171; }
.act-bar.indet i { position: absolute; animation: act-slide 1.4s ease-in-out infinite; }
@keyframes act-slide { 0% { left: -35%; } 100% { left: 100%; } }
.act-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .74rem; color: var(--text-2); }
.act-meta b { color: var(--text); font-size: .8rem; }
.act-meta a { margin-left: auto; color: #c5f05a; font-weight: 700; text-decoration: none; }
.act-phase { font-size: .76rem; color: var(--text-2); margin-top: 6px; line-height: 1.4; }
.act-log { margin-top: 6px; }
.act-log summary { font-size: .72rem; color: var(--text-3); cursor: pointer; }
.act-log > div { margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .7rem; color: var(--text-2);
  background: rgba(0,0,0,.25); border-radius: 8px; padding: 6px 8px; max-height: 140px; overflow: auto; line-height: 1.5; }
.act-log span { color: var(--text-3); }
[data-theme="light"] .act-btn { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.12); }
.hist-btn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--glass-border, rgba(255,255,255,.1));
  background: rgba(255,255,255,.04); color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s;
}
.hist-btn:hover:not(:disabled) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }
.hist-btn:disabled { opacity: .3; cursor: default; }
[data-theme="light"] .hist-btn { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.12); color: #181830; }
.topnav-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}
.topnav-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.835rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.14s cubic-bezier(0.22,1,0.36,1), box-shadow 0.18s, background 0.18s, border-color 0.18s, color 0.18s;
  font-family: inherit;
  letter-spacing: -0.1px;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(120deg, #9182ff 0%, #7c6af7 50%, #5b8ef7 100%);
  background-size: 160% 160%;
  color: #fff;
  box-shadow: 0 4px 18px rgba(124,106,247,0.40), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover {
  background-position: 100% 0;
  box-shadow: 0 6px 26px rgba(124,106,247,0.55), inset 0 1px 0 rgba(255,255,255,0.3);
  color: #fff;
  transform: translateY(-1px);
}
/* sheen sweep */
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.09);
  color: var(--text);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.btn-danger { background: rgba(239,68,68,0.16); color: #fca5a5; border: 1px solid rgba(239,68,68,0.32); }
.btn-danger:hover { background: rgba(239,68,68,0.26); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(124,106,247,0.08);
  color: var(--accent-h);
  border: 1px solid rgba(124,106,247,0.32);
}
.btn-ghost:hover { background: var(--accent-dim); border-color: var(--accent); color: #fff; transform: translateY(-1px); }
.btn-sm { padding: 5px 11px; font-size: 0.775rem; border-radius: 8px; }
.btn-icon {
  background: none; border: none; cursor: pointer; padding: 7px;
  border-radius: 9px; color: var(--text-3); font-size: 1.05rem;
  position: relative; transition: background 0.18s, color 0.18s;
}
.btn-icon:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Notification bell */
.notif-badge {
  position: absolute; top: 1px; right: 1px;
  background: linear-gradient(135deg, #ff5a5a, #ef4444);
  color: #fff;
  font-size: 0.58rem; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg), 0 0 10px rgba(239,68,68,0.6);
}

/* ── Page Content ──────────────────────────────────────────────────── */
.page-content { padding: 30px; flex: 1; min-width: 0; }
.page-header { margin-bottom: 26px; position: relative; }
.page-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.page-header p { color: var(--text-3); margin-top: 5px; font-size: 0.875rem; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 22px 24px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 14px 44px rgba(0,0,0,0.5), inset 0 1px 0 var(--glass-hi);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-size: 0.92rem; font-weight: 600;
  color: var(--text); letter-spacing: -0.1px;
}
.card-subtitle { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

/* ── Grid Layouts ──────────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Brand Cards ───────────────────────────────────────────────────── */
.brand-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.brand-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-color, var(--accent));
  box-shadow: 0 0 18px var(--brand-color, var(--accent));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.brand-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 90px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-color, var(--accent)) 16%, transparent) 0%, transparent 100%);
  pointer-events: none;
}
.brand-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 1px 0 var(--glass-hi);
}
.brand-card .flex-between { position: relative; z-index: 1; }
.brand-card-header {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 16px;
  position: relative; z-index: 1;
}
.brand-card-icon { font-size: 1.35rem; }
.brand-card-favicon { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; border: 1px solid var(--glass-border); flex-shrink: 0; }
.brand-card-name { font-size: 0.97rem; font-weight: 700; color: var(--text); }
.brand-card-pos { font-size: 0.72rem; color: var(--text-3); text-transform: capitalize; margin-top: 1px; }
.metric-row { display: flex; gap: 10px; margin-bottom: 14px; position: relative; z-index: 1; }
.metric {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  transition: background 0.18s, border-color 0.18s;
}
.metric:hover { background: rgba(255,255,255,0.07); border-color: var(--border-hover); }
.metric-label { font-size: 0.67rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.metric-value { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-top: 3px; letter-spacing: -0.6px; }
.metric-delta { font-size: 0.73rem; margin-top: 2px; }
.metric-delta.up { color: var(--green); }
.metric-delta.down { color: var(--red); }
.metric-delta.text-muted { color: var(--text-3); }

/* ── Status Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.71rem; font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.badge-green  { background: rgba(34,197,94,0.14);  color: #4ade80; border: 1px solid rgba(34,197,94,0.30); }
.badge-green::before { background: var(--green); }
.badge-amber  { background: rgba(234,179,8,0.14);  color: #fcd34d; border: 1px solid rgba(234,179,8,0.30); }
.badge-amber::before { background: var(--amber); }
.badge-red    { background: rgba(239,68,68,0.14);  color: #f87171; border: 1px solid rgba(239,68,68,0.30); }
.badge-red::before { background: var(--red); }
.badge-blue   { background: rgba(59,130,246,0.14); color: #60a5fa; border: 1px solid rgba(59,130,246,0.30); }
.badge-blue::before { background: var(--blue); }
.badge-purple { background: rgba(124,106,247,0.14); color: #a594ff; border: 1px solid rgba(124,106,247,0.30); }
.badge-purple::before { background: var(--accent); }
.badge-gray   { background: rgba(255,255,255,0.05); color: var(--text-3); border: 1px solid var(--border); }
.badge-gray::before { background: var(--text-3); box-shadow: none; }

/* ── Table ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.855rem; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.68rem; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: rgba(255,255,255,0.04); color: var(--text); }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: -0.1px;
}
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.855rem;
  color: var(--text);
  background: rgba(255,255,255,0.04);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(124,106,247,0.18);
}
.form-control::placeholder { color: var(--text-3); }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-elevated); color: var(--text); }
textarea.form-control { resize: vertical; line-height: 1.5; }
.input-group { display: flex; align-items: center; }
.input-group .form-control { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; height: 100%; white-space: nowrap; }
.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 40px; }
.toggle-pw {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-3);
  font-size: 0.9rem; padding: 2px;
  transition: color 0.15s;
}
.toggle-pw:hover { color: var(--text-2); }

/* ── Connector Grid ────────────────────────────────────────────────── */
.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.connector-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  box-shadow: var(--glass-shadow);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, transform 0.18s;
  display: flex; align-items: center; gap: 13px;
}
.connector-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px rgba(124,106,247,0.18), var(--accent-glow);
}
.connector-card.connected { border-color: rgba(34,197,94,0.42); }
.connector-card.connected:hover { border-color: var(--green); box-shadow: 0 0 0 1px rgba(34,197,94,0.18), 0 0 24px rgba(34,197,94,0.22); }
.connector-icon { font-size: 1.5rem; }
.connector-info { flex: 1; min-width: 0; }
.connector-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.connector-status { font-size: 0.73rem; margin-top: 2px; }
.connector-status.connected { color: var(--green); }
.connector-status.disconnected { color: var(--text-3); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(4,4,10,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; animation: overlay-in 0.2s ease; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modal-in 0.26s cubic-bezier(0.2, 0, 0.1, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1.02rem; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-3);
  padding: 5px; border-radius: 7px; line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.test-result {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem; font-weight: 500;
  margin-top: 10px; display: none; border: 1px solid;
}
.test-result.ok  { background: rgba(34,197,94,0.12); color: #4ade80; border-color: rgba(34,197,94,0.28); }
.test-result.fail { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.28); }

/* ── Progress Feed ─────────────────────────────────────────────────── */
.progress-feed {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  padding: 15px 17px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.79rem;
  color: var(--text-2);
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.65;
}
.progress-line { padding: 1px 0; animation: slide-in 0.2s ease; }
.progress-line.ok    { color: #4ade80; }
.progress-line.warn  { color: #fcd34d; }
.progress-line.error { color: #f87171; }
.progress-line.info  { color: #60a5fa; }
.progress-error { color: #f87171; padding: 2px 0; }
/* light mode: the status colours above are tuned for a dark console; darken them so they read on a light panel */
[data-theme="light"] .progress-line.ok    { color: #15803d; }
[data-theme="light"] .progress-line.warn  { color: #b45309; }
[data-theme="light"] .progress-line.error { color: #dc2626; }
[data-theme="light"] .progress-line.info  { color: #1d4ed8; }
[data-theme="light"] .progress-error      { color: #dc2626; }

/* ── Notification Cards ────────────────────────────────────────────── */
.notif-alert {
  border-radius: var(--r);
  padding: 15px 17px;
  margin-bottom: 11px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-left-width: 3px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: border-color 0.15s, transform 0.15s;
}
.notif-alert:hover { transform: translateX(2px); }
.notif-alert.high     { border-left-color: var(--red); }
.notif-alert.normal   { border-left-color: var(--accent); }
.notif-alert.critical { border-left-color: #dc2626; background: rgba(220,38,38,0.07); }
.notif-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.notif-body { flex: 1; }
.notif-title { font-weight: 700; font-size: 0.875rem; margin-bottom: 4px; color: var(--text); }
.notif-text { font-size: 0.8rem; color: var(--text-2); line-height: 1.5; }
.notif-actions { display: flex; gap: 8px; margin-top: 11px; align-items: center; flex-wrap: wrap; }
.notif-priority { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.notif-priority.high     { color: var(--red); }
.notif-priority.critical { color: #dc2626; }
.notif-priority.normal   { color: var(--accent); }
.notif-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 1rem; margin-left: auto;
  padding: 3px 6px; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.notif-dismiss:hover { background: rgba(255,255,255,0.07); color: var(--text-2); }

/* ── Alert Banners ─────────────────────────────────────────────────── */
.alert-banner {
  background: rgba(234,179,8,0.1);
  border: 1px solid rgba(234,179,8,0.28);
  border-radius: var(--r);
  padding: 14px 17px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 12px;
  color: #fcd34d;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.alert-banner.alert-red {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.28);
  color: #f87171;
}
.alert-banner.alert-green {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.28);
  color: #4ade80;
}
.alert-banner-icon { font-size: 1.1rem; flex-shrink: 0; }
.alert-banner-text { flex: 1; font-size: 0.855rem; }
.alert-banner-text strong { font-weight: 700; }

/* ── Cannibalization Health ────────────────────────────────────────── */
.health-indicator {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 17px;
  border-radius: var(--r);
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.health-indicator.warning {
  background: rgba(234,179,8,0.08);
  border-color: rgba(234,179,8,0.22);
}
.health-indicator.danger {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.22);
}
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; position: relative; }
.health-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  background: inherit; opacity: 0.5; animation: pulse-ring 2s ease-out infinite;
}
.health-dot.green { background: var(--green); box-shadow: 0 0 10px rgba(34,197,94,0.6); }
.health-dot.amber { background: var(--amber); box-shadow: 0 0 10px rgba(234,179,8,0.6); }
.health-dot.red   { background: var(--red);   box-shadow: 0 0 10px rgba(239,68,68,0.6); }
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(2.6); opacity: 0; }
}
.health-label { font-size: 0.855rem; font-weight: 600; color: var(--text); }
.health-detail { font-size: 0.77rem; color: var(--text-3); margin-top: 1px; }

/* ── Logs Page ─────────────────────────────────────────────────────── */
.log-filters {
  display: flex; gap: 9px; margin-bottom: 18px; flex-wrap: wrap; align-items: center;
}
.log-filters select, .log-filters input {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.82rem;
  outline: none;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.log-filters select:focus, .log-filters input:focus { border-color: var(--accent); background: rgba(255,255,255,0.06); }
.run-detail-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 17px;
  margin-top: 10px;
  font-size: 0.82rem;
  display: none;
}
.run-detail-panel.open { display: block; animation: slide-in 0.2s ease; }
.run-output-pre {
  background: rgba(4,4,9,0.7);
  border: 1px solid var(--glass-border);
  color: #8585b8;
  border-radius: 10px;
  padding: 14px 15px;
  font-size: 0.76rem;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 10px;
  line-height: 1.6;
}

/* ── Schedule Page ─────────────────────────────────────────────────── */
.schedule-table .time-input { width: 70px; }
.schedule-toggle {
  position: relative; display: inline-block;
  width: 40px; height: 23px;
}
.schedule-toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  inset: 0; background: rgba(255,255,255,0.12); border-radius: 23px;
  transition: background 0.2s;
}
.toggle-slider:before {
  content: ''; position: absolute;
  height: 17px; width: 17px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: transform 0.22s cubic-bezier(0.22,1,0.36,1);
}
input:checked + .toggle-slider { background: linear-gradient(120deg, var(--accent-h), var(--accent-2)); box-shadow: 0 0 12px rgba(124,106,247,0.5); }
input:checked + .toggle-slider:before { transform: translateX(17px); }

/* ── Settings Page ─────────────────────────────────────────────────── */
.settings-section { margin-bottom: 30px; }
.settings-section h2 {
  font-size: 0.92rem; font-weight: 700;
  color: var(--text);
  margin-bottom: 15px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.1px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.setting-desc  { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

/* ── Page Builder ──────────────────────────────────────────────────── */
.preview-frame {
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  min-height: 400px;
  background: #fff;
  overflow: auto;
  padding: 20px;
}
.video-thumb {
  aspect-ratio: 9/16;
  max-width: 140px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 2rem;
}

/* ── Empty States ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}
.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.55; }
.empty-state p { font-size: 0.875rem; color: var(--text-3); }

/* ── Mobile Hamburger ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 1.25rem; padding: 6px; color: var(--text-2);
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 99;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* ── Reveal / Motion ───────────────────────────────────────────────── */
@keyframes slide-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; }
.reveal.in { animation: rise 0.5s cubic-bezier(0.22,1,0.36,1) both; }

/* skeleton loader */
.skeleton {
  background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .hamburger { display: block; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 18px; }
  .connector-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .connector-grid { grid-template-columns: 1fr; }
  .log-filters { flex-direction: column; }
  .topnav { padding: 0 14px; }
  .metric-row { flex-direction: column; }
}

/* ── Utilities ─────────────────────────────────────────────────────── */
.mt-4  { margin-top: 4px;  }  .mb-4  { margin-bottom: 4px;  }
.mt-8  { margin-top: 8px;  }  .mb-8  { margin-bottom: 8px;  }
.mt-16 { margin-top: 16px; }  .mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; }  .mb-24 { margin-bottom: 24px; }
.mb-20 { margin-bottom: 20px; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-muted { color: var(--text-3); }
.text-sm    { font-size: 0.82rem; }
.text-xs    { font-size: 0.71rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
code { background: rgba(124,106,247,0.1); border: 1px solid var(--glass-border); border-radius: 6px; padding: 2px 6px; font-size: 0.8rem; color: #b3a6ff; font-family: 'JetBrains Mono', monospace; }

/* ── Theme transition ──────────────────────────────────────────────── */
.main-wrap,
.main-wrap .card,
.main-wrap .topnav,
.main-wrap .modal,
.main-wrap .connector-card,
.main-wrap .brand-card,
.main-wrap .metric,
.main-wrap .form-control,
.main-wrap .notif-alert,
.main-wrap .health-indicator,
.main-wrap .alert-banner,
.main-wrap .run-detail-panel,
.main-wrap tbody td {
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ════════════════════════════════════════════════════════════════════
   Light Theme (scoped to .main-wrap — sidebar stays dark always)
   ════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .main-wrap,
[data-theme="light"] .home-wrap {
  --bg:           #eef0f8;
  --bg-elevated:  #ffffff;
  --bg-surface:   #f0f1f9;
  --border:       rgba(20,20,50,0.08);
  --border-hover: rgba(20,20,50,0.18);
  --text:         #181830;
  --text-2:       #44445f;
  --text-3:       #5e5e7a;   /* was #8888a4 — 3.4:1 on white, below AA; this is ~6:1 */
  --accent-dim:   rgba(124,106,247,0.10);
  --glass-bg:        rgba(255,255,255,0.62);
  --glass-bg-strong: rgba(255,255,255,0.82);
  --glass-border:    rgba(255,255,255,0.7);
  --glass-hi:        rgba(255,255,255,0.9);
  --glass-shadow:    0 10px 34px rgba(60,60,120,0.12), inset 0 1px 0 rgba(255,255,255,0.8);
  --shadow-modal:    0 30px 90px rgba(40,40,90,0.22), 0 0 0 1px rgba(255,255,255,0.6);
  color: var(--text);   /* body's colour is computed from the dark :root tokens — re-anchor text that just inherits */
}
/* lighter, pastel aurora for light mode */
[data-theme="light"] body::before {
  background:
    radial-gradient(38% 46% at 12% 8%,  rgba(124,106,247,0.20), transparent 70%),
    radial-gradient(34% 42% at 88% 12%, rgba(59,155,246,0.16),  transparent 70%),
    radial-gradient(42% 48% at 78% 88%, rgba(215,97,240,0.13),  transparent 70%),
    radial-gradient(40% 46% at 8%  92%, rgba(6,182,212,0.12),   transparent 70%);
}
[data-theme="light"] body { background: #eef0f8; }
[data-theme="light"] .main-wrap { background: transparent; }

/* topnav */
[data-theme="light"] .topnav {
  background: rgba(255,255,255,0.6);
  border-bottom-color: rgba(255,255,255,0.7);
}
[data-theme="light"] .topnav-title { color: #181830; }

/* cards & surfaces — frosted white glass */
[data-theme="light"] .card,
[data-theme="light"] .brand-card,
[data-theme="light"] .connector-card { border-color: rgba(255,255,255,0.7); }
[data-theme="light"] .metric { background: rgba(255,255,255,0.55); border-color: rgba(20,20,50,0.06); }
[data-theme="light"] .metric:hover { background: rgba(255,255,255,0.8); }

/* modal */
[data-theme="light"] .modal-overlay { background: rgba(40,40,80,0.25); }
[data-theme="light"] .modal-footer { border-top-color: rgba(20,20,50,0.08); }
[data-theme="light"] .modal-close:hover { background: rgba(20,20,50,0.05); }

/* table */
[data-theme="light"] tbody tr:hover td { background: rgba(124,106,247,0.05); }

/* buttons — the primary gradient is a touch deeper on white so its white label stays readable */
[data-theme="light"] .btn-primary { background-image: linear-gradient(120deg, #6d5bf0 0%, #5b46e0 50%, #3f6fe6 100%); }
[data-theme="light"] .btn-secondary { background: rgba(255,255,255,0.7); color: #555577; border-color: rgba(20,20,50,0.1); }
[data-theme="light"] .btn-secondary:hover { background: #fff; color: #181830; }
[data-theme="light"] .btn-ghost { background: rgba(124,106,247,0.07); border-color: rgba(124,106,247,0.35); color: #5b46d6; }
[data-theme="light"] .btn-icon:hover { background: rgba(20,20,50,0.05); }

/* forms */
[data-theme="light"] .form-control { background: rgba(255,255,255,0.8); border-color: rgba(20,20,50,0.12); color: #181830; }
[data-theme="light"] .form-control:focus { background: #fff; }
[data-theme="light"] select.form-control option { background: #fff; color: #181830; }
[data-theme="light"] .log-filters select,
[data-theme="light"] .log-filters input { background: rgba(255,255,255,0.8); border-color: rgba(20,20,50,0.12); color: #181830; }

/* badges — explicit light-mode colours */
[data-theme="light"] .badge-green  { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
[data-theme="light"] .badge-amber  { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
[data-theme="light"] .badge-red    { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
[data-theme="light"] .badge-blue   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
[data-theme="light"] .badge-purple { background: #ede9fe; color: #4c1d95; border-color: #ddd6fe; }
[data-theme="light"] .badge-gray   { background: #eef0f8; color: #475569; border-color: #e2e8f0; }

/* alerts */
[data-theme="light"] .alert-banner { background: rgba(255,251,235,0.85); border-color: #fde68a; color: #854d0e; }
[data-theme="light"] .alert-banner.alert-red { background: rgba(255,245,245,0.85); border-color: #fca5a5; color: #991b1b; }
[data-theme="light"] .alert-banner.alert-green { background: rgba(240,253,244,0.85); border-color: #bbf7d0; color: #166534; }

/* health */
[data-theme="light"] .health-indicator         { background: rgba(240,253,244,0.8); border-color: #bbf7d0; }
[data-theme="light"] .health-indicator.warning { background: rgba(255,251,235,0.8); border-color: #fde68a; }
[data-theme="light"] .health-indicator.danger  { background: rgba(255,245,245,0.8); border-color: #fca5a5; }

/* notifications */
[data-theme="light"] .notif-alert { border-color: rgba(255,255,255,0.7); }
[data-theme="light"] .notif-alert.critical { background: rgba(255,245,245,0.7); }
[data-theme="light"] .notif-dismiss:hover { background: rgba(20,20,50,0.05); }

/* run panels — keep dark terminal look in both themes */
[data-theme="light"] .run-detail-panel { background: rgba(255,255,255,0.6); border-color: rgba(20,20,50,0.08); }

/* misc */
[data-theme="light"] .settings-section h2 { border-bottom-color: rgba(20,20,50,0.08); }
[data-theme="light"] .setting-row { border-bottom-color: rgba(20,20,50,0.06); }
[data-theme="light"] code { background: rgba(124,106,247,0.08); border-color: rgba(124,106,247,0.18); color: #5b46d6; }
[data-theme="light"] .empty-state { color: var(--text-3); }
[data-theme="light"] .toggle-slider { background: rgba(20,20,50,0.15); }

/* scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(20,20,50,0.18); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(20,20,50,0.3); }

/* ── Theme Toggle Button ───────────────────────────────────────────── */
.theme-toggle {
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
  border-radius: 9px; cursor: pointer;
  padding: 6px 10px; font-size: 0.95rem; line-height: 1;
  color: var(--text-3);
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); border-color: var(--border-hover); color: var(--text); transform: rotate(-12deg); }
[data-theme="light"] .theme-toggle {
  background: rgba(255,255,255,0.7); border-color: rgba(20,20,50,0.1); color: #5e5e7a;
}
[data-theme="light"] .theme-toggle:hover { background: #fff; border-color: rgba(20,20,50,0.2); color: #181830; }

/* ── Content Decoder · post verdict (static/decoder_verdict.js) ─────────────────────────────── */
.vd { border:1px solid var(--border); border-radius:12px; padding:12px 14px; margin:12px 0; background:rgba(255,255,255,.025); }
.vd-head { font-weight:800; font-size:.98rem; color:var(--text); }
.vd-sub { font-size:.8rem; color:var(--text-2); margin-top:3px; }
.vd-h { font-size:.7rem; letter-spacing:.06em; text-transform:uppercase; font-weight:800; color:var(--text-2); margin:12px 0 4px; }
.vd-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:5px; }
.vd-list li { display:flex; gap:10px; align-items:baseline; justify-content:space-between; font-size:.82rem; line-height:1.45; color:var(--text); }
.vd-list li::before { content:'✓'; font-weight:800; color:#4ade80; flex-shrink:0; }
.vd-list.fix li::before { content:'→'; color:#fbbf24; }
.vd-list li span { flex:1; min-width:0; }
.vd-list li em { font-style:normal; font-size:.66rem; color:var(--text-3); white-space:nowrap; border:1px solid var(--border); border-radius:20px; padding:1px 7px; }
.vd-repeat { margin-top:10px; font-size:.82rem; font-weight:700; color:#c5f05a; }
.vd-says { margin-top:10px; font-size:.8rem; color:var(--text-2); line-height:1.5; }
.vd-note { margin-top:8px; font-size:.68rem; color:var(--text-3); }
.vd-note:empty { display:none; }
.vd-excel { border-color:rgba(197,240,90,.45); background:rgba(197,240,90,.06); }
.vd-good { border-color:rgba(74,222,128,.35); }
.vd-weak { border-color:rgba(248,113,113,.35); }
[data-theme="light"] .vd { background:rgba(255,255,255,.7); }
[data-theme="light"] .vd-list li::before { color:#15803d; }
[data-theme="light"] .vd-list.fix li::before { color:#b45309; }
[data-theme="light"] .vd-repeat { color:#4d7c0f; }
[data-theme="light"] .vd-excel { border-color:rgba(101,163,13,.45); background:rgba(101,163,13,.06); }
@media (max-width:640px) { .vd-list li { flex-wrap:wrap; } }
