/* ============================================================================
   VioletWave Prospector — Design System "Command Center" (dark, mobile-first)
   Rediseño 2026-06-22. Un solo stylesheet: tokens + base + shell + componentes.
   No frameworks. Las clases las consumen los templates Jinja2 + app.js.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700;800;900&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

/* ---- Tokens ---------------------------------------------------------------
   Paleta portada 1:1 del sitio violetwaveai.com (Equipo de Desarrollo Web →
   apps/violet-wave/src/index.css, bloque html.vw-home). Las superficies están
   TEÑIDAS de violeta (no son grises neutros) y hay dos acentos secundarios
   —magenta y lavanda— más un lime de señal. Eso es lo que le da el aire tech.
   --------------------------------------------------------------------------- */
:root {
  /* Marca Violet Wave */
  --brand: #753BBD;          /* violeta oficial */
  --brand-2: #9B5CE0;        /* violet-sat */
  --brand-deep: #1a0830;     /* violet-deep */
  --brand-grad: linear-gradient(135deg, #753BBD 0%, #9B5CE0 50%, #4b2a8a 100%);
  --grad-magenta: linear-gradient(135deg, #c026d3 0%, #753BBD 60%, #4b2a8a 100%);
  --grad-aurora: radial-gradient(ellipse 90% 70% at 50% 110%, rgba(117,59,189,0.55) 0%, rgba(117,59,189,0.18) 45%, transparent 70%);

  /* Segundo acento: magenta. Tercer acento: lavanda. Señal: lime. */
  --magenta: #c026d3;
  --magenta-sat: #e040fb;
  --magenta-soft: rgba(192, 38, 211, 0.14);
  --magenta-line: rgba(192, 38, 211, 0.38);
  --lavender: #b99df5;
  --lime: #a3e635;

  /* Superficies del sitio: void → charcoal → graphite → slate → iron */
  --bg: #06060f;
  --bg-elev: #0d0c1a;
  --surface-1: #14132b;
  --surface-2: #1a1740;
  --surface-3: #2d2a52;
  --indigo-mid: #1a1540;
  --hairline: rgba(240, 238, 248, 0.08);
  --hairline-2: rgba(117, 59, 189, 0.30);

  /* Texto */
  --text: #f0eef8;
  --text-muted: rgba(240, 238, 248, 0.65);
  --text-dim: rgba(240, 238, 248, 0.35);

  /* Acento interactivo */
  --accent: #753BBD;
  --accent-bright: #9B5CE0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(117, 59, 189, 0.16);
  --accent-line: rgba(117, 59, 189, 0.45);

  /* Semánticos */
  --success: #34D8A0; --success-soft: rgba(52, 216, 160, 0.14);
  --warn: #F5B544;    --warn-soft: rgba(245, 181, 68, 0.14);
  --danger: #FF5C7A;  --danger-soft: rgba(255, 92, 122, 0.14);
  --info: #6AA8FF;    --info-soft: rgba(106, 168, 255, 0.14);
  --wa: #25D366;      --wa-soft: rgba(37, 211, 102, 0.14);

  /* Compat: los templates viejos usan estos nombres — los mapeo al sistema nuevo */
  --color-primary: var(--accent); --color-primary-hover: var(--accent-bright);
  --color-primary-bg: var(--accent-soft);
  --color-success: var(--success); --color-danger: var(--danger);
  --color-warning: var(--warn); --color-info: var(--info);
  --color-whatsapp: var(--wa);
  --color-bg: var(--bg); --color-bg-card: var(--surface-2); --color-bg-sidebar: var(--surface-1);
  --color-text: var(--text); --color-text-secondary: var(--text-muted); --color-text-muted: var(--text-dim);
  --color-border: var(--hairline); --color-border-light: var(--hairline);
  --shadow-sm: var(--shadow-1);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --z-overlay: 55; --z-panel: 60; --z-modal: 80;

  /* Radios */
  --r-xs: 8px; --r-sm: 10px; --r: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

  /* Sombras difusas (nada de drop shadows duras) */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.6);
  --shadow-2: 0 2px 4px rgba(0,0,0,0.4), 0 24px 48px -16px rgba(0,0,0,0.7);
  --glow: 0 0 0 1px var(--accent-line), 0 8px 30px -8px rgba(124,92,255,0.5);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,0.06);

  /* Tipografía — la misma tríada del sitio: Outfit (display+UI) +
     Cormorant Garamond italic (cifras/acentos editoriales) + JetBrains Mono (data/labels) */
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Outfit', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-editorial: 'Cormorant Garamond', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Motion */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms; --t: 240ms; --t-slow: 420ms;

  --sidebar-w: 250px;
  --topbar-h: 58px;
}

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
/* Fondo WebGL vivo (aurora violeta) detrás de todo + scrim sutil para contraste de texto */
#bg-shader { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; display: block; pointer-events: none; }
body.app #bg-shader { opacity: 0.55; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,7,18,0.18) 0%, rgba(8,7,18,0.42) 60%, rgba(8,7,18,0.62) 100%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #2e2e3c; background-clip: content-box; }

/* ============================================================================
   SHELL — sidebar (desktop) + topbar/drawer (mobile)
   ============================================================================ */
.app { min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface-1), var(--bg-elev));
  border-right: 1px solid var(--hairline);
  padding: 18px 14px;
  transition: transform var(--t) var(--ease);
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; margin-bottom: 6px; }
/* Isotipo Violet Wave (la onda) en un chip violeta profundo → la onda blanca resalta */
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(150deg, #2C1650, #170F2A);
  border: 1px solid var(--accent-line);
  box-shadow: 0 6px 20px -8px rgba(117,59,189,0.6), var(--inset-hi), inset 0 0 22px -8px rgba(139,75,216,0.55);
  display: grid; place-items: center; overflow: hidden;
}
.brand-mark img { width: 27px; height: 27px; object-fit: contain; }
/* Fallback texto (si algún template todavía usa la letra) */
.brand-mark:not(:has(img)) { color: #fff; font-weight: 800; font-size: 15px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; }
.brand-name b { color: var(--brand-2); font-weight: 800; }
/* Lockup oficial de Violet Wave (isotipo + wordmark) */
.brand-lockup { height: 27px; width: auto; max-width: 100%; object-fit: contain; display: block; }
.auth-brand .brand-lockup { height: 34px; }

.nav { display: flex; flex-direction: column; gap: 2px; list-style: none; padding: 0; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); padding: 14px 12px 6px; font-weight: 600; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav a .ic { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.035); }
.nav a.active { color: var(--text); background: var(--accent-soft); }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.nav-badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
}
.nav-badge.amber { background: var(--warn); color: #1a1206; }

.sidebar-foot { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.wa-link { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--wa); background: var(--wa-soft); transition: filter var(--t-fast); }
.wa-link:hover { filter: brightness(1.15); }
.acct { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-weight: 700; font-size: 13px; border: 1px solid var(--hairline-2); }
.acct .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.acct .who b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct .who small { font-size: 11px; color: var(--text-dim); }
.acct form { margin-left: auto; }
.logout { color: var(--text-dim); font-size: 12.5px; font-weight: 600; padding: 6px 8px; border-radius: 8px; transition: color var(--t-fast), background var(--t-fast); }
.logout:hover { color: var(--danger); background: var(--danger-soft); }

/* Topbar (solo mobile) */
.topbar {
  display: none; position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  align-items: center; gap: 12px; padding: 0 14px;
  background: rgba(10,10,15,0.72); backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--hairline);
}
.hamb { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--text); border: 1px solid var(--hairline); background: var(--surface-2); }
.hamb svg { width: 20px; height: 20px; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(5,5,8,0.6); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity var(--t) var(--ease), visibility var(--t); }

