:root {
  /* Identidad Media Mavens (mediamavens.cl): azul #0356b0 + gris #303030, fondo claro */
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-2: #f3f6fb;
  --border: #dde3ec;
  --text: #1b2433;
  --muted: #64748b;
  --brand: #0356b0;     /* azul Media Mavens */
  --brand-2: #2e8fe0;   /* azul claro para gradientes/acentos */
  --ink: #303030;       /* gris del wordmark */
  --accent: #f59e0b;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(3, 86, 176, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  background: radial-gradient(1100px 650px at 85% -10%, #dbe8f7 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ── Layout ─────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand small { color: var(--muted); font-weight: 500; }
/* Wordmark Media Mavens: "Media" gris + "Mavens" azul */
.brand-mark { font-weight: 800; font-size: 20px; letter-spacing: -0.4px; white-space: nowrap; }
.brand-mark .a { color: var(--ink); }
.brand-mark .b { color: var(--brand); }
.brand-logo { height: 30px; width: auto; display: block; }
.lp-foot .brand-logo { height: 26px; }
.topbar .right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar .btn.active-admin { background: var(--brand); color: #fff; border-color: var(--brand); }
.container { max-width: 1120px; margin: 0 auto; padding: 28px; }

/* ── Navegación de 3 ítems ────────────────── */
.tabs-nav { display: flex; gap: 6px; max-width: 1120px; margin: 0 auto; padding: 16px 28px 0;
  flex-wrap: wrap; }
.tabs-nav button { background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 11px 18px; border-radius: 11px; font-weight: 600; font-size: 14px; }
.tabs-nav button:hover { color: var(--text); }
.tabs-nav button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs-nav button { display: inline-flex; align-items: center; }
.tabs-nav .tab-ic { margin-right: 6px; font-size: 15px; line-height: 1; }
.tabs-nav .nav-badge { margin-left: 6px; }
.tab-short { display: none; }

.lang-sel { width: auto; padding: 7px 10px; font-size: 13px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 9px; color: var(--text); }

/* ── Landing + Auth ─────────────────────── */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 420px; gap: 48px;
  align-items: center; max-width: 1100px; margin: 0 auto; padding: 40px 28px; }
/* En móvil, el formulario (auth-card) sube ARRIBA del pitch para no nacer bajo el fold
   (el pitch es largo: badge + H1 + lead + 4 features + botones + trust-strip). */
@media (max-width: 880px) { .landing { grid-template-columns: 1fr; gap: 28px; } .landing .auth-card { order: -1; } }
.landing-pitch h1 { font-size: 40px; line-height: 1.1; margin: 18px 0 14px; }
@media (max-width: 880px) { .landing-pitch h1 { font-size: 30px; } }
.landing-pitch .lead { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0 0 22px; max-width: 520px; }
.landing-pitch .feat { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; }
.landing-pitch .feat li { font-size: 15px; color: var(--text); }
.landing-pitch .feat b { font-weight: 700; }
/* ── Página de inicio (landing pública) ─────────────────────── */
.lp { background: var(--bg); }
.lp-nav { max-width: 1100px; margin: 0 auto; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lp-links { display: flex; gap: 6px; }
.lp-links button { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.lp-links button:hover { color: var(--brand); background: var(--panel-2); }
@media (max-width: 720px) { .lp-links { display: none; } }

.lp-hero { min-height: auto !important; padding-top: 6px !important; padding-bottom: 56px !important; align-items: center; }
.lp-badge { display: inline-block; background: rgba(3,86,176,.10); color: var(--brand); font-weight: 700; font-size: 12px; padding: 5px 12px; border-radius: 20px; letter-spacing: .4px; margin-bottom: 4px; }

.lp-sec { max-width: 1100px; margin: 0 auto; padding: 60px 28px; }
.lp-sec-alt { max-width: none; background: var(--panel); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-sec-alt > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.lp-h2 { font-size: 28px; text-align: center; margin: 0 auto 8px; letter-spacing: -.5px; }
.lp-sub { text-align: center; color: var(--muted); max-width: 700px; margin: 0 auto 34px; line-height: 1.55; font-size: 15px; }

.lp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 880px) { .lp-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .lp-steps { grid-template-columns: 1fr; } }
.lp-step { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px 22px; position: relative; box-shadow: var(--shadow); }
.lp-step-n { position: absolute; top: -13px; left: 20px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.lp-step-ic { font-size: 26px; margin: 6px 0 10px; }
.lp-step h3 { margin: 0 0 6px; font-size: 16px; }
.lp-step p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.lp-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 880px) { .lp-feats { grid-template-columns: 1fr; } }
.lp-feat { display: flex; gap: 13px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.lp-feat-ic { font-size: 22px; flex: none; line-height: 1.2; }
.lp-feat h3 { margin: 0 0 4px; font-size: 15px; }
.lp-feat p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.lp-price { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 880px) { .lp-price { grid-template-columns: 1fr; } }
.lp-price-5 { grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1000px) { .lp-price-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .lp-price-5 { grid-template-columns: 1fr; } }
.lp-price-5 .price-card { padding: 22px 14px; }
.lp-price-5 .price-name { min-height: 34px; }
.lp-price-bul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 22px auto 0; color: var(--text); font-size: 13.5px; font-weight: 600; }
.lp-price-bul span { color: var(--muted); }
.price-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px 22px; text-align: center; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.price-card.hot { border: 2px solid var(--brand); transform: translateY(-6px); }
@media (max-width: 880px) { .price-card.hot { transform: none; } }
.price-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 20px; letter-spacing: .4px; white-space: nowrap; }
.price-name { color: var(--muted); font-weight: 700; font-size: 14px; }
.price-num { font-size: 50px; font-weight: 900; color: var(--brand); line-height: 1; margin: 12px 0 4px; letter-spacing: -1.5px; }
.price-num span { font-size: 24px; font-weight: 800; }
.price-when { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.price-feats { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; display: grid; gap: 9px; }
.price-feats li { font-size: 13.5px; color: var(--text); }
.price-cta { width: 100% !important; margin-top: auto !important; }
.lp-note { text-align: center; color: var(--muted); font-size: 13px; margin: 26px auto 0; max-width: 560px; }

.lp-cta { text-align: center; padding: 60px 28px; background: linear-gradient(135deg, rgba(3,86,176,.08), rgba(46,143,224,.10)); border-top: 1px solid var(--border); }
.lp-cta h2 { font-size: 24px; margin: 0 0 20px; letter-spacing: -.5px; }
.lp-cta .btn { display: inline-block; margin: 0 auto; }

/* ── Prueba social / FAQ / captura de leads (landing) ─────── */
.trust-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; color: var(--muted); font-size: 13px; font-weight: 600; }
.lp-faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px; box-shadow: var(--shadow); }
.faq-item summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--brand); font-size: 20px; font-weight: 800; }
.faq-item[open] summary::after { content: '−'; }
.faq-a { color: var(--muted); font-size: 14px; line-height: 1.55; padding: 0 0 14px; }
.lead-box { max-width: 420px; margin: 22px auto 0; }
.lead-form { display: flex; gap: 8px; }
.lead-form input { flex: 1; }

