/* ============================================================================
   LGANCIA · EMBUDO — sistema de diseño único
   Lo usan el panel y las páginas Livewire. Antes estaba duplicado en dos
   Blade distintos, así que los formularios se quedaban con el diseño viejo.

   Temas: claro por defecto, oscuro por preferencia del sistema, y
   data-theme="light|dark" en <html> gana sobre ambas.
   Paleta y superficies: instancia de referencia de la guía de dataviz,
   validada con su script para daltonismo y contraste.
   ============================================================================ */

:root {
  color-scheme: light;

  /* superficies */
  --plane:      #f9f9f7;   /* fondo de página */
  --surface:    #fcfcfb;   /* tarjetas y superficie de los gráficos */
  --surface-2:  #f1f1ed;   /* realce sutil dentro de una tarjeta */

  /* tinta */
  --ink:        #0b0b0b;
  --ink-2:      #52514e;
  /* La paleta de referencia usa #898781 para este rol, pero ahí es solo para
     ticks de eje. Aquí también viste texto pequeño de interfaz (subtítulos,
     pies de KPI), y #898781 da 3.5:1 sobre fondo claro — por debajo del 4.5:1
     que pide WCAG AA. Se oscurece un paso: 5.11:1. En oscuro ya cumplía. */
  --ink-muted:  #6e6c67;
  --axis-ink:   #898781;   /* ticks del eje, según la paleta */

  /* líneas */
  --hairline:   rgba(11,11,11,.10);
  --grid:       #e1e0d9;
  --axis:       #c3c2b7;

  /* series de datos (slots categóricos 1 y 2) */
  --series-1:   #2a78d6;
  --series-2:   #eb6834;
  --series-1-soft: rgba(42,120,214,.14);

  /* estado — fijos, nunca se tematizan */
  --good:       #0ca30c;
  --warning:    #fab219;
  --serious:    #ec835a;
  --critical:   #d03b3b;
  --good-ink:   #006300;   /* verde legible sobre fondo claro */

  /* acentos de plataforma: identidad, nunca series */
  --tiktok:     #d81b45;
  --whatsapp:   #128c4a;

  --focus:      #2a78d6;

  --r-lg: 14px; --r: 10px; --r-sm: 7px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 60px;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 4px 12px -6px rgba(11,11,11,.10);
}

/* El :not() deja que un data-theme="light" explícito gane al SO en oscuro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:      #0d0d0d;
    --surface:    #1a1a19;
    --surface-2:  #232322;
    --ink:        #ffffff;
    --ink-2:      #c3c2b7;
    --ink-muted:  #898781;
    --axis-ink:   #898781;
    --hairline:   rgba(255,255,255,.10);
    --grid:       #2c2c2a;
    --axis:       #383835;
    --series-1:   #3987e5;
    --series-2:   #d95926;
    --series-1-soft: rgba(57,135,229,.18);
    --good-ink:   #0ca30c;
    --tiktok:     #ff5c78;
    --whatsapp:   #25d366;
    --focus:      #3987e5;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px -6px rgba(0,0,0,.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:      #0d0d0d;
  --surface:    #1a1a19;
  --surface-2:  #232322;
  --ink:        #ffffff;
  --ink-2:      #c3c2b7;
  --ink-muted:  #898781;
  --axis-ink:   #898781;
  --hairline:   rgba(255,255,255,.10);
  --grid:       #2c2c2a;
  --axis:       #383835;
  --series-1:   #3987e5;
  --series-2:   #d95926;
  --series-1-soft: rgba(57,135,229,.18);
  --good-ink:   #0ca30c;
  --tiktok:     #ff5c78;
  --whatsapp:   #25d366;
  --focus:      #3987e5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px -6px rgba(0,0,0,.5);
}

/* ============ base ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--plane);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
/* En iOS, un input de menos de 16px hace que Safari amplíe la página al enfocarlo
   y el usuario se queda con la vista descuadrada. Solo aplica en pantallas
   táctiles pequeñas, para no agrandar los campos en escritorio. */
@media (max-width: 820px) {
  input, select, textarea { font-size: 16px; }
  .field input, .field select, .field textarea, .searchbox input { font-size: 16px; }
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--series-1); color: #fff; }
/* Cifras de ancho fijo SOLO donde los números se alinean en vertical (ids,
   tokens, columnas de tabla, ticks del eje). En un número grande suelto
   —el héroe o el valor de un KPI— el ancho fijo lo hace parecer suelto,
   así que ahí se usan las cifras proporcionales por defecto. */