/* Contenido */
.content { margin-left: var(--sidebar-w); min-height: 100dvh; }
.content > .inner { max-width: 1240px; margin: 0 auto; padding: 30px 30px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 27px; font-weight: 800; background: linear-gradient(180deg, #FFFFFF 30%, #C9BEEB); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head .sub { color: var(--text-muted); font-size: 14px; margin-top: 5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Job bar global */
.jobbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-bright); border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }

/* ============================================================================
   COMPONENTES
   ============================================================================ */
.card { background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow-1), var(--inset-hi); padding: 20px; }
.card.tight { padding: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { position: relative; font-size: 16px; font-weight: 700; padding-left: 12px; }
/* Barra de acento de marca antes del título de sección */
.card-head h3::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 15px; border-radius: 3px; background: var(--brand-grad); }
.card-head .hint { color: var(--accent-bright); font-size: 12.5px; font-weight: 600; transition: filter var(--t-fast); }
.card-head a.hint:hover { filter: brightness(1.15); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat { position: relative; background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px 18px 16px; box-shadow: var(--shadow-1), var(--inset-hi); overflow: hidden; transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
/* Glow de marca en la esquina — le da vida al card */
.stat::before { content: ""; position: absolute; right: -34px; top: -34px; width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.stat:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-2), var(--inset-hi); }
.stat .ic-wrap { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-bright); margin-bottom: 14px; box-shadow: inset 0 0 0 1px var(--accent-line); }
.stat .ic-wrap svg { width: 19px; height: 19px; }
.stat .num { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat .lbl { color: var(--text-muted); font-size: 13px; margin-top: 7px; font-weight: 500; }
.stat .delta { font-size: 12px; font-weight: 600; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; user-select: none; transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), filter var(--t-fast), box-shadow var(--t-fast); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand-grad); background-size: 140% 140%; color: #fff; box-shadow: 0 6px 22px -8px rgba(117,59,189,0.7), var(--inset-hi), 0 0 0 1px var(--accent-line); }
.btn-primary:hover { filter: brightness(1.08); background-position: 100% 0; }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--hairline-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: var(--accent-soft); color: var(--accent-bright); border-color: var(--accent-line); }
.btn-soft:hover { filter: brightness(1.12); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(255,92,108,0.35); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-wa { background: var(--wa); color: #04210f; }
.btn-wa:hover { filter: brightness(1.08); }
.btn.sm { height: 33px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn .pip { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.18); display: grid; place-items: center; margin-right: -6px; transition: transform var(--t-fast) var(--ease); }
.btn:hover .pip { transform: translate(2px, -1px) scale(1.05); }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text-muted); }
.btn-icon:hover { color: var(--text); background: var(--surface-3); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em; background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--hairline); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-bright); border-color: transparent; }
.eyebrow { display: inline-block; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600; color: var(--accent-bright); }

.table-wrap { border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; background: var(--surface-1); box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: var(--text-dim); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--hairline); color: var(--text); vertical-align: middle; }
table.data tbody tr { transition: background var(--t-fast); }
table.data tbody tr:hover { background: rgba(255,255,255,0.025); }
table.data tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-muted); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.input, .select, .textarea { width: 100%; background: var(--bg-elev); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 0 14px; height: 44px; font-size: 15px; color: var(--text); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface-1); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239A9AA8' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-dim); pointer-events: none; }
.search-input .input { padding-left: 40px; }

.modal-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(5,5,8,0.66); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 18px; opacity: 0; visibility: hidden; transition: opacity var(--t) var(--ease), visibility var(--t); }
.modal-scrim.open { opacity: 1; visibility: visible; }
.modal { width: 100%; max-width: 520px; background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline-2); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 24px; max-height: 88dvh; overflow-y: auto; transform: translateY(12px) scale(0.98); transition: transform var(--t-slow) var(--ease-out); }
.modal-scrim.open .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { font-size: 19px; }

.empty { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty .ic { width: 66px; height: 66px; border-radius: 19px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-bright); box-shadow: 0 0 44px -12px rgba(117,59,189,0.55), var(--inset-hi); }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 340px; margin: 0 auto; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================================
   CHAT (Conversaciones IA)
   ============================================================================ */
