*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal: #2faba1;
  --teal-dark: #238c83;
  --teal-light: #e8f7f6;
  --bg: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --text: #1a1a18;
  --text-muted: #6b6a65;
  --text-light: #9b9a95;
  --border: #e5e4e0;
  --grid: #ecebe7;
  --shadow: 0 2px 12px rgba(0,0,0,0.05);
  --radius: 10px;

  /* Estados comerciales (mismos que comerciales.lasser.es) */
  --st-no: #d97706;          --st-no-bg: #fffbeb;
  --st-seg: #3b82f6;         --st-seg-bg: #eff6ff;
  --st-cerrado: #059669;     --st-cerrado-bg: #ecfdf5;
  --st-perdido: #dc2626;     --st-perdido-bg: #fef2f2;
  --st-sinresp: #8b5cf6;     --st-sinresp-bg: #f5f3ff;
  --st-info: #ea580c;        --st-info-bg: #fff7ed;
  --st-cat: #c026d3;         --st-cat-bg: #fdf4ff;

  /* Severidad de alertas */
  --sev-critical: #c62828;   --sev-critical-bg: #fdecec;
  --sev-serious: #c2410c;    --sev-serious-bg: #fff3e8;
  --sev-warning: #a16207;    --sev-warning-bg: #fef9e7;
  --good: #15803d;           --good-bg: #ecfdf3;

  --chart-1: #2faba1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111413;
    --surface: #1a1e1d;
    --surface-2: #202524;
    --text: #ecefee;
    --text-muted: #a3aba9;
    --text-light: #7a8381;
    --border: #2c3331;
    --grid: #262c2b;
    --teal-light: #183330;
    --shadow: none;
    --st-no-bg: #33270f;  --st-seg-bg: #172437;  --st-cerrado-bg: #12302a;  --st-perdido-bg: #3a1717;
    --st-sinresp-bg: #261d3d;  --st-info-bg: #3a2312;  --st-cat-bg: #36163a;
    --st-no: #fbbf24; --st-seg: #7ab0ff; --st-cerrado: #4ade80; --st-perdido: #f87171;
    --st-sinresp: #b49cff; --st-info: #fb923c; --st-cat: #e879f9;
    --sev-critical: #ff8a80; --sev-critical-bg: #3a1716;
    --sev-serious: #fdba74;  --sev-serious-bg: #3a2313;
    --sev-warning: #fcd34d;  --sev-warning-bg: #33290f;
    --good: #4ade80; --good-bg: #12301f;
    --chart-1: #3cc2b6;
  }
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--teal-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: 'DM Mono', ui-monospace, monospace; }
.muted { color: var(--text-muted); }
.light { color: var(--text-light); }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; white-space: nowrap; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.brand small { font-size: 12px; font-weight: 500; color: var(--teal-dark); background: var(--teal-light); padding: 3px 10px; border-radius: 20px; }

.tabs { display: flex; gap: 4px; height: 100%; overflow-x: auto; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 100%;
  text-decoration: none; color: var(--text-muted); font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--teal); }
.tabs .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 7px; }
.tabs .count:empty { display: none; }
.tabs .count.warn { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: transparent; }

.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ---------- Layout ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 28px 24px 60px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.view-head p { color: var(--text-muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; text-decoration: none; color: var(--text); font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--text-light); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.danger { background: var(--sev-critical); border-color: var(--sev-critical); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.section { margin-top: 24px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.section-title .light { font-weight: 400; font-size: 13px; }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.input, .select {
  height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid var(--teal-light); border-color: var(--teal); }
.input.grow { flex: 1 1 260px; }
.chips { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.chips button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer; color: var(--text-muted); font-weight: 500; font-size: 13px; }
.chips button.active { background: var(--teal-light); color: var(--teal-dark); }
.chips button:disabled { opacity: .45; cursor: default; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-align: left; }
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--text-light); }
button.kpi.active { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-light); }
.kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.kpi .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); padding: 11px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge.active { background: var(--good-bg); color: var(--good); }
.badge.paused { background: var(--surface-2); color: var(--text-muted); }
.badge.issue { background: var(--sev-serious-bg); color: var(--sev-serious); }
.tag { font-size: 10px; font-weight: 600; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }

