/* ==========================================================================
   SISTEMA DE DISEÑO & VARIABLES
   ========================================================================== */
:root {
  /* Paleta de Colores Principal - Inspirada en el Login Luxury Dark & Green */
  --bg-primary: #070d11;
  --bg-secondary: #0c151c;
  --bg-tertiary: #111d27;
  --card-bg: #0c151c;
  --card-border: rgba(103, 124, 93, 0.16);
  
  --accent-primary: #677c5d; /* Color institucional (se cambia con scripts/aplicar-marca.js) */
  --accent-secondary: #38bdf8; /* Azul/Cian Eléctrico */
  --accent-success: #10b981; /* Verde Esmeralda */
  --accent-warning: #fbbf24; /* Oro / Amber */
  --accent-danger: #ef4444; /* Rojo */
  
  /* Gradientes */
  --grad-primary: linear-gradient(135deg, #677c5d 0%, #059669 100%);
  --grad-premium: linear-gradient(135deg, #677c5d 0%, #38bdf8 100%);
  --grad-dark: radial-gradient(circle at 20% 20%, rgba(103, 124, 93, 0.25) 0%, rgba(8, 30, 24, 0.96) 50%, #06110e 100%);
  
  /* Tipografía y Textos */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-family: 'Outfit', system-ui, -apple-system, sans-serif;

  /* Panel de notificaciones (campana). Tiene sus propios colores porque usaba --text-muted
     (#64748b) sobre un fondo casi negro: daba 2.6:1 de contraste, menos de la mitad del minimo
     legible (4.5:1), y el "Asignado: ..." practicamente no se leia. El fondo tambien se aclara
     para que el panel se despegue de la pagina en vez de quedar negro sobre negro. */
  --notif-bg: #273449;
  --notif-header-bg: rgba(255,255,255,0.05);
  --notif-border: rgba(255,255,255,0.14);
  --notif-text: #ffffff;
  --notif-sub: #cbd5e1;
  --notif-chip-bg: rgba(255,255,255,0.16);
  --notif-accent: #7dd3fc;
  
  /* Sombras y Efectos */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 25px rgba(103, 124, 93, 0.35);
  --glass-blur: blur(16px);
  
  /* Bordes */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Transición */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   MODO CLARO EJECUTIVO & INSTITUCIONAL (Julián Peluso)
   ========================================================================== */
.light-theme {
  --bg-primary: #ededed;       /* Canvas de fondo Slate suave, técnico y descansado */
  --bg-secondary: #ffffff;     /* Superficie limpia de tarjetas y paneles */
  --bg-tertiary: #f8fafc;      /* Contenedores secundarios, headers y toolbars */
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-border-hover: #cbd5e1;
  
  --accent-primary: #677c5d;   /* Color institucional (tema claro) */
  --accent-primary-hover: #059669;
  --accent-secondary: #0d1527; /* Azul Noche / Carbón Ejecutivo */
  --accent-success: #10b981;   /* Verde Éxito */
  --accent-warning: #f59e0b;   /* Ámbar / Tasaciones */
  --accent-danger: #ef4444;    /* Rojo Alerta */
  --accent-info: #0284c7;      /* Azul Sky */
  
  --grad-primary: linear-gradient(135deg, #677c5d 0%, #059669 100%);
  --grad-premium: linear-gradient(135deg, #0d1527 0%, #1e293b 100%);
  --grad-dark: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  
  --text-primary: #22313a;     /* Slate 900 - Máxima legibilidad */
  --text-secondary: #334155;   /* Slate 700 - Contraste nítido */
  --text-muted: #64748b;       /* Slate 500 */

  /* Mismo panel de notificaciones, en tema claro */
  --notif-bg: #ffffff;
  --notif-header-bg: #f1f5f9;
  --notif-border: rgba(15,23,42,0.12);
  --notif-text: #22313a;
  --notif-sub: #475569;
  --notif-chip-bg: rgba(15,23,42,0.08);
  --notif-accent: #0369a1;
  
  --shadow-sm: 0 1px 3px rgba(34, 49, 58, 0.06), 0 1px 2px rgba(34, 49, 58, 0.04);
  --shadow-md: 0 4px 14px rgba(34, 49, 58, 0.06), 0 2px 6px rgba(34, 49, 58, 0.03);
  --shadow-lg: 0 14px 34px rgba(34, 49, 58, 0.08), 0 4px 12px rgba(34, 49, 58, 0.03);
  --shadow-glow: 0 0 25px rgba(103, 124, 93, 0.22);
}

/* Base Body & App Canvas en Modo Claro */
body.light-theme {
  background: #ededed !important;
  color: #22313a !important;
}
.light-theme .app-container {
  background: #ededed !important;
}

/* Sidebar Institucional Ejecutivo (Carbón Azul Noche & Esmeralda) */
.light-theme .sidebar {
  background: #2f414a !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 4px 0 24px rgba(11, 19, 41, 0.18) !important;
}
.light-theme .brand-icon {
  background: linear-gradient(135deg, #677c5d 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(103, 124, 93, 0.45) !important;
}
.light-theme .brand-text h1 {
  background: none !important;
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em;
}
.light-theme .brand-text span {
  color: #34d399 !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
}
.light-theme .menu-item {
  color: #94a3b8 !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  margin: 2px 10px !important;
  padding: 10px 14px !important;
  transition: all 0.2s ease !important;
}
.light-theme .menu-item:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
}
.light-theme .menu-item.active {
  background: linear-gradient(90deg, rgba(103, 124, 93, 0.22) 0%, rgba(103, 124, 93, 0.03) 100%) !important;
  border-left: 3.5px solid #677c5d !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(103, 124, 93, 0.15) !important;
}
.light-theme .menu-item.active i {
  color: #34d399 !important;
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(103, 124, 93, 0.8)) !important;
}
.light-theme .sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.light-theme .api-status-badge {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
}
.light-theme .api-status-badge.active {
  background-color: rgba(103, 124, 93, 0.18) !important;
  border: 1px solid rgba(103, 124, 93, 0.4) !important;
  color: #34d399 !important;
}
.light-theme .api-status-badge.active .status-dot {
  background-color: #677c5d !important;
  box-shadow: 0 0 10px #677c5d !important;
}

/* Header Superior Corporativo */
.light-theme .content-header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(34, 49, 58, 0.04) !important;
}
.light-theme .header-title h2 {
  color: #22313a !important;
  font-weight: 800 !important;
}
.light-theme .header-title p {
  color: #475569 !important;
}
.light-theme .user-profile {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 30px !important;
  padding: 5px 16px 5px 6px !important;
  box-shadow: 0 1px 4px rgba(34, 49, 58, 0.04) !important;
}
.light-theme #header-user-avatar {
  border-color: #677c5d !important;
  box-shadow: 0 0 0 2px rgba(103, 124, 93, 0.25) !important;
}
.light-theme #header-user-selector {
  color: #22313a !important;
  font-weight: 700 !important;
}
.light-theme #header-user-role {
  color: #047857 !important;
  font-weight: 700 !important;
}
.light-theme #theme-toggle {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #22313a !important;
  box-shadow: 0 1px 3px rgba(34, 49, 58, 0.06) !important;
}
.light-theme #btn-view-web-clients,
.light-theme .btn-portal-link {
  background: linear-gradient(135deg, #677c5d 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(103, 124, 93, 0.28) !important;
}
.light-theme #btn-view-web-clients:hover,
.light-theme .btn-portal-link:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(103, 124, 93, 0.35) !important;
}

/* ==========================================================================
   CARDS, WIDGETS Y PANELES (Elevación Suave & Toque Institucional Esmeralda)
   ========================================================================== */
.light-theme .metric-card,
.light-theme .grid-card,
.light-theme .card,
.light-theme .dashboard-card,
.light-theme .stat-card,
.light-theme .property-card,
.light-theme .dif-global-kpi-card,
.light-theme .dif-metric-group-card,
.light-theme .difusion-portal-card,
.light-theme .dif-pack-card,
.light-theme .difusion-header-card,
.light-theme .mobile-lead-card,
.light-theme .tasacion-card,
.light-theme .tasacion-calc-box,
.light-theme .agent-card,
.light-theme .agenda-card,
.light-theme .radar-card,
.light-theme .radar-filter-box,
.light-theme .c360-header-card,
.light-theme .c360-tab-card,
.light-theme .c360-panel,
.light-theme .flyer-section-card,
.light-theme .modal-card,
.light-theme .client-360-modal .modal-card,
.light-theme .leads-filter-bar,
.light-theme .leads-stage-summary-container,
.light-theme .pipeline-container,
.light-theme .properties-toolbar,
.light-theme .table-responsive {
  background: #ffffff !important;
  border-top: 3.5px solid #677c5d !important;
  border-left: 1px solid #e2e8f0 !important;
  border-right: 1px solid #e2e8f0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(34, 49, 58, 0.04), 0 1px 3px rgba(34, 49, 58, 0.02) !important;
  border-radius: 14px !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.light-theme .metric-card:hover,
.light-theme .grid-card:hover,
.light-theme .difusion-portal-card:hover,
.light-theme .property-card:hover {
  border-top-color: #059669 !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 24px rgba(103, 124, 93, 0.1) !important;
  transform: translateY(-2px);
}

.light-theme .metric-title {
  color: #475569 !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em;
}
.light-theme .metric-value {
  color: #22313a !important;
  font-weight: 900 !important;
}
.light-theme .metric-icon.blue {
  background: rgba(103, 124, 93, 0.14) !important;
  color: #047857 !important;
  border: 1px solid rgba(103, 124, 93, 0.25) !important;
}
.light-theme .metric-icon.purple {
  background: rgba(34, 49, 58, 0.08) !important;
  color: #22313a !important;
  border: 1px solid rgba(34, 49, 58, 0.15) !important;
}
.light-theme .metric-icon.orange {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #b45309 !important;
  border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
.light-theme .metric-icon.green {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #065f46 !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
.light-theme .grid-card h3 {
  color: #22313a !important;
  font-weight: 800 !important;
}
.light-theme .card-subtitle {
  color: #64748b !important;
}
.light-theme .channel-row {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
}
.light-theme .channel-row:hover {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}
.light-theme .channel-name {
  color: #22313a !important;
  font-weight: 700 !important;
}

/* Botones Institucionales en Modo Claro */
.light-theme .btn-primary,
.light-theme .btn.btn-primary {
  background: linear-gradient(135deg, #677c5d 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(103, 124, 93, 0.28) !important;
  border-radius: 8px !important;
}
.light-theme .btn-primary:hover,
.light-theme .btn.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  box-shadow: 0 6px 18px rgba(103, 124, 93, 0.38) !important;
  transform: translateY(-1px);
}
.light-theme .btn-secondary,
.light-theme .btn.btn-secondary {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(34, 49, 58, 0.04) !important;
  border-radius: 8px !important;
}
.light-theme .btn-secondary:hover,
.light-theme .btn.btn-secondary:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #22313a !important;
}

/* Formularios, Inputs, Selects y Buscadores */
.light-theme input:not([type="checkbox"]):not([type="radio"]),
.light-theme select:not(#header-user-selector),
.light-theme textarea {
  background: #ffffff !important;
  color: #22313a !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
}
.light-theme input:focus,
.light-theme select:focus,
.light-theme textarea:focus {
  border-color: #677c5d !important;
  box-shadow: 0 0 0 3px rgba(103, 124, 93, 0.2) !important;
}
.light-theme input::placeholder,
.light-theme textarea::placeholder {
  color: #94a3b8 !important;
}
.light-theme select option {
  background-color: #ffffff !important;
  color: #22313a !important;
}
.light-theme label {
  color: #1e293b !important;
  font-weight: 700 !important;
}

/* Tablas y Listados en Modo Claro */
.light-theme table thead tr th {
  background: #f8fafc !important;
  color: #22313a !important;
  font-weight: 800 !important;
  border-bottom: 2px solid #e2e8f0 !important;
}
.light-theme table tbody tr:not(.lead-stage-group-header-row) {
  background: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
}
.light-theme table tbody tr:not(.lead-stage-group-header-row):nth-child(even) {
  background: #fafbfc !important;
}
.light-theme table tbody tr:not(.lead-stage-group-header-row):hover {
  background-color: rgba(103, 124, 93, 0.06) !important;
}
.light-theme table tbody tr:not(.lead-stage-group-header-row) td {
  color: #1e293b !important;
}
.light-theme .lead-contact-name {
  color: #22313a !important;
  font-weight: 800 !important;
}
.light-theme .lead-contact-name:hover {
  color: #677c5d !important;
}

/* Pipeline Kanban en Modo Claro */
.light-theme .kanban-column {
  background: #eef2f6 !important;
  border: 1px solid #d8e2ec !important;
  border-radius: 12px !important;
}
.light-theme .kanban-column-header {
  color: #22313a !important;
  font-weight: 800 !important;
}
.light-theme .kanban-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(34, 49, 58, 0.05) !important;
  border-radius: 10px !important;
}
.light-theme .kanban-card:hover {
  border-color: #677c5d !important;
  box-shadow: 0 6px 16px rgba(103, 124, 93, 0.12) !important;
}

/* Subpestañas y Pestañas */
.light-theme .tas-tab-btn,
.light-theme .sub-tab-btn,
.light-theme .tab-btn {
  color: #475569 !important;
  font-weight: 600 !important;
}
.light-theme .tas-tab-btn.active,
.light-theme .sub-tab-btn.active,
.light-theme .tab-btn.active {
  color: #677c5d !important;
  border-bottom: 2.5px solid #677c5d !important;
  font-weight: 800 !important;
}
.light-theme .lead-main-tab-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  font-weight: 700 !important;
}
.light-theme .lead-main-tab-btn.active {
  background: #0d1527 !important;
  color: #ffffff !important;
  border-color: #0d1527 !important;
  box-shadow: 0 4px 12px rgba(13, 21, 39, 0.2) !important;
}
.light-theme .lead-main-tab-btn.active .lead-tab-badge {
  background: #677c5d !important;
  color: #ffffff !important;
}

/* Modales y Ficha 360° en Modo Claro */
.light-theme .modal-dialog,
.light-theme .modal-card,
.light-theme .client-360-dialog {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 25px 60px rgba(11, 19, 41, 0.22) !important;
  border-radius: 16px !important;
}
.light-theme .modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #22313a !important;
}
.light-theme .modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}
.light-theme .client-360-header {
  background: #0d1527 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}
.light-theme .client-360-header span,
.light-theme .client-360-header strong {
  color: #e2e8f0 !important;
}
.light-theme .client-360-header .client-icon-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}
.light-theme .client-360-header .client-icon-btn:hover {
  background: rgba(103, 124, 93, 0.3) !important;
  border-color: #677c5d !important;
  color: #34d399 !important;
}
.light-theme .client-360-sidebar {
  background: #f8fafc !important;
  border-right: 1px solid #e2e8f0 !important;
}
.light-theme .client-360-avatar {
  background: linear-gradient(135deg, #677c5d 0%, #059669 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(103, 124, 93, 0.35) !important;
}
.light-theme .c360-action-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}
.light-theme .c360-action-card:hover {
  border-color: #677c5d !important;
  box-shadow: 0 6px 16px rgba(103, 124, 93, 0.1) !important;
}

