/* Tablero del equipo. Colores, tipografías, radio y logos salen de /app/static/marca.css (marca/marca.yaml →
   `python -m growth_os marca aplicar`): aquí no hay colores de marca escritos a mano. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.45 var(--f-text);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
body::before { /* grano sutil de la marca (forma.textura) */
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: var(--grain-op, 0); z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.tnum { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── estructura (como el tablero original: riel lateral + contenido) ── */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; position: relative; z-index: 1; }
.layout.collapsed { grid-template-columns: 68px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 18px 12px;
  border-right: 1px solid var(--line); background: var(--surface);
}
.sb-logo { display: flex; align-items: center; gap: 8px; padding: 4px 8px 16px; min-height: 44px; }
.sb-logo .logo { height: 26px; aspect-ratio: var(--logo-ratio); background: var(--logo) left center / contain no-repeat; }
.sb-logo .iso { display: none; width: 30px; aspect-ratio: var(--isotipo-ratio); background: var(--isotipo) center / contain no-repeat; }
.sb-logo .os { font: 600 11px var(--f-label); letter-spacing: .14em; color: var(--muted); }
.collapsed .sb-logo .logo, .collapsed .sb-logo .os, .collapsed .nav-label, .collapsed .collapse-label, .collapsed .user-txt { display: none; }
.collapsed .sb-logo .iso { display: block; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r);
  color: var(--text-2); cursor: pointer; text-align: left; position: relative;
}
.nav-item:hover { background: var(--hl); color: var(--text-strong); }
.nav-item.active { background: var(--accent-soft); color: var(--text-strong); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item svg { flex: none; }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.collapse-btn, .user-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: var(--r);
  color: var(--muted); cursor: pointer;
}
.collapse-btn:hover, .user-card:hover { background: var(--hl); color: var(--text); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--text-strong); font: 600 12px var(--f-label);
}
.user-txt { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.user-txt b { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.user-txt small { color: var(--faint); font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .spacer { flex: 1; }
.content { padding: 22px 28px 96px; max-width: 1480px; width: 100%; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 {
  margin: 0; font: 400 30px/1.1 var(--f-display); text-transform: var(--display-case); letter-spacing: -.01em; color: var(--text-strong);
}
.page-h .sub { color: var(--muted); margin-top: 6px; }
.eyebrow { font: 600 11px var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ── controles ── */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-soft); }
.seg button:hover { background: var(--hl); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.sel, .inp {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 10px; color: var(--text);
}
.sel { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r); padding: 7px 12px; cursor: pointer; color: var(--text);
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.btn.primary:hover { background: var(--btn-hover); }
.btn.icon { padding: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.mute { color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--r);
  border: 1px solid var(--warn); background: var(--warn-bg); color: var(--text);
}
.banner.err { border-color: var(--bad); background: var(--bad-bg); }
.banner b { color: var(--text-strong); font-weight: 600; }

/* ── tarjetas ── */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; }
/* 6 tarjetas: 6 en una fila, 3 + 3 o 2 + 2 + 2, nunca una sola abajo */
.kpis.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) { .kpis.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cols-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.cols-eq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) * 1.6); padding: 16px 18px;
  min-width: 0; position: relative;
}
.card h3 { margin: 0 0 12px; font: 600 11px var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.card h3 .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; font-family: var(--f-text); }
.kpi { display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }

.kpi.norte { border-color: var(--accent-line); }
.kpi .lbl { font: 500 12px var(--f-label); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .val { font: 400 clamp(22px, 1.7vw + 8px, 30px)/1.1 var(--f-display); color: var(--text-strong); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .val.na { color: var(--faint); }
.kpi .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-height: 20px; flex-wrap: wrap; }
.kpi .spark { margin-left: auto; opacity: .9; flex: none; }
.delta { font-size: 12px; font-weight: 500; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); } .delta.flat { color: var(--muted); }
/* Tarjetas de Resumen: 4 + 4 + 3 + 3 en compu, 2 por fila en tableta y celular. El tono sale de los colores de
   estado y acento de la marca (marca.css), mezclados con la superficie para que funcionen en claro y en oscuro. */