/* ── Medición y conversiones (GA4 / GTM) ──────────────────── */
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 560px) { .connect-grid { grid-template-columns: 1fr; } }
.connect-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--panel-2); }
.conv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; flex-wrap: wrap; }
.conv-row code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.link-ads { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 14px 16px; border: 1px dashed var(--brand); border-radius: 12px; background: rgba(3,86,176,.05); }

/* ── Medidor de optimización de campaña ───────────────────── */
.opt-bar { height: 9px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin: 10px 0 14px; }
.opt-fill { height: 100%; border-radius: 6px; transition: width .35s ease, background .35s ease; }
.opt-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
@media (max-width: 560px) { .opt-list { grid-template-columns: 1fr; } }
.opt-item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.opt-item > span { font-weight: 800; flex: none; }
.opt-item.ok > span { color: var(--green); }
.opt-item.warn > span { color: var(--accent); }

/* ── Descarga de la app (PWA Android/Apple) ───────────────── */
.lp-app-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.store-btn { display: inline-flex; align-items: center; gap: 12px; background: #111827; color: #fff; border: 0; border-radius: 14px; padding: 12px 22px; cursor: pointer; min-width: 220px; text-align: left; }
.store-btn:hover { filter: brightness(1.12); }
.store-ic { font-size: 30px; line-height: 1; }
.store-tx { display: flex; flex-direction: column; line-height: 1.2; }
.store-tx small { font-size: 11px; opacity: .8; }
.store-tx b { font-size: 18px; font-weight: 800; }
.install-os { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 6px; }
@media (max-width: 560px) { .install-os { grid-template-columns: 1fr; } }
.install-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--panel-2); }
.install-h { font-weight: 800; margin-bottom: 6px; }
.install-card ol { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; color: var(--text); }