/* Tasación Result Box en Modo Claro */
.light-theme .tasacion-result-card,
.light-theme .tas-result-box {
  background: linear-gradient(135deg, #0d1527 0%, #1e293b 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 30px rgba(13, 21, 39, 0.25) !important;
}
.light-theme .tasacion-result-card h3,
.light-theme .tas-result-box h3,
.light-theme .tasacion-result-card span {
  color: #e2e8f0 !important;
}
.light-theme .tas-result-price {
  color: #34d399 !important;
  font-weight: 900 !important;
}

/* Módulo de Estadísticas y Analíticas en Modo Claro */
.light-theme .analytics-toolbar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(34, 49, 58, 0.04) !important;
}
.light-theme .analytics-live-indicator {
  background: rgba(103, 124, 93, 0.12) !important;
  color: #047857 !important;
  border: 1px solid rgba(103, 124, 93, 0.25) !important;
}
.light-theme .analytics-last-update {
  color: #64748b !important;
}
.light-theme .analytics-period-selector {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}
.light-theme .btn-period {
  color: #475569 !important;
}
.light-theme .btn-period:hover {
  color: #22313a !important;
}
.light-theme .btn-period.active {
  background: #677c5d !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(103, 124, 93, 0.35) !important;
}
.light-theme .analytics-kpi-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-top: 3.5px solid #677c5d !important;
  box-shadow: 0 2px 8px rgba(34, 49, 58, 0.04) !important;
}
.light-theme .analytics-kpi-card:hover {
  border-color: #cbd5e1 !important;
  border-top-color: #059669 !important;
  box-shadow: 0 10px 24px rgba(103, 124, 93, 0.1) !important;
  transform: translateY(-2px);
}
.light-theme .kpi-label {
  color: #475569 !important;
}
.light-theme .kpi-value {
  color: #22313a !important;
}
.light-theme .kpi-subtext {
  color: #64748b !important;
}
.light-theme .analytics-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-top: 3.5px solid #677c5d !important;
  box-shadow: 0 2px 8px rgba(34, 49, 58, 0.04) !important;
}
.light-theme .analytics-card-header {
  border-bottom: 1px solid #f1f5f9 !important;
}
.light-theme .analytics-card-title {
  color: #22313a !important;
  font-weight: 800 !important;
}
.light-theme .analytics-card-desc {
  color: #64748b !important;
}
.light-theme .sector-bar-track {
  background: #f1f5f9 !important;
}
.light-theme .funnel-step {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}
.light-theme .funnel-step-name {
  color: #22313a !important;
  font-weight: 700 !important;
}
.light-theme .analytics-table th {
  background: #f8fafc !important;
  color: #22313a !important;
  border-bottom: 2px solid #e2e8f0 !important;
}
.light-theme .analytics-table td {
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
}
.light-theme .analytics-table tbody tr:hover {
  background: rgba(103, 124, 93, 0.05) !important;
}


/* ==========================================================================
   ESTILOS GENERALES Y RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, #0d1022 0%, #070912 50%, #0a0d1f 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
body.light-theme {
  background: linear-gradient(135deg, #e8edf5 0%, #f4f6fb 50%, #ebf0f8 100%) !important;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* ==========================================================================
   GLOW SPHERES & USER PROFILE STYLES
   ========================================================================== */
/* Esferas de luz flotantes para profundidad visual (Glassmorphism) */
.glow-sphere {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  transition: var(--transition-smooth);
}
.light-theme .glow-sphere {
  opacity: 0.08;
}
.glow-sphere-1 {
  width: 600px;
  height: 600px;
  background: #6366f1;
  top: -200px;
  right: -150px;
}
.glow-sphere-2 {
  width: 500px;
  height: 500px;
  background: #06b6d4;
  bottom: -150px;
  left: -80px;
}
.glow-sphere-3 {
  width: 400px;
  height: 400px;
  background: #10b981;
  top: 30%;
  right: 8%;
}

/* Perfil del Usuario en el Header */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 49, 58, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 16px 5px 6px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.light-theme .user-profile {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(203, 213, 225, 0.8) !important;
  border-radius: 30px !important;
  padding: 5px 16px 5px 6px !important;
  box-shadow: 0 2px 10px rgba(34, 49, 58, 0.05), inset 0 1px 0 #ffffff !important;
  backdrop-filter: blur(12px) !important;
}
#header-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  flex-shrink: 0;
}
.light-theme #header-user-avatar {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.user-info {
  display: flex;
  flex-direction: column;
}
#header-user-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.light-theme #header-user-name {
  color: #22313a !important;
}
#header-user-selector {
  display: none !important;
}
#header-user-role {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}
.light-theme #header-user-role {
  color: #64748b !important;
}

/* ==========================================================================
   ESTRUCTURA DE CONTENEDORES (SPA LAYOUT)
   ========================================================================== */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: transparent;
}

/* Barra Lateral (Sidebar) */
.sidebar {
  width: 280px;
  background: rgba(10, 13, 30, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 4px 0 30px rgba(99, 102, 241, 0.08);
  display: flex;
  flex-direction: column;
  padding: 30px 24px;
  flex-shrink: 0;
  z-index: 10;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}
.light-theme .sidebar {
  background: rgba(255, 255, 255, 0.75) !important;
  border-right-color: rgba(99, 102, 241, 0.15) !important;
}

/* Monograma / Logo Oficial en el Fondo del Sidebar (Idéntico al Login) */
.sidebar-watermark-monogram {
  position: absolute;
  width: 260px;
  height: 460px;
  right: -25px;
  bottom: -20px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.9;
  transition: var(--transition-smooth);
}

.sidebar-watermark-svg {
  width: 100%;
  height: 100%;
}

.sidebar-brand,
.sidebar-menu,
.sidebar-footer {
  position: relative;
  z-index: 2;
}

/* Modo Claro: Adaptación elegante para el monograma de fondo */
.light-theme .sidebar-watermark-monogram {
  opacity: 1;
}
.light-theme .sidebar-watermark-svg rect {
  fill: url(#sidebarPilarGradLight) !important;
  stroke: url(#sidebarPilarStrokeLight) !important;
  opacity: 0.45 !important;
}
.light-theme .sidebar-watermark-p {
  fill: #677c5d !important;
  opacity: 0.15 !important;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: white;
}

.brand-icon i {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-top: 1px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.menu-item i {
  width: 20px;
  height: 20px;
  transition: var(--transition-smooth);
}

.menu-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(103, 124, 93, 0.22) 0%, rgba(103, 124, 93, 0.03) 100%);
  border-left: 3.5px solid #677c5d;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-left: -24px;
  padding-left: 39px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(103, 124, 93, 0.25), inset 0 0 20px rgba(103, 124, 93, 0.05);
}
.light-theme .menu-item.active {
  background: linear-gradient(90deg, rgba(103, 124, 93, 0.14) 0%, rgba(103, 124, 93, 0.02) 100%) !important;
  border-left: 3.5px solid #677c5d !important;
  color: #22313a !important;
}
.menu-item.active i {
  color: #34d399;
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(103, 124, 93, 0.7));
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-tertiary);
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.api-status-badge.active {
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-success);
}
.api-status-badge.active .status-dot {
  background-color: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.api-status-badge.inactive {
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--accent-warning);
}
.api-status-badge.inactive .status-dot {
  background-color: var(--accent-warning);
  box-shadow: 0 0 8px var(--accent-warning);
}

/* Área de Contenido Principal */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
  position: relative;
}

/* Cabecera */
.content-header {
  height: 88px;
  padding: 0 40px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: rgba(10, 12, 22, 0.5);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 5;
}

.light-theme .content-header {
  background-color: rgba(255, 255, 255, 0.88) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
  backdrop-filter: blur(16px) !important;
  box-shadow: 0 4px 20px rgba(34, 49, 58, 0.03);
}

.light-theme #theme-toggle {
  background: #ffffff !important;
  border: 1px solid rgba(203, 213, 225, 0.8) !important;
  color: #22313a !important;
  box-shadow: 0 2px 8px rgba(34, 49, 58, 0.06) !important;
}

.header-title h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-profile img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
}

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

/* ==========================================================================
   CAMPANA Y PANEL DE NOTIFICACIONES DE OPORTUNIDADES
   ========================================================================== */
.notifications-wrapper {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(239,68,68,0.5);
  border: 2px solid var(--card-bg, #1e293b);
  animation: pulseBadge 2s infinite ease-in-out;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 350px;
  max-width: 90vw;
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--card-border, rgba(255,255,255,0.1));
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  z-index: 1000;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.light-theme .notifications-dropdown {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

/* ==========================================================================
   COMPONENTES DE PESTAÑAS (TAB SYSTEM)
   ========================================================================== */
.tab-content {
  display: none;
  padding: 40px;
  animation: fadeIn 0.4s ease;
  flex-grow: 1;
}

.tab-content.active {
  display: block;
}

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

/* ==========================================================================
   PESTAÑA 1: DASHBOARD
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card {
  background: #0c151c;
  border: 1px solid rgba(103, 124, 93, 0.18);
  border-radius: var(--radius-md);
  padding: 24px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: var(--transition-smooth);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(103, 124, 93, 0.05) inset;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #677c5d 0%, #34d399 50%, rgba(103, 124, 93, 0.1) 100%);
  pointer-events: none;
}
.metric-card:hover {
  transform: translateY(-4px);
  border-color: #677c5d;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(103, 124, 93, 0.25);
}

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

.metric-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon.blue { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.metric-icon.purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.metric-icon.orange { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.metric-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.metric-icon i {
  width: 18px;
  height: 18px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.metric-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.trend-up {
  color: var(--accent-success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trend-up i { width: 14px; height: 14px; }

.trend-ok {
  color: var(--accent-secondary);
  font-weight: 600;
}

.metric-desc {
  color: var(--text-muted);
}

/* Grilla Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media(max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.grid-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 28px;
  backdrop-filter: var(--glass-blur);
}

.grid-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Lista de Canales */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: var(--transition-smooth);
}

.channel-row:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.channel-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.channel-logo.whatsapp { background: linear-gradient(135deg, #25d366 0%, #128c7e 100%); }
.channel-logo.messenger { background: linear-gradient(135deg, #006aff 0%, #00c6ff 100%); }
.channel-logo.instagram { background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%); }
.channel-logo.web { background: var(--grad-primary); }

.channel-logo i { width: 18px; height: 18px; }

.channel-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.channel-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Timeline Actividad */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background-color: var(--bg-tertiary);
}

.timeline-item {
  display: flex;
  gap: 20px;
  position: relative;
}

.timeline-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  border: 2px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-badge i { width: 16px; height: 16px; }

.timeline-content {
  background-color: rgba(255, 255, 255, 0.01);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.02);
  flex-grow: 1;
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.timeline-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.timeline-content p strong {
  color: var(--text-primary);
}

/* ==========================================================================
   PESTAÑA 2: PROPIEDADES (CRUD PANEL)
   ========================================================================== */
.properties-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 20px;
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 480px;
}

.search-box i,
.search-box svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.search-box input {
  width: 100%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--card-border);
  padding: 12px 16px 12px 48px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

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

.property-card {
  background: rgba(14, 17, 38, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.light-theme .property-card {
  background: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(99, 102, 241, 0.12) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.05) !important;
}
.property-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.2);
}
.light-theme .property-card:hover {
  border-color: rgba(99, 102, 241, 0.3) !important;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.1) !important;
}

.property-image {
  height: 200px;
  position: relative;
  background-color: var(--bg-tertiary);
  overflow: hidden;
}

.property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}

.property-card:hover .property-image img {
  transform: scale(1.03);
}

/* Carrusel de fotos en la tarjeta */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(10, 12, 22, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.property-card:hover .carousel-btn {
  opacity: 1;
}

.carousel-btn:hover {
  background: var(--grad-primary);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

.carousel-btn i {
  width: 16px;
  height: 16px;
}

.property-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-disponible { background-color: var(--accent-success); color: white; }
.badge-reservado { background-color: var(--accent-warning); color: #0a0c16; }
.badge-alquilado { background-color: #3b82f6; color: white; }
.badge-vendido { background-color: var(--text-muted); color: white; }
.badge-no-disponible,
.badge-nodisponible { background-color: rgba(148, 163, 184, 0.25); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.4); }

.property-type-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  background-color: rgba(10, 12, 22, 0.7);
  backdrop-filter: var(--glass-blur);
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.property-details {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.property-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-secondary);
  margin-bottom: 6px;
}

.property-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.property-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.property-specs {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 18px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.spec-item i { width: 14px; height: 14px; }

.property-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(103, 124, 93, 0.35);
  border: 1px solid rgba(103, 124, 93, 0.4);
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #10b981 0%, #677c5d 100%);
  box-shadow: 0 6px 20px rgba(103, 124, 93, 0.5);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background-color: var(--accent-danger);
  color: white;
}

/* ==========================================================================
   VISTA LISTA HORIZONTAL DE PROPIEDADES (Imagen 2)
   ========================================================================== */
.properties-grid.view-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

.property-card-horizontal {
  background: rgba(14, 17, 38, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  display: grid;
  grid-template-columns: 300px 1fr;
  backdrop-filter: var(--glass-blur, blur(10px));
  -webkit-backdrop-filter: var(--glass-blur, blur(10px));
  transition: var(--transition-smooth, all 0.2s);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.light-theme .property-card-horizontal {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
}

.property-card-horizontal:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.prop-horizontal-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: #0c151c;
  overflow: hidden;
}

.prop-horizontal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.property-card-horizontal:hover .prop-horizontal-image-wrap img {
  transform: scale(1.03);
}

.prop-list-badge-home {
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  background: #16a34a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom-right-radius: 8px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.prop-list-badge-home i {
  width: 18px;
  height: 18px;
}

.prop-list-star-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: all 0.2s;
}

.prop-list-star-btn:hover,
.prop-list-star-btn.active {
  color: #fbbf24;
  border-color: #fbbf24;
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.1);
}

.prop-list-star-btn i {
  width: 15px;
  height: 15px;
}

.prop-list-type-code-pill {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(34, 49, 58, 0.9);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 3;
}

.prop-horizontal-content {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.prop-horizontal-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prop-horizontal-title {
  font-size: 16.5px;
  font-weight: 900;
  color: var(--text-primary);
  margin: 0;
  cursor: pointer;
  letter-spacing: -0.2px;
}

.prop-horizontal-title:hover {
  color: var(--accent-primary, #6366f1);
}

.prop-horizontal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.prop-horizontal-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.prop-op-tag {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 900;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.prop-op-tag.tag-venta {
  background: #ea580c;
  color: #ffffff;
}

.prop-op-tag.tag-alquiler {
  background: #0284c7;
  color: #ffffff;
}

.prop-horizontal-prices {
  display: flex;
  flex-direction: column;
}

.prop-price-secondary {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.prop-price-main {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
}

.prop-horizontal-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 14px;
  max-width: 480px;
}

.light-theme .prop-horizontal-features-grid {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

.prop-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.prop-feature-item i {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.prop-horizontal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--card-border);
  padding-top: 10px;
  margin-top: 2px;
}

.prop-horizontal-agent {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.prop-horizontal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .property-card-horizontal {
    grid-template-columns: 1fr;
  }
  .prop-horizontal-image-wrap {
    height: 190px;
    min-height: 190px;
  }
  .prop-horizontal-features-grid {
    max-width: 100%;
  }
}

/* ==========================================================================
   PESTAÑA 3: CONFIGURACIÓN DE IA
   ========================================================================== */
.config-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
}

@media(max-width: 960px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

.config-card {
  background: rgba(14, 17, 38, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 32px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.03) inset;
  transition: var(--transition-smooth);
}
.light-theme .config-card {
  background: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(99, 102, 241, 0.12) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.05) !important;
}
.config-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.12);
}
.light-theme .config-card:hover {
  border-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.08) !important;
}

.config-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.config-card h3:not(:first-child) {
  margin-top: 32px;
}

/* Formularios */
.config-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.form-group label .label-icon {
  flex-shrink: 0;
  line-height: 1.4;
}

.form-group input, 
.form-group select, 
.form-group textarea {
  background-color: var(--bg-secondary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: var(--transition-smooth);
  width: 100%;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
  background-color: rgba(22, 28, 54, 0.65);
}
.light-theme .form-group input:focus, 
.light-theme .form-group select:focus, 
/* ==========================================================================
   ESTILOS PREMIUM PARA .FORM-INPUT Y SELECT LISTBOXES
   ========================================================================== */
.form-input,
input.form-input,
select.form-input,
textarea.form-input {
  background-color: rgba(18, 24, 48, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--text-primary, #f8fafc);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  outline: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

select.form-input option {
  background-color: #121830 !important;
  color: #f8fafc !important;
  padding: 10px 14px;
  font-size: 13px;
}

.form-input:hover,
select.form-input:hover {
  border-color: rgba(129, 140, 248, 0.5);
  background-color: rgba(24, 32, 62, 0.98);
}

.form-input:focus,
select.form-input:focus,
textarea.form-input:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3) !important;
  background-color: rgba(22, 28, 56, 0.98) !important;
}

/* Compatibilidad Tema Claro */
.light-theme .form-input,
.light-theme input.form-input,
.light-theme select.form-input,
.light-theme textarea.form-input {
  background-color: #ffffff !important;
  color: #22313a !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.light-theme select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

.light-theme select.form-input option {
  background-color: #ffffff !important;
  color: #22313a !important;
}

.form-help {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Inputs Especiales */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 48px;
}

.btn-toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.btn-toggle-password:hover {
  color: var(--text-primary);
}
.btn-toggle-password i { width: 18px; height: 18px; }

.btn-save {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* Tarjeta informativa de configuración */
.info-card {
  background: linear-gradient(135deg, rgba(22, 28, 54, 0.7) 0%, rgba(10, 12, 22, 0.9) 100%);
  border-color: rgba(99, 102, 241, 0.15);
}

.info-steps {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}

.info-step {
  display: flex;
  gap: 18px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.info-step h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.info-step p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   PESTAÑA 4: SIMULADOR MULTICANAL
   ========================================================================== */
.simulator-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  height: calc(100vh - 168px);
}

@media(max-width: 900px) {
  .simulator-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.simulator-channels h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.channel-selector-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 24px;
}

.channel-select-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
  width: 100%;
}

.channel-select-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.15);
}

