/* ============================================================
   9AM Ads Bot — redesigned tokens & base
   ============================================================ */

:root {
  /* canvas / surface */
  --bg: oklch(98% 0.003 80);
  --surface: #ffffff;
  --surface-2: oklch(97.5% 0.004 80);
  --surface-sunken: oklch(96% 0.004 80);

  /* ink */
  --ink: oklch(18% 0.01 80);
  --ink-2: oklch(35% 0.01 80);
  --ink-3: oklch(52% 0.008 80);
  --ink-4: oklch(68% 0.006 80);

  /* lines */
  --line: oklch(91% 0.004 80);
  --line-2: oklch(94% 0.003 80);
  --line-strong: oklch(85% 0.005 80);

  /* accents — same chroma/lightness, hue varies */
  --accent: oklch(48% 0.13 156);          /* emerald */
  --accent-soft: oklch(94% 0.04 156);
  --accent-ink: oklch(28% 0.08 156);

  --danger: oklch(55% 0.18 25);
  --danger-soft: oklch(95% 0.04 25);

  --warn: oklch(70% 0.13 75);
  --warn-soft: oklch(95% 0.05 75);

  --info: oklch(55% 0.13 245);
  --info-soft: oklch(95% 0.04 245);

  /* typography */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-display: 32px;
  --fs-h1: 22px;
  --fs-h2: 15px;
  --fs-body: 13.5px;
  --fs-sm: 12px;
  --fs-xs: 10.5px;

  /* radius */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;

  /* shadow */
  --shadow-1: 0 1px 0 oklch(92% 0.004 80);
  --shadow-2: 0 1px 2px rgba(15, 15, 14, 0.04), 0 0 0 1px var(--line);

  /* layout */
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;
}

[data-theme="dark"] {
  --bg: oklch(16% 0.004 80);
  --surface: oklch(20% 0.005 80);
  --surface-2: oklch(22% 0.005 80);
  --surface-sunken: oklch(18% 0.004 80);

  --ink: oklch(96% 0.004 80);
  --ink-2: oklch(82% 0.005 80);
  --ink-3: oklch(62% 0.006 80);
  --ink-4: oklch(45% 0.005 80);

  --line: oklch(28% 0.005 80);
  --line-2: oklch(24% 0.005 80);
  --line-strong: oklch(35% 0.006 80);

  --accent: oklch(72% 0.14 156);
  --accent-soft: oklch(28% 0.05 156);
  --accent-ink: oklch(88% 0.08 156);

  --danger: oklch(70% 0.17 25);
  --danger-soft: oklch(28% 0.05 25);

  --warn: oklch(78% 0.12 75);
  --warn-soft: oklch(28% 0.05 75);

  --info: oklch(72% 0.12 245);
  --info-soft: oklch(28% 0.05 245);

  --shadow-1: 0 1px 0 rgba(0,0,0,0.4);
  --shadow-2: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px var(--line);
}

/* ===== reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' on, 'cv11' on;
}
button { font-family: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: 'zero' on, 'ss01' on; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.app[data-sidebar="collapsed"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 4px;
}

/* Quay lại CRM — link styled như button-back, KHÔNG dùng default browser link */
.sidebar .sb-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-1, 8px);
  text-decoration: none;
  background: rgba(184,150,110,.08);
  border-left: 3px solid #b8966e;
  color: #b8966e;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
  transition: background 120ms;
}
.sidebar .sb-back:hover {
  background: rgba(184,150,110,.16);
}
.sidebar .sb-back .sb-icon { width: 14px; height: 14px; }
.sidebar .sb-back .sb-icon svg { width: 14px; height: 14px; }

/* Sidebar toggle button — góc trên-phải sidebar */
.sidebar .rd-sidebar-toggle {
  align-self: flex-end;
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 4px;
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
}
.sidebar .rd-sidebar-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 14px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 10px;
}
.sb-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-brand-text { min-width: 0; }
.sb-brand-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.1;
}
.sb-brand-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.sb-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  padding: 14px 8px 6px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--r-1);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: background 120ms, color 120ms;
}
.sb-link:hover { background: var(--surface-sunken); color: var(--ink); }
.sb-link.active {
  background: var(--ink);
  color: var(--bg);
}
.sb-link.active .sb-icon svg { stroke: var(--bg); }
.sb-icon { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; }
.sb-icon svg { width: 16px; height: 16px; stroke: currentColor; }
.sb-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  letter-spacing: 0.04em;
}
.sb-link.active .sb-tag { background: rgba(255,255,255,0.15); color: var(--bg); }

.sb-foot {
  margin-top: auto;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line-2);
}
.sb-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.sb-foot-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.sb-foot-status { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.sb-foot-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }

/* ============================================================
   MAIN
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.topbar-crumb .crumb-mute { color: var(--ink-3); }
.topbar-crumb .crumb-sep { color: var(--ink-4); }
.topbar-crumb .crumb-here { color: var(--ink); font-weight: 600; }

.topbar-spacer { flex: 1; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.topbar-meta .dot-live {
  width: 7px; height: 7px; border-radius: 999px; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 14px; height: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }

/* ============================================================
   PAGE CONTAINER
   ============================================================ */
.page {
  padding: 26px 28px 60px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
}
.page-sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin-top: 6px;
  max-width: 560px;
  line-height: 1.5;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 18px 20px;
}
.card.flush { padding: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.card-head-meta { font-size: 12px; color: var(--ink-3); }
.card-head-actions { display: flex; align-items: center; gap: 8px; }

/* ===== KPI grid ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 14px;
}
.kpi-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kpi-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.kpi-hero-num {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  font-feature-settings: 'zero' on;
}
.kpi-hero-num .currency { color: var(--ink-3); font-size: 22px; margin-right: 6px; vertical-align: 4px; }
.kpi-hero-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.kpi-hero-delta.neg { color: var(--danger); background: var(--danger-soft); }
.progress-track {
  height: 4px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(.2,.7,.2,1);
}
.progress-fill.warn { background: var(--warn); }
.progress-fill.danger { background: var(--danger); }
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
}
.kpi-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-top: auto;
}
.kpi-sub {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-sub .up { color: var(--accent-ink); font-weight: 500; }
.kpi-sub .down { color: var(--danger); font-weight: 500; }

/* ===== Account grid ===== */
.acct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.acct {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 14px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 120ms;
}
.acct:hover { border-color: var(--line-strong); }
.acct-head { display: flex; align-items: center; gap: 10px; }
.acct-platform {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-2);
}
.acct-platform.fb { background: oklch(95% 0.03 245); color: oklch(40% 0.13 245); }
.acct-platform.tk { background: oklch(94% 0.005 80); color: oklch(20% 0.005 80); }
.acct-platform.gg { background: oklch(95% 0.04 70); color: oklch(45% 0.13 70); }
.acct-name { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-status {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.acct-status.paused { background: var(--surface-sunken); color: var(--ink-3); }
.acct-spend { display: flex; align-items: baseline; gap: 8px; }
.acct-spend-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.acct-spend-cap { font-size: 11.5px; color: var(--ink-3); }
.acct-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.acct-metric { display: flex; flex-direction: column; gap: 2px; }
.acct-metric-lbl { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.acct-metric-val { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--ink); }

/* ===== Limits ===== */
.limit-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.4fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.limit-row:last-child { border-bottom: 0; }
.limit-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.limit-name small { color: var(--ink-3); font-weight: 400; display: block; margin-top: 2px; }
.limit-num { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.limit-num small { color: var(--ink-3); }
.limit-bar { display: flex; align-items: center; gap: 10px; }
.limit-bar .progress-track { flex: 1; height: 5px; }
.limit-bar-pct { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); min-width: 40px; text-align: right; }
.limit-tag {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.limit-tag.ok { background: var(--accent-soft); color: var(--accent-ink); }
.limit-tag.warn { background: var(--warn-soft); color: oklch(40% 0.1 75); }
.limit-tag.danger { background: var(--danger-soft); color: var(--danger); }

/* ===== Top ads table ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  font-size: 12.5px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
}
.table th {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 8px 12px;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.ad-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ad-thumb {
  width: 36px; height: 36px;
  border-radius: 6px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.ad-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.6) 3px 4px);
}
.ad-thumb-img {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  flex-shrink: 0;
  display: block;
}
.ad-info { min-width: 0; }
.ad-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.ad-id { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.verdict-dot { width: 5px; height: 5px; border-radius: 999px; }
.verdict.scale { background: var(--accent-soft); color: var(--accent-ink); }
.verdict.scale .verdict-dot { background: var(--accent); }
.verdict.increase { background: var(--info-soft); color: oklch(30% 0.1 245); }
.verdict.increase .verdict-dot { background: var(--info); }
.verdict.keep { background: var(--surface-sunken); color: var(--ink-2); }
.verdict.keep .verdict-dot { background: var(--ink-3); }
.verdict.watch { background: var(--warn-soft); color: oklch(35% 0.1 75); }
.verdict.watch .verdict-dot { background: var(--warn); }
.verdict.kill { background: var(--danger-soft); color: var(--danger); }
.verdict.kill .verdict-dot { background: var(--danger); }

/* ===== Two col row ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ===== Alerts / Actions feed ===== */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.feed-item:last-child { border-bottom: 0; }
.feed-glyph {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: center;
}
.feed-glyph svg { width: 14px; height: 14px; stroke: var(--ink-2); }
.feed-glyph.danger { background: var(--danger-soft); }
.feed-glyph.danger svg { stroke: var(--danger); }
.feed-glyph.warn { background: var(--warn-soft); }
.feed-glyph.warn svg { stroke: oklch(45% 0.13 75); }
.feed-glyph.ok { background: var(--accent-soft); }
.feed-glyph.ok svg { stroke: var(--accent-ink); }
.feed-glyph.info { background: var(--info-soft); }
.feed-glyph.info svg { stroke: oklch(40% 0.13 245); }
.feed-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feed-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.feed-desc { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.feed-meta { font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; text-align: right; }

/* ===== AI eval card ===== */
.eval-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.eval-card {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}
.eval-card-head { display: flex; align-items: center; justify-content: space-between; }
.eval-card-time { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.eval-card-verdict { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; }
.eval-card-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.eval-card-foot { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--ink-3); padding-top: 8px; border-top: 1px solid var(--line-2); }
.eval-card-foot strong { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

/* sparkline */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.spark-bar { width: 4px; background: var(--accent); border-radius: 1px; opacity: 0.85; }
.spark-bar.muted { background: var(--line-strong); opacity: 1; }

/* segmented */
.seg {
  display: inline-flex;
  background: var(--surface-sunken);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.seg button {
  background: transparent;
  border: 0;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 500;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
[data-theme="dark"] .seg button.active { background: var(--surface-2); }

/* page footer */
.page-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-4);
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
  margin-top: 6px;
}
.page-foot code {
  font-family: var(--font-mono);
  background: var(--surface-sunken);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* ============================================================
   ĐO LƯỜNG & SCALE — page-specific
   ============================================================ */

/* Toolbar / filter bar */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.preset-group {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 9px;
}
.preset-group button {
  background: transparent;
  border: 0;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 500;
}
.preset-group button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="dark"] .preset-group button.active { background: var(--surface-2); }

.date-input {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
}
.date-input:focus { border-color: var(--line-strong); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--line-strong); }
.filter-chip svg { width: 12px; height: 12px; stroke: var(--ink-3); }
.filter-chip .chip-caret { color: var(--ink-3); }

.input-num-sm {
  height: 30px;
  width: 100px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
}

.safeguard-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--info-soft);
  color: oklch(35% 0.12 245);
}
[data-theme="dark"] .safeguard-pill { color: var(--info); }
.safeguard-pill .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--info); }

