:root {
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eff4fb;
  --border: #e5ebf5;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #0b66fa;
  --primary-btn: #0b66fa;
  --primary-btn-hover: #0954d1;
  --primary-2: #38bdf9;
  --primary-soft: #eef4ff;
  --olive: #507a27;
  --olive-2: #709350;
  --olive-soft: rgba(80, 122, 39, 0.14);
  --accent: #f59e0b;
  --info: #0b66fa;
  --pos: #507a27;
  --pos-soft: #eef6e7;
  --neu: #64748b;
  --neu-soft: #f1f5f9;
  --neg: #e24c4b;
  --neg-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --side: #ffffff;
  --side-2: #f8fafd;
  --side-border: #e5ebf5;
  --side-text: #475569;
  --side-active: #0b66fa;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.025);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #080f1a;
  --surface: #0f172a;
  --surface-2: #141f35;
  --surface-3: #1b2842;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #8b9cb5;
  --primary: #3b82f6;
  --primary-btn: #2563eb;
  --primary-btn-hover: #1d4ed8;
  --primary-2: #38bdf9;
  --primary-soft: rgba(59, 130, 246, 0.14);
  --olive: #84cc16;
  --olive-2: #65a30d;
  --olive-soft: rgba(132, 204, 22, 0.15);
  --pos: #4ade80;
  --pos-soft: rgba(74, 222, 128, 0.14);
  --neu: #94a3b8;
  --neu-soft: rgba(148, 163, 184, 0.14);
  --neg: #f87171;
  --neg-soft: rgba(248, 113, 113, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --side: #0b1220;
  --side-2: #111b2e;
  --side-border: #1e293b;
  --side-text: #94a3b8;
  --side-active: #60a5fa;
  --shadow-xs: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.ico { flex: none; display: inline-block; vertical-align: middle; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: 1.25; letter-spacing: -0.015em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-2 { gap: 8px; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Shared Icons & Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-weight: 600; font-size: 12.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  box-shadow: var(--shadow-xs); text-decoration: none !important;
}
.btn svg { width: 14px; height: 14px; flex: none; }
.btn:hover:not([disabled]) { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; }
.btn.primary:hover:not([disabled]) { background: var(--primary-btn-hover); border-color: var(--primary-btn-hover); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover:not([disabled]) { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--neg); border-color: var(--border); }
.btn.danger:hover:not([disabled]) { background: var(--neg-soft); border-color: rgba(226, 76, 75, 0.35); }
.btn.danger-fill { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.danger-fill:hover:not([disabled]) { filter: brightness(0.92); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; gap: 5px; border-radius: 7px; }
.btn.sm svg { width: 13px; height: 13px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: all .15s; flex: none;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface-3); color: var(--primary); border-color: var(--border-strong); }
.icon-btn.spin svg { animation: spin .75s linear infinite; }

/* ---------- Forms ---------- */
label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2);
  margin: 14px 0 6px; letter-spacing: 0.02em;
}
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { resize: vertical; }
.err { color: var(--neg); font-size: 12.5px; margin-top: 8px; min-height: 18px; }
.err-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-top: 14px;
  border-radius: var(--radius-sm); background: var(--neg-soft); border: 1px solid rgba(226, 76, 75, 0.28);
  color: var(--neg); font-size: 12.5px; font-weight: 500;
}

