/* =====================================================================
   Makali Client Dashboard — application styles.
   Extends colors_and_type.css. Pure black canvas, gradient as accent,
   raised cards #111 on #000. Never grey-ish-black.
   ===================================================================== */

* { box-sizing: border-box; }
html, body { background: #000; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; }

/* Disable native scroll bounce/native scrollbar styling to match dark UI */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #2E2E2E; }

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  background: #000;
  color: #fff;
  font-family: var(--font-body);
  display: grid;
  grid-template-columns: 248px 1fr;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.side {
  background: #000;
  border-right: 1px solid #141414;
  padding: 22px 14px 18px;
  display: flex; flex-direction: column;
  gap: 22px;
  position: sticky; top: 0; height: 100vh;
  z-index: 10;
}
.side__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 0;
}
.side__brand img { height: 22px; }
.side__client {
  display: grid; grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px 10px;
  background: #0d0d0d;
  border: 1px solid #1a1a1a;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.side__client:hover { border-color: #2E2E2E; background: #111; }
/* Static (non-interactive) variant — no hover state, no caret, two-column */
.side__client--static {
  grid-template-columns: 36px 1fr;
  cursor: default;
}
.side__client--static:hover { border-color: #1a1a1a; background: #0d0d0d; }
.side__client-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--mk-gradient-diag);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 900; font-size: 13px;
  color: #000;
  letter-spacing: .02em;
}
.side__client-name {
  font-family: var(--font-display); font-weight: 900;
  font-size: 13px; letter-spacing: .01em; color: #fff;
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side__client-meta {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--fg-2); letter-spacing: .08em;
  margin-top: 2px;
}
.side__client svg { color: var(--fg-2); }

.side__group { display: flex; flex-direction: column; gap: 2px; }
.side__label {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-mute);
  padding: 8px 12px 6px;
}
.side__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: .005em;
  color: var(--fg-2);
  cursor: pointer; border: 0; background: transparent;
  position: relative;
  width: 100%; text-align: left;
  transition: background .12s var(--ease-out), color .12s var(--ease-out);
}
.side__item:hover { color: #fff; background: #0f0f0f; }
.side__item.is-active {
  color: #fff;
  background: #111;
}
.side__item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--mk-gradient);
}
.side__item svg { width: 17px; height: 17px; flex: none; stroke-width: 1.75; }
.side__item-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--fg-mute);
}
.side__item-dot {
  margin-left: auto;
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--mk-acqua);
  box-shadow: 0 0 8px 1px rgba(0,231,255,.55);
}
.side__divider {
  height: 1px;
  background: #141414;
  margin: 0 6px;
}
.side__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid #141414; }
.side__user {
  display: grid; grid-template-columns: 32px 1fr auto;
  gap: 10px; align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s var(--ease-out);
}
.side__user:hover { background: #0f0f0f; }
.side__avatar {
  width: 32px; height: 32px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 900;
  font-size: 11px; color: #000;
  background: var(--mk-gradient-diag);
  letter-spacing: .02em;
}
.side__uname { font-family: var(--font-display); font-weight: 700; font-size: 12.5px; }
.side__urole { font-size: 10.5px; color: var(--fg-2); margin-top: 1px; font-family: var(--font-mono); letter-spacing: .04em; }

/* ============================================================
   TOP BAR — sticky filter row
   ============================================================ */
.main { min-width: 0; display: flex; flex-direction: column; background: #000; }
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid #141414;
  padding: 14px 32px;
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.top__crumbs {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2);
}
.top__crumbs b { color: #fff; font-weight: 900; }
.top__crumbs .slash { color: var(--fg-mute); }

.top__filters { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-eyebrow {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-mute);
}
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #0c0c0c;
  border: 1px solid #1a1a1a;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11.5px; color: #fff; letter-spacing: .01em;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.pill:hover { border-color: #2E2E2E; }
.pill svg { width: 13px; height: 13px; }
.pill__mute { color: var(--fg-2); font-weight: 500; }

.seg {
  display: inline-flex;
  padding: 3px;
  background: #0c0c0c;
  border: 1px solid #1a1a1a;
  border-radius: 999px;
}
.seg button {
  background: transparent; border: 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .04em;
  color: var(--fg-2); cursor: pointer;
  transition: color .12s var(--ease-out), background .12s var(--ease-out);
}
.seg button:hover { color: #fff; }
.seg button.is-on {
  background: #fff; color: #000;
}

.top__right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: rgba(0, 231, 255, 0.06);
  border: 1px solid rgba(0, 231, 255, 0.18);
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--mk-acqua);
  letter-spacing: .04em;
}
.sync-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--mk-acqua); box-shadow: 0 0 6px 1px rgba(0,231,255,.6); transition: transform .25s; }
.sync-chip--btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sync-chip--btn:hover { background: rgba(0,231,255,.12); border-color: rgba(0,231,255,.32); }
.sync-chip--btn:active { transform: scale(.98); }
.sync-chip--btn.is-syncing { background: rgba(0,231,255,.14); }
.sync-dot--spin {
  animation: sync-spin 800ms linear infinite;
  background: transparent;
  box-shadow: none;
  border: 1.5px solid rgba(0,231,255,.25);
  border-top-color: var(--mk-acqua);
}
@keyframes sync-spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: #0c0c0c; border: 1px solid #1a1a1a;
  color: #fff; cursor: pointer;
  position: relative;
  transition: border-color .15s var(--ease-out);
}
.icon-btn:hover { border-color: #2E2E2E; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--mk-raspberry); box-shadow: 0 0 6px 1px rgba(239,17,102,.6);
}

/* ============================================================
   CANVAS
   ============================================================ */