.chat { display: grid; grid-template-columns: 340px 1fr; gap: 16px; height: calc(100dvh - 150px); min-height: 460px; }
.chat-list { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.chat-list .head { padding: 14px; border-bottom: 1px solid var(--hairline); }
.chat-list .scroll { overflow-y: auto; flex: 1; }
.conv-item { display: flex; flex-direction: column; padding: 13px 14px; border-bottom: 1px solid var(--hairline); cursor: pointer; transition: background var(--t-fast); }
.conv-item:hover { background: rgba(255,255,255,0.03); }
.conv-item.active { background: var(--accent-soft); }
.conv-item .who { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.conv-item .who time { color: var(--text-dim); font-size: 11px; font-weight: 500; }
.conv-item .last { color: var(--text-muted); font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }

.thread { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.thread .head { padding: 14px 18px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 12px; }
.thread .stream { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: radial-gradient(60vw 40vh at 50% 0, rgba(124,92,255,0.04), transparent 70%); }
.msg { max-width: 76%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-1); }
.msg time { display: block; font-size: 10.5px; margin-top: 5px; opacity: 0.6; }
.msg.in { align-self: flex-start; background: var(--surface-3); border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: linear-gradient(160deg, var(--accent), #6b51e0); color: #fff; border-bottom-right-radius: 5px; }
.msg.out.human { background: linear-gradient(160deg, #2b8a5b, #1f6b46); }
.composer { padding: 12px; border-top: 1px solid var(--hairline); display: flex; gap: 10px; align-items: flex-end; }
.composer .textarea { min-height: 44px; max-height: 140px; }
.chat-back { display: none; }

/* ============================================================================
   LOGIN — split-screen (lienzo de marca + formulario)
   ============================================================================ */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 0.95fr; }

.auth-brand {
  position: relative; overflow: hidden; padding: 46px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  background: radial-gradient(130% 100% at 12% 8%, #2C1652 0%, #17102E 52%, #0B0817 100%);
  border-right: 1px solid var(--hairline-2);
}
.auth-brand > * { position: relative; z-index: 2; }
.auth-brand .ab-mid { max-width: 30ch; }
.auth-brand .ab-mid .eyebrow { margin-bottom: 14px; }
.auth-brand .ab-mid h2 { font-size: clamp(26px, 3vw, 37px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; text-wrap: balance; }
.auth-brand .ab-mid p { margin-top: 16px; color: var(--text-muted); font-size: 15.5px; max-width: 42ch; }
.auth-brand .ab-pipe { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.auth-brand .ab-pipe span { font-size: 12.5px; font-weight: 600; color: var(--text); padding: 7px 13px; border-radius: 999px; background: rgba(255,255,255,0.045); border: 1px solid var(--hairline-2); }
.auth-brand .ab-pipe i { color: var(--brand-2); font-style: normal; font-weight: 700; }
.auth-brand .ab-foot { color: var(--text-dim); font-size: 12.5px; letter-spacing: 0.03em; text-transform: uppercase; }
.auth-brand .ab-wave { position: absolute; inset: auto -6% -10% -6%; width: 112%; height: 66%; z-index: 1; opacity: 0.95; }

.auth-form { position: relative; display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-form::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(48vw 42vh at 92% -4%, rgba(117,59,189,0.12), transparent 60%); }
.af-inner { position: relative; width: 100%; max-width: 384px; }
.af-mini { display: none; margin-bottom: 26px; padding: 0; }
.auth-form h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-form .sub { color: var(--text-muted); font-size: 14.5px; margin: 7px 0 28px; }
.auth-form .err { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255,92,122,0.3); border-radius: var(--r-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 18px; }
.auth-form .field > label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; }
.auth-form .input { height: 48px; }
.af-note { margin-top: 22px; color: var(--text-dim); font-size: 12px; }

/* input con botón sufijo (toggle contraseña) */
.input-affix { position: relative; }
.input-affix .input { padding-right: 46px; }
.affix-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-dim); transition: color var(--t-fast), background var(--t-fast); }
.affix-btn:hover { color: var(--text-muted); background: var(--surface-2); }
.affix-btn svg { width: 18px; height: 18px; }
.affix-btn.on { color: var(--accent-bright); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .af-mini { display: flex; }
}

/* ---- helpers -------------------------------------------------------------- */
.muted { color: var(--text-muted); } .dim { color: var(--text-dim); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mono { font-family: var(--mono); }
.hide { display: none !important; }
.mt-2{margin-top:8px}.mt-3{margin-top:14px}.mt-4{margin-top:22px}.mb-3{margin-bottom:14px}

/* ============================================================================
   DASHBOARD — rediseño: funnel visualizado + roster de vendedores
   ============================================================================ */
/* Hero: número que importa + onda de marca */
.dash-hero { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(115deg, #1B1436 0%, #17122B 55%, #120E22 100%);
  border: 1px solid var(--hairline-2); border-radius: var(--r-xl); padding: 26px 28px; margin-bottom: 20px; overflow: hidden;
  box-shadow: var(--shadow-2), inset 0 0 60px -30px rgba(139,75,216,0.6); }
.dash-hero::after { content: ""; position: absolute; right: -6%; top: -40%; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(117,59,189,0.4), transparent 68%); pointer-events: none; }
.dash-hero .h-main { position: relative; z-index: 1; }
.dash-hero .h-eyebrow { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brand-2); font-weight: 700; }
.dash-hero .h-num { font-family: var(--mono); font-size: 46px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; margin: 8px 0 2px;
  background: linear-gradient(180deg, #fff, #C9BEEB); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dash-hero .h-sub { color: var(--text-muted); font-size: 14px; }
.dash-hero .h-rates { position: relative; z-index: 1; display: flex; gap: 26px; }
.dash-hero .h-rate { text-align: right; }
.dash-hero .h-rate b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--text); }
.dash-hero .h-rate span { font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.02em; }
/* onda decorativa */
.dash-wave { position: absolute; left: 0; right: 0; bottom: -2px; height: 46px; z-index: 0; opacity: 0.5; pointer-events: none; }

/* Gráfico de actividad (área + línea, dark-first) */
.actv { padding: 20px 22px 16px; }
.actv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.actv-kpis { display: flex; gap: 26px; }
.actv-kpi { display: flex; flex-direction: column; gap: 2px; }
.actv-kpi b { font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.actv-kpi span { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.actv-legend { display: flex; gap: 16px; }
.actv-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); font-weight: 500; }
.actv-legend i { width: 11px; height: 4px; border-radius: 2px; }
.actv-chart { width: 100%; min-height: 214px; }
.actv-chart svg { display: block; width: 100%; }
.actv-chart .grid { stroke: var(--hairline); stroke-width: 1; }
.actv-chart .axis-lbl { fill: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.actv-chart .dot-end { filter: drop-shadow(0 0 6px rgba(169,111,240,0.9)); }

/* Funnel vertical que se angosta */
.funnel { display: flex; flex-direction: column; gap: 9px; }
.funnel-row { display: grid; grid-template-columns: 168px 1fr 92px; align-items: center; gap: 16px; }
.funnel-row .f-label { display: flex; align-items: center; gap: 10px; }
.funnel-row .f-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-bright); box-shadow: inset 0 0 0 1px var(--accent-line); }
.funnel-row .f-ic svg { width: 17px; height: 17px; }
.funnel-row .f-name { font-size: 13.5px; font-weight: 600; }
.funnel-row .f-name small { display: block; color: var(--text-dim); font-size: 11px; font-weight: 500; }
.funnel-track { height: 46px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--hairline); overflow: hidden; position: relative; }
.funnel-fill { height: 100%; border-radius: 11px; background: var(--brand-grad); display: flex; align-items: center; justify-content: flex-end;
  padding-right: 14px; min-width: 62px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 0 24px -10px rgba(139,75,216,0.9);
  transition: width 900ms var(--ease-out); position: relative; }
.funnel-fill .f-count { font-family: var(--mono); font-size: 18px; font-weight: 600; color: #fff; letter-spacing: -0.02em; }
.funnel-fill.tier-2 { background: linear-gradient(140deg, #8A4FD2, #6A34B0); }
.funnel-fill.tier-3 { background: linear-gradient(140deg, #A06BE0, #7C46C4); }
.funnel-fill.tier-4 { background: linear-gradient(140deg, var(--success), #1f9e72); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 0 24px -10px rgba(52,216,160,0.9); }
.funnel-conv { text-align: right; }
.funnel-conv b { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--text); }
.funnel-conv span { display: block; font-size: 10.5px; color: var(--text-dim); }
.funnel-conv.top b { color: var(--text-dim); font-weight: 500; font-size: 12px; }

/* Roster de vendedores como cards con mini-funnel */
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.vendor-card { position: relative; display: block; background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1), var(--inset-hi); cursor: pointer;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease); }
.vendor-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.vendor-card .vc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.vendor-card .vc-kebab { position: absolute; top: 13px; right: 12px; z-index: 3; }
.vendor-card .vc-head { padding-right: 34px; }
.vendor-card .vc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.vendor-card .vc-av { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 6px 16px -8px rgba(117,59,189,0.7), var(--inset-hi); }
.vendor-card .vc-id { min-width: 0; flex: 1; }
.vendor-card .vc-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vendor-card .vc-meta { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.vendor-card .vc-niche { text-transform: capitalize; }
.vmf { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--bg-elev); margin: 4px 0 12px; gap: 2px; }
.vmf i { display: block; height: 100%; }
.vmf .s1 { background: var(--brand-2); } .vmf .s2 { background: var(--brand); } .vmf .s3 { background: var(--warn); } .vmf .s4 { background: var(--success); }
.vendor-card .vc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vendor-card .vc-num { background: var(--bg-elev); border: 1px solid var(--hairline); border-radius: 11px; padding: 10px 12px; }
.vendor-card .vc-num b { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -0.03em; display: block; }
.vendor-card .vc-num span { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.vendor-card .vc-num.win b { color: var(--success); }

@media (max-width: 720px) {
  .dash-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .dash-hero .h-rates { gap: 20px; }
  .dash-hero .h-rate { text-align: left; }
  .funnel-row { grid-template-columns: 44px 1fr 66px; gap: 10px; }
  .funnel-row .f-name { display: none; }
}

/* ============================================================================
   MOTION — reveals on-scroll (vanilla, a prueba de FOUC) + number ticker
   Patrón del playbook de Desarrollo Web: visible por default; el JS agrega
   `reveals-armed` y luego IntersectionObserver pone `.is-in`. Movimiento MÍNIMO
   (fade + translateY chico), nunca scale-zoom en elementos grandes.
   ============================================================================ */
.reveal { transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
html.reveals-armed .reveal:not(.is-in) { opacity: 0; transform: translateY(18px); }
.reveal.is-in { opacity: 1 !important; transform: none !important; }
/* stagger opcional para grillas */
html.reveals-armed .reveal[data-d="1"] { transition-delay: 0.05s; }
html.reveals-armed .reveal[data-d="2"] { transition-delay: 0.10s; }
html.reveals-armed .reveal[data-d="3"] { transition-delay: 0.15s; }
html.reveals-armed .reveal[data-d="4"] { transition-delay: 0.20s; }
@media (prefers-reduced-motion: reduce) {
  html.reveals-armed .reveal:not(.is-in) { opacity: 1; transform: none; }
}

/* ============================================================================
   GLASSMORPHISM (paneles translúcidos sobre la aurora WebGL) + tipografía display
   ============================================================================ */
.sidebar { background: linear-gradient(180deg, rgba(19,16,42,0.72), rgba(11,9,24,0.76)); -webkit-backdrop-filter: blur(22px) saturate(135%); backdrop-filter: blur(22px) saturate(135%); }
.card, .stat, .vendor-card { background: linear-gradient(180deg, rgba(30,26,58,0.60), rgba(20,17,42,0.64)); -webkit-backdrop-filter: blur(18px) saturate(125%); backdrop-filter: blur(18px) saturate(125%); }
.dash-hero { -webkit-backdrop-filter: blur(20px) saturate(125%); backdrop-filter: blur(20px) saturate(125%); }
.table-wrap { background: rgba(18,16,40,0.52); -webkit-backdrop-filter: blur(16px) saturate(120%); backdrop-filter: blur(16px) saturate(120%); }
.funnel-track { background: rgba(10,9,22,0.5); }
.modal, .kebab-menu, .modal-overlay .modal { -webkit-backdrop-filter: blur(26px) saturate(135%); backdrop-filter: blur(26px) saturate(135%); }
/* Login: el lienzo de marca deja pasar la aurora */
.auth-brand { background: linear-gradient(130deg, rgba(40,23,78,0.48) 0%, rgba(20,14,42,0.55) 52%, rgba(11,8,24,0.62) 100%); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* Tipografía display (Space Grotesk) en títulos, marca y eyebrows */
h1, h2, h3, h4, .brand-name, .page-head h1, .card-head h3,
.auth-form h1, .auth-brand .ab-mid h2 { font-family: var(--font-display); letter-spacing: -0.01em; }
.brand-name { letter-spacing: 0.03em; }

/* ---- Command palette (⌘K) ---- */
.cmdk-trigger { display: flex; align-items: center; gap: 9px; width: 100%; margin: 2px 0 10px; padding: 9px 11px; border-radius: var(--r-sm);
  background: rgba(255,255,255,0.03); border: 1px solid var(--hairline); color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.cmdk-trigger:hover { background: rgba(255,255,255,0.06); color: var(--text); border-color: var(--hairline-2); }
.cmdk-trigger svg { width: 15px; height: 15px; opacity: 0.8; }
.cmdk-trigger .kbd { margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--text-dim);
  background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; }

.cmdk-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(6,5,14,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center; padding-top: 13vh; }
.cmdk-scrim.open { display: flex; animation: cmdk-fade var(--t-fast) var(--ease-out); }
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk { width: min(580px, 92vw); background: rgba(24,21,46,0.82); -webkit-backdrop-filter: blur(30px) saturate(140%); backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid var(--hairline-2); border-radius: var(--r-lg); box-shadow: var(--shadow-2), 0 0 70px -18px rgba(117,59,189,0.6);
  overflow: hidden; transform: translateY(-8px) scale(0.99); animation: cmdk-in var(--t) var(--ease-out) forwards; }
@keyframes cmdk-in { to { transform: none; } }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--hairline); }
.cmdk-input input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 16px; font-family: var(--font); }
.cmdk-input input::placeholder { color: var(--text-dim); }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text); font-size: 14px; font-weight: 500; }
.cmdk-item .k-ic { width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-bright); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cmdk-item .k-hint { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-item.active .k-hint { color: var(--accent-bright); }
.cmdk-empty { padding: 26px; text-align: center; color: var(--text-muted); font-size: 14px; }
.cmdk-foot { padding: 9px 14px; border-top: 1px solid var(--hairline); font-size: 11.5px; color: var(--text-dim); display: flex; gap: 16px; align-items: center; }
.cmdk-hintkey { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; }

/* ---- Grain de film (feTurbulence, cero requests) — textura sutil sobre todo ---- */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Línea de acento que crece en hover (micro-interacción premium) ---- */
.vendor-card::after {
  content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 2px; border-radius: 0 0 2px 2px;
  background: var(--brand-grad); transform: scaleX(0); transform-origin: left; transition: transform 0.38s var(--ease-out); pointer-events: none;
}
.vendor-card:hover::after { transform: scaleX(1); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .chat { grid-template-columns: 300px 1fr; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 56px; }
  .topbar { display: flex; }
  .sidebar { transform: translateX(-104%); box-shadow: var(--shadow-2); width: min(86vw, 320px); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; visibility: visible; }
  .content { margin-left: 0; }
  .content > .inner { padding: 18px 16px 96px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }

  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }

  /* Tablas → cards apiladas */
  .table-wrap { border: none; background: none; box-shadow: none; overflow: visible; }
  table.data, table.data thead, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tbody tr { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r); margin-bottom: 12px; padding: 6px 4px; box-shadow: var(--shadow-1); }
  table.data tbody td { border: none; padding: 9px 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; }
  table.data tbody td::before { content: attr(data-label); color: var(--text-dim); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; text-align: left; flex: none; }
  table.data tbody td[data-label=""]::before { content: none; }

  /* Chat: lista u hilo (no ambos) */
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 120px); }
  .chat.view-thread .chat-list { display: none; }
  .chat:not(.view-thread) .thread { display: none; }
  .chat-back { display: inline-grid; }
}

@media (max-width: 460px) {
  body { font-size: 14.5px; }
  .content > .inner { padding: 14px 12px 96px; }
  .stat .num { font-size: 26px; }
  .msg { max-width: 86%; }
  .modal { padding: 20px 16px; border-radius: var(--r-lg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* iOS: inputs ≥16px en mobile para que no haga zoom al focus */
@media (max-width: 860px) { .input, .select, .textarea, .composer .textarea { font-size: 16px; } }

/* ============================================================================
   COMPAT — pantallas todavía no porteadas (clases viejas) sobre tema oscuro.
   Para que nada quede roto durante el rediseño gradual. Se irá borrando a
   medida que cada pantalla se porte al design system nuevo.
   ============================================================================ */
.content h2 { font-size: 18px; font-weight: 700; margin: 26px 0 14px; }
.content h2:first-child { margin-top: 0; }
/* Links de TEXTO únicamente. Cualquier <a> que sea una superficie (botón, card) queda
   fuera: si no, hereda este color y se "apaga" entero al hover (los hijos usan
   currentColor). Marcar las superficies nuevas con .surface-link o su propia clase. */
.content a:not(.btn):not(.vendor-card):not(.artifact-card):not(.surface-link) { color: var(--accent-bright); }
.content a:not(.btn):not(.vendor-card):not(.artifact-card):not(.surface-link):hover { color: var(--accent); }

/* Tablas sin .data */
.content table:not(.data) { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 8px; }
.content table:not(.data) th { text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--text-dim); padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--hairline); }
.content table:not(.data) td { padding: 11px 14px; border-bottom: 1px solid var(--hairline); color: var(--text); }
.content table:not(.data) tr:last-child td { border-bottom: none; }

/* Inputs sin clase */
.content input:not(.input):not([type=checkbox]):not([type=radio]), .content select:not(.select), .content textarea:not(.textarea) {
  background: var(--bg-elev); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); font-size: 14px; max-width: 100%; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.content input:not(.input):focus, .content select:not(.select):focus, .content textarea:not(.textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.content label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* Botones viejos (tienen base .btn) */
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--hairline-2); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-sm { height: 33px; padding: 0 12px; font-size: 13px; }

/* Badges viejos legibles + inline-status (app.js le mete color inline claro) */
.badge[class*="badge-"] { background: var(--surface-3); color: var(--text-muted); }
.inline-status { border-radius: var(--r-pill); padding: 6px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--hairline); }

/* Empty state viejo */
.empty-state { text-align: center; color: var(--text-muted); padding: 22px; }

/* Funnel viejo + secciones genéricas (fallback) */
.funnel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 8px; }
.funnel-card { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 16px; }
.funnel-value { font-family: var(--mono); font-size: 26px; font-weight: 600; }
.funnel-rate, .funnel-rate-label { color: var(--text-muted); font-size: 12.5px; }
.funnel-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.funnel-step-arrow { display: none; }
.section, .panel, .box { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 18px; margin-bottom: 16px; }

/* Tablas viejas: scroll horizontal en mobile (no se rompen) */
@media (max-width: 860px) {
  .content table:not(.data) { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---- LEGACY COMPONENTS — pantallas JS-pesadas (searches/prospects/campaigns/
   ai_agents/wa_templates/...) que reusan clases viejas. Estilizadas en oscuro
   para que se vean premium sin reescribir su JS. ---- */

/* Form-row (crear búsqueda / campaña) */
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 16px; margin-bottom: 20px; box-shadow: var(--shadow-1), var(--inset-hi); }
.form-row > div { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-row select, .form-row input { background: var(--bg-elev); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 0 12px; height: 42px; color: var(--text); font-size: 14px; }
.form-row textarea { background: var(--bg-elev); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); font-size: 14px; min-height: 42px; resize: vertical; width: 100%; }
.form-row select:focus, .form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row .col-full { flex-basis: 100%; }
.input-sm { max-width: 120px; }
@media (max-width: 860px) { .form-row > div { min-width: 100%; } .form-row .btn { width: 100%; } }

/* Modales legacy (.modal-overlay/.modal) */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,5,8,0.66); backdrop-filter: blur(8px); display: none; place-items: center; padding: 18px; }
.modal-overlay.active { display: grid; }
.modal-overlay .modal { width: 100%; max-width: 560px; background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline-2); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 24px; max-height: 88dvh; overflow-y: auto; }
.modal-overlay .modal.modal-lg { max-width: 880px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-header h3, .modal-header h4 { font-size: 18px; }
.slide-panel-close { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--text-muted); background: var(--surface-3); border: 1px solid var(--hairline); flex: none; }
.slide-panel-close:hover { color: var(--text); }

