/* =====================================================================
   Performance Marketing Command Center · operational layer styles
   Built on top of WindMar colors_and_type.css — never mints new hexes.
   ===================================================================== */

:root {
  /* Operational signals — desaturated to sit on white without screaming */
  --op-green:        #1B8A5A;
  --op-green-50:     #E8F4EE;
  --op-green-100:    #C8E5D5;
  --op-amber:        #C97A0E;
  --op-amber-50:     #FCF1DE;
  --op-amber-100:    #F8DCA6;
  --op-red:          #B5301F;
  --op-red-50:       #FBE8E5;
  --op-red-100:      #F4C2BB;

  /* Density */
  --op-row-h:        36px;
  --op-row-h-tight:  30px;

  /* Chrome */
  --op-chrome-bg:    #FBFBFD;
  --op-chrome-line:  #E6E8EE;
  --op-line:         #ECEEF3;
  --op-line-strong:  #DCDFE7;

  /* Mono digit font for tabular figures */
  --op-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
}
body {
  background: var(--wm-white);
  color: var(--wm-fg);
  font-family: var(--wm-font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "tnum";
}

/* tabular numbers everywhere it matters */
.op-num, .op-tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------- App shell ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--wm-white);
}

/* ============ TOPBAR (brand chrome + filters) ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--wm-white);
  border-bottom: 1px solid var(--op-chrome-line);
}
.topbar-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  min-height: 52px;
}
.topbar-brand {
  display: flex; align-items: center; gap: 12px;
}
.topbar-brand img { height: 30px; width: auto; display: block; }
.topbar-brand .topbar-product {
  font-family: var(--wm-font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--wm-blue);
  border-left: 1px solid var(--op-line-strong);
  padding-left: 12px;
  margin-left: 4px;
  line-height: 1;
}
.topbar-brand .topbar-product small {
  display: block;
  font-family: var(--wm-font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--wm-fg-muted);
  margin-top: 3px;
}

.topbar-spacer { flex: 1; }

.topbar-filters {
  display: flex; align-items: center; gap: 6px;
}
.topbar-actions {
  display: flex; align-items: center; gap: 8px;
}

/* Pill / chip filters */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: var(--wm-white);
  border: 1px solid var(--op-line-strong);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--wm-fg);
  cursor: pointer;
  user-select: none;
  transition: all 160ms cubic-bezier(.2,.8,.2,1);
  white-space: nowrap;
  font-family: var(--wm-font-sans);
}
.chip:hover { border-color: var(--wm-blue); color: var(--wm-blue); }
.chip.is-active {
  background: var(--wm-blue);
  border-color: var(--wm-blue);
  color: var(--wm-white);
}
.chip.is-active:hover { background: var(--wm-blue-600); }
.chip-group {
  display: inline-flex;
  border: 1px solid var(--op-line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--wm-white);
}
.chip-group .chip {
  border: none;
  border-right: 1px solid var(--op-line-strong);
  border-radius: 0;
  background: transparent;
  padding: 6px 12px;
}
.chip-group .chip:last-child { border-right: none; }
.chip-group .chip.is-active { background: var(--wm-blue); color: var(--wm-white); }

.chip-icon {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px;
  color: var(--wm-fg-muted);
}
.chip.is-active .chip-icon { color: var(--wm-white); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border: 1px solid var(--op-line-strong);
  background: var(--wm-white);
  border-radius: 8px;
  color: var(--wm-fg-muted);
  cursor: pointer;
  position: relative;
}
.icon-btn:hover { color: var(--wm-blue); border-color: var(--wm-blue); }
.icon-btn .badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--wm-orange);
  color: var(--wm-white);
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
}

/* ============ PROFIT COMMAND BAR ============ */
.profit-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--wm-blue-900);
  background: linear-gradient(180deg, #11183A 0%, #0A0F1B 100%);
  color: var(--wm-white);
  position: relative;
}
.profit-cell {
  padding: 12px 18px;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  cursor: default;
}
.profit-cell:last-child { border-right: none; }
.profit-cell--featured {
  background: linear-gradient(180deg, rgba(248,155,36,0.12) 0%, rgba(248,155,36,0) 100%);
}
.profit-cell--clickable { cursor: pointer; transition: background 160ms; }
.profit-cell--clickable:hover { background: rgba(255,255,255,0.06); }
.creatives-row { transition: background 120ms; }
.creatives-row:hover { background: var(--wm-bg-muted); }