/* Measure KPI grid (6 cards) */
.kpi-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.kpi-6 .kpi { padding: 14px 16px; min-height: 96px; gap: 6px; }
.kpi-6 .kpi-val { font-size: 22px; }
.kpi-6 .kpi-trend { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.kpi-6 .kpi-trend .up { color: var(--accent-ink); font-weight: 500; }
.kpi-6 .kpi-trend .down { color: var(--danger); font-weight: 500; }
.kpi-6 .kpi.accent-blue .kpi-val { color: var(--info); }
.kpi-6 .kpi.accent-green .kpi-val { color: var(--accent); }
.kpi-6 .kpi.accent-amber .kpi-val { color: oklch(55% 0.16 70); }
.kpi-6 .kpi.accent-red .kpi-val { color: var(--danger); }

/* Verdict chip bar */
.verdict-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.verdict-bar-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 6px;
}
.v-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.v-chip:hover { background: var(--surface-2); }
.v-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.v-chip .v-dot { width: 6px; height: 6px; border-radius: 999px; }
.v-chip .v-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  padding: 1px 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
}
.v-chip.active .v-count { background: rgba(255,255,255,0.18); color: var(--bg); }
.v-chip-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 4px;
}

/* Top posts/ads cards row */
.tops-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.top-row-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.top-row-item:last-child { border-bottom: 0; }
.top-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 500;
}
.top-rank.gold { color: oklch(55% 0.13 75); }
.top-title { font-size: 12.5px; color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.top-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; font-family: var(--font-mono); }
.top-stat { text-align: right; }
.top-stat-num { font-family: var(--font-mono); font-size: 14px; font-weight: 500; color: var(--ink); }
.top-stat-lbl { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }

/* View tabs */
.view-tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: 9px;
}
.view-tab {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  cursor: pointer;
  font-weight: 500;
}
.view-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="dark"] .view-tab.active { background: var(--surface-2); }

/* Big detail table */
.dl-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dl-table th, .dl-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.dl-table th {
  position: sticky;
  top: 0;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 8px 12px;
  z-index: 1;
}
.dl-table tbody tr:hover { background: var(--surface-2); }
.dl-table td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.dl-table th.num { text-align: right; }
.dl-table td.sticky-left, .dl-table th.sticky-left { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.dl-table thead th.sticky-left { background: var(--surface-2); z-index: 3; }
.dl-table tbody tr:hover td.sticky-left { background: var(--surface-2); }

/* Source-group colored columns + 2-tier header (Pancake / CRM / FB Ads) */
.dl-table thead tr.dl-group-row th {
  position: sticky; top: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
}
.dl-table thead tr.dl-group-row th.gh-pancake {
  background: color-mix(in oklab, oklch(70% 0.12 200) 14%, var(--surface));
  color: oklch(40% 0.13 200);
}
.dl-table thead tr.dl-group-row th.gh-crm {
  background: color-mix(in oklab, oklch(70% 0.12 290) 14%, var(--surface));
  color: oklch(40% 0.13 290);
}
.dl-table thead tr.dl-group-row th.gh-fb {
  background: color-mix(in oklab, oklch(70% 0.12 245) 14%, var(--surface));
  color: oklch(40% 0.13 245);
}
.dl-table thead tr.dl-col-row th { top: 28px; }
.dl-table td.col-pancake, .dl-table th.col-pancake {
  background: color-mix(in oklab, oklch(70% 0.12 200) 6%, var(--surface));
}
.dl-table td.col-crm, .dl-table th.col-crm {
  background: color-mix(in oklab, oklch(70% 0.12 290) 6%, var(--surface));
}
.dl-table td.col-fb, .dl-table th.col-fb {
  background: color-mix(in oklab, oklch(70% 0.12 245) 6%, var(--surface));
}
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-pancake { background: color-mix(in oklab, oklch(60% 0.12 200) 18%, var(--surface)); color: oklch(80% 0.1 200); }
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-crm { background: color-mix(in oklab, oklch(60% 0.12 290) 18%, var(--surface)); color: oklch(80% 0.1 290); }
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-fb { background: color-mix(in oklab, oklch(60% 0.12 245) 18%, var(--surface)); color: oklch(80% 0.1 245); }
[data-theme="dark"] .dl-table td.col-pancake, [data-theme="dark"] .dl-table th.col-pancake { background: color-mix(in oklab, oklch(60% 0.12 200) 8%, var(--surface)); }
[data-theme="dark"] .dl-table td.col-crm, [data-theme="dark"] .dl-table th.col-crm { background: color-mix(in oklab, oklch(60% 0.12 290) 8%, var(--surface)); }
[data-theme="dark"] .dl-table td.col-fb, [data-theme="dark"] .dl-table th.col-fb { background: color-mix(in oklab, oklch(60% 0.12 245) 8%, var(--surface)); }

/* Summary row */
.dl-table tr.dl-summary-row td {
  background: var(--surface-sunken);
  font-weight: 600;
  border-bottom: 2px solid var(--line-strong);
  position: sticky;
  top: 56px;
  z-index: 1;
}
.dl-table tr.dl-summary-row td.col-pancake { background: color-mix(in oklab, oklch(70% 0.12 200) 12%, var(--surface-sunken)); }
.dl-table tr.dl-summary-row td.col-crm { background: color-mix(in oklab, oklch(70% 0.12 290) 12%, var(--surface-sunken)); }
.dl-table tr.dl-summary-row td.col-fb { background: color-mix(in oklab, oklch(70% 0.12 245) 12%, var(--surface-sunken)); }

/* Ad name cell with status + name + chips */
.ad-name-cell { display: flex; flex-direction: column; gap: 4px; min-width: 240px; max-width: 360px; }
.ad-name-row { display: flex; align-items: center; gap: 8px; }
.fb-status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.fb-status-badge.fb-active { background: var(--accent-soft); color: var(--accent-ink); }
.fb-status-badge.fb-paused { background: var(--danger-soft); color: var(--danger); }
.fb-status-badge.fb-unknown { background: var(--surface-sunken); color: var(--ink-3); }
.fb-status-badge .dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.ad-name-cell .ad-title {
  font-size: 12.5px; font-weight: 500; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-name-cell .ad-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ad-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-sunken);
  color: var(--ink-3);
  cursor: pointer;
}
.ad-chip:hover { background: var(--line); color: var(--ink); }
.ad-chip.tag-chip { background: oklch(95% 0.04 65); color: oklch(45% 0.12 65); font-family: var(--font-sans); }
[data-theme="dark"] .ad-chip.tag-chip { background: oklch(28% 0.05 65); color: oklch(85% 0.08 65); }

/* Verdict cell with score */
.verdict-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.verdict-score { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; padding-left: 2px; }
.verdict-score.pos { color: var(--accent-ink); }
.verdict-score.neg { color: var(--danger); }

/* Action cluster: pause / resume / scale-menu */
.act-cluster { display: inline-flex; gap: 3px; }
.act-btn {
  width: 28px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 120ms;
}
.act-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.act-btn.pause:hover { color: var(--danger); border-color: var(--danger); }
.act-btn.resume:hover { color: var(--accent); border-color: var(--accent); }
.act-btn.scale:hover { color: var(--info); border-color: var(--info); }
.act-btn.is-disabled { opacity: 0.35; cursor: not-allowed; }
.act-btn.is-active.resume { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.act-btn svg { width: 12px; height: 12px; }

/* Post link cell */
.post-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--info);
  text-decoration: none;
}
.post-link:hover { background: var(--info-soft); border-color: var(--info); }
.post-link svg { width: 12px; height: 12px; }