/* Slide panel lateral (prospects) */
.slide-panel-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,5,8,0.6); backdrop-filter: blur(6px); display: none; }
.slide-panel-overlay.active { display: block; }
.slide-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 94vw); background: var(--surface-1); border-left: 1px solid var(--hairline-2); box-shadow: var(--shadow-2); z-index: 81; overflow-y: auto; padding: 22px; transform: translateX(100%); transition: transform var(--t) var(--ease); }
.slide-panel.active { transform: none; }

/* Progress ring + spinner cell (búsquedas en curso) */
.progress-cell { display: inline-flex; align-items: center; gap: 8px; }
.progress-text { font-size: 12.5px; color: var(--text-muted); }
.progress-ring { width: 30px; height: 30px; }
.progress-ring__bg { fill: none; stroke: var(--surface-3); stroke-width: 4; }
.progress-ring__circle { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 113; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .4s var(--ease); }

/* Ratio chips (solicitados/encontrados) */
.ratio { font-family: var(--mono); font-size: 12.5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-muted); }
.ratio-met { color: var(--success); background: var(--success-soft); }
.ratio-unmet { color: var(--warn); background: var(--warn-soft); }

/* Badges por estado (legacy) → colores semánticos en oscuro */
.badge-pending, .badge-queued, .badge-validating, .badge-sending, .badge-pendiente_llamar, .badge-seguimiento, .badge-seguimiento_wsp { background: var(--warn-soft) !important; color: var(--warn) !important; }
.badge-running, .badge-generating, .badge-sent, .badge-llamado, .badge-mensaje_enviado, .badge-propuesta_enviada { background: var(--info-soft) !important; color: var(--info) !important; }
.badge-completed, .badge-validated, .badge-generated, .badge-interesado, .badge-cliente { background: var(--success-soft) !important; color: var(--success) !important; }
.badge-failed, .badge-cancelled, .badge-no_interesado, .badge-tiene_web, .badge-numero_invalido, .badge-invalid_number, .badge-web_incorrecta { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge-nuevo, .badge-demo_creada, .badge-zona_ocupada, .badge-descartado { background: var(--accent-soft) !important; color: var(--accent-bright) !important; }

/* Checkboxes */
.content input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* flex-gap (info de detalle) */
.flex-gap { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; }
.flex-gap > div { color: var(--text-muted); }
.flex-gap strong { color: var(--text); }

/* stat-card legacy (otras pantallas que no porteé al .stat nuevo) */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 8px; }
.stat-card { background: linear-gradient(180deg, var(--surface-2), var(--surface-1)); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-1), var(--inset-hi); }
.stat-card h3 { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.stat-card .value { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.data-table { width: 100%; border-collapse: collapse; }

/* Extras legacy (filtros, panel lateral de prospects, tabs, call modal) */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters input, .filters select { background: var(--bg-elev); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); height: 42px; padding: 0 12px; color: var(--text); font-size: 14px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-whatsapp { background: var(--wa); color: #04210f; }
.btn-whatsapp:hover { filter: brightness(1.08); }
.status-bar { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.slide-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,5,8,0.6); backdrop-filter: blur(6px); display: none; }
.slide-overlay.active { display: block; }
.badge-opened { background: var(--info-soft) !important; color: var(--info) !important; }
.tab { padding: 8px 13px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; background: none; border: none; }
.tab.active { background: var(--accent-soft); color: var(--accent-bright); }
.tab-content { display: none; }
.tab-content.active { display: block; }
#call-modal { position: fixed; inset: 0; z-index: 82; background: rgba(5,5,8,0.66); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 18px; }
@media (max-width: 860px) { .filters input { width: 100% !important; } .filters { gap: 10px; } }

/* Row actions — menú overflow (kebab) para no apilar N botones por fila */
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.kebab-wrap { position: relative; display: inline-block; }
.kebab-btn { width: 33px; height: 33px; padding: 0; border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--hairline-2); color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background var(--t-fast), color var(--t-fast); }
.kebab-btn:hover, .kebab-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
/* position: fixed → el menú se posiciona en coordenadas de viewport (por JS), así NO lo recorta
   el overflow:hidden de la tabla ni de ningún card contenedor. El flip-up también lo calcula el JS. */
.kebab-menu { position: fixed; z-index: var(--z-overlay); min-width: 210px;
  background: var(--surface-2); border: 1px solid var(--hairline-2); border-radius: var(--r); box-shadow: var(--shadow-2);
  padding: 6px; display: none; }
.kebab-menu.open { display: block; animation: kebab-in var(--t-fast) var(--ease-out); }
@keyframes kebab-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.kebab-menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; justify-content: flex-start;
  height: 34px; padding: 0 10px; border: 0; background: transparent; color: var(--text); font-size: 13px; font-weight: 500;
  border-radius: 9px; cursor: pointer; white-space: nowrap; }