.mono, .inp-mono, .mask { font-variant-numeric: tabular-nums; }

/* ============ estructura ============ */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.main { flex: 1; min-width: 0; }
.content { padding: 20px 16px calc(var(--nav-h) + 28px); max-width: 1180px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } }

/* ============ topbar (móvil) ============ */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(140deg, var(--tiktok), var(--series-1) 55%, var(--whatsapp));
}
.brand-txt b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.brand-txt small { display: block; font-size: 11px; color: var(--ink-muted); }
.spacer { flex: 1; }

/* interruptor de tema */
.theme-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--ink-2); border: 1px solid var(--hairline); background: var(--surface);
}
.theme-btn:hover { color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

/* indicador de modo sim/real */
.mode-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 550;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
}
.mode-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
body[data-mode="real"] .mode-pill .dot { background: var(--good); }

/* ============ navegación ============ */
.rail { display: none; }
.botnav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); z-index: 35;
  display: flex; background: color-mix(in srgb, var(--plane) 92%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.botnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-muted); position: relative; min-width: 0;
}
.botnav button svg { width: 20px; height: 20px; }
.botnav button .t { font-size: 10px; font-weight: 500; }
.botnav button.active { color: var(--series-1); }
.botnav .badge {
  position: absolute; top: 4px; right: calc(50% - 17px);
  background: var(--tiktok); color: #fff; font-size: 9px; font-weight: 650;
  min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px;
}

/* ============ encabezado de vista ============ */
.vhead { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.vhead .htext { flex: 1; min-width: 0; }
.vhead .eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted);
}
.vhead h2 { font-size: 24px; margin-top: 2px; }
.vhead .act { display: flex; gap: 8px; flex-shrink: 0; }
.info {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0;
  display: grid; place-items: center; color: var(--ink-muted);
  border: 1px solid var(--hairline); background: var(--surface);
}
.info:hover { color: var(--series-1); }
.info svg { width: 15px; height: 15px; }

