/* ===================================================================
   CRM Del Río Automotores — Diseño Premium Rediseñado
   Inspirado en delrioautomotores.com: Poppins + Montserrat,
   Rojo institucional #e51922, diseño limpio y accesible
   Responsive Notebook + Móvil | Accesible para adultos mayores
   =================================================================== */

/* ── 1. GOOGLE FONTS ───────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Montserrat:wght@600;700&display=swap');

/* ── 2. TOKENS & VARIABLES ─────────────────────────────────────────── */
:root {
  /* Paleta Del Río */
  --brand:         #e51922;
  --brand-dark:    #c5141c;
  --brand-light:   #ff4851;
  --brand-soft:    rgba(229, 25, 34, 0.10);
  --brand-glow:    rgba(229, 25, 34, 0.30);

  /* Fondos (Light Mode base — más legible para adultos mayores) */
  --bg-app:         #f5f5f7;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #fdf0f0;
  --bg-primary:     var(--bg-app);
  --bg-hover:       var(--bg-card-hover);
  --bg-input:       #f9f9fb;
  --bg-sidebar:     #1a1a2e;
  --bg-sidebar-item:#ffffff0d;

  /* Texto */
  --text-primary:   #1a1a1a;
  --text-secondary: #4a4a5a;
  --text-muted:     #8a8a9a;
  --text-on-brand:  #ffffff;
  --text-on-dark:   #f0f0ff;
  --text-on-dark-muted: rgba(240,240,255,0.55);

  /* Bordes */
  --border:         rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.15);
  --border-brand:   rgba(229,25,34,0.30);

  /* Estados semáforo */
  --green:    #16a34a;
  --green-bg: rgba(22,163,74,0.10);
  --yellow:   #d97706;
  --yellow-bg:rgba(217,119,6,0.10);
  --orange:   #ea580c;
  --orange-bg:rgba(234,88,12,0.10);
  --red:      #dc2626;
  --red-bg:   rgba(220,38,38,0.10);
  --blue:     #2563eb;
  --blue-bg:  rgba(37,99,235,0.10);
  --purple:   #7c3aed;
  --purple-bg:rgba(124,58,237,0.10);

  /* Layout */
  --sidebar-w:       260px;
  --sidebar-w-col:   72px;
  --topbar-h:        72px;
  --radius-sm:       8px;
  --radius-md:       14px;
  --radius-lg:       20px;
  --radius-xl:       28px;
  --radius-pill:     9999px;

  /* Sombras */
  --shadow-xs:  0 1px 4px rgba(0,0,0,0.06);
  --shadow-sm:  0 2px 10px rgba(0,0,0,0.08);
  --shadow-md:  0 6px 24px rgba(0,0,0,0.10);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.14);
  --shadow-brand: 0 6px 24px rgba(229,25,34,0.35);

  /* Tipografía */
  --font-base:    'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-headings: 'Montserrat', 'Poppins', sans-serif;
  --font-buttons: 'Montserrat', sans-serif;

  /* Tamaños de fuente (grandes para accesibilidad) */
  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-md:   18px;
  --fs-lg:   22px;
  --fs-xl:   28px;
  --fs-2xl:  36px;

  /* Transiciones */
  --trans:      220ms cubic-bezier(0.4,0,0.2,1);
  --trans-slow: 420ms cubic-bezier(0.4,0,0.2,1);
  --trans-bounce: 260ms cubic-bezier(0.34,1.56,0.64,1);
}

/* ── 2.1 VARIABLES & REGLAS DE MODO OSCURO (DARK MODE) ──────────────── */
html.dark-mode {
  /* Fondos Dark Mode */
  --bg-app:          #0e0f19;
  --bg-surface:      #161726;
  --bg-card:         #1d1f33;
  --bg-card-hover:   #282a44;
  --bg-input:        #23263e;
  --bg-sidebar:      #0b0c14;
  --bg-sidebar-item: rgba(255, 255, 255, 0.06);

  /* Texto */
  --text-primary:    #f3f4fd;
  --text-secondary:  #b2b4cd;
  --text-muted:      #7c809e;
  --text-on-brand:   #ffffff;
  --text-on-dark:    #f0f0ff;
  --text-on-dark-muted: rgba(240, 240, 255, 0.60);

  /* Bordes */
  --border:          rgba(255, 255, 255, 0.10);
  --border-strong:   rgba(255, 255, 255, 0.18);
  --border-brand:    rgba(229, 25, 34, 0.45);

  /* Sombras */
  --shadow-xs:       0 1px 4px rgba(0, 0, 0, 0.45);
  --shadow-sm:       0 2px 10px rgba(0, 0, 0, 0.55);
  --shadow-md:       0 6px 24px rgba(0, 0, 0, 0.65);
  --shadow-lg:       0 12px 40px rgba(0, 0, 0, 0.80);
  --shadow-brand:    0 6px 24px rgba(229, 25, 34, 0.45);

  /* Brand soft & glow */
  --brand-soft:      rgba(229, 25, 34, 0.18);
  --brand-glow:      rgba(229, 25, 34, 0.45);

  /* Semáforos con contraste oscuro */
  --green-bg:        rgba(22, 163, 74, 0.22);
  --yellow-bg:       rgba(217, 119, 6, 0.22);
  --orange-bg:       rgba(234, 88, 12, 0.22);
  --red-bg:          rgba(220, 38, 38, 0.22);
  --blue-bg:         rgba(37, 99, 235, 0.22);
  --purple-bg:       rgba(124, 58, 237, 0.22);
}

/* Ajustes finos de componentes en modo oscuro */
html.dark-mode .data-table thead {
  background: linear-gradient(135deg, #18192a 0%, #202238 100%);
}
html.dark-mode .pipeline-col-count,
html.dark-mode .kanban-col-count,
html.dark-mode .filter-select {
  background: var(--bg-input);
  color: var(--text-primary);
}
html.dark-mode .chat-context-bar {
  background: var(--bg-input);
}
html.dark-mode .form-input,
html.dark-mode .reply-input,
html.dark-mode .stage-select {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}
html.dark-mode .form-input:focus,
html.dark-mode .reply-input:focus {
  border-color: var(--brand);
  background: var(--bg-card);
}
html.dark-mode .btn-outline {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
html.dark-mode .btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand-light);
  background: var(--brand-soft);
}
html.dark-mode .topbar-user-badge {
  background: var(--bg-card);
}
html.dark-mode .search-wrap {
  background: var(--bg-surface);
  border-color: var(--border);
}
html.dark-mode .search-input {
  color: var(--text-primary);
}
html.dark-mode .pipeline-card,
html.dark-mode .kanban-card {
  background: var(--bg-card);
  border-color: var(--border);
}
html.dark-mode .pc-other-interests {
  background: rgba(255, 255, 255, 0.03);
}
html.dark-mode .existing-client-notice {
  background: rgba(59, 130, 246, 0.15);
  color: #bfdbfe;
}
html.dark-mode .btn-peritaje-quick {
  background: rgba(229, 25, 34, 0.20);
  color: #ff6b72;
  border-color: rgba(229, 25, 34, 0.45);
}
html.dark-mode .btn-peritaje-quick:hover {
  background: var(--brand);
  color: #ffffff;
}

/* ── 3. RESET & BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-base);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; color: var(--text-primary); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); font-weight: 600; }

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; background: none; font: inherit; }
input, textarea, select { font: inherit; outline: none; border: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent);
  outline-offset: 2px;
}
pre { font-family: 'Courier New', monospace; }

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ── 4. LAYOUT PRINCIPAL ────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#sidebar-root {
  flex-shrink: 0;
  width: var(--sidebar-w);
  transition: width var(--trans-slow);
  z-index: 200;
}
#sidebar-root:has(.sidebar.collapsed) {
  width: var(--sidebar-w-col);
}

.main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-app);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 28px 40px;
}

/* Animación de entrada de secciones */
.view-section {
  animation: slideIn 280ms cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 5. SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--trans-slow);
  box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  position: relative;
}
.sidebar.collapsed { width: var(--sidebar-w-col); }

/* Línea roja decorativa en el sidebar */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  min-height: 80px;
}

.logo-wrap {
  display: flex; align-items: center; gap: 12px; overflow: hidden;
}

.sidebar-logo-img {
  width: 42px; height: 42px;
  object-fit: contain; flex-shrink: 0;
  border-radius: var(--radius-sm);
  filter: brightness(1.05) drop-shadow(0 2px 6px rgba(229,25,34,0.4));
  background: white;
  padding: 2px;
}

.logo-text { display: flex; flex-direction: column; overflow: hidden; }
.logo-main {
  font-size: 15px; font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}
.logo-sub {
  font-size: 10px; color: var(--text-on-dark-muted);
  white-space: nowrap; letter-spacing: 0.5px;
}

.sidebar-toggle {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-on-dark-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  transition: all var(--trans);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.sidebar-toggle:hover {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  transform: scale(1.1);
}

/* Ocultar elementos al colapsar */
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer { display: none; }

/* Navegación */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.nav::-webkit-scrollbar { display: none; }

.nav-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-on-dark-muted);
  padding: 12px 10px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 12px;
  border-radius: var(--radius-md);
  color: rgba(240,240,255,0.70);
  font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--trans);
  position: relative; overflow: hidden;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  transform: translateX(2px);
}
.nav-item.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(229,25,34,0.40);
  font-weight: 600;
}
.nav-item.active::after {
  content: '';
  position: absolute; right: -1px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 3px 0 0 3px;
  background: white;
}

.nav-icon {
  font-size: 1.2rem; flex-shrink: 0;
  width: 22px; text-align: center;
}
.nav-text { flex: 1; }
.nav-badge {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-pill);
  min-width: 22px; text-align: center;
}
.nav-badge.urgent { background: var(--brand); }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }

/* Footer sidebar */
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(229,25,34,0.3);
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name {
  font-size: var(--fs-sm); font-weight: 600;
  color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role-label { font-size: 11px; color: var(--text-on-dark-muted); }
.btn-sidebar-logout {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(240, 240, 255, 0.88);
  background: rgba(255, 255, 255, 0.06);
  transition: color var(--trans), background var(--trans), border-color var(--trans);
}
.btn-sidebar-logout:hover {
  color: #fff;
  background: rgba(229, 25, 34, 0.24);
  border-color: rgba(255, 255, 255, 0.18);
}
.btn-sidebar-logout:focus-visible,
.btn-sidebar-help:focus-visible {
  outline: 3px solid #ff6970;
  outline-offset: 2px;
}
.btn-sidebar-logout .app-icon,
.btn-sidebar-logout svg { width: 18px; height: 18px; }

/* ── 6. TOPBAR ───────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { display: flex; flex-direction: column; }
.topbar-title h1 { font-size: var(--fs-lg); font-weight: 700; }
.topbar-date { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Badge de usuario autenticado en TopBar */
.topbar-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.topbar-user-badge:hover {
  border-color: var(--border-brand);
}
.topbar-user-badge:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #ff4851);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(229, 25, 34, 0.25);
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.topbar-user-name {
  font-family: var(--font-headings);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-primary);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.topbar-user-role.role-admin {
  color: var(--brand);
}
.topbar-user-role.role-vendedor {
  color: #d97706;
}
.topbar-user-role.role-dev {
  color: #2563eb;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-icon-btn {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all var(--trans);
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.topbar-icon-btn:hover {
  background: var(--brand-soft);
  border-color: var(--border-brand);
  color: var(--brand);
  transform: scale(1.05);
}
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--bg-surface);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.topbar-icon-btn.has-alerts {
  color: var(--brand);
  border-color: rgba(229, 25, 34, 0.40);
  background: var(--brand-soft);
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(229, 25, 34, 0.45);
  border: 2px solid var(--bg-surface);
  line-height: 1;
  animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── CENTRO DE NOTIFICACIONES Y ALERTAS (DEL RÍO AUTOMOTORES) ───────── */
.notif-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 76px 24px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.notif-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.notif-modal-dialog {
  width: 100%;
  max-width: 490px;
  max-height: calc(100vh - 100px);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: notifSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes notifSlideDown {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-modal-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.08) 0%, rgba(229, 25, 34, 0.02) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notif-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.notif-header-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.35);
  flex-shrink: 0;
}
.notif-modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.notif-header-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-notif-mark-read {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--trans);
  cursor: pointer;
  white-space: nowrap;
}
.btn-notif-mark-read:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}
.notif-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--trans);
}
.notif-modal-close:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red);
}

.notif-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.notif-filter-bar::-webkit-scrollbar { display: none; }
.notif-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--trans);
}
.notif-filter-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.notif-filter-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(229, 25, 34, 0.35);
}
.notif-filter-pill {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  font-weight: 700;
}
.notif-filter-btn.active .notif-filter-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.notif-filter-pill.alert {
  background: var(--brand);
  color: #fff;
}

.notif-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--trans);
}
.notif-item.is-unread {
  border-left: 4px solid var(--brand);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.notif-item.is-read {
  opacity: 0.72;
}
.notif-item:hover {
  transform: translateX(2px);
  border-color: var(--border-brand);
}
.notif-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-type-lead .notif-item-icon {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}
.notif-type-task .notif-item-icon {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}
.notif-type-peritaje .notif-item-icon {
  background: rgba(229, 25, 34, 0.12);
  color: var(--brand);
}
.notif-type-stock .notif-item-icon {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}
.notif-item-content {
  flex: 1;
  min-width: 0;
}
.notif-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.notif-badge-chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-whatsapp { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.badge-urgente { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.badge-peritaje { background: rgba(229, 25, 34, 0.12); color: var(--brand); }
.badge-stock { background: rgba(22, 163, 74, 0.12); color: #16a34a; }

.notif-item-time {
  font-size: 11px;
  color: var(--text-muted);
}
.notif-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.notif-item-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}
.notif-item-actions {
  display: flex;
  align-items: center;
  align-self: center;
}
.btn-notif-action {
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-brand);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--trans);
}
.btn-notif-action:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 25, 34, 0.35);
}