/* ===== Print / Export PDF ===== */
@media print {
  /* Hide chrome that isn't useful on paper */
  .topbar, .tabbar, .profit-bar,
  aside,                          /* BrandRail */
  .sheet-overlay,                 /* CreativeSheet modal if open */
  .no-print { display: none !important; }

  /* Strip backgrounds + give the page width */
  body, .app-shell, .app-main, .main { background: white !important; }
  .main { padding: 0 !important; }
  .app-shell { display: block !important; }

  /* Expand every accordion + keep borders subtle */
  .card { box-shadow: none !important; border: 1px solid #e5e7eb !important; break-inside: avoid; }

  /* Prevent split rows on page breaks where possible */
  tr { break-inside: avoid; page-break-inside: avoid; }
  table { font-size: 10px !important; }
  img { max-width: 100% !important; }

  /* Smaller margins so more fits per page */
  @page { margin: 12mm; }
}
.funnel-step--clickable { transition: background 160ms; border-radius: 8px; }
.funnel-step--clickable:hover { background: var(--wm-blue-50); }
.profit-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
  display: flex; align-items: center; gap: 6px;
}
.profit-value {
  font-family: var(--wm-font-sans);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.profit-value--accent { color: var(--wm-orange); }
.profit-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
.profit-delta {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.profit-delta.up   { background: rgba(27,138,90,0.20); color: #6FE3A6; }
.profit-delta.down { background: rgba(181,48,31,0.22); color: #FF8C7A; }
.profit-delta.flat { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.85); }

.profit-spark {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 22px;
  pointer-events: none;
  opacity: 0.55;
}

/* ============ TABS ============ */
.tabbar {
  display: flex; align-items: stretch;
  background: var(--wm-white);
  border-bottom: 1px solid var(--op-chrome-line);
  padding: 0 12px;
  overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--wm-fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  position: relative;
  white-space: nowrap;
  transition: color 160ms cubic-bezier(.2,.8,.2,1);
  font-family: var(--wm-font-sans);
}
.tab:hover { color: var(--wm-fg); }
.tab.is-active {
  color: var(--wm-blue);
  border-bottom-color: var(--wm-orange);
  font-weight: 700;
}
.tab-count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--op-line);
  color: var(--wm-fg-muted);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .tab-count {
  background: var(--wm-blue);
  color: var(--wm-white);
}
.tab-count.is-alert {
  background: var(--op-red);
  color: var(--wm-white);
}

/* ============ MAIN CONTENT ============ */
.main {
  flex: 1;
  padding: 20px;
  background: var(--wm-bg-muted);
  background:
    radial-gradient(circle at 20% 10%, rgba(29,66,155,0.025) 0%, transparent 40%),
    var(--wm-bg-muted);
}

/* Section header */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
}
.section-title {
  font-family: var(--wm-font-sans);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--wm-blue);
  line-height: 1.1;
  margin: 0;
}
.section-title em {
  font-style: normal;
  font-weight: 400;
  color: var(--wm-blue);
}
.section-sub {
  font-size: 12px;
  color: var(--wm-fg-muted);
  margin: 4px 0 0 0;
  max-width: 600px;
}

/* ============ CARDS ============ */
.card {
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 14px;
  padding: 16px;
}
.card--tight { padding: 12px; }
.card--flush { padding: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--wm-blue);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.card-sub {
  font-size: 11px;
  color: var(--wm-fg-muted);
  font-weight: 500;
}

/* Grid presets */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-23 { grid-template-columns: 2fr 3fr; }
.grid-cols-32 { grid-template-columns: 3fr 2fr; }
.grid-cols-13 { grid-template-columns: 1fr 3fr; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-23, .grid-cols-32 { grid-template-columns: 1fr; }
}

/* ============ KPI mini cards ============ */
.kpi {
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--wm-fg-muted);
}
.kpi-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--wm-blue);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.kpi-meta {
  font-size: 11px;
  color: var(--wm-fg-muted);
  display: flex; align-items: center; gap: 6px;
}
.kpi-bar {
  height: 4px;
  background: var(--op-line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}
.kpi-bar > span {
  display: block; height: 100%;
  background: var(--wm-blue);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(.2,.8,.2,1);
}

/* ============ Status pills ============ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-family: var(--wm-font-sans);
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}
.pill-scale    { background: var(--op-green-50);  color: var(--op-green); }
.pill-optimize { background: var(--op-amber-50);  color: var(--op-amber); }
.pill-kill     { background: var(--op-red-50);    color: var(--op-red); }
.pill-watch    { background: var(--wm-blue-50);   color: var(--wm-blue); }
.pill-neutral  { background: var(--op-line);      color: var(--wm-fg-muted); }
.pill-orange   { background: rgba(248,155,36,0.14); color: var(--wm-orange-600); }

.pill-lg { padding: 4px 10px; font-size: 12px; }

/* ============ Tables ============ */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--wm-fg-muted);
  border-bottom: 1px solid var(--op-line-strong);
  background: var(--wm-bg-muted);
  position: sticky; top: 0;
  white-space: nowrap;
  user-select: none;
}
.table th.num, .table td.num { text-align: right; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--wm-blue); }
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--op-line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--wm-blue-50); }
.table-scroll { max-height: 520px; overflow: auto; border-radius: 12px; }