/* Verdict bar score-chip enhancements */
.v-chip.chip-all.active { background: var(--ink); color: var(--bg); }
.v-chip.chip-winners {
  background: linear-gradient(135deg, oklch(75% 0.16 75) 0%, oklch(65% 0.18 50) 100%);
  color: #fff; border-color: transparent;
}
.v-chip.chip-winners .v-count { background: rgba(255,255,255,0.22); color: #fff; }
.v-chip.chip-winners:hover { filter: brightness(1.05); }
.v-chip.chip-winners.active { box-shadow: 0 0 0 3px color-mix(in oklab, oklch(75% 0.16 75) 25%, transparent); }

.kpi.accent-blue .kpi-val { color: var(--info); }

/* Tighten KPI 6-grid to feel cleaner */
.kpi-6 .kpi { background: var(--surface); }
.kpi-6 .kpi-label { font-size: 10.5px; }

/* ===========================================================
   TOP LEADERBOARDS — production style (thumb + ext icon + green booking)
   =========================================================== */
.tops-table tbody td { padding: 9px 12px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.tops-table tbody tr:hover td { background: var(--surface-2); }

/* Thumbnail next to title */
.top-row-thumb-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  max-width: 320px;
}
.top-row-thumb {
  width: 38px; height: 38px;
  border-radius: 6px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.top-row-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 35%, oklch(80% 0.04 30) 0%, oklch(70% 0.06 30) 30%, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.6) 3px 4px);
}
.top-row-thumb.thumb-2::before {
  background-image:
    radial-gradient(circle at 50% 35%, oklch(78% 0.06 50) 0%, oklch(65% 0.07 60) 30%, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.6) 3px 4px);
}
.top-row-thumb.thumb-3::before {
  background-image:
    radial-gradient(circle at 50% 40%, oklch(82% 0.05 80) 0%, oklch(70% 0.08 60) 30%, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.6) 3px 4px);
}
.top-row-thumb.thumb-4::before {
  background-image:
    radial-gradient(circle at 50% 35%, oklch(75% 0.06 40) 0%, oklch(60% 0.08 30) 30%, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.6) 3px 4px);
}
.top-row-thumb.thumb-camp {
  background: var(--accent-soft);
}
.top-row-thumb.thumb-camp::before { background-image: none; }
.top-row-thumb.thumb-camp::after {
  content: '📋';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.top-row-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.top-row-title-text {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.top-row-ext {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--info);
  cursor: pointer;
  text-decoration: none;
}
.top-row-ext:hover { background: var(--info-soft); border-color: var(--info); }
.top-row-ext svg { width: 12px; height: 12px; }

/* Green booking number */
.top-row-bk { color: var(--accent-ink); font-weight: 600; }

/* AD ID column (right table) */
.top-row-ad-id-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.top-row-ad-id-cell:hover { color: var(--accent-ink); }

.tops-row .card-head h2 {
  display: inline-flex; align-items: center; gap: 6px;
}
.tops-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tops-table th {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-3);
  text-align: left; padding: 6px 10px;
  border-bottom: 1px solid var(--line-2);
}
.tops-table th.num { text-align: right; }
.tops-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.tops-table td.num { font-family: var(--font-mono); text-align: right; }
.tops-table tr:last-child td { border-bottom: 0; }
.tops-table tr:hover td { background: var(--surface-2); }
.rank-medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--ink-4);
}
.rank-medal.gold { color: oklch(60% 0.16 75); font-size: 14px; }
.rank-medal.silver { color: oklch(65% 0.02 250); font-size: 14px; }
.rank-medal.bronze { color: oklch(55% 0.14 50); font-size: 14px; }
.top-post-title { font-size: 12px; color: var(--ink); font-weight: 500; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-post-meta { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 2px; }
.top-num-strong { color: var(--accent-ink); font-weight: 600; }

/* Safeguard pill in topbar — show day/hour quota */
.sg-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11.5px; font-weight: 500;
}
.sg-pill .sg-bar { display: inline-flex; gap: 4px; align-items: center; font-family: var(--font-mono); }
.sg-pill .sg-key { color: oklch(40% 0.05 156); opacity: 0.85; }
[data-theme="dark"] .sg-pill .sg-key { color: var(--accent-ink); opacity: 0.7; }
.sg-pill .sg-sep { width: 1px; height: 12px; background: currentColor; opacity: 0.25; }

.fb-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.fb-pill.active { background: var(--accent-soft); color: var(--accent-ink); }
.fb-pill.paused { background: var(--surface-sunken); color: var(--ink-3); }
.fb-pill .fb-dot { width: 5px; height: 5px; border-radius: 999px; }
.fb-pill.active .fb-dot { background: var(--accent); }
.fb-pill.paused .fb-dot { background: var(--ink-4); }

.row-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 100ms;
}
.dl-table tr:hover .row-actions { opacity: 1; }
.row-act {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.row-act:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.row-act svg { width: 12px; height: 12px; }
.row-act.danger:hover { color: var(--danger); border-color: var(--danger); }

/* Bulk bar */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-2);
  font-size: 12.5px;
}
.bulk-bar strong { font-family: var(--font-mono); }
.bulk-bar .bulk-spacer { flex: 1; }
.bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.bulk-btn:hover { background: rgba(255,255,255,0.12); }

/* notes section */
.notes-block {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 16px 20px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.notes-block h3 {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 10px;
}
.notes-block code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
}
.notes-block ul { margin: 0; padding-left: 18px; }
.notes-block li { margin: 4px 0; }

/* ============================================================
   ACCOUNTS & SETTINGS PAGE
   ============================================================ */
.set-page { display: flex; flex-direction: column; gap: 18px; }

.set-anchor {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-3);
  padding: 4px 4px 0;
}
.set-anchor .lbl {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  color: var(--ink-4);
}
.set-anchor .line { flex: 1; height: 1px; background: var(--line); }

/* Top status strip */
.set-status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.set-status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.set-status-card .lbl {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
}
.set-status-card .val {
  font-family: var(--font-mono);
  font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.set-status-card .val.ok { color: var(--accent-ink); }
.set-status-card .val.warn { color: oklch(40% 0.13 75); }
.set-status-card .sub { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.set-status-card .sub .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.set-status-card .sub .dot.warn { background: var(--warn); }
.set-status-card .sub .dot.danger { background: var(--danger); }

@media (max-width: 1100px) { .set-status-strip { grid-template-columns: repeat(2, 1fr); } }

/* Account mgmt grid */
.acct-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}
.acct-mgmt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.12s;
}
.acct-mgmt-card:hover { border-color: var(--line-strong); }
.acct-mgmt-card.inactive { opacity: 0.65; background: var(--surface-2); }

.acct-mgmt-head {
  display: flex; align-items: flex-start; gap: 10px;
  justify-content: space-between;
}
.acct-mgmt-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
}
.acct-mgmt-icon.fb { background: oklch(94% 0.04 250); color: oklch(40% 0.16 250); }
.acct-mgmt-icon.tk { background: oklch(20% 0.005 80); color: #fff; }
.acct-mgmt-icon.gg { background: oklch(95% 0.05 70); color: oklch(45% 0.13 70); }

.acct-mgmt-title-block { flex: 1; min-width: 0; }
.acct-mgmt-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin-bottom: 2px;
}
.acct-mgmt-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.acct-mgmt-status-pill {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.acct-mgmt-status-pill.active { background: var(--accent-soft); color: var(--accent-ink); }
.acct-mgmt-status-pill.inactive { background: var(--surface-sunken); color: var(--ink-3); }

.acct-mgmt-spend-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.acct-mgmt-spend-num {
  font-family: var(--font-mono);
  font-size: 22px; font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.acct-mgmt-spend-cap { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }
.acct-mgmt-spend-trend {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.acct-mgmt-spend-trend.up { color: var(--accent-ink); }
.acct-mgmt-spend-trend.down { color: var(--danger); }

.acct-mgmt-progress {
  height: 4px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.acct-mgmt-progress-fill {
  height: 100%; background: var(--ink);
  border-radius: 999px;
  transition: width 400ms ease;
}
.acct-mgmt-progress-fill.warn { background: var(--warn); }
.acct-mgmt-progress-fill.danger { background: var(--danger); }

.acct-mgmt-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.acct-mgmt-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-3);
}
.acct-mgmt-tag.ok { background: var(--accent-soft); color: var(--accent-ink); }
.acct-mgmt-tag.warn { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.acct-mgmt-tag .key {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}

.acct-mgmt-actions {
  display: flex; gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}
.acct-mgmt-actions .btn-act {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: all 0.1s;
}
.acct-mgmt-actions .btn-act:hover { background: var(--surface-2); border-color: var(--line-strong); }
.acct-mgmt-actions .btn-act.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.acct-mgmt-actions .btn-act.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.acct-mgmt-actions .btn-act.primary:hover { background: var(--ink-2); }

/* Config card */
.cfg-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 0;
  overflow: hidden;
}
.cfg-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.cfg-card-head h2 {
  font-size: 13px; font-weight: 600; margin: 0;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.cfg-card-head h2 .glyph {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 13px;
}
.cfg-card-head .meta { font-size: 11px; color: var(--ink-3); }

.cfg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  align-items: center;
}
.cfg-row:last-child { border-bottom: 0; }
.cfg-row.full { grid-template-columns: 1fr; }
.cfg-row-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.cfg-row-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.5;
}
.cfg-row-hint code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-sunken);
  color: var(--ink-3);
  padding: 1px 5px;
  border-radius: 3px;
}

.cfg-input {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.cfg-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cfg-input.mono { font-family: var(--font-mono); font-size: 11.5px; }

.cfg-input-wrap {
  display: flex; gap: 6px; align-items: stretch;
  min-width: 320px;
}
.cfg-input-wrap .cfg-input { flex: 1; }
.cfg-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.cfg-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.cfg-btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cfg-btn.primary:hover { background: var(--ink-2); }
.cfg-btn.danger { color: var(--danger); }
.cfg-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.cfg-toggle {
  position: relative;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.cfg-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.cfg-toggle.on { background: var(--accent); }
.cfg-toggle.on::after { left: 18px; }

/* Threshold grid */
.th-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.th-group {
  padding: 14px 18px;
  border-right: 1px solid var(--line-2);
}
.th-group:last-child { border-right: 0; }
.th-group-title {
  font-size: 11.5px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 6px;
}
.th-group-title.v-kill { color: var(--danger); }
.th-group-title.v-scale { color: var(--accent-ink); }
.th-group-title.v-watch { color: oklch(40% 0.13 75); }
.th-row {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  font-size: 11.5px;
}
.th-row label { color: var(--ink-3); line-height: 1.4; }
.th-row input {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.th-row input:focus { outline: none; border-color: var(--accent); }

@media (max-width: 1100px) {
  .th-grid { grid-template-columns: 1fr; }
  .th-group { border-right: 0; border-bottom: 1px solid var(--line-2); }
}

/* Cron list */
.cron-list { display: flex; flex-direction: column; }
.cron-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-2);
  font-size: 12px;
}
.cron-row:last-child { border-bottom: 0; }
.cron-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); }
.cron-dot.warn { background: var(--warn); }
.cron-dot.danger { background: var(--danger); }
.cron-label { color: var(--ink); font-weight: 500; }
.cron-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.cron-next {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--info);
  font-weight: 500;
  text-align: right;
  min-width: 100px;
}

/* Telegram group rows */
.tg-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
}
.tg-row:last-child { border-bottom: 0; }
.tg-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--info-soft);
  color: var(--info);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.tg-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.tg-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; font-family: var(--font-mono); }
.tg-actions { display: flex; gap: 4px; }
.tg-default-pill {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 7px;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 999px;
}