.canvas {
  padding: 28px 32px 80px;
  display: flex; flex-direction: column;
  gap: 24px;
  max-width: 1480px;
  width: 100%;
}

/* Page header pattern */
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head__eyebrow {
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2);
}
.page-head__title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 40px; letter-spacing: -.025em; text-transform: uppercase;
  line-height: .94; margin: 0; color: #fff;
}
.page-head__sub {
  font-size: 14px; color: var(--fg-2); margin-top: 4px;
  font-family: var(--font-body); font-weight: 400; line-height: 1.5;
  max-width: 720px;
}

/* ============================================================
   AI NARRATIVE — Overview hero
   ============================================================ */
.narrative {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  align-items: stretch;
}
.narr-main {
  background: #0a0a0a;
  border: 1px solid #181818;
  border-radius: 24px;
  padding: 32px 36px 28px;
  position: relative;
  overflow: hidden;
}
.narr-main::before {
  content: "";
  position: absolute;
  inset: -120px -120px auto auto;
  width: 380px; height: 380px;
  background: radial-gradient(closest-side, rgba(118,0,255,.32), transparent 70%);
  pointer-events: none;
  filter: blur(20px);
}
.narr-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: rgba(0, 231, 255, 0.06);
  border: 1px solid rgba(0, 231, 255, 0.22);
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--mk-acqua);
  margin-bottom: 18px;
  position: relative;
}
.narr-tag .sparkle {
  width: 14px; height: 14px;
  background: var(--mk-gradient-diag);
  border-radius: 4px;
  display: grid; place-items: center;
  color: #000;
}
.narr-headline {
  font-family: var(--font-display); font-weight: 900;
  font-size: 44px; letter-spacing: -.025em; text-transform: uppercase;
  line-height: .96; margin: 0;
  color: #fff;
  position: relative;
  max-width: 620px;
}
.narr-headline .accent {
  background: var(--mk-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.narr-headline .glow {
  color: var(--mk-acqua);
}
.narr-body {
  font-size: 15px; line-height: 1.6; color: var(--fg-2);
  margin: 22px 0 0; max-width: 600px;
  position: relative;
}
.narr-body b { color: #fff; font-weight: 700; }
.narr-body .pos { color: var(--mk-acqua); font-weight: 700; }
.narr-body .neg { color: var(--mk-raspberry); font-weight: 700; }
.narr-meta {
  display: flex; gap: 22px; align-items: center;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #181818;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-mute);
  position: relative;
}
.narr-meta .agent {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff;
}
.narr-meta .agent .badge {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--mk-gradient-diag);
  display: grid; place-items: center;
  color: #000;
}

/* Right side hero: MER big number + sparkline */
.narr-side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 22px;
}
.hero-stat {
  background: #0a0a0a;
  border: 1px solid #181818;
  border-radius: 24px;
  padding: 22px 24px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.hero-stat__eyebrow {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 10px;
}
.hero-stat__eyebrow .ctx { color: var(--fg-mute); }
.hero-stat__val {
  font-family: var(--font-display); font-weight: 900;
  font-size: 64px; letter-spacing: -.04em;
  line-height: .9;
  display: flex; align-items: baseline; gap: 10px;
}
.hero-stat__val .gradient {
  background: var(--mk-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.hero-stat__val .unit {
  font-size: 28px; font-weight: 900; color: var(--fg-2); letter-spacing: -.02em;
}
.hero-stat__delta {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,231,255,.08);
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; color: var(--mk-acqua);
  width: fit-content;
}
.hero-stat__delta.down { background: rgba(239,17,102,.08); color: var(--mk-raspberry); }
.hero-stat__chart {
  margin-top: auto;
  height: 56px;
}
.hero-stat__foot {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .08em; color: var(--fg-mute);
  text-transform: uppercase;
}

.hero-stat--compact .hero-stat__val { font-size: 44px; }
.hero-stat--compact .hero-stat__val .unit { font-size: 20px; }

/* ============================================================
   HIGHLIGHT CARDS — contextual wins/alerts
   ============================================================ */
.highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.highlight {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 20px;
  padding: 22px;
  display: flex; flex-direction: column;
  gap: 14px;
  min-height: 260px;
  position: relative;
  overflow: hidden;
  transition: transform .25s var(--ease-out), border-color .25s var(--ease-out);
}
.highlight:hover { transform: translateY(-2px); border-color: #2a2a2a; }
.highlight__head {
  display: flex; justify-content: space-between; align-items: center;
}
.highlight__num {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .12em; color: var(--fg-mute);
}
.highlight__kind {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 900;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
}
.highlight__kind .dot {
  width: 7px; height: 7px; border-radius: 999px;
}
.highlight.win .highlight__kind { color: var(--mk-acqua); }
.highlight.win .highlight__kind .dot { background: var(--mk-acqua); box-shadow: 0 0 8px 1px rgba(0,231,255,.55); }
.highlight.alert .highlight__kind { color: var(--mk-raspberry); }
.highlight.alert .highlight__kind .dot { background: var(--mk-raspberry); box-shadow: 0 0 8px 1px rgba(239,17,102,.55); }
.highlight.watch .highlight__kind { color: var(--mk-orange); }
.highlight.watch .highlight__kind .dot { background: var(--mk-orange); box-shadow: 0 0 8px 1px rgba(255,127,0,.55); }

.highlight__title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 20px; line-height: 1.1; color: #fff;
  letter-spacing: -.015em;
  margin: 0;
}
.highlight__body {
  font-size: 13.5px; line-height: 1.55; color: var(--fg-2);
  margin: 0;
}
.highlight__body b { color: #fff; font-weight: 700; }
.highlight__stats {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid #181818;
}
.highlight__stat-l {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.highlight__stat-v {
  font-family: var(--font-display); font-weight: 900;
  font-size: 22px; letter-spacing: -.02em; color: #fff;
}
.highlight.win .highlight__stat-v.accent { color: var(--mk-acqua); }
.highlight.alert .highlight__stat-v.accent { color: var(--mk-raspberry); }
.highlight.watch .highlight__stat-v.accent { color: var(--mk-orange); }
.highlight__spark { width: 80px; height: 36px; }
.highlight__foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #181818;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .08em; color: var(--fg-mute);
  text-transform: uppercase;
}
.highlight__foot .arrow {
  color: #fff;
  transition: transform .2s var(--ease-out);
}
.highlight:hover .highlight__foot .arrow { transform: translateX(4px); }

/* ============================================================
   KPI ROW
   ============================================================ */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.kpis.kpis--4 { grid-template-columns: repeat(4, 1fr); }
.kpi {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 16px;
  padding: 16px 18px 14px;
  display: flex; flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  min-height: 132px;
}
.kpi__label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg-2);
}
.kpi__label svg { width: 12px; height: 12px; color: var(--fg-mute); }
.kpi__val {
  font-family: var(--font-display); font-weight: 900;
  font-size: 30px; letter-spacing: -.03em; line-height: 1;
  color: #fff;
  white-space: nowrap;
}
.kpi__delta-row {
  display: flex; align-items: center; gap: 6px;
}
.kpi__delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .02em;
}
.kpi__delta.up { background: rgba(0,231,255,.08); color: var(--mk-acqua); }
.kpi__delta.down { background: rgba(239,17,102,.08); color: var(--mk-raspberry); }
.kpi__delta.neutral { background: #1a1a1a; color: var(--fg-2); }
.kpi__delta-ctx {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--fg-mute); letter-spacing: .04em;
}
.kpi__spark {
  position: absolute; right: 14px; bottom: 12px;
  width: 70px; height: 24px;
  opacity: .9;
}

/* ============================================================
   PANEL
   ============================================================ */
.panel {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 20px;
  padding: 20px 22px;
  display: flex; flex-direction: column;
  gap: 16px;
}
.panel__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap;
}
.panel__head-l { display: flex; flex-direction: column; gap: 4px; }
.panel__title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 16px; letter-spacing: -.005em; text-transform: uppercase;
  margin: 0; line-height: 1.1; color: #fff;
}
.panel__sub {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2); margin: 0;
}
.panel__legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--fg-2); font-weight: 600;
}
.legend-item .sw { width: 9px; height: 9px; border-radius: 2px; }
.legend-item .sw--line { width: 14px; height: 2px; border-radius: 999px; }