.channel-select-btn.active {
  background-color: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.channel-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.channel-icon.whatsapp { background-color: #25d366; }
.channel-icon.instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); }
.channel-icon.messenger { background-color: #006aff; }
.channel-icon.web { background: var(--grad-primary); }
.channel-icon i { width: 16px; height: 16px; }

.channel-details {
  display: flex;
  flex-direction: column;
}

.channel-details span {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.channel-details small {
  font-size: 11px;
  color: var(--text-muted);
}

.channel-guide-card {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.channel-guide-card h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.channel-guide-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.channel-guide-card li {
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 12px;
  position: relative;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.channel-guide-card li:hover {
  color: var(--text-primary);
  padding-left: 16px;
}

.channel-guide-card li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-weight: bold;
}

/* Simulador Viewport - Celular Mockup */
.simulator-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.phone-mockup {
  width: 320px;
  height: 560px;
  background-color: #000;
  border-radius: 40px;
  border: 8px solid #222538;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

/* Contenedor Interno de Canales del Teléfono */
.phone-screen {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
  color: #333;
}

/* =========================================
   MAQUETA: WHATSAPP
   ========================================= */
.phone-screen.wa-theme {
  background-color: #efeae2;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-size: contain;
}

.wa-header {
  background-color: #075e54;
  color: white;
  padding: 24px 14px 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.wa-header .back-btn {
  font-size: 18px;
  display: flex;
  align-items: center;
}

.wa-header img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.wa-header-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.wa-header-info h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.wa-header-info span {
  font-size: 9px;
  opacity: 0.8;
}

.wa-header-actions {
  display: flex;
  gap: 12px;
  font-size: 14px;
}

.wa-chat-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  word-break: break-word;
}

.wa-bubble.received {
  background-color: white;
  align-self: flex-start;
  border-top-left-radius: 0;
}

.wa-bubble.sent {
  background-color: #d9fdd3;
  align-self: flex-end;
  border-top-right-radius: 0;
}

.wa-time {
  font-size: 8px;
  color: #777;
  text-align: right;
  display: block;
  margin-top: 4px;
}

.wa-input-area {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-input-box {
  background-color: white;
  border-radius: 20px;
  flex-grow: 1;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.wa-input-box input {
  border: none;
  background: none;
  flex-grow: 1;
  font-size: 12px;
  color: #333;
}

.wa-input-box i {
  color: #888;
  font-size: 14px;
  cursor: pointer;
}

.wa-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #00a884;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.wa-send-btn i { width: 14px; height: 14px; }

/* =========================================
   MAQUETA: INSTAGRAM
   ========================================= */
.phone-screen.insta-theme {
  background-color: #000;
  color: #fff;
}

.insta-header {
  border-bottom: 1px solid #222;
  padding: 24px 14px 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.insta-header img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #333;
}

.insta-header-info {
  flex-grow: 1;
}

.insta-header-info h4 {
  font-size: 13px;
  font-weight: 600;
}

.insta-header-info span {
  font-size: 9px;
  color: #888;
}

.insta-header-actions i {
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.insta-chat-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insta-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.insta-bubble.received {
  background-color: #262626;
  color: #fff;
  align-self: flex-start;
}

.insta-bubble.sent {
  background: linear-gradient(135deg, #ae22a8 0%, #ec1868 100%);
  color: #fff;
  align-self: flex-end;
}

.insta-input-area {
  padding: 10px;
  border-top: 1px solid #111;
}

.insta-input-box {
  background-color: #121212;
  border: 1px solid #333;
  border-radius: 24px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.insta-input-box input {
  border: none;
  background: none;
  color: #fff;
  flex-grow: 1;
  font-size: 12px;
}

.insta-send-btn {
  color: #0095f6;
  font-weight: 700;
  font-size: 12px;
  border: none;
  background: none;
  cursor: pointer;
}

/* =========================================
   MAQUETA: MESSENGER
   ========================================= */
.phone-screen.messenger-theme {
  background-color: #fff;
  color: #000;
}

.messenger-header {
  border-bottom: 1px solid #eee;
  padding: 24px 14px 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.messenger-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.messenger-header-left img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.messenger-header-info h4 {
  font-size: 13px;
  font-weight: 600;
}

.messenger-header-info span {
  font-size: 9px;
  color: #888;
}

.messenger-header-actions {
  display: flex;
  gap: 14px;
  color: #0084ff;
  font-size: 16px;
}

.messenger-chat-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messenger-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.messenger-bubble.received {
  background-color: #f0f0f0;
  color: #000;
  align-self: flex-start;
}

.messenger-bubble.sent {
  background-color: #0084ff;
  color: #fff;
  align-self: flex-end;
}

.messenger-input-area {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #eee;
}

.messenger-input-box {
  background-color: #f0f2f5;
  border-radius: 20px;
  flex-grow: 1;
  padding: 6px 14px;
  display: flex;
  align-items: center;
}

.messenger-input-box input {
  border: none;
  background: none;
  color: #000;
  flex-grow: 1;
  font-size: 12px;
}

.messenger-send-btn {
  background: none;
  border: none;
  color: #0084ff;
  font-size: 16px;
  cursor: pointer;
}

/* =========================================
   MAQUETA: WIDGET WEB
   ========================================= */
.phone-screen.web-theme {
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
}

/* Fondo simulando el sitio web */
.web-site-mock {
  flex-grow: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0.4;
  font-size: 10px;
  pointer-events: none;
}

.web-site-mock .mock-hero {
  height: 80px;
  background: linear-gradient(135deg, #1b203e, #0a0c16);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.web-site-mock .mock-row {
  height: 12px;
  background-color: #cbd5e1;
  border-radius: 4px;
  width: 80%;
}
.web-site-mock .mock-row.short { width: 50%; }

/* Widget Real */
.web-widget-container {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 250px;
  height: 360px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 5;
  transition: var(--transition-smooth);
}

.web-widget-header {
  background: var(--grad-primary);
  color: white;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.web-widget-header img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.web-widget-header h4 {
  font-size: 11px;
  font-weight: 700;
}

.web-widget-chat {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.web-bubble {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.4;
  word-break: break-word;
}

.web-bubble.received {
  background-color: #f1f5f9;
  color: #1e293b;
  align-self: flex-start;
}

.web-bubble.sent {
  background-color: #6366f1;
  color: white;
  align-self: flex-end;
}

.web-widget-input {
  border-top: 1px solid #e2e8f0;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  background-color: white;
}

.web-widget-input input {
  border: none;
  background: none;
  font-size: 11px;
  flex-grow: 1;
  color: #333;
}

.web-widget-send {
  background: none;
  border: none;
  color: #6366f1;
  cursor: pointer;
  font-size: 14px;
}

/* Efecto de cargando / escribiendo (typing indicator) */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  background-color: rgba(0, 0, 0, 0.05);
  align-self: flex-start;
  width: fit-content;
}

.insta-theme .typing-indicator {
  background-color: #262626;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #888;
  border-radius: 50%;
  animation: typingGlow 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingGlow {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================================
   PESTAÑA 5: DOCUMENTACIÓN / INTEGRACIÓN
   ========================================================================== */
.integration-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 32px;
  backdrop-filter: var(--glass-blur);
}

.integration-header-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
  margin-bottom: 30px;
}

.int-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.int-tab:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.02);
}

.int-tab.active {
  color: white;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.integration-pane {
  display: none;
}

.integration-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.integration-pane h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.integration-pane p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.step-guide {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.step-guide-item {
  display: flex;
  gap: 16px;
  background-color: rgba(255, 255, 255, 0.01);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-guide-item strong {
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}

.step-guide-item p {
  font-size: 13px;
  margin-bottom: 0;
}

/* Fenced Code block style */
.code-block-wrapper {
  background-color: #05070f;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
  margin-top: 16px;
}

.code-header {
  background-color: #0b0d19;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.btn-copy-code {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  transition: var(--transition-smooth);
}
.btn-copy-code:hover {
  color: var(--text-primary);
}
.btn-copy-code i { width: 14px; height: 14px; }

pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
}

code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: #34d399; /* Green coding color */
  line-height: 1.5;
  display: block;
}

/* ==========================================================================
   MODALES (POPUPS)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(5, 7, 15, 0.85);
  backdrop-filter: var(--glass-blur);
  display: none;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  overflow-y: auto;
  padding: 16px 10px;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  z-index: 99999;
}

/* PANTALLA DEDICADA DE BIENVENIDA Y LOGIN SPLIT DUAL-PANEL (PANTALLA COMPLETA) */
.welcome-login-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #090d16;
  display: none;
  opacity: 1;
  pointer-events: none;
  z-index: -1;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.welcome-login-wrapper.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  z-index: 999999;
}

/* Ocultar pantalla de login y mostrar app inmediatamente si el usuario ya inició sesión */
html.authenticated-user #welcome-login-screen,
html.authenticated-user .welcome-login-wrapper,
html.authenticated-user .welcome-login-wrapper.active,
html.authenticated-user #welcome-login-screen[style*="flex"] {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}

html.authenticated-user #app-container {
  display: flex !important;
}

/* Tarjeta Principal Split a Pantalla Completa (100% Viewport) */
.welcome-split-card {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  background: #0c111d;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  margin: 0;
  position: relative;
}

/* PANEL IZQUIERDO: Diseño Íntegro Luxury con Logo Plasmado */
.welcome-panel-left.integrated-brand-panel {
  flex: 1 1 50%;
  width: 50%;
  height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(103, 124, 93, 0.28) 0%, rgba(8, 30, 24, 0.96) 50%, #06110e 100%);
  padding: 50px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  text-align: center;
}

/* Marca de Agua Geométrica Oficial del Logo en el fondo */
.bg-watermark-monogram {
  position: absolute;
  width: 380px;
  height: 640px;
  right: -30px;
  bottom: -40px;
  pointer-events: none;
  z-index: 1;
}

.watermark-svg {
  width: 100%;
  height: 100%;
  animation: pulseWatermark 7s ease-in-out infinite alternate;
}

@keyframes pulseWatermark {
  0% { transform: scale(1) translateY(0px); opacity: 0.85; }
  100% { transform: scale(1.03) translateY(-10px); opacity: 1; }
}

.panel-left-top {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.panel-left-badge.luxury-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(103, 124, 93, 0.16);
  backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #34d399;
  border: 1px solid rgba(103, 124, 93, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.panel-left-badge svg {
  width: 15px;
  height: 15px;
}

.panel-left-content {
  position: relative;
  z-index: 2;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Logo Oficial Plasmado e Integrado Minimalista */
.hero-brand-integrated {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.hero-logo-frame {
  width: 140px;
  height: 140px;
  border-radius: 28px;
  background: transparent;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 35px rgba(103, 124, 93, 0.5));
  transition: transform 0.3s ease;
}

.hero-logo-frame:hover {
  transform: scale(1.05);
}

.hero-logo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 20px;
}

.hero-brand-name {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1.15;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.hero-brand-tagline {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 8px;
  display: block;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-gold-line {
  width: 70px;
  height: 3.5px;
  background: linear-gradient(90deg, #fbbf24, #677c5d);
  border-radius: 2px;
  margin: 20px auto 0 auto;
}

.panel-left-footer {
  position: relative;
  z-index: 2;
  width: 100%;
}

.panel-footer-note {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.3px;
}

/* PANEL DERECHO: Formulario de Login Dark (#0c111d) */
.welcome-panel-right {
  flex: 1 1 50%;
  width: 50%;
  height: 100vh;
  background: #0c111d;
  background-image: radial-gradient(circle at 80% 20%, rgba(103, 124, 93, 0.08) 0%, rgba(12, 17, 29, 0.98) 70%);
  padding: 50px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 2;
  overflow-y: auto;
}

.login-box-wrapper {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

/* Header del Formulario con fondo de logo en Negro */
.login-form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand-badge.logo-badge-black {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #000000;
  padding: 4px;
  border: 2px solid #677c5d;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(103, 124, 93, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-brand-badge.logo-badge-black img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.login-headings {
  display: flex;
  flex-direction: column;
}

.login-main-title {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.3px;
}

.login-sub-brand {
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 3px;
}

/* Alerta de Error */
.login-alert-box {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 13px;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 18px;
  animation: shake 0.4s ease;
}

.login-alert-box svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Formulario */
.modern-login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-forgot-pass {
  background: none;
  border: none;
  color: #677c5d;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.link-forgot-pass:hover {
  color: #34d399;
  text-decoration: underline;
}

.field-input-box {
  position: relative;
  display: flex !important;
  align-items: center !important;
  background: #091a14 !important;
  border: 1.5px solid rgba(103, 124, 93, 0.35) !important;
  border-radius: 14px !important;
  padding: 0 14px !important;
  min-height: 52px !important;
  transition: all 0.25s ease !important;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5) !important;
}

.field-input-box .field-icon,
.field-icon {
  position: static !important;
  width: 19px !important;
  height: 19px !important;
  color: #34d399 !important;
  flex-shrink: 0 !important;
  margin-right: 12px !important;
  margin-left: 2px !important;
  pointer-events: none !important;
}

.field-input-box input {
  flex: 1 !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  padding: 13px 4px 13px 0 !important;
  caret-color: #34d399 !important;
}

.field-input-box input:focus {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.field-input-box input::placeholder {
  color: #52637a !important;
  font-size: 13.5px !important;
}

.btn-toggle-eye {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-eye svg {
  width: 18px;
  height: 18px;
}

.btn-toggle-eye:hover {
  color: #ffffff;
}

/* Botón Submit */
.btn-login-submit {
  width: 100%;
  padding: 13.5px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  background: linear-gradient(135deg, #677c5d 0%, #059669 100%);
  color: #ffffff;
  border: none;
  margin-top: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 6px 20px rgba(103, 124, 93, 0.38);
  transition: all 0.2s ease;
}

.btn-login-submit svg {
  width: 18px;
  height: 18px;
}

.btn-login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(103, 124, 93, 0.5);
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.btn-login-submit:active {
  transform: translateY(0);
}

/* Panel Recuperación de Clave */
.forgot-pass-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(103, 124, 93, 0.08);
  border: 1px solid rgba(103, 124, 93, 0.3);
  padding: 18px;
  border-radius: 14px;
  margin-top: 10px;
  width: 100%;
}

.forgot-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #34d399;
  margin: 0 0 4px 0;
}

.forgot-header p {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

.forgot-actions {
  display: flex;
  gap: 8px;
}

.btn-send-recovery {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  background: #677c5d;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-cancel-recovery {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 8px;
  background: #161f30;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

/* Enlace Volver a la Web Principal */
.login-footer-nav {
  margin-top: 20px;
  text-align: left;
  width: 100%;
}

.link-back-portal {
  font-size: 12.5px;
  color: #64748b;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.link-back-portal svg {
  width: 14px;
  height: 14px;
}

.link-back-portal:hover {
  color: #677c5d;
}

/* RESPONSIVE PANTALLA COMPLETA */
@media (max-width: 880px) {
  .welcome-split-card {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .welcome-panel-left.integrated-brand-panel {
    width: 100%;
    flex: none;
    height: auto;
    padding: 36px 24px;
  }
  .hero-logo-frame {
    width: 95px;
    height: 95px;
    margin-bottom: 10px;
  }
  .hero-brand-name {
    font-size: 1.7rem;
  }
  .hero-pillars-grid {
    display: none;
  }
  .welcome-panel-right {
    width: 100%;
    flex: 1;
    height: auto;
    padding: 36px 24px;
  }
}

#welcome-modal {
  display: none;
}

#welcome-modal.active {
  display: flex;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(18px);
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  width: 680px;
  max-width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

/* Agregar/Editar Propiedad: formulario muy extenso, así que este modal en particular usa (casi)
   toda la ventana disponible en vez del ancho fijo genérico de .modal-card -- se adapta al tamaño
   real de pantalla (vw/vh) en vez de un tamaño fijo en px. En mobile, la media query de abajo
   (.modal-card !important) sigue pisando esto, que es lo que queremos ahí. */
#property-modal .modal-card {
  width: 96vw;
  max-width: 1680px;
  height: 94vh;
  max-height: 94vh;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

/* BOTÓN DE CIERRE DE MODALES ELEGANTE, GRANDE Y PROFESIONAL */
.btn-close-modal,
.modal-close,
.modal-close-btn,
button.modal-close {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: var(--text-secondary, #94a3b8) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  line-height: 1 !important;
  padding: 0 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.btn-close-modal:hover,
.modal-close:hover,
.modal-close-btn:hover,
button.modal-close:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45) !important;
}

.btn-close-modal i,
.btn-close-modal svg,
.modal-close i,
.modal-close svg {
  width: 18px !important;
  height: 18px !important;
  stroke-width: 2.3px !important;
}

.light-theme .btn-close-modal,
.light-theme .modal-close,
.light-theme .modal-close-btn,
.light-theme button.modal-close {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  box-shadow: 0 1px 4px rgba(34, 49, 58, 0.08) !important;
}

.light-theme .btn-close-modal:hover,
.light-theme .modal-close:hover,
.light-theme .modal-close-btn:hover,
.light-theme button.modal-close:hover {
  background: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-row > .form-group {
  flex: 1;
}

.flex-2 { flex: 2 !important; }
.flex-1 { flex: 1 !important; }

/* Checkbox personalizado */
.flex-center-checkbox {
  justify-content: center;
  padding-top: 24px;
}

.checkbox-container {
  display: block;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--bg-primary);
  border: 1px solid var(--card-border);
  border-radius: 4px;
}

.checkbox-container:hover input ~ .checkmark {
  background-color: var(--bg-tertiary);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.modal-footer {
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   TOASTS (NOTIFICACIONES)
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--accent-success);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition-smooth);
  pointer-events: none; /* oculto (transparente) no tiene que tapar los botones de abajo */
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Leads Table & Workflows */
.leads-table th, 
.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}

.leads-table tr {
  transition: var(--transition-smooth);
}

.leads-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

.badge-status {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
}

.badge-status.nuevo {
  background-color: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-status.contactado {
  background-color: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-status.en-seguimiento {
  background-color: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-status.convertido {
  background-color: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-status.descartado {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.lead-contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lead-contact-info .lead-name {
  font-weight: 700;
  color: var(--text-primary);
}

.lead-contact-info .lead-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.lead-channel-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin: 0 auto;
}

.lead-channel-icon.whatsapp { background: #25d366; }
.lead-channel-icon.instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045); }
.lead-channel-icon.messenger { background: #0084ff; }
.lead-channel-icon.web { background: var(--grad-primary); }

.lead-channel-icon i {
  width: 14px;
  height: 14px;
}

.lead-status-select {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.lead-status-select:focus {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.leads-table-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.leads-table-actions .btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 6px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.leads-table-actions .btn i,
.leads-table-actions .btn svg {
  width: 15px;
  height: 15px;
}

/* TOKKO BROKER 48H SLA TIMER BUBBLE */
.sla-timer-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace, system-ui;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  box-sizing: border-box;
}

.sla-timer-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

.sla-progress-track {
  width: 100%;
  height: 3.5px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 1px;
}

.sla-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease, background 0.3s ease;
}

.sla-progress-fill.sla-success {
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 4px rgba(52, 211, 153, 0.5);
}

.sla-progress-fill.sla-warning {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.5);
}

.sla-progress-fill.sla-danger {
  background: linear-gradient(90deg, #dc2626, #f87171);
  box-shadow: 0 0 4px rgba(248, 113, 113, 0.5);
}

.sla-progress-fill.sla-critical {
  background: #ffffff;
  box-shadow: 0 0 4px #ffffff;
}

.sla-timer-bubble.sla-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.sla-timer-bubble.sla-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.sla-timer-bubble.sla-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.sla-timer-bubble.sla-critical {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid #991b1b !important;
  animation: slaPulse 1.2s infinite ease-in-out;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
}

.sla-timer-bubble.sla-unassigned {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Mismo azul que el estado "Congelado" en PIPELINE_STAGE_COLORS (public/app.js) */
.sla-timer-bubble.sla-frozen {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.4);
}

.sla-progress-fill.sla-frozen {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  box-shadow: 0 0 4px rgba(96, 165, 250, 0.5);
}

@keyframes slaPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    transform: scale(1);
  }
}

/* ==========================================================================
   PIPELINE CHEVRON DE OPORTUNIDADES & PANEL CRM 360
   ========================================================================== */

.pipeline-chevron-wrapper {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 6px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: var(--bg-secondary);
}

.pipeline-chevron-wrapper::-webkit-scrollbar {
  height: 6px;
}
.pipeline-chevron-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.pipeline-step {
  flex: 1;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 14px 10px 22px;
  color: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  clip-path: polygon(0% 0%, calc(100% - 14px) 0%, 100% 50%, calc(100% - 14px) 100%, 0% 100%, 14px 50%);
  margin-right: -10px;
  user-select: none;
}

.pipeline-step:first-child {
  clip-path: polygon(0% 0%, calc(100% - 14px) 0%, 100% 50%, calc(100% - 14px) 100%, 0% 100%);
  padding-left: 14px;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.pipeline-step:last-child {
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 14px 50%);
  margin-right: 0;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.pipeline-step:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  z-index: 5;
}

.pipeline-step.active {
  filter: brightness(1.25);
  box-shadow: inset 0 0 0 2px #ffffff, 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.pipeline-count {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.pipeline-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  max-width: 90px;
}

/* Colores específicos del Pipeline Chevron (Imagen 1) */
.pipe-step-all { background: #677c5d; }
.pipe-step-sin-seg { background: #528994; }
.pipe-step-1 { background: #ef4444; }
.pipe-step-2 { background: #f59e0b; color: #1e293b !important; }
.pipe-step-2 .pipeline-count, .pipe-step-2 .pipeline-label { text-shadow: none; }
.pipe-step-4 { background: #38bdf8; color: #0c4a6e !important; }
.pipe-step-4 .pipeline-count, .pipe-step-4 .pipeline-label { text-shadow: none; }
.pipe-step-6 { background: #84cc16; color: #1e293b !important; }
.pipe-step-6 .pipeline-count, .pipe-step-6 .pipeline-label { text-shadow: none; }
.pipe-step-7 { background: #2563eb; }
.pipe-step-3 { background: #ec4899; }
.pipe-step-5 { background: #ea580c; }
.pipe-step-8 { background: #f472b6; color: #831843 !important; }
.pipe-step-8 .pipeline-count, .pipe-step-8 .pipeline-label { text-shadow: none; }
.pipe-step-9 { background: #8b5cf6; }

/* ==========================================================================
   AGRUPACIONES POR ESTADO EN TABLA DE OPORTUNIDADES (Imagen 1)
   ========================================================================== */
.lead-stage-group-header-row,
.light-theme .lead-stage-group-header-row {
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
  transition: all 0.2s ease;
}

.lead-stage-group-header-row td,
.light-theme .lead-stage-group-header-row td {
  color: #ffffff !important;
  background-color: inherit !important;
  padding: 10px 14px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.lead-stage-group-header-row .stage-group-badge-count,
.light-theme .lead-stage-group-header-row .stage-group-badge-count {
  background: rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  font-weight: 700 !important;
}

.stage-group-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #ffffff;
  vertical-align: middle;
}

.stage-group-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stage-group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.stage-group-title-wrap:hover {
  opacity: 0.92;
}

.stage-empty-placeholder-row td {
  padding: 12px 24px !important;
  color: var(--text-muted) !important;
  font-size: 11.5px !important;
  font-style: italic;
  background: rgba(0, 0, 0, 0.12);
  border-bottom: 1px solid var(--card-border) !important;
}

.mobile-stage-group-banner {
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 14px 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Barra de Acciones de Oportunidades */
.opps-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.opps-actions-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.opp-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.opp-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.opp-action-btn i {
  width: 14px;
  height: 14px;
}

/* Mini-Ficha de Contacto en Tabla (Imagen 2) */
.client-mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.client-avatar-silhouette {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  flex-shrink: 0;
  overflow: hidden;
}

.client-mini-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.client-mini-name {
  font-size: 14px;
  font-weight: 800;
  color: #ef4444;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s;
}

.client-mini-name:hover {
  color: #dc2626;
}

.client-star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}

.client-star-btn.active {
  color: #f59e0b;
}

.client-mini-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.client-mini-meta a {
  color: inherit;
  text-decoration: none;
}
.client-mini-meta a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

/* ==========================================================================
   SISTEMA DE MODALES OVERLAY & FICHA 360°
   ========================================================================== */

.modal, .modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 99999 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
}

#client-360-modal,
.client-360-modal {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(3, 7, 18, 0.88) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 100050 !important;
  display: none;
  opacity: 0;
  pointer-events: none;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

#client-360-modal.active,
.client-360-modal.active,
.modal.active, 
.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 100050 !important;
}

#modal-contract-detail.active {
  z-index: 100150 !important;
}

#modal-doc-viewer.active,
#modal-doc-viewer {
  z-index: 100300 !important;
}

@keyframes modalScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Modales que deben abrirse por ENCIMA de la Ficha 360° */
#lead-modal.active,
#property-modal.active,
#c360-new-event-modal.active,
#property-dispatch-modal.active,
#dispatch-properties-modal.active,
#modal-lead-matches.active,
#modal-change-lead-property.active,
#hammer-close-modal.active,
#flyer-poster-modal.active,
#modal-internal-prop-info.active,
#bitacora-modal.active,
#c360-change-property-modal.active,
#close-opportunity-modal.active {
  z-index: 100090 !important;
}

/* Debe abrirse por encima de #property-modal (100090), que es donde vive su botón */
#modal-doc-status.active {
  z-index: 100096 !important;
}

#watermark-remover-modal.active {
  z-index: 2147483647 !important;
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   MODAL DE INFORMACIÓN INTERNA (ADAPTATIVO MODO OSCURO & MODO CLARO)
   ========================================================================== */
.internal-info-modal-card {
  max-width: 580px;
  width: 95%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  background: var(--card-bg) !important;
  backdrop-filter: var(--glass-blur);
}

.internal-info-header {
  background: var(--bg-tertiary) !important;
  border-bottom: 1px solid var(--card-border) !important;
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.internal-info-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  font-size: 14px;
  line-height: 1.6;
}

.internal-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 11px 15px;
  transition: var(--transition-smooth);
}

.internal-info-row-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 11px 15px;
  transition: var(--transition-smooth);
}

.internal-info-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.internal-info-val {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
}

.internal-info-price-box {
  background: rgba(103, 124, 93, 0.08);
  border: 1px solid rgba(103, 124, 93, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 4px;
}

.light-theme .internal-info-price-box {
  background: rgba(103, 124, 93, 0.09);
  border: 1px solid rgba(103, 124, 93, 0.35);
}

.internal-info-footer {
  padding: 14px 22px;
  background: var(--bg-tertiary) !important;
  border-top: 1px solid var(--card-border) !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-dialog {
  background: var(--bg-primary, #22313a);
  border: 1px solid var(--card-border, #334155);
  border-radius: 16px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  position: relative;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.client-360-dialog {
  background: var(--bg-primary, #22313a);
  border: 1px solid var(--card-border, #334155);
  border-radius: 16px;
  width: 98vw !important;
  max-width: 1680px !important;
  height: 94vh !important;
  max-height: 96vh !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.8);
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.client-360-header {
  padding: 14px 24px;
  background: var(--bg-secondary, #1e293b);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.client-360-header-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.client-360-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.smart-lead-badge {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.client-quick-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.client-icon-btn:hover {
  background: var(--accent-primary, #6366f1);
  color: #ffffff;
  transform: translateY(-1px);
}

.client-360-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
  flex: 1;
}

/* Adaptación Completa para Móviles (<= 900px) */
@media (max-width: 900px) {
  .client-360-modal {
    padding: 0 !important;
  }
  
  .client-360-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    overflow-x: hidden !important;
  }

  .client-360-profile-card,
  .client-360-contact-list,
  #c360-assigned-property-section,
  #c360-assigned-property-section > div {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .client-360-header {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .client-360-header-info {
    font-size: 10.5px;
    line-height: 1.3;
    width: 100%;
    order: 2;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .client-360-top-actions {
    width: 100%;
    order: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
  }
  
  .client-quick-icons {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 120px);
    padding-bottom: 2px;
  }
  
  .client-icon-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }
  
  .client-360-body {
    grid-template-columns: 1fr !important;
    padding: 12px 10px !important;
    gap: 14px !important;
  }

  .client-360-profile-card {
    padding: 14px !important;
  }

  .client-360-avatar {
    width: 58px !important;
    height: 58px !important;
    font-size: 22px !important;
  }

  .client-360-name {
    font-size: 16px !important;
  }

  .client-360-contact-list {
    font-size: 11.5px !important;
    gap: 6px !important;
    margin: 8px 0 12px 0 !important;
  }

  .client-360-metrics-row {
    padding-top: 10px !important;
  }

  #c360-assigned-property-section > div:last-child {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #c360-assigned-property-section > div:last-child > div:first-child {
    width: 100% !important;
    height: 180px !important;
  }

  #pane-c360-buscador > div:first-child > div {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  
  #pane-c360-buscador > div:first-child > div > button {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    margin-top: 4px !important;
  }
}

/* Columna Izquierda: Perfil del Cliente */
.client-360-profile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.client-360-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 700;
}

.client-360-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.client-360-contact-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 16px 0;
  text-align: left;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.client-360-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

.client-360-status-pill {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f97316;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.client-hammer-btn {
  background: rgba(0, 0, 0, 0.25);
  border: none;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.client-hammer-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.client-360-metrics-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

.client-360-metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-secondary);
}

.client-360-metric-item strong {
  font-size: 14px;
  color: var(--text-primary);
}

/* Columna Derecha: Tarjetas de Acción y Subtabs */
.client-360-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.client-action-boxes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 650px) {
  .client-action-boxes-grid {
    grid-template-columns: 1fr;
  }
}

.client-action-box {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  text-align: center;
}

.client-action-box h4 {
  font-size: 13.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
}

.client-action-box p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.btn-action-start {
  background: transparent;
  border: 1.5px solid #ef4444;
  color: #ef4444;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action-start:hover {
  background: #ef4444;
  color: #ffffff;
}

/* Pestañas Buscador / Timeline */
.client-tabs-nav {
  display: flex;
  border-bottom: 2px solid var(--card-border);
  background: var(--bg-secondary);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.client-tab-btn {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.client-tab-btn.active {
  background: #334155;
  color: #ffffff;
  border-bottom: 3px solid #f97316;
}

/* Timeline Cards (Imagen 4) */
.timeline-notes-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  padding: 10px 16px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  margin-bottom: 14px;
}

.timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-event-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  position: relative;
}

.timeline-avatar-tag {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

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

.timeline-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.timeline-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.timeline-prop-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-primary, #6366f1);
  text-decoration: underline;
  cursor: pointer;
}

/* ==========================================================================
   MODAL DE DESPACHO PROFESIONAL DE PROPIEDADES (Imagen 5)
   ========================================================================== */

.dispatch-modal-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  padding: 20px;
}

@media (max-width: 800px) {
  .dispatch-modal-layout {
    grid-template-columns: 1fr;
  }
}

.dispatch-left-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dispatch-right-col {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dispatch-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #f97316;
  margin-bottom: 6px;
}

.dispatch-prop-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* Intent Badges styling */
.badge-intent {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: capitalize;
}

.badge-intent i {
  width: 12px;
  height: 12px;
}

.badge-intent.visita {
  background-color: rgba(139, 92, 246, 0.1); /* purple */
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-intent.tasación {
  background-color: rgba(59, 130, 246, 0.1); /* blue */
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-intent.contacto-agente {
  background-color: rgba(245, 158, 11, 0.1); /* orange */
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-intent.consulta-general {
  background-color: rgba(156, 163, 175, 0.1); /* gray */
  color: #d1d5db;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

/* ==========================================================================
   AGENT CARDS & PERFORMANCE METRICS
   ========================================================================== */
.agent-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  backdrop-filter: var(--glass-blur);
}

.agent-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: var(--shadow-glow);
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.05);
}

.agent-meta h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.agent-meta span {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
}

.agent-kpis {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 16px;
}

.agent-kpi-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-kpi-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.agent-kpi-val {
  color: var(--text-primary);
  font-weight: 700;
}

.agent-kpi-bar-wrapper {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.agent-kpi-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   BITÁCORA TIMELINE SLEEK DESIGN
   ========================================================================== */
.bitacora-time {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.bitacora-author-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.bitacora-author-badge.sistema {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.bitacora-author-badge.admin {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.bitacora-content-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Custom Dropdown select within table */
.agent-select {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  width: 100%;
  max-width: 140px;
  transition: var(--transition-smooth);
}

.agent-select:hover {
  border-color: var(--accent-primary);
}

.btn-action-bitacora {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-action-bitacora:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
  transform: scale(1.05);
}

/* ==========================================================================
   SUB-TABS LAYOUT SYSTEM
   ========================================================================== */
.sub-tab-btn {
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.sub-tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--card-border);
}

.sub-tab-btn.active {
  background-color: var(--bg-tertiary);
  color: var(--accent-primary);
  border-color: var(--card-border);
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.15);
}

.agenda-view-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.agenda-view-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.agenda-view-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-color: transparent !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

.sub-tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.sub-tab-pane.active {
  display: block;
}

/* Vista previa interactiva de mapa en las tarjetas de propiedades */
.property-map-preview-container {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid var(--card-border);
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transition: var(--transition-smooth);
}

.property-map-preview-container:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.property-map-preview-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(11, 15, 25, 0.85);
  color: #fff;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  transition: var(--transition-smooth);
}

.property-map-preview-container:hover .property-map-preview-overlay {
  background: var(--accent-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* FAQ Accordion */
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.faq-item {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-smooth);
}

.faq-item:hover {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.faq-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 16px;
}

.faq-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  transition: var(--transition-smooth);
}

.faq-header:hover h4 {
  color: var(--accent-primary);
}

.faq-toggle {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
  flex-shrink: 0;
}

.faq-toggle::before,
.faq-toggle::after {
  content: '';
  position: absolute;
  background-color: var(--accent-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Horizontal line */
.faq-toggle::before {
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
}

/* Vertical line */
.faq-toggle::after {
  top: 0;
  left: 6px;
  width: 2px;
  height: 14px;
}

.faq-item.active {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

/* Rotate vertical line to make a minus sign */
.faq-item.active .faq-toggle::after {
  transform: rotate(90deg);
  opacity: 0;
}

.faq-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  padding: 0 24px;
}

.faq-item.active .faq-body {
  max-height: 220px;
  padding-bottom: 20px;
}

.faq-body p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* Oscurecer el dropdown selector de usuario en la cabecera */
#header-user-selector option {
  background-color: #111827 !important;
  color: var(--text-primary) !important;
}

/* ==========================================================================
   MÓDULO DE TASACIÓN – NORMA TTN 6.3
   ========================================================================== */

/* Grid principal de la ficha técnica */
.tas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

/* Tarjeta de sección de tasación */
.tas-card {
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
}

/* Título de sección dentro de tasación */
.tas-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 10px;
}

/* Grid de formulario interno (2 columnas adaptativo) */
.tas-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Link estilizado para enlaces externos */
.tas-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.tas-link:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent-secondary);
}

/* Contenedor de los 3 comparables */
.tas-comparables-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Tarjeta de comparable individual */
.tas-comparable-card {
  background: rgba(27, 32, 62, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}
.light-theme .tas-comparable-card {
  background: rgba(241, 245, 249, 0.75) !important;
  border-color: rgba(34, 49, 58, 0.08) !important;
}
.tas-comparable-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 12px rgba(99, 102, 241, 0.1);
}
.light-theme .tas-comparable-card:hover {
  border-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 8px 20px rgba(34, 49, 58, 0.05), 0 0 8px rgba(99, 102, 241, 0.05) !important;
}

/* Header del comparable */
.tas-comp-header {
  margin-bottom: 14px;
}

/* Badge de comparable (Comparable 1, 2, 3) */
.tas-comp-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2) 0%, rgba(6,182,212,0.2) 100%);
  border: 1px solid rgba(99,102,241,0.4);
  color: var(--accent-primary);
}

/* Grid de coeficientes TTN 6.3 */
.tas-coef-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.05);
}

/* Item individual de coeficiente */
.tas-coef-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.tas-coef-item label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tas-coef-item input {
  padding: 6px 8px;
  font-size: 13px;
  text-align: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--accent-secondary);
  font-weight: 700;
  width: 100%;
}
.tas-coef-item input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

/* Fila de resultados calculados del comparable */
.tas-result-row {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.04);
  flex-wrap: wrap;
}
.tas-result-item {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tas-result-item label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tas-result-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
}
.tas-result-highlight {
  color: var(--accent-success) !important;
  font-size: 16px;
}

/* Promedios por mercado */
.tas-promedios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.tas-promedio-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid;
}
.tas-promedio-card.oferta {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}
.tas-promedio-card.realizacion {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.25);
}
.tas-promedio-card.subasta {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}
.tas-promedio-card h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tas-promedio-values {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tas-promedio-values > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tas-promedio-values label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}
.tas-promedio-values span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Grid de fotos y mapa */
.tas-fotos-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* Área de upload de fotos */
.tas-foto-upload-area {
  margin-bottom: 14px;
}

/* Grid de previsualizaciones de fotos */
.tas-fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  min-height: 40px;
}

/* Item individual de foto */
.tas-foto-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--card-border);
  aspect-ratio: 4/3;
  background: var(--bg-tertiary);
  transition: transform 0.2s, box-shadow 0.2s;
}
.tas-foto-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}
.tas-foto-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Botón de eliminar foto */
.tas-foto-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}
.tas-foto-item:hover .tas-foto-delete {
  opacity: 1;
}

/* Layout de resultado final */
.tas-resultado-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* Header de sección de resultado */
.tas-resultado-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}
.tas-resultado-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.oferta-header { color: var(--accent-success); }
.realizacion-header { color: var(--accent-primary); }
.subasta-header { color: var(--accent-warning); }

/* Tabla de resultados */
.tas-resultado-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tas-resultado-table th {
  padding: 8px 10px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
}
.tas-resultado-table th:first-child { text-align: left; }
.tas-td-label {
  padding: 10px 10px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tas-td-value {
  padding: 10px 10px;
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tas-td-highlight {
  color: var(--accent-success) !important;
  font-size: 15px;
}

/* Texto de conclusión */
.tas-conclusion-text {
  padding: 16px 18px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}
.tas-conclusion-text p {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
  font-style: italic;
}

/* Sección de firma */
.tas-firma-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tas-legal-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
}
.tas-legal-notice p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 600;
  line-height: 1.5;
}
.tas-firma-box {
  padding: 20px;
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.15);
}
.tas-firma-area {
  text-align: center;
}
.tas-firma-area p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 30px;
  font-weight: 600;
}
.tas-firma-line {
  height: 1px;
  background: var(--card-border);
  margin: 0 auto 10px;
  width: 70%;
}
.tas-firma-area span {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Tab button activo de tasación */
.tas-tab-btn.active {
  background: var(--grad-primary) !important;
  border-color: transparent !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tas-grid,
  .tas-comparables-container,
  .tas-resultado-layout,
  .tas-fotos-layout {
    grid-template-columns: 1fr;
  }
  .tas-form-grid {
    grid-template-columns: 1fr;
  }
  .tas-coef-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Contenedor de impresión oculto y con tamaño A4 en pantalla para cálculos correctos de Leaflet */
@media screen {
  #tas-print-report-container {
    position: absolute !important;
    left: -9999px !important;
    top: 0 !important;
    width: 210mm !important;
    height: auto !important;
    z-index: -9999 !important;
    background: white !important;
    display: block !important;
  }

  #tas-print-report-container .print-map-wrapper {
    height: 250px !important;
    width: 100% !important;
  }

  #tas-print-report-container .print-map-wrapper #tas-leaflet-map {
    height: 100% !important;
    width: 100% !important;
  }
}

/* Estilos para impresión del informe */
@media print {
  @page {
    size: A4 portrait;
    margin: 0mm !important;
  }

  thead {
    display: table-header-group !important;
  }

  :root {
    --font-family: Arial, Helvetica, sans-serif !important;
  }

  /* Anular posicionamiento flex/viewport y permitir scroll completo en impresión */
  html, body {
    width: 210mm !important;
    height: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    position: static !important;
    background: white !important;
    color: black !important;
    font-family: Arial, Helvetica, sans-serif !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Ocultar toda la interfaz interactiva de la SPA */
  body > *:not(#tas-print-report-container):not(#tpl-print-container),
  .app-container,
  .sidebar,
  .main-content,
  .content-header,
  .tab-content,
  .sub-tab-pane,
  .btn,
  .tas-tab-btn,
  #toast-notification {
    display: none !important;
  }
  
  /* Mostrar únicamente el contenedor de impresión */
  #tas-print-report-container {
    display: block !important;
    visibility: visible !important;
    width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    position: static !important;
    overflow: visible !important;
    background: white !important;
  }

  #tas-print-report-container * {
    visibility: visible !important;
  }
  
  /* Formato de página A4 con márgenes compactos controlados */
  .print-page {
    page-break-after: always !important;
    break-after: page !important;
    box-sizing: border-box !important;
    padding: 12mm 15mm 12mm 15mm !important; /* Márgenes compactos profesionales */
    height: 297mm !important; /* Altura exacta para A4 */
    min-height: 297mm !important;
    max-height: 297mm !important;
    width: 210mm !important;      /* Ancho completo del papel A4 */
    max-width: 210mm !important;
    margin: 0 auto !important;
    position: relative !important;
    overflow: hidden !important; /* Cortar desbordamientos incidentales para evitar hojas extra */
    background: white !important;
  }
  
  /* Evitar saltos de página huérfanos dentro de elementos clave */
  tr, td, th, .visual-card, .market-result-box, .report-legal-notice, .report-signature-section {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Cabecera repetida en hojas subsiguientes (2+) */
  .print-page-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding-bottom: 6px !important;
    margin-bottom: 20px !important;
    font-size: 8px !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  .print-header-logo-small {
    max-height: 22px !important;
    object-fit: contain !important;
  }
  .print-header-logo-placeholder {
    font-size: 7px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
  }
  
  /* ── DISEÑO DE LA PORTADA (PÁGINA 1) ── */
  .cover-header-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 30px !important;
  }
  .cover-header-table td {
    border: 1.5px solid #22313a !important;
    padding: 12px !important;
    vertical-align: middle !important;
    text-align: center !important;
  }
  .cover-header-logo-cell {
    width: 25% !important;
  }
  .cover-logo-img {
    max-width: 100% !important;
    max-height: 80px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }
  .cover-logo-placeholder {
    font-size: 10px !important;
    color: #94a3b8 !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
  }
  .cover-header-title-cell {
    width: 50% !important;
  }
  .cover-header-title-cell h2 {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: #22313a !important;
    margin: 0 0 4px 0 !important;
    letter-spacing: 0.5px !important;
  }
  .cover-header-title-cell .subtitle {
    font-size: 9px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
  }
  .cover-header-meta-cell {
    width: 25% !important;
    font-size: 11px !important;
    color: #22313a !important;
    background-color: #f8fafc !important;
    text-transform: uppercase !important;
  }
  .cover-header-meta-cell.sub-meta {
    text-align: left !important;
    font-size: 10px !important;
    text-transform: none !important;
  }
  .cover-header-meta-cell.sub-meta div {
    margin-bottom: 2px !important;
  }
  .cover-body {
    margin-top: 20px !important;
  }
  .cover-section-title {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #22313a !important;
    border-left: 3px solid #1e293b !important;
    padding-left: 8px !important;
    margin-bottom: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  .cover-info-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 24px !important;
  }
  .cover-info-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 8px 10px !important;
    font-size: 11px !important;
    color: #334155 !important;
    text-align: left !important;
  }
  .cover-info-table td.info-label {
    width: 20% !important;
    font-weight: 700 !important;
    background-color: #f8fafc !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    font-size: 9px !important;
    letter-spacing: 0.25px !important;
  }
  .cover-info-table td.info-value {
    color: #22313a !important;
  }
  .cover-footer-notice {
    margin-top: 50px !important;
    padding: 12px !important;
    border-radius: 6px !important;
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 10px !important;
    color: #64748b !important;
    text-align: center !important;
    line-height: 1.4 !important;
  }
  
  /* ── ESTILOS DE REPORTES Y TABLAS GENERALES ── */
  .report-section-title {
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #22313a !important;
    margin: 20px 0 8px 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1.5px solid #1e293b !important;
    padding-bottom: 4px !important;
  }
  .report-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 20px !important;
  }
  .report-table th, 
  .report-table td {
    border: 1px solid #cbd5e1 !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
    text-align: left !important;
  }
  .report-table th {
    background-color: #22313a !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 9px !important;
    text-transform: uppercase !important;
  }
  .report-table td.row-label {
    font-weight: 700 !important;
    color: #334155 !important;
    background-color: #f8fafc !important;
  }
  
  /* ── VISTAS GRÁFICAS DE PÁGINA 2 ── */
  .visual-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
    margin-top: 12px !important;
  }
  .visual-card {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: white !important;
  }
  .visual-card-title {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding: 6px 10px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  .print-map-wrapper {
    height: 250px !important;
    width: 100% !important;
    background-color: #f8fafc !important;
  }
  .print-map-wrapper #tas-leaflet-map {
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
  }
  .print-sv-wrapper {
    height: 250px !important;
    width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f8fafc !important;
  }
  .print-sv-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }
  .no-visual-placeholder {
    font-size: 10px !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 20px !important;
  }
  
  /* ── TABLA DE COMPARABLES (PÁGINA 3) ── */
  .comp-table th {
    font-size: 8px !important;
    padding: 4px 6px !important;
  }
  .comp-table td {
    font-size: 8.5px !important;
    padding: 4px 6px !important;
    line-height: 1.2 !important;
  }
  .comp-table td small {
    font-size: 7.5px !important;
    color: #64748b !important;
  }
  .section-divider-row td {
    background-color: #f1f5f9 !important;
    font-weight: 800 !important;
    font-size: 8px !important;
    color: #334155 !important;
    letter-spacing: 0.5px !important;
    text-align: center !important;
    border-top: 1.5px solid #94a3b8 !important;
    border-bottom: 1.5px solid #94a3b8 !important;
  }
  .result-row td {
    background-color: #f8fafc !important;
    font-weight: 600 !important;
  }
  .result-row.highlight-row td {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
  }
  .result-row.highlight-row.secondary td {
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
    font-size: 9px !important;
  }
  .avg-table th {
    font-size: 8px !important;
    padding: 5px 6px !important;
  }
  .avg-table td {
    font-size: 8.5px !important;
    padding: 5px 6px !important;
  }
  
  /* ── DICTAMEN Y CIERRE (PÁGINA 4) ── */
  .report-conclusion-text {
    font-size: 10.5px !important;
    line-height: 1.5 !important;
    color: #334155 !important;
    margin-bottom: 15px !important;
    text-align: justify !important;
  }
  .final-results-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-bottom: 15px !important;
  }
  .market-result-box {
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    background: #f8fafc !important;
  }
  .market-result-box.preferred {
    border: 1.5px solid #16a34a !important;
    background: #f0fdf4 !important;
  }
  .market-result-box .box-title {
    padding: 4px 10px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    text-transform: uppercase !important;
  }
  .market-result-box.preferred .box-title {
    background-color: #16a34a !important;
    color: white !important;
  }
  .market-result-box .box-values {
    padding: 8px 12px !important;
  }
  .market-result-box .box-val-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 4px !important;
    font-size: 10px !important;
  }
  .market-result-box .box-val-row:last-child {
    margin-bottom: 0 !important;
  }
  .market-result-box .val-label {
    color: #475569 !important;
  }
  .market-result-box.preferred .val-label {
    color: #15803d !important;
    font-weight: 600 !important;
  }
  .market-result-box .val-num {
    font-weight: 700 !important;
    color: #22313a !important;
  }
  .market-result-box .val-num.highlight {
    font-size: 11px !important;
    color: #1e3a8a !important;
  }
  .market-result-box.preferred .val-num.highlight {
    color: #14532d !important;
    font-size: 12px !important;
  }
  .report-legal-notice {
    border: 1px solid #fed7aa !important;
    background-color: #fff7ed !important;
    color: #7c2d12 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 8.5px !important;
    line-height: 1.3 !important;
    margin-bottom: 25px !important;
  }
  .report-legal-notice p {
    margin: 3px 0 0 0 !important;
  }
  .report-signature-section {
    display: flex !important;
    justify-content: flex-end !important;
    margin-top: 15px !important;
  }
  .signature-box {
    width: 220px !important;
    text-align: center !important;
  }
  .signature-line {
    border-top: 1px solid #22313a !important;
    margin-bottom: 6px !important;
  }
  .signature-name {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #22313a !important;
  }
  .signature-title {
    font-size: 8px !important;
    color: #64748b !important;
    margin-bottom: 2px !important;
  }
  .signature-meta {
    font-size: 7.5px !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase !important;
  }
  
  /* ── ANEXO FOTOGRÁFICO (PÁGINA 5) ── */
  .photos-annex-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    margin-top: 15px !important;
  }
  .photo-annex-item {
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    background: white !important;
  }
  .photo-annex-item img {
    width: 100% !important;
    height: 110px !important;
    object-fit: cover !important;
    display: block !important;
  }
  .photo-annex-item .caption {
    font-size: 7.5px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    padding: 4px 6px !important;
    background-color: #f8fafc !important;
    text-align: center !important;
    text-transform: uppercase !important;
    border-top: 1px solid #cbd5e1 !important;
  }
}