/* ============ tarjetas ============ */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow);
}
.card-pad-0 { padding: 0; overflow: hidden; }
.card-title { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.card + .card { margin-top: 14px; }
.two-col { display: grid; gap: 14px; }

/* ============ KPI ============ */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 15px; box-shadow: var(--shadow);
}
.kpi .lbl { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.kpi .num { font-size: 30px; font-weight: 680; letter-spacing: -.03em; line-height: 1.1; margin-top: 8px; }
.kpi .foot { font-size: 11.5px; color: var(--ink-muted); margin-top: 4px; }
.kpi.is-good .num { color: var(--good-ink); }

/* héroe: el número con el que abre el panel */
.hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero .big { font-size: 48px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.hero .unit { font-size: 15px; color: var(--ink-2); }

/* ============ gráficos ============ */
.chart { width: 100%; }
.chart-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.chart-head .htext { flex: 1; min-width: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Vista de tabla: todo gráfico necesita una lectura exacta que no dependa
   del hover, para lector de pantalla, teclado e impresión. */
.tableview { margin-top: 12px; }
.tableview > summary {
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 6px 0;
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.tableview > summary::-webkit-details-marker { display: none; }
.tableview > summary::before { content: "▸"; color: var(--ink-muted); }
.tableview[open] > summary::before { content: "▾"; }
.tableview table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.tableview th, .tableview td {
  text-align: right; padding: 6px 8px; font-size: 12.5px;
  border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums;
}
.tableview th:first-child, .tableview td:first-child { text-align: left; }
.tableview th { color: var(--ink-muted); font-weight: 600; }
.tableview .wrap { max-height: 260px; overflow-y: auto; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--surface); color: var(--ink); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 8px 11px; font-size: 12.5px; box-shadow: var(--shadow);
  max-width: 240px;
}
.tip.on { opacity: 1; }
.tip .t-title { font-weight: 650; margin-bottom: 4px; }
.tip .t-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tip .t-row .swatch { width: 9px; height: 9px; border-radius: 2px; }
.tip .t-val { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; }

/* embudo */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.fstage { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.fstage .fname { font-size: 13px; color: var(--ink-2); }
.fstage .fval { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.fstage .ftrack { grid-column: 1 / -1; height: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.fstage .fbar { height: 100%; border-radius: 4px; background: var(--series-1); transition: width .35s ease; }
.fstage.is-goal .fbar { background: var(--good); }
.fstage .fdrop { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-muted); }

/* ============ listas ============ */
.list { display: flex; flex-direction: column; }
.lrow {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--hairline); cursor: pointer; transition: background .12s;
}
.lrow:last-child { border-bottom: none; }
.lrow:hover { background: var(--surface-2); }
.lrow .lmain { flex: 1; min-width: 0; }
.lrow .lmain b { display: block; font-size: 14px; font-weight: 600; }
.lrow .lsub {
  font-size: 12.5px; color: var(--ink-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lrow .lend { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.lrow .when { font-size: 11.5px; color: var(--ink-muted); }
.section-sub {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted); padding: 14px 16px 8px;
}

/* ============ chips ============ */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 550; white-space: nowrap;
  border: 1px solid var(--hairline); background: var(--surface-2); color: var(--ink-2);
}
.chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip.gray   { color: var(--ink-muted); }
.chip.blue   { color: var(--series-1); background: var(--series-1-soft); border-color: transparent; }
.chip.teal   { color: var(--series-1); background: var(--series-1-soft); border-color: transparent; }
.chip.green  { color: var(--good-ink); background: color-mix(in srgb, var(--good) 14%, transparent); border-color: transparent; }
.chip.amber  { color: var(--ink); background: color-mix(in srgb, var(--warning) 26%, transparent); border-color: transparent; }
.chip.pink   { color: var(--tiktok); background: color-mix(in srgb, var(--tiktok) 13%, transparent); border-color: transparent; }

/* ============ botones ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 15px; border-radius: var(--r); font-size: 14px; font-weight: 550;
  transition: .14s; white-space: nowrap; border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--series-1); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--hairline); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-conv { background: var(--whatsapp); color: #fff; }
.btn-danger { background: var(--critical); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;            /* en móvil, 100vh se pasa por la barra del navegador */
  display: grid; place-items: center;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  position: relative; overflow: hidden;
}
/* Fondo: un halo muy tenue con los colores de marca. Da identidad sin ruido. */
.login-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 45% at 15% 0%,  color-mix(in srgb, var(--tiktok) 14%, transparent), transparent 70%),
    radial-gradient(55% 45% at 90% 100%, color-mix(in srgb, var(--whatsapp) 13%, transparent), transparent 70%);
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 396px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px; padding: 34px 30px 28px;
  box-shadow: 0 1px 2px rgba(11,11,11,.04), 0 12px 32px -12px rgba(11,11,11,.18);
}
:root[data-theme="dark"] .login-card,
:root:not([data-theme="light"]) .login-card { box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 16px 40px -16px rgba(0,0,0,.7); }

.login-head { text-align: center; margin-bottom: 26px; }
.login-head .brand-mark {
  width: 54px; height: 54px; border-radius: 15px; font-size: 24px;
  margin: 0 auto 16px; box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--series-1) 70%, transparent);
}
.login-head h1 { font-size: 21px; font-weight: 660; letter-spacing: -.02em; }
.login-head p { margin-top: 5px; font-size: 13.5px; color: var(--ink-2); }

/* campo de contraseña con botón de mostrar */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 46px !important; }
.pw-toggle {
  position: absolute; right: 8px; width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center; color: var(--ink-muted);
}
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pw-toggle svg { width: 17px; height: 17px; }
.pw-toggle .i-off { display: none; }
.pw-wrap.is-shown .pw-toggle .i-on  { display: none; }
.pw-wrap.is-shown .pw-toggle .i-off { display: block; }

.login-error {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 9px;
  font-size: 12.5px; color: var(--critical);
}
.login-error svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

.login-hint {
  display: none; align-items: center; gap: 7px; margin-top: 9px;
  font-size: 12.5px; color: var(--ink-2);
}
.login-hint.on { display: flex; }
.login-hint svg { width: 15px; height: 15px; color: var(--warning); flex-shrink: 0; }

.login-btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.login-btn[disabled] { opacity: .55; cursor: not-allowed; }

.login-foot {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--hairline);
  font-size: 12px; color: var(--ink-muted); text-align: center; line-height: 1.5;
}
.login-theme { position: absolute; top: 16px; right: 16px; z-index: 2; }

@media (max-width: 380px) {
  .login-card { padding: 28px 22px 24px; border-radius: 16px; }
  .login-head .brand-mark { width: 48px; height: 48px; font-size: 21px; }
  .login-head h1 { font-size: 19px; }
}