/* ---------- Comerciales ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rep { padding: 16px 18px; cursor: pointer; text-align: left; width: 100%; }
.rep:hover { border-color: var(--text-light); }
.rep.active { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-light); }
.rep-head { display: flex; align-items: center; gap: 10px; }
.rep-head .avatar { width: 36px; height: 36px; }
.rep-name { font-weight: 600; }
.rep-total { margin-left: auto; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stack { display: flex; gap: 2px; height: 8px; margin: 14px 0 10px; border-radius: 4px; overflow: hidden; background: var(--grid); }
.stack span { display: block; height: 100%; }
.rep-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.rep-meta b { color: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- Gráficos ---------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.chart-card { padding: 16px 18px 10px; }
.chart-title { font-weight: 600; font-size: 14px; }
.chart-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-light); font-size: 10px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--chart-1); }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--surface);
  padding: 7px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5;
}
.tooltip b { font-weight: 600; }

/* ---------- Ads ---------- */
.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.banner.demo { background: var(--sev-warning-bg); color: var(--sev-warning); }
.banner.error { background: var(--sev-critical-bg); color: var(--sev-critical); }
.banner.info { background: var(--teal-light); color: var(--teal-dark); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: grid; grid-template-columns: 112px 56px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.alert .thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.sev.critical { background: var(--sev-critical-bg); color: var(--sev-critical); }
.sev.serious { background: var(--sev-serious-bg); color: var(--sev-serious); }
.sev.warning { background: var(--sev-warning-bg); color: var(--sev-warning); }
.alert-title { font-weight: 600; }
.alert-detail { font-size: 13px; color: var(--text-muted); }
.alert-action { font-size: 13px; font-weight: 500; margin-top: 2px; }
.empty { padding: 28px; text-align: center; color: var(--text-muted); }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 0; padding: 0 12px; overflow-x: auto; }
.subtabs button { border: 0; background: transparent; padding: 12px 12px; cursor: pointer; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs button.active { color: var(--text); border-bottom-color: var(--teal); }
.subtabs .spacer { flex: 1; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; white-space: nowrap; padding: 0 4px; }

.ad-name { display: flex; gap: 10px; align-items: center; }
.ad-name img { width: 40px; height: 40px; border-radius: 5px; object-fit: cover; background: var(--surface-2); flex: none; }

.creatives { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 16px; }
.creative { overflow: hidden; display: flex; flex-direction: column; }
.creative .img { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.creative .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creative .img .play { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 4px; }
.creative .img .badge { position: absolute; top: 8px; right: 8px; }
.creative .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.creative .name { font-weight: 600; font-size: 13px; }
.creative .copy { font-size: 12px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.creative .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 11px; color: var(--text-muted); margin-top: auto; }
.creative .stats b { display: block; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }

.connect { padding: 28px; }
.connect h3 { font-size: 18px; margin-bottom: 6px; }
.connect ol { margin: 14px 0 0 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-muted); }
.connect code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); font-size: 12px; }