/* Pancake page rows */
.pc-row {
  display: grid;
  grid-template-columns: 1fr 110px 100px 120px;
  gap: 10px;
  align-items: center;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-2);
}
.pc-row:last-child { border-bottom: 0; }
.pc-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.pc-id { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.pc-status-pill {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  text-align: center;
}
.pc-status-pill.ok { background: var(--accent-soft); color: var(--accent-ink); }
.pc-status-pill.missing { background: var(--danger-soft); color: var(--danger); }
.pc-convs {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.pc-last { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: right; }

@media (max-width: 1280px) {
  .kpi-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .kpi-6 { grid-template-columns: repeat(2, 1fr); }
  .tops-row { grid-template-columns: 1fr; }
}

/* density */
[data-density="compact"] .page { padding: 18px 22px 50px; gap: 16px; }
[data-density="compact"] .card { padding: 14px 16px; }
[data-density="compact"] .kpi-hero-num { font-size: 34px; }
[data-density="compact"] .kpi-val { font-size: 22px; }
[data-density="compact"] .table td, [data-density="compact"] .table th { padding: 8px 10px; }
[data-density="comfy"] .page { padding: 32px 32px 70px; gap: 28px; }
[data-density="comfy"] .card { padding: 22px 24px; }

/* responsive — collapse sidebar to icons */
@media (max-width: 920px) {
  .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
  .sb-brand-text, .sb-link span:last-child, .sb-section, .sb-tag, .sb-foot-name, .sb-foot-status { display: none; }
  .sb-brand { justify-content: center; padding: 6px 0 14px; }
  .sb-link { justify-content: center; padding: 8px; }
  .sb-foot { justify-content: center; padding: 10px 0; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-hero { grid-column: span 2; }
  .two-col { grid-template-columns: 1fr; }
}

/* ============================================================
   REFINEMENTS — "instrument grade" pass
   ============================================================ */

/* —— KPI 6 refined: sparkline + delta + clearer hierarchy —— */
.kpi-6 .kpi {
  position: relative;
  padding: 14px 16px 12px;
  min-height: 108px;
  gap: 4px;
}
.kpi-6 .kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.kpi-6 .kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.kpi-6 .kpi-glyph {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: var(--surface-sunken);
  color: var(--ink-3);
}
.kpi-6 .kpi-glyph svg { width: 13px; height: 13px; stroke-width: 1.7; }
.kpi-6 .kpi-glyph.accent-blue { background: var(--info-soft); color: var(--info); }
.kpi-6 .kpi-glyph.accent-green { background: var(--accent-soft); color: var(--accent-ink); }
.kpi-6 .kpi-glyph.accent-amber { background: var(--warn-soft); color: oklch(45% 0.13 75); }
.kpi-6 .kpi-glyph.accent-red { background: var(--danger-soft); color: var(--danger); }

.kpi-6 .kpi-val {
  font-size: 26px;
  font-weight: 500;
  margin-top: 0;
  letter-spacing: -0.015em;
}
.kpi-6 .kpi-val .currency-pre {
  font-size: 14px;
  color: var(--ink-3);
  margin-right: 2px;
  font-weight: 400;
}

.kpi-6 .kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.kpi-6 .kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-6 .kpi-delta.up { color: var(--accent-ink); background: var(--accent-soft); }
.kpi-6 .kpi-delta.down { color: var(--danger); background: var(--danger-soft); }
.kpi-6 .kpi-delta.flat { color: var(--ink-3); background: var(--surface-sunken); }
.kpi-6 .kpi-delta svg { width: 10px; height: 10px; stroke-width: 2; }

.kpi-6 .spark { height: 18px; flex: 1; max-width: 80px; gap: 1.5px; }
.kpi-6 .spark-bar { width: 3px; opacity: 0.95; border-radius: 1px; }
.kpi-6 .spark-bar.muted { opacity: 0.28; }

/* —— Verdict bar refined: cleaner chips, no emoji, dot leads —— */
.v-chip {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 500;
  gap: 7px;
  letter-spacing: -0.005em;
}
.v-chip .v-dot { width: 7px; height: 7px; }
.v-chip .v-count {
  font-size: 10.5px;
  padding: 1px 6px;
  letter-spacing: 0;
  min-width: 22px;
  text-align: center;
}
.v-chip-sep { height: 18px; margin: 0 6px; }
.verdict-bar-label {
  margin-right: 10px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  height: 24px;
}

/* WINNERS chip — sleek gold gradient */
.v-chip.chip-winners {
  background: linear-gradient(135deg, oklch(78% 0.16 80) 0%, oklch(62% 0.18 50) 100%);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.v-chip.chip-winners .v-count {
  background: rgba(255,255,255,0.24);
  color: #fff;
  font-weight: 600;
}
.v-chip.chip-winners .v-dot { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.3); }

/* —— Top sections: bar viz + cleaner rows —— */
.tops-table td { padding: 10px 10px; vertical-align: middle; }
.tops-table tr:hover td { background: var(--surface-2); }
.rank-medal.gold, .rank-medal.silver, .rank-medal.bronze { font-size: 16px; }
.top-post-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.top-post-title { font-weight: 500; font-size: 12.5px; }
.top-post-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.top-post-meta .ext { color: var(--info); cursor: pointer; }
.top-post-meta .ext svg { width: 11px; height: 11px; }

.booking-bar-wrap { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 80px; }
.booking-bar {
  position: relative;
  width: 56px; height: 5px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.booking-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 999px;
}
.booking-bar-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-width: 16px;
  text-align: right;
}

/* —— Main detail table refined: vertical group dividers (not full column tint) —— */
.dl-table { font-size: 12.5px; }
.dl-table td, .dl-table th { padding: 9px 11px; }

/* Drop the full-column tint — keep only a tiny tint on group header */
.dl-table td.col-pancake, .dl-table th.col-pancake,
.dl-table td.col-crm, .dl-table th.col-crm,
.dl-table td.col-fb, .dl-table th.col-fb {
  background: var(--surface);
}
[data-theme="dark"] .dl-table td.col-pancake,
[data-theme="dark"] .dl-table th.col-pancake,
[data-theme="dark"] .dl-table td.col-crm,
[data-theme="dark"] .dl-table th.col-crm,
[data-theme="dark"] .dl-table td.col-fb,
[data-theme="dark"] .dl-table th.col-fb { background: var(--surface); }

/* Vertical accent line at FIRST cell of each group */
.dl-table td.col-pancake.col-first,
.dl-table th.col-pancake.col-first {
  border-left: 2px solid oklch(70% 0.12 200);
}
.dl-table td.col-crm.col-first,
.dl-table th.col-crm.col-first {
  border-left: 2px solid oklch(70% 0.12 290);
}
.dl-table td.col-fb.col-first,
.dl-table th.col-fb.col-first {
  border-left: 2px solid oklch(70% 0.12 245);
}

.dl-table thead tr.dl-group-row th {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 10px;
}
.dl-table thead tr.dl-group-row th.gh-pancake {
  background: var(--surface);
  color: oklch(38% 0.13 200);
  border-left: 2px solid oklch(70% 0.12 200);
}
.dl-table thead tr.dl-group-row th.gh-crm {
  background: var(--surface);
  color: oklch(38% 0.13 290);
  border-left: 2px solid oklch(70% 0.12 290);
}
.dl-table thead tr.dl-group-row th.gh-fb {
  background: var(--surface);
  color: oklch(38% 0.13 245);
  border-left: 2px solid oklch(70% 0.12 245);
}
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-pancake { color: oklch(78% 0.1 200); }
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-crm { color: oklch(78% 0.1 290); }
[data-theme="dark"] .dl-table thead tr.dl-group-row th.gh-fb { color: oklch(78% 0.1 245); }

.dl-table thead tr.dl-col-row th {
  font-size: 10px;
  letter-spacing: 0.07em;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dl-table tbody tr { transition: background 80ms; }
.dl-table tbody tr:not(.dl-summary-row):hover { background: var(--surface-2); }

.dl-table tr.dl-summary-row td {
  background: var(--bg);
  font-weight: 600;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.dl-table tr.dl-summary-row td.col-pancake.col-first { background: color-mix(in oklab, oklch(70% 0.12 200) 7%, var(--bg)); }
.dl-table tr.dl-summary-row td.col-crm.col-first { background: color-mix(in oklab, oklch(70% 0.12 290) 7%, var(--bg)); }
.dl-table tr.dl-summary-row td.col-fb.col-first { background: color-mix(in oklab, oklch(70% 0.12 245) 7%, var(--bg)); }

/* —— Ad name cell refined (no emoji chips) —— */
.fb-status-badge {
  font-size: 10px;
  padding: 2px 7px 2px 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fb-status-badge .dot { width: 5px; height: 5px; }
.ad-chips { gap: 5px; align-items: center; }
.ad-chip {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-3);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid transparent;
  transition: background 80ms, border-color 80ms;
}
.ad-chip:hover { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.ad-chip .chip-key {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
}
.ad-chip.tag-chip {
  background: transparent;
  color: var(--ink-3);
  font-family: var(--font-mono);
  border-color: var(--line);
}

/* —— Verdict pill refined: uppercase tracking + score next to it —— */
.verdict-cell { gap: 4px; }
.verdict {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  gap: 6px;
  font-weight: 600;
}
.verdict .verdict-dot { width: 6px; height: 6px; }
.verdict-score {
  font-size: 10px;
  padding-left: 2px;
  letter-spacing: 0.02em;
}

/* —— Action cluster: SVG-icon based, sleeker —— */
.act-cluster { gap: 2px; }
.act-btn {
  width: 26px; height: 24px;
  border-radius: 5px;
}
.act-btn svg { width: 13px; height: 13px; stroke-width: 1.7; }

/* —— Post link icon —— */
.post-link {
  width: 24px; height: 24px;
}
.post-link svg { width: 12px; height: 12px; stroke-width: 1.7; }

/* —— Inline bar for spend cell in table —— */
.cell-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.cell-bar-num { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.cell-bar-rail {
  width: 60px; height: 3px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.cell-bar-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
  opacity: 0.8;
}

/* —— Frequency cell heat —— */
.freq-cell {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}
.freq-dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--accent);
}
.freq-cell.warn .freq-dot { background: var(--warn); }
.freq-cell.danger .freq-dot { background: var(--danger); }
.freq-cell.danger { color: var(--danger); font-weight: 600; }
.freq-cell.warn { color: oklch(40% 0.13 75); font-weight: 500; }

/* —— Tools (date toolbar) refined —— */
.toolbar { padding: 11px 14px; gap: 8px; }
.preset-group { padding: 2px; border-radius: 8px; }
.preset-group button { font-size: 11.5px; padding: 4px 10px; }
.date-input { height: 28px; font-size: 11.5px; padding: 0 9px; }
.filter-chip { height: 28px; padding: 0 10px; font-size: 11.5px; gap: 5px; }
.input-num-sm { height: 28px; width: 56px; padding: 0 8px; font-size: 11.5px; }

/* —— Topbar safeguard pill subtler —— */
.sg-pill {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-weight: 500;
}
.sg-pill .sg-key { color: var(--ink-4); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.sg-pill .sg-bar { gap: 6px; }

/* —— Card head — uppercase mini-label style for sectioning —— */
.card-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card-head-meta { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }

/* Section divider with light label */
.section-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 0;
}
.section-rule-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
}
.section-rule-line { flex: 1; height: 1px; background: var(--line); }

/* ============================================================
   CREATIVE VIEW v3 — production bp-card layout (horizontal row)
   ============================================================ */

/* Filter toolbar above creative list */
.cv-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.cv-toolbar .cv-search {
  flex: 1;
  min-width: 240px;
  max-width: 320px;
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink);
  font-family: inherit;
}
.cv-toolbar .cv-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.cv-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.cv-checkbox input { margin: 0; }

.cv-select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}

.cv-num-input {
  width: 56px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}

.cv-toolbar .cv-min-grp {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.cv-count {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* Card list */
.cv-list { display: flex; flex-direction: column; }

/* Single card: horizontal row */
.cv-card {
  display: grid;
  grid-template-columns: 72px 1fr 220px 360px 28px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.1s;
}
.cv-card:first-child { border-top: 0; }
.cv-card:hover { background: var(--surface-2); }
.cv-card.is-winner { background: color-mix(in oklab, var(--accent-soft) 30%, var(--surface)); }
.cv-card.is-winner:hover { background: color-mix(in oklab, var(--accent-soft) 50%, var(--surface)); }

@media (max-width: 1400px) {
  .cv-card { grid-template-columns: 64px 1fr 240px 28px; }
  .cv-quality-block { display: none; }
}

/* Thumbnail */
.cv-thumb {
  width: 72px; height: 72px;
  border-radius: var(--r-2);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
.cv-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 35%, oklch(80% 0.04 30) 0%, oklch(68% 0.06 30) 30%, transparent 55%),
    repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.5) 3px 4px);
}
.cv-thumb.thumb-2::before { background-image: radial-gradient(circle at 50% 35%, oklch(78% 0.06 50) 0%, oklch(65% 0.07 60) 30%, transparent 55%), repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.5) 3px 4px); }
.cv-thumb.thumb-3::before { background-image: radial-gradient(circle at 50% 40%, oklch(82% 0.05 80) 0%, oklch(70% 0.08 60) 30%, transparent 55%), repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.5) 3px 4px); }
.cv-thumb.thumb-4::before { background-image: radial-gradient(circle at 50% 35%, oklch(75% 0.06 40) 0%, oklch(60% 0.08 30) 30%, transparent 55%), repeating-linear-gradient(135deg, transparent 0 3px, oklch(88% 0.005 80 / 0.5) 3px 4px); }