.kebab-menu button:hover { background: var(--surface-3); }
.kebab-menu button.danger { color: var(--danger); }
.kebab-menu button.danger:hover { background: var(--danger); color: #fff; }
.kebab-menu .menu-sep { height: 1px; background: var(--hairline); margin: 5px 4px; }
.kebab-menu .menu-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.11em; color: var(--text-dim);
  padding: 7px 10px 3px; font-weight: 700; }

/* ============================================================================
   VW SITE DNA — firmas visuales portadas del sitio violetwaveai.com.
   Fuente: Equipo de Desarrollo Web → apps/violet-wave/src/index.css (html.vw-home).
   Estas son las que hacen que el sitio se lea "tech" y el panel no: blueprint
   grid, eyebrows mono con dash, inset-glow en cards, glow-pulse en KPIs, borde
   cónico rotando, cifras en editorial italic y un segundo acento magenta.
   ============================================================================ */

/* --- 1. Blueprint grid + dot-grid: el lienzo deja de estar vacío ----------- */
.content::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(117,59,189,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117,59,189,.07) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 30%, transparent 75%);
}
.content::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(circle, rgba(117,59,189,.20) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 60% at 85% 100%, #000 0%, transparent 70%);
}

/* --- 2. Eyebrow mono con dash — el tic tipográfico del sitio --------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: .7rem;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--lavender);
}
.eyebrow::before { content: ""; display: block; width: 18px; height: 1px; background: var(--lavender); flex: none; }

/* --- 3. Cards: borde violeta + inset-glow (no sombra difusa) --------------- */
.card {
  background: rgba(26,21,64,.66);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--hairline-2);
  box-shadow: inset 0 0 20px rgba(117,59,189,.08), 0 0 8px rgba(117,59,189,.12);
  transition: border-color .3s, box-shadow .3s;
}
.card:hover {
  border-color: var(--brand-2);
  box-shadow: inset 0 0 25px rgba(155,92,224,.12), 0 0 14px rgba(117,59,189,.2);
}
.card-head h3 { font-family: var(--font-display); letter-spacing: -.02em; }