.lp-foot { max-width: 1100px; margin: 0 auto; padding: 30px 28px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.lp-foot .muted { font-size: 13px; color: var(--muted); flex: 1; min-width: 220px; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 18px; padding: 32px; box-shadow: var(--shadow);
}
.auth-hero { text-align: center; margin-bottom: 22px; }
.auth-hero h1 { margin: 14px 0 6px; font-size: 24px; }
.auth-hero p { color: var(--muted); margin: 0; font-size: 14px; }
.tabs { display: flex; gap: 6px; background: var(--panel-2); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 8px; font-weight: 600; }
.tabs button.active { background: var(--brand); color: #fff; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--border);
  /* 16px: por debajo, iOS Safari hace zoom automático al enfocar y descoloca el
     layout (la app se usa mucho en celular). 16px lo evita. */
  border-radius: 10px; color: var(--text); font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 15px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); width: auto; padding: 8px 14px; margin: 0; }
.btn.small { width: auto; padding: 8px 14px; margin: 0; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards / grid ───────────────────────── */
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
/* Tablas de desglose: UNA por fila (ancho completo) — más legibles que de a dos. */
.cols-2.bd-pair { grid-template-columns: 1fr; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px) { .cols-2, .cols-4 { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.kpi .value small { font-size: 14px; color: var(--muted); font-weight: 600; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-size: 18px; }

/* ── Campaign list ──────────────────────── */
.camp { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); margin-bottom: 12px; }
.camp .meta { display: flex; flex-direction: column; gap: 4px; }
.camp .meta b { font-size: 15px; }
.camp .meta span { color: var(--muted); font-size: 13px; }
.camp .stats { display: flex; gap: 22px; text-align: right; }
.camp .stats div small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.camp .stats div b { font-size: 15px; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: .4px; }
.badge.active { background: rgba(27,196,125,.15); color: var(--green); }
.badge.paused { background: rgba(255,176,32,.15); color: var(--accent); }
.badge.failed { background: rgba(255,90,101,.15); color: var(--red); }
.badge.pending { background: rgba(148,160,184,.15); color: var(--muted); }
.badge.paid { background: rgba(27,196,125,.15); color: var(--green); }
.badge.muted { background: rgba(148,160,184,.10); color: var(--muted); }
.badge.new { background: rgba(59,130,246,.15); color: #3b82f6; }
.badge.rec { background: rgba(27,196,125,.13); color: var(--green); }

/* Segmentador (Todos / Nuevos / Recurrentes) */
.seg { display: inline-flex; background: rgba(148,160,184,.10); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-b { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg-b.active { background: var(--card, #fff); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Botón de acción destructiva (borrar) */
.btn.danger { background: var(--red, #ff5a65); color: #fff; border-color: transparent; }
.btn.danger:hover { filter: brightness(.94); }
.btn.del-btn:hover { color: var(--red, #ff5a65); border-color: var(--red, #ff5a65); }

/* Honeypot anti-bot: invisible para humanos, tentador para bots */
.hp-field { position: absolute !important; left: -9999px !important; top: -9999px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Contenedor con scroll horizontal para tablas anchas (móvil) */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.adm-bill { width: 100%; min-width: 640px; }
.adm-bill tfoot td { border-top: 2px solid var(--line, rgba(148,160,184,.25)); padding-top: 10px; }
.adm-bill tbody tr td { vertical-align: middle; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

/* ── Modal ──────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(5,7,12,.7); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 4px; }
.modal .close { float: right; background: transparent; border: 0; color: var(--muted); font-size: 22px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

/* ── Toast ──────────────────────────────── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--panel-2); border: 1px solid var(--border); padding: 13px 20px; border-radius: 12px;
  box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 99; font-size: 14px; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.spark { width: 100%; height: 60px; }
.muted { color: var(--muted); }
.flex { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.pill { background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 11px; font-size: 12px; color: var(--muted); }

/* ── Bot Mavi ────────────────────────────── */
.bot-launcher { position: fixed; bottom: 22px; right: 22px; z-index: 60;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0;
  padding: 13px 18px; border-radius: 30px; font-weight: 700; box-shadow: var(--shadow); font-size: 15px; }
.bot-launcher:hover { filter: brightness(1.08); }
.bot-panel { position: fixed; bottom: 80px; right: 22px; z-index: 61; width: 360px; max-width: 92vw;
  height: 480px; max-height: 70vh; display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.bot-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: var(--panel-2); }
.bot-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bot-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.bot-msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bot-msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bot-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.bot-input input { flex: 1; }
.bot-proposal { align-self: flex-start; max-width: 92%; background: var(--panel-2);
  border: 1px solid var(--brand); border-radius: 12px; padding: 12px 14px; font-size: 13px; }

/* ── Reporte profesional (estilo Looker Studio) ───────────── */
.report-head { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 18px; }
.report-head h2 { font-size: 20px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; }
.ra-period, .ra-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.range-tabs button { border: none; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.range-tabs button.active { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.camp-filter { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 12px; }
.camp-filter > span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.camp-filter select { width: auto; min-width: 150px; max-width: 240px; padding: 7px 10px; font-size: 13px; font-weight: 600; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); }
.date-range { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; }
.date-range.on { border-color: var(--brand); background: rgba(3, 86, 176, .06); }
.date-range .dr-ic { font-size: 14px; }
.date-range .dr-sep { color: var(--muted); font-size: 12px; }
.date-range input[type=date] { width: auto; padding: 6px 8px; font-size: 12.5px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font-family: inherit; }
.date-range .dr-clear { border: none; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.date-range .dr-clear:hover { color: var(--red); }

/* Panel de administración: KPIs del negocio */
.admin-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 6px; }
.akpi { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.akpi.hot { border-color: var(--brand); background: rgba(3, 86, 176, .07); }
.akpi-l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.akpi-v { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 2px; line-height: 1.1; }
.akpi-s { font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) { .admin-kpis { grid-template-columns: repeat(2, 1fr); } }

.scorecards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 1100px) { .scorecards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .scorecards { grid-template-columns: repeat(2, 1fr); } }
.scorecard { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.sc-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.sc-value { font-size: 22px; font-weight: 800; margin: 6px 0; letter-spacing: -.5px; line-height: 1.1; }
.trend { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 7px; display: inline-block; }
.trend.up { color: var(--green); background: rgba(22,163,74,.10); }
.trend.down { color: var(--red); background: rgba(220,38,38,.10); }
.trend.flat { color: var(--muted); background: var(--panel-2); }

.chart-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.chart-head b { font-size: 15px; }
.metric-tabs { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.metric-tabs button { border: 1px solid var(--border); background: var(--panel-2); padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.metric-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .ylab, svg.chart .xlab { fill: var(--muted); font-size: 11px; }

.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
svg.donut { width: 140px; height: 140px; flex: none; }
.donut-c1 { font-size: 17px; font-weight: 800; fill: var(--text); }
.donut-c2 { font-size: 10px; fill: var(--muted); }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 8px; }
.lg-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lg-item .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg-name { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-val { font-weight: 700; color: var(--text); white-space: nowrap; }

.hbars { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.hbar-track { height: 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; transition: width .4s ease; }

/* ── Paneles agrupados (Promoción / Efectividad / Rendimiento) ── */
.panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
@media (max-width: 960px) { .panels { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.panel-h { background: #1f2a44; color: #fff; font-weight: 800; letter-spacing: 1.4px; font-size: 14px; text-align: center; padding: 12px; }
/* Descripción bajo el header: SIN margen negativo (antes -4px la metía bajo la
   barra oscura y el texto salía ilegible) y con padding propio para que no quede
   pegada al borde. */
.panel-hint { font-size: 11px; color: var(--muted); font-weight: 600; text-align: center; padding: 9px 12px 0; line-height: 1.35; }
.panel-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 10px 8px; text-align: center; }
.pc { min-width: 0; }
.pc-val { font-size: 17px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; white-space: nowrap; }
.pc-label { font-size: 10.5px; color: var(--muted); margin: 3px 0 5px; }
.panel-chart { padding: 4px 12px 12px; }
svg.minibars { width: 100%; height: 70px; display: block; }
.delta { font-size: 11px; font-weight: 700; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }

/* ── Tablas de rendimiento (%Δ) y desgloses (mapa de calor) ──── */
/* table-layout:fixed + tabular-nums → columnas uniformes y números que se
   alinean dígito a dígito. Así TODAS las tablas quedan cuadradas entre sí. */
table.ht, table.bd { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; font-variant-numeric: tabular-nums; }
table.ht th, table.bd th { text-align: right; padding: 8px 6px; background: #f5f6f8; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.ht th:first-child, table.bd th:first-child { text-align: left; }
table.ht td, table.bd td { text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.ht td:first-child, table.bd td.bd-label { text-align: left; }
/* Ancho de la 1ª columna (segmento/campaña); las numéricas se reparten igual. */
table.bd th:first-child, table.bd td:first-child { width: 30%; }
table.ht th:first-child, table.ht td:first-child { width: 26%; }
/* Desgloses: más densos (7 columnas en media tarjeta) → fuente y padding menores. */
table.bd { font-size: 11px; }
table.bd th, table.bd td { padding: 6px 4px; }
table.bd th { font-size: 10px; }
.ht-val { font-weight: 700; }
table.ht .delta, table.bd .delta { display: block; margin-top: 1px; font-size: 10.5px; }
/* Rendimiento por campaña: encabezado fijo al hacer scroll vertical dentro de la tabla. */
.camp-perf-scroll thead th { position: sticky; top: 0; z-index: 2; }
.camp-perf-scroll .bd-total td { position: sticky; bottom: 0; background: var(--panel); z-index: 1; }
.bd-total td { font-weight: 800; border-top: 2px solid var(--border); background: var(--panel-2); }
/* Fila "Sin segmentar" (el resto hasta el total): atenuada, para leerse como
   complemento y no como un segmento más. */
.bd-rest td { color: var(--muted); font-style: italic; background: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(100,116,139,.05) 6px, rgba(100,116,139,.05) 12px); }
.bd-note { font-size: 11px; color: var(--muted); margin-top: 8px; }
/* Nota honesta: por qué los totales de cada tabla de segmento pueden no cuadrar. */
.bd-explainer { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a5f; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 12.5px; line-height: 1.55; }
.bd-explainer b { color: #0f2440; }
/* Resumen en lenguaje simple sobre cada tabla (para quien no lee tablas). */
.bd-summary { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.bd-summary b { color: var(--text); font-weight: 700; }
/* Hallazgo estratégico: destacado sobre la explicación. */
.bd-finding { color: var(--text); }
/* min-width:0 = clave: sin esto el ítem del grid/flex crece hasta la tabla
   (min-width:auto por defecto) y estira TODA la página en móvil en vez de
   dejar que la tabla scrollee dentro de su tarjeta. */
.bd-wrap { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
/* Tarjetas de desglose: misma altura (grid stretch) pero SIN filas vacías: la
   tabla queda compacta arriba y la nota se ancla al fondo de la tarjeta. */
.grid.cols-2 > .chart-card { display: flex; flex-direction: column; min-width: 0; }
.grid.cols-2 > .chart-card .bd-note { margin-top: auto; padding-top: 8px; }

/* ── Onboarding amigable (primera campaña con Mavi) ───────────────── */
.onb-hero { text-align: center; margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(3,86,176,.12), rgba(46,143,224,.10));
  border-color: var(--brand); }
.onb-hero-ic { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.onb-hero h2 { margin: 4px 0 6px; }
.onb-hero p { color: var(--muted); max-width: 560px; margin: 0 auto 14px; line-height: 1.5; }
.onb-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.onb-mavi { width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; }
.onb-mavi.big { width: 64px; height: 64px; font-size: 32px; margin: 0 auto 10px; }
.onb-bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin-bottom: 16px; }
.onb-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .3s ease; }
.onb-q { margin: 0 0 12px; font-size: 18px; }
.onb-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.onb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 6px 0; }
.onb-pick { position: relative; text-align: center; padding: 14px 10px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--panel); cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.onb-pick:hover { border-color: var(--accent); }
.onb-pick.on { border-color: var(--brand); background: rgba(3,86,176,.08); box-shadow: 0 0 0 3px rgba(3,86,176,.12); }
.onb-pick b { font-size: 16px; }
.onb-pick small { color: var(--muted); font-size: 12px; }
.onb-pick .onb-ic { font-size: 24px; }
.onb-pick.hot { border-color: var(--brand); }
.onb-flag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.onb-recap { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 14px 0; }
.onb-recap > div { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.onb-recap span { display: block; color: var(--muted); font-size: 12px; }
.onb-recap b { font-size: 15px; }
.onb-sub { font-weight: 700; margin: 14px 0 6px; }
.ad-preview { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--panel); }
.ad-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ad-tag { font-size: 11px; font-weight: 700; color: var(--text); }
.ad-url { font-size: 13px; color: var(--muted); }
.ad-title { color: #1a73e8; font-size: 19px; line-height: 1.3; margin: 2px 0 4px; }
.ad-desc { color: var(--text); font-size: 13.5px; line-height: 1.45; }
.ad-sitelinks { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.ad-sitelinks span { color: #1a73e8; font-size: 13px; }

/* Resumen en palabras de Mavi (dashboard) */
.mavi-summary { border-left: 3px solid var(--brand); background: linear-gradient(180deg, rgba(3,86,176,.05), transparent); margin-bottom: 16px; }

/* Grupos de anuncios (estructura estratégica) */
.onb-groups { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.onb-group { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.onb-group-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.onb-group-url { font-size: 12px; color: var(--muted); }
.onb-group-url a { color: #1a73e8; }
.ag-block { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; padding: 12px; margin-top: 10px; }
.ag-block textarea, .ag-block input { width: 100%; }

/* Paso 4: el plan de Mavi + el desglose del trabajo */
.onb-plan { background: linear-gradient(180deg, rgba(3,86,176,.06), transparent); }
.onb-work { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--panel-2); }
.onb-work > summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.onb-work-body { margin-top: 10px; }
.onb-wsec { margin-bottom: 12px; }
.onb-wsec > b { display: block; font-size: 13px; margin-bottom: 6px; }
.onb-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.neg { border-color: rgba(255,90,101,.4); color: var(--red); }

/* Editor de configuración de campaña: toggle de idiomas + chips de ubicaciones */
.chip-toggle { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-t { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chip-t.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip-edit { border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--panel); }
.chip-edit .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-edit input { border: 0; background: transparent; width: 100%; padding: 4px 2px; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; margin-left: 4px; opacity: .7; padding: 0; }
.chip-x:hover { opacity: 1; }

/* Resultado de "Mavi lee tu sitio" en el paso 1 del wizard */
.onb-scan-result { font-size: 13px; line-height: 1.5; color: var(--muted); }
.onb-scan-result.on { margin-top: 8px; background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }

.onb-launch { display: flex; gap: 10px; margin-top: 16px; }
.onb-launch .btn { flex: 1; }
.onb-loading { text-align: center; padding: 24px 10px; }
.onb-loading h2 { margin: 6px 0; }
.onb-spinner { width: 34px; height: 34px; margin: 16px auto 0; border-radius: 50%;
  border: 3px solid var(--panel-2); border-top-color: var(--brand); animation: onb-spin .8s linear infinite; }
@keyframes onb-spin { to { transform: rotate(360deg); } }

/* ── Glosario: términos con explicación (hover + clic/tap) ────────── */
.gloss { cursor: help; border-bottom: 1px dashed currentColor; outline: none; }
.gloss:hover, .gloss:focus { color: var(--brand); }
.gloss-q::after {
  content: '?'; display: inline-grid; place-items: center;
  width: 13px; height: 13px; margin-left: 4px; border-radius: 50%;
  background: var(--panel-2); color: var(--muted);
  font-size: 9px; font-weight: 800; line-height: 1;
  vertical-align: middle; text-transform: none;
}
.gloss-q:hover::after, .gloss-q:focus::after { background: var(--brand); color: #fff; }
.gloss-tip {
  position: fixed; z-index: 10000; max-width: 250px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(3px); pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  text-transform: none; letter-spacing: normal; font-weight: 400;
}
.gloss-tip.on { opacity: 1; transform: translateY(0); }
.gloss-tip b { display: block; color: var(--brand); margin-bottom: 2px; font-size: 13px; }
.gl-list { display: grid; gap: 6px; margin-top: 10px; }
.gl-row { padding: 11px 13px; border-radius: 10px; background: var(--panel-2); }
.gl-row b { display: block; color: var(--brand); margin-bottom: 2px; font-size: 14px; }
.gl-row span { font-size: 13px; color: var(--text); line-height: 1.45; }

/* ── Bandeja de contactos (leads) ─────────────────────────────── */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; margin-left: 4px; vertical-align: middle; }
/* ── Cerebro de Mavi (memoria + acciones para ganancias) ──────── */
.brain-card { background: linear-gradient(135deg, rgba(139,92,246,.09), rgba(3,86,176,.06)); border-color: #8b5cf6; }
.brain-list { display: grid; gap: 6px; margin-top: 12px; }
.brain-li { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; line-height: 1.4; }
.brain-acts { display: grid; gap: 10px; }
.brain-act { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.brain-act-h { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.imp { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.imp-alto { background: rgba(22,163,74,.14); color: var(--green); }
.imp-medio { background: rgba(245,158,11,.16); color: #b45309; }
.imp-bajo { background: var(--panel-2); color: var(--muted); }
.brain-auto { font-size: 11px; font-weight: 700; color: #6d28d9; background: rgba(139,92,246,.12); padding: 3px 9px; border-radius: 7px; }
.brain-manual { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2); padding: 3px 9px; border-radius: 7px; }
.brain-done { font-size: 12px; font-weight: 800; color: var(--green); }
.auto-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 99px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: #8b5cf6; border-color: #8b5cf6; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.lead-sale { font-size: 12px; font-weight: 800; color: var(--green); background: rgba(22,163,74,.12); padding: 3px 9px; border-radius: 7px; border: 0; cursor: pointer; font-family: inherit; }
.lead-sale:hover { background: rgba(22,163,74,.22); }
.brain-act-f { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.brain-act-f .btn { margin-left: auto; }
.step-list { margin: 14px 0 0; padding-left: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
.step-list li { position: relative; padding: 10px 12px 10px 44px; background: var(--panel-2); border-radius: 10px; line-height: 1.45; counter-increment: st; }
.step-list li::before { content: counter(st); position: absolute; left: 12px; top: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; }

.lead-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.lead-tools #lead-search { flex: 1; min-width: 180px; }
.lead-tools select { width: auto; }
.lead-tools #lead-csv { margin-left: auto; }
.lead-row { display: flex; gap: 12px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.lead-row:last-child { border-bottom: 0; }
.lead-ch { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 17px; }
.lead-main { flex: 1; min-width: 0; }
.lead-main > div { overflow: hidden; text-overflow: ellipsis; }
.lead-act { display: flex; align-items: center; gap: 6px; flex: none; }
.lead-act .btn { padding: 5px 9px; }
.lead-status { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); font-weight: 700; font-size: 12px; cursor: pointer; }
.lead-status.st-new { color: var(--brand); border-color: var(--brand); background: rgba(3,86,176,.08); }
.lead-status.st-contacted { color: #b45309; border-color: #f59e0b; background: rgba(245,158,11,.08); }
.lead-status.st-won { color: var(--green); border-color: var(--green); background: rgba(22,163,74,.08); }
.lead-status.st-lost { color: var(--muted); }
.snippet { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; margin: 0 0 8px; }
.snippet code { white-space: pre; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.copyrow { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.copyrow code { background: var(--panel-2); padding: 6px 9px; border-radius: 7px; font-size: 12px; word-break: break-all; }
.lead-stats { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 640px) { .lead-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .lead-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .lead-row { flex-wrap: wrap; }
  .lead-act { width: 100%; justify-content: flex-end; }
  /* Áreas de toque cómodas en móvil (la bandeja se usa sobre todo en celular). */
  .lead-act .btn, .lead-status { min-height: 42px; }
}

/* ══ MÓVIL: la app es una PWA, se usa sobre todo en el celular ══════════ */
@media (max-width: 640px) {
  .container { padding: 14px; }

  /* Top bar compacto — no debe desbordar */
  .topbar { padding: 10px 14px; }
  .topbar .brand small { display: none; }
  .brand-logo { height: 24px; }
  .topbar .right { gap: 7px; font-size: 12px; }
  .topbar .right .btn { padding: 7px 10px; font-size: 12px; }
  .lang-sel { padding: 6px 7px; font-size: 12px; }

  /* Pestañas: scroll horizontal en vez de amontonarse en 2-3 filas */
  .tabs-nav { padding: 12px 14px 0; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tabs-nav button { flex: 0 0 auto; padding: 9px 13px; font-size: 13px; white-space: nowrap; }
  .tabs-nav .tab-full { display: none; }
  .tabs-nav .tab-short { display: inline; }
  .tabs-nav .tab-ic { font-size: 16px; margin-right: 5px; }

  /* Cabecera del reporte + acciones, apiladas y a lo ancho */
  .report-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .report-head h2 { font-size: 18px; }
  .report-actions { width: 100%; gap: 6px; }
  /* min-width:0 en toda la cadena flex: sin esto los inputs de fecha (min-width
     intrínseco) hacen que .ra-period exceda su flex-basis y desborde 4-18px. */
  .camp-filter { flex: 1 1 100%; min-width: 0; }
  .camp-filter select { min-width: 0; max-width: none; width: 100%; }
  .date-range { flex: 1 1 100%; min-width: 0; }
  .date-range input[type=date] { flex: 1; min-width: 0; font-size: 16px; } /* 16px: evita el auto-zoom de iOS al enfocar */
  .range-tabs { flex: 1 1 100%; min-width: 0; justify-content: center; }
  /* min-width fuerza un reparto equilibrado de los 7 botones (4+3) al hacer wrap,
     en vez de dejar "Mes pasado" solo y estirado en una fila aparte. */
  .range-tabs button { flex: 1 1 auto; min-width: 74px; }
  .ra-period, .ra-tools { flex: 1 1 100%; gap: 6px; min-width: 0; }
  .ra-tools .btn { flex: 1 1 auto; }

  /* Métricas: que los números QUEPAN en las 3 columnas del panel */
  .panel-cards { padding: 14px 8px 8px; gap: 4px; }
  .pc-val { font-size: 15px; }
  .pc-label { font-size: 9.5px; }
  .panel-h { font-size: 13px; letter-spacing: 1px; padding: 11px; }

  /* Cards y KPIs con menos padding en pantalla chica */
  .card { padding: 16px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 22px; }

  /* Desgloses que venían de a PARES → una tabla por fila en móvil (de a dos
     quedan de ~180px e ilegibles). */
  .cols-2.bd-pair { grid-template-columns: 1fr; }

  /* Tablas de desglose: mantener ancho legible y DESLIZAR en vez de aplastar
     las columnas (sus contenedores ya tienen overflow-x:auto). */
  table.ht, table.bd { min-width: 540px; table-layout: auto; }
  .bd-wrap { -webkit-overflow-scrolling: touch; }

  /* Botón flotante de Mavi sin tapar contenido */
  .bot-launcher { bottom: 14px; right: 14px; }

  /* Detalle de campaña (modal): ajustado y sin desbordes en móvil */
  .modal { padding: 18px 15px; }
  .modal-bg { padding: 8px; }
  .modal input, .modal select, .modal textarea { max-width: 100%; }
  .ag-block { padding: 10px; }
  .onb-group-h { gap: 4px; }
  /* Paso 4 del wizard es largo en móvil → el botón "Lanzar" queda SIEMPRE alcanzable,
     pegado al fondo del modal (que es el contenedor con scroll), sin scrollear todo. */
  .onb-launch {
    position: sticky;
    bottom: -18px;                /* pega al borde inferior del modal (padding-bottom 18px) */
    margin: 14px -15px -18px;     /* full-bleed horizontal + cancela el padding inferior */
    padding: 12px 15px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 18px -10px rgba(0,0,0,.35);
    z-index: 5;
  }
  /* Chips de config/idiomas más chicos para no amontonar */
  .chip-t { padding: 6px 10px; font-size: 12.5px; }
  /* KPIs del detalle (4 col) → 2 col en móvil */
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  /* Áreas de toque cómodas (≥40px) para no fallar el tap en botones densos */
  .btn.small, .range-tabs button, .metric-tabs button { min-height: 40px; }
  /* Tablas nuevas de admin: deslizan en vez de aplastarse en pantalla chica */
  .tbl-scroll table.adm-bill, #adm-payment-profiles table, #adm-ai-clients table { min-width: 460px; }
  /* Botones de descarga (landing): a lo ancho y apilados */
  .store-btn { min-width: 0; width: 100%; justify-content: center; }
  .lp-app-row { flex-direction: column; align-items: stretch; }
}
@media (max-width: 384px) {
  .pc-val { font-size: 13px; }
  .ra-tools .btn { font-size: 11px; padding: 7px 8px; }
  .grid.cols-4 { grid-template-columns: 1fr; }
}