/* Title + meta + stats column */
.cv-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cv-row1 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cv-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 480px;
}
.cv-type-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  text-transform: none;
  letter-spacing: 0;
}
.cv-type-chip.type-image { background: oklch(94% 0.05 350); color: oklch(40% 0.16 350); }
.cv-type-chip.type-share { background: var(--accent-soft); color: var(--accent-ink); }

.cv-ext-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--info);
  text-decoration: none;
  cursor: pointer;
}
.cv-ext-link:hover { background: var(--info-soft); border-color: var(--info); }
.cv-ext-link svg { width: 11px; height: 11px; }

.cv-row2 {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.cv-row2 .cv-acc {
  color: var(--info);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 3px;
}
.cv-row2 .cv-acc:hover { text-decoration: underline; }
.cv-row2 .cv-tag {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--ink-3);
}

/* Mini stats line: Inbox 85   Chất 65 (76%)   Spam 20 (24%)   Tỉnh 0 (0%)   Booking 9 (11%) */
.cv-stats-line {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 16px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.cv-stat { display: inline-flex; align-items: baseline; gap: 4px; }
.cv-stat strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cv-stat .pct { font-size: 10.5px; opacity: 0.75; font-family: var(--font-mono); }
.cv-stat.cv-bk { color: var(--accent-ink); }
.cv-stat.cv-bk strong { color: var(--accent-ink); }
.cv-stat.q-good { color: var(--accent-ink); }
.cv-stat.q-good strong { color: var(--accent-ink); }
.cv-stat.q-warn { color: oklch(45% 0.13 75); }
.cv-stat.q-warn strong { color: oklch(45% 0.13 75); }
.cv-stat.q-bad { color: var(--danger); }
.cv-stat.q-bad strong { color: var(--danger); }

/* Quality bar */
.cv-quality-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.cv-qb-track {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-sunken);
}
.cv-qb-good { background: var(--accent); }
.cv-qb-warn { background: var(--warn); }
.cv-qb-bad { background: var(--danger); }
.cv-qb-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.cv-qb-labels .lbl-good { color: var(--accent-ink); }
.cv-qb-labels .lbl-warn { color: oklch(45% 0.13 75); }
.cv-qb-labels .lbl-bad { color: var(--danger); }

/* Bigstats row at right */
.cv-bigstats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: center;
}
.cv-bs { text-align: center; }
.cv-bs-num {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  line-height: 1;
}
.cv-bs-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-top: 4px;
}
.cv-bs-num.bk { color: var(--accent-ink); }
.cv-bs-num.spend { color: var(--info); }
.cv-bs-num.rev { color: var(--warn); }
.cv-bs-num.rev-muted { color: var(--ink-4); font-weight: 400; }
.cv-bs-num.acos-good { color: var(--accent-ink); }
.cv-bs-num.acos-warn { color: oklch(45% 0.13 75); }
.cv-bs-num.acos-bad { color: var(--danger); }
.cv-bs-num.acos-muted { color: var(--ink-4); font-weight: 400; }

/* Chevron */
.cv-chevron {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  color: var(--ink-4);
  transition: transform 0.15s;
}
.cv-card.expanded .cv-chevron { transform: rotate(180deg); color: var(--accent-ink); }

/* Expanded body: variants table */
.cv-body {
  display: none;
  background: var(--surface-2);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.cv-card-wrap.expanded .cv-body { display: block; }
.cv-card-wrap.expanded > .cv-card { background: var(--surface-2); }

.cv-body-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cv-body-table th {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface);
}
.cv-body-table th.num { text-align: right; }
.cv-body-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cv-body-table tr:last-child td { border-bottom: 0; }
.cv-body-table tr:hover td { background: color-mix(in oklab, var(--surface) 70%, var(--surface-2)); }
.cv-body-table td.num { font-family: var(--font-mono); text-align: right; }
.cv-body-table .cv-best-row { background: oklch(96% 0.04 75); }
.cv-body-table .cv-best-row:hover td { background: oklch(94% 0.05 75); }

/* ============================================================
   Expanded body — production ad-row layout (rich targeting cell)
   ============================================================ */
.cv-body .cv-bt-wrap { overflow-x: auto; }
.cv-bt {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

/* Two-tier header: top label + sub label */
.cv-bt thead th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: left;
  padding: 9px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: top;
}
.cv-bt thead th.num { text-align: right; }
.cv-bt thead .th-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 8.5px;
  color: var(--ink-4);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* Summary row — green highlighted */
.cv-bt-summary td {
  background: oklch(95% 0.04 156) !important;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  border-bottom: 2px solid var(--accent);
  color: var(--accent-ink);
  padding: 10px 12px;
}
.cv-bt-summary .cv-targeting-cell {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 5px;
}
.cv-bt-summary .num .neg { color: var(--danger); }

/* Ad row */
.cv-bt tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
  white-space: nowrap;
}
.cv-bt tbody td.num {
  font-family: var(--font-mono);
  text-align: right;
}
.cv-bt tbody tr:hover td { background: color-mix(in oklab, var(--surface) 70%, var(--accent-soft) 6%); }
.cv-bt tbody tr:last-child td { border-bottom: 0; }

/* Targeting cell (rich, multi-row) */
.cv-targeting {
  display: flex; flex-direction: column;
  gap: 5px;
  min-width: 280px;
  max-width: 380px;
  white-space: normal;
}
.cv-targ-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
  cursor: pointer;
}
.cv-targ-id:hover { text-decoration: underline; }
.cv-targ-name {
  font-size: 11px;
  color: var(--ink-3);
  font-style: italic;
}
.cv-targ-acc-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-sunken);
  color: var(--info);
  width: fit-content;
  cursor: pointer;
  border: 1px solid transparent;
}
.cv-targ-acc-chip:hover { border-color: var(--info); background: var(--info-soft); }

/* Mini-pill strip — colored stats */
.cv-pill-strip {
  display: flex; flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.cv-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cv-pill .pill-key {
  font-family: var(--font-sans);
  font-weight: 600;
}
.cv-pill.p-thruplay { background: oklch(94% 0.05 350); color: oklch(40% 0.16 350); }
.cv-pill.p-playrate { background: oklch(94% 0.05 290); color: oklch(40% 0.13 290); }
.cv-pill.p-ctr { background: var(--info-soft); color: var(--info); }
.cv-pill.p-cpm { background: oklch(95% 0.04 250); color: oklch(45% 0.14 250); }
.cv-pill.p-cpc { background: oklch(95% 0.04 30); color: oklch(40% 0.13 30); }
.cv-pill.p-freq { background: var(--warn-soft); color: oklch(45% 0.13 75); }
.cv-pill.p-inbox { background: var(--info-soft); color: var(--info); }
.cv-pill.p-booking { background: var(--accent-soft); color: var(--accent-ink); }
.cv-pill.p-spam { background: var(--danger-soft); color: var(--danger); }
.cv-pill.p-cpi { background: var(--accent-soft); color: var(--accent-ink); }
.cv-pill.p-rating { background: var(--warn-soft); color: oklch(45% 0.13 75); border: 1px solid oklch(75% 0.13 75 / 0.4); }
.cv-pill.p-rating-good { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent); }
.cv-pill.p-rating-bad { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }

/* Drill-down link in numeric cells */
.cv-drill {
  color: var(--info);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.cv-drill:hover { border-bottom-color: var(--info); }
.cv-num-pct {
  font-size: 9.5px;
  color: var(--ink-3);
  opacity: 0.85;
  font-family: var(--font-mono);
  margin-left: 1px;
}
.cv-bt td.num .cv-num-bk { color: var(--accent-ink); font-weight: 600; }
.cv-bt td.num.has-warn { color: var(--warn); }
.cv-bt td.num.has-good { color: var(--accent-ink); }
.cv-bt td.num.has-bad { color: var(--danger); }
.cv-bt td.num .cpb-good { color: var(--accent-ink); }
.cv-bt td.num .cpb-warn { color: oklch(45% 0.13 75); }
.cv-bt td.num .cpb-bad { color: var(--danger); }

.cv-bt .cv-roi-pos { color: var(--accent-ink); font-weight: 700; }
.cv-bt .cv-roi-neg { color: var(--danger); font-weight: 700; }

/* Verdict pill at right */
.cv-verdict-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.cv-verdict-pill.v-scale { background: var(--accent-soft); color: var(--accent-ink); }
.cv-verdict-pill.v-increase { background: var(--info-soft); color: var(--info); }
.cv-verdict-pill.v-keep { background: var(--surface-sunken); color: var(--ink-3); }
.cv-verdict-pill.v-watch { background: var(--warn-soft); color: oklch(45% 0.13 75); }
.cv-verdict-pill.v-kill { background: var(--danger-soft); color: var(--danger); }
.cv-verdict-pill.v-paused { background: var(--ink); color: var(--bg); }
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.creative-sort-bar .sort-label {
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-4);
  margin-right: 4px;
}