.notif-empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}
.notif-empty-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}
.notif-empty-state h3 {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.notif-empty-state p {
  font-size: 0.88rem;
  max-width: 320px;
  margin: 0 auto;
}

.notif-modal-footer {
  padding: 12px 18px;
  background: var(--bg-app);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notif-footer-text {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-notif-close-bottom {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-notif-close-bottom:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Modal en Móvil */
@media (max-width: 640px) {
  .notif-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .notif-modal-dialog {
    max-width: 100vw;
    width: 100vw;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    animation: notifSlideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes notifSlideUpMobile {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
  .btn-notif-action {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }
}

/* ── 7. COMPONENTES COMUNES ─────────────────────────────────────────── */

/* Toolbar de vista */
.view-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; flex-wrap: wrap;
}

/* Búsqueda */
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 16px; flex: 1; max-width: 400px;
  transition: all var(--trans);
  box-shadow: var(--shadow-xs);
}
.search-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.search-icon { color: var(--text-muted); font-size: 1rem; }
.search-input {
  flex: 1; background: none; color: var(--text-primary);
  font-size: var(--fs-base); padding: 12px 0;
}
.search-input::placeholder { color: var(--text-muted); }

/* Filtros */
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select {
  background: var(--bg-surface); color: var(--text-primary);
  border: 2px solid var(--border); border-radius: var(--radius-pill);
  padding: 10px 18px; font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--trans); cursor: pointer;
}
.filter-select:focus { border-color: var(--brand); outline: none; }

/* Botones */
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm); font-weight: 700;
  transition: all var(--trans-bounce);
  white-space: nowrap;
  box-shadow: var(--shadow-brand);
  letter-spacing: 0.3px;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(229,25,34,0.45);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-sm { padding: 9px 18px; font-size: var(--fs-xs); }
.btn-full { width: 100%; justify-content: center; }
.btn-outline {
  border: 2px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm); font-weight: 600;
  transition: all var(--trans);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.btn-link { color: var(--text-muted); font-size: var(--fs-sm); transition: color var(--trans); }
.btn-link:hover { color: var(--brand); }

/* ══ BOTÓN DE VOZ — Diseño muy llamativo ═══════════════════════════ */
.voice-btn {
  position: relative;
  width: 52px; height: 52px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #1e3a5f 0%, #0f3460 100%);
  color: white;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--trans-bounce);
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 14px rgba(15,52,96,0.4);
  overflow: visible;
}
.voice-btn:hover {
  transform: scale(1.12);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  box-shadow: 0 6px 20px rgba(229,25,34,0.45);
  border-color: transparent;
}
.voice-btn:hover::before {
  content: 'Hablar';
  position: absolute;
  bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}

/* Estado ESCUCHANDO — animación muy llamativa */
.voice-btn.voice-active {
  background: linear-gradient(135deg, var(--brand) 0%, #ff0000 100%) !important;
  border-color: transparent;
  box-shadow: 0 0 0 0 rgba(229,25,34,0.7);
  animation: voice-listening 1.2s ease-in-out infinite;
}
.voice-btn.voice-active::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid rgba(229,25,34,0.4);
  animation: voice-ring 1.2s ease-in-out infinite;
}

@keyframes voice-listening {
  0%   { box-shadow: 0 0 0 0 rgba(229,25,34,0.70); transform: scale(1.05); }
  50%  { box-shadow: 0 0 0 16px rgba(229,25,34,0); transform: scale(1.12); }
  100% { box-shadow: 0 0 0 0 rgba(229,25,34,0); transform: scale(1.05); }
}
@keyframes voice-ring {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Etiqueta GRABANDO visible debajo del botón */
.voice-btn.voice-active::before {
  content: '● REC';
  position: absolute;
  bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: white;
  font-size: 11px; font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 1px;
  animation: blink-label 0.9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes blink-label {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Versión compacta del botón de voz (en barra de búsqueda) */
.voice-btn-sm {
  width: 38px; height: 38px;
  font-size: 1rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f3460 100%);
  border-radius: var(--radius-pill);
  color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: none;
  transition: all var(--trans-bounce);
  box-shadow: 0 2px 8px rgba(15,52,96,0.3);
}
.voice-btn-sm:hover {
  transform: scale(1.15);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  box-shadow: 0 4px 14px rgba(229,25,34,0.4);
}
.voice-btn-sm.voice-active {
  background: linear-gradient(135deg, var(--brand) 0%, #ff0000 100%);
  animation: voice-listening 1.2s ease-in-out infinite;
}

/* ── 8. TARJETAS / CARDS ────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--trans);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Conteo de resultados */
.stock-count { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 14px; font-weight: 500; }

/* ── 9. TABLAS ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: linear-gradient(135deg, #f8f8fc 0%, #f0f0f8 100%); }
.data-table th {
  padding: 14px 18px;
  font-size: var(--fs-xs); font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td { padding: 14px 18px; font-size: var(--fs-base); vertical-align: middle; }

.table-row { transition: background var(--trans); cursor: pointer; }
.table-row:hover { background: var(--brand-soft); }

.vehicle-cell { display: flex; align-items: center; gap: 12px; }
.vehicle-name { font-weight: 600; display: block; font-size: var(--fs-sm); }
.vehicle-version { font-size: var(--fs-xs); color: var(--text-muted); display: block; }
.vehicle-brand-icon { font-size: 1.4rem; }
.price-cell { font-weight: 700; color: var(--green); font-size: var(--fs-sm); }
.cost-cell { color: var(--text-secondary); font-size: var(--fs-sm); }
.margin-cell { font-weight: 700; color: var(--blue); font-size: var(--fs-sm); }

/* Acciones de tabla */
.row-actions { display: flex; gap: 6px; }
.action-btn {
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--text-muted);
  transition: all var(--trans);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.action-btn:hover {
  background: var(--brand-soft);
  border-color: var(--border-brand);
  color: var(--brand);
  transform: scale(1.1);
}

/* ── 10. BADGES & ETIQUETAS ─────────────────────────────────────────── */
.status-badge, .condition-badge, .stage-badge, .ctx-tag {
  display: inline-flex; align-items: center;
  padding: 5px 13px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 700;
  white-space: nowrap; letter-spacing: 0.3px;
}

.stat-disponible { background: var(--green-bg); color: var(--green); }
.stat-reservado  { background: var(--yellow-bg); color: var(--yellow); }
.stat-vendido    { background: var(--blue-bg); color: var(--blue); }
.stat-en_trafico { background: var(--purple-bg); color: var(--purple); }

.cond-0km   { background: rgba(14,165,233,0.10); color: #0284c7; }
.cond-usado { background: var(--yellow-bg); color: var(--yellow); }

.stage-nuevo       { background: var(--blue-bg); color: var(--blue); }
.stage-calificado  { background: rgba(20,184,166,0.10); color: #0d9488; }
.stage-propuesta   { background: var(--purple-bg); color: var(--purple); }
.stage-negociacion { background: var(--yellow-bg); color: var(--yellow); }
.stage-cerrado     { background: var(--green-bg); color: var(--green); }
.stage-perdido     { background: var(--red-bg); color: var(--red); }

.ctx-tag { padding: 4px 10px; }
.tag-0km     { background: rgba(14,165,233,0.10); color: #0284c7; }
.tag-usado   { background: var(--yellow-bg); color: var(--yellow); }
.tag-trade   { background: var(--purple-bg); color: var(--purple); }
.tag-fin     { background: var(--blue-bg); color: var(--blue); }
.tag-vehicle { background: var(--brand-soft); color: var(--brand); }

.peritaje-status-badge { padding: 5px 13px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; }
.pst-borrador { background: rgba(100,116,139,0.10); color: #64748b; }
.pst-emitido  { background: var(--yellow-bg); color: var(--yellow); }
.pst-aprobado { background: var(--green-bg); color: var(--green); }

/* ── 11. AVATARES ───────────────────────────────────────────────────── */
.lead-avatar {
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: white; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(229,25,34,0.3);
}
.lead-avatar.big  { width: 52px; height: 52px; font-size: 18px; }
.lead-avatar.sm   { width: 32px; height: 32px; font-size: 13px; }

/* ── 12. FORMULARIOS ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
  font-size: var(--fs-sm); font-weight: 700;
  color: var(--text-secondary);
}
.form-input {
  background: var(--bg-input); color: var(--text-primary);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  padding: 13px 16px; font-size: var(--fs-base); width: 100%;
  transition: all var(--trans); resize: vertical;
}
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Wrap input + botón de voz */
.input-voice-wrap {
  display: flex; gap: 10px; align-items: flex-start;
}
.input-voice-wrap .form-input { flex: 1; }

/* Empty state */
.empty-state {
  text-align: center; color: var(--text-muted);
  padding: 40px 20px; font-size: var(--fs-base);
  font-weight: 500;
}
.empty-state.centered { display: flex; align-items: center; justify-content: center; height: 200px; }

/* Resúmenes de intención y estados de carga de datos reales. */
.intent-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-height: 4.8em;
  line-height: 1.6em;
}
.intent-summary span { min-width: 0; }
.chat-context-bar .tag-vehicle { max-width: min(100%, 520px); white-space: normal; overflow-wrap: anywhere; }
.data-loading-screen {
  flex: 1 1 100%; width: 100%; min-width: 0; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px;
  color: var(--text-secondary); background: var(--bg-primary); overflow: auto;
  position: relative; isolation: isolate;
}
#app:has(.data-loading-screen) { display: block; width: 100%; min-width: 0; overflow: hidden; }
.data-loading-screen { width: 100%; min-width: 100%; }
.data-loading-screen::before,
.data-loading-screen::after { content: ''; position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; filter: blur(2px); }
.data-loading-screen::before { width: 42vw; height: 42vw; max-width: 560px; max-height: 560px; left: -18vw; top: -19vw; background: color-mix(in srgb, var(--brand) 9%, transparent); }
.data-loading-screen::after { width: 36vw; height: 36vw; max-width: 480px; max-height: 480px; right: -14vw; bottom: -18vw; background: color-mix(in srgb, #f59e0b 8%, transparent); }
.data-loading-shell { width: min(100%, 740px); display: grid; gap: 28px; }
.data-loading-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text-primary); font-size: 14px; font-weight: 700; }
.data-loading-logo-wrap { width: 44px; height: 44px; padding: 5px; display: grid; place-items: center; border-radius: 14px; background: var(--brand); box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 24%, transparent); }
.data-loading-logo { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.data-loading-content { background: color-mix(in srgb, var(--bg-surface) 90%, transparent); border: 1px solid var(--border); border-radius: 28px; padding: clamp(28px, 6vw, 56px); box-shadow: 0 24px 70px rgba(18, 24, 40, .10); backdrop-filter: blur(18px); }
.data-loading-mark { width: 58px; height: 58px; position: relative; display: grid; place-items: center; margin-bottom: 26px; border-radius: 18px; background: color-mix(in srgb, var(--brand) 10%, var(--bg-surface)); color: var(--brand); }
.data-loading-ring { position: absolute; inset: 9px; border: 3px solid color-mix(in srgb, var(--brand) 16%, transparent); border-top-color: var(--brand); border-radius: 50%; animation: data-spin .9s linear infinite; }
.data-loading-check { opacity: .4; font-size: 17px; font-weight: 800; }
.data-loading-kicker { margin: 0 0 10px; color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.data-loading-content h1 { max-width: 520px; margin: 0; color: var(--text-primary); font-size: clamp(26px, 4vw, 42px); line-height: 1.08; letter-spacing: -.035em; }
.data-loading-description { max-width: 560px; margin: 16px 0 30px; color: var(--text-secondary); font-size: clamp(15px, 2vw, 17px); line-height: 1.6; }
.data-loading-progress { height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-hover); }
.data-loading-progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #ff7b62); transition: width 350ms ease; }
.data-loading-status { min-height: 22px; margin: 12px 0 24px; color: var(--text-primary); font-size: 14px; font-weight: 600; }
.data-loading-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; }
.data-loading-step { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-muted); font-size: 12px; line-height: 1.35; }
.data-loading-step-icon { width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: transparent; font-size: 0; }
.data-loading-step.is-active { color: var(--text-secondary); }
.data-loading-step.is-active .data-loading-step-icon { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); color: var(--brand); font-size: 17px; line-height: 1; }
.data-loading-step.is-done .data-loading-step-icon { border-color: var(--brand); background: var(--brand); color: #fff; font-size: 12px; }
.data-loading-step.is-done .data-loading-step-icon::before { content: '✓'; }
.data-loading-step.is-done .data-loading-step-icon { font-size: 0; }
.data-loading-step.is-done .data-loading-step-icon::before { font-size: 12px; }
.data-loading-step.is-error { color: var(--brand); }
.data-loading-step.is-error .data-loading-step-icon { border-color: var(--brand); color: transparent; font-size: 0; }
.data-loading-step.is-error .data-loading-step-icon::before { content: '!'; color: var(--brand); font-size: 12px; font-weight: 800; }
.data-loading-screen.has-error .data-loading-ring { animation: none; border-color: color-mix(in srgb, var(--brand) 22%, transparent); border-top-color: var(--brand); }
.data-loading-screen.has-error .data-loading-progress-bar { background: #dc2626; }
.data-loading-error { display: grid; gap: 8px; margin-top: 24px; padding: 16px; border: 1px solid color-mix(in srgb, #d97706 45%, var(--border)); border-radius: 16px; background: color-mix(in srgb, #f59e0b 10%, var(--bg-surface)); color: var(--text-secondary); font-size: 13px; line-height: 1.45; }
.lead-voice-status { max-width: 220px; color: var(--red); font-size: 11px; line-height: 1.25; }
.copilot-voice-error { margin: 0 0 8px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--red) 8%, var(--bg-surface)); color: var(--red); font-size: 12px; }
.data-loading-error[hidden] { display: none !important; }
.data-loading-error strong { color: var(--text-primary); }
.data-loading-error-list { display: grid; gap: 5px; margin: 0; padding-left: 20px; }
.data-loading-retry { width: fit-content; margin-top: 5px; min-height: 44px; }
.data-loading-logout { width: fit-content; min-height: 44px; }
.data-loading-footnote { margin: 0; color: var(--text-muted); font-size: 12px; }
@media (max-width: 560px) {
  .data-loading-screen { padding: 20px 14px; place-items: start center; }
  .data-loading-shell { gap: 20px; margin-top: 8vh; }
  .data-loading-content { padding: 26px 22px; border-radius: 22px; }
  .data-loading-steps { grid-template-columns: 1fr; gap: 12px; }
  .data-loading-step { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .data-loading-ring { animation: none; }
  .data-loading-progress-bar { transition: none; }
}

/* ── CONSULTAS: TOOLBAR RESPONSIVE ───────────────────────────────── */
#view-consultas > .view-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
#view-consultas .toolbar-left {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
#view-consultas .toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
#view-consultas .search-input-wrap { width: 100%; min-width: 0; }
#view-consultas .lead-search-box { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
#view-consultas .voice-search-btn,
#view-consultas .clear-search-btn { min-width: 40px; min-height: 40px; }
#view-consultas .view-toggle { display: flex; min-width: 0; }
#view-consultas .toggle-btn { min-height: 44px; white-space: nowrap; }
#view-consultas #btnAddLead { min-height: 48px; }

@media (max-width: 1200px) {
  #view-consultas > .view-toolbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "right";
    gap: 14px;
    align-items: stretch;
  }
  #view-consultas .toolbar-left {
    grid-area: left;
  }
  #view-consultas .toolbar-right {
    grid-area: right;
    justify-content: flex-start;
    width: 100%;
  }
}
@media (max-width: 1100px) {
  /* En ventanas angostas la búsqueda y el selector deben vivir en filas propias. */
  #view-consultas .toolbar-left {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #view-consultas .view-toggle {
    width: min(100%, 460px);
  }
  #view-consultas .toggle-btn {
    flex: 1 1 0;
  }
  #view-consultas .toolbar-right {
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(240px, max-content);
    justify-content: start;
    gap: 12px;
  }
}
@media (max-width: 760px) {
  #view-consultas > .view-toolbar { gap: 10px; margin-bottom: 18px; }
  #view-consultas .toolbar-left { grid-template-columns: 1fr; gap: 10px; }
  #view-consultas .view-toggle { width: 100%; }
  #view-consultas .toggle-btn { flex: 1 1 0; padding: 8px 10px; font-size: 13px; }
  #view-consultas .toolbar-right { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 8px; width: 100%; }
  #view-consultas .total-leads-badge { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px; text-align: center; }
  #view-consultas #btnAddLead { width: 100%; justify-content: center; }
}
@media (max-width: 390px) {
  #view-consultas .lead-search-box { font-size: 14px; padding-left: 32px; padding-right: 70px; }
  #view-consultas .toggle-btn { padding-inline: 6px; font-size: 12px; }
  #view-consultas .toolbar-right { grid-template-columns: 1fr; }
  #view-consultas #btnAddLead { min-height: 46px; }
}

/* El encabezado conserva el nombre y nunca empuja acciones fuera del viewport. */
.topbar, .topbar-left, .topbar-right, .topbar-actions { min-width: 0; }
.topbar-left { flex: 1 1 auto; }
.topbar-title { min-width: 0; }
.topbar-title h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 761px) and (max-width: 1050px) {
  .topbar-right { flex: 0 1 auto; }
  .btn-tutorials-topbar { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .tutorials-topbar-text { display: none !important; }
  .btn-copilot-topbar { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .copilot-topbar-text { display: none !important; }
}

/* ── CONFIGURACIÓN Y CALENDARIO ───────────────────────────────────── */
.settings-view { max-width: 1080px; margin: 0 auto; }
.settings-header { margin-bottom: 24px; }
.settings-header h2 { margin: 4px 0 8px; font-size: clamp(24px, 3vw, 32px); }
.settings-header p { color: var(--text-secondary); }
.settings-grid { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(320px, 1.2fr); gap: 18px; }
.settings-card { padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.settings-card-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.settings-card-heading h3 { margin: 0 0 4px; font-size: var(--fs-md); }
.settings-card-heading p { color: var(--text-muted); font-size: var(--fs-sm); }
.settings-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 12px; }
.google-calendar-icon { color: #4285f4; background: #eaf2ff; }
.profile-summary { display: flex; align-items: center; gap: 14px; padding-top: 8px; }
.settings-avatar { width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; }
.settings-avatar.small { width: 36px; height: 36px; font-size: 12px; }
.profile-summary strong, .profile-summary span, .profile-summary small { display: block; }
.profile-summary span { margin-top: 3px; color: var(--text-secondary); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.profile-summary small { margin-top: 4px; color: var(--brand); font-size: 12px; font-weight: 700; }
.calendar-status { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; color: var(--text-secondary); font-size: var(--fs-sm); }
.calendar-status.is-connected { color: var(--green); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }
.calendar-status.is-connected .status-dot { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 15%, transparent); }
.calendar-meta { display: block; margin: -6px 0 12px; color: var(--text-muted); font-size: 12px; }
.settings-help { margin-bottom: 18px; color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.55; }
.settings-calendar-action { min-height: 44px; }
.settings-calendar-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.settings-calendar-actions button { min-height: 44px; }
.calendar-status.is-connected + .settings-help + .settings-calendar-action { background: var(--bg-hover); color: var(--text-primary); box-shadow: none; }
.settings-security { display: flex; align-items: center; gap: 5px; margin-top: 14px; color: var(--text-muted); font-size: 11px; }
.settings-error { margin: 12px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border)); border-radius: 10px; color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--bg-surface)); font-size: 13px; }
.settings-notice { margin: 12px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--border)); border-radius: 10px; color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--bg-surface)); font-size: 13px; }
.settings-notice.is-error { border-color: color-mix(in srgb, var(--red) 35%, var(--border)); color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--bg-surface)); }
.team-calendar-card { margin-top: 18px; }
.team-calendar-list { display: grid; gap: 8px; }
.team-calendar-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px 0; border-top: 1px solid var(--border); }
.team-calendar-name { flex: 1; min-width: 0; }
.team-calendar-name strong, .team-calendar-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-calendar-name span { margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.team-task-count, .team-calendar-state { white-space: nowrap; font-size: 12px; }
.team-task-count { color: var(--text-secondary); }
.team-calendar-state { color: var(--text-muted); }
.team-calendar-state.connected { color: var(--green); font-weight: 700; }
.settings-empty { color: var(--text-muted); font-size: var(--fs-sm); }
.stock-financials-row .form-help { display: block; margin-top: 5px; color: var(--text-muted); font-size: 11px; line-height: 1.35; }
.admin-accounts-card { margin-top: 18px; }
.admin-user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-user-field { display: grid; gap: 7px; min-width: 0; color: var(--text-primary); font-size: 13px; font-weight: 700; }
.admin-user-field .form-input { width: 100%; min-width: 0; min-height: 48px; }
.admin-user-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.admin-user-form-actions .settings-security { margin: 0; }
.admin-user-form-actions .btn-primary, .admin-password-form .btn-primary { min-height: 46px; padding: 10px 18px; }
.admin-account-feedback { margin-top: 14px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.admin-account-feedback[hidden] { display: none; }
.admin-account-feedback.is-success { color: var(--green); background: color-mix(in srgb, var(--green) 8%, var(--bg-surface)); border-color: color-mix(in srgb, var(--green) 28%, var(--border)); }
.admin-account-feedback.is-error { color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--bg-surface)); border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }
.admin-users-heading { display: flex; align-items: center; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.admin-users-heading h4 { margin: 0; font-size: 14px; }
.admin-users-heading > span { min-width: 24px; padding: 3px 7px; border-radius: 999px; color: var(--text-secondary); background: var(--bg-hover); font-size: 12px; text-align: center; }
.admin-users-list { display: grid; gap: 10px; min-width: 0; margin-top: 10px; }
.admin-users-loading { display: flex; align-items: center; gap: 10px; min-height: 50px; color: var(--text-secondary); font-size: 13px; }
.admin-users-loading .data-loading-spinner { width: 22px; height: 22px; border-width: 2px; }
.admin-user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); }
.admin-user-identity { display: grid; gap: 3px; min-width: 0; }
.admin-user-identity strong, .admin-user-identity span, .admin-user-identity small { min-width: 0; overflow-wrap: anywhere; }
.admin-user-identity span { color: var(--text-secondary); font-size: 13px; }
.admin-user-identity small { color: var(--text-muted); font-size: 12px; }
.admin-password-details { min-width: 0; }
.admin-password-details > summary { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 10px; cursor: pointer; list-style: none; text-align: center; }
.admin-password-details > summary::-webkit-details-marker { display: none; }
.admin-password-details[open] { grid-column: 1 / -1; width: 100%; padding-top: 10px; border-top: 1px solid var(--border); }
.admin-password-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; padding-top: 12px; }
.admin-password-form .btn-primary { grid-column: 1 / -1; justify-self: end; }
.admin-user-row .settings-avatar { font-size: 12px; }
@media (max-width: 760px) {
  .settings-grid { grid-template-columns: 1fr; }
  .team-calendar-row { flex-wrap: wrap; }
  .team-task-count { margin-left: 46px; }
  .team-calendar-state { margin-left: auto; }
  .admin-user-form-grid, .admin-password-form { grid-template-columns: 1fr; }
  .admin-user-form-actions { align-items: stretch; flex-direction: column; }
  .admin-user-form-actions .btn-primary { width: 100%; }
  .admin-user-row { grid-template-columns: auto minmax(0, 1fr); }
  .admin-password-details { grid-column: 1 / -1; width: 100%; }
  .admin-password-details > summary { width: 100%; }
  .admin-password-form .btn-primary { grid-column: auto; width: 100%; }
}
.data-loading-spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border);
  border-top-color: var(--brand); animation: data-spin .75s linear infinite;
}
.view-loading-state {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 240px;
  padding: 32px 20px;
  color: var(--text-secondary);
  text-align: center;
}
.view-loading-state .data-loading-spinner { width: 30px; height: 30px; }
.view-loading-state span { font-size: var(--fs-sm); font-weight: 600; }
@keyframes data-spin { to { transform: rotate(360deg); } }
.data-source-warning {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-md);
  background: color-mix(in srgb, #f59e0b 12%, var(--bg-card));
  border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--border)); color: var(--text-primary); font-size: var(--fs-sm);
}
.btn-data-retry { white-space: nowrap; padding: 7px 12px; }
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 45%, var(--bg-card) 65%); background-size: 400% 100%; animation: data-shimmer 1.25s ease infinite; border-radius: var(--radius-sm); }
@keyframes data-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-line { height: 14px; width: 100%; }
.skeleton-title { width: min(320px, 55vw); height: 36px; }
.skeleton-button { width: 144px; height: 38px; }
.pipeline-skeleton .pipeline-col, .clientes-skeleton { pointer-events: none; }
.pipeline-skeleton .skeleton-card { height: 168px; margin-top: 12px; }
.skeleton-client-card { height: 210px; }
@media (max-width: 640px) { .data-source-warning { align-items: flex-start; flex-direction: column; } }

/* ── 13. DASHBOARD ───────────────────────────────────────────────────── */
.dashboard-grid { display: flex; flex-direction: column; gap: 24px; }