/* ==========================================================================
   ESTILOS COMPLEMENTARIOS DE AUTOCOMPLETE Y MAPA (TASACIÓN)
   ========================================================================== */

/* Contenedor de bloque de dirección */
.tas-addr-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.tas-addr-label {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: -2px;
}

.tas-autocomplete-wrap {
  position: relative;
  width: 100%;
}

.tas-addr-input {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--card-border) !important;
  color: var(--text-primary) !important;
  padding: 10px 14px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13.5px !important;
  width: 100% !important;
  transition: var(--transition-smooth) !important;
}

.tas-addr-input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15) !important;
  outline: none;
}

/* Botón de Street View */
.tas-sv-btn {
  padding: 10px 14px !important;
  font-size: 13px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 40px !important;
}

/* Dropdown de Autocomplete Nominatim */
.tas-ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1100; /* Por encima de Leaflet (1000) */
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  max-height: 250px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  margin-top: 4px;
}

.tas-ac-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tas-ac-item:hover {
  background-color: rgba(99, 102, 241, 0.15);
  color: var(--accent-secondary);
}

.tas-ac-item:last-child {
  border-bottom: none;
}

.tas-ac-empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  font-style: italic;
}

.tas-ac-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Street View en Previsualizaciones */
.tas-sv-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(34, 49, 58, 0.85);
  color: var(--accent-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 5;
}