/* --- 4. KPIs: glow-pulse + cifra en mono grande, delta en lime ------------- */
@keyframes vw-stat-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(117,59,189,.30), 0 0 40px rgba(117,59,189,.10); }
  50%      { box-shadow: 0 0 0 1px rgba(155,92,229,.60), 0 0 80px rgba(117,59,189,.25); }
}
.stat {
  background: rgba(26,21,64,.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--accent-line);
  animation: vw-stat-glow 4s ease-in-out infinite;
  box-shadow: none;
}
.stat:nth-child(2n) { animation-delay: 1.3s; }
.stat:nth-child(3n) { animation-delay: 2.6s; }
.stat:hover { transform: translateY(-3px); border-color: var(--magenta); }
.stat::before { background: radial-gradient(circle, rgba(192,38,211,.20), transparent 70%); }
.stat .num {
  font-family: var(--mono); font-weight: 500; font-size: 32px;
  letter-spacing: -.03em; color: var(--text);
  text-shadow: 0 0 12px rgba(155,92,224,.55);
}
.stat .lbl {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--lavender); font-weight: 500;
}
.stat .delta.up { color: var(--lime); }
.stat .ic-wrap { background: var(--magenta-soft); color: var(--magenta-sat); box-shadow: inset 0 0 0 1px var(--magenta-line); }

/* --- 5. Borde cónico rotando: la card destacada del sitio ------------------ */
@property --vw-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes vw-border-spin { to { --vw-angle: 360deg; } }
.card.featured {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--grad-magenta); border: 0;
}
.card.featured::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from var(--vw-angle,0deg), transparent 20%, rgba(255,255,255,.9) 40%, rgba(192,38,211,.9) 50%, rgba(255,255,255,.9) 60%, transparent 80%);
  animation: vw-border-spin 3s linear infinite;
}
.card.featured::after {
  content: ""; position: absolute; inset: 1.5px; border-radius: inherit; z-index: -1;
  background: var(--grad-magenta);
}