/* ---------- Brand Logo ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 15.5px; letter-spacing: -0.02em; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #0b66fa, #38bdf9); color: #fff;
  box-shadow: 0 3px 10px rgba(11, 102, 250, 0.28);
}
.brand-logo svg { width: 17px; height: 17px; }
.brand-logo.sm { width: 28px; height: 28px; border-radius: 7px; }
.brand-logo.sm svg { width: 14px; height: 14px; }
.brand small { display: block; font-size: 9px; letter-spacing: 0.14em; font-weight: 700; color: var(--primary); margin-top: 1px; }

/* ---------- Login Screen ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.12fr 1fr; background: var(--bg); }
.login-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, #071936 0%, #0b2e6b 58%, #071b3f 100%);
  color: #eff6ff; padding: 42px 52px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero .brand small { color: #7dd3fc; }
.login-hero-bg {
  position: absolute; inset: 0; opacity: 0.25; pointer-events: none;
  background-image:
    linear-gradient(rgba(56, 189, 249, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 249, 0.16) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at 30% 35%, black 15%, transparent 75%);
}
.login-hero-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px; font-weight: 600; color: #bae6fd;
}
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: #38bdf9; box-shadow: 0 0 0 3px rgba(56, 189, 249, 0.28); }
.login-hero-body { position: relative; max-width: 540px; margin: 32px 0; }
.login-hero h1 { font-size: clamp(30px, 3.2vw, 42px); font-weight: 800; line-height: 1.15; margin-bottom: 14px; color: #fff; }
.login-hero h1 em { font-style: normal; color: #38bdf9; }
.hero-sub { font-size: 15px; color: #cbd5e1; line-height: 1.6; margin: 0 0 28px; }
.hero-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.hm-card { padding: 12px 14px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); }
.hm-card span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: #7dd3fc; font-weight: 700; }
.hm-card strong { display: block; font-size: 13px; color: #fff; margin-top: 4px; font-weight: 600; }
.hero-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.hero-features li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: #e2e8f0; }
.hero-features svg { width: 16px; height: 16px; color: #38bdf9; flex: none; margin-top: 2px; }
.login-hero-foot { position: relative; display: flex; justify-content: space-between; font-size: 12px; color: rgba(226, 232, 240, 0.6); border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 16px; }

.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 400px; }
.mobile-brand-mini { display: none; align-items: center; gap: 8px; font-weight: 800; font-family: var(--font-display); margin-bottom: 18px; }
.login-card-head h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-card-head p { margin: 0 0 22px; font-size: 13.5px; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; padding-right: 38px; }
.pw-toggle { position: absolute; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; display: grid; place-items: center; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle svg { width: 16px; height: 16px; }
#l-submit { margin-top: 20px; }
.login-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 22px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.login-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

/* ---------- White Enterprise Sidebar Shell ---------- */
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s ease; }
.app.collapsed { grid-template-columns: 72px minmax(0, 1fr); }