/* Sparkbar inside table cell */
.cell-bar {
  display: flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums;
}
.cell-bar-track {
  flex: 1;
  height: 5px;
  background: var(--op-line);
  border-radius: 999px;
  overflow: hidden;
  min-width: 30px;
}
.cell-bar-fill {
  height: 100%;
  background: var(--wm-blue);
  border-radius: 999px;
  transition: width 500ms cubic-bezier(.2,.8,.2,1);
}
.cell-bar-fill.green { background: var(--op-green); }
.cell-bar-fill.amber { background: var(--op-amber); }
.cell-bar-fill.red   { background: var(--op-red); }
.cell-bar-fill.orange{ background: var(--wm-orange); }

/* Row strip — left signal */
.tr-signal { position: relative; }
.tr-signal::before {
  content: "";
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: transparent;
  border-radius: 999px;
}
.tr-signal.scale::before    { background: var(--op-green); }
.tr-signal.optimize::before { background: var(--op-amber); }
.tr-signal.kill::before     { background: var(--op-red); }

/* ============ Funnel ============ */
.funnel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
.funnel-step {
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--op-line-strong);
}
.funnel-step:last-child { border-bottom: none; }
.funnel-name {
  display: flex; flex-direction: column; gap: 2px;
}
.funnel-name b {
  font-size: 13px;
  font-weight: 800;
  color: var(--wm-blue);
}
.funnel-name span {
  font-size: 10px;
  color: var(--wm-fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.funnel-bar-wrap {
  position: relative;
  height: 32px;
  background: var(--wm-bg-muted);
  border-radius: 8px;
  overflow: hidden;
}
.funnel-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--wm-blue) 0%, var(--wm-blue-vibrant) 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px;
  color: var(--wm-white);
  font-weight: 900;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}
.funnel-meta {
  text-align: right;
  font-size: 11px;
  color: var(--wm-fg-muted);
  font-variant-numeric: tabular-nums;
}
.funnel-meta b { color: var(--wm-fg); font-weight: 800; font-size: 13px; display: block; }