/* Hero: el bloque violeta del sitio (#lead) — hatch diagonal + halo magenta. */
.dash-hero {
  position: relative; overflow: hidden; border-radius: 18px; border: 0;
  background: var(--brand); backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 0 1px 12px rgba(117,59,189,.35);
  padding: 30px 32px;
}
.dash-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.05) 0px, rgba(255,255,255,.05) 1px, transparent 1px, transparent 28px);
}
.dash-hero::after {
  content: ""; position: absolute; bottom: -80px; right: -60px; z-index: 0;
  width: 420px; height: 420px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(192,38,211,.45) 0%, transparent 70%);
}
.dash-hero > * { position: relative; z-index: 1; }
.dash-hero .h-eyebrow {
  font-family: var(--mono); font-weight: 500; color: rgba(255,255,255,.72);
  letter-spacing: .2em;
}
.dash-hero .h-num { color: #fff; text-shadow: 0 0 20px rgba(255,255,255,.35); }
.dash-hero .h-sub { color: rgba(255,255,255,.78); }
.dash-hero .h-rate b { color: #fff; }
.dash-hero .h-rate span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: rgba(255,255,255,.62);
}
.dash-hero .h-rates { gap: 34px; }

/* --- 6. Cifras editoriales: Cormorant italic para valores grandes ---------- */
.vw-figure {
  font-family: var(--font-editorial); font-style: italic; font-weight: 300;
  color: var(--text); line-height: 1.1; letter-spacing: 0;
}

/* --- 7. Tablas: cabecera mono, filas con hairline violeta ------------------ */
.table-wrap { background: rgba(20,19,43,.72); border-color: var(--hairline-2); box-shadow: inset 0 0 30px rgba(117,59,189,.06); }
table thead th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--lavender); font-weight: 500;
}
table tbody tr:hover { background: rgba(117,59,189,.08); }

/* --- 8. Sidebar: la nav activa con barra neón + hatch de fondo ------------- */
.sidebar {
  background: linear-gradient(180deg, rgba(13,12,26,.94), rgba(6,6,15,.94));
  border-right: 1px solid var(--hairline-2);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.nav a { font-family: var(--font-display); letter-spacing: -.01em; }
.nav a.active { background: rgba(117,59,189,.18); box-shadow: inset 0 0 18px rgba(117,59,189,.18); }
.nav a.active::before { background: var(--magenta-sat); box-shadow: 0 0 10px var(--magenta-sat); }

/* --- 9. Títulos de página: display Outfit 800, tight ----------------------- */
.page-head h1 {
  font-family: var(--font-display); font-weight: 800;
  letter-spacing: -.045em; line-height: .95; font-size: clamp(1.8rem, 3vw, 2.4rem);
}
.page-head h1 em {
  font-family: var(--font-editorial); font-style: italic; font-weight: 300;
  color: var(--lavender); font-size: 1.06em;
  -webkit-text-fill-color: var(--lavender);
}

/* --- 10. Botón primario: glow de marca (como el del sitio) ----------------- */
.btn-primary { box-shadow: 0 4px 24px rgba(117,59,189,.4); }
.btn-primary:hover { box-shadow: 0 8px 40px rgba(117,59,189,.6); }
.btn { font-family: var(--font-display); }

/* --- 11. Badges: mono, uppercase, tracking (leen como telemetría) ---------- */
.badge { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }

/* --- 12. Login: canales (activo vs. próximo) + h2 con acento editorial ----- */
.auth-brand .ab-mid h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.045em; line-height: .98; }
.auth-brand .ab-mid h2 em {
  font-family: var(--font-editorial); font-style: italic; font-weight: 300;
  color: var(--lavender); font-size: 1.08em;
}
.auth-brand .ab-pipe span {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; border-radius: 6px;
  display: inline-flex; align-items: center; gap: .55rem;
}
.auth-brand .ab-pipe span::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: currentColor;
}
.auth-brand .ab-pipe span.on {
  color: var(--lime); border-color: rgba(163,230,53,.35); background: rgba(163,230,53,.08);
}
.auth-brand .ab-pipe span.on::before { box-shadow: 0 0 8px var(--lime); }
.auth-brand .ab-pipe span.soon {
  color: var(--text-dim); border-color: var(--hairline); background: transparent;
}

/* --- 13. Filtros globales del dashboard ----------------------------------- */
.dash-filters {
  /* z-index: las cards de abajo usan backdrop-filter (contexto de apilado propio) y
     si no, el popover del calendario queda pintado DEBAJO de ellas. */
  position: relative; z-index: 60;
  display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(20,19,43,.6); border: 1px solid var(--hairline-2);
  box-shadow: inset 0 0 20px rgba(117,59,189,.06);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.df-group { display: flex; flex-direction: column; gap: 6px; }
.df-lbl {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--lavender); font-weight: 500;
}
.df-sel { height: 34px; min-width: 190px; font-size: 13px; padding: 0 34px 0 11px; }
.dash-filters .df-reset { margin-left: auto; }

/* Segmented control (período) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px;
  background: var(--bg-elev); border: 1px solid var(--hairline); }
.seg button {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em;
  height: 26px; padding: 0 11px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-dim);
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: var(--brand); color: #fff;
  box-shadow: 0 0 14px rgba(117,59,189,.55);
}

/* --- 14. Chip de artefacto en la tabla de campañas ------------------------ */
.artifact {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}
.artifact svg { width: 14px; height: 14px; flex: none; }
.artifact.vendedor_ia { color: var(--brand-2); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.artifact.email { color: var(--magenta-sat); background: var(--magenta-soft); border: 1px solid var(--magenta-line); }

/* --- 15. Hero: alineación (los textos se rompían al angostarse) ----------- */
.dash-hero {
  align-items: center; gap: 40px; flex-wrap: wrap;
  padding: 26px 30px; min-height: 0;
}
.dash-hero .h-main { min-width: 230px; flex: 0 1 auto; }
.dash-hero .h-num { font-size: 48px; margin: 8px 0 4px; }
.dash-hero .h-sub { max-width: 30ch; line-height: 1.45; }
.dash-hero .h-rates { flex: 0 0 auto; margin-left: auto; align-items: center; }
.dash-hero .h-rate { text-align: left; min-width: 108px; }
.dash-hero .h-rate b { font-size: 26px; line-height: 1.1; margin-bottom: 6px; }
.dash-hero .h-rate span { display: block; white-space: nowrap; line-height: 1.4; }
/* la onda vivía como decoración de altura fija y dejaba un hueco muerto abajo */
.dash-hero .dash-wave { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; width: 100%; opacity: .5; }

/* --- 16. Dashboard raíz: una tarjeta por artefacto ------------------------- */
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.artifact-card {
  display: block; padding: 22px; border-radius: 16px;
  background: rgba(26,21,64,.66); border: 1px solid var(--hairline-2);
  box-shadow: inset 0 0 20px rgba(117,59,189,.08), 0 0 8px rgba(117,59,189,.12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
a.artifact-card:hover {
  border-color: var(--brand-2); transform: translateY(-3px);
  box-shadow: inset 0 0 25px rgba(155,92,224,.12), 0 0 18px rgba(117,59,189,.28);
}
.artifact-card.is-soon { opacity: .62; }
.ac-head { display: flex; align-items: center; gap: 13px; }
.ac-ic {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--accent-line);
}
.ac-ic svg { width: 22px; height: 22px; }
.ac-ic.email { background: var(--magenta-soft); color: var(--magenta-sat); box-shadow: inset 0 0 0 1px var(--magenta-line); }
.ac-id { min-width: 0; flex: 1; }
.ac-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.ac-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.ac-state {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px; flex: none;
}
.ac-state.live { color: var(--lime); background: rgba(163,230,53,.09); border: 1px solid rgba(163,230,53,.35); }
.ac-state.soon { color: var(--text-dim); border: 1px solid var(--hairline); }
.ac-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.am {
  padding: 12px; border-radius: 10px; text-align: left;
  background: var(--bg-elev); border: 1px solid var(--hairline);
}
.am b { display: block; font-family: var(--mono); font-size: 22px; font-weight: 500; letter-spacing: -.03em;
  text-shadow: 0 0 12px rgba(155,92,224,.45); }
.am.win b { color: var(--success); text-shadow: 0 0 12px rgba(52,216,160,.45); }
.am span { display: block; margin-top: 5px; font-family: var(--mono); font-size: 9px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--lavender); }
.ac-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--hairline); }
.ac-count { font-family: var(--mono); font-size: 11px; color: var(--text-dim); letter-spacing: .06em; }
.ac-go { font-size: 13px; font-weight: 600; color: var(--brand-2); }
.ac-soon { margin-top: 16px; }
.ac-soon p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }

/* --- 17. Selector de rango de fechas (dateGrid) --------------------------- */
.daterange { position: relative; }
.dr-btn {
  display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 11px;
  border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--bg-elev); border: 1px solid var(--hairline-2); min-width: 200px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.dr-btn:hover { border-color: var(--accent-line); }
.dr-btn[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--accent-soft); }
.dr-btn svg { width: 15px; height: 15px; color: var(--lavender); flex: none; }
.dr-btn .dr-label { flex: 1; text-align: left; white-space: nowrap; }
.dr-btn .dr-caret { width: 13px; height: 13px; opacity: .7; }
.dr-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 70;
  display: flex; gap: 0; border-radius: 13px; overflow: hidden;
  background: var(--surface-1); border: 1px solid var(--hairline-2);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.8), inset 0 0 30px rgba(117,59,189,.08);
}
.dr-pop[hidden] { display: none; }
.dr-presets { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-right: 1px solid var(--hairline);
  background: rgba(6,6,15,.4); }
.dr-presets button {
  text-align: left; white-space: nowrap; border: 0; cursor: pointer; border-radius: 7px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 500; color: var(--text-muted); background: transparent;
  transition: background var(--t-fast), color var(--t-fast);
}
.dr-presets button:hover { background: var(--surface-3); color: var(--text); }
.dr-presets button.on { background: var(--accent-soft); color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--accent-line); }
.dr-cal { padding: 12px 14px 10px; }
.dr-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dr-nav b { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; }
.dr-nav button {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--hairline); cursor: pointer;
  background: var(--bg-elev); color: var(--text-muted); font-size: 15px; line-height: 1;
}
.dr-nav button:hover { color: var(--text); background: var(--surface-3); }
.dr-dow, .dr-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 2px; }
.dr-dow i {
  font-family: var(--mono); font-style: normal; font-size: 9.5px; letter-spacing: .1em;
  color: var(--text-dim); text-align: center; padding-bottom: 5px;
}
.dr-grid button, .dr-pad { height: 30px; }
.dr-grid button {
  border: 0; cursor: pointer; border-radius: 7px; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 12px; transition: background var(--t-fast), color var(--t-fast);
}
.dr-grid button:hover:not(:disabled) { background: var(--surface-3); }
.dr-grid button:disabled, .dr-grid button.is-off { color: var(--text-dim); opacity: .35; cursor: not-allowed; }
.dr-grid button.in-range { background: var(--accent-soft); border-radius: 0; }
.dr-grid button.is-edge {
  background: var(--brand); color: #fff; border-radius: 7px;
  box-shadow: 0 0 12px rgba(117,59,189,.6);
}
.dr-grid button.is-today:not(.is-edge) { box-shadow: inset 0 0 0 1px var(--accent-line); }
.dr-hint { margin-top: 8px; font-size: 10.5px; color: var(--text-dim); text-align: center; }

/* --- 18. KPI "ganadas" del gráfico de actividad --------------------------- */
.actv-kpi.win b { color: var(--success); }

/* --- 19. El margen que faltaba entre cards apiladas ----------------------- */
.card + .card, .card + .card-head, .table-wrap + .card-head { margin-top: 18px; }
.mt-4 { margin-top: 24px; }

/* --- 20. dateGrid doble: campos Desde/Hasta + dos meses ------------------- */
.dr-main { padding: 12px 14px 10px; }
.dr-fields {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--hairline);
}
.drf {
  flex: 1; padding: 7px 11px; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--hairline);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.drf.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--accent-soft); }
.drf span {
  display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--lavender); margin-bottom: 3px;
}
.drf b { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--text); }
.dr-arrow { color: var(--text-dim); font-style: normal; flex: none; }
.dr-cals { display: flex; gap: 18px; }
.dr-cal { flex: none; }
.dr-nav span { width: 26px; height: 26px; display: block; }
.dr-nav button:disabled { opacity: .3; cursor: not-allowed; }

/* --- 21. Origen de leads: etiqueta libre (la fuente del vendedor, sea cual sea) */
.src { display: flex; flex-direction: column; gap: 3px; }
.src-plat {
  font-family: var(--mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--lavender); width: fit-content;
  padding: 2px 6px; border-radius: 4px; background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.src-lbl { font-size: 13px; color: var(--text-muted); }
.cell-mono.win { color: var(--success); }
.c-of { color: var(--text-dim); font-size: 11px; }

/* --- 22. Cursor: todo lo que se clickea tiene que decir que se clickea ----- */
.select, select, .btn, button, .seg button, .kebab-btn, .logout, .cmdk-trigger,
.dr-btn, .dr-presets button, .dr-grid button:not(:disabled), .dr-nav button:not(:disabled),
.vendor-card, a.artifact-card { cursor: pointer; }
.btn:disabled, button:disabled, .nav-disabled { cursor: not-allowed; }

/* --- 23. Pie del dateGrid: Cancelar / Aplicar ----------------------------- */
.dr-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hairline);
}
.dr-foot .dr-hint { margin: 0; text-align: left; }
.dr-actions { display: flex; gap: 8px; flex: none; }

/* --- 24. Panel del vendedor: su filtro propio ----------------------------- */
.vfilter {
  padding: 14px 16px; border-radius: 11px;
  background: rgba(6,6,15,.45); border: 1px dashed var(--hairline-2);
}
.vf-head {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--lavender); margin-bottom: 9px;
}
.vf-items { display: flex; gap: 20px; flex-wrap: wrap; }
.vf-items span { font-size: 13px; color: var(--text-muted); }
.vf-items b { font-family: var(--mono); color: var(--text); font-weight: 500; margin-right: 3px; }
.vf-note { margin: 9px 0 0; font-size: 11.5px; color: var(--text-dim); line-height: 1.5; max-width: 70ch; }
.stat .num.win { color: var(--success); text-shadow: 0 0 12px rgba(52,216,160,.45); }