.tas-sv-open {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.9);
  color: white !important;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.2s, opacity 0.2s;
  z-index: 10;
  opacity: 0;
}

.tas-foto-item:hover .tas-sv-open {
  opacity: 1;
}

.tas-sv-open:hover {
  background: var(--accent-primary);
}

/* Botones de fijación de modo de mapa */
.btn.map-mode-active {
  background-color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

/* Street View Item - Ampliado al ancho completo de la tarjeta */
.tas-streetview-item {
  grid-column: 1 / -1 !important;
  aspect-ratio: 16/9 !important;
  height: 200px !important;
  width: 100% !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  margin-bottom: 8px !important;
}

/* Indicadores de Validación de Dirección en Tasación */
.tas-addr-input.is-valid,
input#tas-bien-direccion.is-valid {
  border-color: var(--accent-success) !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
  padding-right: 36px !important;
}

.tas-addr-input.is-invalid,
input#tas-bien-direccion.is-invalid {
  border-color: var(--accent-danger) !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
  padding-right: 36px !important;
}

.tas-addr-input.is-searching,
input#tas-bien-direccion.is-searching {
  border-color: var(--accent-warning) !important;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.25) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpath d='M12 6v6l4 2'%3E%3C/path%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
  padding-right: 36px !important;
  animation: tas-pulse 1.5s infinite ease-in-out !important;
}