/* ============ Creative cards ============ */
.creative {
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: all 200ms cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
  position: relative;
}
.creative:hover {
  border-color: var(--wm-blue);
  box-shadow: var(--wm-shadow-md);
  transform: translateY(-2px);
}
.creative.is-selected {
  border-color: var(--wm-blue);
  box-shadow: 0 0 0 2px var(--wm-blue), var(--wm-shadow-md);
}
.creative-thumb {
  aspect-ratio: 4/5;
  background: var(--wm-blue-50);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.creative-thumb img {
  max-width: 70%;
  max-height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(33,39,78,0.25));
}
.creative-thumb-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(29,66,155,0.0) 50%, rgba(10,15,27,0.65) 100%);
}
.creative-headline {
  position: absolute;
  left: 12px; right: 12px; bottom: 10px;
  color: var(--wm-white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}
.creative-badges {
  position: absolute;
  top: 10px; left: 10px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.creative-score-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--wm-white);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: var(--wm-blue);
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 2px 8px rgba(33,39,78,0.20);
}
.creative-score-badge.is-top {
  background: var(--wm-orange);
  color: var(--wm-white);
}
.creative-body {
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.creative-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.creative-stat {
  background: var(--wm-bg-muted);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex; flex-direction: column;
}
.creative-stat span {
  font-size: 9px;
  color: var(--wm-fg-muted);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.creative-stat b {
  font-size: 13px;
  color: var(--wm-blue);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.creative-stat.is-cm b { color: var(--op-green); }
.creative-stat.is-cm.neg b { color: var(--op-red); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--wm-font-sans);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 160ms cubic-bezier(.2,.8,.2,1);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--wm-blue);
  color: var(--wm-white);
}
.btn-primary:hover { background: var(--wm-blue-600); }
.btn-orange {
  background: var(--wm-orange);
  color: var(--wm-white);
}
.btn-orange:hover { background: var(--wm-orange-600); }
.btn-ghost {
  background: var(--wm-white);
  color: var(--wm-fg);
  border-color: var(--op-line-strong);
}
.btn-ghost:hover { border-color: var(--wm-blue); color: var(--wm-blue); }

.btn-scale  { background: var(--op-green); color: white; }
.btn-scale:hover { background: #166D48; }
.btn-kill   { background: var(--op-red); color: white; }
.btn-kill:hover  { background: #8E2517; }
.btn-fix    { background: var(--op-amber); color: white; }
.btn-fix:hover   { background: #A06309; }

.btn-sm { padding: 4px 8px; font-size: 11px; }

/* ============ Sparkline & charts ============ */
.spark {
  display: block;
  width: 100%;
  height: 36px;
}

/* ============ Decision Engine kanban ============ */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.kanban-col {
  background: var(--wm-bg-muted);
  border-radius: 14px;
  padding: 12px;
  display: flex; flex-direction: column;
  gap: 10px;
  min-height: 480px;
  border: 1px solid transparent;
}
.kanban-col.scale    { border-color: var(--op-green-100); background: linear-gradient(180deg, var(--op-green-50) 0%, var(--wm-bg-muted) 28%); }
.kanban-col.optimize { border-color: var(--op-amber-100); background: linear-gradient(180deg, var(--op-amber-50) 0%, var(--wm-bg-muted) 28%); }
.kanban-col.kill     { border-color: var(--op-red-100); background: linear-gradient(180deg, var(--op-red-50) 0%, var(--wm-bg-muted) 28%); }

.kanban-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 0;
}
.kanban-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.kanban-col.scale    .kanban-title { color: var(--op-green); }
.kanban-col.optimize .kanban-title { color: var(--op-amber); }
.kanban-col.kill     .kanban-title { color: var(--op-red); }
.kanban-spend {
  font-size: 11px;
  font-weight: 700;
  color: var(--wm-fg-muted);
  font-variant-numeric: tabular-nums;
}

.k-card {
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 0 rgba(33,39,78,0.04);
  transition: all 200ms cubic-bezier(.2,.8,.2,1);
}
.k-card:hover { box-shadow: var(--wm-shadow-md); }
.k-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.k-card-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--wm-fg);
  line-height: 1.25;
}
.k-card-meta {
  font-size: 10px;
  color: var(--wm-fg-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.k-card-stats {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 6px;
}
.k-card-stats .creative-stat { padding: 5px 7px; }
.k-card-reason {
  font-size: 11px;
  color: var(--wm-fg-muted);
  padding: 7px 9px;
  background: var(--wm-bg-muted);
  border-radius: 8px;
  line-height: 1.35;
}
.k-card-reason b { color: var(--wm-fg); }
.k-card-actions {
  display: flex; gap: 6px;
}

/* ============ Alert items ============ */
.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 12px;
  align-items: center;
  position: relative;
  transition: all 200ms cubic-bezier(.2,.8,.2,1);
}
.alert.sev-critical { border-left: 3px solid var(--op-red); }
.alert.sev-high     { border-left: 3px solid var(--op-amber); }
.alert.sev-info     { border-left: 3px solid var(--wm-blue); }
.alert.sev-good     { border-left: 3px solid var(--op-green); }
.alert.is-resolved {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: var(--op-line);
}
.alert-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.alert.sev-critical .alert-icon { background: var(--op-red-50); color: var(--op-red); }
.alert.sev-high     .alert-icon { background: var(--op-amber-50); color: var(--op-amber); }
.alert.sev-info     .alert-icon { background: var(--wm-blue-50); color: var(--wm-blue); }
.alert.sev-good     .alert-icon { background: var(--op-green-50); color: var(--op-green); }
.alert-body {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.alert-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--wm-fg);
  display: flex; align-items: center; gap: 8px;
}
.alert-msg {
  font-size: 12px;
  color: var(--wm-fg-muted);
  line-height: 1.4;
}
.alert-msg b { color: var(--wm-fg); font-weight: 700; }
.alert-actions {
  display: flex; gap: 6px;
  flex-shrink: 0;
}
.alert-time {
  font-size: 10px;
  color: var(--wm-fg-subtle);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ============ Competitor card ============ */
.comp-ad {
  background: var(--wm-white);
  border: 1px solid var(--op-chrome-line);
  border-radius: 12px;
  overflow: hidden;
  transition: all 200ms cubic-bezier(.2,.8,.2,1);
}
.comp-ad:hover { box-shadow: var(--wm-shadow-md); border-color: var(--wm-blue); }
.comp-ad-poster {
  aspect-ratio: 4/5;
  position: relative;
  display: flex; flex-direction: column;
  padding: 16px;
  overflow: hidden;
  color: var(--wm-white);
}
.comp-ad-poster::before {
  content: "";
  position: absolute; inset: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.4) 0, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.2) 0, transparent 60%);
}
.comp-ad-brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  position: relative;
}
.comp-ad-headline {
  margin-top: auto;
  font-family: var(--wm-font-display);
  font-size: 26px;
  line-height: 1.0;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  position: relative;
  text-wrap: balance;
}
.comp-ad-cta {
  margin-top: 12px;
  display: inline-block;
  align-self: flex-start;
  background: var(--wm-white);
  color: var(--wm-blue-900);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
}
.comp-ad-foot {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--op-chrome-line);
}
.comp-ad-tags {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.comp-ad-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px;
  color: var(--wm-fg-muted);
}
.comp-ad-meta b { color: var(--wm-fg); font-weight: 800; }