/* Chart wrapper */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; display: block; }

/* Row layouts */
.row-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.row-2--even { grid-template-columns: 1fr 1fr; }
.row-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 18px; }

/* ============================================================
   TABLE
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2);
  text-align: left;
  padding: 10px 10px 12px;
  border-bottom: 1px solid #1a1a1a;
}
.tbl th.num { text-align: right; }
.tbl td {
  padding: 14px 10px;
  border-bottom: 1px solid #141414;
  font-size: 13px; vertical-align: middle;
  color: #fff;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr { transition: background .12s var(--ease-out); }
.tbl tbody tr:hover { background: #0e0e0e; }
.tbl td.num {
  text-align: right;
  font-family: var(--font-display); font-weight: 700;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.005em;
  white-space: nowrap;
}
.tbl td.delta {
  text-align: right;
  font-family: var(--font-display); font-weight: 700;
  font-size: 12px; white-space: nowrap;
}
.tbl td.delta.up { color: var(--mk-acqua); }
.tbl td.delta.down { color: var(--mk-raspberry); }
.tbl td.delta.neutral { color: var(--fg-2); }
.tbl .ch { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.tbl .ch .dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.tbl .ch .sq { width: 22px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center; color: #fff; }

.tbl .status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
}
.tbl .status.active { background: rgba(0,231,255,.08); color: var(--mk-acqua); }
.tbl .status.paused { background: #1a1a1a; color: var(--fg-2); }
.tbl .status.learning { background: rgba(255,127,0,.08); color: var(--mk-orange); }
.tbl .status .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.tbl__sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); margin-top: 3px; }
.tbl__sub-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); margin-top: 3px; text-align: right; font-weight: 400; letter-spacing: 0; }

/* Mini-bar inline */
.bar-cell {
  display: inline-block;
  width: 80px; height: 6px; border-radius: 999px;
  background: #1a1a1a;
  vertical-align: middle;
  margin-right: 10px;
  position: relative; overflow: hidden;
}
.bar-cell__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--mk-gradient);
  border-radius: 999px;
}

/* ============================================================
   PLATFORM HEADER — Meta / Google / GA / Shopify
   ============================================================ */