/* ============ zona de borrado ============
   Separada del formulario y con su propio color: una acción destructiva no
   debe quedar al lado de "Guardar" ni poder dispararse pulsando Enter. */
.danger-zone {
  margin-top: 28px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--critical) 35%, transparent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--critical) 6%, var(--surface));
}
.danger-zone b { font-weight: 620; }
.dz-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.dz-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dz-row > div { flex: 1; min-width: 200px; }
.dz-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.dz-actions .btn { flex: 1; min-width: 140px; }

/* ============ formularios ============ */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 13.5px; font-weight: 550; display: flex; align-items: center; gap: 7px; }
.field label .qm {
  width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center;
  font-size: 11px; color: var(--ink-muted); border: 1px solid var(--hairline);
  background: var(--surface-2); cursor: pointer; flex-shrink: 0;
}
.field label .qm:hover { color: var(--series-1); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font-size: 14px;
  background: var(--plane); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--r); transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--series-1);
  box-shadow: 0 0 0 3px var(--series-1-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-muted); }
.field textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.inp-mono { font-size: 13.5px; }
.mask { color: var(--ink-muted); letter-spacing: .5px; }
.mono { font-size: 13px; color: var(--ink-2); }
.toggle {
  position: relative; width: 44px; height: 26px; border-radius: 20px;
  background: var(--axis); transition: .2s; flex-shrink: 0; cursor: pointer;
}
.toggle.on { background: var(--good); }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: .2s;
}
.toggle.on::after { left: 21px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* pestañas */
.tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: var(--surface-2); border-radius: var(--r); border: 1px solid var(--hairline);
}
.tab {
  flex: 1; padding: 9px; border-radius: var(--r-sm); font-size: 13px; font-weight: 550;
  color: var(--ink-muted); text-align: center; transition: .15s;
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* buscador */
.searchbox { position: relative; display: flex; align-items: center; margin-bottom: 12px; }
.searchbox > svg {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--ink-muted); pointer-events: none;
}
.searchbox input {
  width: 100%; padding: 11px 40px; font-size: 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--r); transition: .15s;
}
.searchbox input:focus { outline: none; border-color: var(--series-1); box-shadow: 0 0 0 3px var(--series-1-soft); }
.searchbox input::placeholder { color: var(--ink-muted); }
.searchbox input::-webkit-search-cancel-button { display: none; }
.searchbox button {
  position: absolute; right: 9px; width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; color: var(--ink-muted);
}
.searchbox button:hover { color: var(--ink); background: var(--surface-2); }
.searchbox button svg { width: 14px; height: 14px; }

/* ============ avisos ============ */
.banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: var(--r); font-size: 13px; margin-bottom: 16px;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
}
.banner svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.banner.warn { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.banner.warn svg { color: var(--warning); }
.banner.info svg { color: var(--series-1); }
.banner b { color: var(--ink); }
.simbanner { /* compatibilidad con las vistas Livewire */
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--r); font-size: 13px; margin-bottom: 16px;
  border: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--good) 12%, var(--surface));
  color: var(--ink-2);
}
.simbanner svg { width: 17px; height: 17px; flex-shrink: 0; }
body[data-mode="real"] .hide-on-real { display: none; }

/* ============ conversación ============ */
.thread-head { padding: 14px 16px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 11px; }
.avt {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 14px; font-weight: 650; color: #fff;
  background: linear-gradient(140deg, var(--tiktok), #a8123a);
}
.thread { padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 54vh; overflow-y: auto; }
.msg { max-width: 84%; padding: 10px 13px; border-radius: 13px; font-size: 14px; line-height: 1.5; }
.msg .meta { display: block; font-size: 10.5px; opacity: .7; margin-top: 5px; }
.msg.in { background: var(--surface-2); border: 1px solid var(--hairline); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--series-1); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.wa { background: var(--whatsapp); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.sys { align-self: center; background: none; color: var(--ink-muted); font-size: 12px; max-width: 100%; text-align: center; padding: 2px; }
.meta-list { display: flex; flex-direction: column; gap: 14px; }
.meta-item .k { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); }
.meta-item .v { margin-top: 4px; font-size: 14px; }
.detail-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; font-weight: 550; margin-bottom: 16px; }
.detail-back:hover { color: var(--ink); }
.detail-back svg { width: 16px; height: 16px; }