/* KPI Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: transform var(--trans-bounce), box-shadow var(--trans-bounce), border-color var(--trans-bounce);
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  transition: background var(--trans);
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-brand);
}
.kpi-card:hover::before {
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
}
.kpi-card.kpi-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  border: none;
  box-shadow: var(--shadow-brand);
}
.kpi-card.kpi-primary::before { display: none; }
.kpi-card.kpi-primary:hover {
  box-shadow: 0 12px 36px rgba(229,25,34,0.50);
}
.kpi-card.kpi-primary .kpi-label { color: rgba(255,255,255,0.75); }
.kpi-card.kpi-primary .kpi-value { color: white; }
.kpi-card.kpi-primary .kpi-icon { background: rgba(255,255,255,0.20); }
.kpi-card.kpi-primary .kpi-trend { background: rgba(255,255,255,0.20); color: white; }

.kpi-icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.kpi-info { flex: 1; min-width: 0; }
.kpi-value {
  display: block; font-size: 1.5rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.kpi-label { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.kpi-trend {
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: var(--radius-pill); flex-shrink: 0;
}
.kpi-trend.up      { background: var(--green-bg); color: var(--green); }
.kpi-trend.down    { background: var(--red-bg); color: var(--red); }
.kpi-trend.neutral { background: var(--bg-app); color: var(--text-muted); }

/* Alertas de dashboard */
.dashboard-alerts { display: flex; flex-direction: column; gap: 10px; }
.alert-card {
  padding: 14px 20px; border-radius: var(--radius-md);
  font-size: var(--fs-base); font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.alert-info    { background: var(--blue-bg); border-left: 4px solid var(--blue); }
.alert-warning { background: var(--yellow-bg); border-left: 4px solid var(--yellow); }
.alert-danger  { background: var(--red-bg); border-left: 4px solid var(--red); }

/* Grid inferior dashboard */
.dashboard-bottom {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px; overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.dash-card-header h3 { font-size: var(--fs-base); font-weight: 700; }

.dash-leads-list { display: flex; flex-direction: column; gap: 10px; }
.dash-lead-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-md);
  width: 100%; min-width: 0; text-align: left; font: inherit; color: inherit;
  cursor: pointer; transition: background var(--trans), border-color var(--trans), transform var(--trans);
  border: 1px solid transparent;
}
.dash-lead-item:hover { background: var(--brand-soft); border-color: var(--border-brand); }
.lead-info { flex: 1; min-width: 0; }
.lead-name { font-size: var(--fs-sm); font-weight: 700; display: block; }
.lead-meta { font-size: var(--fs-xs); color: var(--text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dash-tasks-list { display: flex; flex-direction: column; gap: 8px; }
.dash-task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  cursor: pointer; border: 1px solid transparent; transition: background var(--trans), border-color var(--trans), transform var(--trans);
}
.dash-task-item:hover { background: var(--brand-soft); border-color: var(--border-brand); transform: translateX(2px); }
.dash-task-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.task-priority-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.priority-alta  { background: var(--red); box-shadow: 0 0 6px rgba(220,38,38,0.5); }
.priority-media { background: var(--yellow); }
.priority-baja  { background: var(--green); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

.task-info { flex: 1; min-width: 0; }
.task-title { font-size: var(--fs-sm); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta  { font-size: var(--fs-xs); color: var(--text-muted); display: block; }
.task-status {
  font-size: 11px; padding: 3px 10px;
  border-radius: var(--radius-pill); font-weight: 700;
}
.task-card-highlight { animation: taskCardHighlight 1.8s ease both; }
@keyframes taskCardHighlight {
  0%, 100% { box-shadow: var(--shadow-xs); }
  25%, 70% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 28%, transparent), var(--shadow-md); }
}
.status-pendiente   { background: var(--yellow-bg); color: var(--yellow); }
.status-en_progreso { background: var(--blue-bg); color: var(--blue); }
.status-completada  { background: var(--green-bg); color: var(--green); }

/* Pipeline visual */
.pipeline-card { overflow: auto; }
.pipeline-stages {
  display: flex; align-items: flex-end; gap: 20px;
  padding: 16px 0; height: 160px;
}
.pipeline-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.pipeline-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.pipeline-bar {
  width: 100%; border-radius: 6px 6px 0 0; min-height: 8px;
  transition: height 700ms cubic-bezier(0.34,1.56,0.64,1);
}
.stage-bar-nuevo       { background: linear-gradient(180deg, #60a5fa, var(--blue)); }
.stage-bar-calificado  { background: linear-gradient(180deg, #2dd4bf, #0d9488); }
.stage-bar-propuesta   { background: linear-gradient(180deg, #c084fc, var(--purple)); }
.stage-bar-negociacion { background: linear-gradient(180deg, #fcd34d, var(--yellow)); }
.stage-bar-cerrado     { background: linear-gradient(180deg, #4ade80, var(--green)); }
.pipeline-count { font-size: var(--fs-md); font-weight: 800; }
.pipeline-label { font-size: 11px; color: var(--text-muted); text-align: center; font-weight: 500; }

/* ── 14. CONSULTAS / PIPELINE ────────────────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px; gap: 2px;
}
.toggle-btn {
  padding: 8px 18px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
  transition: all var(--trans);
}
.toggle-btn.active {
  background: var(--brand);
  color: white;
  box-shadow: var(--shadow-brand);
}

/* Seguimiento comercial — visible únicamente para Administración */
.seller-overview {
  margin: 0 0 18px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.07), var(--bg-surface) 44%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.seller-overview-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.seller-overview-heading h3 { display: flex; align-items: center; gap: 7px; margin: 2px 0 0; font-size: var(--fs-md); }
.seller-eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.seller-overview-note { color: var(--text-muted); font-size: var(--fs-xs); }
.seller-overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.seller-status-card { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--text-primary); cursor: pointer; transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans); }
.seller-status-card:hover, .seller-status-card.active { border-color: var(--brand); box-shadow: 0 4px 14px rgba(229,25,34,.13); }
.seller-status-card.active { background: var(--brand-soft); }
.seller-status-avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; }
.seller-status-avatar.neutral { background: var(--text-secondary); }
.seller-status-body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
.seller-status-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.seller-status-body small, .seller-status-number small { color: var(--text-muted); font-size: 11px; font-weight: 500; }
.seller-status-number { display: flex; flex-direction: column; align-items: end; color: var(--brand); font-size: 20px; font-weight: 800; line-height: 1; }

.pipeline-board {
  display: flex; gap: 14px; overflow-x: auto;
  padding-bottom: 12px; min-height: 500px;
}

.pipeline-col {
  min-width: 230px; width: 230px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.pipeline-col-header {
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pipeline-col-title { font-size: var(--fs-sm); font-weight: 700; }
.pipeline-col-count {
  background: var(--bg-app); color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--radius-pill);
}
.pipeline-cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* El tablero no debe capturar la rueda en un contenedor sin altura. En
   escritorio cada columna desplaza sus tarjetas; en móvil desplaza la página. */
@media (min-width: 769px) {
  .pipeline-board { min-height: 0; height: calc(100dvh - var(--topbar-h) - 210px); max-height: calc(100dvh - var(--topbar-h) - 210px); overflow-y: clip; overscroll-behavior-y: auto; }
  .pipeline-col { min-height: 0; max-height: 100%; }
}
@media (max-width: 768px) {
  .seller-overview { padding: 13px; }
  .seller-overview-heading { align-items: start; flex-direction: column; }
  .seller-overview-grid { grid-template-columns: 1fr; }
  .seller-status-card { min-height: 52px; }
  .pipeline-board { max-height: none; overflow-y: visible; }
  .pipeline-col { max-height: none; }
  .pipeline-cards { overflow-y: visible; }
}

.pipeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-xs);
  contain: content;
  touch-action: pan-y;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
@media (hover: hover) and (pointer: fine) {
  .pipeline-card:hover {
    border-color: var(--border-brand);
    box-shadow: 0 4px 14px rgba(229,25,34,0.12);
  }
}
.pc-header { display: flex; align-items: center; gap: 8px; }
.pc-name-wrap { flex: 1; min-width: 0; }
.pc-name { font-size: var(--fs-sm); font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-time { font-size: 11px; color: var(--text-muted); display: block; }
.pc-channel { font-size: 1rem; flex-shrink: 0; }
.pc-vehicle { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-assigned { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.pc-assigned.unassigned { color: var(--orange); font-weight: 600; }
.empty-col { text-align: center; color: var(--text-muted); font-size: var(--fs-sm); padding: 20px; }

/* ── Multi-lead badge & chips (1 cliente con múltiples autos en pipeline) ── */
.pc-multi-lead-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.12), rgba(229, 25, 34, 0.04));
  border: 1px solid rgba(229, 25, 34, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--brand);
  cursor: pointer;
  transition: all var(--trans);
  margin-top: 2px;
}
.pc-multi-lead-badge:hover {
  background: rgba(229, 25, 34, 0.2);
  border-color: var(--brand);
  transform: translateY(-1px);
}
.multi-lead-action {
  font-size: 10px;
  text-decoration: underline;
  color: var(--text-muted);
}
.pc-multi-lead-badge:hover .multi-lead-action {
  color: var(--brand);
}
.pc-other-interests {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--brand);
}
.other-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.other-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  color: var(--text-secondary);
}
.existing-client-notice {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid #3b82f6;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}
.badge-multi-lead {
  display: inline-block;
  background: rgba(229, 25, 34, 0.1);
  color: var(--brand);
  border: 1px solid rgba(229, 25, 34, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
}

/* ── 15. KANBAN TAREAS ───────────────────────────────────────────────── */
.tasks-summary { display: flex; gap: 14px; align-items: center; }
.task-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-secondary); font-weight: 500;
}

.kanban-board {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px; min-height: 450px;
}
.kanban-col {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-xs);
}
.kanban-col-header {
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.kanban-col-title { font-size: var(--fs-base); font-weight: 700; }
.kanban-col-count {
  background: var(--bg-app); color: var(--text-muted);
  font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--radius-pill);
}
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 250px;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  contain: content;
  touch-action: pan-y;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.kanban-card:active { cursor: grabbing; }
@media (hover: hover) and (pointer: fine) {
  .kanban-card:hover { border-color: var(--border-brand); box-shadow: var(--shadow-sm); }
}
.kanban-card.overdue { border-left: 4px solid var(--red); }

.kanban-card.dragging {
  opacity: 0.45 !important;
  transform: scale(0.97) rotate(-1.5deg) !important;
  border: 2px dashed var(--brand) !important;
  box-shadow: var(--shadow-lg) !important;
}

.kanban-col {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-xs);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.kanban-col.drop-target-active {
  background: rgba(229, 25, 34, 0.05) !important;
  border: 2px dashed var(--brand) !important;
  box-shadow: 0 0 20px rgba(229, 25, 34, 0.15) !important;
}

.kanban-col.drop-target-active .empty-col {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.kanban-col .empty-col {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  background: rgba(0,0,0,0.01);
  transition: all 0.15s ease;
}

.kc-header { display: flex; align-items: flex-start; gap: 8px; }
.kc-title { font-size: var(--fs-base); font-weight: 600; flex: 1; }
.kc-desc { font-size: var(--fs-sm); color: var(--text-secondary); }
.kc-footer { display: flex; align-items: center; justify-content: space-between; }
.kc-assigned { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; }
.kc-due { font-size: var(--fs-xs); color: var(--text-muted); }
.overdue-text { color: var(--red) !important; font-weight: 700; }
.kc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.kc-btn {
  padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 700;
  background: var(--bg-app); color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.kc-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.kc-btn-primary { background: var(--brand-soft); color: var(--brand); border-color: var(--border-brand); }
.kc-btn-success { background: var(--green-bg); color: var(--green); border-color: transparent; }

/* ── 16. PERITAJE ────────────────────────────────────────────────────── */
.peritaje-layout {
  display: grid; grid-template-columns: 270px 1fr;
  gap: 18px; height: calc(100vh - var(--topbar-h) - 28px - 40px);
}
.peritaje-list-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow-xs);
}
.panel-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.peritaje-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.peritaje-list-item {
  padding: 12px 14px; border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--trans);
  border: 2px solid transparent;
}
.peritaje-list-item:hover { background: var(--bg-app); }
.peritaje-list-item.active { background: var(--brand-soft); border-color: var(--border-brand); }
.pi-main { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pi-vehicle { font-size: var(--fs-sm); font-weight: 700; }
.pi-date { font-size: 11px; color: var(--text-muted); }
.pi-meta { display: flex; align-items: center; justify-content: space-between; }
.pi-value { font-size: var(--fs-xs); color: var(--green); font-weight: 700; }

.peritaje-detail-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow-y: auto; padding: 24px;
  box-shadow: var(--shadow-xs);
}

.peritaje-ficha { display: flex; flex-direction: column; gap: 24px; }
.ficha-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ficha-meta { font-size: var(--fs-sm); color: var(--text-muted); display: block; margin-top: 4px; }
.ficha-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.ficha-value { font-size: 1.3rem; font-weight: 800; color: var(--green); }

.damage-map-section h4 { margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.damage-count { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); background: var(--bg-app); padding: 3px 10px; border-radius: var(--radius-pill); }

.damage-map-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 18px; }

.damage-map {
  position: relative; background: linear-gradient(135deg, #f8f8fc, #f0f0f8);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  min-height: 300px;
  display: flex; align-items: center; justify-content: center;
}
.car-silhouette { width: 100%; max-width: 320px; color: var(--text-muted); }

.damage-zone-btn {
  position: absolute; transform: translate(-50%, -50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-surface); border: 2px solid var(--border-strong);
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans-bounce); z-index: 2;
  box-shadow: var(--shadow-xs);
}
.damage-zone-btn:hover {
  border-color: var(--brand); color: var(--brand);
  background: var(--brand-soft);
  transform: translate(-50%, -50%) scale(1.25);
  box-shadow: 0 0 0 6px var(--brand-soft);
}
.damage-zone-btn.damaged { color: white; border-color: transparent; }
.damage-zone-btn.sev-leve     { background: var(--yellow); box-shadow: 0 2px 10px rgba(217,119,6,0.4); }
.damage-zone-btn.sev-moderado { background: var(--orange); box-shadow: 0 2px 10px rgba(234,88,12,0.4); }
.damage-zone-btn.sev-grave    { background: var(--red); box-shadow: 0 2px 10px rgba(220,38,38,0.4); }

.damage-list { display: flex; flex-direction: column; gap: 8px; }
.damage-list h5 { margin-bottom: 10px; font-size: var(--fs-sm); }
.damage-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-app); border-left: 4px solid var(--yellow);
}
.damage-item.sev-moderado { border-left-color: var(--orange); }
.damage-item.sev-grave    { border-left-color: var(--red); }
.damage-item-left { display: flex; flex-direction: column; gap: 2px; }
.damage-zone-name { font-size: var(--fs-sm); font-weight: 700; }
.damage-severity  { font-size: var(--fs-xs); font-weight: 700; }
.damage-remove {
  color: var(--text-muted); font-size: 0.9rem;
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: all var(--trans); border: 1px solid transparent;
}
.damage-remove:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

.ficha-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.ficha-created { font-size: var(--fs-xs); color: var(--text-muted); }

/* ── 17. MODAL ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; overscroll-behavior: contain;
}
.modal-overlay.open { display: flex; animation: fadeOverlay 250ms ease; }
@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 700px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 300ms cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn {
  from { transform: scale(0.90) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-sm { max-width: 440px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 14px;
}
.modal-header h3 { font-size: var(--fs-md); font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); flex-shrink: 0;
  border: 1px solid var(--border);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); transform: scale(1.1); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }

/* Modal de chat */
.modal-chat { max-width: 660px; }
.chat-lead-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.chat-meta { font-size: var(--fs-xs); color: var(--text-muted); display: block; margin-top: 2px; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-chatwoot {
  padding: 8px 16px; border-radius: var(--radius-pill);
  background: var(--blue-bg); color: var(--blue);
  font-size: var(--fs-xs); font-weight: 700;
  transition: all var(--trans); border: 1px solid transparent;
}
.btn-chatwoot:hover { background: var(--blue); color: white; box-shadow: 0 4px 14px rgba(37,99,235,0.3); }

.chat-context-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg-app);
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 220px; max-height: 360px;
}

.chat-bubble {
  max-width: 82%; display: flex; flex-direction: column; gap: 4px;
}
.bubble-bot     { align-self: flex-start; }
.bubble-cliente { align-self: flex-end; }
.bubble-asesor  { align-self: flex-start; }

.bubble-meta { display: flex; align-items: center; gap: 8px; }
.bubble-sender { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.bubble-time   { font-size: 10px; color: var(--text-muted); }

.bubble-content {
  padding: 12px 16px; border-radius: 18px;
  font-size: var(--fs-base); line-height: 1.55;
}
.bubble-bot .bubble-content {
  background: var(--brand-soft); border-bottom-left-radius: 4px;
  border: 1px solid var(--border-brand);
}
.bubble-cliente .bubble-content {
  background: var(--blue-bg); border-bottom-right-radius: 4px;
  border: 1px solid rgba(37,99,235,0.15);
}
.bubble-asesor .bubble-content {
  background: var(--green-bg); border-bottom-left-radius: 4px;
  border: 1px solid rgba(22,163,74,0.15);
}
.no-messages { text-align: center; color: var(--text-muted); font-size: var(--fs-base); padding: 24px; }

.chat-reply-bar {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; flex-shrink: 0;
}
.reply-input {
  background: var(--bg-input); color: var(--text-primary);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; font-size: var(--fs-base); resize: none; width: 100%;
  transition: all var(--trans);
}
.reply-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reply-right { display: flex; gap: 10px; align-items: center; }
.stage-select {
  background: var(--bg-input); color: var(--text-primary);
  border: 2px solid var(--border); border-radius: var(--radius-pill);
  padding: 8px 14px; font-size: var(--fs-sm);
}

/* ── 18. VENTAS ──────────────────────────────────────────────────────── */
.ventas-layout { display: flex; flex-direction: column; gap: 24px; }
.ventas-kpis { grid-template-columns: repeat(4, 1fr); }
.section-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-xs);
}
.section-card h3 { margin-bottom: 16px; font-size: var(--fs-base); }

/* ── 19. CLIENTES ────────────────────────────────────────────────────── */
.clientes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px; margin-top: 4px;
}
.cliente-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: all var(--trans-bounce);
  box-shadow: var(--shadow-xs);
}
.cliente-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-brand); }
.status-border-vip   { border-top: 4px solid var(--yellow); }
.status-border-activo{ border-top: 4px solid var(--green); }
.cliente-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.cliente-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cliente-name { font-size: var(--fs-md); font-weight: 700; }
.cliente-phone, .cliente-email { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500; }
.cliente-status-badge { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: var(--radius-pill); flex-shrink: 0; }
.cst-vip    { background: var(--yellow-bg); color: var(--yellow); }
.cst-activo { background: var(--green-bg); color: var(--green); }
.cliente-card-body { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.cliente-stat { display: flex; flex-direction: column; gap: 3px; }
.cs-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.cs-value { font-size: var(--fs-sm); font-weight: 700; }
.cs-small { font-size: var(--fs-xs); font-weight: 400; color: var(--text-secondary); }

/* ── 20. DEV LOGS ─────────────────────────────────────────────────────── */
.dev-logs-layout { display: flex; flex-direction: column; gap: 18px; }
.dev-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 22px; gap: 14px;
  box-shadow: var(--shadow-xs);
}
.dev-status-indicator { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); font-weight: 500; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); animation: pulse-dot 2s infinite; }
.dev-actions { display: flex; gap: 10px; }

.dev-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.dev-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; text-align: center;
  box-shadow: var(--shadow-xs);
}
.dev-stat-value { display: block; font-size: 2rem; font-weight: 800; color: var(--brand); }
.dev-stat-label { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; font-weight: 600; }

.log-stream {
  background: #0f1117; border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100vh - var(--topbar-h) - 280px);
  overflow-y: auto; font-family: 'Courier New', monospace;
  box-shadow: inset 0 2px 12px rgba(0,0,0,0.2);
}
.log-entry {
  border-radius: var(--radius-sm); overflow: hidden;
  border-left: 3px solid var(--green);
}
.log-entry.log-error { border-left-color: var(--red); }
.log-entry-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: rgba(255,255,255,0.03);
  flex-wrap: wrap;
}
.log-timestamp { font-size: 11px; color: #64748b; }
.log-source    { font-size: 12px; color: #0d9488; }
.log-event     { font-size: 12px; color: #d97706; flex: 1; }
.log-status-badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: var(--radius-pill); }
.lsb-ok    { background: var(--green-bg); color: var(--green); }
.lsb-error { background: var(--red-bg); color: var(--red); }
.log-payload { padding: 8px 12px; font-size: 12px; color: #94a3b8; line-height: 1.6; }

/* ── 21. RESPONSIVE ─────────────────────────────────────────────────── */

/* Tablet / Notebook grande */
@media (max-width: 1200px) {
  .dashboard-bottom    { grid-template-columns: 1fr; }
  .kanban-board        { grid-template-columns: 1fr 1fr; }
  .ventas-kpis         { grid-template-columns: repeat(2, 1fr); }
  .peritaje-layout     { grid-template-columns: 1fr; height: auto; }
  .damage-map-wrap     { grid-template-columns: 1fr; }
  .dev-stats-row       { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet / Notebook pequeña */
@media (max-width: 960px) {
  :root { --sidebar-w: 220px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-user-name { max-width: 100px; }
  .topbar { padding: 0 18px; }
  .content-area { padding: 20px; }
}

/* Móvil — diseño completamente adaptado */
@media (max-width: 700px) {
  :root {
    --topbar-h: 64px;
    --fs-base: 15px;
    --fs-md: 17px;
    --fs-lg: 20px;
  }

  body { overflow: hidden; }

  #app { position: relative; }

  /* Sidebar: oculto por defecto en móvil, slide-in */
  #sidebar-root {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 500;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform var(--trans-slow);
    box-shadow: none;
  }
  #sidebar-root.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.35);
  }
  #sidebar-root:has(.sidebar.collapsed) {
    width: var(--sidebar-w) !important;
  }
  .sidebar { width: 100% !important; }
  .sidebar.collapsed { width: 100% !important; }
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .sidebar-footer { display: flex !important; }

  .main-layout { width: 100%; }

  /* Botón hamburguesa en topbar */
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-date { display: none; }
  #btnMenuMobile {
    display: flex !important;
    width: 40px; height: 40px; border-radius: var(--radius-md);
    align-items: center; justify-content: center;
    font-size: 1.2rem; background: var(--bg-app); border: 1px solid var(--border);
    color: var(--text-secondary); flex-shrink: 0;
  }

  /* Overlay detrás del sidebar */
  #mobileOverlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 499;
  }
  #mobileOverlay.open { display: block; }

  .topbar-user-info { display: none; }
  .topbar-user-badge { padding: 4px; }

  .content-area { padding: 16px 14px 30px; }
  .view-toolbar { gap: 8px; }
  .search-wrap { max-width: 100%; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 16px 14px; }
  .kpi-value { font-size: 1.2rem; }
  .kpi-icon { width: 42px; height: 42px; font-size: 1.2rem; }

  .dashboard-bottom { grid-template-columns: 1fr; }
  .pipeline-board { flex-direction: column; }
  .pipeline-col { min-width: unset; width: 100%; }
  .kanban-board { grid-template-columns: 1fr; }
  .clientes-grid { grid-template-columns: 1fr; }
  .dev-stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }

  .modal { border-radius: var(--radius-lg); max-height: 95vh; }
  .modal-overlay { padding: 10px; }

  .data-table th, .data-table td { padding: 10px 12px; font-size: var(--fs-xs); }
}

/* Pantallas muy pequeñas */
@media (max-width: 380px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1rem; }
  .role-btn { padding: 6px 8px; }
}

/* ── 22. MOBILE MENU BUTTON (oculto en desktop) ─────────────────────── */
#btnMenuMobile { display: none; }

/* ── 23. INTERACTIVE DRAG & DROP (Mouse + Touch) ────────────────────── */
.kanban-hint-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-xs);
}

.pipeline-card {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--trans), box-shadow var(--trans), opacity var(--trans), border-color var(--trans);
  touch-action: pan-y;
}

.pipeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card.dragging {
  opacity: 0.45 !important;
  transform: scale(0.97) rotate(-1.5deg) !important;
  border: 2px dashed var(--brand) !important;
  box-shadow: var(--shadow-lg) !important;
}

.pipeline-col {
  transition: background-color var(--trans), border-color var(--trans), box-shadow var(--trans);
  border-radius: var(--radius-md);
}

.pipeline-col.drop-target-active {
  background: rgba(229, 25, 34, 0.05) !important;
  border: 2px dashed var(--brand) !important;
  box-shadow: 0 0 20px rgba(229, 25, 34, 0.15) !important;
}

.empty-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  background: rgba(0,0,0,0.01);
  transition: all var(--trans);
}

.pipeline-col.drop-target-active .empty-drop-zone {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

@keyframes dropSuccessPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.drop-success-pulse {
  animation: dropSuccessPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Acciones rápidas en tarjeta de Lead */
.pc-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-chat-quick {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-buttons);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
}
.btn-edit-lead { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 700; cursor: pointer; }
.btn-edit-lead:hover { color: var(--brand); border-color: var(--brand); }
.lead-edit-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 14px; padding: 2px 0; }
.lead-edit-notes { grid-column: 1 / -1; }
.edit-lead-feedback { min-height: 18px; margin: 10px 0; color: var(--text-muted); font-size: var(--fs-xs); }