.tiles { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile {
  --tono: var(--accent); grid-column: span 3; min-width: 0; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px; border-radius: calc(var(--r) * 1.6);
  background: color-mix(in srgb, var(--tono) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tono) 26%, transparent);
}
.tile.w4 { grid-column: span 4; }
.tile.t-ok { --tono: var(--ok); } .tile.t-aviso { --tono: var(--warn); } .tile.t-malo { --tono: var(--bad); } .tile.t-acento { --tono: var(--accent); }
.tile .t-top { display: flex; align-items: center; gap: 8px; }
.tile .t-lbl { font: 500 12.5px var(--f-label); color: var(--text-2); display: flex; align-items: center; gap: 6px; min-width: 0; }
.tile .t-ico { margin-left: auto; flex: none; color: color-mix(in srgb, var(--tono) 80%, var(--text)); opacity: .9; }
.tile .t-val { font: 500 clamp(22px, 1.6vw + 9px, 30px)/1.15 var(--f-display); color: var(--text-strong); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile .t-val.na { color: var(--faint); }
.tile .t-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.destacada { border-color: color-mix(in srgb, var(--tono) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tono) 18%, transparent) inset; }
.tile.destacada .t-val { color: color-mix(in srgb, var(--tono) 70%, var(--text-strong)); }
h3.sec { margin: 0 0 10px; font: 600 11px var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
h3.sec .faint { text-transform: none; letter-spacing: 0; font-weight: 400; }
@media (max-width: 900px) { .tile, .tile.w4 { grid-column: span 6; } .tile.destacada, .tile:last-child { grid-column: span 12; } }
@media (max-width: 380px) { .tile, .tile.w4 { grid-column: span 12; } }
.info { cursor: pointer; color: var(--faint); display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1px solid currentColor; border-radius: 50%; font: 600 9px var(--f-text); }
.state { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.state.ok { background: var(--ok); } .state.aviso { background: var(--warn); } .state.malo { background: var(--bad); }

/* ── tablas ── */
.tbl-wrap { overflow: auto; margin: 0 -18px -16px; border-top: 1px solid var(--line-soft); max-height: 70vh; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
th:first-child, td:first-child { text-align: left; padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
td.l, th.l { text-align: left; }
td.l { white-space: normal; min-width: 240px; max-width: 460px; line-height: 1.35; }
td { font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--surface); z-index: 1; font: 600 11px var(--f-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
th.sorted { color: var(--text-strong); }
tbody tr:hover { background: var(--hl); }
tbody tr.click { cursor: pointer; }
td .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal;
  overflow-wrap: anywhere; vertical-align: bottom; }
td .sub { color: var(--faint); font-size: 12px; display: block; }
.thumb { width: 36px; height: 36px; border-radius: calc(var(--r) * .7); object-fit: cover; background: var(--sunken); vertical-align: middle; margin-right: 10px; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell i { display: block; height: 6px; border-radius: 3px; background: var(--accent); opacity: .75; }

/* ── gráficas ── */
.chart { width: 100%; height: 240px; display: block; }
.chart text { fill: var(--muted); font: 11px var(--f-text); }
.chart .grid line { stroke: var(--line-soft); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tip {
  position: fixed; pointer-events: none; z-index: 50; background: var(--surface-solid); border: 1px solid var(--line-strong);
  border-radius: var(--r); padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); min-width: 140px;
}
.tip b { display: block; color: var(--text-strong); margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .st { display: grid; grid-template-columns: minmax(64px, 112px) minmax(36px, 1fr) auto 44px; align-items: center; gap: 10px; }
.funnel .st > * { min-width: 0; }
.funnel .n { font-variant-numeric: tabular-nums; }
.funnel .track { background: var(--sunken); border-radius: var(--r); height: 26px; overflow: hidden; }
.funnel .st .b { height: 100%; border-radius: var(--r); background: var(--accent); opacity: .85; }
.funnel .n { text-align: right; color: var(--text-strong); font-weight: 500; }
.funnel .st:nth-child(n+3) .b { opacity: .7; }
.funnel .st:nth-child(n+5) .b { opacity: .55; }
.funnel .cv { color: var(--muted); font-size: 12px; text-align: right; }

/* ── login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.login .box { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) * 2); padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.login .logo { height: 34px; aspect-ratio: var(--logo-ratio); background: var(--logo) left center / contain no-repeat; }
.login h1 { margin: 6px 0 0; font: 400 28px/1.1 var(--f-display); text-transform: var(--display-case); color: var(--text-strong); }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login .or { text-align: center; color: var(--faint); font-size: 12px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ── modal ── */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal { width: min(620px, 100%); max-height: 86vh; overflow: auto; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: calc(var(--r) * 1.8); padding: 22px; }
.modal h2 { margin: 0 0 4px; font: 400 24px var(--f-display); color: var(--text-strong); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin-top: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
/* carga: el logo de la marca respira y las tarjetas se insinúan, sin saltos al llegar los datos */
.cargando { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 0 22px; font-size: 13px; }
.cargando.inicial { min-height: 100vh; justify-content: center; }
.logo.pulso { height: 34px; aspect-ratio: var(--logo-ratio); background: var(--logo) center / contain no-repeat;
  animation: pulso 1.6s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { opacity: .35; transform: scale(.97); } 50% { opacity: 1; transform: scale(1); } }
.esq { min-height: 118px; background: linear-gradient(100deg, var(--surface) 30%, var(--sunken) 50%, var(--surface) 70%);
  background-size: 300% 100%; animation: brillo 1.8s ease-in-out infinite; }
.esq.alto { min-height: 280px; margin-top: 14px; }
@keyframes brillo { from { background-position: 100% 0; } to { background-position: 0 0; } }
#root > * { animation: aparecer .18s ease-out; }
@keyframes aparecer { from { opacity: .4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .logo.pulso, .esq, #root > * { animation: none; } }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.syncbar { height: 2px; background: transparent; overflow: hidden; }
.syncbar.on::after { content: ''; display: block; height: 100%; width: 40%; background: var(--accent); animation: sync 1s ease-in-out infinite; }
@keyframes sync { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.mobilenav { display: none; }
@media (max-width: 900px) {
  .layout, .layout.collapsed { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 96px; }
  .cols-2, .cols-eq { grid-template-columns: 1fr; }
  .kpis, .kpis.n6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .val { font-size: 24px; }
  .kpi .spark { display: none; }
  .topbar .seg { order: 5; width: 100%; }
  .funnel .st { grid-template-columns: 90px 1fr 70px 44px; gap: 8px; }
  .mobilenav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto;
  }
  .mobilenav button { flex: 1; min-width: 64px; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; padding: 4px; }
  .mobilenav button.on { color: var(--text-strong); }
  .kv { grid-template-columns: 1fr; }
}

/* Ofertas */
.ofertas-g { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 14px; }
.oferta-card .of-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; }
.oferta-card .of-h h3 { margin: 0; }
.of-roas { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.of-roas b { font: 400 clamp(28px, 3vw, 40px)/1 var(--f-display); color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1; }
.of-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.of-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.of-grid .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.of-grid b { font-size: 18px; font-variant-numeric: tabular-nums; }
.of-grid .faint { font-size: 12px; }
table.of-dia tr.grupos th { text-align: center; border-bottom: 1px solid var(--line-soft); color: var(--text-2); }
table.of-dia tr.grupos th + th { border-left: 1px solid var(--line-soft); }
table.of-dia td:nth-child(6n+2) { border-left: 1px solid var(--line-soft); }

/* Clasificación de anuncios */
.cl-g { grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); margin-bottom: 14px; }
.cl-g > :last-child { grid-column: 1 / -1; }
.podio { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.podio li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.podio .pos { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.podio .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podio b { font-variant-numeric: tabular-nums; }
.podio .faint { grid-column: 2 / 4; font-size: 12px; }
.acierto { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.acierto b { font: 400 clamp(28px, 3vw, 40px)/1 var(--f-display); color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1; }
.cl-g .track { background: var(--sunken); border-radius: var(--r); height: 10px; overflow: hidden; }
.cl-g .track .b { height: 100%; background: var(--accent); }
@media (max-width: 720px) { .cl-g { grid-template-columns: 1fr; } .of-grid b { font-size: 16px; } }

/* ── Productos: embudo de la compra principal a bumps y upsells ── */
.fn { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 22px; align-items: start; }
.fn-grupo + .fn-grupo { margin-top: 14px; }
.fn-gt { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 0 10px 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.fn-gt b { font: 600 11px var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.fn-gt .faint { font-size: 12px; }
.fn-row {
  display: grid; grid-template-columns: minmax(110px, 1.1fr) minmax(80px, 2fr) 64px 84px; gap: 12px; align-items: center; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: var(--r); background: none; cursor: pointer; text-align: left;
}
.fn-row:hover { background: var(--hl); }
.fn-row.on { background: var(--accent-soft); border-color: var(--accent); }
.fn-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.fn-nom small { display: block; color: var(--muted); font-size: 11px; }
.fn-bar { position: relative; height: 12px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.fn-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); }
.fn-bar.sm { height: 8px; }
.fn-pct, .fn-usd { text-align: right; font-variant-numeric: tabular-nums; }
.fn-pct { font-weight: 600; color: var(--text-strong); }
.fn-usd { color: var(--text-2); }
.fn-det { border: 1px solid var(--line-soft); border-radius: var(--r); padding: 16px; position: sticky; top: 76px; }
.fn-det .of-h { margin-bottom: 12px; }
.fn-sub { border-top: 1px solid var(--line-soft); margin-top: 12px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fn-sub .lbl, .tk .lbl, .conc-res .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fn-li { display: grid; grid-template-columns: minmax(0, 1fr) 56px 84px; gap: 8px; font-variant-numeric: tabular-nums; }
.fn-li > span:not(:first-child) { text-align: right; }
.fn-li.faint { color: var(--muted); }
.fn-of { display: grid; grid-template-columns: minmax(0, 1fr) minmax(50px, 1fr) 48px 40px; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.fn-of > span:nth-child(n+3) { text-align: right; }
.fn-razon { margin: 2px 0 0; font-size: 12.5px; }
.tk { margin-top: 18px; padding: 14px 10px 0; border-top: 1px solid var(--line-soft); }
.tk-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.tk-h b { font: 400 22px/1 var(--f-display); color: var(--text-strong); }
.tk-bar { display: flex; gap: 2px; height: 18px; border-radius: 4px; overflow: hidden; }
.tk-bar > span { background: var(--accent); opacity: var(--o); min-width: 3px; }
.tk-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.tk-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); opacity: var(--o); margin-right: 6px; vertical-align: -1px; }
.tk-leyenda b { color: var(--text-strong); font-weight: 600; }
.conc-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); gap: 16px; margin-bottom: 14px; align-items: start; }
.conc-res > div:not(.conc-por) { display: flex; flex-direction: column; gap: 2px; }
.conc-res b { font: 400 22px/1.1 var(--f-display); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.conc-por p { margin: 0 0 4px; font-size: 13px; color: var(--text-2); }
@media (max-width: 1100px) { .conc-res { grid-template-columns: repeat(3, minmax(0, 1fr)); } .conc-por { grid-column: 1 / -1; } }
.kpis.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1240px) {
  .fn { grid-template-columns: 1fr; }
  .fn-det { position: static; }
}
@media (max-width: 900px) {
  .fn { grid-template-columns: 1fr; }
  .fn-det { position: static; }
  .fn-row { grid-template-columns: minmax(0, 1fr) 56px 76px; grid-template-areas: 'nom pct usd' 'bar bar bar'; row-gap: 6px; }
  .fn-nom { grid-area: nom; } .fn-row > .fn-bar { grid-area: bar; } .fn-pct { grid-area: pct; } .fn-usd { grid-area: usd; }
  .conc-res { grid-template-columns: 1fr 1fr; }
}
/* Manita en todo lo que responde al mouse: etapas del embudo (y lo que llevan dentro), pestañas y barras con detalle */
[data-etapa], [data-etapa] *, [data-nav], [data-sub], [data-filtro], [data-serie], [data-preset], [data-act], [data-tip] { cursor: pointer; }

/* Semanal */
.sem-wrap { margin: 0; border: 1px solid var(--line-soft); border-radius: 12px; max-height: none; }
table.sem { min-width: 720px; }
table.sem th small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; text-transform: none; letter-spacing: 0; }
table.sem .sem-kpi { position: sticky; left: 0; background: var(--card, var(--bg)); z-index: 1; white-space: nowrap; }
table.sem .sem-tot { background: color-mix(in srgb, var(--text) 4%, transparent); }
table.sem tr.sem-g th { font: 600 11px var(--f-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 14px; }
.sem-tr { display: inline-block; width: 12px; margin-left: 5px; font-size: 10px; font-style: normal; text-align: center; }
.sem-tr.ok { color: var(--ok); } .sem-tr.bad { color: var(--bad); }
@media (max-width: 760px) { table.sem { min-width: 0; } table.sem .sem-kpi { white-space: normal; min-width: 120px; } }
table.sem tbody th.sem-kpi { text-transform: none; letter-spacing: 0; font: 500 13px var(--f-text); color: var(--text); }

/* Galería de anuncios (pestaña Anuncios → Galería) */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ga-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.ga-img { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer; aspect-ratio: 4 / 5; background: var(--sunken); overflow: hidden; }
.ga-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
a.ga-img:hover img { transform: scale(1.03); }
.ga-vacio { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 12px; }
.ga-tipo { position: absolute; top: 8px; left: 8px; box-shadow: 0 1px 4px rgb(0 0 0 / .15); }
.ga-tipo.mute { background: var(--surface); }
.ga-play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(0 0 0 / .45); color: #fff; font-size: 17px; padding-left: 3px; pointer-events: none; }
.ga-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ga-nom { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-camp { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.ga-mets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.ga-m { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ga-m span { font-size: 11.5px; color: var(--muted); }
.ga-m b { font-size: 14px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-m b.na { color: var(--faint); font-weight: 400; }
.ga-txt summary { cursor: pointer; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ga-txt p { margin: 6px 0 0; font-size: 12.5px; white-space: pre-line; color: var(--text); max-height: 180px; overflow: auto; }
.ga-links { display: flex; gap: 12px; font-size: 12.5px; margin-top: auto; }
@media (max-width: 560px) { .galeria { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .ga-body { padding: 10px; } }

/* Ficha del anuncio: video a la izquierda, datos a la derecha */
.modal.ad-modal { width: min(1080px, 100%); max-height: 90vh; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); overflow: hidden; }
.ad-media { position: relative; background: #000; display: grid; place-items: center; min-height: 320px; max-height: 90vh; }
.ad-media img, .ad-media video { width: 100%; height: 100%; max-height: 90vh; object-fit: contain; display: block; }
.ad-cargando { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 12.5px; text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
.ad-info { padding: 22px; overflow: auto; max-height: 90vh; min-width: 0; }
.ad-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ad-info h2 { word-break: break-word; }
.ad-info .kv { grid-template-columns: 110px 1fr; }
.ad-mets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); }
.ad-sec { margin: 18px 0 8px; font: 600 11.5px var(--f-label); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-copy { white-space: pre-line; font-size: 13.5px; line-height: 1.5; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); max-height: 260px; overflow: auto; }
.ad-copiar { width: 100%; margin-top: 8px; }
@media (max-width: 760px) {
  .modal.ad-modal { grid-template-columns: 1fr; overflow: auto; max-height: 92vh; }
  .ad-media { max-height: 60vh; } .ad-media img, .ad-media video { max-height: 60vh; }
  .ad-info { max-height: none; overflow: visible; } .ad-mets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* CRM: ficha del comprador con su recorrido en línea de tiempo */
.crm-modal { width: min(760px, 100%); }
.crm-tl { list-style: none; margin: 8px 0 6px; padding: 0; display: grid; gap: 8px; }
.crm-tl li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.crm-tl .ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--muted); }
.crm-tl b { font-weight: 600; display: block; }
.crm-tl .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.crm-tl .t-nueva .ico, .crm-tl .t-upsell .ico, .crm-tl .t-bump .ico { color: var(--ok, #1a7f37); border-color: currentColor; }
.crm-tl .t-reembolso .ico { color: var(--bad, #c62828); border-color: currentColor; }