/* Group header row inside dl-table */
.dl-table tr.dl-group-header td {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  font-family: var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}
.dl-table tr.dl-group-header:hover td { background: var(--surface-sunken); }
.dl-table tr.dl-group-header.is-winner td:first-child {
  box-shadow: inset 3px 0 0 oklch(70% 0.13 75);
}

.dlg-header-cell {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.dlg-chev {
  display: inline-flex;
  color: var(--ink-3);
  width: 14px; height: 14px;
  transition: transform 160ms;
  flex-shrink: 0;
}
.dlg-chev svg { width: 12px; height: 12px; }
.dl-table tr.dl-group-header.open .dlg-chev { transform: rotate(90deg); }

.dlg-rank {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 28px; height: 20px; padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  flex-shrink: 0;
}
.dlg-rank.gold { background: linear-gradient(135deg, oklch(78% 0.16 80), oklch(62% 0.18 50)); color: #fff; }
.dlg-rank.silver { background: oklch(82% 0.01 80); color: var(--ink); }
.dlg-rank.bronze { background: oklch(55% 0.14 50); color: #fff; }

.dlg-title-block {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
  flex: 1;
}
.dlg-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 480px;
}
.dlg-sub {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.dlg-sub .ads-pill {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.dlg-sub .dot-on { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--accent); }
.dlg-sub .dot-off { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--ink-4); margin-left: 6px; }

/* Variant rows */
.dl-table tr.dl-variant-row td {
  background: color-mix(in oklab, var(--surface-sunken) 50%, var(--surface));
  padding-left: 18px;
}
.dl-table tr.dl-variant-row td:first-child { padding-left: 38px; }
.dl-table tr.dl-variant-row .ad-name { padding-left: 4px; }
.dl-table tr.dl-variant-row:hover td { background: var(--surface-sunken); }
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
  width: 100%;
}
.creative-card.is-winner {
  border-color: oklch(70% 0.13 75 / 0.7);
  box-shadow: 0 0 0 1px oklch(70% 0.13 75 / 0.3);
}

/* === Top: thumb + title + status + verdict + actions === */
.creative-top {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  align-items: center;
}
.creative-thumb {
  position: relative;
  width: 72px; height: 72px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.creative-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 4px, oklch(88% 0.005 80 / 0.4) 4px 5px);
}
.creative-thumb-icon {
  position: relative; z-index: 1;
  width: 32px; height: 32px;
  color: var(--ink-3);
  background: var(--surface);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.creative-thumb-icon svg { width: 16px; height: 16px; }
.creative-rank {
  position: absolute; top: 5px; left: 5px;
  min-width: 26px; height: 20px; padding: 0 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.creative-rank.gold { background: linear-gradient(135deg, oklch(78% 0.16 80), oklch(62% 0.18 50)); color: #fff; }
.creative-rank.silver { background: oklch(82% 0.01 80); color: var(--ink); }
.creative-rank.bronze { background: oklch(55% 0.14 50); color: #fff; }

.creative-info { min-width: 0; }
.creative-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
.creative-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.creative-meta .post-id-chip {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer;
}
.creative-meta .post-id-chip:hover { color: var(--ink-2); }
.creative-meta .post-id-chip svg { width: 11px; height: 11px; }
.creative-meta .ads-count {
  font-family: var(--font-sans);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.creative-meta .dot-on { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.creative-meta .dot-off { display: inline-block; width: 6px; height: 6px; border-radius: 999px; background: var(--ink-4); margin-left: 6px; }

.creative-verdict-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.creative-verdict-pill.scale { background: var(--accent-soft); color: var(--accent-ink); }
.creative-verdict-pill.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.creative-verdict-pill.keep { background: var(--surface-sunken); color: var(--ink-3); }
.creative-verdict-pill.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.creative-verdict-pill.kill { background: var(--danger-soft); color: var(--danger); }

.creative-actions { display: flex; gap: 6px; }
.creative-actions .btn { height: 30px; font-size: 12px; }

/* === Hero KPI strip: 6 big numbers === */
.creative-hero {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.creative-hero-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.creative-hero-cell:last-child { border-right: 0; }
.creative-hero-lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.creative-hero-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.creative-hero-val .pre { font-size: 14px; color: var(--ink-3); margin-right: 2px; font-weight: 400; }
.creative-hero-val.muted { color: var(--ink-4); font-weight: 400; font-size: 18px; }
.creative-hero-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-hero-val.danger { color: var(--danger); font-weight: 600; }
.creative-hero-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

/* === 3-group metric panel: horizontal rows === */
.creative-detail-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--line-2);
}
.creative-dgroup {
  padding: 14px 20px;
  border-right: 1px solid var(--line-2);
  border-top: 3px solid transparent;
  display: flex; flex-direction: column; gap: 10px;
}
.creative-dgroup:last-child { border-right: 0; }
.creative-dgroup.g-pancake { border-top-color: oklch(70% 0.12 200); }
.creative-dgroup.g-crm { border-top-color: oklch(70% 0.12 290); }
.creative-dgroup.g-fb { border-top-color: oklch(70% 0.12 245); }
.creative-dgroup-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
}
.creative-dgroup.g-pancake .creative-dgroup-name { color: oklch(40% 0.13 200); }
.creative-dgroup.g-crm .creative-dgroup-name { color: oklch(40% 0.13 290); }
.creative-dgroup.g-fb .creative-dgroup-name { color: oklch(40% 0.13 245); }
[data-theme="dark"] .creative-dgroup.g-pancake .creative-dgroup-name { color: oklch(78% 0.1 200); }
[data-theme="dark"] .creative-dgroup.g-crm .creative-dgroup-name { color: oklch(78% 0.1 290); }
[data-theme="dark"] .creative-dgroup.g-fb .creative-dgroup-name { color: oklch(78% 0.1 245); }
.creative-dgroup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 12px;
}
.creative-dstat {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.creative-dstat-lbl {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.creative-dstat-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.creative-dstat-val.muted { color: var(--ink-4); font-weight: 400; }
.creative-dstat-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-dstat-val.warn { color: oklch(45% 0.13 75); font-weight: 600; }
.creative-dstat-val.danger { color: var(--danger); font-weight: 600; }

/* === Variants section header === */
.variants-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  background: var(--surface);
  border-bottom: 1px solid var(--line-2);
}
.variants-header .count-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  background: var(--surface-sunken);
  border-radius: 999px;
  color: var(--ink-2);
  letter-spacing: 0;
}

/* === Variants table (always visible) === */
.variants-table-wrap {
  background: var(--surface);
  overflow-x: auto;
}
.variants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.variants-table thead tr.dl-group-row th {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-sunken);
  text-align: left;
}
.variants-table thead tr.dl-group-row th.gh-pancake { color: oklch(40% 0.13 200); }
.variants-table thead tr.dl-group-row th.gh-crm { color: oklch(40% 0.13 290); }
.variants-table thead tr.dl-group-row th.gh-fb { color: oklch(40% 0.13 245); }
.variants-table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: right;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.variants-table th.left { text-align: left; }

.variants-table td {
  padding: 11px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.variants-table tr:last-child td { border-bottom: 0; }
.variants-table tr:hover td { background: var(--surface-2); }
.variants-table td.left { text-align: left; font-family: var(--font-sans); }

.variants-table td.col-first, .variants-table th.col-first {
  border-left: 2px solid var(--line);
}
.variants-table td.col-first.gh-pancake, .variants-table th.col-first.gh-pancake {
  border-left-color: oklch(70% 0.12 200);
}
.variants-table td.col-first.gh-crm, .variants-table th.col-first.gh-crm {
  border-left-color: oklch(70% 0.12 290);
}
.variants-table td.col-first.gh-fb, .variants-table th.col-first.gh-fb {
  border-left-color: oklch(70% 0.12 245);
}

.variant-ad-cell {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 240px;
  max-width: 360px;
}
.variant-status-row { display: flex; align-items: center; gap: 8px; }
.variant-status-row .fb-status-badge { font-size: 9.5px; padding: 2px 7px; }
.variant-ad-name {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-ad-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  cursor: pointer;
}
.variant-ad-id:hover { color: var(--ink-2); }
.variant-verdict-mini {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-sans);
}
.variant-verdict-mini .v-dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.variant-verdict-mini.scale { background: var(--accent-soft); color: var(--accent-ink); }
.variant-verdict-mini.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.variant-verdict-mini.keep { background: var(--surface-sunken); color: var(--ink-3); }
.variant-verdict-mini.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.variant-verdict-mini.kill { background: var(--danger-soft); color: var(--danger); }

.variants-actions {
  display: inline-flex; gap: 3px; justify-content: flex-end;
}
.variants-actions .act-btn { width: 26px; height: 24px; }

.variant-cell-warn { color: oklch(45% 0.13 75); }
.variant-cell-danger { color: var(--danger); font-weight: 600; }
.variant-cell-muted { color: var(--ink-4); }

/* === Sort bar === */
.creative-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 14px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.creative-sort-bar .sort-label {
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-4);
  margin-right: 4px;
}

@media (max-width: 1280px) {
  .creative-hero { grid-template-columns: repeat(3, 1fr); }
  .creative-hero-cell:nth-child(3) { border-right: 0; }
  .creative-detail-panel { grid-template-columns: 1fr; }
  .creative-dgroup { border-right: 0; border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 720px) {
  .creative-hero { grid-template-columns: repeat(2, 1fr); }
  .creative-dgroup-grid { grid-template-columns: repeat(2, 1fr); }
}
.creative-table th, .creative-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.creative-table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.creative-table th.num { text-align: right; }
.creative-table td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.creative-table tbody tr.creative-row { cursor: pointer; transition: background 80ms; }
.creative-table tbody tr.creative-row:hover { background: var(--surface-2); }
.creative-table tbody tr.creative-row.open { background: var(--surface-2); }
.creative-table tbody tr.creative-row.is-winner td:first-child {
  box-shadow: inset 2px 0 0 oklch(70% 0.13 75);
}

.creative-table .col-first { border-left: 2px solid var(--line); }
.creative-table th.col-first.gh-pancake, .creative-table td.col-first.gh-pancake { border-left-color: oklch(70% 0.12 200); }
.creative-table th.col-first.gh-crm, .creative-table td.col-first.gh-crm { border-left-color: oklch(70% 0.12 290); }
.creative-table th.col-first.gh-fb, .creative-table td.col-first.gh-fb { border-left-color: oklch(70% 0.12 245); }
.creative-table th.gh-pancake { color: oklch(40% 0.13 200); }
.creative-table th.gh-crm { color: oklch(40% 0.13 290); }
.creative-table th.gh-fb { color: oklch(40% 0.13 245); }
[data-theme="dark"] .creative-table th.gh-pancake { color: oklch(78% 0.1 200); }
[data-theme="dark"] .creative-table th.gh-crm { color: oklch(78% 0.1 290); }
[data-theme="dark"] .creative-table th.gh-fb { color: oklch(78% 0.1 245); }

.creative-table thead tr.dl-group-row th {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  padding: 5px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

/* Creative row layout */
.cr-rank-cell { width: 36px; text-align: center !important; }
.cr-rank {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 26px; height: 18px; padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--ink-3);
}
.cr-rank.gold { background: linear-gradient(135deg, oklch(78% 0.16 80), oklch(62% 0.18 50)); color: #fff; }
.cr-rank.silver { background: oklch(82% 0.01 80); color: var(--ink); }
.cr-rank.bronze { background: oklch(55% 0.14 50); color: #fff; }

.cr-name-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 240px;
  max-width: 380px;
}
.cr-name-row { display: flex; align-items: center; gap: 8px; }
.cr-chev {
  display: inline-flex;
  width: 14px; height: 14px;
  color: var(--ink-3);
  transition: transform 160ms;
  flex-shrink: 0;
}
.cr-chev svg { width: 12px; height: 12px; }
.creative-row.open .cr-chev { transform: rotate(90deg); }
.cr-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.cr-meta {
  display: flex; align-items: center; gap: 8px;
  margin-left: 22px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.cr-meta .ads-pill {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cr-meta .dot-on { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--accent); }
.cr-meta .dot-off { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--ink-4); }

.cr-verdict-cell { width: 110px; }

/* Variants expanded rows */
.creative-table tr.variant-row td {
  background: var(--surface-sunken);
  padding: 6px 11px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--line-2);
}
.creative-table tr.variant-row:last-of-type td { border-bottom: 2px solid var(--line); }
.creative-table tr.variant-row td.num { font-size: 11.5px; }
.cr-variant-name-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: 32px; /* indent under parent */
  min-width: 240px;
  max-width: 380px;
}
.cr-variant-name-row { display: flex; align-items: center; gap: 6px; }
.cr-variant-name {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-variant-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  margin-left: 26px;
}

.cr-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.cr-actions .act-btn { width: 24px; height: 22px; }

/* freq warn/danger reuse from main table */

/* Bar in cell — for ranking visual */
.cr-bar-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 90px;
}
.cr-bar-cell .num { font-family: var(--font-mono); font-weight: 500; }
.cr-bar-mini {
  width: 40px; height: 4px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}