/* ============ Drill-down sheet ============ */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(10,15,27,0.45);
  z-index: 100;
  display: flex; align-items: center; justify-content: flex-end;
  animation: fadeIn 200ms cubic-bezier(.2,.8,.2,1);
}
.sheet {
  width: min(640px, 100vw);
  height: 100vh;
  background: var(--wm-white);
  overflow-y: auto;
  box-shadow: -24px 0 60px rgba(10,15,27,0.30);
  animation: slideIn 280ms cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.sheet-head {
  position: sticky; top: 0;
  background: var(--wm-white);
  padding: 18px 20px;
  border-bottom: 1px solid var(--op-chrome-line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  z-index: 2;
}
.sheet-body { padding: 20px; flex: 1; }
.sheet-foot {
  position: sticky; bottom: 0;
  background: var(--wm-white);
  padding: 14px 20px;
  border-top: 1px solid var(--op-chrome-line);
  display: flex; gap: 8px; justify-content: flex-end;
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ Misc ============ */
.divider { height: 1px; background: var(--op-line); margin: 16px 0; }
.divider-dotted {
  height: 0; border: none; border-top: 1px dotted var(--wm-blue);
  margin: 14px 0;
  opacity: 0.5;
}
.muted { color: var(--wm-fg-muted); }
.tnum  { font-variant-numeric: tabular-nums; }

.skeleton {
  display: inline-block;
  height: 1em; width: 80px;
  background: linear-gradient(90deg, var(--op-line) 0%, var(--op-chrome-line) 50%, var(--op-line) 100%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shim 1500ms infinite;
}
@keyframes shim { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.tooltip {
  position: absolute;
  background: var(--wm-blue-900);
  color: var(--wm-white);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  z-index: 50;
  box-shadow: var(--wm-shadow-md);
}
.tooltip::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--wm-blue-900);
}

/* Trend arrows */
.trend {
  display: inline-flex; align-items: center; gap: 2px;
  font-weight: 800; font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.trend.up   { color: var(--op-green); }
.trend.down { color: var(--op-red); }
.trend.flat { color: var(--wm-fg-muted); }

/* The orange accent rule used as a tasteful divider in section heads */
.head-accent {
  display: inline-block;
  width: 56px; height: 3px;
  background: var(--wm-orange);
  border-radius: 999px;
  margin-bottom: 8px;
}

/* Heatmap cell */
.heat-cell {
  display: grid; place-items: center;
  height: 38px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--wm-fg);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(.2,.8,.2,1);
}
.heat-cell:hover { transform: scale(1.06); z-index: 2; }
.heat-cell.empty { background: var(--op-line); color: transparent; cursor: default; }
.heat-cell.empty:hover { transform: none; }

/* compact density variant */
body.density-compact { font-size: 12px; }
body.density-compact .profit-cell { padding: 8px 14px; }
body.density-compact .profit-value { font-size: 20px; }
body.density-compact .table th, body.density-compact .table td { padding: 7px 10px; }
body.density-compact .card { padding: 12px; }
body.density-compact .kpi { padding: 9px 12px; }
body.density-compact .kpi-value { font-size: 19px; }
body.density-compact .main { padding: 14px; }

/* No-text-decoration links inside data tables */
.table a { text-decoration: none; color: var(--wm-blue); font-weight: 700; }
.table a:hover { text-decoration: underline; text-decoration-color: var(--wm-orange); }

/* Selection ring on creative click */
.is-selected-ring {
  outline: 2px solid var(--wm-orange);
  outline-offset: 2px;
}

/* Empty state */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--wm-fg-muted);
  font-size: 13px;
}

/* Subtle WindMar pattern accent */
.bg-pattern-dots {
  background-image: radial-gradient(var(--wm-blue-100) 1px, transparent 1px);
  background-size: 14px 14px;
}