.btn-chat-quick:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(229, 25, 34, 0.25);
}

.btn-wa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: #25d366;
  color: #fff !important;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  transition: all var(--trans);
  flex-shrink: 0;
}

.btn-wa-icon:hover {
  background: #1eb956;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
}

.lead-search-box {
  width: 100%;
  padding: 9px 36px 9px 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  transition: border-color var(--trans), box-shadow var(--trans);
}

.lead-search-box:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
}

.clear-search-btn:hover {
  color: var(--text-primary);
}

.total-leads-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
}

/* ── 24. CHATWOOT LIVE WHATSAPP VIEWER ──────────────────────────────── */
.chat-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-source-db {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-source-db::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 8px #16a34a;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.btn-wa-direct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  background: #25d366;
  color: #ffffff !important;
  font-family: var(--font-buttons);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  transition: all var(--trans);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.btn-wa-direct:hover {
  background: #1eb956;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.40);
}

.chat-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(229, 25, 34, 0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reply-input-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.reply-input-wrap .reply-input {
  flex: 1;
}

.reply-input-wrap .voice-btn {
  margin-bottom: 6px;
}

/* ── 25. MICRO-ANIMACIONES DE VOZ ──────────────────────────────────── */
.obs-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.voice-hint {
  font-size: 11px;
  color: var(--brand);
  font-weight: 600;
}

.voice-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans);
  flex-shrink: 0;
}

.voice-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.05);
}

.voice-btn.voice-active {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 6px var(--brand-glow), 0 0 20px rgba(229, 25, 34, 0.4);
  animation: pulseVoice 1s infinite alternate ease-in-out;
}

@keyframes pulseVoice {
  0% { transform: scale(1); box-shadow: 0 0 0 4px var(--brand-glow); }
  100% { transform: scale(1.12); box-shadow: 0 0 0 10px rgba(229, 25, 34, 0.15), 0 0 25px rgba(229, 25, 34, 0.5); }
}

/* Clases de clon táctil */
.touch-drag-clone {
  cursor: grabbing !important;
}

/* ── 26. PANEL DE SUGERENCIAS DE IA (Gemini) ────────────────────────── */
.ai-tasks-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.ai-tasks-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #f59e0b, #ec4899);
}

.ai-panel-header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-badge-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-sparkle {
  font-size: 1.2rem;
}

.ai-badge-title h4 {
  font-family: var(--font-buttons);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.ai-caption-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(229, 25, 34, 0.08);
  color: var(--brand);
  border: 1px solid rgba(229, 25, 34, 0.2);
}

.ai-subtitle {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
  width: 100%;
}

.ai-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.ai-suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow-xs);
}

.ai-suggestion-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 25, 34, 0.4);
  box-shadow: var(--shadow-sm);
}

.ai-sug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-sug-reason {
  font-size: 11px;
  font-weight: 600;
  color: #d97706;
  background: rgba(217, 119, 6, 0.08);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.ai-sug-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.ai-sug-desc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: 1.45;
  flex: 1;
}

.ai-sug-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ai-lead-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-accept-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font-family: var(--font-buttons);
  font-size: var(--fs-xs);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--trans);
  box-shadow: 0 4px 12px rgba(229, 25, 34, 0.25);
  flex-shrink: 0;
}

.btn-accept-ai:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(229, 25, 34, 0.35);
}

.ai-empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  background: rgba(0,0,0,0.01);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

/* ── 27. LOGIN VIEW & GOOGLE ONE-CLICK AUTH ────────────────────────── */
.login-page-container {
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 10% 20%, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-y: auto;
}

.login-page-container::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(229, 25, 34, 0.18) 0%, rgba(229, 25, 34, 0) 70%);
  top: -100px;
  right: -100px;
  pointer-events: none;
}

.login-wrapper {
  width: 100%;
  max-width: 520px;
  position: relative;
  z-index: 10;
  animation: loginSlideUp 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-top: 4px solid var(--brand);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-wrap {
  width: 68px;
  height: 68px;
  margin: 0 auto 12px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 6px 20px rgba(229, 25, 34, 0.25);
  border: 1px solid rgba(229, 25, 34, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-title {
  font-family: var(--font-headings);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.login-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  background: rgba(229, 25, 34, 0.08);
  color: var(--brand);
  border: 1px solid rgba(229, 25, 34, 0.2);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: var(--fs-xs);
  color: #64748b;
  line-height: 1.4;
  max-width: 380px;
  margin: 0 auto;
}

.login-feedback {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-bottom: 18px;
  text-align: center;
  animation: fadeIn 200ms ease;
}
.login-feedback.fb-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.login-feedback.fb-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.login-feedback.fb-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* Sección de Google One-Click */
.login-google-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.btn-google-login {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all var(--trans);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-google-login:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}
.btn-google-login:disabled,
.btn-submit-login:disabled {
  cursor: wait;
  opacity: .68;
  transform: none;
  box-shadow: none;
}

.google-caption {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Divisor */
.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0 20px;
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e2e8f0;
}

.login-divider span {
  padding: 0 12px;
}

/* Formulario */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
  color: #94a3b8;
}

.input-icon-wrap .form-input {
  padding-left: 44px;
  padding-right: 44px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
  font-size: var(--fs-sm);
  transition: all var(--trans);
  background: #f8fafc;
  width: 100%;
}

.input-icon-wrap .form-input:focus {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

.btn-submit-login {
  height: 50px;
  background: var(--brand);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--trans);
  box-shadow: 0 6px 18px rgba(229, 25, 34, 0.35);
  margin-top: 4px;
}

.btn-submit-login:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(229, 25, 34, 0.45);
}
.btn-submit-login:disabled:hover,
.btn-google-login:disabled:hover {
  transform: none;
}

.login-card-footer {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
}

@media (max-width: 600px) {
  .login-card {
    padding: 28px 20px;
  }
}

/* ── 28. AGENT COPILOT & VOICE SEARCH (Issue #13) ────────────────── */
/* Botón en TopBar */
.btn-copilot-topbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--brand), #ff4851);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-buttons);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.35);
  transition: all var(--trans);
}

.btn-copilot-topbar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(229, 25, 34, 0.5);
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.copilot-sparkle {
  font-size: 14px;
  animation: sparkleTwinkle 2s infinite ease-in-out;
}

@keyframes sparkleTwinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.9; }
  50% { transform: scale(1.25) rotate(15deg); opacity: 1; }
}

/* Botón flotante FAB */
.copilot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  height: 54px;
  padding: 0 20px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1.5px solid rgba(229, 25, 34, 0.4);
  color: #ffffff;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  z-index: 9990;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform var(--trans-bounce), border-color var(--trans-bounce), box-shadow var(--trans-bounce);
}

.copilot-fab:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--brand);
  box-shadow: 0 14px 40px rgba(229, 25, 34, 0.4);
}

.copilot-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--brand);
  opacity: 0;
  animation: fabPulse 2.5s infinite cubic-bezier(0.24, 0, 0.38, 1);
  pointer-events: none;
}

@keyframes fabPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  70% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.2); opacity: 0; }
}

.copilot-fab-icon {
  font-size: 18px;
}

.copilot-fab-label {
  min-width: 0;
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.copilot-fab-badge {
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

/* Drawer Deslizante */
.copilot-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  max-width: 100vw;
  background: var(--bg-surface);
  box-shadow: -12px 0 45px rgba(0, 0, 0, 0.3);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--trans-slow);
  border-left: 1px solid var(--border);
}

.copilot-drawer.open {
  transform: translateX(0);
}

/* Header del Copilot */
.copilot-header {
  padding: 18px 20px;
  background: #1a1a2e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--brand);
}

.copilot-brand,
.copilot-brand > div {
  min-width: 0;
}

.copilot-brand > div {
  overflow: hidden;
}

.copilot-brand strong,
.copilot-status {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.copilot-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copilot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.copilot-online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #1a1a2e;
}

.copilot-info {
  display: flex;
  flex-direction: column;
}

.copilot-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copilot-name {
  font-family: var(--font-headings);
  font-size: var(--fs-base);
  font-weight: 700;
  color: #ffffff;
}

.copilot-tag {
  background: rgba(229, 25, 34, 0.2);
  border: 1px solid var(--brand);
  color: #ff6b72;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.copilot-status {
  font-size: 11px;
  color: #94a3b8;
}

.copilot-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--trans);
}

.copilot-close-btn:hover {
  background: var(--brand);
}

/* Feed de Conversación */
.copilot-feed {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-app);
}

.copilot-msg {
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: fadeIn 200ms ease;
}

.copilot-msg.msg-user {
  align-items: flex-end;
}

.copilot-msg.msg-bot {
  align-items: flex-start;
}

.msg-bubble {
  min-width: 0;
  max-width: 88%;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.user-bubble {
  background: #1a1a2e;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.msg-author {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  display: block;
  margin-bottom: 4px;
}

.bot-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
}

.msg-bot-title {
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 6px;
  font-size: var(--fs-sm);
}

.msg-bot-body {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* Chips rápidos */
.copilot-chips-wrap {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.chips-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.chips-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.chips-learning-note {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.copilot-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.copilot-chip-btn {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--trans);
  line-height: 1.35;
}

.copilot-chip-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  transform: translateX(3px);
}

/* Acciones de Boti: una lista operativa clara, sin convertir el chat en un tablero denso. */
.copilot-workflow-suggestions {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 12px;
}

.copilot-workflow-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copilot-workflow-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.copilot-workflow-note {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.copilot-workflow-helper {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  margin: 5px 0 9px;
}

.copilot-workflow-list {
  display: grid;
  gap: 7px;
}

.copilot-workflow-btn {
  align-items: center;
  background: var(--bg-app);
  background: color-mix(in srgb, var(--bg-app) 92%, var(--brand-soft));
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  min-height: 58px;
  padding: 8px 10px;
  text-align: left;
  transition: border-color var(--trans), background var(--trans), transform var(--trans);
  width: 100%;
}

.copilot-workflow-btn:hover,
.copilot-workflow-btn:focus-visible {
  background: var(--bg-surface);
  border-color: var(--brand);
  outline: none;
  transform: translateX(2px);
}

.copilot-workflow-icon {
  align-items: center;
  background: var(--brand-soft);
  border-radius: 10px;
  color: var(--brand);
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.copilot-workflow-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.copilot-workflow-copy strong {
  font-size: 13px;
  line-height: 1.25;
}

.copilot-workflow-copy small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.3;
}

.copilot-workflow-mode {
  align-items: center;
  color: var(--brand);
  display: inline-flex;
  justify-content: center;
}

/* Tarjetas de Acción */
.copilot-action-card {
  background: var(--bg-app);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 10px 0;
}

.copilot-action-card.peritaje-card {
  border-left: 4px solid var(--brand);
}

.copilot-action-card.task-card {
  border-left: 4px solid #3b82f6;
}

.copilot-action-card.triage-card {
  border-left: 4px solid #10b981;
}

.copilot-action-card.pitch-card {
  border-left: 4px solid #25d366;
}

.copilot-action-card.stock-card {
  border-left: 4px solid #f59e0b;
}

.copilot-action-card.advice-card {
  border-left: 4px solid #8b5cf6;
}

.copilot-action-card.status-query-card {
  border-left-color: #0ea5e9;
}

.copilot-status-results {
  display: grid;
  gap: 7px;
  margin: 8px 0 10px;
}

.copilot-status-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.copilot-status-result strong,
.copilot-status-result small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copilot-status-result small {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11px;
}

.status-query-badge {
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* Contenedor de Multi-Acciones / Desglose en partes */
.copilot-multiaction-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.cac-multistep-summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(229, 25, 34, 0.08);
  border: 1px solid rgba(229, 25, 34, 0.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}

.cac-step-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 12px;
  color: var(--text-secondary);
}

.cac-lead-badge-row {
  margin: 6px 0;
}

.cac-lead-pill {
  font-size: 11px;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-block;
}

.cac-pitch-box {
  background: rgba(37, 211, 102, 0.06);
  border: 1px dashed rgba(37, 211, 102, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 8px 0;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-primary);
}

.cac-pitch-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-cac-copy, .btn-cac-chat {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all var(--trans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-cac-copy:hover {
  background: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.btn-cac-copy.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

.btn-cac-chat:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.cac-stock-mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.cac-stock-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
}

.cac-stock-price {
  font-weight: 700;
  color: var(--brand);
}

.cac-advice-content {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-secondary);
  margin-top: 6px;
}

.cac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cac-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
}

.cac-badge.badge-blue {
  color: #2563eb;
}

.cac-badge.badge-green {
  color: #059669;
}

.cac-date, .cac-assignee {
  font-size: 11px;
  color: var(--text-muted);
}

.cac-car-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.cac-damages-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.damage-pill {
  background: rgba(229, 25, 34, 0.08);
  color: var(--brand);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.cac-task-info {
  font-size: 11px;
  background: rgba(59, 130, 246, 0.08);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: #1d4ed8;
  margin-bottom: 10px;
}

.btn-cac-nav {
  width: 100%;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--trans);
}

.btn-cac-nav:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* Triaje de Leads */
.triage-leads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.triage-lead-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tli-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tli-rank {
  background: #10b981;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}

.tli-name {
  font-size: var(--fs-xs);
  color: var(--text-primary);
  flex: 1;
}

.tli-score {
  font-size: 10px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.tli-car {
  font-size: 11px;
  color: var(--text-secondary);
}

.tli-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 3px 0;
}

.tli-reason-tag {
  font-size: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.tli-pitch {
  font-size: 11px;
  color: #475569;
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid #3b82f6;
  margin: 4px 0;
}

.btn-tli-chat {
  align-self: flex-start;
  padding: 5px 12px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
}

.btn-tli-chat:hover {
  background: #1eb754;
  transform: translateY(-1px);
}

/* Banner de Grabación por Voz */
.copilot-voice-recording-banner {
  background: #1a1a2e;
  border-top: 1px solid var(--brand);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  animation: fadeIn 150ms ease;
}

.voice-wave-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.voice-wave-bars span {
  width: 3px;
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  animation: waveBar 800ms infinite ease-in-out alternate;
}

.voice-wave-bars span:nth-child(2) { animation-delay: 150ms; }
.voice-wave-bars span:nth-child(3) { animation-delay: 300ms; }
.voice-wave-bars span:nth-child(4) { animation-delay: 450ms; }
.voice-wave-bars span:nth-child(5) { animation-delay: 600ms; }

@keyframes waveBar {
  0%   { height: 4px; opacity: 0.4; }
  100% { height: 20px; opacity: 1; }
}

.voice-recording-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.voice-recording-text {
  font-size: 11px;
  color: #ff6b72;
  font-weight: 700;
}

.voice-recording-sub {
  font-size: 10px;
  color: #cbd5e1;
}

.copilot-footer-tip {
  margin-top: 8px;
  font-size: 10.5px;
  color: #64748b;
  text-align: center;
  line-height: 1.3;
}

/* Spinner de ejecución */
.copilot-executing-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.copilot-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer & Input Bar */
.copilot-footer {
  min-width: 0;
  padding: 14px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.copilot-input-bar {
  display: flex;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  gap: 8px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 4px 6px 4px 8px;
  transition: border-color var(--trans), background-color var(--trans), box-shadow var(--trans);
}

.copilot-input-bar:focus-within {
  border-color: var(--brand);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.copilot-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  margin-block: 2px;
  transition: background-color var(--trans), color var(--trans), box-shadow var(--trans), transform var(--trans);
  flex-shrink: 0;
}

.copilot-mic-btn:hover {
  background: var(--brand-soft);
  transform: scale(1.08);
}

.copilot-mic-btn.listening {
  background: var(--brand);
  color: #fff;
  animation: pulseMic 1s infinite alternate;
}

@keyframes pulseMic {
  from { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 25, 34, 0.7); }
  to   { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(229, 25, 34, 0); }
}

.copilot-input {
  flex: 1;
  display: block;
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--fs-xs);
  color: var(--text-primary);
  outline: none;
  line-height: 1.35;
  min-height: 40px;
  max-height: 136px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: 8px 0;
  resize: none;
}

.copilot-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  margin-block: 3px;
  transition: background-color var(--trans), box-shadow var(--trans), transform var(--trans);
  flex-shrink: 0;
}

.copilot-send-btn:hover {
  background: var(--brand-dark);
  transform: scale(1.06);
}

/* Botón de voz en buscador de leads */
.voice-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--trans);
}

.voice-search-btn:hover {
  background: var(--brand-soft);
  transform: scale(1.1);
}

.voice-search-btn.voice-active {
  background: var(--brand);
  color: #fff;
  animation: pulseMic 1s infinite alternate;
}