/* ============ videos ============ */
.vgrid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.vcard {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.vcard:hover { transform: translateY(-2px); border-color: var(--axis); }
.vthumb { height: 104px; display: grid; place-items: center; position: relative; color: rgba(255,255,255,.6); }
.vtype {
  position: absolute; top: 9px; left: 9px; font-size: 10px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.5); color: #fff; backdrop-filter: blur(4px);
}
.vhot {
  position: absolute; top: 9px; right: 9px; font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; background: var(--good); color: #fff;
}
.vbody { padding: 14px; }
.vbody .vt { font-size: 14px; font-weight: 620; line-height: 1.35; margin-bottom: 10px; }
.vmetrics { display: flex; gap: 16px; flex-wrap: wrap; }
.vmetric { font-size: 12px; color: var(--ink-muted); display: flex; align-items: center; gap: 5px; }
.vmetric b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.vmetric.conv b { color: var(--good-ink); }
.acct-head { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff; }

/* ============ vacíos ============ */
.empty-state { text-align: center; padding: 40px 18px; color: var(--ink-2); }
.empty-state svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--ink-muted); display: inline-block; }
.empty-state p { font-size: 13.5px; }

/* ============ modal ============ */
.modal-ov {
  display: none; position: fixed; inset: 0; z-index: 60; padding: 0;
  background: rgba(11,11,11,.5); backdrop-filter: blur(3px);
  align-items: flex-end; justify-content: center;
}
.modal-ov.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 18px 18px 0 0; width: 100%; max-width: 540px; max-height: 84vh;
  overflow-y: auto; padding: 8px 22px 28px; position: relative;
  animation: sheet .26s cubic-bezier(.2,.8,.3,1);
}
@keyframes sheet { from { transform: translateY(24px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }
.modal-grip { width: 38px; height: 4px; border-radius: 3px; background: var(--axis); margin: 10px auto 18px; }
.modal h3 { font-size: 18px; margin-bottom: 10px; padding-right: 34px; }
.modal .mbody { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.modal .mbody p { margin-bottom: 10px; }
.modal .mbody strong { color: var(--ink); font-weight: 620; }
.modal .close { position: absolute; right: 16px; top: 18px; }

/* ============ ESCRITORIO ============ */
@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; }
  .vgrid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  body { font-size: 15px; }
  .app { flex-direction: row; }
  .botnav { display: none; }
  .topbar { display: none; }
  .content { padding: 28px 32px 48px; }
  .vgrid { grid-template-columns: repeat(3, 1fr); }

  .rail {
    display: flex; flex-direction: column; width: 236px; flex-shrink: 0;
    border-right: 1px solid var(--hairline); background: var(--surface);
    position: sticky; top: 0; height: 100vh;
  }
  .rail .brand { padding: 20px 18px; border-bottom: 1px solid var(--hairline); }
  .rail-nav { padding: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
  .rail-label {
    font-size: 10.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
    color: var(--ink-muted); padding: 14px 10px 6px;
  }
  .rail-item {
    display: flex; align-items: center; gap: 11px; padding: 9px 11px;
    border-radius: var(--r-sm); color: var(--ink-2); font-size: 14px; font-weight: 500;
    width: 100%; text-align: left; transition: .14s;
  }
  .rail-item:hover { background: var(--surface-2); color: var(--ink); }
  .rail-item.active { background: var(--series-1-soft); color: var(--series-1); font-weight: 600; }
  .rail-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  .rail-item .count {
    margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums;
    color: var(--ink-muted); background: var(--surface-2); padding: 1px 7px; border-radius: 20px;
  }
  .rail-item.active .count { background: var(--surface); color: var(--series-1); }
  .rail-foot { padding: 12px; border-top: 1px solid var(--hairline); display: flex; align-items: center; gap: 8px; }

  .modal-ov { align-items: center; padding: 24px; }
  .modal { border-radius: var(--r-lg); }
  .modal-grip { display: none; }
  .thread { max-height: 460px; }
  .split { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
}

/* filas apiladas en pantallas muy estrechas */
@media (max-width: 380px) {
  .vhead h2 { font-size: 21px; }
  .kpi .num { font-size: 26px; }
  .hero .big { font-size: 40px; }
  .content { padding-left: 13px; padding-right: 13px; }
}

@media print {
  .botnav, .rail, .topbar, .info, .theme-btn { display: none !important; }
  .view { display: block !important; }
  .card { box-shadow: none; break-inside: avoid; }
}