.cr-bar-mini-fill {
  height: 100%; background: var(--accent); border-radius: 999px;
}

/* Sort bar (reuse) */
.creative-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.creative-sort-bar .sort-label {
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-4);
  margin-right: 4px;
}

/* === Top: thumb + title + verdict === */
.creative-top {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  padding: 14px 16px 12px;
  align-items: flex-start;
}
.creative-thumb {
  position: relative;
  width: 52px; height: 52px;
  background: var(--surface-sunken);
  border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.creative-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 4px, oklch(88% 0.005 80 / 0.4) 4px 5px);
}
.creative-thumb-icon {
  position: relative; z-index: 1;
  width: 24px; height: 24px;
  color: var(--ink-3);
  background: var(--surface);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.creative-thumb-icon svg { width: 12px; height: 12px; }
.creative-rank {
  position: absolute; top: 4px; left: 4px;
  min-width: 20px; height: 16px; padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  letter-spacing: 0.02em;
}
.creative-rank.gold { background: linear-gradient(135deg, oklch(78% 0.16 80), oklch(62% 0.18 50)); }
.creative-rank.silver { background: oklch(78% 0.01 80); color: var(--ink); }
.creative-rank.bronze { background: oklch(55% 0.14 50); }

.creative-info { min-width: 0; padding-top: 1px; }
.creative-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.creative-meta {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.creative-meta .post-id-chip {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.creative-meta .post-id-chip:hover { color: var(--ink-2); }
.creative-meta .post-id-chip svg { width: 10px; height: 10px; }
.creative-meta .sep { color: var(--ink-4); }
.creative-meta .ads-count {
  font-family: var(--font-sans);
  color: var(--ink-2);
  font-weight: 500;
}
.creative-meta .ads-count .dot-on { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--accent); margin-right: 4px; }
.creative-meta .ads-count .dot-off { display: inline-block; width: 5px; height: 5px; border-radius: 999px; background: var(--ink-4); margin-right: 4px; margin-left: 8px; }

.creative-verdict-pill {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.creative-verdict-pill.scale { background: var(--accent-soft); color: var(--accent-ink); }
.creative-verdict-pill.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.creative-verdict-pill.keep { background: var(--surface-sunken); color: var(--ink-3); }
.creative-verdict-pill.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.creative-verdict-pill.kill { background: var(--danger-soft); color: var(--danger); }

/* === Hero stats: 4 KPIs in one strip === */
.creative-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.creative-hero-cell {
  padding: 12px 14px;
  border-right: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.creative-hero-cell:last-child { border-right: 0; }
.creative-hero-cell.is-lead { background: var(--surface-2); }
.creative-hero-lbl {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.creative-hero-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.creative-hero-val .pre { font-size: 11px; color: var(--ink-3); margin-right: 1px; font-weight: 400; }
.creative-hero-val.muted { color: var(--ink-4); font-weight: 400; }
.creative-hero-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-hero-val.danger { color: var(--danger); font-weight: 600; }
.creative-hero-sub {
  font-size: 10px;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

/* === Bar viz under hero === */
.creative-barviz {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.creative-barviz-lbl {
  display: flex; justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
}
.creative-barviz-lbl strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
}
.creative-bar {
  height: 4px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.creative-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* === Expand button === */
.creative-expand-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 80ms, color 80ms;
}
.creative-expand-btn:hover { background: var(--surface-2); color: var(--ink); }
.creative-expand-btn .chev {
  display: inline-flex;
  transition: transform 160ms;
  color: var(--ink-3);
}
.creative-expand-btn .chev svg { width: 12px; height: 12px; }
.creative-expand-btn.open .chev { transform: rotate(180deg); }
.creative-expand-btn .ec-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

/* === Details: 3-group metrics + variants (only when expanded) === */
.creative-details {
  background: var(--surface-sunken);
  border-top: 1px solid var(--line-2);
}
.creative-details-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}
.creative-details-section:last-child { border-bottom: 0; }
.creative-details-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.creative-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.creative-dgroup {
  border-left: 2px solid var(--line);
  padding-left: 10px;
}
.creative-dgroup.g-pancake { border-left-color: oklch(70% 0.12 200); }
.creative-dgroup.g-crm { border-left-color: oklch(70% 0.12 290); }
.creative-dgroup.g-fb { border-left-color: oklch(70% 0.12 245); }
.creative-dgroup-name {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--ink-3);
}
.creative-dgroup.g-pancake .creative-dgroup-name { color: oklch(40% 0.13 200); }
.creative-dgroup.g-crm .creative-dgroup-name { color: oklch(40% 0.13 290); }
.creative-dgroup.g-fb .creative-dgroup-name { color: oklch(40% 0.13 245); }
[data-theme="dark"] .creative-dgroup.g-pancake .creative-dgroup-name { color: oklch(78% 0.1 200); }
[data-theme="dark"] .creative-dgroup.g-crm .creative-dgroup-name { color: oklch(78% 0.1 290); }
[data-theme="dark"] .creative-dgroup.g-fb .creative-dgroup-name { color: oklch(78% 0.1 245); }
.creative-drow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 11.5px;
  padding: 3px 0;
}
.creative-drow-key { color: var(--ink-3); font-size: 11px; }
.creative-drow-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
}
.creative-drow-val.muted { color: var(--ink-4); font-weight: 400; }
.creative-drow-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-drow-val.warn { color: oklch(45% 0.13 75); font-weight: 600; }
.creative-drow-val.danger { color: var(--danger); font-weight: 600; }

/* === Sort bar === */
.creative-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.creative-sort-bar .sort-label {
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-4);
  margin-right: 4px;
}

/* === Variants table inside details === */
.variants-table-wrap {
  background: var(--surface);
  border-top: 1px solid var(--line-2);
  margin: 0 -16px -14px;
}
.variants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.variants-table th {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: right;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-sans);
  white-space: nowrap;
  background: var(--surface-sunken);
}
.variants-table th.left { text-align: left; }
.variants-table th.gh-pancake { color: oklch(40% 0.13 200); }
.variants-table th.gh-crm { color: oklch(40% 0.13 290); }
.variants-table th.gh-fb { color: oklch(40% 0.13 245); }
[data-theme="dark"] .variants-table th.gh-pancake { color: oklch(78% 0.1 200); }
[data-theme="dark"] .variants-table th.gh-crm { color: oklch(78% 0.1 290); }
[data-theme="dark"] .variants-table th.gh-fb { color: oklch(78% 0.1 245); }

.variants-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.variants-table tr:last-child td { border-bottom: 0; }
.variants-table tr:hover td { background: var(--surface-2); }
.variants-table td.left { text-align: left; }
.variants-table td.col-first, .variants-table th.col-first {
  border-left: 2px solid var(--line);
}
.variants-table td.col-first.gh-pancake, .variants-table th.col-first.gh-pancake {
  border-left-color: oklch(70% 0.12 200);
}
.variants-table td.col-first.gh-crm, .variants-table th.col-first.gh-crm {
  border-left-color: oklch(70% 0.12 290);
}
.variants-table td.col-first.gh-fb, .variants-table th.col-first.gh-fb {
  border-left-color: oklch(70% 0.12 245);
}

.variant-ad-cell {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 180px;
  max-width: 240px;
}
.variant-status-row { display: flex; align-items: center; gap: 6px; }
.variant-status-row .fb-status-badge {
  font-size: 9px;
  padding: 1px 6px 1px 5px;
}
.variant-ad-name {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-ad-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}
.variant-ad-id:hover { color: var(--ink-2); cursor: pointer; }
.variant-verdict-mini {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
}
.variant-verdict-mini .v-dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.variant-verdict-mini.scale { background: var(--accent-soft); color: var(--accent-ink); }
.variant-verdict-mini.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.variant-verdict-mini.keep { background: var(--surface-sunken); color: var(--ink-3); }
.variant-verdict-mini.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.variant-verdict-mini.kill { background: var(--danger-soft); color: var(--danger); }

.variants-actions {
  display: inline-flex; gap: 2px; justify-content: flex-end;
}
.variants-actions .act-btn { width: 22px; height: 20px; }
.variants-actions .act-btn svg { width: 11px; height: 11px; }