.plat-head {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 0 0;
}
.plat-mark {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff;
}
.plat-mark.meta { background: linear-gradient(135deg, #0866FF 0%, #7600FF 100%); }
.plat-mark.google { background: #fff; color: #000; }
.plat-mark.ga { background: linear-gradient(135deg, #F9AB00 0%, #E37400 100%); color: #fff; }
.plat-mark.shopify { background: linear-gradient(135deg, #5E8E3E 0%, #95BF47 100%); }
.plat-head__title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 36px; letter-spacing: -.025em; text-transform: uppercase;
  margin: 0; line-height: .96;
}
.plat-head__sub {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-2); letter-spacing: .04em; margin-top: 4px;
}
.plat-head__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.plat-account {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px;
}
.plat-account__l { font-family: var(--font-display); font-weight: 700; font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--fg-2); }
.plat-account__v { font-family: var(--font-mono); font-size: 12px; color: #fff; }

/* ============================================================
   CREATIVE GALLERY
   ============================================================ */
.creative-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.creative {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .25s var(--ease-out), border-color .25s var(--ease-out);
}
.creative:hover { transform: translateY(-3px); border-color: #2E2E2E; }
.creative__thumb {
  aspect-ratio: 4 / 5;
  position: relative;
  overflow: hidden;
  background: #000;
}
.creative__thumb-bg {
  position: absolute; inset: 0;
}
.creative__thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.75) 100%);
  pointer-events: none;
}
.creative__rank {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-display); font-weight: 900;
  font-size: 10px; letter-spacing: .12em;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  z-index: 3;
}
.creative__badge {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.12);
  z-index: 3;
}
.creative__badge.video { color: #fff; }
.creative__badge svg { width: 11px; height: 11px; }
.creative__play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  z-index: 2;
  transition: opacity .2s var(--ease-out);
}
.creative__play-btn {
  width: 56px; height: 56px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  border: 1.5px solid rgba(255,255,255,.7);
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
  transition: transform .2s var(--ease-out), background .2s var(--ease-out);
}
.creative:hover .creative__play-btn {
  transform: scale(1.08);
  background: rgba(0,231,255,.55);
  border-color: #fff;
}
.creative__play-btn svg { width: 22px; height: 22px; color: #fff; }
.creative.is-playing .creative__play { opacity: 0; pointer-events: none; }

.creative__caption {
  position: absolute; bottom: 10px; left: 12px; right: 12px;
  z-index: 3;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; letter-spacing: .04em; color: #fff;
  line-height: 1.25;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}

.creative__duration {
  position: absolute; bottom: 10px; right: 10px;
  z-index: 3;
  font-family: var(--font-mono); font-size: 10px;
  background: rgba(0,0,0,.7);
  padding: 2px 6px; border-radius: 4px; color: #fff;
}

.creative__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.creative__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.creative__platform {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--fg-2);
}
.creative__platform .ic { width: 12px; height: 12px; }
.creative__id { font-family: var(--font-mono); font-size: 10px; color: var(--fg-mute); }
.creative__stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #181818;
}
.creative__stat-l { font-family: var(--font-display); font-weight: 700; font-size: 8.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-2); margin-bottom: 3px; }
.creative__stat-v { font-family: var(--font-display); font-weight: 900; font-size: 15px; color: #fff; letter-spacing: -.01em; }
.creative__stat-v.pos { color: var(--mk-acqua); }
.creative__stat-v.neg { color: var(--mk-raspberry); }
.creative__concept {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1a1a1a;
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .04em;
  color: var(--fg-2);
}

/* "Playing" inline animation — mock video preview */
.video-frames {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
}
.video-frames > div {
  background-size: cover; background-position: center;
  filter: brightness(.95);
  animation: frame-shift 6s steps(8, end) infinite;
}
@keyframes frame-shift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-12%); }
}

/* Inline "now playing" indicator */
.now-playing-pill {
  position: absolute; top: 10px; right: 10px;
  z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  background: rgba(0,231,255,.9);
  border-radius: 6px;
  font-family: var(--font-display); font-weight: 900;
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: #000;
}
.np-bars { display: inline-flex; gap: 2px; align-items: end; height: 9px; }
.np-bars span {
  width: 2px; background: #000; border-radius: 1px;
  animation: bar-pulse 1.1s ease-in-out infinite;
}
.np-bars span:nth-child(1) { animation-delay: .0s; height: 80%; }
.np-bars span:nth-child(2) { animation-delay: .2s; height: 100%; }
.np-bars span:nth-child(3) { animation-delay: .4s; height: 60%; }
.np-bars span:nth-child(4) { animation-delay: .15s; height: 90%; }
@keyframes bar-pulse {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}

/* Concept grid (creative library overview) */
.concepts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.concept {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 16px;
  padding: 18px 18px 16px;
  display: flex; flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform .25s var(--ease-out), border-color .25s var(--ease-out);
}
.concept:hover { transform: translateY(-2px); border-color: #2a2a2a; }
.concept__head { display: flex; justify-content: space-between; align-items: center; }
.concept__name {
  font-family: var(--font-display); font-weight: 900;
  font-size: 13px; color: #fff; letter-spacing: -.005em;
}
.concept__count {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute);
}
.concept__roas {
  font-family: var(--font-display); font-weight: 900;
  font-size: 32px; letter-spacing: -.03em; color: #fff;
  display: flex; align-items: baseline; gap: 8px;
}
.concept__roas .x { font-size: 16px; color: var(--fg-2); font-weight: 700; }
.concept__roas .delta {
  font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700;
  letter-spacing: .02em;
}
.concept__roas .delta.up { background: rgba(0,231,255,.08); color: var(--mk-acqua); }
.concept__roas .delta.down { background: rgba(239,17,102,.08); color: var(--mk-raspberry); }
.concept__foot {
  display: flex; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid #181818;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--fg-2);
}
.concept__foot b { color: #fff; font-weight: 700; }

/* ============================================================
   FUNNEL
   ============================================================ */
.funnel {
  display: flex; flex-direction: column; gap: 10px;
}
.funnel-row {
  display: grid;
  grid-template-columns: 1fr 110px 80px;
  gap: 14px;
  align-items: center;
}
.funnel-bar {
  height: 38px;
  border-radius: 8px;
  background: #141414;
  position: relative;
  overflow: hidden;
}
.funnel-bar__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--mk-gradient);
  border-radius: 8px;
  display: flex; align-items: center;
  padding: 0 14px;
}
.funnel-bar__label {
  font-family: var(--font-display); font-weight: 900;
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: #000;
  white-space: nowrap;
}
.funnel-bar__label.out {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #fff;
}
.funnel-val {
  text-align: right;
  font-family: var(--font-display); font-weight: 900;
  font-size: 18px; color: #fff;
  letter-spacing: -.015em;
}
.funnel-rate {
  text-align: right;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-2);
}
.funnel-rate.good { color: var(--mk-acqua); }
.funnel-rate.bad { color: var(--mk-raspberry); }