@keyframes tas-pulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }
  100% { opacity: 0.8; }
}

.tas-autocomplete-wrap input.is-valid ~ i,
.tas-autocomplete-wrap input.is-invalid ~ i,
.tas-autocomplete-wrap input.is-searching ~ i {
  display: none !important;
}

/* Modal de Zoom para Fotos de Tasación */
.tas-foto-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 12, 22, 0.9);
  backdrop-filter: blur(10px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: tas-zoom-fade-in 0.25s ease-out;
  transition: opacity 0.25s ease-out;
}

.tas-foto-zoom-overlay.fade-out {
  opacity: 0;
}

.tas-foto-zoom-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.tas-foto-zoom-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}

.tas-foto-zoom-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(10, 12, 22, 0.65);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 24px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tas-foto-zoom-close:hover {
  background-color: var(--accent-danger);
  border-color: var(--accent-danger);
}

@keyframes tas-zoom-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   DOCUMENT TEMPLATES STYLES
   ========================================================================== */
.document-preview-box {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 40px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 15px;
  line-height: 1.8;
  box-shadow: var(--shadow-md);
  min-height: 500px;
  max-height: 600px;
  overflow-y: auto;
  box-sizing: border-box;
}

.document-preview-box h1 {
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: #22313a;
  margin-top: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 12px;
}

.document-preview-box h2 {
  font-family: var(--font-primary);
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
  margin-top: 20px;
  margin-bottom: 12px;
}

.document-preview-box p {
  margin-bottom: 16px;
}

.tpl-highlight {
  background-color: rgba(99, 102, 241, 0.1);
  border-bottom: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  font-family: var(--font-primary);
  transition: all 0.2s ease;
}

.tpl-highlight.filled {
  background-color: rgba(16, 185, 129, 0.08);
  border-bottom: 2px solid #10b981;
  color: #10b981;
}

.tpl-folder-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-sm);
}

.tpl-folder-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.1);
  background: rgba(99, 102, 241, 0.02);
}

.tpl-folder-icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tpl-folder-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.tpl-folder-info span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Reglas de impresión para exportar plantillas y recibos limpiamente a PDF */
@media print {
  body * {
    visibility: hidden !important;
  }
  #tpl-print-container, #tpl-print-container * {
    visibility: visible !important;
  }
  #tpl-print-container {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt !important;
  }
  #tpl-document-preview {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }
}

/* Animación de carga para el progreso del OCR */
.loading-dot {
  width: 8px;
  height: 8px;
  background-color: var(--text-primary);
  border-radius: 50%;
  display: inline-block;
}

@keyframes bounce {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.3;
  } 
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE STYLES (Celulares / Tablets)
   ========================================================================== */

/* Overlay oscuro para Sidebar Móvil */
.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 19, 41, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99990 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-sidebar-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Botón Hamburguesa en Header */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}

.mobile-menu-toggle:hover {
  background: var(--bg-tertiary);
}

/* Botón de cierre en el sidebar móvil */
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
}

.sidebar-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* Barra de Navegación Inferior en Celulares */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  z-index: 900;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom);
  /* Evita que un toque un poco largo en Android/Chrome se interprete como selección de texto y
     dispare el buscador contextual de Google ("Presioná para ver los resultados de la búsqueda")
     tapando los botones de abajo -- nada acá es texto para seleccionar de todos modos. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  height: 100%;
  transition: color 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.mobile-nav-item i {
  width: 20px;
  height: 20px;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
  color: var(--accent-primary);
}

/* MEDIA QUERIES PARA CELULARES Y TABLETS (<= 900px) */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .content-header {
    padding: 12px 14px;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .header-title-container {
    flex: 1;
    min-width: 0;
  }

  .header-title h2 {
    font-size: 15px;
    margin: 0;
  }

  .header-title p {
    font-size: 11px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none;
  }

  /* El scroll horizontal de .header-actions recorta también en vertical (overflow-x distinto de
     overflow-y fuerza a "auto" en ambos ejes), así que el desplegable de notificaciones quedaba
     invisible/inalcanzable al tocar la campana en mobile aunque sí se abría. Se saca de ese
     contexto de recorte fijándolo a la ventana en vez de posicionarlo relativo a la campana. */
  .notifications-dropdown {
    position: fixed !important;
    top: 64px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  #header-whatsapp-btn span:not(#header-wa-status-dot),
  #header-web-clientes-btn span,
  #btn-logout span {
    display: none;
  }

  #header-whatsapp-btn,
  #header-web-clientes-btn,
  #btn-logout {
    padding: 8px !important;
    width: 38px;
    height: 38px;
    justify-content: center;
  }

  .user-profile {
    padding: 3px 8px 3px 4px;
    max-width: 160px;
    gap: 6px;
  }

  #header-user-avatar {
    width: 28px;
    height: 28px;
  }

  #header-user-selector {
    max-width: 100px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #header-user-role {
    font-size: 8px;
    display: none;
  }

  .sidebar-close-btn {
    display: flex !important;
  }

  .mobile-menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 20 !important;
    position: relative !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    transform: translateX(-100%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease !important;
    box-shadow: 6px 0 36px rgba(0, 0, 0, 0.7) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .main-content {
    padding: 12px 14px;
    padding-bottom: 90px !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    max-width: 100vw;
  }

  .tab-content {
    padding: 12px 0 !important;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .metrics-grid,
  .stats-grid,
  .properties-grid,
  .dashboard-grid,
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .tas-grid,
  .tas-form-grid,
  .tas-coef-grid,
  .tas-comparables-container {
    grid-template-columns: 1fr !important;
  }

  .form-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .form-row > * {
    min-width: 0 !important;
    width: 100% !important;
  }

  .modal-card,
  .modal-content,
  .modal-dialog {
    width: 96% !important;
    max-width: 100% !important;
    margin: 8px auto !important;
    padding: 14px !important;
    max-height: 92vh;
    overflow-y: auto;
  }

  .modal-form {
    padding: 12px 0;
    gap: 12px;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }

  .table-responsive,
  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
  }

  .table-responsive table,
  .table-container table {
    min-width: 600px;
  }

  /* Columna de Acciones (Editar/Eliminar) siempre visible sin depender del scroll horizontal */
  #agents-crud-table td:last-child,
  #agents-crud-table th:last-child {
    position: sticky;
    right: 0;
    background: var(--bg-secondary);
    z-index: 2;
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.4);
  }

  .agenda-toolbar,
  .section-toolbar,
  .properties-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }

  .section-toolbar .btn,
  .agenda-toolbar .btn,
  .properties-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  .search-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Cabecera Móvil */
  .content-header {
    padding: 8px 10px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    height: 60px !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .header-title-container {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    gap: 6px !important;
  }

  .header-title h2 {
    font-size: 14px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100px !important;
  }

  #section-subtitle {
    display: none !important;
  }

  .header-actions {
    gap: 4px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  .user-profile {
    padding: 3px 6px !important;
    max-width: 132px !important;
    gap: 4px !important;
    display: flex !important;
    align-items: center !important;
  }

  #header-user-name {
    font-size: 9px !important;
    max-width: 84px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #header-user-role {
    display: none !important;
  }

  #header-user-selector {
    font-size: 11px !important;
    padding: 2px 4px !important;
    max-width: 90px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #btn-logout {
    padding: 5px 8px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
  }

  /* Agenda en Móvil */
  .calendar-scroll-container {
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .calendar-scroll-container > div {
    min-width: 100% !important;
    width: 100% !important;
  }

  .calendar-mobile-hint {
    display: none !important;
  }

  .event-pill {
    font-size: 10px !important;
    padding: 2px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  #agenda-agents-legend {
    font-size: 11px !important;
    padding: 8px 10px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }

  /* Adaptación Responsiva Móvil para el Módulo de Potenciales */
  #leads-section .table-responsive {
    display: none !important;
  }

  #mobile-leads-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .mobile-lead-card {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--card-border, #334155);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    width: 100%;
  }

  .mobile-lead-card.selected {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
  }

  .light-theme .mobile-lead-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 2px 10px rgba(34, 49, 58, 0.08);
  }

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

  .mobile-lead-client-info {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .mobile-lead-comms-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .mobile-comm-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
  }

  .mobile-comm-btn.wp {
    background: rgba(37, 211, 102, 0.15);
    color: #25d366;
    border: 1px solid rgba(37, 211, 102, 0.35);
  }

  .mobile-comm-btn.mail {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
  }

  .mobile-comm-btn.tel {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.35);
  }

  .mobile-lead-interest-box {
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
  }

  .light-theme .mobile-lead-interest-box {
    background: #f8fafc;
    border-color: #e2e8f0;
  }

  .mobile-lead-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
  }

  .light-theme .mobile-lead-controls-grid {
    background: #f1f5f9;
    border-color: #e2e8f0;
  }

  .mobile-control-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mobile-control-item label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .mobile-lead-actions-row {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--card-border);
  }

  .leads-subtabs {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .leads-subtabs .lead-subtab {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 14px !important;
    font-size: 12px !important;
  }

  #leads-section .properties-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  #leads-section .search-box {
    width: 100% !important;
  }

  #leads-section .filter-box {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  #leads-section .filter-box select,
  #leads-section .filter-box button {
    flex: 1 1 auto !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
    justify-content: center !important;
  }
}

/* ================= EXPORTADOR A CARTELERA FÍSICA HORIZONTAL ================= */
.flyer-photo-thumb {
  transition: all 0.2s ease;
}
.flyer-photo-thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35) !important;
}

.flyer-poster-sheet {
  transition: all 0.2s ease;
  aspect-ratio: 297 / 210;
  max-width: 100%;
}

@media (max-width: 1440px) {
  .flyer-poster-sheet {
    width: 680px !important;
    height: 480px !important;
  }
}

@media (max-width: 1200px) {
  .flyer-modal-split-body {
    grid-template-columns: 370px minmax(0, 1fr) !important;
  }
  .flyer-poster-sheet {
    width: 580px !important;
    height: 410px !important;
  }
}

@media (max-height: 800px) {
  .flyer-poster-sheet {
    width: 560px !important;
    height: 395px !important;
  }
}

@media (max-width: 960px) {
  .flyer-modal-split-body {
    grid-template-columns: 1fr !important;
    overflow-y: auto !important;
  }
  .flyer-controls-panel {
    border-right: none !important;
    border-bottom: 1px solid var(--card-border) !important;
    max-height: none !important;
    height: auto !important;
  }
  .flyer-preview-panel {
    max-height: none !important;
    padding: 16px !important;
  }
  .flyer-poster-sheet {
    width: 100% !important;
    max-width: 620px !important;
    height: auto !important;
    aspect-ratio: 297 / 210 !important;
  }
}

/* ==========================================================================
   ESTUDIO REMOVEDOR DE MARCAS DE AGUA
   ========================================================================== */
#watermark-canvas-container {
  user-select: none;
  -webkit-user-select: none;
}

#watermark-selection-box {
  border: 2px dashed #38bdf8;
  background: rgba(56, 189, 248, 0.2);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   DISEÑO PROFESIONAL DE CONTROLES DE CARTELERA FÍSICA
   ========================================================================== */
.flyer-poster-modal-card {
  max-width: 1400px !important;
  width: 96vw !important;
  height: 92vh !important;
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.flyer-modal-split-body {
  display: grid !important;
  grid-template-columns: 400px minmax(0, 1fr) !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

.flyer-controls-panel {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 16px 18px 60px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  scrollbar-width: thin !important;
  scrollbar-color: #38bdf8 rgba(34, 49, 58, 0.7) !important;
}

.flyer-controls-panel::-webkit-scrollbar {
  width: 8px !important;
}

.flyer-controls-panel::-webkit-scrollbar-track {
  background: rgba(34, 49, 58, 0.7) !important;
  border-radius: 4px !important;
}

.flyer-controls-panel::-webkit-scrollbar-thumb {
  background: #38bdf8 !important;
  border-radius: 4px !important;
}

.flyer-controls-panel::-webkit-scrollbar-thumb:hover {
  background: #0284c7 !important;
}

.flyer-preview-panel {
  height: 100% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.flyer-section-card {
  background: rgba(34, 49, 58, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease-in-out;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.flyer-section-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.flyer-section-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
  margin: 0 0 8px 0;
}

.flyer-field-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 5px;
}

/* Botones Modernos Luxury para Cartelera */
.flyer-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.flyer-btn-watermark {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.18));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.15);
}

