:root, [data-theme="dark"] {
  /* Paleta Scale Ads · modo oscuro */
  --bg: #051F20;
  --panel: #0B2B26;
  --panel-2: #163832;
  --panel-3: #1D433B;
  --side: rgba(7, 36, 33, .78);
  --line: rgba(142, 182, 155, .15);
  --line-2: rgba(142, 182, 155, .28);
  --text: #EAF6EC;
  --muted: #94BBA1;
  --brand: #8EB69B;
  --brand-ink: #051F20;
  --brand-2: #A9D3B6;
  --brand-soft: rgba(142, 182, 155, .14);
  --input: #072623;
  --overlay: rgba(2, 14, 13, .62);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.28);
  --shadow-lg: 0 24px 70px rgba(0,0,0,.5);
  --silver: #C9DCCF;
  --good: #7FD49B; --good-bg: rgba(127, 212, 155, .14);
  --warn: #FFB340; --warn-bg: rgba(255, 179, 64, .14);
  --bad: #FF6961;  --bad-bg: rgba(255, 105, 97, .14);
  --info: #7CC4FF; --info-bg: rgba(124, 196, 255, .14);
  --chart-spend: #2C5A4E; --chart-rev: #8EB69B; --chart-roas: #EAF6EC;
  --radius: 16px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F3F8F4;
  --panel: #FFFFFF;
  --panel-2: #EEF6F0;
  --panel-3: #E3F0E6;
  --side: rgba(255, 255, 255, .78);
  --line: rgba(5, 31, 32, .09);
  --line-2: rgba(5, 31, 32, .17);
  --text: #051F20;
  --muted: #4E6B60;
  --brand: #235347;
  --brand-ink: #FFFFFF;
  --brand-2: #235347;
  --brand-soft: #DAF1DE;
  --input: #F7FBF8;
  --overlay: rgba(5, 31, 32, .35);
  --shadow: 0 1px 2px rgba(5,31,32,.05), 0 8px 24px rgba(5,31,32,.06);
  --shadow-lg: 0 24px 70px rgba(5,31,32,.18);
  --silver: #235347;
  --good: #1E7F4E; --good-bg: rgba(30, 127, 78, .10);
  --warn: #B25000; --warn-bg: rgba(255, 149, 0, .13);
  --bad: #D70015;  --bad-bg: rgba(215, 0, 21, .08);
  --info: #0060DF; --info-bg: rgba(0, 96, 223, .08);
  --chart-spend: #B9D7C2; --chart-rev: #235347; --chart-roas: #051F20;
  color-scheme: light;
}
:root { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Inter, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
body { transition: background .3s, color .3s; overflow-x: hidden; }
h1, .kpi .v, .step .t { font-weight: 650; }
h1 { letter-spacing: -.025em; }
.hl { color: var(--brand-2); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 28px; margin: 0; letter-spacing: -.025em; line-height: 1.15; overflow-wrap: anywhere; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; } }

/* Layout */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); backdrop-filter: saturate(1.6) blur(22px); -webkit-backdrop-filter: saturate(1.6) blur(22px); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--text); }
.logo .lg { display: inline-flex; flex: none; width: 40px; height: 28px; }
.logo .lg img { width: 100%; height: 100%; object-fit: contain; }
.lg-l { display: none; } [data-theme="light"] .lg-d { display: none; } [data-theme="light"] .lg-l { display: block; }
.logo .wm { display: flex; align-items: flex-end; gap: 4px; line-height: 1; }
.logo .wm { font-family: Montserrat, var(--sans, sans-serif); font-weight: 900; font-size: 21px; letter-spacing: -.03em; gap: 6px; }
.logo .wm b { font-weight: 900; } .logo .wm em { font-style: normal; color: var(--brand-2); }