/* ============================================================
   GEO LIST
   ============================================================ */
.geo-list { display: flex; flex-direction: column; gap: 12px; }
.geo-row {
  display: grid;
  grid-template-columns: 28px 1fr 70px;
  gap: 12px; align-items: center;
}
.geo-row__flag {
  width: 28px; height: 20px; border-radius: 3px;
  display: grid; place-items: center;
  font-size: 16px; line-height: 1;
  overflow: hidden;
}
.geo-row__mid {
  display: flex; flex-direction: column; gap: 5px;
}
.geo-row__top {
  display: flex; justify-content: space-between; align-items: baseline;
}
.geo-row__name { font-family: var(--font-display); font-weight: 700; font-size: 12.5px; color: #fff; }
.geo-row__pct { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }
.geo-row__bar { height: 5px; background: #1a1a1a; border-radius: 999px; overflow: hidden; }
.geo-row__bar-fill { height: 100%; background: var(--mk-gradient); border-radius: 999px; }
.geo-row__val { text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 12.5px; }

/* ============================================================
   DONUT
   ============================================================ */
.donut-wrap {
  display: grid; grid-template-columns: 160px 1fr; gap: 22px; align-items: center;
  padding: 6px 0;
}
.donut-svg { width: 160px; height: 160px; }
.donut-rows { display: flex; flex-direction: column; gap: 9px; }
.donut-row {
  display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 10px;
}
.donut-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.donut-row .nm { font-size: 12.5px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-row .v { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff; letter-spacing: -.005em; }
.donut-row .p { font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }

/* ============================================================
   ATTRIBUTION PROGRESS CARDS
   ============================================================ */
.progress-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.progress {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
  background: #0e0e0e;
  border: 1px solid #181818;
  border-radius: 12px;
}
.progress__head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #fff;
}
.progress__head .v {
  font-family: var(--font-display); font-weight: 900; font-size: 14px; letter-spacing: -.01em;
}
.progress__bar {
  height: 5px; background: #1a1a1a; border-radius: 999px;
  position: relative; overflow: hidden;
}
.progress__bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 999px;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-bg {
  position: fixed; inset: 0;
  z-index: 100;
  background: #000;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Blurred dashboard chrome behind the login card.
   Pure black canvas, dark-grey rectangles that read as cards.
   Heavy blur softens them to a suggestion of UI, not real content. */
.login-thumbs {
  position: absolute; inset: 0;
  filter: blur(6px);
  opacity: .55;
  pointer-events: none;
}
.lt {
  position: absolute;
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 16px;
}
.lt--sb {
  background: #060606;
  border-color: #141414;
}
.lt--filter {
  display: flex; align-items: center; gap: 12px;
  background: #0a0a0a;
  border-radius: 999px;
  border-color: #181818;
}
.lt--kpi-row {
  display: flex; gap: 12px;
  background: transparent;
  border: 0;
}
.lt__kpi {
  background: #0c0c0c;
  border: 1px solid #181818;
  border-radius: 16px;
}
.lt__bar {
  background: #1a1a1a;
  border-radius: 4px;
}
.lt__row {
  position: absolute;
  background: #111;
  border: 1px solid #1a1a1a;
}
.lt__nav-item {
  position: absolute;
  background: #1a1a1a;
  border-radius: 8px;
}

/* Login card */
.login-card {
  position: relative; z-index: 2;
  width: calc(100% - 32px); max-width: 440px;
  margin: 0;
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  padding: 36px 36px 30px;
  display: flex; flex-direction: column;
  gap: 24px;
}
.login-card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(0,231,255,.4) 0%, rgba(118,0,255,.4) 40%, rgba(239,17,102,.4) 80%, rgba(255,127,0,.4) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.login-logo { height: 28px; align-self: flex-start; }
.login-eyebrow {
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-2);
}
.login-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 28px; letter-spacing: -.02em; text-transform: uppercase;
  line-height: 1; color: #fff;
  margin: 0;
}
.login-title .accent {
  background: var(--mk-gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field label {
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg-2);
}
.login-field input {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 12px;
  padding: 13px 14px;
  font-family: var(--font-body); font-weight: 500;
  font-size: 14px; color: #fff;
  outline: none;
  transition: border-color .15s var(--ease-out);
}
.login-field input::placeholder { color: var(--fg-mute); }
.login-field input:focus { border-color: var(--mk-acqua); }
.login-row { display: flex; justify-content: space-between; align-items: center; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-2); cursor: pointer; user-select: none; }
.login-remember input { accent-color: var(--mk-acqua); }
.login-forgot {
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; color: var(--mk-acqua); cursor: pointer; border: 0; background: transparent;
  letter-spacing: .04em;
}
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--mk-gradient);
  color: #fff;
  font-family: var(--font-display); font-weight: 900;
  font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase;
  border: 0; cursor: pointer;
  position: relative;
  transition: transform .15s var(--ease-out);
  width: 100%;
}
.btn-primary:hover { outline: 1.5px solid #fff; outline-offset: 3px; }
.btn-primary:active { transform: scale(.98); }
.btn-primary svg { width: 14px; height: 14px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid #2E2E2E;
  color: #fff;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11.5px; letter-spacing: .06em;
  cursor: pointer;
  transition: background .15s var(--ease-out), border-color .15s var(--ease-out);
}
.btn-ghost:hover { background: #1A1A1A; border-color: #fff; }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--fg-mute);
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: #181818; }

.login-sso { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login-foot {
  font-size: 11.5px; color: var(--fg-mute); text-align: center;
  font-family: var(--font-mono); letter-spacing: .04em;
}
.login-foot a, .login-foot button {
  color: var(--mk-acqua); border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: inherit;
}

/* ============================================================
   BUTTONS — General
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #0c0c0c;
  border: 1px solid #1a1a1a;
  color: #fff;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.btn:hover { border-color: #2E2E2E; background: #111; }
.btn svg { width: 12px; height: 12px; }
.btn--solid {
  background: #fff; color: #000; border-color: #fff;
}
.btn--solid:hover { background: #fff; outline: 1.5px solid #fff; outline-offset: 3px; }
.btn--gradient {
  background: var(--mk-gradient);
  color: #fff;
  border-color: transparent;
}
.btn--gradient:hover { outline: 1.5px solid #fff; outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #141414;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .04em;
  color: var(--fg-2);
  border: 0;
  cursor: pointer;
}
.chip.is-on {
  background: #fff; color: #000;
}

/* ============================================================
   BADGE / TAG
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
}
.tag.acqua { background: rgba(0,231,255,.08); color: var(--mk-acqua); }
.tag.pink { background: rgba(239,17,102,.08); color: var(--mk-raspberry); }
.tag.orange { background: rgba(255,127,0,.08); color: var(--mk-orange); }
.tag.indigo { background: rgba(118,0,255,.1); color: #b394ff; }
.tag.neutral { background: #1a1a1a; color: var(--fg-2); }
.tag.gradient { background: var(--mk-gradient); color: #fff; }

/* ============================================================
   PRODUCT ROW (Shopify)
   ============================================================ */
.product {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px; align-items: center;
}
.product__img {
  width: 56px; height: 56px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 900;
  font-size: 22px; color: #fff; letter-spacing: -.02em;
  overflow: hidden;
  position: relative;
}
.product__img::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(closest-side, transparent 30%, rgba(0,0,0,.5) 100%);
}
.product__img span { position: relative; z-index: 1; }
.product__name { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; }
.product__sku { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); margin-top: 2px; }

/* ============================================================
   TAG PICKER
   ============================================================ */
.tagpkr {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px;
  position: relative;
}
.tagpkr__empty {
  font-family: var(--font-display); font-weight: 700;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-mute);
  padding: 4px 0;
}
.tagpkr__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tc, #6B6B6B) 35%, #1a1a1a);
  background: color-mix(in srgb, var(--tc, #6B6B6B) 12%, #0a0a0a);
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .04em;
  color: #fff;
  line-height: 1;
}
.tagpkr__dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--tc, #6B6B6B);
  box-shadow: 0 0 4px 0 color-mix(in srgb, var(--tc, #6B6B6B) 70%, transparent);
}
.tagpkr__x {
  display: grid; place-items: center;
  width: 14px; height: 14px; border-radius: 999px;
  background: transparent; border: 0;
  color: var(--fg-2); cursor: pointer;
  transition: background .12s var(--ease-out), color .12s var(--ease-out);
}
.tagpkr__x:hover { background: #2E2E2E; color: #fff; }
.tagpkr__add {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px dashed #2E2E2E;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .04em;
  color: var(--fg-2);
  cursor: pointer;
  transition: color .12s var(--ease-out), border-color .12s var(--ease-out);
}
.tagpkr__add:hover { color: #fff; border-color: var(--mk-acqua); border-style: solid; }
.tagpkr__add svg { color: var(--mk-acqua); }

.tagpkr--sm .tagpkr__chip { font-size: 9.5px; padding: 2px 4px 2px 7px; }
.tagpkr--sm .tagpkr__add  { font-size: 9.5px; padding: 3px 8px; }
.tagpkr--sm .tagpkr__x { width: 12px; height: 12px; }

/* Popover */
.tagpkr__pop {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  z-index: 30;
  width: 280px;
  background: #0e0e0e;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.02);
  display: flex; flex-direction: column; gap: 8px;
  animation: tagpkr-in .18s cubic-bezier(.22,1,.36,1);
}
.tagpkr__pop--above { top: auto; bottom: calc(100% + 6px); }
@keyframes tagpkr-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.tagpkr__pop-head {
  font-family: var(--font-display); font-weight: 700;
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-mute);
}
.tagpkr__pop-grid {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tagpkr__pop-empty {
  font-size: 11px; color: var(--fg-2); padding: 2px 0;
}
.tagpkr__pop-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tc, #6B6B6B) 10%, #141414);
  border: 1px solid color-mix(in srgb, var(--tc, #6B6B6B) 25%, #1a1a1a);
  color: #fff; cursor: pointer;
  font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: .04em;
  transition: border-color .12s var(--ease-out), transform .12s var(--ease-out);
}
.tagpkr__pop-opt:hover {
  border-color: var(--tc);
  transform: translateY(-1px);
}
.tagpkr__pop-form {
  display: grid; grid-template-columns: 1fr auto; gap: 6px;
}
.tagpkr__pop-form input {
  background: #1A1A1A;
  border: 1px solid #2E2E2E;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--font-body); font-weight: 500;
  font-size: 12px; color: #fff;
  outline: none;
  transition: border-color .12s var(--ease-out);
}
.tagpkr__pop-form input::placeholder { color: var(--fg-mute); }
.tagpkr__pop-form input:focus { border-color: var(--mk-acqua); }
.tagpkr__pop-create {
  background: var(--mk-gradient);
  border: 0; cursor: pointer;
  padding: 0 14px;
  border-radius: 10px;
  font-family: var(--font-display); font-weight: 900;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: #fff;
}
.tagpkr__pop-create:hover { outline: 1.5px solid #fff; outline-offset: 2px; }

/* Filter strip variant */
.tag-strip {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.tag-strip .chip { white-space: nowrap; }
.chip--untagged {
  background: rgba(255,127,0,.08);
  color: var(--mk-orange);
}
.chip--untagged.is-on { background: var(--mk-orange); color: #000; }
.chip--untagged svg { width: 10px; height: 10px; }
.chip__count {
  display: inline-flex; align-items: center;
  margin-left: 4px;
  padding: 1px 6px;
  background: rgba(0,0,0,.25);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
}
.chip.is-on .chip__count { background: rgba(255,255,255,.25); }

/* Inline tag list (for table rows or creative cards) */
.tag-row {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.tag-row .tagpkr__chip { font-size: 9.5px; padding: 2px 4px 2px 7px; }
.tag-row .tagpkr__add { font-size: 9.5px; padding: 3px 7px; }
.tag-row .tagpkr__x { width: 12px; height: 12px; }
.fade-up {
  animation: mk-fade-up 480ms cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes mk-fade-up {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .narrative { grid-template-columns: 1fr; }
  .creative-grid, .concepts { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .row-2, .row-2--even, .row-3 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   MOBILE — ≤768px
   Sidebar collapses to a slide-in panel; KPIs stack; charts go
   full-width; tables scroll horizontally; settings form stacks.
   ------------------------------------------------------------ */

/* Hamburger trigger — only visible on mobile */
.hamburger {
  display: none;
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 8px;
  align-items: center; justify-content: center;
  cursor: pointer;
  flex: none;
}
.hamburger:hover { background: rgba(255,255,255,.06); }
.hamburger:active { background: rgba(255,255,255,.1); }

/* Mobile sidebar backdrop */
.mobile-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  animation: mb-fade .18s ease-out both;
}
@keyframes mb-fade { from { opacity: 0; } to { opacity: 1; } }

/* Table horizontal scroll wrapper */
.tbl-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------
   STATE COMPONENTS — loading / empty / error
   Rendered when a page is fetching Supabase data, returned no
   rows, or the query failed. Brand-styled, centred.
   ------------------------------------------------------------ */
.state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 24px;
  background: #000;
  border: 1px solid #181818;
  border-radius: 16px;
  gap: 14px;
  min-height: 280px;
}
.state__spinner {
  width: 30px; height: 30px;
  border-radius: 999px;
  border: 2px solid #1a1a1a;
  border-top-color: var(--mk-acqua);
  animation: sync-spin 800ms linear infinite;
}
.state__mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--mk-gradient-diag);
  display: grid; place-items: center;
  color: #000;
}
.state__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.state__msg {
  font-size: 13px;
  color: var(--fg-2);
  max-width: 380px;
  line-height: 1.55;
}
.state__msg--mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--mk-raspberry);
  word-break: break-word;
}
.state--error .state__mark {
  background: rgba(239,17,102,.1);
  color: var(--mk-raspberry);
  border: 1px solid rgba(239,17,102,.3);
}
.state--loading {
  background: transparent;
  border-color: transparent;
}

/* Shopify "Where's the leak?" rows + progress strip — desktop layout */
.shp-leak-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0e0e0e;
  border: 1px solid #181818;
  border-radius: 10px;
}
.shp-prog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 768px) {
  /* Belt-and-suspenders horizontal-overflow guard. Pages should fit naturally,
     but this prevents any rogue inline-styled descendant from pushing the
     viewport into horizontal scroll. Tables wrapped in .tbl-scroll still
     scroll within their own container. */
  html, body { overflow-x: hidden; }

  /* App layout: stack instead of side-by-side */
  .app {
    display: block;
  }
  .main {
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Overview highlight cards stack one per row */
  .highlights { grid-template-columns: 1fr; gap: 12px; }

  /* Shopify leak rows wrap so the tag drops below long text */
  .shp-leak-row { flex-wrap: wrap; }
  /* Shopify progress strip collapses to a single column on mobile */
  .shp-prog-grid { grid-template-columns: 1fr; }
  .canvas {
    padding: 18px 14px 36px;
    gap: 22px;
  }

  /* Sidebar: off-canvas slide-in */
  .side {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    max-width: 86vw;
    z-index: 100;
    transform: translateX(-101%);
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
    box-shadow: 0 10px 60px rgba(0,0,0,.7);
    border-right: 1px solid #161616;
    overflow-y: auto;
  }
  .side.is-mobile-open {
    transform: translateX(0);
  }

  /* TopBar: hamburger replaces sidebar entry */
  .hamburger { display: inline-flex; }
  .top {
    padding: 12px 14px;
    gap: 10px;
  }
  .top__filters {
    margin-left: 0 !important;
    width: 100%;
    order: 10;
  }
  .top__right {
    margin-left: auto;
    gap: 6px;
  }
  .sync-chip { display: none; }
  .top__crumbs { font-size: 11px; }

  /* KPIs and grids stack */
  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .narrative { grid-template-columns: 1fr; }
  .creative-grid, .concepts { grid-template-columns: 1fr; gap: 14px; }

  /* Panels and charts — full bleed within the canvas */
  .panel { padding: 16px; }
  .panel__head { flex-wrap: wrap; gap: 10px; }
  .panel__legend { width: 100%; }

  /* Tables: keep readable min-width, scroll horizontally inside wrapper */
  .tbl { min-width: 640px; }
  .tbl-scroll {
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* Platform headers stack vertically so the title isn't crowded */
  .plat-head { flex-wrap: wrap; gap: 12px; }
  .plat-head__right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .plat-head__title { font-size: 24px; }

  /* Settings form: single column */
  .set-grid { grid-template-columns: 1fr; gap: 14px; }
  .set-section { padding: 16px; }
  .set-section__head { flex-direction: column; align-items: stretch; gap: 8px; }
  .set-platform { grid-template-columns: 1fr; gap: 12px; }
  .set-platform .set-toggle { justify-self: flex-start; }

  /* Login: scale gracefully, hide busy blurred chrome */
  .login-card {
    width: calc(100vw - 32px);
    max-width: 420px;
    padding: 28px 22px;
    border-radius: 18px;
    gap: 18px;
  }
  .login-thumbs { display: none; }
  .login-logo { height: 24px; }
  .login-title { font-size: 22px; }
  .login-roles__tab { font-size: 11px; padding: 9px 10px; }

  /* Tweaks panel: drop it out of the way on mobile */
  .twk-panel { display: none !important; }
}

@media (max-width: 420px) {
  .canvas { padding: 14px 12px 28px; }
  .panel { padding: 14px; }
  .plat-head__title { font-size: 20px; }
}

/* ============================================================
   LOGIN ROLE TABS
   ============================================================ */
.login-roles {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  background: #0a0a0a;
  border: 1px solid #181818;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 4px;
}
.login-roles__tab {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.login-roles__tab svg { width: 12px; height: 12px; }
.login-roles__tab:hover { color: #fff; }
.login-roles__tab.is-on {
  background: var(--mk-gradient-diag);
  color: #000;
}
.login-error {
  font-size: 11.5px;
  color: var(--mk-raspberry);
  background: rgba(239,17,102,.08);
  border: 1px solid rgba(239,17,102,.32);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
}

/* Sidebar user role chip */
.side__urole--admin {
  color: var(--mk-acqua);
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.set-sections {
  display: flex; flex-direction: column;
  gap: 18px;
}
.set-section {
  background: #000;
  border: 1px solid #181818;
  border-radius: 16px;
  padding: 22px 24px;
}
.set-section__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #161616;
}
.set-section__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -.01em;
  text-transform: uppercase;
  margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.set-section__title svg { color: var(--mk-acqua); }
.set-section__sub {
  font-size: 12.5px; color: var(--fg-2);
  margin: 6px 0 0;
  max-width: 560px;
}
.set-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 22px;
}
.set-grid--single { grid-template-columns: 1fr; }
.set-field {
  display: flex; flex-direction: column;
  gap: 7px;
}
.set-field--wide { grid-column: 1 / -1; }
.set-field__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.set-field__hint {
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: 2px;
}
.set-input,
.set-select {
  appearance: none;
  background: #0d0d0d;
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  padding: 11px 14px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
}
.set-input:focus,
.set-select:focus {
  border-color: var(--mk-acqua);
  background: #0f0f0f;
}
.set-input::placeholder { color: var(--fg-mute); }
.set-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='rgba(255,255,255,.45)' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Logo upload */
.set-logo {
  display: flex; align-items: center; gap: 14px;
}
.set-logo__preview {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: #0d0d0d;
  border: 1px solid #1f1f1f;
  display: grid; place-items: center;
  color: var(--fg-mute);
  overflow: hidden;
  flex: none;
}
.set-logo__preview img {
  width: 100%; height: 100%; object-fit: contain;
}
.set-logo__upload {
  appearance: none;
  background: #0d0d0d;
  border: 1px solid #1f1f1f;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 10px;
  padding: 10px 14px;
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.set-logo__upload:hover { border-color: #2E2E2E; }
.set-logo__upload svg { width: 13px; height: 13px; }

/* Toggle switch — explicit button reset so no UA buttonface (~#EFEFEF) bleeds through */
.set-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: transparent !important;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
}
.set-toggle:focus { outline: none; }
.set-toggle:focus-visible { outline: 2px solid var(--mk-acqua); outline-offset: 4px; border-radius: 8px; }
.set-toggle__track {
  width: 36px; height: 20px;
  background: #1a1a1a;
  border-radius: 999px;
  position: relative;
  transition: background .2s;
}
.set-toggle__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform .2s cubic-bezier(.22, 1, .36, 1);
}
.set-toggle--on .set-toggle__track {
  background: var(--mk-gradient-diag);
}
.set-toggle--on .set-toggle__thumb {
  transform: translateX(16px);
}
.set-toggle__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mk-raspberry);
  min-width: 76px;
}
.set-toggle--on .set-toggle__label { color: var(--mk-acqua); }

/* Platform connection card — pure black, no grey fills */
.set-platform {
  border: 1px solid #1a1a1a;
  background: #000;
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 18px;
  align-items: center;
}
.set-platform__head {
  display: flex; align-items: center; gap: 12px;
}
.set-platform__mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #111;
  display: grid; place-items: center;
  color: #fff;
}
.set-platform__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .02em;
}
.set-platform__status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-top: 2px;
}
.set-platform__status.is-on { color: var(--mk-acqua); }
.set-platform__id {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; gap: 6px;
}
.set-platform__id input {
  background: #000;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 12.5px;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  outline: none;
}
.set-platform__id input:focus { border-color: var(--mk-acqua); }
.set-platform__id input:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Password field with show/hide */
.set-pw {
  position: relative;
  display: flex; align-items: center;
}
.set-pw input { flex: 1; padding-right: 64px; }
.set-pw__toggle {
  position: absolute; right: 8px;
  appearance: none;
  background: transparent; border: 0;
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
}
.set-pw__toggle:hover { color: #fff; }

.set-actions {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 12px;
  padding-top: 14px;
}
.set-saved-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mk-acqua);
  padding: 6px 12px;
  background: rgba(0,231,255,.06);
  border: 1px solid rgba(0,231,255,.22);
  border-radius: 999px;
}
@media (max-width: 1100px) {
  .set-grid { grid-template-columns: 1fr; }
}

/* TikTok plat-mark accent */
.plat-mark.tiktok {
  background: linear-gradient(135deg, #25F4EE 0%, #FE2C55 100%);
  color: #000;
}