.flyer-btn-watermark:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(99, 102, 241, 0.3));
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.flyer-btn-upload {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.18));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.flyer-btn-upload:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.3));
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.flyer-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

.flyer-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #f8fafc;
  transform: translateY(-1px);
}

.flyer-form-input,
.flyer-form-select,
.flyer-form-textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  background: #22313a !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-radius: 8px !important;
  color: #f8fafc !important;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 9px 12px !important;
  line-height: 1.4 !important;
  outline: none !important;
  transition: all 0.2s ease-in-out !important;
}

.flyer-form-textarea {
  resize: vertical !important;
  min-height: 65px !important;
  word-break: break-word !important;
  overflow-x: hidden !important;
}

.flyer-form-input:focus,
.flyer-form-select:focus,
.flyer-form-textarea:focus {
  background: #1e293b !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
  color: #ffffff !important;
}

.flyer-form-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  padding-right: 34px !important;
  cursor: pointer !important;
}

.flyer-form-select option {
  background: #22313a !important;
  color: #f8fafc !important;
  padding: 8px !important;
}

.flyer-form-input::placeholder,
.flyer-form-textarea::placeholder {
  color: #64748b !important;
  font-weight: 400 !important;
}

.flyer-price-input {
  color: #34d399 !important;
  font-weight: 800 !important;
  font-size: 0.92rem !important;
  letter-spacing: 0.3px;
}

.flyer-price-settings-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(34, 49, 58, 0.5);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 6px;
}

/* ==========================================================================
   CHIPS TILDABLES PARA BÚSQUEDA EXTERNA DE PROPIEDADES
   ========================================================================== */
.ext-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ext-chip-label {
  cursor: pointer;
  user-select: none;
  display: inline-flex;
}

.ext-chip-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.ext-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ext-chip-btn:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(16, 185, 129, 0.4);
  color: #f8fafc;
  transform: translateY(-1px);
}

.ext-chip-label input[type="checkbox"]:checked + .ext-chip-btn {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10b981;
  color: #34d399;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

/* ==========================================================================
   MÓDULO DE MARKETING & DIFUSIÓN EN PORTALES
   ========================================================================== */
.difusion-portal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.difusion-portal-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md), 0 0 16px rgba(103, 124, 93, 0.15);
}

.portal-brand-col {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 240px;
}

.portal-logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  flex-shrink: 0;
}