@media (max-width: 600px) {
  .copilot-drawer {
    width: 100vw;
  }
  .chips-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .chips-learning-note {
    white-space: normal;
  }
  .copilot-workflow-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .copilot-workflow-note {
    white-space: normal;
  }
  .copilot-workflow-btn {
    min-height: 62px;
  }
  .copilot-workflow-copy strong {
    font-size: 14px;
  }
  .copilot-workflow-copy small {
    font-size: 12px;
  }
  .copilot-fab {
    bottom: 20px;
    right: 20px;
    height: 48px;
    padding: 0 16px;
  }

  .copilot-footer {
    padding: 12px max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .copilot-input-bar {
    gap: 6px;
    border-radius: 16px;
  }

  .copilot-mic-btn,
  .copilot-send-btn {
    flex: 0 0 38px;
  }
}

/* ── 29. STOCK EDITOR & DETAIL MODAL ─────────────────────────────── */
@media (max-height: 600px) {
  .copilot-input { max-height: 96px; }
  .copilot-feed { padding-block: 12px; }
  .copilot-footer-tip { display: none; }
}

.modal-stock {
  max-width: 760px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-stock .modal-body {
  padding: 18px 24px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-stock .form-group {
  gap: 5px;
}

.modal-stock .form-group label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}

.modal-stock .form-input {
  padding: 9px 13px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
}

.modal-stock .form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stock-financials-row {
  align-items: flex-end;
}

.price-highlight {
  font-weight: 700;
  color: var(--brand) !important;
}

.margin-live-indicator {
  padding: 8px 14px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--brand);
  text-align: right;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.seller-notice-box {
  grid-column: span 2;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 11.5px;
  color: #1e40af;
  line-height: 1.35;
}

.editor-alert {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-top: 6px;
}

.editor-alert.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-footer-stock {
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  z-index: 10;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn-danger-stock {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
}

.btn-danger-stock:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

/* Ficha Detallada de Unidad */
.stock-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.detail-badge-chip {
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.stock-price-banner {
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.06), rgba(229, 25, 34, 0.02));
  border: 1.5px solid rgba(229, 25, 34, 0.2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.spb-main {
  display: flex;
  flex-direction: column;
}

.spb-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spb-price {
  font-family: var(--font-headings);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--brand);
}

.spb-admin {
  display: flex;
  gap: 20px;
  font-size: var(--fs-sm);
  border-left: 2px solid var(--border);
  padding-left: 20px;
}

.spb-admin-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.margin-text {
  color: #10b981;
}

.stock-obs-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.soc-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 6px;
}

.soc-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Simulador Comercial */
.simulator-card {
  background: #1a1a2e;
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-top: 3px solid var(--brand);
}

.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sc-title {
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #ffffff;
}

.sc-badge {
  background: var(--brand);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.sc-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 14px;
}

.sc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sc-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.sc-item.highlight-cuota {
  background: rgba(229, 25, 34, 0.15);
  border-color: var(--brand);
}

.sc-item-label {
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.sc-item-val {
  font-family: var(--font-headings);
  font-size: var(--fs-base);
  font-weight: 800;
  color: #ffffff;
}

.sc-item.highlight-cuota .sc-item-val {
  color: #ff6b72;
}

.sc-item-sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
}

.btn-whatsapp-share {
  background: #25d366;
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--trans);
}

.btn-whatsapp-share:hover {
  background: #1eb754;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

@media (max-width: 600px) {
  .sc-grid {
    grid-template-columns: 1fr;
  }
  .spb-admin {
    border-left: none;
    padding-left: 0;
  }
  .modal-footer-stock {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .footer-right, .footer-left {
    width: 100%;
    justify-content: stretch;
  }
  .footer-right button, .footer-left button, .btn-whatsapp-share {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

/* ── 30. CARTERA DE CLIENTES & MODALIDAD DE PAGO COMBINADA (VENTAS) ── */

/* Strip de KPIs de Cartera de Clientes */
.client-kpis-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.ck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-app);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.ck-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}

.ck-item strong {
  font-family: var(--font-headings);
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text-primary);
}

/* Grilla de Clientes */
.clientes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.cliente-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all var(--trans);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.cliente-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(229, 25, 34, 0.35);
}

.cliente-card.status-border-vip {
  border-left: 4px solid var(--brand);
}

.cliente-card.status-border-activo {
  border-left: 4px solid #10b981;
}

.cliente-card.status-border-prospecto {
  border-left: 4px solid #3b82f6;
}

.cliente-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lead-avatar.avatar-lead {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.cliente-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cliente-name {
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cliente-phone, .cliente-dni, .cliente-email {
  font-size: 11px;
  color: var(--text-secondary);
}

.cliente-status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.cliente-status-badge.cst-vip {
  background: rgba(229, 25, 34, 0.12);
  color: var(--brand);
  border: 1px solid rgba(229, 25, 34, 0.3);
}

.cliente-status-badge.cst-activo {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cliente-status-badge.cst-prospecto {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.cliente-card-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.cliente-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cliente-stat .cs-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.cliente-stat .cs-value {
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.cliente-stat .cs-small {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cliente-card-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.btn-card-action {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn-card-whatsapp {
  background: rgba(37, 211, 102, 0.08);
  border-color: rgba(37, 211, 102, 0.3);
  color: #16a34a;
}

.btn-card-whatsapp:hover {
  background: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.btn-card-view:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* Ficha Histórica del Cliente (Modal) */
.client-history-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.chs-item {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.chs-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chs-val {
  font-family: var(--font-headings);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.client-history-section {
  margin-bottom: 16px;
}

.history-section-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.history-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-card.trade-in-card {
  border-left: 3px solid var(--brand);
  background: rgba(229, 25, 34, 0.03);
}

.hic-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
}

.hic-price {
  font-family: var(--font-headings);
  font-weight: 700;
  color: var(--brand);
}

.hic-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.history-empty-text {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 12px;
  background: var(--bg-app);
  border-radius: var(--radius-md);
  margin: 0;
}

/* ── MODALIDAD DE PAGO COMBINADA (VENTAS) ── */
.payment-methods-box {
  background: var(--bg-app);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pmb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.pm-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: all var(--trans);
}

.pm-section.trade-in-section {
  border-color: rgba(229, 25, 34, 0.3);
  background: rgba(229, 25, 34, 0.02);
}

.pm-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.pm-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}

.pm-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.pm-trade-in-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(229, 25, 34, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trade-in-notice {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(229, 25, 34, 0.06);
  border-left: 3px solid var(--brand);
  padding: 8px 12px;
  border-radius: 4px;
  line-height: 1.4;
}

.price-highlight {
  font-weight: 700;
  border-color: var(--brand) !important;
  color: var(--brand);
}

.payment-balance-bar {
  background: #1a1a2e;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.pbb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
}

.pbb-row strong {
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
}

.sale-method-pill {
  display: inline-block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ── 31. PANEL DE APROBACIÓN DE PERITAJE & INGRESO A STOCK ── */
.peritaje-admin-card {
  background: var(--bg-app);
  border: 1.5px solid rgba(229, 25, 34, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin: 18px 0;
  position: relative;
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.06);
  transition: all var(--trans);
}

.peritaje-admin-card.pac-approved {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.03);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
}

.pac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pac-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pac-icon {
  font-size: 24px;
}

.pac-title-wrap h4 {
  font-family: var(--font-headings);
  font-size: var(--fs-base);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.pac-desc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.pac-approved-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  gap: 14px;
  flex-wrap: wrap;
}

.pai-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pai-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

.pai-val {
  font-family: var(--font-headings);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.badge-stock-ingresado {
  background: rgba(229, 25, 34, 0.1);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
}

.pac-projections-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
}

.paps-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
}

.paps-item strong {
  font-family: var(--font-headings);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.pac-action-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.btn-approve-stock {
  background: linear-gradient(135deg, var(--brand), #ff4851);
  color: #ffffff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-buttons);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.35);
  transition: all var(--trans);
}

.btn-approve-stock:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 25, 34, 0.45);
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.btn-approve-stock:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── 32. SISTEMA DE ICONOGRAFÍA VECTORIAL MODERNA (FORMAL & CLEAN) ── */
.app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform var(--trans), stroke var(--trans);
}

.app-icon svg {
  display: block;
}

.btn-primary .app-icon,
.btn-secondary .app-icon,
.btn-outline .app-icon,
.btn-submit-login .app-icon {
  margin-right: 7px;
}

.btn-card-action .app-icon {
  margin-right: 5px;
}

.nav-item .nav-icon .app-icon {
  width: 20px;
  height: 20px;
}

.action-btn .app-icon {
  margin: 0;
}

.sale-method-pill .app-icon,
.cliente-status-badge .app-icon,
.peritaje-status-badge .app-icon {
  margin-right: 4px;
}

.kpi-card .kpi-icon .app-icon {
  width: 28px;
  height: 28px;
}

.vehicle-cell .app-icon-car,
.history-section-title .app-icon-car {
  margin-right: 6px;
  color: var(--brand);
}

.btn-toggle-pwd .app-icon {
  color: var(--text-secondary);
}

.btn-toggle-pwd:hover .app-icon {
  color: var(--text-primary);
}

/* ===================================================================
   SISTEMA DE GUÍAS Y TUTORIALES SHEPHERD.JS — DEL RÍO AUTOMOTORES
   Diseñado para asesores comerciales senior (50-65+ años)
   Tipografía grande, alto contraste, cero tecnicismos
   =================================================================== */

/* ── 1. Botón en TopBar "¿Cómo se usa?" ────────────────────────────── */
.btn-tutorials-topbar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.08) 0%, rgba(229, 25, 34, 0.16) 100%);
  border: 1.5px solid rgba(229, 25, 34, 0.35);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--brand);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-tutorials-topbar:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 25, 34, 0.28);
}

.tutorials-badge-icon {
  font-size: 15px;
  line-height: 1;
}

/* ── 2. Widget en Sidebar "Guías y Ayuda" ──────────────────────────── */
.sidebar-help-widget {
  padding: 10px 14px;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.btn-sidebar-help {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  color: rgba(248, 248, 255, 0.94);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.btn-sidebar-help:hover {
  background: rgba(229, 25, 34, 0.24);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
}

.sidebar.collapsed .sidebar-help-widget {
  padding: 10px 6px;
}

.sidebar.collapsed .btn-sidebar-help {
  justify-content: center;
  padding: 8px 0;
}

.sidebar.collapsed .btn-sidebar-help .help-text {
  display: none;
}

.help-icon {
  font-size: 18px;
  color: currentColor;
  line-height: 1;
  flex-shrink: 0;
}

/* ── 3. Estilos Shepherd.js Theme Del Río ─────────────────────────── */
.delrio-shepherd-theme.shepherd-element {
  max-width: 480px;
  width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 14px;
  border: 1.5px solid rgba(229, 25, 34, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0,0,0,0.04);
  font-family: 'Poppins', system-ui, sans-serif;
  z-index: 10000;
  overflow: hidden;
  animation: shepherdFadeIn 0.22s ease-out;
}

@keyframes shepherdFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.delrio-shepherd-theme .shepherd-content {
  border-radius: 14px;
}

.delrio-shepherd-theme .shepherd-header {
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  border-bottom: 1px solid rgba(229, 25, 34, 0.12);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.delrio-shepherd-theme .shepherd-title {
  color: #1a1a2e;
  font-family: 'Montserrat', 'Poppins', sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.delrio-shepherd-theme .shepherd-cancel-icon {
  color: #717182;
  font-size: 1.4rem;
  font-weight: 600;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delrio-shepherd-theme .shepherd-cancel-icon:hover {
  color: var(--brand);
  background: rgba(229, 25, 34, 0.10);
}

.delrio-shepherd-theme .shepherd-text {
  padding: 16px 20px;
  font-size: 0.97rem;
  line-height: 1.55;
  color: #2d2d3e;
}

.shepherd-senior-text p {
  margin: 0 0 10px 0;
}

.shepherd-senior-text p:last-child {
  margin-bottom: 0;
}

.shepherd-step-list {
  margin: 10px 0 12px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shepherd-step-list li {
  line-height: 1.45;
}

.shepherd-badge-tip {
  margin-top: 12px;
  background: #fff8e6;
  border-left: 3px solid #d97706;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.92rem;
  color: #78350f;
}

.delrio-shepherd-theme .shepherd-footer {
  padding: 12px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: #fafafc;
}

/* Botones dentro del tour */
.shepherd-button {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.shepherd-btn-next,
.shepherd-btn-finish {
  background: var(--brand) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 8px rgba(229, 25, 34, 0.3);
}

.shepherd-btn-next:hover,
.shepherd-btn-finish:hover {
  background: var(--brand-dark) !important;
  transform: translateY(-1px);
}

.shepherd-btn-back {
  background: #f1f2f5 !important;
  color: #333344 !important;
  border: 1px solid #d5d5dd !important;
}

.shepherd-btn-back:hover {
  background: #e4e5eb !important;
}

.shepherd-btn-exit {
  background: transparent !important;
  color: #828292 !important;
  font-size: 13px !important;
  margin-right: auto !important;
  padding: 6px 10px !important;
}

.shepherd-btn-exit:hover {
  color: var(--brand) !important;
  text-decoration: underline;
}

/* Modal backdrop de Shepherd */
.shepherd-modal-overlay-container {
  z-index: 9998;
}

.shepherd-modal-overlay-container.shepherd-modal-is-visible {
  opacity: 0.65;
  background: #0b0b14;
}

/* ── 4. Modal Selector de Tutoriales (Mobile-First) ──────────────── */
.tutorials-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(10, 12, 24, 0.82) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100000 !important;
  padding: 16px !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tutorials-modal-dialog {
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface, #ffffff);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--brand, #e51922);
  overflow: hidden;
  margin: auto;
  animation: modalScaleUp 0.22s ease-out;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tutorials-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.09) 0%, rgba(229, 25, 34, 0.02) 100%);
  border-bottom: 1.5px solid var(--border);
}

.tut-header-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tut-header-icon {
  font-size: 32px;
  line-height: 1;
}

.tutorials-modal-header h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 3px 0;
}

.tut-header-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0;
}

.tut-close-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.tut-close-btn:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.tutorials-modal-body {
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hero card: Tour General */
.tutorials-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  border: 2px solid var(--brand);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.12);
}

.tutorials-hero-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(229, 25, 34, 0.22);
}

.hero-card-left {
  flex: 1;
}

.hero-badge {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.tutorials-hero-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 4px 0;
}

.tutorials-hero-card p {
  font-size: 0.88rem;
  color: #4a4a5a;
  margin: 0;
  line-height: 1.45;
}

.btn-tut-action {
  background: var(--brand);
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  box-shadow: 0 3px 8px rgba(229, 25, 34, 0.3);
}

.tutorials-hero-card:hover .btn-tut-action {
  background: var(--brand-dark);
}

.tut-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
}

/* Grid de tutoriales específicos */
.tutorials-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.tut-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tut-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.tut-card-icon {
  font-size: 26px;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 12px;
}

.tut-icon-green { background: rgba(22, 163, 74, 0.12); }
.tut-icon-red   { background: rgba(229, 25, 34, 0.12); }
.tut-icon-blue  { background: rgba(37, 99, 235, 0.12); }
.tut-icon-orange{ background: rgba(234, 88, 12, 0.12); }
.tut-icon-purple{ background: rgba(124, 58, 237, 0.12); }

.tut-card-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  line-height: 1.35;
}

.tut-card-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.45;
}

.tut-card-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand);
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
}

.tut-card:hover .tut-card-link {
  transform: translateX(4px);
}