.logo .tag { display: block; font-size: 10px; color: var(--brand-2); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.side .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; min-width: 0; }
.nav a > span:not(.ico):not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.nav a.active .badge { background: rgba(255,255,255,.28); color: inherit; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.badge { margin-left: auto; background: var(--brand-soft); color: var(--text); font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 700; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.main { padding: 30px 36px 70px; min-width: 0; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Cards */
.card { background: var(--panel); border: 0.5px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.card.tight { padding: 14px; }
.kpi { min-width: 0; }
.kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; white-space: nowrap; overflow: hidden; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.kpi .s { font-size: 12px; margin-top: 4px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* Forms */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0.5px solid var(--line-2); background: var(--panel-2); color: var(--text); padding: 8px 15px; border-radius: 999px; cursor: pointer; font-weight: 550; white-space: nowrap; max-width: 100%; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--panel-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); background: var(--brand); }
.btn.good { background: var(--good-bg); border-color: transparent; color: var(--good); }
.btn.danger { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field { min-width: 0; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.field .hint { font-size: 11px; color: var(--muted); }
input, select, textarea { background: var(--input); border: 0.5px solid var(--line-2); border-radius: 10px; padding: 9px 12px; outline: none; width: 100%; min-width: 0; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; }

/* Tables */
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 550; padding: 10px; border-bottom: 0.5px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 0.5px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; padding: 3px 9px; border-radius: 99px; background: var(--panel-2); color: var(--text); border: 0; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.st-ganador { background: var(--brand); color: var(--brand-ink); }
.st-perdedor { background: var(--bad-bg); color: var(--bad); }
.st-testeando { background: var(--brand-soft); color: var(--text); }
.st-nuevo { color: var(--muted); }
.st-ACTIVE { background: var(--good-bg); color: var(--good); }
.st-PAUSED { background: var(--warn-bg); color: var(--warn); }
.st-ERROR { background: var(--bad-bg); color: var(--bad); }

/* Creatives */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.creative { background: var(--panel); border: 0.5px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.creative.selectable { cursor: pointer; }
.creative.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.creative .thumb { aspect-ratio: 4/5; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.creative .thumb img, .creative .thumb video { width: 100%; height: 100%; object-fit: cover; }
.creative .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.creative .name { font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creative .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 11px; color: var(--muted); }
.creative .stats b { display: block; color: var(--text); font-size: 13px; }
.creative .type { position: absolute; top: 8px; left: 8px; }
.creative .check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.55); border: 2px solid #fff; display: grid; place-items: center; font-size: 13px; }
.creative.selected .check { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.creative .stats > div { min-width: 0; } .creative .stats b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--brand); color: var(--text); background: var(--brand-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 99px; border: 0.5px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* Strategy ladder */
.ladder { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.step { min-width: 170px; flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; border-top: 3px solid var(--c, var(--brand)); cursor: pointer; }
.step.on { background: var(--panel-2); box-shadow: 0 0 0 1px var(--c); }
.step .n { font-size: 11px; color: var(--muted); }
.step .t { font-weight: 700; margin: 2px 0 6px; }
.arrow { align-self: center; color: var(--muted); }

/* Recommendations */
.rec { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 0.5px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.rec > div { min-width: 0; }
.rec + .rec { margin-top: 10px; }
.rec .icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex-shrink: 0; background: var(--panel-2); }
.rec .t { font-weight: 700; }
.rec .d { color: var(--muted); margin-top: 4px; line-height: 1.45; }
.prio-1 { border-left: 3px solid var(--bad); }
.prio-2 { border-left: 3px solid var(--warn); }
.prio-3 { border-left: 3px solid var(--muted); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 15% -10%, rgba(69,155,125,.22), transparent), radial-gradient(700px 400px at 110% 110%, rgba(69,155,125,.12), transparent); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 10px; margin: 18px 0; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

/* Misc */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel); color: var(--text); border: 0.5px solid var(--line-2); box-shadow: var(--shadow-lg); overflow-wrap: anywhere; padding: 12px 16px; border-radius: 12px; z-index: 50; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--bad); }
.toast.ok { border-color: var(--good); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); border: 0; line-height: 1.5; overflow-wrap: anywhere; }
.notice.warn { background: var(--warn-bg); }
.chart { width: 100%; height: 220px; }
.bar-pos { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar-pos > div { height: 100%; background: var(--good); }
.brand-card { cursor: pointer; transition: .15s; }
.brand-card:hover { border-color: var(--brand); }
.modal-bg { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: var(--panel); color: var(--text); border: 0.5px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); overflow-wrap: anywhere; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.thumb-sm { width: 40px; height: 50px; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; }
code { background: var(--panel-2); overflow-wrap: anywhere; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
details summary { cursor: pointer; }

/* Detalles de marca */
.card.accent { box-shadow: inset 0 3px 0 var(--brand), var(--shadow); }

.page-head h1 .hl { font-weight: 900; }
.brand-foot { font-size: 11px; color: var(--muted); text-align: center; padding: 14px 0 0; letter-spacing: .06em; }
.brand-foot b { color: var(--brand-2); }

.good-bg { background: var(--good) !important; } .warn-bg { background: var(--warn) !important; } .bad-bg { background: var(--bad) !important; }

.ok { color: var(--brand-2); } .ok-bg { background: var(--brand-2) !important; }
.zones { display: flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); min-height: 58px; }
.zone { padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 92px; font-size: 11.5px; }
.zone b { font-size: 12.5px; }
.zone span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone.good { background: var(--good-bg); color: var(--good); }
.zone.ok { background: var(--brand-soft); color: var(--text); }
.zone.warn { background: var(--warn-bg); color: var(--warn); }
.zone.bad { background: var(--bad-bg); color: var(--bad); flex: 1; }

/* Constructor de estrategias */
.scols { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .scols { grid-template-columns: 1fr; } }
.label-s { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 2px 6px; }
.label-s:first-child { margin-top: 0; }
.scard { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--brand)); border-radius: 10px; padding: 10px 12px; cursor: pointer; margin-bottom: 8px; }
.scard:hover { border-color: var(--line-2); border-left-color: var(--c); }
.scard.on { background: var(--panel-2); box-shadow: 0 0 0 1px var(--c); }
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.sgrid .scard { margin: 0; }
.dot-l { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sdiag { display: grid; grid-template-columns: minmax(200px, 260px) 24px 1fr; gap: 10px; align-items: center; }
.sdiag .snext { grid-column: 3; font-size: 12px; color: var(--muted); }
.sarrow { color: var(--muted); text-align: center; font-size: 18px; }
.sgroups { display: flex; flex-direction: column; gap: 8px; }
.sbox { border: 0.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--panel-2); min-width: 0; }
.sbox.budget { border-color: var(--brand); background: var(--brand-soft); }
.sb-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sb-l { font-size: 12px; color: var(--text); opacity: .85; margin-top: 3px; }
.sb-count { background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.sq-row { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 4px; }
.sq-row i { width: 9px; height: 9px; border-radius: 2px; background: var(--silver); opacity: .55; display: inline-block; }
.sq-row em { font-size: 10px; color: var(--muted); font-style: normal; }
.gcard { border: 0.5px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--panel-2); min-width: 0; }
.sub-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-2); margin: 16px 0 8px; }
.thumb-xs { width: 30px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
tr.camp-row td { background: var(--brand-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chips a { cursor: pointer; margin-left: 4px; }
.isearch { position: relative; }
.ires { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow: auto; }
.ires:empty { display: none; }
.iopt { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.iopt:hover { background: var(--brand-soft); }

/* Conexiones */
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.st3 { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.st3 > span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--panel-2); border: 1px solid var(--line); flex-shrink: 0; }
.st3.cur { border-color: var(--brand); }
.st3.cur > span { border-color: var(--brand); color: var(--brand-2); }
.st3.done > span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-size: 0; }
.st3.done > span::after { content: '✓'; font-size: 14px; }
.fb-btn { justify-content: center; background: #1877f2 !important; border-color: #1877f2 !important; color: #fff !important; font-size: 15px; padding: 12px 16px; }
.fb-f { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #1877f2; display: grid; place-items: center; font-weight: 900; font-family: Arial, sans-serif; }
.claude-btn { width: 100%; justify-content: center; margin-top: 10px; border-color: rgba(217, 119, 87, .45); color: #C4643F; background: rgba(217, 119, 87, .10); }
[data-theme="dark"] .claude-btn { color: #f0b49c; }
.claude-btn.on, .claude-btn:hover { background: rgba(217, 119, 87, .16); }
.steps-ol { margin: 0; padding-left: 20px; line-height: 1.9; }
.ex-ul { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--text); }
.tool-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tool-row code { color: var(--brand-2); }

/* Guía de conexión */
.gtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.gtab { border: 1px solid var(--line); background: var(--panel-2); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; }
.gtab.on { border-color: var(--brand); background: var(--brand-soft); }
.glist { list-style: none; padding: 0; margin: 0 0 10px; counter-reset: g; }
.glist li { counter-increment: g; border: 0.5px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--panel-2); }
.glist li.done { border-color: var(--brand); background: var(--brand-soft); }
.glist li.done span { opacity: .7; }
.gchk { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; cursor: pointer; line-height: 1.5; }
.gchk input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; flex-shrink: 0; }
.gchk span::before { content: counter(g) ". "; color: var(--brand-2); font-weight: 800; }
.gh { margin: 14px 0 8px; font-size: 13px; color: var(--brand-2); }
.guide a { color: var(--brand-2); text-decoration: underline; }
.from-meta { position: absolute; bottom: auto; top: 36px; left: 8px; background: rgba(24,119,242,.85); color: #fff; }
.st-CREANDO { background: var(--info-bg); color: var(--info); }

/* Selector de fechas estilo Meta */
.dp { position: relative; }
.dp-btn { gap: 10px; }
.dp-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; grid-template-columns: 210px 1fr; background: var(--panel); border: 0.5px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(860px, 92vw); }
.dp-pop[hidden] { display: none; }
.dp-l { border-right: 1px solid var(--line); padding: 14px; max-height: 470px; overflow-y: auto; }
.dp-t { font-weight: 800; margin-bottom: 8px; }
.dp-r { display: flex; gap: 10px; align-items: center; padding: 7px 4px; cursor: pointer; border-radius: 8px; }
.dp-r:hover { background: var(--panel-2); }
.dp-r input { width: 16px; height: 16px; accent-color: var(--brand); }
.dp-c { padding: 14px 18px; }
.dp-nav { display: flex; margin-bottom: -28px; position: relative; z-index: 1; }
.dp-ms { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.dp-mh { text-align: center; font-weight: 800; text-transform: capitalize; margin: 4px 0 10px; }
.dp-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-g b { font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.dp-d { border: 0; background: transparent; padding: 7px 0; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.dp-d:hover { background: var(--panel-2); }
.dp-d.in { background: var(--brand-soft); }
.dp-d.edge { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.dp-d.fut { opacity: .3; cursor: default; }
.delta { font-weight: 700; margin-right: 4px; }
.delta.good { color: var(--good); } .delta.bad { color: var(--bad); }

/* Generador de textos */
.gen { display: flex; gap: 10px; align-items: flex-end; }
.copies { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.copt { border: 0.5px solid var(--line); border-radius: 14px; padding: 12px; background: var(--panel-2); min-width: 0; overflow-wrap: anywhere; }
.copt .ctext { white-space: pre-line; font-size: 13px; line-height: 1.45; margin-top: 4px; max-height: 190px; overflow: auto; }
@media (max-width: 700px) { .gen { flex-direction: column; align-items: stretch; } }

details.helper { border: 0.5px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details.helper > summary { cursor: pointer; list-style: none; }
details.helper > summary::before { content: '▸ '; color: var(--brand-2); }
details.helper[open] > summary::before { content: '▾ '; }

.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 16px; }
.card.gone { opacity: .72; }
.st-ELIMINADA, .st-ELIMINADO { color: var(--bad); background: var(--bad-bg); }
.danger-t { color: var(--bad); }

.sgrid4 { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:10px; }
.sgrid3 { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; }
@media (max-width: 900px) { .sgrid4, .sgrid3 { grid-template-columns:1fr 1fr; } }
.opt { display:flex; gap:10px; border:0.5px solid var(--line-2); border-radius:14px; padding:12px; cursor:pointer; background:var(--panel-2); min-width:0; overflow-wrap:anywhere; }
.opt input[type=radio] { width:18px; height:18px; flex:none; margin-top:3px; accent-color:var(--brand); }
.opt.on { border-color:var(--brand); background:var(--brand-soft); }
.src-sa { background:var(--brand-soft); color:var(--text); } .src-fb { background:var(--info-bg); color:var(--info); }
.dupbox { display:flex; gap:4px; align-items:center; border:1px dashed var(--brand); border-radius:999px; padding:3px 6px; }
.notice.good { background:var(--good-bg); color:var(--text); }
.rowbad td { background:var(--bad-bg); }
.sugg { border:0; background:var(--warn-bg); border-radius:14px; padding:12px 14px; overflow-wrap:anywhere; }
.sg { display:flex; gap:10px; border:0.5px solid var(--line); border-radius:12px; padding:8px; background:var(--panel); cursor:pointer; min-width:0; }
.sg img { width:64px; height:80px; object-fit:cover; border-radius:8px; flex:none; }
.filterbar { padding:14px 18px; }
.copt.sel { border-color:var(--brand); box-shadow:0 0 0 1px var(--brand) inset; }

.creative.clickable { cursor:pointer; }
.creative .uso { position:absolute; top:10px; right:10px; font-size:11px; z-index:2; }
.u-on { background:rgba(20,110,60,.88); color:#fff; } .u-off { background:rgba(0,0,0,.6); color:#fff; }
.modal.wide { max-width:780px; width:94vw; }
.na { color:var(--muted); font-size:12px; background:var(--panel-2); border-radius:6px; padding:2px 7px; white-space:nowrap; }
.obj { font-weight:600; } .obj-ventas { background:var(--brand-soft); color:var(--text); } .obj-trafico, .obj-perfil, .obj-interaccion { background:var(--info-bg); color:var(--info); }
.obj-alcance { background:var(--warn-bg); color:var(--warn); } .obj-whatsapp { background:var(--good-bg); color:var(--good); } .obj-leads { background:var(--info-bg); color:var(--info); }

select.need { outline:2px solid var(--warn); }

.ctable { font-size:13px; } .ctable td:first-child { min-width:190px; } .ctable td.num, .ctable th { white-space:nowrap; }
/* Ventana de copia pieza por pieza */
.cpy { margin-top: 6px; }
.cpy-g { margin: 12px 0 2px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.cpy-g:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.cpy-r { display: flex; gap: 10px; align-items: center; padding: 4px 0 4px 18px; font-size: 13.5px; color: var(--muted); }
.cpy-r .ic { width: 18px; text-align: center; }
.cpy-r.ok { color: var(--text); } .cpy-r.ok .ic { color: var(--good); }
.cpy-r.now { color: var(--text); font-weight: 600; } .cpy-r.err { color: var(--warn); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } } .spin { display: inline-block; animation: spin 1s linear infinite; }
.mvlist .opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0.5px solid var(--line-2); border-radius: 10px; margin-bottom: 6px; cursor: pointer; font-size: 14px; }
.mvlist .opt.sel { border-color: var(--brand); }
.mvlist .opt.off { opacity: .55; cursor: not-allowed; }
/* Notificaciones */
.ntf { display: flex; gap: 12px; background: var(--panel); border: 0.5px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; padding: 12px 14px; margin-bottom: 10px; position: relative; }
.ntf.unread::before { content: ''; position: absolute; left: -4px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.nt-ico { width: 36px; height: 36px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; }
.nt-up { background: var(--good-bg); color: var(--good); } .nt-down { background: var(--bad-bg); color: var(--bad); }
.nt-wait { background: var(--warn-bg); color: var(--warn); } .nt-chg { background: var(--brand-soft); color: var(--brand-2); }
.nt-flat { background: var(--panel-2); color: var(--muted); } .nt-fb { background: var(--info-bg); color: var(--info); }
.nt-t { font-size: 14.5px; font-weight: 600; }
.nt-v { font-weight: 700; } .nt-v.up { color: var(--good); } .nt-v.down { color: var(--bad); } .nt-v.flat, .nt-v.nodata { color: var(--muted); } .nt-v.wait { color: var(--warn); }
.nt-k { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.nt-k .kpi { padding: 8px 10px; } .nt-k .v.sm { font-size: 14px; }
.nt-adv { margin-top: 8px; font-size: 13px; background: var(--brand-soft); border-radius: 8px; padding: 7px 10px; }
/* Lanzador: conjuntos con sus creativos */
.seg { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 2px; font-size: 13px; max-width: 100%; flex-wrap: wrap; }
.seg span { padding: 6px 12px; cursor: pointer; color: var(--muted); border-radius: 8px; }
.seg span.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.gbox { border: 0.5px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; background: var(--panel-2); min-width: 0; }
.grow { display: flex; flex-wrap: wrap; gap: 10px; }
.gth { width: 104px; font-size: 12px; }
.gimg { width: 104px; height: 128px; border-radius: 12px; overflow: hidden; position: relative; background: var(--panel-3); cursor: pointer; border: 1px solid var(--line); }
.gimg img, .gimg video { width: 100%; height: 100%; object-fit: cover; }
.gtype { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.6); border-radius: 6px; padding: 1px 5px; }
.gx { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; font-size: 14px; cursor: pointer; text-decoration: none; }
.gx:hover { background: var(--bad); }
.gnm { margin-top: 5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gmt { font-size: 11px; color: var(--muted); }
.gadd { width: 104px; height: 128px; border-radius: 12px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font: inherit; font-size: 12.5px; }
.gadd span { font-size: 22px; color: var(--brand-2); }
.gadd:hover { border-color: var(--brand); color: var(--text); }
.setrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.setrow:first-child { border-top: 0; }
.pill.rl-test { background: var(--info-bg); color: var(--info); }
.creative.cdis { opacity: .45; cursor: not-allowed; }
.cinfo { display: inline-block; margin-top: 6px; color: var(--brand-2); cursor: pointer; }
.modal.picker { width: min(1100px, 94vw); max-width: 1100px; max-height: 90vh; overflow: auto; }
.pkfoot { position: sticky; bottom: -18px; background: var(--panel); padding: 12px 0 4px; border-top: 1px solid var(--line); }
.pkgrid .creative .pill.uso { right: 40px; }

/* ===== Textos dentro de sus tarjetas (en todos los tamaños) ===== */
.card > *, .gbox > *, .gcard > *, .sbox > *, .kpi > *, .ntf > * { min-width: 0; }
.grid > *, .row > *, .sgrid > *, .sgrid3 > *, .sgrid4 > *, .kgrid > *, .cgrid > *, .copies > *, .nt-k > * { min-width: 0; }
.page-head > div:first-child { min-width: 0; max-width: 100%; }
.page-head p, .muted, .small, .hint { overflow-wrap: anywhere; }
.page-head .row.wrap { max-width: 100%; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
td { overflow-wrap: anywhere; }
td.num, td .pill, td .btn { overflow-wrap: normal; }
.scard b, .rec .t, .nt-t, .gnm, .creative .name { overflow-wrap: anywhere; }
img, video, svg, canvas { max-width: 100%; }

/* ===== Interruptor de modo claro / oscuro ===== */
.theme-sw { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 3px; gap: 2px; margin-top: 10px; }
.theme-sw button { border: 0; background: transparent; color: var(--muted); width: 34px; height: 26px; border-radius: 999px; cursor: pointer; font-size: 13px; display: grid; place-items: center; }
.theme-sw button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.side-foot .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Celular y tablet: menú como cajón ===== */
.mtop { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg); background: var(--panel); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: var(--overlay); z-index: 55; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 50; padding: 10px 14px; background: var(--side); backdrop-filter: saturate(1.6) blur(22px); -webkit-backdrop-filter: saturate(1.6) blur(22px); border-bottom: 0.5px solid var(--line); }
  .mtop button { border: 0; background: var(--panel-2); color: var(--text); width: 38px; height: 34px; border-radius: 10px; font-size: 18px; cursor: pointer; }
  .mtop .logo { padding: 0; } .mtop .logo .wm { font-size: 18px; }
  .main { padding: 18px 14px 60px; }
  h1 { font-size: 23px; }
  .page-head { gap: 10px; }
  .card { padding: 16px; }
  .kpi .v { font-size: 22px; }
  .dp-pop { grid-template-columns: 1fr; width: min(560px, 94vw); right: auto; left: 0; }
  .dp-l { border-right: 0; border-bottom: 0.5px solid var(--line); max-height: 200px; }
  .dp-ms { grid-template-columns: 1fr; }
  .steps3 { grid-template-columns: 1fr; }
  .sdiag { grid-template-columns: 1fr; } .sarrow { transform: rotate(90deg); }
  .toast { left: 14px; right: 14px; max-width: none; }
  /* Tablas: la primera columna queda fija al desplazar */
  .table-wrap td:first-child, .table-wrap th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
  .ctable td:first-child { min-width: 150px; }
}
@media (max-width: 560px) {
  .main { padding: 14px 10px 50px; }
  .modal { padding: 18px; border-radius: 18px; }
  .modal-bg { padding: 10px; }
  .gth, .gimg, .gadd { width: 92px; } .gimg, .gadd { height: 114px; }
  .cgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .zones { flex-wrap: wrap; }
}

/* ===== Inicio de sesión ===== */
.login { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: 100vh; }
.login-izq { position: relative; overflow: hidden; background: radial-gradient(90% 75% at 50% 62%, #163832 0%, #0B2B26 42%, #051F20 100%); color: #EAF6EC; display: flex; flex-direction: column; justify-content: center; padding: 48px 6vw; min-height: 100vh; }
.login-globo { position: absolute; left: 50%; top: 58%; width: min(1100px, 125%); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; }
.login-marca { position: relative; z-index: 2; max-width: 460px; }
.logo-anim { width: min(230px, 60vw); height: auto; overflow: visible; display: block; margin-bottom: 6px; }
.login-wm { font-family: Montserrat, sans-serif; font-weight: 900; font-size: clamp(38px, 5vw, 60px); letter-spacing: -.035em; line-height: 1; display: flex; gap: .22em; flex-wrap: wrap; opacity: 0; transform: translateY(10px); }
.login-wm em { font-style: normal; color: #8EB69B; }
.login-lema { color: #B9D3C1; font-size: clamp(14px, 1.3vw, 17px); line-height: 1.55; margin: 14px 0 0; max-width: 400px; opacity: 0; transform: translateY(10px); }
.login.go .login-wm { animation: lgUp .7s 2.3s forwards; } .login.go .login-lema { animation: lgUp .7s 2.6s forwards; }
@keyframes lgUp { to { opacity: 1; transform: none; } }
.login-der { display: flex; align-items: center; justify-content: center; padding: 32px 22px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 0.5px solid var(--line); border-radius: 22px; padding: 28px 26px 22px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 24px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; }
.login-card form { display: grid; gap: 12px; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; margin-top: 4px; }
.login-card .alt { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.login-card .alt a, .login-card .lnk { color: var(--brand-2); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.login-card .lnk { font-size: 12.5px; justify-self: end; margin-top: -4px; }
.login-card .err { color: var(--bad); font-size: 13px; min-height: 0; margin: 0; }
.login-card .err:empty { display: none; }
.pw { position: relative; } .pw input { padding-right: 40px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px 6px; }
.code-ok { color: var(--good); font-size: 12px; } .code-bad { color: var(--bad); font-size: 12px; }
.login-pie { position: absolute; z-index: 2; left: 6vw; bottom: 22px; font-size: 12px; color: #7FA58D; }
/* Logo animado */
.la-barras rect { fill: #fff; transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.login.go .la-barras rect { animation: laGrow .6s cubic-bezier(.2,.9,.25,1.15) var(--d) forwards; }
@keyframes laGrow { to { transform: scaleY(1); } }
.la-puff { fill: #e9efe9; opacity: 0; }
.login.go .la-puff { animation: laPuff 1.2s var(--t) infinite; }
@keyframes laPuff { 0% { opacity: .55; transform: translate(0,0) scale(.6); } 100% { opacity: 0; transform: translate(-46px, var(--y)) scale(2.2); } }
.la-f1 { transform-origin: 0 0; animation: laFlick .12s infinite alternate; } .la-f2 { transform-origin: 0 0; animation: laFlick .09s infinite alternate-reverse; }
@keyframes laFlick { from { transform: scaleX(.82); } to { transform: scaleX(1.08); } }
.la-chispa { fill: #FFD24A; opacity: 0; }
.login.go .la-chispa { animation: laSpark .55s var(--t) infinite; }
@keyframes laSpark { 0% { opacity: 1; transform: translate(0,0); } 100% { opacity: 0; transform: translate(-34px, var(--y)); } }
.login.fin .la-humo, .login.fin .la-fuego { opacity: 0; transition: opacity 1.2s; }
@media (prefers-reduced-motion: reduce) { .la-barras rect { transform: none !important; animation: none !important; } .login-wm, .login-lema { opacity: 1; transform: none; animation: none !important; } }
@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-izq { min-height: 0; padding: 34px 22px 40px; }
  .login-globo { top: 70%; width: 160%; opacity: .75; }
  .logo-anim { width: 150px; }
  .login-pie { display: none; }
  .login-der { padding: 0 14px 34px; background: linear-gradient(#051F20 0, var(--bg) 120px); }
  .login-card { margin-top: -20px; position: relative; z-index: 3; }
}

/* ===== Códigos de invitación (cuenta madre) ===== */
.inv-new { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; margin-top: 14px; }
.inv-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em; background: var(--panel); padding: 4px 10px; border-radius: 8px; }
.inv-st-activo { background: var(--good-bg); color: var(--good); } .inv-st-usado { background: var(--panel-2); color: var(--muted); }
.inv-st-vencido { background: var(--warn-bg); color: var(--warn); } .inv-st-revocado { background: var(--bad-bg); color: var(--bad); }
.brand-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-pick label { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; max-width: 100%; }
.brand-pick label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-pick input { width: auto; accent-color: var(--brand); }
.sec-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--warn-bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
/* Ajustes del revisor de desbordes */
.btn { flex-shrink: 0; }
@media (max-width: 900px) {
  .row { flex-wrap: wrap; }
  .row > .spacer { min-width: 0; }
  .card > .row > h2, .card > .row > div { min-width: 0; }
}
@media (max-width: 560px) {
  .sgrid4, .sgrid3 { grid-template-columns: minmax(0, 1fr); }
  .btn { white-space: normal; text-align: center; }
}
select.btn { width: auto; max-width: 100%; padding-right: 30px; }
.row.wrap { justify-content: flex-start; }
.card > .row > .row.wrap { flex: 0 1 auto; justify-content: flex-end; }
.dupbox select { width: auto; border: 0; background: transparent; }