.portal-metrics-col {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.portal-metric-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.portal-metric-item strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.portal-metric-item span {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
}

.portal-totals-col {
  text-align: right;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-total-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.portal-total-row strong {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.portal-total-row span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dif-quality-bar-wrap {
  width: 70px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.dif-quality-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.spin-slow {
  animation: spinSlow 3s linear infinite;
}

@keyframes spinSlow {
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .difusion-portal-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .portal-metrics-col {
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
  }
  .portal-totals-col {
    text-align: left;
    width: 100%;
    border-top: 1px solid var(--card-border);
    padding-top: 10px;
  }
  .portal-total-row {
    justify-content: flex-start;
  }
  .dif-metrics-boxes-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   MÓDULO DE ESTADÍSTICAS Y ANALÍTICAS
   ========================================================================== */
.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--card-border, #334155);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.analytics-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.analytics-last-update {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
}

.analytics-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-period-selector {
  display: inline-flex;
  background: var(--bg-primary, #22313a);
  border: 1px solid var(--card-border, #334155);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.btn-period {
  background: transparent;
  border: none;
  color: var(--text-secondary, #94a3b8);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-period:hover {
  color: var(--text-primary, #ffffff);
}

.btn-period.active {
  background: #677c5d;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(103, 124, 93, 0.35);
}

/* 1. KPIs Grid */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.analytics-kpi-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--card-border, #334155);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analytics-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.kpi-blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.kpi-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }
.kpi-green { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.kpi-gold { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
  margin-bottom: 4px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--text-primary, #ffffff);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.kpi-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.badge-blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-green { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.badge-gold { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.kpi-subtext {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  display: block;
}

/* 2. Grids de Gráficos y Tarjetas */
.analytics-charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.analytics-charts-grid.secondary-grid {
  grid-template-columns: 1.2fr 1fr;
}

.analytics-card {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--card-border, #334155);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

.analytics-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary, #ffffff);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analytics-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary, #94a3b8);
  margin: 0;
}

.chart-legend-custom {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.dot-blue { background: #38bdf8; }
.dot-purple { background: #a855f7; }

/* 3. Lista de Top Sectores */
.top-sectors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  justify-content: center;
}

.sector-item-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sector-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}

.sector-item-name {
  color: var(--text-primary, #ffffff);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sector-rank-badge {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--bg-tertiary, #334155);
  color: var(--text-primary, #ffffff);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.sector-rank-badge.top-1 { background: #f59e0b; color: #000; }
.sector-rank-badge.top-2 { background: #94a3b8; color: #000; }
.sector-rank-badge.top-3 { background: #cd7f32; color: #fff; }

.sector-item-counts {
  color: var(--text-secondary, #94a3b8);
  font-size: 11.5px;
}

.sector-progress-track {
  width: 100%;
  height: 7px;
  background: var(--bg-primary, #22313a);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.sector-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #677c5d 0%, #38bdf8 100%);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 4. Embudo de Conversión (Funnel) */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.funnel-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary, #22313a);
  border: 1px solid var(--card-border, #334155);
  border-radius: 10px;
  padding: 10px 14px;
  position: relative;
  overflow: hidden;
}

.funnel-step-bg {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(103, 124, 93, 0.12);
  z-index: 0;
  transition: width 0.6s ease;
}

.funnel-step-info {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.funnel-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--card-border, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary, #ffffff);
}

.funnel-step-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
}

.funnel-step-stats {
  position: relative;
  z-index: 1;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
}

.funnel-step-count {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary, #ffffff);
}

.funnel-step-pct {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(103, 124, 93, 0.2);
  color: #677c5d;
}

/* 5. Tabla de Analíticas */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.analytics-table th {
  background: var(--bg-primary, #22313a);
  color: var(--text-secondary, #94a3b8);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--card-border, #334155);
}

.analytics-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--card-border, #334155);
  color: var(--text-primary, #ffffff);
  vertical-align: middle;
}

.analytics-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Adaptación Móvil */
@media (max-width: 900px) {
  .analytics-charts-grid,
  .analytics-charts-grid.secondary-grid {
    grid-template-columns: 1fr !important;
  }
  .analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .analytics-toolbar-right {
    justify-content: space-between;
  }
}



/* ==========================================================================
   PERFECCIONAMIENTO DE CAMPOS DE LOGIN (DARK LUXURY + ANULACIÓN AUTOFILL)
   ========================================================================== */

/* Anular fondo blanco / celeste forzado por Chrome y Android al autocompletar */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #091a14 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #34d399 !important;
  transition: background-color 5000s ease-in-out 0s !important;
  border-radius: 8px !important;
}

.field-input-box {
  display: flex !important;
  align-items: center !important;
  background: #091a14 !important;
  border: 1.5px solid rgba(103, 124, 93, 0.35) !important;
  border-radius: 14px !important;
  padding: 4px 14px !important;
  min-height: 52px !important;
  transition: all 0.25s ease !important;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5) !important;
}

.field-input-box:focus-within {
  border-color: #10b981 !important;
  background: #0d231b !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35), inset 0 2px 5px rgba(0, 0, 0, 0.5) !important;
}

.field-icon {
  width: 19px !important;
  height: 19px !important;
  color: #34d399 !important;
  flex-shrink: 0 !important;
  margin-right: 8px !important;
}

.field-input-box input {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  font-family: inherit !important;
  padding: 12px 0 !important;
  caret-color: #34d399 !important;
}

.field-input-box input::placeholder {
  color: #52637a !important;
  font-size: 13.5px !important;
}

.btn-toggle-eye {
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #94a3b8 !important;
}

.btn-toggle-eye:hover, .btn-toggle-eye:active {
  color: #34d399 !important;
}


/* Reordenamiento de Módulos de Agente */
.perm-sort-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(14, 28, 22, 0.7);
  border: 1px solid rgba(103, 124, 93, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
}

.perm-sort-item:hover {
  background: rgba(103, 124, 93, 0.15);
  border-color: rgba(103, 124, 93, 0.4);
}

.perm-sort-item.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.perm-sort-item.drag-over {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.25);
  transform: scale(1.02);
}

.perm-drag-handle {
  color: var(--text-dim, #64748b);
  cursor: grab;
  font-size: 16px;
  padding: 0 4px;
}

/* Drag & Drop en Galería de Fotos de Propiedades */
.prop-image-card {
  position: relative;
  background: var(--bg-secondary, #22313a);
  border: 1px solid var(--card-border, rgba(255,255,255,0.12));
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: grab;
  transition: all 0.2s ease;
}

.prop-image-card.is-cover {
  border: 2px solid #10b981;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

.prop-image-card:hover {
  border-color: #34d399;
  transform: translateY(-2px);
}

.prop-image-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border-style: dashed;
}

.prop-image-card.drag-over {
  border: 2px dashed #10b981 !important;
  background: rgba(16, 185, 129, 0.2) !important;
  transform: scale(1.04);
}

/* ==========================================================================
   DOCUMENTOS Y CONTRATOS DE VENTA - ESTILOS MODO CLARO Y OSCURO
   ========================================================================== */
.prop-sale-docs-container {
  background: var(--bg-tertiary) !important;
  border: 1.5px solid var(--accent-primary, #677c5d) !important;
  color: var(--text-primary) !important;
}

.light-theme .prop-sale-docs-container {
  background: #f8fafc !important;
  border-color: #677c5d !important;
  box-shadow: 0 4px 16px rgba(103, 124, 93, 0.08) !important;
}

.light-theme #prop-sale-doc-category {
  background: #ffffff !important;
  color: #22313a !important;
  border-color: #cbd5e1 !important;
}

.light-theme #prop-sale-backup-folder-preview {
  color: #047857 !important;
  background: rgba(16, 185, 129, 0.12) !important;
}

/* Modal de Configuración de Portales y Difusión */
#portal-config-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(3, 7, 18, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 100050 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

#portal-config-modal.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Cartelera: las tarjetas del panel izquierdo NO deben encogerse (antes se aplastaban y cortaban
   campos en pantallas bajas); el panel hace scroll en su lugar. */
.flyer-controls-panel > * {
  flex-shrink: 0 !important;
}
.flyer-controls-panel .flyer-section-card {
  overflow: visible !important;
  padding: 16px !important;
}
.flyer-controls-panel .flyer-form-textarea {
  min-height: 150px !important;
  font-size: 0.88rem !important;
  line-height: 1.5 !important;
}
#flyer-photo-selector {
  max-height: 170px !important;
  min-height: 70px !important;
}

/* ==========================================================================
   CONSOLA DE WHATSAPP EN EL CELULAR (estilo WhatsApp: lista o conversacion)
   ========================================================================== */
/* El boton de volver solo tiene sentido en el celular, donde una vista tapa a la otra. */
.wa-console-back {
  display: none;
  width: 34px;
  height: 34px;
  min-width: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
}
.wa-console-thread-title { flex: 1; min-width: 0; }
.wa-console-thread-title #wa-console-thread-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reloj de la ventana de 24hs de Meta (cuánto queda para responder gratis con texto libre) */
.wa-window-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.wa-window-timer.is-closing { color: #f59e0b; }
.wa-window-timer.is-closed { color: #ef4444; }

/* Cuadro de escribir de la consola, con barra de herramientas estilo WATI */
.wa-composer {
  position: relative;
  padding: 10px 16px 8px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-composer-toolbar { display: flex; gap: 4px; align-items: center; }
.wa-composer-closed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.35;
}
.wa-tpl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.wa-tpl-icon-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.wa-tpl-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 6px);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid #22c55e;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 20;
}
.wa-tpl-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: 13.5px;
  color: var(--text-primary);
}
.wa-tpl-panel-head input {
  flex: 1;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}
.wa-tpl-panel-body { overflow-y: auto; min-height: 0; }
.wa-tpl-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}
.wa-tpl-item:hover:not(:disabled) { background: rgba(34, 197, 94, 0.1); }
.wa-tpl-item:disabled { cursor: not-allowed; opacity: 0.55; }
.wa-tpl-item-name { font-weight: 800; font-size: 13px; }
.wa-tpl-item-text { font-size: 12.5px; color: var(--text-secondary, var(--text-muted)); margin-top: 3px; white-space: pre-line; }
.wa-tpl-item-note { font-size: 11px; color: #f59e0b; margin-top: 3px; }
.wa-tpl-empty { padding: 18px 14px; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.wa-tpl-fill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 12px 14px; }
.wa-tpl-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.wa-tpl-field { margin-bottom: 10px; }
.wa-tpl-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}
.wa-tpl-preview {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.12);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
  color: var(--text-primary);
}
.wa-tpl-preview .wa-tpl-missing { color: #ef4444; font-weight: 700; }
.wa-tpl-preview-footer { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.wa-tpl-preview-btn { margin-top: 8px; text-align: center; font-size: 12.5px; font-weight: 700; color: #3b82f6; border-top: 1px solid var(--card-border); padding-top: 6px; }

/* Cuadro de escribir de varias líneas (crece solo hasta ~6 renglones) */
.wa-console-textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
}
.wa-toolbar-sep { width: 1px; height: 18px; background: var(--card-border); margin: 0 4px; }
.wa-tpl-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.wa-link-btn { background: none; border: none; padding: 0 0 0 8px; color: #22c55e; font-size: 11.5px; font-weight: 700; cursor: pointer; text-transform: none; }
.wa-new-tpl-btn {
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #22c55e;
  background: transparent;
  color: #22c55e;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.wa-tpl-label-row { display: flex; justify-content: space-between; align-items: center; }
.wa-tpl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wa-tpl-field select,
.wa-tpl-field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.wa-tpl-field textarea { resize: vertical; }
.wa-tpl-btn-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.wa-tpl-btn-row input { flex: 1; min-width: 0; }
.wa-tpl-status { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.wa-tpl-status.pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.wa-tpl-status.rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.wa-tpl-section { padding: 8px 14px 4px; font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }

/* Emojis */
.wa-emoji-panel { right: auto; width: 330px; max-width: calc(100% - 24px); }
.wa-emoji-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 8px; overflow-y: auto; max-height: 240px; }
.wa-emoji-grid button { border: none; background: transparent; font-size: 20px; line-height: 1; padding: 5px 0; border-radius: 6px; cursor: pointer; }
.wa-emoji-grid button:hover { background: var(--bg-tertiary); }

/* Selector de asesor en la cabecera de la charla */
.wa-agent-select {
  margin-left: 4px;
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  max-width: 150px;
}

/* Panel de datos del contacto (se superpone a la derecha del hilo) */
.wa-contact-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  max-width: 100%;
  flex-direction: column;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
  z-index: 25;
}
/* En la computadora el panel corre el chat (no lo tapa), como en WATI. */
.wa-console-pane-thread.wa-contact-open #wa-console-thread { margin-right: 300px; }
.wa-contact-body { overflow-y: auto; padding: 12px 14px; font-size: 12.5px; color: var(--text-primary); }
.wa-contact-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--card-border); }
.wa-contact-row span:first-child { color: var(--text-muted); }
.wa-contact-row span:last-child { word-break: break-word; }
.wa-contact-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wa-contact-tag { padding: 2px 8px; border-radius: 10px; background: var(--bg-tertiary); font-size: 11.5px; }
.wa-contact-prop { padding: 6px 0; border-bottom: 1px dashed var(--card-border); }

@media (max-width: 860px) {
  .wa-console-shell {
    grid-template-columns: 1fr !important;
    /* Barra superior + navegacion inferior del celular: si no se descuentan, el cuadro de escribir
       queda tapado por la botonera y no se puede responder. */
    height: calc(100vh - 210px) !important;
    min-height: 420px !important;
    border-radius: 12px !important;
  }
  .wa-console-shell > .wa-console-pane-list,
  .wa-console-shell > .wa-console-pane-thread {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .wa-console-pane-list { border-right: none !important; }

  /* Por defecto se ve la LISTA; al abrir una conversacion la seccion toma .wa-mobile-thread y se
     muestra el hilo a pantalla completa, como en WhatsApp. */
  .wa-console-pane-thread { display: none !important; }
  #whatsapp-console-section.wa-mobile-thread .wa-console-pane-list { display: none !important; }
  #whatsapp-console-section.wa-mobile-thread .wa-console-pane-thread { display: flex !important; }

  .wa-console-back { display: inline-flex; }
  /* Cabecera en UNA linea, como WhatsApp: flecha + nombre + accion. Sin esto el boton de tomar la
     conversacion la parte en tres renglones y se come media pantalla del telefono. */
  .wa-console-thread-head {
    padding: 8px 10px !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .wa-console-thread-head #wa-console-thread-phone,
  .wa-console-thread-head #wa-console-thread-agent { font-size: 11px; }
  .wa-console-thread-title > div:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* El boton queda como icono solo: el texto no entra al lado del nombre del contacto. */
  #wa-console-bot-toggle {
    padding: 8px !important;
    min-width: 36px;
    justify-content: center;
  }
  #wa-console-bot-toggle-label { display: none; }
  #wa-console-messages { padding: 12px 10px !important; }
  .wa-tpl-fill-grid { grid-template-columns: 1fr; }
  /* En el telefono el panel va dentro del cuadro de escribir (achica los mensajes) en vez de flotar:
     flotando se salia por arriba de la pantalla. */
  .wa-tpl-panel { position: static; max-height: 50vh; }
  .wa-composer-closed { flex-direction: column; align-items: stretch; }
  .wa-tpl-row { grid-template-columns: 1fr; }
  .wa-emoji-panel { width: auto; }
  .wa-contact-panel { width: 100%; }
  .wa-console-pane-thread.wa-contact-open #wa-console-thread { margin-right: 0; }
  .wa-agent-select { max-width: 110px; }
  /* Las burbujas angostas de escritorio (65%) dejan demasiado aire en un telefono */
  #wa-console-messages > div > div { max-width: 85% !important; }
}

/* ==========================================================================
   BOTONERA DEL LIBRO DE PRODUCCION
   ========================================================================== */
.pb-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pb-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.pb-btn i,
.pb-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.pb-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.pb-btn:active { transform: translateY(0); }
.pb-btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.pb-btn-primary:hover {
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.42);
}
.pb-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 700px) {
  .pb-toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .pb-btn { justify-content: center; padding: 11px 10px; }
  .pb-btn-primary { grid-column: 1 / -1; }
}

/* ==========================================================================
   CONSOLA DE WHATSAPP: ESTETICA ESTILO WHATSAPP (lista + chat)
   ==========================================================================
   Solo apariencia: no cambia como se cargan ni se mandan los mensajes. */

/* ---- Lista de conversaciones (panel izquierdo) ---- */
.wa-row {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--card-border);
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease;
}
.wa-row:hover { background: rgba(255, 255, 255, 0.04); }
.wa-row.active { background: rgba(103, 124, 93, 0.14); }

.wa-row-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #677c5d, #0a8a6d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.wa-row-body { min-width: 0; flex: 1; }
.wa-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.wa-row-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Fecha/hora del ultimo contacto, alineada a la derecha como en WhatsApp */
.wa-row-stamp {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.wa-row-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.wa-row-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 6px;
}
.wa-row-tag.bot {
  background: rgba(103, 124, 93, 0.16);
  color: #34d399;
  border: 1px solid rgba(103, 124, 93, 0.32);
}
.wa-row-tag.paused {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

/* ---- Fondo empapelado del chat ---- */
#wa-console-messages {
  background-color: #0b141a !important;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%20viewBox='0%200%20120%20120'%3E%3Cg%20fill='none'%20stroke='%23ffffff'%20stroke-opacity='0.075'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10%2018c3-5%209-5%2012%200'/%3E%3Ccircle%20cx='34'%20cy='12'%20r='5'/%3E%3Cpath%20d='M52%208v10M47%2013h10'/%3E%3Crect%20x='68'%20y='6'%20width='12'%20height='12'%20rx='3'/%3E%3Cpath%20d='M92%2018l5-9%205%209z'/%3E%3Cpath%20d='M108%208c4%202%204%208%200%2010'/%3E%3Cpath%20d='M6%2040h12M12%2034v12'/%3E%3Cpath%20d='M28%2046c0-6%205-10%2010-7s3%209-2%2011-8-1-8-4z'/%3E%3Ccircle%20cx='58'%20cy='42'%20r='6'/%3E%3Cpath%20d='M76%2036l8%208-8%208'/%3E%3Cpath%20d='M98%2038h14l-3%2010H101z'/%3E%3Cpath%20d='M8%2068c5-6%2012-6%2017%200'/%3E%3Crect%20x='36'%20y='62'%20width='14'%20height='10'%20rx='2'/%3E%3Cpath%20d='M62%2076V62l10%207z'/%3E%3Ccircle%20cx='90'%20cy='68'%20r='4'/%3E%3Cpath%20d='M104%2062v14M98%2069h12'/%3E%3Cpath%20d='M14%2096l6-8%206%208z'/%3E%3Cpath%20d='M36%2092h16M44%2086v12'/%3E%3Ccircle%20cx='66'%20cy='96'%20r='5'/%3E%3Cpath%20d='M82%2090c6%200%209%204%209%207s-5%205-9%203-4-10%200-10z'/%3E%3Cpath%20d='M104%2090l8%206-8%206'/%3E%3Cpath%20d='M20%20112h14M52%20108v8M78%20112h10'/%3E%3C/g%3E%3C/svg%3E") !important;
  background-repeat: repeat !important;
  gap: 4px !important;
}
/* Las charlas cortas quedan pegadas ABAJO, como en WhatsApp, en vez de flotando arriba con un hueco
   enorme debajo. Se usa margin-top:auto en el primer elemento (y no justify-content:flex-end) porque
   con este ultimo algunos navegadores recortan el principio del historial al scrollear. */
#wa-console-messages > *:first-child { margin-top: auto; }
.light-theme #wa-console-messages {
  background-color: #efe7dd !important;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='120'%20height='120'%20viewBox='0%200%20120%20120'%3E%3Cg%20fill='none'%20stroke='%230a0a0a'%20stroke-opacity='0.075'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10%2018c3-5%209-5%2012%200'/%3E%3Ccircle%20cx='34'%20cy='12'%20r='5'/%3E%3Cpath%20d='M52%208v10M47%2013h10'/%3E%3Crect%20x='68'%20y='6'%20width='12'%20height='12'%20rx='3'/%3E%3Cpath%20d='M92%2018l5-9%205%209z'/%3E%3Cpath%20d='M108%208c4%202%204%208%200%2010'/%3E%3Cpath%20d='M6%2040h12M12%2034v12'/%3E%3Cpath%20d='M28%2046c0-6%205-10%2010-7s3%209-2%2011-8-1-8-4z'/%3E%3Ccircle%20cx='58'%20cy='42'%20r='6'/%3E%3Cpath%20d='M76%2036l8%208-8%208'/%3E%3Cpath%20d='M98%2038h14l-3%2010H101z'/%3E%3Cpath%20d='M8%2068c5-6%2012-6%2017%200'/%3E%3Crect%20x='36'%20y='62'%20width='14'%20height='10'%20rx='2'/%3E%3Cpath%20d='M62%2076V62l10%207z'/%3E%3Ccircle%20cx='90'%20cy='68'%20r='4'/%3E%3Cpath%20d='M104%2062v14M98%2069h12'/%3E%3Cpath%20d='M14%2096l6-8%206%208z'/%3E%3Cpath%20d='M36%2092h16M44%2086v12'/%3E%3Ccircle%20cx='66'%20cy='96'%20r='5'/%3E%3Cpath%20d='M82%2090c6%200%209%204%209%207s-5%205-9%203-4-10%200-10z'/%3E%3Cpath%20d='M104%2090l8%206-8%206'/%3E%3Cpath%20d='M20%20112h14M52%20108v8M78%20112h10'/%3E%3C/g%3E%3C/svg%3E") !important;
}

/* ---- Separador de dia ---- */
.wa-day {
  text-align: center;
  margin: 12px 0 6px;
}
.wa-day span {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: #d5dbdf;
  background: rgba(31, 44, 52, 0.92);
  padding: 4px 11px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}
.light-theme .wa-day span {
  color: #54656f;
  background: #ffffff;
}

/* ---- Burbujas ---- */
.wa-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 1px 0;
}
.wa-msg.out { align-items: flex-end; }
.wa-msg-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  margin: 4px 4px 2px;
}
.wa-bubble {
  position: relative;
  max-width: 65%;
  padding: 6px 9px 8px 10px;
  border-radius: 8px;
  font-size: 13.2px;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.16);
}
.wa-msg.in .wa-bubble {
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 0;
}
.wa-msg.out .wa-bubble {
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 0;
}
.light-theme .wa-msg.in .wa-bubble { background: #ffffff; color: #111b21; }
.light-theme .wa-msg.out .wa-bubble { background: #d9fdd3; color: #111b21; }

/* Puntita de la burbuja, como en WhatsApp */
.wa-bubble::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}
.wa-msg.in .wa-bubble::after {
  left: -8px;
  border-top-color: #202c33;
  border-right-color: #202c33;
  border-left-width: 0;
}
.wa-msg.out .wa-bubble::after {
  right: -8px;
  border-top-color: #005c4b;
  border-left-color: #005c4b;
  border-right-width: 0;
}
.light-theme .wa-msg.in .wa-bubble::after {
  border-top-color: #ffffff;
  border-right-color: #ffffff;
}
.light-theme .wa-msg.out .wa-bubble::after {
  border-top-color: #d9fdd3;
  border-left-color: #d9fdd3;
}

/* Hora + tilde, abajo a la derecha dentro de la burbuja */
.wa-bubble-meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  line-height: 1;
  margin: 6px -3px -2px 8px;
  color: rgba(233, 237, 239, 0.62);
  user-select: none;
}
.light-theme .wa-bubble-meta { color: rgba(17, 27, 33, 0.48); }
.wa-check {
  width: 14px;
  height: 10px;
  fill: #53bdeb;
  flex-shrink: 0;
}

/* ---- Cuadro de escribir ---- */
#wa-console-input {
  border-radius: 22px !important;
  padding: 10px 16px !important;
}

/* ==========================================================================
   BOTONES DE LAS TARJETAS DE PROPIEDADES EN MODO CLARO
   ==========================================================================
   En modo claro, la regla general de .btn-secondary fuerza fondo blanco, borde gris y texto oscuro
   con !important, asi que los botones de las tarjetas (Interna, Web, Imprimir, Cartelera, Word,
   Planilla, MercadoLibre, Facebook, Marketplace...) perdian su color y quedaban todos iguales.
   Aca se les devuelve el MISMO color que tienen en modo oscuro, en un tono mas oscuro para que se
   lea bien sobre blanco. Se apunta a cada boton por el color que trae en linea, que es lo que los
   distingue (ver renderProperties en app.js). */

.light-theme .property-card .btn-secondary[style*="#34d399"],
.light-theme .property-card-horizontal .btn-secondary[style*="#34d399"] {
  color: #047857 !important;
  background: rgba(16, 185, 129, 0.10) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}
.light-theme .property-card .btn-secondary[style*="#677c5d"],
.light-theme .property-card-horizontal .btn-secondary[style*="#677c5d"] {
  color: #0f766e !important;
  background: rgba(13, 148, 136, 0.10) !important;
  border: 1px solid rgba(13, 148, 136, 0.35) !important;
}
.light-theme .property-card .btn-secondary[style*="#fde68a"],
.light-theme .property-card-horizontal .btn-secondary[style*="#fde68a"],
.light-theme .property-card .btn-secondary[style*="#fbbf24"],
.light-theme .property-card-horizontal .btn-secondary[style*="#fbbf24"] {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.40) !important;
}
.light-theme .property-card .btn-secondary[style*="#38bdf8"],
.light-theme .property-card-horizontal .btn-secondary[style*="#38bdf8"] {
  color: #0369a1 !important;
  background: rgba(2, 132, 199, 0.10) !important;
  border: 1px solid rgba(2, 132, 199, 0.35) !important;
}
.light-theme .property-card .btn-secondary[style*="#93c5fd"],
.light-theme .property-card-horizontal .btn-secondary[style*="#93c5fd"],
.light-theme .property-card .btn-secondary[style*="#60a5fa"],
.light-theme .property-card-horizontal .btn-secondary[style*="#60a5fa"] {
  color: #1d4ed8 !important;
  background: rgba(37, 99, 235, 0.10) !important;
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}
.light-theme .property-card .btn-secondary[style*="#f9a8d4"],
.light-theme .property-card-horizontal .btn-secondary[style*="#f9a8d4"] {
  color: #be185d !important;
  background: rgba(219, 39, 119, 0.10) !important;
  border: 1px solid rgba(219, 39, 119, 0.35) !important;
}
.light-theme .property-card .btn-secondary[style*="#a78bfa"],
.light-theme .property-card-horizontal .btn-secondary[style*="#a78bfa"] {
  color: #6d28d9 !important;
  background: rgba(124, 58, 237, 0.10) !important;
  border: 1px solid rgba(124, 58, 237, 0.35) !important;
}

/* Al pasar el mouse, el mismo color un poco mas marcado (y no el gris generico del modo claro) */
.light-theme .property-card .btn-secondary[style*="#"]:hover,
.light-theme .property-card-horizontal .btn-secondary[style*="#"]:hover {
  filter: brightness(0.94);
}

/* ==========================================================================
   FILTROS DEL LIBRO DE PRODUCCION
   ==========================================================================
   Antes usaban la clase .form-control, que no existe en ninguna hoja de estilos: quedaban con el
   aspecto por defecto del navegador (caja blanca con texto negro), que desentonaba con el panel. */
.pb-campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.pb-campo > span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 2px;
}
.pb-campo-ancho {
  grid-column: span 2;
}

.pb-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pb-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}
.pb-input:hover {
  border-color: rgba(148, 163, 184, 0.55);
}
.pb-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

/* Flecha propia para los desplegables (la del navegador no se puede pintar) */
select.pb-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
/* Las opciones abiertas las pinta el sistema: se fuerzan para que no queden blancas en modo oscuro */
select.pb-input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* El selector de fecha: el iconito del calendario viene negro y se pierde sobre fondo oscuro */
input.pb-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}
.light-theme input.pb-input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

.light-theme .pb-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #22313a;
}
.light-theme .pb-input:hover { border-color: #94a3b8; }

@media (max-width: 700px) {
  .pb-campo-ancho { grid-column: 1 / -1; }
}

/* Etiqueta con el asesor a cargo en cada conversación de la consola de WhatsApp.
   El color sale del nombre (ver waColorDeAsesor en app.js): cada asesor tiene siempre el mismo. */
.wa-row-etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  align-items: center;
}
.wa-row-etiquetas .wa-row-tag { margin-top: 0; }
.wa-row-asesor {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   ALTA DE PROPIEDAD: NUEVA O REINGRESO
   ========================================================================== */
.alta-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alta-opcion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.alta-opcion:hover { border-color: var(--accent-primary, #10b981); }
.alta-opcion strong { font-size: 14px; }
.alta-opcion span { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.alta-resultado { padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.alta-resultado.ok { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.35); }
.alta-resultado.error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.35); color: var(--text-primary); }
.alta-resultado .alta-codigo { font-size: 18px; font-weight: 800; color: #818cf8; }
.alta-resultado .alta-aviso { margin-top: 8px; color: #f59e0b; font-weight: 600; }
.prop-reingreso-aviso {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(129, 140, 248, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.4);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}
.prop-reingreso-aviso.solo-libro { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.45); }
@media (max-width: 600px) {
  .alta-opciones { grid-template-columns: 1fr; }
}
#alta-reingreso-codigo {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Contrato de alquiler: filas de locatarios / locadores / garantes en 2 columnas en pantallas chicas */
@media (max-width: 700px) {
  .contract-party-row { grid-template-columns: 1fr 1fr !important; }
}

/* Detalle del contrato: las pestañas no se aprietan (se desplazan si no entran) */
#modal-contract-detail .tab-button { flex: 0 0 auto !important; padding: 12px 16px !important; display: inline-flex !important; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; margin: 0 !important; position: static !important; }