.side {
  background: var(--side); color: var(--side-text);
  border-right: 1px solid var(--side-border);
  padding: 14px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 35; overflow: hidden;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 2px 4px 14px; border-bottom: 1px solid var(--side-border);
}
.side .brand { color: var(--text); min-width: 0; }
.side-collapse {
  width: 28px; height: 28px; background: var(--surface-2);
  border-color: var(--border); color: var(--muted);
}
.side-collapse:hover { background: var(--primary-soft); color: var(--primary); border-color: rgba(11, 102, 250, 0.25); }
.app.collapsed .brand-text { display: none; }
.app.collapsed .side-head { justify-content: center; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.app.collapsed .side-collapse svg { transform: rotate(180deg); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-group {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 12px 10px 5px; opacity: 0.85;
}
.nav-group:first-child { padding-top: 4px; }
.app.collapsed .nav-group { display: none; }

.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 11px; border-radius: 9px;
  color: var(--side-text); font-weight: 500; font-size: 13px;
  transition: background .14s, color .14s; text-decoration: none; position: relative;
}
.nav a svg { width: 16px; height: 16px; flex: none; opacity: 0.78; }
.nav a .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .nav-badge {
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active {
  background: var(--primary-soft); color: var(--side-active); font-weight: 600;
}
.nav a.active .nav-badge { background: rgba(11, 102, 250, 0.14); color: var(--side-active); }
.nav a.active svg { opacity: 1; color: var(--side-active); }
.app.collapsed .nav a { justify-content: center; padding: 10px; }
.app.collapsed .nav a .nav-label, .app.collapsed .nav a .nav-badge { display: none; }

.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--side-border); display: grid; gap: 8px; }
.sys-status {
  padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 11px; display: grid; gap: 3px;
}
.sys-status-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 600; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.status-dot.warn::before { background: #f59e0b; }
.app.collapsed .sys-status { display: none; }

.user-card {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px;
  background: var(--side-2); border: 1px solid var(--border);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #f59e0b, #ea580c); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
  font-family: var(--font-display);
}
.user-meta { flex: 1; min-width: 0; }
.user-meta b { display: block; color: var(--text); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { display: block; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.user-card .icon-btn { width: 28px; height: 28px; background: transparent; border-color: transparent; color: var(--muted); }
.user-card .icon-btn:hover { background: var(--neg-soft); color: var(--neg); }
.app.collapsed .user-card { flex-direction: column; padding: 6px; }
.app.collapsed .user-meta { display: none; }
.side-backdrop { display: none; }

/* ---------- Topbar ---------- */
.workspace { min-width: 0; overflow-x: clip; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 25; height: 52px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-menu-btn { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.bc-root { color: var(--muted); font-weight: 500; }
.bc-sep { color: var(--border-strong); }
.bc-cur { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.cmd-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); cursor: pointer; font-size: 12px; transition: border-color .15s, color .15s;
}
.cmd-trigger svg { width: 14px; height: 14px; }
.cmd-trigger:hover { border-color: var(--primary); color: var(--text); }
.cmd-trigger kbd {
  font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.top-status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.top-status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; display: inline-block; }
.top-status-pill.lexicon i { background: var(--accent); }

/* ---------- Main Page & Campaign Context Header ---------- */
.main { padding: 20px 24px 56px; max-width: 1460px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.ctx-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ctx-badge {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: var(--primary-btn); color: #fff; display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(11, 102, 250, 0.25);
}
.ctx-badge svg { width: 20px; height: 20px; }
.page-head h1 { font-size: clamp(18px, 1.9vw, 22px); font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Pill Filter Strip (Matching Screenshot) ---------- */
.toolbar-card {
  background: transparent; border: 0; padding: 0; margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.toolbar-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow-xs); margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-width: 0; }
.filters select, .filters input[type="text"], .filters input[type="search"], .filters input[type="date"], .filters input:not([type]) {
  padding: 6px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); font-size: 12px; font-weight: 600; height: 32px; outline: none;
  color: var(--text-2); box-shadow: var(--shadow-xs); max-width: 100%; min-width: 0;
}
.filters select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 13px;
}
.filters select.pill-primary {
  background-color: var(--primary-btn); border-color: var(--primary-btn); color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  padding-right: 30px; max-width: 280px;
}
.filters select.pill-primary option { background: var(--surface); color: var(--text); }
.filters select:focus, .filters input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.search-box svg { position: absolute; left: 10px; width: 13px; height: 13px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 29px !important; padding-right: 26px !important; min-width: 190px; }
.search-clear {
  position: absolute; right: 6px; border: 0; background: none; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px;
}
.search-clear:hover { color: var(--text); background: var(--surface-3); }

.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; background: var(--surface); height: 32px; padding: 2px; gap: 2px;
  box-shadow: var(--shadow-xs); max-width: 100%;
}
.seg button {
  border: 0; background: none; padding: 0 11px; cursor: pointer; color: var(--muted);
  font-weight: 600; font-size: 11.5px; border-radius: 6px; transition: all .14s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--primary-btn); color: #fff; }

.section-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all .14s; flex: none;
}
.section-tab:hover { border-color: var(--primary); color: var(--primary); }
.section-tab.active { background: var(--primary-soft); border-color: rgba(11, 102, 250, 0.25); color: var(--primary); }

/* ---------- Cards & Colored Card Header Icons ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.card.tight { padding: 14px 16px; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head > :last-child { max-width: 100%; }
.card-title-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.card-ico {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.card-ico svg { width: 14px; height: 14px; }
.card-ico.olive { background: var(--olive-soft); color: var(--olive); }
.card-ico.red { background: var(--neg-soft); color: var(--neg); }
.card-ico.amber { background: var(--warn-soft); color: var(--warn); }
.card-ico.purple { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.card-ico.cyan { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.card h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.card-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; display: block; margin-top: 1px; }

.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* ---------- KPI Cards (4 Colored Square Badges) ---------- */
.kpi { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 16px 18px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .label { color: var(--muted); font-weight: 600; font-size: 12px; }
.kpi-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.kpi-ico.blue { background: #2563eb; color: #fff; }
.kpi-ico.olive { background: var(--olive); color: #fff; }
.kpi-ico.red { background: #e24c4b; color: #fff; }
.kpi-ico.cyan { background: #38bdf9; color: #fff; }
.kpi-ico.amber { background: #f59e0b; color: #fff; }
.kpi-ico svg { width: 15px; height: 15px; }
.kpi .val {
  font-family: var(--font-display); font-size: 28px; font-weight: 800;
  margin: 8px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chg-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chg-pill.up { background: var(--pos-soft); color: var(--pos); }
.chg-pill.down { background: var(--neg-soft); color: var(--neg); }
.chg-pill.flat { background: var(--neu-soft); color: var(--muted); }

/* ---------- Charts & Sentiment Breakdown ---------- */
.chart-box { position: relative; height: 265px; }
.chart-box.sm { height: 215px; }

.sent-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sent-tile {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  cursor: pointer; transition: transform .12s, border-color .14s;
}
.sent-tile:hover { transform: translateY(-1px); border-color: var(--primary); }
.sent-tile.active { outline: 2px solid var(--primary); }
.sent-tile.t-pos { background: #f0f9ff; border-color: #dbeafe; }
.sent-tile.t-neu { background: #f0fdf4; border-color: #dcfce7; }
.sent-tile.t-neg { background: #fef2f2; border-color: #fee2e2; }
.sent-tile.t-net { background: #fffbeb; border-color: #fef3c7; }
:root[data-theme="dark"] .sent-tile.t-pos { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.25); }
:root[data-theme="dark"] .sent-tile.t-neu { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.2); }
:root[data-theme="dark"] .sent-tile.t-neg { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.25); }
:root[data-theme="dark"] .sent-tile.t-net { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.25); }
.sent-tile span { font-size: 11.5px; color: var(--muted); font-weight: 600; display: block; }
.sent-tile b { font-family: var(--font-display); font-size: 20px; font-weight: 800; display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }

.sent-meter { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; margin-top: 12px; }
.sent-meter i { display: block; height: 100%; }

.sent-legend { display: grid; gap: 8px; }
.sent-row {
  display: flex; align-items: center; justify-content: space-between; padding: 7px 10px;
  border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .14s; font-size: 12px;
}
.sent-row:hover { border-color: var(--primary); }
.sent-row.active { border-color: var(--primary); background: var(--primary-soft); }
.sent-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }

/* ---------- Risk Panel ---------- */
.risk-grid { display: grid; grid-template-columns: 1.05fr 1fr 1.35fr; gap: 12px; }
.risk-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px;
  background: var(--surface-2); display: flex; flex-direction: column; justify-content: space-between;
}
.risk-box .big { font-family: var(--font-display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0; }
.gauge-track { height: 8px; border-radius: 99px; position: relative; margin-top: 10px; background: linear-gradient(90deg, #507a27 0%, #f59e0b 48%, #e24c4b 100%); }
.gauge-pin { position: absolute; top: -5px; width: 6px; height: 18px; border-radius: 3px; background: var(--text); border: 2px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.gauge-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.kw-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kw-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: var(--neg-soft); color: var(--neg); border: 1px solid rgba(226, 76, 75, 0.25);
  font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all .14s;
}
.kw-btn:hover { background: var(--neg); color: #fff; }

/* ---------- Bars (Olive Green Style), Word Cloud, Sky-Blue Heatmap ---------- */
.bar-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  margin-bottom: 9px; padding: 3px 5px; border-radius: 7px; transition: background .12s;
}
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover { background: var(--surface-2); }
.bar-row:last-child { margin-bottom: 0; }
.bar-row .name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--olive), var(--olive-2)); border-radius: 99px; }
.bar-row b { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); }

.chan-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 14px; align-items: center;
  margin-bottom: 12px;
}
.chan-row:last-child { margin-bottom: 0; }
.chan-row .bar { height: 12px; margin-top: 0; }

.cloud { display: flex; flex-wrap: wrap; gap: 7px 10px; align-items: center; justify-content: center; padding: 12px 6px; min-height: 170px; }
.cloud-word {
  font-weight: 700; line-height: 1.1; padding: 3px 8px; border-radius: 6px;
  cursor: pointer; border: 1px solid transparent; transition: transform .12s, background .12s, border-color .12s;
  background: transparent;
}
.cloud-word:hover { transform: translateY(-1px); background: var(--surface-2); border-color: var(--border); }
.cloud-word.positive { color: var(--olive); }
.cloud-word.negative { color: var(--neg); }
.cloud-word.neutral { color: var(--text-2); }

.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heat { display: grid; grid-template-columns: 36px repeat(24, minmax(14px, 1fr)); gap: 3px; font-size: 10px; color: var(--muted); min-width: 420px; }
.heat .cell { aspect-ratio: 1; border-radius: 3px; transition: transform .1s, outline .1s; cursor: default; }
.heat .cell:hover { transform: scale(1.18); outline: 1.5px solid var(--text); z-index: 2; }
.heat .lbl { display: flex; align-items: center; font-weight: 600; font-size: 10.5px; }
.heat-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.heat-scale { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.heat-scale i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* ---------- Indonesia Geo Map ---------- */
.geo-split { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.indo-map-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; position: relative;
}
.indo-map-svg { width: 100%; height: auto; display: block; }
.indo-land { fill: #dbe4f0; stroke: #ffffff; stroke-width: 0.8; }
:root[data-theme="dark"] .indo-land { fill: #1e293b; stroke: #0f172a; }
.indo-dot { fill: var(--primary); fill-opacity: 0.78; stroke: #ffffff; stroke-width: 1.2; cursor: pointer; transition: r .15s; }
.indo-dot-halo { fill: var(--primary); fill-opacity: 0.2; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-scroll { max-height: 360px; overflow-y: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.row-click { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Pills & Channel Badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.pill svg { width: 11.5px; height: 11.5px; flex: none; }
.pill.positive, .pill.active, .pill.published, .pill.Low { background: var(--pos-soft); color: var(--pos); border-color: rgba(80, 122, 39, 0.24); }
.pill.negative, .pill.failed, .pill.High { background: var(--neg-soft); color: var(--neg); border-color: rgba(226, 76, 75, 0.25); }
.pill.neutral, .pill.inactive { background: var(--neu-soft); color: var(--muted); border-color: var(--border); }
.pill.Medium, .pill.in_progress { background: var(--warn-soft); color: var(--warn); border-color: rgba(245, 158, 11, 0.28); }
.pill.info { background: var(--primary-soft); color: var(--primary); border-color: rgba(11, 102, 250, 0.2); }
.pill .pulse { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.chan-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.chan-badge svg { width: 11.5px; height: 11.5px; flex: none; }
.chan-badge.yt { color: #e24c4b; border-color: rgba(226, 76, 75, 0.25); background: #fef2f2; }
.chan-badge.tw { color: #0284c7; border-color: rgba(2, 132, 199, 0.25); background: #f0f9ff; }
.chan-badge.news { color: #0b66fa; border-color: rgba(11, 102, 250, 0.22); background: #eef4ff; }
.chan-badge.up { color: #7c3aed; border-color: rgba(124, 58, 237, 0.22); background: #f5f3ff; }
.chan-badge.tt { color: #e11d48; border-color: rgba(225, 29, 72, 0.22); background: #fff1f2; }
.chan-badge.ig { color: #c026d3; border-color: rgba(192, 38, 211, 0.22); background: #fdf4ff; }
.chan-badge.fb { color: #1877f2; border-color: rgba(24, 119, 242, 0.25); background: #eff6ff; }
:root[data-theme="dark"] .chan-badge.tt { background: rgba(244, 63, 94, 0.15); color: #fb7185; }
:root[data-theme="dark"] .chan-badge.ig { background: rgba(217, 70, 239, 0.15); color: #f0abfc; }
:root[data-theme="dark"] .chan-badge.fb { background: rgba(24, 119, 242, 0.16); color: #60a5fa; }
:root[data-theme="dark"] .chan-badge.yt { background: rgba(248, 113, 113, 0.14); }
:root[data-theme="dark"] .chan-badge.tw { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
:root[data-theme="dark"] .chan-badge.news { background: rgba(59, 130, 246, 0.14); color: #60a5fa; }
:root[data-theme="dark"] .chan-badge.up { background: rgba(167, 139, 250, 0.14); color: #c4b5fd; }

/* ---------- Top Content & Mention Cards + Media Thumbnails ---------- */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(275px, 100%), 1fr)); gap: 14px; }
.post {
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; background: var(--surface);
  display: flex; flex-direction: column; gap: 8px; transition: transform .15s, border-color .15s, box-shadow .15s;
}
.post:hover { transform: translateY(-2px); border-color: rgba(11, 102, 250, 0.35); box-shadow: var(--shadow); }
.post.has-thumb { padding: 0; overflow: hidden; gap: 0; }
.post-inner { padding: 13px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-list { display: grid; gap: 10px; }
.post-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.post-author { display: flex; align-items: center; gap: 9px; min-width: 0; }
.post-av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 11px; flex: none;
}
.post-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.post-meta b { color: var(--text); }
.post-title { font-weight: 700; font-size: 13.5px; color: var(--text); line-height: 1.38; }
.post-body { color: var(--text-2); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.post-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.post-stats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); margin-top: auto;
}
.post-metrics { display: flex; flex-wrap: wrap; gap: 10px; font-variant-numeric: tabular-nums; }
.post-metrics b { color: var(--text); }

/* ---------- Creative Hero Pulse, KPI Sparklines, Risk Arc, Media Profiles & Thumbnails ---------- */
.hero-intel { display: grid; grid-template-columns: 1.65fr 1fr; gap: 14px; margin-bottom: 14px; }
.hero-intel > * { min-width: 0; }
.hero-brief {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 20px 22px; color: #eff6ff;
  background: linear-gradient(135deg, #07193d 0%, #0b4fdb 58%, #0284c7 100%);
  box-shadow: 0 10px 26px rgba(11, 102, 250, 0.22);
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
}
.hero-brief::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 80% 25%, black 15%, transparent 78%);
}
.hero-brief > * { position: relative; z-index: 1; }
.hero-live-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #e0f2fe; width: fit-content;
}
.hero-live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3); }
.hero-headline { font-family: var(--font-display); font-size: clamp(16px, 1.55vw, 20px); font-weight: 700; line-height: 1.38; margin: 0; color: #fff; }
.hero-headline em { font-style: normal; color: #7dd3fc; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px; color: #f8fafc; backdrop-filter: blur(4px); cursor: pointer; transition: background .14s;
}
.hero-chip:hover { background: rgba(255, 255, 255, 0.22); }
.hero-cta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.hero-cta-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  background: #ffffff; color: #0b4fdb; font-weight: 700; font-size: 12px; border: 0; cursor: pointer;
  text-decoration: none !important; transition: transform .12s, box-shadow .14s; white-space: nowrap;
}
.hero-cta-btn svg { width: 14px; height: 14px; flex: none; }
.hero-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16); }

.hero-health {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 18px;
}
.hero-ring-wrap { position: relative; width: 108px; height: 108px; flex: none; display: grid; place-items: center; }
.hero-ring-wrap svg { transform: rotate(-90deg); width: 108px; height: 108px; }
.hero-ring-center { position: absolute; text-align: center; }
.hero-ring-center b { font-family: var(--font-display); font-size: 20px; font-weight: 800; display: block; line-height: 1.1; }
.hero-ring-center span { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.hero-health-list { flex: 1; min-width: 0; display: grid; gap: 7px; }
.hero-h-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px;
  border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px;
  cursor: pointer; transition: border-color .14s;
}
.hero-h-item:hover { border-color: var(--primary); }

.kpi { transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden; }
.kpi:hover { transform: translateY(-2px); border-color: rgba(11, 102, 250, 0.28); }
.kpi-spark { width: 100%; height: 34px; display: block; margin-top: 8px; overflow: visible; }

.risk-gauge-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4px 0; }
.risk-arc-svg { width: 164px; height: 92px; display: block; overflow: visible; }

/* ---------- Media Logo Badges & Online Media Profiles ---------- */
.media-logo {
  position: relative; width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 13px;
  color: #fff; overflow: hidden; box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
}
.media-logo.sm { width: 28px; height: 28px; border-radius: 7px; font-size: 10.5px; }
.media-logo.lg { width: 54px; height: 54px; border-radius: 14px; font-size: 17px; }
.media-fav-wrap {
  position: absolute; inset: 3px; border-radius: 7px; background: #ffffff;
  display: grid; place-items: center; overflow: hidden; opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.media-fav-wrap.loaded { opacity: 1; }
.media-logo.sm .media-fav-wrap { inset: 2px; border-radius: 5px; }
.media-logo.lg .media-fav-wrap { inset: 4px; border-radius: 10px; }
.media-fav { width: 72%; height: 72%; object-fit: contain; display: block; }

.media-profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(255px, 100%), 1fr)); gap: 12px; }
.media-profile-card {
  position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 11px; padding: 15px 15px 13px;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.media-profile-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--mp-accent, var(--primary));
}
.media-profile-card:hover { transform: translateY(-2px); border-color: rgba(11, 102, 250, 0.42); box-shadow: var(--shadow); }
.mp-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.mp-head h4 { font-size: 14px; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-domain { font-family: var(--font-mono); font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.mp-cat {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); margin-top: 4px;
}
.mp-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px 10px;
  border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); text-align: center;
}
.mp-metrics span { display: block; font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.mp-metrics b { display: block; font-family: var(--font-display); font-size: 14px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.mp-sent-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.mp-sent-bar i { display: block; height: 100%; }
.mp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); padding-top: 2px; }
.mp-link { color: var(--primary); font-weight: 700; font-size: 11.5px; white-space: nowrap; }

/* ---------- Media Thumbnails (16:9 Editorial Covers & Photos) ---------- */
.media-thumb {
  position: relative; height: 150px; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; padding: 11px 12px; color: #fff;
  background: var(--mt-bg, linear-gradient(135deg, #0b2e6b, #0b66fa));
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.media-thumb-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.24; }
.media-thumb-wm {
  position: absolute; right: 12px; bottom: -8px; font-family: var(--font-display); font-weight: 800;
  font-size: 44px; letter-spacing: -0.04em; opacity: 0.12; pointer-events: none; user-select: none; color: #fff;
}
.media-thumb-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1;
}
.media-thumb-scrim {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(7, 18, 42, 0.56) 0%, rgba(7, 18, 42, 0.18) 45%, rgba(7, 18, 42, 0.82) 100%);
}
.media-thumb-top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mt-outlet {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.94); color: #0f172a; font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18); max-width: 68%; border: 0; cursor: pointer;
}
.mt-outlet:hover { background: #ffffff; }
.mt-outlet span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-outlet-ico {
  width: 18px; height: 18px; border-radius: 50%; background: #eef4ff; color: #0b66fa;
  display: grid; place-items: center; font-size: 9px; font-weight: 800; overflow: hidden; flex: none;
}
.mt-outlet-ico img { width: 14px; height: 14px; object-fit: contain; display: block; }
.media-thumb-cap { position: relative; z-index: 3; }
.mt-topic {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; background: rgba(255, 255, 255, 0.18); color: #f8fafc; backdrop-filter: blur(4px);
}
.mt-headline {
  margin-top: 5px; font-family: var(--font-display); font-size: 12.5px; font-weight: 700; line-height: 1.3;
  color: #ffffff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.media-thumb-mini {
  width: 56px; height: 40px; border-radius: 8px; flex: none; overflow: hidden; position: relative;
  display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 11px;
  background: var(--mt-bg, linear-gradient(135deg, #0b2e6b, #0b66fa)); border: 1px solid var(--border);
}
.media-thumb-mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.media-thumb-mini .mini-fav {
  width: 22px; height: 22px; border-radius: 6px; background: rgba(255, 255, 255, 0.92); color: #0f172a;
  display: grid; place-items: center; z-index: 2; box-shadow: 0 1px 4px rgba(0,0,0,0.2); font-size: 9px;
}
.media-thumb-mini .mini-fav img { position: static; width: 15px; height: 15px; object-fit: contain; }

/* ---------- Media Profile Drawer ---------- */
.drawer.wide { max-width: 680px; }
.drawer-body > .media-thumb { border-radius: 12px; border: 1px solid var(--border); height: 175px; }
.mp-hero {
  border-radius: 12px; padding: 16px; color: #fff; position: relative; overflow: hidden;
  background: var(--mt-bg, linear-gradient(135deg, #07193d, #0b66fa));
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.mp-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mp-articles-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Banner / Connectors ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); font-size: 12.5px; color: var(--text-2); margin-bottom: 14px;
}
.banner.warn { border-left-color: var(--accent); }
.connector-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 11.5px; font-weight: 600;
}
.conn-pill i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.conn-pill.off i { background: var(--neu); }
.conn-pill.off { color: var(--muted); }

/* ---------- Copilot Chat Workspace ---------- */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 235px); min-height: 480px; padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.msg-wrap { display: flex; gap: 10px; max-width: 86%; }
.msg-wrap.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-wrap.bot { align-self: flex-start; }
.msg-av { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.msg-wrap.user .msg-av { background: var(--surface-3); color: var(--text-2); }
.msg { padding: 12px 15px; border-radius: 12px; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; position: relative; }
.msg-wrap.user .msg { background: var(--primary-btn); color: #fff; border-bottom-right-radius: 4px; }
.msg-wrap.bot .msg { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot ul { margin: 8px 0; padding-left: 18px; }
.msg-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.chat-input-bar { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; max-width: 640px; width: 100%; }
.prompt-card { text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: all .14s; }
.prompt-card:hover { border-color: var(--primary); background: var(--surface); transform: translateY(-1px); }
.prompt-card b { display: block; font-size: 12.5px; color: var(--primary); margin-bottom: 3px; }
.prompt-card span { font-size: 12px; color: var(--muted); }
.hist-list { display: grid; gap: 6px; max-height: calc(100vh - 300px); overflow-y: auto; }
.hist-item { width: 100%; text-align: left; padding: 10px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: all .14s; }
.hist-item:hover { border-color: var(--primary); background: var(--surface); }
.hist-item b { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 3px; }

/* ---------- Network / SNA ---------- */
.sna-wrap { position: relative; }
#network-graph { height: 580px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.sna-toolbar {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  display: flex; gap: 4px; padding: 4px; border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.sna-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.sna-inspector { background: var(--surface-2); height: 580px; overflow-y: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 3px 8px; border-radius: 999px; border: 1px solid transparent; }
.legend-item:hover { background: var(--surface-2); border-color: var(--border); }
.legend-item.dim { opacity: 0.45; }
.legend-note { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- Modal, Drawer, Command Palette, Toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal h2 { font-size: 17px; font-weight: 800; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.source-opt { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text); }
.source-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.source-opt:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }

.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 26px 16px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; margin-top: 10px; }
.dropzone > svg { width: 32px; height: 32px; color: var(--primary); margin: 0 auto; display: block; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }

.drawer-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px); z-index: 65; display: flex; justify-content: flex-end; }
.drawer { width: 100%; max-width: 520px; height: 100%; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; display: grid; gap: 16px; align-content: start; min-width: 0; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; background: var(--surface-2); }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv-item { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.kv-item span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kv-item b { display: block; font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }

.cmd-modal { padding: 0; overflow: hidden; max-width: 560px; }
.cmd-input-wrap { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cmd-input-wrap svg { width: 17px; height: 17px; color: var(--muted); }
.cmd-input-wrap input { flex: 1; border: 0; background: none; outline: none; font-size: 14px; min-width: 0; }
.cmd-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmd-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 10px 4px; }
.cmd-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-align: left; }
.cmd-item:hover, .cmd-item.sel { background: var(--primary-soft); color: var(--primary); }

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 80; display: grid; gap: 8px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: #0f172a; color: #f8fafc; border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg); font-size: 13px; animation: slideUp .18s ease-out;
}
.toast > svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast.success { border-left: 3px solid #10b981; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid #38bdf9; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty { color: var(--muted); text-align: center; padding: 36px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty > svg { width: 28px; height: 28px; color: var(--muted); flex: none; }
.empty.small { padding: 20px 12px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .hero-intel { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3:has(.span2) { grid-template-columns: minmax(0, 1fr); }
  .g3:has(.span2) .span2 { grid-column: auto; }
  .risk-grid, .geo-split { grid-template-columns: 1fr; }
  .sent-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout, .sna-split { grid-template-columns: 1fr; }
  .chat-main { height: 520px; }
  #network-graph { height: 420px; }
  .sna-inspector { height: auto; max-height: 360px; }
}
@media (max-width: 960px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3.kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .hero-health { flex-direction: column; align-items: stretch; }
  .hero-ring-wrap { align-self: center; }
  .mp-articles-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .mobile-brand-mini { display: flex; }
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 264px; z-index: 50; box-shadow: var(--shadow-lg); transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; }
  .app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .nav-badge, .app.collapsed .nav-group, .app.collapsed .user-meta { display: block; }
  .app.collapsed .sys-status { display: grid; }
  .app.collapsed .side-head { flex-direction: row; justify-content: space-between; }
  .app.collapsed .nav a { justify-content: flex-start; padding: 8.5px 11px; }
  .app.collapsed .user-card { flex-direction: row; padding: 8px; }
  .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 45; }
  .side-collapse { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .cmd-label, .cmd-trigger kbd, .top-status-pill { display: none; }
  .main { padding: 16px 14px 48px; }
  .g4, .g3, .g3.kpi-row, .g2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .kpi .val { font-size: 24px; }
  .source-grid, .prompt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; height: 50px; }
  .bc-root, .bc-sep { display: none; }
  .main { padding: 14px 12px 44px; }
  .card { padding: 14px; border-radius: 10px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .filters { width: 100%; }
  .filters select.pill-primary { max-width: none; width: 100%; flex: 1 1 100%; }
  .filters > select:not(.pill-primary) { flex: 1 1 calc(50% - 4px); min-width: 130px; }
  .search-box { width: 100%; flex: 1 1 100%; }
  .search-box input { width: 100%; min-width: 0; }
  .seg { width: 100%; height: auto; flex-wrap: wrap; }
  .seg button { flex: 1 1 auto; min-height: 30px; padding: 4px 8px; }
  .card-head > :last-child { width: 100%; }
  .drawer, .drawer.wide { max-width: 100%; border-left: 0; }
  .drawer-head, .drawer-body, .drawer-foot { padding: 14px 16px; }
  .drawer-foot { flex-wrap: wrap; }
  .mp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #network-graph { height: 350px; }
  .chat-main { height: calc(100vh - 210px); min-height: 380px; }
  .msg-wrap { max-width: 94%; }
  .chat-log { padding: 14px; }
  .modal { padding: 18px; }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media (max-width: 480px) {
  .chan-row { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .chan-row .bar { grid-column: 1 / -1; height: 10px; }
  .sent-tile { padding: 10px 11px; }
  .sent-tile b { font-size: 17px; }
  .kv-grid { grid-template-columns: 1fr; }
  .filters > select:not(.pill-primary) { flex: 1 1 100%; }
}