/* ---------- Instaladores ---------- */
.tec { margin-bottom: 12px; overflow: hidden; }
.tec-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; flex-wrap: wrap; }
.tec-head:hover { background: var(--surface-2); }
.tec-name { font-weight: 600; font-size: 15px; }
.tec-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.progress { flex: 1 1 160px; max-width: 260px; height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; margin-left: auto; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.pct { font-size: 12px; color: var(--text-muted); width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.chev { color: var(--text-light); transition: transform .15s; }
.tec.open .chev { transform: rotate(90deg); }
.tec-body { border-top: 1px solid var(--border); display: none; }
.tec.open .tec-body { display: block; }
.st-realizada { background: var(--good-bg); color: var(--good); }
.st-pendiente { background: var(--sev-critical-bg); color: var(--sev-critical); }
.st-sin_hora { background: var(--sev-warning-bg); color: var(--sev-warning); }
.st-asignado { background: var(--st-seg-bg); color: var(--st-seg); }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
details.material summary { cursor: pointer; font-size: 12px; color: var(--teal-dark); margin-top: 4px; }
details.material ul { margin: 6px 0 0 16px; font-size: 12px; color: var(--text-muted); }

/* ---------- Estado de carga ---------- */
.loading { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.loading::before { content: ''; display: block; width: 26px; height: 26px; margin: 0 auto 12px; border: 3px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 50; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 34px 30px; }
.login-card h1 { font-size: 22px; margin: 18px 0 4px; }
.login-card p { color: var(--text-muted); margin-bottom: 22px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 6px; }
.login-card .input { width: 100%; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 22px; height: 42px; }
.login-error { background: var(--sev-critical-bg); color: var(--sev-critical); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  .topbar { padding: 0 16px; gap: 12px; height: auto; flex-wrap: wrap; padding-top: 10px; }
  .brand small, .user .uname { display: none; }
  .tabs { order: 3; width: 100%; height: 44px; }
  main { padding: 20px 16px 50px; }
  .view-head h1 { font-size: 22px; }
  .charts { grid-template-columns: 1fr; }
  .alert { grid-template-columns: 48px 1fr; }
  .alert .thumb { width: 48px; height: 48px; }
  .alert > .sev { grid-column: 1 / -1; justify-self: start; }
  .alert > .btn { grid-column: 1 / -1; justify-content: center; }
  .progress { display: none; }
}

/* ---------- Acciones sobre anuncios ---------- */
.alert-buttons { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.alert-buttons .btn { justify-content: center; }
.creative-actions { display: flex; gap: 6px; }
.creative-actions .btn { flex: 1; justify-content: center; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.budget-edit { background: none; border: 1px dashed transparent; border-radius: 6px; padding: 3px 6px; margin: -4px -7px; cursor: pointer; text-align: right; font: inherit; color: inherit; }
.budget-edit:hover { border-color: var(--teal); background: var(--teal-light); }
.budget-edit .pencil { display: block; font-size: 11px; color: var(--teal-dark); opacity: 0; }
.budget-edit:hover .pencil, .budget-edit:focus .pencil { opacity: 1; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 13, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { width: 100%; max-width: 440px; padding: 22px 24px; }
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal-body p + p { margin-top: 6px; }
.modal-input { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.modal-input .input { width: 140px; font-size: 16px; }
.modal-hint { font-size: 12px; margin-top: 8px; }
.modal-error { margin-top: 10px; font-size: 13px; color: var(--sev-critical); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@media (max-width: 760px) { .alert-buttons { grid-column: 1 / -1; } }
/* ---------- RRSS ---------- */
:root { --ig: #c13584; --li: #0a66c2; }
.red-badge { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 4px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #fff; flex: none; }
.red-badge.instagram { background: var(--ig); }
.red-badge.linkedin { background: var(--li); }
.est-idea { --est: var(--text-muted); --est-bg: var(--surface-2); }
.est-borrador { --est: var(--sev-warning); --est-bg: var(--sev-warning-bg); }
.est-listo { --est: var(--st-seg); --est-bg: var(--st-seg-bg); }
.est-publicado { --est: var(--good); --est-bg: var(--good-bg); }
.badge.est-idea, .badge.est-borrador, .badge.est-listo, .badge.est-publicado { background: var(--est-bg); color: var(--est); }
.est-sw-idea { background: var(--text-light); } .est-sw-borrador { background: var(--sev-warning); }
.est-sw-listo { background: var(--st-seg); } .est-sw-publicado { background: var(--good); }

.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-head h3 { font-size: 16px; min-width: 150px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.cal-day { position: relative; min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { color: var(--text-light); }
.cal-day.today .cal-num { background: var(--teal); color: #fff; }
.cal-day.drop { background: var(--teal-light); outline: 2px dashed var(--teal); outline-offset: -3px; }
.cal-num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-post { display: flex; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 5px; font-size: 12px; cursor: pointer; background: var(--est-bg); border-left: 3px solid var(--est); overflow: hidden; }
.cal-post:hover { filter: brightness(.96); }
.cal-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cal-add { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--teal-light); color: var(--teal-dark); cursor: pointer; opacity: 0; font-size: 15px; line-height: 1; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }

.rr-cards, .rr-ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rr-ideas { min-height: 60px; border-radius: var(--radius); }
.rr-ideas.drop { outline: 2px dashed var(--teal); background: var(--teal-light); }
.rr-card { display: flex; gap: 12px; padding: 12px; cursor: pointer; }
.rr-card:hover { border-color: var(--text-light); }
.rr-card-media { position: relative; flex: none; }
.rr-thumb { width: 84px; height: 84px; border-radius: 6px; object-fit: cover; display: block; background: var(--surface-2); }
.rr-thumb.empty { display: grid; place-items: center; font-size: 11px; color: var(--text-light); border: 1px dashed var(--border); text-align: center; }
.rr-more { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; }
.rr-card-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.rr-card-top { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rr-copy { font-size: 12px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rr-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; font-size: 12px; flex-wrap: wrap; }

/* Editor lateral */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 13, .45); z-index: 90; display: flex; justify-content: flex-end; }
.drawer { width: min(980px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.15); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; padding: 20px 22px; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ed-main { display: flex; flex-direction: column; gap: 14px; }
.fl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.fl .input, .fl .select { width: 100%; font-weight: 400; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-redes { display: flex; gap: 8px; }
.ed-red { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 500; }
.ed-red.instagram:has(input:checked) { border-color: var(--ig); color: var(--ig); }
.ed-red.linkedin:has(input:checked) { border-color: var(--li); color: var(--li); }
.ed-count { font-size: 11px; font-weight: 400; color: var(--text-muted); text-align: right; }
.ed-count .over { color: var(--sev-critical); font-weight: 600; }
.ed-drop { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.ed-drop.over { border-color: var(--teal); background: var(--teal-light); }
.ed-media { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-media:empty { display: none; }
.ed-item { position: relative; cursor: grab; }
.ed-rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--text); color: var(--surface); cursor: pointer; font-size: 11px; }
.ed-cover { position: absolute; bottom: 4px; left: 4px; background: var(--teal); color: #fff; font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.ed-upload { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; cursor: pointer; font-weight: 400; text-align: center; color: var(--text-muted); font-size: 13px; }
.ed-upload u { color: var(--teal-dark); }
.ed-upload .light { font-size: 11px; }
.ed-preview { position: sticky; top: 0; align-self: start; }
.prev { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); font-size: 13px; }
.prev-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.prev-media { position: relative; }
.prev-media .rr-thumb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 0; }
.prev.linkedin .prev-media .rr-thumb { aspect-ratio: 1.91; }
.prev-text { padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; line-height: 1.45; }

@media (max-width: 860px) {
  .drawer-body { grid-template-columns: 1fr; }
  .ed-preview { position: static; }
  .cal-day { min-height: 76px; padding: 3px; }
  .cal-post .cal-txt { display: none; }
  .cal-dow { padding: 6px 3px; font-size: 10px; text-align: center; }
}
/* ---------- RRSS: rendimiento ---------- */
.perf-account { display: flex; align-items: center; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.perf-account img, .perf-account .avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.perf-followers { margin-left: auto; text-align: right; }
.perf-followers .value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.perf-followers .label { font-size: 12px; color: var(--text-muted); }
.delta { display: block; font-size: 11px; margin-top: 4px; color: var(--text-light); }
.delta.up { color: var(--good); }
.delta.down { color: var(--sev-critical); }
.perf-followers .delta { display: inline; margin-left: 4px; }
.perf-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 12px; }
.perf-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.perf-top-item { position: relative; display: flex; gap: 12px; padding: 12px; text-decoration: none; color: inherit; }
.perf-top-item:hover { border-color: var(--text-light); }
.perf-rank { position: absolute; top: 6px; left: 6px; z-index: 1; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.perf-top-img { width: 88px; height: 88px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2); }
.perf-top-img.empty, .perf-row-img.empty { display: grid; place-items: center; font-size: 10px; color: var(--text-light); border: 1px dashed var(--border); }
.perf-top-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.perf-top-val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.perf-top-val .light { font-size: 12px; font-weight: 400; }
.perf-row-img { width: 44px; height: 44px; border-radius: 5px; object-fit: cover; flex: none; background: var(--surface-2); }
.perf-caption { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-metrics { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.rr-metrics b { color: var(--text); }
.ed-link { border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-weight: 400; }
.ed-link + .ed-link { margin-top: 8px; }
.ed-link-head { display: flex; align-items: center; gap: 8px; }
.ed-link-head .select { flex: 1; height: 34px; }
.ed-link-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-size: 11px; color: var(--text-muted); }
.ed-link-metrics b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .perf-grid { grid-template-columns: 1fr; } .perf-followers { margin-left: 0; text-align: left; } }
/* Publicaciones reales (ya hechas) en calendario y lista */
.cal-post.pub { background: var(--surface-2); border-left-style: dotted; }
.rr-card.pub { background: var(--surface-2); }
.pub-detail { display: flex; gap: 12px; align-items: flex-start; }
.pub-detail-img { width: 120px; height: 120px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2); }
.pub-detail-img.empty { display: grid; place-items: center; font-size: 11px; color: var(--text-light); border: 1px dashed var(--border); }
.pub-detail-text { max-height: 160px; overflow-y: auto; white-space: pre-wrap; font-size: 13px; color: var(--text-muted); }
.modal:has(.pub-detail) { max-width: 560px; }
/* ---------- RRSS: ideas con IA ---------- */
.ideas-drawer { width: min(760px, 100%); }
.ideas-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; display: flex; flex-direction: column; gap: 14px; }
.ideas-form { padding: 16px; display: grid; grid-template-columns: auto 140px; gap: 14px; align-items: start; }
.ideas-form .ideas-ind, .ideas-form .ideas-go, .ideas-form .banner { grid-column: 1 / -1; }
.ideas-go { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ideas-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ideas-meta .select { height: 34px; }
.ideas-learn { padding: 14px 16px; background: var(--teal-light); border-color: transparent; }
.ideas-learn ul { margin: 8px 0 0 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ideas-list { display: flex; flex-direction: column; gap: 10px; }
.idea { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.idea-title { font-weight: 600; font-size: 15px; }
.idea-hook { font-size: 14px; font-style: italic; }
.idea details summary { cursor: pointer; font-size: 12px; color: var(--teal-dark); }
.idea-copy { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); border-radius: 6px; padding: 10px 12px; margin-top: 6px; line-height: 1.5; }
.idea-row { font-size: 13px; color: var(--text-muted); }
.idea-row b { color: var(--text); font-weight: 600; margin-right: 4px; }
.idea-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
@media (max-width: 600px) { .ideas-form { grid-template-columns: 1fr; } }
/* ---------- Visor de imágenes ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(8, 10, 10, .88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox figure { max-width: min(1100px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); background: #111; }
.lightbox video { cursor: default; }
.lightbox figcaption { color: #e7ecea; font-size: 13px; text-align: center; }
.lightbox figcaption a { color: #7fe0d6; margin-left: 8px; }
.lightbox-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 16px; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.25); }
[data-zoom] { cursor: zoom-in; }
.zoomable { position: relative; flex: none; }
.zoom-hint { position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; font-size: 14px; pointer-events: none; }
.pub-detail-img { width: 200px; height: 200px; }

/* ---------- Página Hoy ---------- */
.hoy-todo { padding: 18px 20px; margin-bottom: 14px; }
.hoy-todo h2, .hoy-card h2 { font-size: 16px; font-weight: 600; }
.hoy-todo-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.hoy-todo-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); background: var(--surface-2); font-size: 14px; }
.hoy-todo-item:hover { filter: brightness(.97); }
.hoy-todo-item b { font-weight: 600; }
.hoy-todo-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; flex: none; }
.sev-critical .hoy-todo-icon { background: var(--sev-critical-bg); color: var(--sev-critical); }
.sev-serious .hoy-todo-icon { background: var(--sev-serious-bg); color: var(--sev-serious); }
.sev-warning .hoy-todo-icon { background: var(--sev-warning-bg); color: var(--sev-warning); }
.sev-info .hoy-todo-icon { background: var(--good-bg); color: var(--good); }
.hoy-go { margin-left: auto; color: var(--text-light); }
.hoy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hoy-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.hoy-card-head { display: flex; align-items: baseline; justify-content: space-between; text-decoration: none; color: var(--text); }
.hoy-card-head span { font-size: 13px; color: var(--teal-dark); }
.hoy-card-head:hover span { text-decoration: underline; }
.hoy-minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.hoy-mini { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.hoy-mini .value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hoy-mini .label { font-size: 12px; color: var(--text-muted); }
.hoy-mini.warn .value { color: var(--sev-serious); }
.hoy-mini.good .value { color: var(--good); }
.hoy-sub { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-top: 6px; }
.hoy-list { display: flex; flex-direction: column; }
.hoy-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.hoy-row:last-child { border-bottom: 0; }
.hoy-ok { color: var(--good); font-size: 13px; padding: 6px 0; }
.hoy-progress { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.hoy-progress span { display: block; height: 100%; background: var(--good); }
.hoy-last { display: flex; gap: 12px; text-decoration: none; color: inherit; padding: 8px; border-radius: 8px; background: var(--surface-2); }
.hoy-last img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex: none; }
.hoy-last > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
@media (max-width: 900px) { .hoy-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .pub-detail { flex-direction: column; } .pub-detail-img { width: 100%; height: auto; aspect-ratio: 1; } }
/* ---------- Colaboraciones ---------- */
.cst-candidato { --c: var(--text-light); } .cst-contactado { --c: var(--st-seg); } .cst-negociando { --c: var(--sev-warning); }
.cst-colaborando { --c: var(--good); } .cst-descartado { --c: var(--st-perdido); }
.sw.cst-candidato, .sw.cst-contactado, .sw.cst-negociando, .sw.cst-colaborando, .sw.cst-descartado { background: var(--c); }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.col-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.col-card:hover { border-color: var(--text-light); }
.col-head { display: flex; align-items: center; gap: 10px; }
.col-id { min-width: 0; flex: 1; }
.col-id .cell-title, .col-id .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.col-avatar.ph { display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--teal-dark); background: var(--teal-light); }
.col-avatar.big { width: 84px; height: 84px; font-size: 24px; }
.col-score { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; border: 2px solid currentColor; }
.col-score.hi { color: var(--good); background: var(--good-bg); }
.col-score.mid { color: var(--st-seg); background: var(--st-seg-bg); }
.col-score.lo { color: var(--text-muted); background: var(--surface-2); }
.col-score.na { color: var(--text-light); }
.col-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; font-size: 11px; color: var(--text-muted); }
.col-stats b { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.col-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.col-posts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.col-posts.big { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.col-post { position: relative; aspect-ratio: 1; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.col-post img { width: 100%; height: 100%; object-fit: cover; display: block; }
.col-reel { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 3px; }
.col-post-wrap { display: flex; flex-direction: column; gap: 3px; }
.col-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.col-estado { height: 32px; font-size: 13px; border-left: 3px solid var(--c); }
.col-foot .btn { margin-left: auto; }
.col-job { align-items: center; }
.col-ficha { grid-template-columns: minmax(0, 1fr) 280px; }
.col-profile { display: flex; gap: 14px; align-items: flex-start; }
.col-bio { font-size: 13px; color: var(--text-muted); white-space: pre-wrap; margin-top: 4px; }
.col-links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.col-eval { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.col-eval-head { display: flex; gap: 12px; align-items: center; }
.col-eval-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col-eval ul { margin: 4px 0 0 16px; display: flex; flex-direction: column; gap: 3px; }
.col-crm { display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 14px; align-self: start; position: sticky; top: 0; }
.col-search-modal { max-width: 520px; }
@media (max-width: 860px) { .col-ficha { grid-template-columns: 1fr; } .col-crm { position: static; } .col-eval-cols { grid-template-columns: 1fr; } }
/* Colaboraciones: tipo de perfil */
.tag.modo-profesionales { background: var(--st-cat-bg); color: var(--st-cat); border-color: transparent; }
.tag.modo-creadores { background: var(--teal-light); color: var(--teal-dark); border-color: transparent; }
.cs-modos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cs-modo { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
.cs-modo b { font-size: 14px; }
.cs-modo span { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.cs-modo.active { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-light); }
@media (max-width: 520px) { .cs-modos { grid-template-columns: 1fr; } }.tag.modo-divulgadores { background: var(--st-info-bg); color: var(--st-info); border-color: transparent; }
.cs-modos { grid-template-columns: repeat(3, 1fr); }
.col-search-modal { max-width: 640px; }
.col-retype { display: flex; gap: 6px; }
.col-retype .select { flex: 1; height: 32px; }
@media (max-width: 640px) { .cs-modos { grid-template-columns: 1fr; } }
/* ---------- RRSS: audiencia ---------- */
.aud-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.aud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.aud-demo { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.hbars { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hbar-track { height: 10px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; }
.hbar-fill.muted { background: var(--text-light); }
.hbar-v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.hbar-v .light { font-weight: 400; font-size: 11px; }
.aud-matrix td, .aud-matrix th { padding: 8px 10px; }
.aud-cell { display: inline-block; min-width: 30px; padding: 3px 6px; border-radius: 4px; text-align: center; background: color-mix(in srgb, var(--chart-1) calc(var(--a) * 70%), transparent); font-weight: 600; }
.aud-tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.aud-tag { overflow: hidden; }
.aud-tag .col-post { border-radius: 0; }
.aud-tag-body { padding: 8px 10px; }
.aud-tag-body a { text-decoration: none; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .aud-grid, .aud-demo { grid-template-columns: 1fr; } }
/* Colaboraciones: desglose de la nota y pesos */
.nota-desglose { display: flex; flex-direction: column; gap: 6px; }
.nd-row { display: grid; grid-template-columns: minmax(150px, 42%) 1fr auto; gap: 4px 10px; align-items: center; font-size: 12px; }
.nd-label { color: var(--text); }
.nd-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nd-val .light { font-weight: 400; }
.nd-why { grid-column: 1 / -1; color: var(--text-light); font-size: 11px; margin-top: -3px; }
.nd-src { font-size: 9px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; vertical-align: middle; }
.nd-src.ia { background: var(--st-cat-bg); color: var(--st-cat); }
.nd-src.formula { background: var(--teal-light); color: var(--teal-dark); }
.pesos { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.peso-row { display: grid; grid-template-columns: 1fr 80px 46px; gap: 10px; align-items: center; font-size: 13px; }
.peso-row .input { height: 34px; }
.peso-pct { text-align: right; font-variant-numeric: tabular-nums; }
.pesos-reeval { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; }
.lq-mix { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .lq-mix { grid-template-columns: 1fr; } }

/* ---------- Ads: competencia ---------- */
.comp-list { display: flex; flex-direction: column; gap: 10px; }
.comp-card { overflow: hidden; }
.comp-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer; flex-wrap: wrap; }
.comp-head:hover { background: var(--surface-2); }
.comp-stats { display: flex; gap: 18px; font-size: 11px; color: var(--text-muted); text-align: right; }
.comp-stats b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.comp-ads { border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; padding: 12px; background: var(--surface-2); }
.comp-ad { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.comp-ad.off { opacity: .65; }
.comp-ad-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.comp-ad-text { white-space: pre-wrap; color: var(--text-muted); max-height: 140px; overflow-y: auto; line-height: 1.45; }
/* ---------- Asistente (chat) ---------- */
.chat-root { position: fixed; right: 20px; bottom: 20px; z-index: 80; }
.chat-fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--teal); color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.chat-fab:hover { background: var(--teal-dark); }
.chat-panel { position: absolute; right: 0; bottom: 70px; width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; word-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-msg.bot.err { background: var(--sev-critical-bg); color: var(--sev-critical); }
.chat-msg p { margin: 0 0 6px; } .chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul, .chat-msg ol { margin: 4px 0 6px 18px; }
.chat-msg .chat-h { font-weight: 600; margin-top: 4px; }
.chat-msg code { background: var(--surface); padding: 0 4px; border-radius: 3px; font-size: 12px; }
.chat-table { overflow-x: auto; margin: 6px 0; }
.chat-table table { border-collapse: collapse; font-size: 12px; }
.chat-table th, .chat-table td { border: 1px solid var(--border); padding: 4px 7px; text-align: left; }
.chat-table th { background: var(--surface); }
.chat-src { margin-top: 6px; font-size: 10px; color: var(--text-light); }
.chat-msg.typing { display: flex; align-items: center; gap: 4px; color: var(--text-muted); }
.chat-msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-light); animation: chatdot 1s infinite; }
.chat-msg.typing span:nth-child(2) { animation-delay: .15s; } .chat-msg.typing span:nth-child(3) { animation-delay: .3s; }
.chat-msg.typing em { font-size: 12px; margin-left: 6px; }
@keyframes chatdot { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.chat-hello { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.chat-sug { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.chat-sug:hover { border-color: var(--teal); background: var(--teal-light); }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 38px; max-height: 140px; padding: 8px 10px; }
@media (max-width: 560px) { .chat-root { right: 12px; bottom: 12px; } .chat-panel { height: calc(100vh - 100px); } }
/* Tomas -> pedido */
.conv { display:inline-block; min-width:46px; padding:2px 7px; border-radius:10px; font-weight:600; text-align:center; }
.conv.hi { background:var(--good-bg); color:var(--good); } .conv.mid { background:var(--st-seg-bg); color:var(--st-seg); } .conv.lo { background:var(--sev-critical-bg); color:var(--sev-critical); }