.variant-cell-warn { color: oklch(45% 0.13 75); }
.variant-cell-danger { color: var(--danger); font-weight: 600; }
.variant-cell-muted { color: var(--ink-4); }

@media (max-width: 1400px) {
  .creative-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}
@media (max-width: 720px) {
  .creative-hero { grid-template-columns: 1fr 1fr; }
  .creative-hero-cell:nth-child(2) { border-right: 0; }
  .creative-details-grid { grid-template-columns: 1fr; }
}
.creative-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, transparent 0 4px, oklch(88% 0.005 80 / 0.4) 4px 5px);
}
.creative-thumb-icon {
  position: relative; z-index: 1;
  width: 28px; height: 28px;
  color: var(--ink-3);
  background: var(--surface);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.creative-thumb-icon svg { width: 14px; height: 14px; }
.creative-rank {
  position: absolute; top: 4px; left: 4px;
  min-width: 22px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.creative-rank.gold { background: linear-gradient(135deg, oklch(78% 0.16 80), oklch(62% 0.18 50)); }
.creative-rank.silver { background: oklch(78% 0.01 80); color: var(--ink); }
.creative-rank.bronze { background: oklch(55% 0.14 50); }

.creative-info { min-width: 0; }
.creative-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.creative-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 5px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.creative-meta .post-id-chip {
  font-family: var(--font-mono);
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.creative-meta .post-id-chip:hover { color: var(--ink); }
.creative-meta .post-id-chip svg { width: 10px; height: 10px; }
.creative-meta .ads-count {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px;
  background: var(--surface-sunken);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink-2);
  font-size: 10.5px;
}
.creative-status-row { display: flex; gap: 4px; margin-top: 6px; }
.creative-variant-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  background: var(--surface-sunken);
  border-radius: 4px;
  color: var(--ink-3);
}
.creative-variant-chip.active { color: var(--accent-ink); background: var(--accent-soft); }
.creative-variant-chip.paused { color: var(--danger); background: var(--danger-soft); }

.creative-verdict-pill {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.creative-verdict-pill.scale { background: var(--accent-soft); color: var(--accent-ink); }
.creative-verdict-pill.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.creative-verdict-pill.keep { background: var(--surface-sunken); color: var(--ink-3); }
.creative-verdict-pill.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.creative-verdict-pill.kill { background: var(--danger-soft); color: var(--danger); }

/* Spend hero */
.creative-spend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.creative-spend-num {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.creative-spend-num .pre { font-size: 13px; color: var(--ink-3); margin-right: 2px; font-weight: 400; }
.creative-spend-lbl {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-3);
  display: block; margin-bottom: 2px;
}
.creative-roas {
  text-align: right;
  font-family: var(--font-mono);
}
.creative-roas-val { font-size: 16px; font-weight: 600; color: var(--accent-ink); }
.creative-roas-val.neg { color: var(--ink-4); font-weight: 400; }

/* 3-group metrics row */
.creative-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line-2);
}
.creative-mgroup {
  padding: 10px 12px;
  border-right: 1px solid var(--line-2);
  border-left: 2px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.creative-mgroup:last-child { border-right: 0; }
.creative-mgroup.g-pancake { border-left-color: oklch(70% 0.12 200); }
.creative-mgroup.g-crm { border-left-color: oklch(70% 0.12 290); }
.creative-mgroup.g-fb { border-left-color: oklch(70% 0.12 245); }
.creative-mgroup-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.creative-mgroup.g-pancake .creative-mgroup-label { color: oklch(40% 0.13 200); }
.creative-mgroup.g-crm .creative-mgroup-label { color: oklch(40% 0.13 290); }
.creative-mgroup.g-fb .creative-mgroup-label { color: oklch(40% 0.13 245); }
[data-theme="dark"] .creative-mgroup.g-pancake .creative-mgroup-label { color: oklch(78% 0.1 200); }
[data-theme="dark"] .creative-mgroup.g-crm .creative-mgroup-label { color: oklch(78% 0.1 290); }
[data-theme="dark"] .creative-mgroup.g-fb .creative-mgroup-label { color: oklch(78% 0.1 245); }

.creative-mrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 11.5px;
}
.creative-mrow-key {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.creative-mrow-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}
.creative-mrow-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-mrow-val.warn { color: oklch(45% 0.13 75); }
.creative-mrow-val.danger { color: var(--danger); }
.creative-mrow-val.muted { color: var(--ink-4); }

/* Footer: bar + KPI summary */
.creative-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line-2);
  background: var(--surface);
}
.creative-foot-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.creative-foot-stat-lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.creative-foot-stat-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}
.creative-foot-stat-val.muted { color: var(--ink-4); font-weight: 400; }
.creative-foot-stat-val.accent { color: var(--accent-ink); font-weight: 600; }
.creative-foot-sep { width: 1px; height: 22px; background: var(--line); }
.creative-foot-bar-wrap { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.creative-foot-bar-lbl {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  display: flex; justify-content: space-between;
}
.creative-foot-bar-lbl strong { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.creative-bar {
  height: 4px;
  background: var(--surface-sunken);
  border-radius: 999px;
  overflow: hidden;
}
.creative-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Sort bar above creative grid */
.creative-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.creative-sort-bar .sort-label {
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-4);
  margin-right: 4px;
}

/* Expandable variants table inside creative card */
.creative-expand-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: var(--surface);
  border: 0;
  border-top: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 80ms;
}
.creative-expand-btn:hover { background: var(--surface-2); color: var(--ink); }
.creative-expand-btn .chev {
  display: inline-flex;
  transition: transform 160ms;
  color: var(--ink-3);
}
.creative-expand-btn .chev svg { width: 12px; height: 12px; }
.creative-expand-btn.open .chev { transform: rotate(180deg); }
.creative-expand-btn .ec-count {
  font-family: var(--font-mono);
  padding: 1px 6px;
  background: var(--surface-sunken);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.variants-table-wrap {
  background: var(--surface-sunken);
  border-top: 1px solid var(--line-2);
}
.variants-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-family: var(--font-mono);
}
.variants-table th {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-align: right;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.variants-table th.left { text-align: left; }
.variants-table th.gh-pancake { color: oklch(40% 0.13 200); border-bottom-color: oklch(70% 0.12 200 / 0.4); }
.variants-table th.gh-crm { color: oklch(40% 0.13 290); border-bottom-color: oklch(70% 0.12 290 / 0.4); }
.variants-table th.gh-fb { color: oklch(40% 0.13 245); border-bottom-color: oklch(70% 0.12 245 / 0.4); }
[data-theme="dark"] .variants-table th.gh-pancake { color: oklch(78% 0.1 200); }
[data-theme="dark"] .variants-table th.gh-crm { color: oklch(78% 0.1 290); }
[data-theme="dark"] .variants-table th.gh-fb { color: oklch(78% 0.1 245); }

.variants-table td {
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.variants-table tr:last-child td { border-bottom: 0; }
.variants-table tr:hover td { background: var(--surface); }
.variants-table td.left { text-align: left; }

/* group-first cells get colored left border, matching main table */
.variants-table td.col-first.gh-pancake, .variants-table th.col-first.gh-pancake {
  border-left: 2px solid oklch(70% 0.12 200);
}
.variants-table td.col-first.gh-crm, .variants-table th.col-first.gh-crm {
  border-left: 2px solid oklch(70% 0.12 290);
}
.variants-table td.col-first.gh-fb, .variants-table th.col-first.gh-fb {
  border-left: 2px solid oklch(70% 0.12 245);
}

.variant-ad-cell {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 180px;
  max-width: 260px;
}
.variant-status-row { display: flex; align-items: center; gap: 6px; }
.variant-status-row .fb-status-badge {
  font-size: 9px;
  padding: 1px 6px 1px 5px;
}
.variant-ad-name {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-ad-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 4px;
}
.variant-ad-id:hover { color: var(--ink-2); cursor: pointer; }
.variant-verdict-mini {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
}
.variant-verdict-mini .v-dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.variant-verdict-mini.scale { background: var(--accent-soft); color: var(--accent-ink); }
.variant-verdict-mini.increase { background: var(--info-soft); color: oklch(30% 0.12 245); }
.variant-verdict-mini.keep { background: var(--surface-sunken); color: var(--ink-3); }
.variant-verdict-mini.watch { background: var(--warn-soft); color: oklch(40% 0.13 75); }
.variant-verdict-mini.kill { background: var(--danger-soft); color: var(--danger); }

.variants-actions {
  display: inline-flex; gap: 2px; justify-content: flex-end;
}
.variants-actions .act-btn { width: 22px; height: 20px; }
.variants-actions .act-btn svg { width: 11px; height: 11px; }

.variant-cell-warn { color: oklch(45% 0.13 75); }
.variant-cell-danger { color: var(--danger); font-weight: 600; }
.variant-cell-muted { color: var(--ink-4); }

@media (max-width: 1400px) {
  .creative-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
}
@media (max-width: 720px) {
  .creative-metrics { grid-template-columns: 1fr; }
  .creative-mgroup { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .creative-mgroup:last-child { border-bottom: 0; }
}

/* ===== MODAL + FORM (port từ style.css cho tai-khoan.html edit popup) =====
   tai-khoan.html không load style.css nên modal "Sửa tài khoản" hiển thị raw HTML.
   Port các rule cần thiết, đổi tên CSS var sang redesign-namespace. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--surface, #fff);
  border-radius: 14px;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, .25);
  animation: modal-in .15s ease-out;
  font-family: var(--font-sans);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-4);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}
.modal-body { padding: 18px 22px 6px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}

/* Form rows trong modal */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-row .req { color: var(--danger); }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="password"],
.form-row select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  background: var(--surface, #fff);
  color: var(--ink);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-inline { display: flex; align-items: center; gap: 8px; }
.form-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

.input-with-prefix { display: flex; align-items: stretch; }
.input-with-prefix .prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.input-with-prefix input { border-radius: 0 8px 8px 0 !important; }
.input-with-prefix.no-prefix .prefix { display: none; }
.input-with-prefix.no-prefix input { border-radius: 8px !important; }

/* Telegram chat IDs list */
.tg-id-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.tg-id-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
}
.tg-id-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  cursor: pointer;
  font-size: 13px !important;
  font-weight: 500 !important;
}

/* Modal action buttons */
.modal-footer button,
.modal-body button:not(.modal-close):not(.tg-id-row button) {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  transition: background .15s, border-color .15s;
}
.modal-footer button:hover {
  background: var(--surface-sunken);
}
.modal-footer button[type="submit"],
.modal-footer .btn-primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.modal-footer button[type="submit"]:hover,
.modal-footer .btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}