.tut-footer-note {
  background: var(--bg-app);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Driver.js — ayudas contextuales cortas y accesibles */
.delrio-driver-popover {
  width: min(360px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 16px;
  border: 1px solid rgba(229, 25, 34, 0.28);
  border-radius: 14px;
  background: var(--bg-surface, #fff);
  color: var(--text-primary, #1a1a2e);
  box-shadow: 0 18px 48px rgba(8, 12, 32, 0.28);
  font-family: 'Poppins', system-ui, sans-serif;
}

.delrio-driver-popover .driver-popover-title {
  margin: 0 28px 8px 0;
  color: var(--text-primary, #1a1a2e);
  font-family: 'Montserrat', 'Poppins', sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

.delrio-driver-popover .driver-popover-description {
  color: var(--text-secondary, #4a4a5a);
  font-size: .9rem;
  line-height: 1.5;
}

.delrio-driver-popover .driver-popover-close-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  color: var(--text-muted, #717182);
  font-size: 1.35rem;
}

.delrio-driver-popover .driver-popover-close-btn:hover,
.delrio-driver-popover .driver-popover-close-btn:focus-visible {
  color: var(--brand);
  background: var(--brand-soft, rgba(229, 25, 34, .1));
}

.delrio-driver-popover .driver-popover-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.delrio-driver-popover .driver-popover-progress-text {
  margin-right: auto;
  color: var(--text-muted, #717182);
  font-size: .78rem;
}

.delrio-driver-popover .driver-popover-footer-btn {
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid var(--border, #e5e5ed);
  font: 600 .85rem inherit;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.delrio-driver-popover .driver-popover-next-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.delrio-driver-popover .driver-popover-next-btn:hover,
.delrio-driver-popover .driver-popover-next-btn:focus-visible {
  background: var(--brand-dark, #c5141c);
}

.delrio-driver-popover .driver-popover-prev-btn {
  background: var(--bg-app, #f4f5f8);
  color: var(--text-primary, #1a1a2e);
}

.tutorials-hero-card,
.tut-card {
  width: 100%;
  font: inherit;
  text-align: left;
}

.tutorials-hero-card:focus-visible,
.tut-card:focus-visible,
.tut-close-btn:focus-visible,
.btn-tutorials-topbar:focus-visible,
.btn-sidebar-help:focus-visible {
  outline: 3px solid rgba(229, 25, 34, .42);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .driver-overlay-animated,
  .delrio-driver-popover,
  .delrio-driver-popover .driver-popover-footer-btn,
  .tutorials-modal-overlay,
  .tutorials-modal-dialog,
  .tutorials-hero-card,
  .tut-card {
    animation: none !important;
    transition: none !important;
  }
}

html.dark-mode .delrio-driver-popover {
  background: #1e1e30;
  border-color: rgba(229, 25, 34, .45);
  color: #f0f0ff;
}

html.dark-mode .delrio-driver-popover .driver-popover-title { color: #f0f0ff; }
html.dark-mode .delrio-driver-popover .driver-popover-description { color: #d8d8ea; }
html.dark-mode .delrio-driver-popover .driver-popover-prev-btn {
  background: #2b2b40;
  color: #e0e0f0;
  border-color: #3f3f58;
}

/* Recorrido visual previo: explica el concepto sin tocar datos reales. */
.guided-walkthrough-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(7, 13, 32, .84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.guided-walkthrough-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.guided-walkthrough-dialog {
  width: min(1080px, 100%);
  max-height: min(900px, 94dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(229, 25, 34, .24);
  border-radius: 22px;
  background: var(--bg-surface, #fff);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
  transform: translateY(10px) scale(.985);
  transition: transform .22s ease;
}

.guided-walkthrough-overlay.open .guided-walkthrough-dialog { transform: translateY(0) scale(1); }

.guided-walkthrough-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(229, 25, 34, .07), transparent 60%);
}

.guided-walkthrough-brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.guided-walkthrough-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font: 800 13px/1 'Montserrat', sans-serif;
  box-shadow: 0 5px 14px rgba(229, 25, 34, .25);
}

.guided-walkthrough-brand > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.guided-walkthrough-kicker { color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.guided-walkthrough-brand strong { color: var(--text-primary); font: 700 1.05rem/1.25 'Montserrat', sans-serif; overflow-wrap: anywhere; }
.guided-walkthrough-counter { color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: .82rem; white-space: nowrap; }
.guided-walkthrough-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 22px; }
.guided-walkthrough-close:hover, .guided-walkthrough-close:focus-visible { color: var(--brand); background: var(--brand-soft); }

.guided-walkthrough-progress { height: 5px; margin: 0 22px; overflow: hidden; border-radius: 999px; background: var(--bg-app); }
.guided-walkthrough-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #ff6b72); transition: width .22s ease; }

.guided-walkthrough-layout { min-height: 0; display: grid; grid-template-columns: minmax(250px, .78fr) minmax(0, 1.22fr); gap: 24px; overflow: auto; padding: 30px 28px; }
.guided-walkthrough-copy { align-self: center; max-width: 420px; }
.guided-walkthrough-eyebrow { display: block; margin-bottom: 10px; color: var(--text-muted); font-size: .82rem; line-height: 1.45; }
.guided-walkthrough-copy h2 { margin: 0 0 12px; color: var(--text-primary); font: 800 clamp(1.55rem, 3vw, 2.15rem)/1.12 'Montserrat', sans-serif; letter-spacing: -.02em; }
.guided-walkthrough-copy p { margin: 0; color: var(--text-secondary); font-size: 1rem; line-height: 1.65; }
.guided-walkthrough-tip { display: grid; gap: 5px; margin-top: 24px; padding: 15px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-app); color: var(--text-secondary); font-size: .86rem; line-height: 1.45; }
.guided-walkthrough-tip strong { color: var(--text-primary); }

.guided-walkthrough-preview { min-width: 0; align-self: center; padding: 15px; border: 1px solid rgba(93, 131, 220, .24); border-radius: 18px; background: linear-gradient(145deg, #f7f9ff, #edf2fb); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .72); }
.guided-walkthrough-preview-label { display: block; margin: 0 5px 10px; color: #4a64a0; font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.tour-mockup-window { min-height: 220px; overflow: hidden; border: 1px solid #d5def2; border-radius: 14px; background: #fff; box-shadow: 0 14px 30px rgba(39, 61, 114, .12); color: #17213b; }
.tour-mockup-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid #e8edf7; font: 700 .9rem/1.2 'Montserrat', sans-serif; }
.tour-mockup-bar span { color: #e51922; font-size: .72rem; white-space: nowrap; }
.tour-mockup-toolbar { display: flex; gap: 8px; padding: 14px; }
.tour-mockup-toolbar i, .tour-mockup-toolbar b { flex: 1; padding: 10px 11px; border: 1px solid #dce4f3; border-radius: 9px; color: #71809d; font: 500 .72rem/1.2 'Poppins', sans-serif; font-style: normal; }
.tour-mockup-toolbar b { flex: 0 0 100px; color: #344a82; background: #f1f5ff; font-weight: 700; }
.tour-mockup-row { display: grid; gap: 5px; margin: 0 14px 14px; padding: 14px; border: 1px solid #e3e9f4; border-radius: 11px; background: #fbfcff; }
.tour-mockup-row strong { font-size: .82rem; }
.tour-mockup-row small, .tour-mockup-summary small { color: #71809d; font-size: .72rem; }
.tour-mockup-row em { justify-self: start; padding: 4px 8px; border-radius: 999px; background: #e9f8ef; color: #138a4b; font-size: .67rem; font-style: normal; font-weight: 700; }
.tour-mockup-pipeline, .tour-mockup-kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px; }
.tour-mockup-pipeline b, .tour-mockup-kanban b { padding: 9px 8px; border-radius: 8px; background: #eef3ff; color: #344a82; font-size: .7rem; text-align: center; }
.tour-mockup-lead { margin: 0 14px 14px; padding: 14px; border: 1px solid #dce4f3; border-radius: 11px; display: grid; gap: 5px; }
.tour-mockup-lead small { color: #71809d; font-size: .7rem; }
.tour-mockup-lead em { color: #e51922; font-size: .7rem; font-style: normal; font-weight: 700; }
.tour-mockup-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 16px; }
.tour-mockup-fields i { min-height: 38px; display: flex; align-items: center; padding: 0 10px; border: 1px solid #dce4f3; border-radius: 8px; color: #71809d; font-size: .72rem; font-style: normal; }
.tour-mockup-damage, .tour-mockup-summary, .tour-mockup-settings { margin: 0 16px 16px; padding: 14px; border-radius: 10px; background: #fff5f5; color: #a43d44; font-size: .75rem; }
.tour-mockup-summary, .tour-mockup-settings { display: grid; gap: 7px; background: #f4f7ff; color: #344a82; }
.tour-mockup-calendar, .tour-mockup-chat { display: grid; gap: 10px; padding: 16px; }
.tour-mockup-calendar b { color: #344a82; font-size: .76rem; }
.tour-mockup-calendar i { padding: 11px; border-left: 3px solid #e51922; background: #fff5f5; color: #536381; font-size: .72rem; font-style: normal; }
.tour-mockup-dashboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 16px; }
.tour-mockup-dashboard b { padding: 17px 10px; border-radius: 10px; background: #f1f5ff; color: #344a82; font-size: .72rem; text-align: center; }
.tour-mockup-boti { background: #f8f8fc; }
.tour-mockup-boti .tour-mockup-chat strong { padding: 13px; border-radius: 10px; background: #fff; color: #344a82; font-size: .75rem; }
.tour-mockup-input { margin: 0 16px 16px; padding: 12px; border: 1px solid #dce4f3; border-radius: 10px; background: #fff; color: #71809d; font-size: .72rem; }
.tour-mockup-choice, .tour-mockup-stage, .tour-mockup-seller-grid, .tour-mockup-kpis { display: grid; gap: 8px; padding: 14px; }
.tour-mockup-choice { grid-template-columns: repeat(3, 1fr); }
.tour-mockup-choice b, .tour-mockup-stage b, .tour-mockup-stage strong { padding: 9px 8px; border-radius: 8px; background: #eef3ff; color: #344a82; font-size: .68rem; text-align: center; }
.tour-mockup-choice b.active, .tour-mockup-stage strong { background: #e51922; color: #fff; }
.tour-mockup-action { margin: 0 16px 16px; padding: 11px 12px; border-radius: 9px; background: #fff5f5; color: #a43d44; font-size: .72rem; font-weight: 700; }
.tour-mockup-select { display: grid; gap: 6px; margin: 14px 16px; padding: 13px; border: 1px solid #dce4f3; border-radius: 10px; background: #fbfcff; }
.tour-mockup-select b { color: #344a82; font-size: .72rem; }
.tour-mockup-select span { padding: 9px; border: 1px solid #dce4f3; border-radius: 8px; color: #17213b; font-size: .76rem; }
.tour-mockup-select i, .tour-mockup-profile small, .tour-mockup-status small { color: #71809d; font-size: .68rem; font-style: normal; }
.tour-mockup-chat-thread { display: grid; gap: 8px; padding: 14px 16px; }
.tour-mockup-chat-thread i, .tour-mockup-chat-thread b { max-width: 84%; padding: 10px 11px; border-radius: 10px; font-size: .72rem; font-style: normal; }
.tour-mockup-chat-thread i { justify-self: start; background: #eef3ff; color: #536381; }
.tour-mockup-chat-thread b { justify-self: end; background: #e9f8ef; color: #137647; }
.tour-mockup-chat-thread small { color: #71809d; font-size: .66rem; }
.tour-mockup-table { display: grid; grid-template-columns: 1.4fr 1.4fr 1fr; gap: 1px; margin: 14px 16px; overflow: hidden; border: 1px solid #dce4f3; border-radius: 9px; background: #dce4f3; }
.tour-mockup-table > * { padding: 9px 8px; background: #fff; color: #536381; font-size: .68rem; }
.tour-mockup-table b { color: #344a82; background: #f1f5ff; font-weight: 800; }
.tour-mockup-seller-grid { grid-template-columns: repeat(3, 1fr); }
.tour-mockup-seller-grid b, .tour-mockup-kpis b { display: grid; gap: 5px; padding: 11px 8px; border-radius: 9px; background: #f1f5ff; color: #344a82; font-size: .68rem; text-align: center; }
.tour-mockup-seller-grid em { color: #e51922; font-size: .64rem; font-style: normal; }
.tour-mockup-kpis { grid-template-columns: repeat(3, 1fr); }
.tour-mockup-kpis b { font-size: 1rem; }
.tour-mockup-kpis small { display: block; color: #71809d; font-size: .62rem; font-weight: 600; }
.tour-mockup-help, .tour-mockup-profile, .tour-mockup-status, .tour-mockup-log { display: grid; gap: 8px; margin: 14px 16px 16px; padding: 13px; border-radius: 10px; background: #f4f7ff; color: #344a82; }
.tour-mockup-help i { padding: 8px 10px; border-radius: 7px; background: #fff; color: #536381; font-size: .7rem; font-style: normal; }
.tour-mockup-sidebar { display: grid; gap: 5px; margin: 14px 16px 16px; padding: 10px; border-radius: 10px; background: #f1f5ff; }
.tour-mockup-sidebar b, .tour-mockup-sidebar i { padding: 8px 10px; border-radius: 7px; color: #536381; font-size: .7rem; font-style: normal; }
.tour-mockup-sidebar b { background: #e51922; color: #fff; }
.tour-mockup-profile { grid-template-columns: auto 1fr; align-items: center; }
.tour-mockup-profile b { grid-row: span 2; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #e51922; color: #fff; }
.tour-mockup-profile strong { font-size: .78rem; }
.tour-mockup-status b { color: #138a4b; font-size: .78rem; }
.tour-mockup-log i { padding: 8px 9px; border-left: 3px solid #e51922; background: #fff; color: #536381; font-size: .66rem; font-style: normal; }

.guided-walkthrough-footer { display: flex; align-items: center; gap: 12px; padding: 15px 22px max(15px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-surface); }
.guided-walkthrough-footer button { min-height: 46px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font: 700 .86rem/1.2 'Poppins', sans-serif; cursor: pointer; }
.guided-walkthrough-back { color: var(--text-secondary); background: var(--bg-app); }
.guided-walkthrough-back:disabled { opacity: .45; cursor: not-allowed; }
.guided-walkthrough-skip { margin: 0 auto; color: var(--text-muted); background: transparent; }
.guided-walkthrough-next { color: #fff; background: var(--brand); box-shadow: 0 7px 16px rgba(229, 25, 34, .22); }
.guided-walkthrough-next:hover, .guided-walkthrough-next:focus-visible { background: var(--brand-dark); }
.guided-walkthrough-footer button:focus-visible { outline: 3px solid rgba(229, 25, 34, .38); outline-offset: 3px; }

@media (max-width: 640px) {
  .guided-walkthrough-dialog { max-height: 96dvh; border-radius: 16px; }
  .guided-walkthrough-header { min-height: 64px; padding: 12px 14px; gap: 9px; }
  .guided-walkthrough-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 11px; }
  .guided-walkthrough-kicker { font-size: 8px; }
  .guided-walkthrough-brand strong { font-size: .88rem; }
  .guided-walkthrough-counter { padding: 6px 9px; font-size: .72rem; }
  .guided-walkthrough-close { width: 40px; height: 40px; }
  .guided-walkthrough-progress { margin: 0 14px; }
  .guided-walkthrough-layout { grid-template-columns: 1fr; gap: 16px; padding: 20px 14px; }
  .guided-walkthrough-copy { max-width: none; }
  .guided-walkthrough-copy h2 { font-size: 1.45rem; }
  .guided-walkthrough-copy p { font-size: .92rem; }
  .guided-walkthrough-tip { margin-top: 15px; }
  .guided-walkthrough-preview { order: -1; padding: 10px; }
  .tour-mockup-window { min-height: 180px; }
  .tour-mockup-bar span { max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
  .tour-mockup-fields { gap: 7px; padding: 11px; }
  .tour-mockup-toolbar { padding: 10px; }
  .tour-mockup-toolbar b { flex-basis: 88px; }
  .tour-mockup-choice, .tour-mockup-seller-grid { grid-template-columns: 1fr; }
  .tour-mockup-table { margin-inline: 10px; font-size: .64rem; }
  .tour-mockup-table > * { padding: 8px 6px; }
  .tour-mockup-action, .tour-mockup-select, .tour-mockup-settings, .tour-mockup-help, .tour-mockup-profile, .tour-mockup-status, .tour-mockup-log { margin-inline: 10px; }
  .guided-walkthrough-footer { flex-wrap: wrap; padding-inline: 14px; }
  .guided-walkthrough-back, .guided-walkthrough-next { flex: 1 1 calc(50% - 6px); min-height: 48px !important; }
  .guided-walkthrough-skip { order: 3; flex-basis: 100%; min-height: 44px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .guided-walkthrough-overlay,
  .guided-walkthrough-dialog,
  .guided-walkthrough-progress span { transition: none !important; }
}

html.dark-mode .guided-walkthrough-dialog { background: #1d2033; }
html.dark-mode .guided-walkthrough-header,
html.dark-mode .guided-walkthrough-footer { background: #1d2033; border-color: rgba(255,255,255,.08); }
html.dark-mode .guided-walkthrough-preview { background: #171a2b; border-color: rgba(145,164,220,.25); }

/* Toolbars con zonas explícitas: evitan que los controles se compriman en
   vistas con filtros y acciones principales. */
#view-clientes > .view-toolbar,
#view-stock > .view-toolbar,
#view-tareas > .view-toolbar,
#view-ventas .ventas-layout > .view-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

/* ── 5. Botón Hero de Peritaje en Playa y Botón Directo en Leads ─── */
.peritaje-mobile-cta {
  margin-bottom: 16px;
}

.btn-hero-peritaje {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #e51922 0%, #c5141c 100%);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 20px rgba(229, 25, 34, 0.32);
  text-align: left;
}

.btn-hero-peritaje:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(229, 25, 34, 0.42);
}

.btn-hero-peritaje .cta-icon {
  font-size: 28px;
  line-height: 1;
}

.btn-hero-peritaje .cta-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.btn-hero-peritaje .cta-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.btn-hero-peritaje .cta-sub {
  font-size: 0.82rem;
  opacity: 0.9;
  margin-top: 2px;
}

.btn-hero-peritaje .cta-arrow {
  font-size: 18px;
  opacity: 0.8;
}

/* Botón directo de Peritaje en tarjeta de lead */
.btn-peritaje-quick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(229, 25, 34, 0.10);
  color: var(--brand);
  border: 1px solid rgba(229, 25, 34, 0.30);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-peritaje-quick:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* ── 6. Dark Mode overrides para Shepherd y Modal ─────────────────── */
html.dark-mode .tutorials-modal-dialog {
  background: #1c1c2e;
  border-color: var(--brand);
}

html.dark-mode .tutorials-modal-header {
  background: #24243a;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .tutorials-modal-header h2 {
  color: #ffffff;
}

html.dark-mode .tutorials-hero-card {
  background: linear-gradient(135deg, rgba(229, 25, 34, 0.16) 0%, #1e1e32 100%);
  border-color: var(--brand);
}

html.dark-mode .tutorials-hero-card h3 {
  color: #ffffff;
}

html.dark-mode .tutorials-hero-card p {
  color: #c4c4d6;
}

html.dark-mode .tut-card {
  background: #222236;
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .tut-card-content h4 {
  color: #ffffff;
}

html.dark-mode .tut-card-content p {
  color: #a6a6bc;
}

html.dark-mode .tut-footer-note {
  background: #191928;
  border-color: rgba(255, 255, 255, 0.08);
  color: #bbbbcf;
}

html.dark-mode .delrio-shepherd-theme.shepherd-element {
  background: #1e1e30;
  border-color: rgba(229, 25, 34, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

html.dark-mode .delrio-shepherd-theme .shepherd-header {
  background: #25253c;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.dark-mode .delrio-shepherd-theme .shepherd-title {
  color: #f0f0ff;
}

html.dark-mode .delrio-shepherd-theme .shepherd-text {
  color: #d8d8ea;
}

html.dark-mode .delrio-shepherd-theme .shepherd-footer {
  background: #1a1a2a;
  border-top-color: rgba(255, 255, 255, 0.06);
}

html.dark-mode .shepherd-btn-back {
  background: #2b2b40 !important;
  color: #e0e0f0 !important;
  border-color: #3f3f58 !important;
}

html.dark-mode .shepherd-btn-back:hover {
  background: #35354e !important;
}

html.dark-mode .shepherd-badge-tip {
  background: rgba(217, 119, 6, 0.15);
  color: #fcd34d;
  border-left-color: #f59e0b;
}

/* ── 7. Optimización Mobile-First (Celulares & Tablets) ──────────── */
@media (max-width: 640px) {
  /* Modal de Tutoriales en Celular */
  .tutorials-modal-dialog {
    max-height: 94vh;
    border-radius: 14px;
    margin: auto 4px;
  }
  .tutorials-modal-header {
    padding: 14px 16px;
  }
  .tutorials-modal-header h2 {
    font-size: 1.1rem;
  }
  .tut-header-sub {
    font-size: 0.8rem;
  }
  .tutorials-modal-body {
    padding: 14px;
    gap: 12px;
  }
  .tutorials-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tutorials-hero-card {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 12px;
  }
  .btn-tut-action {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    text-align: center;
  }
  .tut-card {
    padding: 14px;
    min-height: 80px;
  }
  .tut-card-link {
    font-size: 0.92rem;
  }

  /* Shepherd Popups en Celular */
  .delrio-shepherd-theme.shepherd-element {
    max-width: calc(100vw - 20px) !important;
    width: calc(100vw - 20px) !important;
    margin: 8px auto !important;
    border-radius: 12px !important;
  }
  .delrio-shepherd-theme .shepherd-header {
    padding: 12px 14px;
  }
  .delrio-shepherd-theme .shepherd-title {
    font-size: 1.05rem;
  }
  .delrio-shepherd-theme .shepherd-text {
    padding: 14px 16px;
    font-size: 0.95rem;
  }
  .delrio-shepherd-theme .shepherd-footer {
    padding: 10px 14px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .shepherd-button {
    min-height: 48px !important;
    font-size: 15px !important;
    flex: 1 1 45% !important;
    justify-content: center !important;
  }
  .shepherd-btn-exit {
    order: 3;
    flex: 1 1 100% !important;
    text-align: center;
    padding: 8px !important;
  }

  /* TopBar en Celular: MANTENER BOTÓN VISIBLE Y FÁCIL DE TOCAR */
  .btn-tutorials-topbar {
    padding: 6px 10px;
    font-size: 12.5px;
    gap: 5px;
  }
  .tutorials-topbar-text {
    display: inline !important; /* Siempre visible para el vendedor */
  }
  .btn-copilot-topbar .copilot-topbar-text {
    display: none; /* Ocultar texto de copilot en móvil pequeño para dar lugar al botón de guías */
  }
}

/* ===================================================================
   SUGERENCIAS INTELIGENTES DE TAREAS (GEMINI + HISTORIAL WHATSAPP)
   Edición de sugerencias, prompts personalizados y chips tácticos
   =================================================================== */
.ai-prompt-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.ai-prompt-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 14px;
  transition: all var(--trans);
}

.ai-prompt-input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--bg-surface);
}

.ai-prompt-icon {
  color: var(--brand);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ai-prompt-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  outline: none;
}

.ai-prompt-input::placeholder {
  color: var(--text-muted);
}

.btn-ai-generate {
  background: linear-gradient(135deg, var(--brand) 0%, #ff4851 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-family: var(--font-buttons);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(229, 25, 34, 0.35);
  transition: all var(--trans);
}

.btn-ai-generate:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(229, 25, 34, 0.45);
}

.btn-ai-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-prompt-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-chips-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.ai-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--trans);
}

.ai-chip:hover {
  background: var(--brand-soft);
  border-color: var(--border-brand);
  color: var(--brand);
  transform: translateY(-1px);
}

.ai-sug-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-edit-ai {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
}

.btn-edit-ai:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-brand);
  color: var(--brand);
}

.sug-lead-context-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--brand-soft);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.slc-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-primary);
}

.spinner-ring-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* Dark mode overrides para sugerencias IA */
html.dark-mode .ai-prompt-bar {
  background: var(--bg-card);
  border-color: var(--border);
}
html.dark-mode .ai-prompt-input-wrap {
  background: var(--bg-input);
  border-color: var(--border);
}
html.dark-mode .ai-chip {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-secondary);
}
html.dark-mode .ai-chip:hover {
  background: var(--brand-soft);
  color: #fff;
  border-color: var(--brand);
}
html.dark-mode .btn-edit-ai {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
}
html.dark-mode .btn-edit-ai:hover {
  background: var(--bg-card-hover);
  color: var(--brand-light);
  border-color: var(--brand);
}
html.dark-mode .sug-lead-context-chip {
  background: rgba(229, 25, 34, 0.12);
  border-color: rgba(229, 25, 34, 0.35);
}

/* ===================================================================
   BLOQUE RESPONSIVO COMPLETO — CRM Del Río Automotores
   Cubre: Login, TopBar, Sidebar, Content Area, Modales y Vistas
   Breakpoints: 480px (tel), 640px (tel grande), 768px (tablet),
                960px (notebook chico), 1200px (notebook grande)
   =================================================================== */

/* ── BASE: permitir scroll en login y overflows globales ─────────── */
body.login-mode {
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100vh;
}

/* Activar login-mode cuando el login está visible */
.login-page-container ~ body,
body:has(.login-page-container) {
  overflow-y: auto !important;
}

/* ── LOGIN — Ajuste viewport correcto ─────────────────────────────── */
.login-page-container {
  min-height: 100dvh;             /* Dynamic Viewport Height para móvil */
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-wrapper {
  max-width: 480px;
  margin: auto;
  width: 100%;
}

.login-card {
  padding: 32px 28px;
  border-radius: 20px;
}

/* Tablet: ancho controlado */
@media (max-width: 768px) {
  .login-page-container {
    padding: 12px;
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 32px;
  }
  .login-wrapper {
    max-width: 440px;
  }
  .login-card {
    padding: 28px 22px;
  }
  .login-logo-wrap {
    width: 60px;
    height: 60px;
  }
  .login-title {
    font-size: 1.25rem;
  }
}

/* Celular grande / iPhone Pro Max */
@media (max-width: 640px) {
  .login-page-container {
    padding: 12px 10px;
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 40px;
  }
  .login-wrapper {
    max-width: 100%;
  }
  .login-card {
    padding: 24px 16px;
    border-radius: 16px;
  }
  .login-logo-wrap {
    width: 54px;
    height: 54px;
    margin-bottom: 10px;
  }
  .login-title {
    font-size: 1.1rem;
    letter-spacing: 1px;
  }
  .login-subtitle {
    font-size: 11px;
  }
  .login-badge {
    font-size: 10px;
    padding: 2px 10px;
  }
  .btn-google-login {
    height: 44px;
    font-size: 13px;
  }
  .btn-submit-login {
    height: 46px;
    font-size: 14px;
  }
  .input-icon-wrap .form-input {
    height: 44px;
    font-size: 14px;
  }
}

/* Celular pequeño — iPhone SE, Galaxy A */
@media (max-width: 430px) {
  .login-card {
    padding: 20px 14px;
    border-radius: 14px;
  }
  .login-title {
    font-size: 1rem;
    letter-spacing: 0.8px;
  }
  .login-logo-wrap {
    width: 48px;
    height: 48px;
  }
  .login-card-footer {
    font-size: 10px;
  }
}

/* ── APP LAYOUT — corregir overflow en login ─────────────────────── */
#app:has(.login-page-container) {
  overflow-y: auto;
  height: auto;
  min-height: 100dvh;
}

/* ── TOPBAR — responsive mejorado ─────────────────────────────────── */
@media (max-width: 1100px) {
  .topbar {
    padding: 0 20px;
    gap: 12px;
  }
  .topbar-user-name {
    max-width: 110px;
  }
}

@media (max-width: 960px) {
  .topbar {
    padding: 0 16px;
    gap: 8px;
  }
  .topbar-title h1 {
    font-size: 17px;
  }
  .topbar-date {
    display: none;
  }
  .btn-tutorials-topbar .tutorials-topbar-text {
    display: none;
  }
}

@media (max-width: 700px) {
  /* topbar ya tiene sus reglas en el bloque de 700px — complementamos */
  .topbar-right {
    gap: 6px;
  }
  .topbar-icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .topbar-user-badge {
    padding: 4px 8px 4px 4px;
    gap: 6px;
  }
  .btn-copilot-topbar {
    padding: 6px 10px;
  }
  .copilot-topbar-text {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 12px;
    height: 56px;
    gap: 8px;
  }
  .topbar-title h1 {
    font-size: 15px;
  }
  .topbar-icon-btn {
    width: 36px;
    height: 36px;
  }
  .topbar-user-name,
  .topbar-user-role {
    display: none;
  }
}

/* ── SIDEBAR — solo ajustes complementarios ─────────────────────── */
@media (max-width: 480px) {
  #sidebar-root {
    width: 240px !important;
  }
}

/* ── CONTENT AREA — padding fluido ──────────────────────────────── */
@media (max-width: 1100px) {
  .content-area {
    padding: 24px 22px 36px;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: 18px 16px 32px;
  }
  .view-section h2 {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  .content-area {
    padding: 14px 12px 28px;
  }
  .view-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .view-toolbar > * {
    flex-shrink: 0;
  }
  .search-wrap {
    width: 100%;
    order: 10;
  }
}

/* ── KPI CARDS — responsive ──────────────────────────────────────── */
@media (max-width: 480px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .kpi-card {
    padding: 14px 12px;
  }
  .kpi-value {
    font-size: 1.05rem;
  }
  .kpi-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .kpi-label {
    font-size: 11px;
  }
}

/* ── MODALES — full-screen en móvil ─────────────────────────────── */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 93dvh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  .modal-footer {
    padding: 10px 16px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer button {
    flex: 1 1 45%;
    min-height: 44px;
  }
}

/* ── TABLAS — scroll horizontal en celular ────────────────────────── */
@media (max-width: 700px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .data-table {
    min-width: 560px;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
}

/* ── GRIDS DE CLIENTES / PERITAJES ─────────────────────────────── */
@media (max-width: 900px) {
  .clientes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .clientes-grid {
    grid-template-columns: 1fr;
  }
  .cliente-card {
    padding: 14px;
  }
}

/* ── VENTAS KPIs ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ventas-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}
@media (max-width: 400px) {
  .ventas-kpis {
    grid-template-columns: 1fr;
  }
}

/* ── PERITAJE LAYOUT ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .peritaje-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .damage-map-wrap {
    grid-template-columns: 1fr !important;
  }
  .vehicle-silhouette {
    max-width: 100%;
    height: auto;
  }
}

/* ── FORMULARIOS — columnas en tablet ────────────────────────────── */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .form-group {
    margin-bottom: 12px;
  }
  .form-input,
  .form-select,
  textarea {
    font-size: 16px; /* evita zoom automático en iOS */
  }
}

/* ── BOTONES — tamaño mínimo táctil 44px ─────────────────────────── */
@media (max-width: 768px) {
  .btn-primary,
  .btn-secondary,
  .btn-outline,
  .btn-danger {
    min-height: 44px;
    font-size: 14px;
  }
}

/* ── STOCK VIEW — cards en móvil ─────────────────────────────────── */
@media (max-width: 700px) {
  .stock-grid {
    grid-template-columns: 1fr;
  }
  .stock-card {
    padding: 14px;
  }
}
@media (min-width: 480px) and (max-width: 700px) {
  .stock-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── PIPELINE / KANBAN ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .pipeline-board {
    flex-direction: column;
    gap: 12px;
  }
  .pipeline-col {
    min-width: unset;
    width: 100%;
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

/* ── DASHBOARD BOTTOM ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dashboard-bottom {
    grid-template-columns: 1fr;
  }
}

/* ── AGENT COPILOT PANEL — móvil ─────────────────────────────────── */
@media (max-width: 640px) {
  .copilot-drawer {
    right: 8px !important;
    left: 8px !important;
    bottom: 8px !important;
    width: auto !important;
    max-width: unset !important;
    border-radius: 16px !important;
    top: 8px !important;
  }
  .copilot-fab {
    right: 12px;
    bottom: 12px;
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
  }
}

/* ── CHATWOOT VIEWER — pantalla completa en móvil ─────────────────── */
@media (max-width: 640px) {
  .chatwoot-modal-overlay {
    padding: 0;
  }
  .chatwoot-modal {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }
}

/* ── TAREAS — tabla compacta en móvil ────────────────────────────── */
@media (max-width: 640px) {
  .tareas-columns {
    grid-template-columns: 1fr !important;
  }
  .tarea-col {
    min-width: unset;
  }
}

/* ── DEV LOGS ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .dev-stats-row {
    grid-template-columns: 1fr !important;
  }
  .log-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .log-event {
    width: 100%;
  }
}

/* ── PREVENIR ZOOM iOS en inputs ─────────────────────────────────── */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ── UTILITY: safe-area iPhone X+ ───────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .login-page-container,
  .content-area,
  .modal {
    padding-bottom: calc(var(--pad-bottom, 0px) + env(safe-area-inset-bottom));
  }
}

/* ── AGENDA COMERCIAL ────────────────────────────────────────────── */
.agenda-view {
  display: grid;
  gap: 20px;
  min-width: 0;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.agenda-header,
.agenda-header-actions,
.agenda-day-toolbar,
.agenda-day-picker,
.agenda-day-summary,
.agenda-event-heading,
.agenda-event-meta,
.agenda-event-actions,
.agenda-section-heading {
  display: flex;
  align-items: center;
}
.agenda-header,
.agenda-day-toolbar,
.agenda-section-heading {
  justify-content: space-between;
  gap: 16px;
}
.agenda-title h2 { margin: 0 0 5px; color: var(--text-primary); font-size: clamp(24px, 2.3vw, 32px); }
.agenda-title p,
.agenda-section-heading p { margin: 0; color: var(--text-muted); font-size: var(--fs-base); line-height: 1.5; }
.agenda-header-actions { gap: 10px; }
.agenda-add-button,
.agenda-today-button,
.agenda-date-arrow,
.agenda-event-actions button,
.agenda-modal-footer button { min-height: 46px; }
.agenda-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); }
.agenda-tab {
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: 700 var(--fs-base) var(--font-base);
  cursor: pointer;
}
.agenda-tab.active { border-bottom-color: var(--brand); color: var(--brand); }
.agenda-day-toolbar { flex-wrap: wrap; }
.agenda-period-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
.agenda-day-picker { flex-wrap: wrap; gap: 8px; }
.agenda-date-arrow {
  width: 46px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}
.agenda-date-label { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: var(--text-primary); font-size: var(--fs-md); font-weight: 700; }
.agenda-date-input { width: 42px; min-height: 44px; margin-left: -48px; opacity: 0; cursor: pointer; }
.agenda-day-summary { gap: 18px; color: var(--text-muted); font-size: var(--fs-sm); }
.agenda-day-summary strong { color: var(--text-primary); font-size: var(--fs-md); }
.agenda-view-switch { display: inline-flex; min-height: 46px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); }
.agenda-view-switch button { min-width: 72px; min-height: 38px; padding: 6px 12px; border: 0; border-radius: calc(var(--radius-md) - 4px); background: transparent; color: var(--text-secondary); font: 700 var(--fs-sm) var(--font-base); cursor: pointer; }
.agenda-view-switch button.active { background: var(--brand-soft); color: var(--brand); }
.agenda-view-switch button:focus-visible,
.agenda-month-day:focus-visible,
.agenda-month-mobile-day > button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.agenda-event-list { display: grid; gap: 12px; min-width: 0; }
.agenda-week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; min-width: 0; }
.agenda-week-day { display: grid; align-content: start; gap: 10px; min-width: 0; min-height: 190px; padding: 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); }
.agenda-week-day.is-today { border: 2px solid var(--brand); }
.agenda-calendar-day-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; width: 100%; min-height: 42px; padding: 4px 2px 8px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text-primary); text-align: left; text-transform: capitalize; cursor: pointer; }
.agenda-calendar-day-heading span { overflow: hidden; font-size: var(--fs-sm); font-weight: 700; text-overflow: ellipsis; }
.agenda-calendar-day-heading time { flex: 0 0 auto; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.agenda-week-day.is-today .agenda-calendar-day-heading span { color: var(--brand); }
.agenda-week-day-content,.agenda-month-mobile-events { display: grid; align-content: start; gap: 6px; min-width: 0; }
.agenda-compact-event { display: grid; gap: 2px; min-width: 0; min-height: 44px; padding: 6px 7px; border: 0; border-left: 3px solid var(--brand); border-radius: 5px; background: var(--bg-app); color: var(--text-secondary); text-align: left; cursor: pointer; }
.agenda-compact-event time { color: var(--brand); font-size: 11px; font-weight: 700; }
.agenda-compact-event > span { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.agenda-compact-event.status-realizada { border-left-color: var(--green); }
.agenda-compact-event.status-cancelada { border-left-color: var(--text-muted); }
.agenda-compact-event.status-ausente { border-left-color: var(--yellow); }
.agenda-month-calendar { min-width: 0; }
.agenda-month-weekdays,
.agenda-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.agenda-month-weekdays { margin-bottom: 6px; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 700; text-align: center; }
.agenda-month-weekdays span { padding: 10px 4px; }
.agenda-month-day { display: grid; align-content: start; gap: 5px; min-width: 0; min-height: 105px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text-primary); text-align: left; cursor: pointer; }
.agenda-month-day + .agenda-month-day { margin-left: -1px; }
.agenda-month-day:hover { position: relative; z-index: 1; border-color: var(--brand); }
.agenda-month-day.outside-month { background: var(--bg-app); color: var(--text-muted); }
.agenda-month-day.is-today { border: 2px solid var(--brand); }
.agenda-month-day-number { font-weight: 700; }
.agenda-month-event { display: block; overflow: hidden; color: var(--text-secondary); font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.agenda-month-event time { color: var(--brand); font-weight: 700; }
.agenda-month-more { color: var(--brand); font-size: 11px; font-weight: 700; }
.agenda-month-mobile { display: none; }
.agenda-event-card {
  display: grid;
  grid-template-columns: minmax(84px, 110px) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
.agenda-event-card.status-realizada { border-left-color: var(--green); }
.agenda-event-card.status-ausente { border-left-color: var(--yellow); }
.agenda-event-card.status-cancelada { border-left-color: var(--text-muted); }
.agenda-event-time { display: grid; gap: 3px; color: var(--text-primary); font-size: var(--fs-base); }
.agenda-event-time strong { font-size: var(--fs-lg); }
.agenda-event-time span { color: var(--text-muted); font-size: var(--fs-sm); }
.agenda-event-main { min-width: 0; }
.agenda-event-heading { flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.agenda-type-badge,
.agenda-status-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; }
.agenda-type-badge { background: var(--blue-bg); color: var(--blue); }
.agenda-status-badge.status-programada { background: var(--yellow-bg); color: var(--yellow); }
.agenda-status-badge.status-realizada { background: var(--green-bg); color: var(--green); }
.agenda-status-badge.status-ausente { background: var(--orange-bg); color: var(--orange); }
.agenda-status-badge.status-cancelada { background: var(--bg-app); color: var(--text-muted); }
.agenda-event-main h3 { margin: 0 0 8px; overflow-wrap: anywhere; color: var(--text-primary); font-size: var(--fs-md); }
.agenda-event-meta { flex-wrap: wrap; gap: 8px 16px; color: var(--text-secondary); font-size: var(--fs-sm); }
.agenda-event-meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.agenda-event-notes { margin: 10px 0 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.agenda-event-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.agenda-event-actions button { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-secondary); font: 600 var(--fs-xs) var(--font-base); cursor: pointer; }
.agenda-event-actions .btn-agenda-done { border-color: color-mix(in srgb, var(--green) 35%, transparent); background: var(--green-bg); color: var(--green); }
.agenda-event-actions .btn-agenda-cancel { color: var(--text-muted); }
.agenda-empty-state,
.agenda-loading { display: grid; justify-items: center; gap: 12px; padding: clamp(28px, 6vw, 60px) 20px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-card); text-align: center; }
.agenda-empty-icon { color: var(--brand); }
.agenda-empty-state h3 { margin: 0; color: var(--text-primary); font-size: var(--fs-lg); }
.agenda-empty-state p { max-width: 460px; margin: 0; color: var(--text-muted); font-size: var(--fs-base); line-height: 1.5; }
.agenda-error { padding: 12px 16px; border: 1px solid var(--red); border-radius: var(--radius-md); background: var(--red-bg); color: var(--red); font-size: var(--fs-base); }
.agenda-automation-panel { display: grid; gap: 20px; min-width: 0; }
.agenda-section-heading h3 { margin: 0 0 5px; color: var(--text-primary); font-size: var(--fs-lg); }
.agenda-rule-list { display: grid; gap: 10px; }
.agenda-rule-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) 100px; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.agenda-rule-card.is-enabled { border-left: 4px solid var(--green); }
.agenda-rule-copy { min-width: 0; }
.agenda-rule-copy h4 { margin: 0 0 4px; color: var(--text-primary); font-size: var(--fs-base); }
.agenda-rule-copy p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; }
.agenda-rule-delay { display: grid; gap: 5px; color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 700; }
.agenda-rule-delay select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); font: 500 var(--fs-sm) var(--font-base); }
.agenda-switch { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 5px; border: 0; background: transparent; color: var(--text-secondary); font: 700 var(--fs-xs) var(--font-base); cursor: pointer; }
.agenda-switch > span { width: 40px; height: 24px; padding: 3px; border-radius: var(--radius-pill); background: var(--border-strong); transition: background var(--trans); }
.agenda-switch > span::after { display: block; width: 18px; height: 18px; border-radius: 50%; background: white; content: ''; transition: transform var(--trans); }
.agenda-switch.enabled > span { background: var(--green); }
.agenda-switch.enabled > span::after { transform: translateX(16px); }
.agenda-runs-panel { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.agenda-run-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.agenda-run-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.agenda-run-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.agenda-run-list li > div { display: grid; gap: 3px; min-width: 0; }
.agenda-run-list strong { color: var(--text-primary); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.agenda-run-list small,.agenda-run-list time,.agenda-runs-empty { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.45; }
.agenda-runs-empty { margin: 0; font-size: var(--fs-sm); }
.agenda-modal-overlay { z-index: 1200; padding: 16px; }
.agenda-modal { width: min(900px, 100%); max-height: min(92dvh, 900px); overflow: auto; }
.agenda-modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.agenda-modal-grid .form-group { min-width: 0; }
.agenda-modal-grid .form-group label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 700; }
.agenda-modal-grid .form-input { width: 100%; min-height: 48px; min-width: 0; }
.agenda-time-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.agenda-modal-notes { grid-column: 1 / -1; }
.agenda-modal-notes textarea { min-height: 96px; resize: vertical; }
.agenda-modal-error { margin-top: 12px; color: var(--red); font-size: var(--fs-sm); }
.agenda-modal-error[hidden] { display: none; }
.agenda-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.agenda-modal-footer .btn-primary { min-width: 190px; }

@media (max-width: 900px) {
  .agenda-week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-month-weekdays,.agenda-month-grid { display: none; }
  .agenda-month-mobile { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

@media (max-width: 700px) {
  .agenda-view { gap: 16px; }
  .agenda-header,.agenda-day-toolbar { align-items: stretch; flex-direction: column; }
  .agenda-period-controls { align-items: stretch; flex-direction: column; }
  .agenda-header-actions .agenda-add-button { width: 100%; justify-content: center; }
  .agenda-day-picker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px auto; width: 100%; }
  .agenda-date-label { grid-column: 2; grid-row: 1; justify-content: center; min-width: 0; font-size: var(--fs-base); text-align: center; }
  .agenda-date-input { grid-column: 2; grid-row: 1; justify-self: center; width: min(100%, 220px); margin: 0; }
  .agenda-day-picker [data-date-back] { grid-column: 1; grid-row: 1; }
  .agenda-day-picker [data-date-forward] { grid-column: 3; grid-row: 1; }
  .agenda-today-button { grid-column: 4; grid-row: 1; }
  .agenda-day-summary { justify-content: space-between; }
  .agenda-view-switch { width: 100%; }
  .agenda-view-switch button { flex: 1; }
  .agenda-week-day { min-height: 150px; padding: 8px; }
  .agenda-month-mobile-day { display: grid; align-content: start; gap: 8px; min-width: 0; min-height: 100px; padding: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-card); }
  .agenda-month-mobile-day.is-today { border: 2px solid var(--brand); }
  .agenda-month-mobile-day .agenda-calendar-day-heading { min-height: 36px; padding-bottom: 6px; }
  .agenda-month-mobile-day .agenda-calendar-day-heading span { font-size: var(--fs-xs); }
  .agenda-month-mobile-day .agenda-calendar-day-heading time { color: var(--text-primary); }
  .agenda-event-card { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 15px; }
  .agenda-event-time { display: flex; align-items: baseline; gap: 7px; }
  .agenda-event-time strong { font-size: var(--fs-md); }
  .agenda-event-actions { justify-content: stretch; }
  .agenda-event-actions button { flex: 1 1 120px; }
  .agenda-rule-card { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .agenda-rule-delay { grid-template-columns: minmax(0, 1fr) minmax(110px, 45%); align-items: center; }
  .agenda-switch { justify-self: start; }
  .agenda-run-list li { grid-template-columns: 10px minmax(0, 1fr); }
  .agenda-run-list time { grid-column: 2; }
  .agenda-modal-overlay { align-items: flex-end; padding: 0; }
  .agenda-modal { width: 100%; max-height: 94dvh; border-radius: 20px 20px 0 0; }
  .agenda-modal-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .agenda-modal-notes { grid-column: auto; }
  .agenda-modal-footer { position: sticky; bottom: 0; background: var(--bg-card); }
  .agenda-modal-footer button { flex: 1; }
}
@media (max-width: 360px) {
  .agenda-day-picker { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .agenda-today-button { grid-column: 2; grid-row: 2; width: 100%; }
  .agenda-day-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .agenda-event-actions button { flex-basis: 100%; }
  .agenda-modal-footer { flex-direction: column-reverse; }
  .agenda-modal-footer .btn-primary { width: 100%; }
}

/* Alta de consulta multicanal: recepción clara en Agencia y canales digitales */
.modal-lead { max-width: 840px; width: min(94vw, 840px); }
.modal-lead .modal-body { padding: 24px 28px 28px; }
.lead-modal-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lead-voice-button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--brand); border-radius: var(--radius-pill); color: var(--brand); background: var(--brand-soft); font-weight: 700; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lead-voice-button.voice-active { background: var(--brand); color: #fff; }
.lead-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.lead-form-grid > .form-group, .lead-form-grid > .form-row, .lead-form-grid > .form-check-group { margin: 0 !important; }
.lead-voice-example { grid-column: 1 / -1; padding: 11px 13px; border-left: 3px solid var(--brand); background: var(--brand-soft); color: var(--text-secondary); font-size: var(--fs-xs); line-height: 1.4; }
.modal-lead .form-input { min-height: 48px; font-size: 15px; }
@media (max-width: 640px) {
  .modal-lead .modal-body { padding: 18px 16px 24px; }
  .lead-form-grid { grid-template-columns: 1fr; gap: 13px; }
  .lead-modal-actions { gap: 8px; }
  .lead-voice-button { min-width: 44px; padding: 0 12px; }
  .lead-voice-example { font-size: 12px; }
}

.stock-editor-header-actions { display: flex; align-items: center; gap: 12px; }
.stock-form-voice-button { min-height: 42px; padding: 9px 14px; border: 1px solid var(--brand); border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-weight: 700; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.stock-form-voice-button.voice-active { background: var(--brand); color: #fff; animation: none; }
.stock-form-voice-button:disabled { opacity: .5; cursor: not-allowed; }
.editor-alert.alert-success { background: rgba(22, 163, 74, .10); color: #15803d; border: 1px solid rgba(22, 163, 74, .25); }

/* El editor de stock necesita el ancho completo para no comprimir campos y
   acciones en escritorio. */
.modal-stock { max-width: 980px; }
.modal-stock .modal-body { padding: 26px 32px 28px; }
.modal-stock .form-input { min-height: 48px; padding: 11px 14px; font-size: 15px; }
.modal-stock .form-row { gap: 18px; }

.stock-data-cell { min-width: 180px; color: var(--text-secondary); font-size: var(--fs-sm); }
.stock-data-cell strong { color: var(--text-primary); }
.stock-data-cell span, .finance-label { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.stock-mobile-list { display: none; }
.stock-mobile-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); }
.stock-mobile-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stock-mobile-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--text-secondary); font-size: var(--fs-xs); }
.stock-mobile-meta span { display: inline-flex; align-items: center; }
.stock-mobile-prices { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stock-mobile-prices.with-admin-prices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stock-mobile-prices > div { padding: 10px 0; min-width: 0; }
.stock-mobile-prices > div + div { border-left: 1px solid var(--border); padding-left: 10px; }
.stock-mobile-prices span { display: block; color: var(--text-muted); font-size: 11px; font-weight: 600; }
.stock-mobile-prices strong { display: block; margin-top: 2px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.stock-mobile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) {
  #view-stock .table-wrap { display: none; }
  #view-stock .stock-mobile-list { display: grid; gap: 12px; }
  .stock-mobile-card { padding: 16px; display: grid; gap: 14px; }
  .stock-mobile-card .vehicle-name { font-size: 1rem; }
  .stock-mobile-actions .btn-primary, .stock-mobile-actions .btn-secondary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
}
@media (max-width: 400px) {
  .stock-mobile-prices.with-admin-prices { grid-template-columns: 1fr; }
  .stock-mobile-prices > div + div { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; }
}

@media (max-width: 768px) {
  .main-layout, .content-area, .view-section, .dashboard-grid, .ventas-layout,
  .peritaje-detail-panel, .section-card, .ai-panel, .pipeline-col, .kanban-col, .cliente-card { min-width: 0; }
  .content-area { padding: 16px 14px calc(32px + env(safe-area-inset-bottom)); }
  .view-toolbar, .ficha-header, .pac-header, .obs-header-row, .panel-header, .dash-card-header { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .view-toolbar > div:first-child, .ficha-header > div:first-child, .pac-title-wrap, .panel-header > div:first-child { min-width: 0; }
  .view-toolbar .btn-primary, .panel-header .btn-primary { width: 100%; justify-content: center; }
  .form-input, .form-select, .search-input, .ai-prompt-input, .reply-input, .stage-select { min-height: 46px; }
  .input-voice-wrap { align-items: stretch; }
  .input-voice-wrap .voice-btn { min-width: 46px; min-height: 46px; }
  .modal-footer-stock, .ficha-actions, .payment-balance-bar, .ai-prompt-chips { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .modal-lead .modal-body { padding: 18px 16px 24px; }
  .lead-form-grid { grid-template-columns: 1fr; gap: 13px; }
  .lead-form-grid > .form-group:nth-of-type(4), .lead-form-grid > .form-group:nth-of-type(6) { grid-column: auto; }
  .lead-modal-actions { gap: 8px; }
  .lead-voice-example { font-size: 12px; }
  .modal-overlay:has(.modal-chat) { padding: 0; align-items: flex-end; }
  .modal-overlay:has(.modal-chat) .modal-chat { max-width: 100vw; width: 100vw; max-height: 95dvh; border-radius: 20px 20px 0 0; }
  .chat-messages { max-height: none; min-height: 180px; }
}
@media (max-width: 700px) {
  .modal-overlay:has(.modal-stock) { align-items: flex-end; padding: 0; }
  .modal-stock { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; }
  .modal-stock .modal-header { padding: 18px 20px; align-items: flex-start; }
  .modal-stock .modal-body { padding: 20px; }
  .modal-stock .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 480px) {
  .modal-stock .form-row { grid-template-columns: 1fr; gap: 12px; }
  .modal-stock .modal-body { padding: 18px 16px 22px; }
  .modal-footer-stock, .footer-right { width: 100%; }
  .footer-right .btn-secondary, .footer-right .btn-primary { flex: 1; min-height: 48px; }
}
@media (max-width: 480px) {
  .stock-form-voice-button span { display: none; }
  .stock-form-voice-button { width: 42px; padding: 0; justify-content: center; }
  .modal-lead .modal-body { padding: 18px 16px 24px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-wrap .data-table { min-width: 560px; }
  .table-wrap .empty-state { white-space: normal; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-left { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .topbar-title { min-width: 0; }
  .topbar-title h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .topbar-right, .topbar-actions { flex: 0 0 auto; gap: 4px; }
  .topbar-user-badge, #btnNotif, #btnDark { display: none; }
  .btn-tutorials-topbar, .btn-copilot-topbar { width: 36px; height: 36px; min-height: 36px; padding: 0; justify-content: center; border-radius: 50%; }
  .tutorials-topbar-text, .copilot-topbar-text { display: none !important; }
}

/* ── DASHBOARD: ACCIONES RÁPIDAS ─────────────────────────────────── */
.dashboard-quick-actions {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 52%, var(--bg-card)), var(--bg-card));
  box-shadow: var(--shadow-xs);
}
.dashboard-quick-actions-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.dashboard-section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dashboard-quick-actions-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--fs-lg);
  line-height: 1.15;
}
.dashboard-quick-actions-header p {
  max-width: 340px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  text-align: right;
}
.dashboard-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-quick-action {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 88px;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}
.dashboard-quick-action:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dashboard-quick-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent);
  outline-offset: 2px;
}
.quick-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}
.quick-action-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.quick-action-copy strong {
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
  line-height: 1.2;
}
.quick-action-copy small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.25;
}
.quick-action-arrow {
  display: inline-flex;
  margin-left: auto;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.quick-action-stock .quick-action-icon { background: var(--blue-bg); color: var(--blue); }
.quick-action-appraisal .quick-action-icon { background: var(--yellow-bg); color: var(--yellow); }
.quick-action-sale .quick-action-icon { background: var(--green-bg); color: var(--green); }
.quick-action-task .quick-action-icon { background: var(--purple-bg); color: var(--purple); }

@media (max-width: 1180px) {
  .dashboard-quick-actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .dashboard-quick-actions { padding: 16px; gap: 14px; }
  .dashboard-quick-actions-header { align-items: flex-start; flex-direction: column; gap: 5px; }
  .dashboard-quick-actions-header p { max-width: none; text-align: left; }
  .dashboard-quick-actions-grid { grid-template-columns: 1fr; gap: 9px; }
  .dashboard-quick-action { min-height: 72px; padding: 12px; }
  .quick-action-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .quick-action-copy strong { font-size: var(--fs-base); }
  .quick-action-copy small { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
.peritaje-create-modal { width: min(760px, calc(100vw - 24px)); max-width: 760px; max-height: min(90dvh, 920px); }
.peritaje-create-modal .modal-body { gap: 14px; }
.peritaje-collapsible { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--bg-card, #fff); }
.peritaje-collapsible > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--text-primary); }
.peritaje-collapsible > summary::marker { color: var(--brand); }
.peritaje-collapsible h4 { margin: 18px 0 10px; color: var(--text-primary); }
.peritaje-inspection-note, .peritaje-margin-disclaimer { margin: 6px 0 12px; color: var(--text-secondary); font-size: var(--fs-xs); line-height: 1.5; }
.peritaje-inspection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.peritaje-inspection-row { display: grid; grid-template-columns: minmax(100px, .7fr) minmax(120px, .8fr) minmax(150px, 1.3fr); align-items: center; gap: 8px; min-width: 0; }
.peritaje-inspection-row > label { font-size: var(--fs-xs); font-weight: 600; overflow-wrap: anywhere; }
.peritaje-inspection-row .form-input, .peritaje-photo-grid .form-input, .peritaje-admin-fields .form-input { min-width: 0; min-height: 44px; }
.peritaje-repair-input { max-width: 150px; }
.peritaje-photo-grid, .peritaje-admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.peritaje-photo-grid label, .peritaje-admin-fields label { display: grid; gap: 6px; min-width: 0; font-size: var(--fs-xs); font-weight: 600; }
.peritaje-admin-fields > p { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: var(--fs-xs); }
.peritaje-create-actions { display: flex; justify-content: flex-end; gap: 10px; }
.peritaje-create-actions button { min-height: 48px; }
.peritaje-detail-inspection { width: 100%; }
.peritaje-status-editor { max-width: 360px; }
.peritaje-status-editor small { color: var(--text-muted); font-size: var(--fs-xs); }
.peritaje-margin-disclaimer { margin-top: 0; }

/* Peritaje: ficha directa en estado vacío y matriz compacta basada en el PDF */
.peritaje-layout-empty { display: block; height: auto; }
.peritaje-empty-panel { max-height: none; overflow: visible; padding: clamp(14px, 2vw, 28px); }
.peritaje-quick-form { width: min(100%, 1100px); margin: 0 auto; display: grid; gap: 16px; min-width: 0; }
.peritaje-form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 4px 2px 10px; }
.peritaje-form-heading h2 { margin: 4px 0; font-size: clamp(22px, 2.2vw, 30px); }
.peritaje-form-heading p { margin: 0; color: var(--text-secondary); line-height: 1.5; }
.peritaje-form-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.peritaje-form-heading-actions .btn-secondary { min-height: 44px; white-space: nowrap; }
.peritaje-eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.peritaje-form-date { flex: 0 0 auto; color: var(--text-muted); font-size: var(--fs-xs); }
.peritaje-form-section { min-width: 0; display: grid; gap: 12px; padding: clamp(14px, 2vw, 22px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.peritaje-form-section > h3 { margin: 0; font-size: var(--fs-base); }
.peritaje-identification-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; min-width: 0; }
.peritaje-identification-grid > label { display: grid; gap: 6px; min-width: 0; color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 700; }
.peritaje-identification-grid .form-input { width: 100%; min-width: 0; min-height: 46px; box-sizing: border-box; }
.peritaje-identification-grid .span-two { grid-column: 1 / -1; }
.peritaje-form-section .input-voice-wrap { width: 100%; min-width: 0; }
.peritaje-form-section textarea.form-input { width: 100%; min-width: 0; box-sizing: border-box; }
.peritaje-inspection-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.peritaje-inspection-row { grid-template-columns: minmax(150px, .8fr) minmax(230px, 1fr) minmax(150px, .7fr); align-items: center; gap: 8px 14px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.peritaje-inspection-label { min-width: 0; color: var(--text-primary); font-size: var(--fs-xs); }
.peritaje-condition-options { display: grid; grid-template-columns: repeat(4, minmax(40px, 1fr)); gap: 4px; min-width: 0; }
.peritaje-condition-option { position: relative; min-width: 0; cursor: pointer; }
.peritaje-condition-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.peritaje-condition-option span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 7px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-surface); color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.peritaje-condition-option.selected span, .peritaje-condition-option input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.peritaje-condition-option input:focus-visible + span { outline: 3px solid var(--brand-glow); outline-offset: 1px; }
.peritaje-inspection-row .peritaje-inspection-notes { grid-column: 1 / -1; min-height: 42px; }
.peritaje-inspection-row .peritaje-repair-input { width: 100%; max-width: none; }
.peritaje-form-error { padding: 12px 14px; border: 1px solid var(--red); border-radius: var(--radius-md); background: var(--red-bg); color: var(--red); font-size: var(--fs-sm); }
.peritaje-estimated-margin { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 14px 16px; border: 1px solid var(--border-brand); border-radius: var(--radius-md); background: var(--brand-soft); color: var(--text-secondary); font-size: var(--fs-sm); }
.peritaje-estimated-margin strong { color: var(--brand); font-size: var(--fs-md); }
.peritaje-list-panel .panel-header { display: grid; align-items: start; gap: 4px; }
.peritaje-list-panel .panel-header > div { min-width: 0; }
.peritaje-list-item { display: block; width: 100%; background: transparent; color: var(--text-primary); font: inherit; text-align: left; }
.peritaje-list-item .pi-main, .peritaje-list-item .pi-meta { min-width: 0; gap: 8px; }
.peritaje-list-item .pi-vehicle { min-width: 0; overflow-wrap: anywhere; }
.peritaje-overview { display: grid; gap: 16px; min-width: 0; }
.peritaje-overview-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.peritaje-overview-header h2 { margin: 0; font-size: clamp(22px, 2vw, 28px); }
.peritaje-overview-header p { margin: 4px 0 0; color: var(--text-secondary); }
.peritaje-overview-header .btn-primary { min-height: 48px; flex: 0 0 auto; }
.peritaje-empty-list { display: grid; gap: 8px; min-height: 180px; align-content: center; justify-items: center; padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); text-align: center; }
.peritaje-empty-list h3 { margin: 0; color: var(--text-primary); }
.peritaje-empty-list p { max-width: 48ch; margin: 0; color: var(--text-secondary); line-height: 1.5; }
.peritaje-state-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 12px; border-bottom: 1px solid var(--border); }
.peritaje-state-count { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-secondary); font-size: var(--fs-xs); }
.peritaje-state-count strong { color: var(--text-primary); font-size: var(--fs-sm); }
.peritaje-list-controls { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(190px, 260px) auto; align-items: end; gap: 12px; }
.peritaje-list-controls label { display: grid; gap: 6px; min-width: 0; color: var(--text-secondary); font-size: var(--fs-xs); font-weight: 700; }
.peritaje-list-controls .form-input { width: 100%; min-width: 0; min-height: 46px; box-sizing: border-box; }
.peritaje-visible-count { padding: 0 2px 12px; color: var(--text-muted); font-size: var(--fs-xs); white-space: nowrap; }
.peritaje-table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); }
.peritaje-overview-table { width: 100%; min-width: 760px; border-collapse: collapse; text-align: left; }
.peritaje-overview-table th { padding: 13px 14px; background: var(--bg-app); color: var(--text-muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.peritaje-overview-table td { padding: 12px 14px; border-top: 1px solid var(--border); color: var(--text-primary); font-size: var(--fs-xs); vertical-align: middle; }
.peritaje-overview-table td:first-child { min-width: 180px; }
.peritaje-overview-table td strong, .peritaje-overview-table td small { display: block; }
.peritaje-overview-table td strong { overflow-wrap: anywhere; }
.peritaje-overview-table td small { margin-top: 4px; color: var(--text-muted); }
.peritaje-open-row { min-height: 44px; white-space: nowrap; }
.peritaje-overview-table tr[hidden] { display: none !important; }
.peritaje-filter-empty { margin: 0; padding: 24px; color: var(--text-secondary); text-align: center; }
.peritaje-detail-page { min-height: 240px; }
.ficha-header-right #btnBackPeritajeList { min-height: 44px; }

@media (max-width: 680px) {
  .peritaje-modal-overlay { padding: 4px; }
  .peritaje-create-modal { width: 100%; max-height: calc(100dvh - 8px); margin: 0; }
  .peritaje-create-modal .modal-body { padding: 16px; }
  .peritaje-create-modal .form-input { min-height: 44px; }
  .peritaje-create-modal .form-row { display: grid; grid-template-columns: 1fr; gap: 0; }
  .peritaje-inspection-grid { grid-template-columns: 1fr; }
  .peritaje-inspection-row { grid-template-columns: minmax(0, 1fr) minmax(115px, .8fr); padding: 8px 0; border-bottom: 1px solid var(--border); }
  .peritaje-inspection-row > label { grid-column: 1 / -1; }
  .peritaje-inspection-row input[data-inspection-field="notes"] { grid-column: 1 / -1; }
  .peritaje-repair-input { max-width: none; }
  .peritaje-photo-grid, .peritaje-admin-fields { grid-template-columns: 1fr; }
  .peritaje-create-actions { display: grid; grid-template-columns: 1fr; }
  .peritaje-create-actions button { width: 100%; min-height: 48px; }
  .peritaje-detail-inspection { padding: 12px; }
  .peritaje-empty-panel { padding: 12px; }
  .peritaje-form-heading { flex-direction: column; gap: 5px; }
  .peritaje-form-heading-actions { width: 100%; justify-content: space-between; }
  .peritaje-form-date { align-self: flex-start; }
  .peritaje-form-section { padding: 14px; }
  .peritaje-identification-grid { grid-template-columns: 1fr; }
  .peritaje-identification-grid .span-two { grid-column: auto; }
  .peritaje-inspection-row { grid-template-columns: minmax(0, 1fr); padding: 12px 0; }
  .peritaje-condition-options { grid-template-columns: repeat(4, minmax(40px, 1fr)); }
  .peritaje-inspection-row .peritaje-inspection-notes { grid-column: 1; }
  .peritaje-inspection-row .peritaje-repair-input { width: 100%; }
  .peritaje-quick-form .peritaje-create-actions { position: sticky; bottom: 8px; z-index: 2; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-surface); box-shadow: var(--shadow-md); }
}

@media (max-width: 960px) {
  .peritaje-overview-header { align-items: flex-start; flex-direction: column; }
  .peritaje-overview-header .btn-primary { width: 100%; }
  .peritaje-list-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .peritaje-visible-count { grid-column: 1 / -1; padding: 0; }
  .peritaje-table-wrap { overflow: visible; border: 0; background: transparent; }
  .peritaje-overview-table, .peritaje-overview-table tbody { display: block; width: 100%; min-width: 0; }
  .peritaje-overview-table thead { display: none; }
  .peritaje-overview-table tbody { display: grid; gap: 10px; }
  .peritaje-overview-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-xs); }
  .peritaje-overview-table td, .peritaje-overview-table td:first-child { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .peritaje-overview-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 10px; font-weight: 800; }
  .peritaje-overview-table td[data-label="Unidad"], .peritaje-overview-table td[data-label="Acción"] { grid-column: 1 / -1; }
  .peritaje-overview-table td[data-label="Acción"] .peritaje-open-row { width: 100%; }
  .ficha-header-right { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .peritaje-list-controls { grid-template-columns: 1fr; }
  .peritaje-visible-count { grid-column: auto; }
  .peritaje-overview-table tr { grid-template-columns: 1fr; }
  .peritaje-overview-table td[data-label="Unidad"], .peritaje-overview-table td[data-label="Acción"] { grid-column: auto; }
}

/* ── DASHBOARD / RESPONSIVE UX — mejora consolidada ──────────────── */
.dashboard-data-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.dashboard-data-warning > span { min-width: 0; overflow-wrap: anywhere; }
.dashboard-data-warning .btn-link,
.dashboard-empty-state .btn-link { min-height: 44px; white-space: nowrap; }
.dashboard-loading-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
}
.dashboard-loading-state strong { color: var(--text-primary); font-size: var(--fs-md); }
.dashboard-loading-state p { font-size: var(--fs-sm); }
.dashboard-loading-state .loading-spinner { width: 28px; height: 28px; }
.dashboard-empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  padding: 22px 14px;
  text-align: center;
  color: var(--text-secondary);
}
.dashboard-empty-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
}
.dashboard-empty-state strong { color: var(--text-primary); font-size: var(--fs-sm); }
.dashboard-empty-state p { max-width: 34ch; font-size: var(--fs-xs); line-height: 1.5; }
.kpi-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-card, .dash-card { min-width: 0; }
.kpi-label { overflow-wrap: anywhere; }
.dash-card-header { gap: 12px; }
.dash-card-header h3 { min-width: 0; text-wrap: balance; }
.dash-leads-list, .dash-tasks-list { min-width: 0; }
.dash-lead-item, .dash-task-item { min-height: 56px; touch-action: manipulation; }
.dash-lead-item:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.pipeline-card { min-width: 0; }

/* El texto largo del Copilot no debe empujar el drawer ni el botón de voz. */
.copilot-drawer { box-sizing: border-box; max-width: 100vw; overflow: hidden; }
.copilot-feed { min-width: 0; overflow-x: hidden; overscroll-behavior: contain; }
.copilot-footer { min-width: 0; flex-shrink: 0; }
.copilot-input-bar { box-sizing: border-box; max-width: 100%; min-width: 0; overflow: hidden; }
.copilot-input { box-sizing: border-box; max-width: 100%; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.copilot-fab {
  right: calc(28px + env(safe-area-inset-right));
  bottom: calc(28px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 24px);
  touch-action: manipulation;
}
.copilot-fab:focus-visible,
.copilot-mic-btn:focus-visible,
.copilot-send-btn:focus-visible,
.copilot-close-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

@media (max-width: 1180px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-data-warning { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 640px) {
  .copilot-drawer {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    max-width: none;
  }
  .copilot-fab {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}
@media (max-width: 360px) {
  .kpi-row { grid-template-columns: 1fr; }
  .dashboard-quick-actions { padding: 16px; }
  .dashboard-quick-actions-header { align-items: flex-start; flex-direction: column; }
  .dash-card { padding: 16px; }
}

/* ── RESPONSIVE UI CONTRACT — toolbars, tablas móviles y accesibilidad ── */
#view-clientes > .view-toolbar,
#view-stock > .view-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#view-tareas > .view-toolbar,
#view-ventas .ventas-layout > .view-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#view-clientes .search-wrap,
#view-stock .search-wrap,
#view-clientes .filter-group,
#view-stock .filter-group,
#view-tareas .tasks-summary,
#view-tareas .toolbar-actions,
#view-ventas .ventas-layout > .view-toolbar > div { min-width: 0; }

#view-clientes .search-wrap,
#view-stock .search-wrap { width: 100%; max-width: none; }
#view-clientes .filter-group,
#view-stock .filter-group { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
#view-clientes .filter-select,
#view-stock .filter-select { min-width: min(220px, 100%); max-width: 100%; }
#view-tareas .toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
#view-tareas .toolbar-actions button,
#view-clientes > .view-toolbar .btn-primary,
#view-stock > .view-toolbar .btn-primary,
#view-ventas .ventas-layout > .view-toolbar .btn-primary { min-height: 44px; }

.mobile-record-list { display: none; min-width: 0; }
.mobile-record-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}
.mobile-record-card-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-width: 0;
}
.mobile-record-card-heading { display: grid; gap: 3px; min-width: 0; }
.mobile-record-card-heading strong,
.mobile-record-card-heading span,
.mobile-record-card-heading small { min-width: 0; overflow-wrap: anywhere; }
.mobile-record-card-heading strong { font-family: var(--font-headings); font-size: var(--fs-sm); }
.mobile-record-card-heading span { color: var(--text-muted); font-size: var(--fs-xs); }
.mobile-record-card-heading small { color: var(--brand); font-size: 11px; font-weight: 700; }
.mobile-record-meta { display: grid; gap: 9px; min-width: 0; margin: 0; }
.mobile-record-meta > div { display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr); gap: 8px; min-width: 0; }
.mobile-record-meta dt { color: var(--text-muted); font-size: 11px; font-weight: 700; }
.mobile-record-meta dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text-primary); font-size: var(--fs-xs); }
.mobile-stage-field { display: grid; gap: 6px; color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.mobile-stage-field .stage-inline-select { width: 100%; min-height: 44px; }
.mobile-record-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; min-width: 0; }
.mobile-record-actions > * { width: 100%; min-height: 44px; justify-content: center; }
.sale-mobile-card .price-cell { white-space: nowrap; font-size: var(--fs-sm); }

#view-consultas .pipeline-card,
#view-consultas .mobile-record-card,
#view-clientes .cliente-card,
#view-stock .stock-mobile-card { overflow-wrap: anywhere; }

#view-consultas .pipeline-board { overscroll-behavior: contain; }
#view-consultas .pipeline-col { overscroll-behavior: contain; }
.copilot-mic-btn,
.copilot-send-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex-basis: 44px; }
.copilot-workflow-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
#view-consultas .clear-search-btn,
.lead-voice-button,
.stock-form-voice-button { min-height: 44px; }
.pc-quick-actions > * { min-height: 44px; }

@media (max-width: 1200px) {
  #view-clientes > .view-toolbar,
  #view-stock > .view-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search filters" "action action";
  }
  #view-clientes > .view-toolbar .search-wrap,
  #view-stock > .view-toolbar .search-wrap { grid-area: search; }
  #view-clientes > .view-toolbar .filter-group,
  #view-stock > .view-toolbar .filter-group { grid-area: filters; }
  #view-clientes > .view-toolbar > .btn-primary,
  #view-stock > .view-toolbar > .btn-primary { grid-area: action; justify-self: start; }
  #view-tareas .toolbar-actions,
  #view-ventas .ventas-layout > .view-toolbar .btn-primary { justify-self: start; }
}

@media (max-width: 960px) {
  #view-clientes > .view-toolbar,
  #view-stock > .view-toolbar,
  #view-tareas > .view-toolbar,
  #view-ventas .ventas-layout > .view-toolbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "filters" "actions";
    align-items: stretch;
  }
  #view-clientes > .view-toolbar .search-wrap,
  #view-stock > .view-toolbar .search-wrap,
  #view-tareas > .view-toolbar .tasks-summary,
  #view-ventas .ventas-layout > .view-toolbar > div { grid-area: main; }
  #view-clientes > .view-toolbar .filter-group,
  #view-stock > .view-toolbar .filter-group { grid-area: filters; justify-content: stretch; }
  #view-clientes > .view-toolbar > .btn-primary,
  #view-stock > .view-toolbar > .btn-primary,
  #view-tareas .toolbar-actions,
  #view-ventas .ventas-layout > .view-toolbar > .btn-primary { grid-area: actions; width: 100%; }
  #view-tareas .toolbar-actions { justify-content: stretch; }
  #view-tareas .toolbar-actions button { flex: 1 1 180px; }

  #view-consultas .pipeline-board {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    overflow-x: visible;
    overflow-y: visible;
  }
  #view-consultas .pipeline-col { width: 100%; min-width: 0; max-height: none; }
  #view-consultas .pipeline-cards { overflow-y: visible; }
}

@media (max-width: 700px) {
  #view-clientes .filter-group,
  #view-stock .filter-group { display: grid; grid-template-columns: 1fr; width: 100%; }
  #view-clientes .filter-select,
  #view-stock .filter-select { width: 100%; min-width: 0; }
  #view-tareas .toolbar-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  #view-tareas .toolbar-actions button { width: 100%; }
  #view-tareas .tasks-summary { flex-wrap: wrap; gap: 8px 12px; }
  #view-clientes > .view-toolbar .btn-primary,
  #view-stock > .view-toolbar .btn-primary,
  #view-ventas .ventas-layout > .view-toolbar > .btn-primary { width: 100%; justify-content: center; }

  #view-consultas .table-wrap,
  #view-ventas .table-wrap { display: none; }
  #view-consultas .mobile-record-list,
  #view-ventas .mobile-record-list { display: grid; gap: 12px; }
  #view-consultas .mobile-record-card,
  #view-ventas .mobile-record-card { width: 100%; }
}

@media (max-width: 420px) {
  .mobile-record-card { padding: 14px; }
  .mobile-record-card-header { grid-template-columns: auto minmax(0, 1fr); }
  .mobile-record-card-header > .stage-badge,
  .mobile-record-card-header > .price-cell { grid-column: 2; justify-self: start; }
  .mobile-record-actions { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .btn-tutorials-topbar,
  .btn-copilot-topbar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}
