@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* === Colores de Marca corporativa === */
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50:  #eff6ff;

    /* === Tonos Neutros === */
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50:  #f8fafc;

    /* === Colores Semánticos (Alertas y Estados) === */
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-100: #dcfce7;
    --green-50:  #f0fdf4;
    --orange-600: #ea580c;
    --orange-500: #f97316;
    --orange-100: #ffedd5;
    --orange-50:  #fff7ed;
    --red-600: #dc2626;
    --red-500: #ef4444;
    --red-100: #fee2e2;
    --red-50:  #fef2f2;
    --amber-500: #f59e0b;
    --violet-600: #7c3aed;

    /* === Geometría (Radios de los bordes) === */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* === Sombras (estilo de diseño claro) === */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, 0.10), 0 6px 12px -6px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 24px 50px -12px rgba(15, 23, 42, 0.18);

    --ring: 0 0 0 4px rgba(37, 99, 235, 0.12);

    --sidebar-w: 248px;
}

/* ---------- REINICIO (RESET) ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* MEJORA RESPONSIVE: width 100% y ocultar overflow horizontal general */
html, body { margin: 0; padding: 0; width: 100%; overflow-x: hidden; }

/* =========================================================
   ANIMACIONES
========================================================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--slate-50);
    color: var(--slate-900);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.015em;
    margin-top: 0;
}

a { color: var(--blue-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--blue-700); }

img { max-width: 100%; display: block; height: auto; }

/* Modos del contenedor principal (Body) */
.body-panel {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--slate-50);
}
.body-form-centrado {
    padding: clamp(20px, 5vw, 64px) clamp(16px, 4vw, 20px);
    background: var(--slate-50);
    min-height: 100vh;
}

/* =========================================================
   1. LOGIN — SPLIT SCREEN MODERNO (MOCKUP)
========================================================= */
.body-split-screen { 
    margin: 0; 
    display: flex; 
    height: 100vh; 
    font-family: 'Inter', sans-serif; 
    overflow: hidden; 
    background-color: white;
}

/* AQUÍ SE APLICÓ EL AJUSTE PARA ENCUADRAR EL TÍTULO ARRIBA */
.promo-panel {
    width: 55%; position: relative; overflow: hidden;
    background: linear-gradient(rgba(255,255,255,.78), rgba(255,255,255,.78)), url("../img/portada.jpg");
    background-size: cover; background-position: center;
    padding: clamp(40px, 8vw, 90px) clamp(30px, 8vw, 70px) clamp(40px, 8vw, 70px) clamp(30px, 8vw, 70px);
    display: flex; flex-direction: column;
    justify-content: flex-start;
}

/* MEJORA RESPONSIVE: Textos adaptables con clamp() */
.login-hero-title { font-size: clamp(1.5rem, 5vw, 4rem); line-height: 1.05; font-weight: 800; color: #0f172a; margin-bottom: clamp(15px, 3vw, 25px); }
.login-hero-text { font-size: clamp(0.85rem, 2vw, 1.45rem); color: #64748b; line-height: 1.6; }

/* Tarjetas flotantes */
.login-stats-wrapper { position: absolute; inset: 0; pointer-events: none; }
.login-stat-card { position: absolute; background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-radius: 20px; padding: 20px; box-shadow: 0 15px 40px rgba(0,0,0,.08); }

/* AQUÍ SE APLICARON LOS NUEVOS MÁRGENES PARA LAS TARJETAS */
.stat-polizas { top: clamp(40px, 8vw, 90px); right: clamp(20px, 4vw, 70px); width: clamp(200px, 80vw, 250px); }
.stat-renov { left: clamp(20px, 4vw, 70px); bottom: clamp(80px, 12vw, 170px); width: clamp(180px, 75vw, 220px); }
.stat-prod { left: auto; right: clamp(20px, 4vw, 70px); bottom: clamp(80px, 12vw, 170px); width: clamp(200px, 80vw, 250px); }

/* =========================================================
   ESTILOS DE LOS GRÁFICOS (TARJETAS FLOTANTES)
========================================================= */

.promo-panel .login-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.promo-panel .login-stat-label {
    font-size: 0.75rem;
    color: var(--slate-500);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: block;
}

/* 1. Tarjeta Pólizas Activas (Línea) */
.promo-panel .stat-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}
.promo-panel .login-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1;
}
.promo-panel .login-stat-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--green-600);
    margin-bottom: 4px;
}
.promo-panel .mini-line-chart {
    width: 100%;
    height: 35px;
    margin-top: 15px;
}

/* 2. Tarjeta Renovaciones (Donut Circular) */
.promo-panel .stat-renov {
    align-items: center;
    text-align: center;
}
.promo-panel .donut-chart-container {
    width: 110px;
    height: 110px;
    margin: 10px auto 15px;
}
.promo-panel .donut-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.promo-panel .donut-inner-text {
    width: 86px;
    height: 86px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--slate-900);
}
.promo-panel .renov-footer-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.promo-panel .renov-footer-text .light-text {
    font-size: 0.75rem;
    color: var(--slate-500);
}
.promo-panel .renov-footer-text .blue-text {
    font-size: 0.85rem;
    color: var(--blue-600);
    font-weight: 700;
}

/* 3. Tarjeta Producción Mensual (Barras) */
.promo-panel .login-stat-number-blue {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--blue-600);
    line-height: 1;
}
.promo-panel .mini-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 45px;
    margin: 15px 0 10px;
}
.promo-panel .mini-bar-chart .bar {
    flex: 1;
    background: var(--blue-100);
    border-radius: 3px 3px 0 0;
    transition: height 0.5s ease;
}
.promo-panel .mini-bar-chart .bar.active {
    background: var(--blue-600);
}
.promo-panel .prod-footer-text {
    font-size: 0.75rem;
    color: var(--slate-400);
    display: block;
}

.login-panel { width: 45%; background: var(--slate-50); display: flex; align-items: center; justify-content: center; padding: 40px; }
/* MEJORA RESPONSIVE: Padding adaptable en caja central */
.contenedor-login { width: 100%; max-width: 440px; background: #fff; border-radius: 28px; padding: clamp(30px, 5vw, 50px); box-shadow: 0 20px 60px rgba(15,23,42,.08); }

.login-brand { display: flex; align-items: center; gap: 18px; margin-bottom: 40px; }
.logo-mark { width: 60px; height: 60px; background: var(--blue-600); color: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.5rem; }
.logo-name { font-size: 1.8rem; font-weight: 800; }

.input-wrapper { position: relative; margin-bottom: 20px; }
.input-wrapper input[type="email"],
.input-wrapper input[type="password"],
.input-wrapper input[type="text"] { 
    width: 100%; 
    height: 55px; 
    border: 1px solid var(--slate-200); 
    border-radius: 12px; 
    padding-left: 48px;  
    padding-right: 48px; 
}
.input-wrapper input:focus { border-color: var(--blue-600); box-shadow: var(--ring); outline: none; }
.input-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--slate-400); }

.btn-login { width: 100%; height: 55px; background: var(--blue-600); color: white; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.btn-login:hover { background: var(--blue-700); }

/* =========================================================
   ESTILOS DEL FOOTER DE SEGURIDAD (PANEL IZQUIERDO)
========================================================= */
.promo-panel .login-hero-footer {
    position: absolute;
    bottom: clamp(20px, 5vw, 40px);
    left: clamp(20px, 5vw, 70px);
    right: clamp(20px, 5vw, 70px);
    display: flex;
    gap: clamp(10px, 3vw, 20px);
    z-index: 10;
}

.promo-panel .footer-item {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 16px 20px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.footer-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--green-50);
    color: var(--green-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.footer-icon.blue {
    background: var(--blue-50);
    color: var(--blue-600);
}

.footer-item strong {
    display: block;
    color: var(--slate-900);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 3px;
}

.footer-item small {
    display: block;
    color: var(--slate-500);
    font-size: 0.8rem;
    line-height: 1.4;
}

.footer-badge-active {
    background: var(--green-100);
    color: var(--green-700);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    display: inline-block;
    margin-top: 6px;
    border: 1px solid var(--green-200);
}

/* =========================================================
   2. MENÚ LATERAL (SIDEBAR)
========================================================= */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    flex-shrink: 0;
    background: #ffffff !important;
    color: var(--slate-700);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--slate-200);
    box-shadow: none;
    z-index: 1000; /* Z-index subido para móviles */
}

.sidebar-header {
    padding: 16px 16px;
    font-size: 1.05em !important;
    font-weight: 800;
    color: var(--slate-900) !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--slate-100);
    letter-spacing: -0.02em;
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    min-height: auto;
}

.logo-mark {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 2px solid var(--blue-600);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-600);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.05em;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.logo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    flex: 1;
}

.logo-name {
    font-size: 0.95em;
    font-weight: 700;
    color: var(--slate-900);
    display: block;
    letter-spacing: -0.01em;
}

.logo-sub {
    font-size: 0.65em;
    font-weight: 500;
    color: var(--slate-500);
    display: block;
    letter-spacing: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 10px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    padding: 10px 12px;
    cursor: pointer;
    border-left: none !important;
    border-radius: var(--radius-sm);
    transition: all .15s ease;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--slate-600);
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px;
    margin-bottom: 2px;
    line-height: 1;
}

.sidebar-menu li:hover {
    background: var(--slate-100);
    color: var(--slate-900);
}

.sidebar-menu li.active {
    background: var(--blue-50) !important;
    color: var(--blue-700) !important;
    font-weight: 600;
}

.sidebar-menu li .badge,
.sidebar-menu li .badge-count,
.sidebar-menu li > span {
    margin-left: auto;
}

.sidebar-menu li i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15em;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-menu li:hover i {
    opacity: 1;
    transform: scale(1.05);
}

.sidebar-footer {
    padding: 14px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--slate-100);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-seguridad,
.card-ayuda {
    background: var(--slate-50);
    border: 1px solid var(--slate-100);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8em;
}

.card-seguridad-icon,
.card-ayuda-icon {
    font-size: 1.3em;
}

.card-seguridad h4,
.card-ayuda h4 {
    margin: 0;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--slate-900);
}

.card-seguridad p,
.card-ayuda p {
    margin: 0;
    color: var(--slate-600);
    font-size: 0.75em;
    line-height: 1.3;
}

.card-seguridad a,
.card-ayuda a {
    color: var(--blue-600);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8em;
    transition: color .15s;
    display: inline;
}

.card-seguridad a:hover,
.card-ayuda a:hover {
    color: var(--blue-700);
    text-decoration: underline;
}

/* === AÑADIDO: BOTÓN MODO ADMINISTRADOR AZUL === */
.btn-admin-blue {
    background: var(--blue-100) !important;
    color: var(--blue-700) !important;
    margin-bottom: 8px;
}
.btn-admin-blue:hover {
    background: var(--blue-200) !important;
    color: var(--blue-800) !important;
}

.sidebar-footer a.btn-logout,
.btn-logout {
    background: var(--slate-100);
    color: var(--slate-700) !important;
    text-decoration: none !important;
    font-size: 0.85em;
    font-weight: 600;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all .15s;
    text-align: center;
    display: block;
}
.sidebar-footer a.btn-logout:hover,
.btn-logout:hover {
    background: var(--slate-200);
    color: var(--slate-900) !important;
}

/* =========================================================
   3. CONTENIDO PRINCIPAL Y BARRA SUPERIOR (TOPBAR)
========================================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--slate-50);
}

.topbar {
    background: #ffffff;
    padding: 14px 28px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
    box-shadow: none;
    min-height: 72px;
    gap: 16px;
}

.topbar h1,
.topbar-title-mobile {
    margin: 0;
    font-size: 1.15em;
    color: var(--slate-900);
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    flex: 0 0 280px;
}

.topbar-search input {
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.9em;
    color: var(--slate-700);
    font-family: inherit;
}

.topbar-search input::placeholder {
    color: var(--slate-400);
}

.topbar-search kbd {
    background: var(--slate-100);
    color: var(--slate-500);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--slate-200);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn-agenda,
.topbar-btn-notif {
    background: var(--slate-100);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all .15s;
    position: relative;
}

.topbar-btn-agenda:hover,
.topbar-btn-notif:hover {
    background: var(--slate-200);
}

.topbar-btn-notif[data-count]::after {
    content: attr(data-count);
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--red-600);
    color: white;
    font-size: 0.65em;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.topbar-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    flex-shrink: 0;
    color: white; /* Añadido color blanco al avatar por defecto */
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-user-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--slate-900);
    display: block;
}

.topbar-user-role {
    font-size: 0.75em;
    font-weight: 400;
    color: var(--slate-500);
    display: block;
}

.user-info {
    color: var(--slate-700);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88em;
    padding: 6px 6px 6px 14px;
    border-radius: 999px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    position: relative;
}
.user-info strong {
    color: var(--slate-900);
    font-weight: 600;
}
.user-info::after {
    content: "";
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") center / 60% no-repeat,
        linear-gradient(135deg, var(--blue-500), var(--blue-700));
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-perfil {
    background: var(--blue-50);
    color: var(--blue-700);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85em;
    border: 1px solid var(--blue-100);
    cursor: pointer;
}
.btn-perfil:hover { background: var(--blue-100); }

.content-area {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    background: var(--slate-50);
}

.seccion-panel { display: none; animation: fadeIn .3s ease; width: 100%; }
.seccion-panel.activa { display: block; }

/* =========================================================
   4. TARJETAS / CONTENEDORES DE INFORMACIÓN
========================================================= */
.tarjeta {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
    width: 100%;
}

.tarjeta h2 {
    margin-top: 0;
    color: var(--slate-900);
    border-bottom: 1px solid var(--slate-100);
    padding-bottom: 14px;
    margin-bottom: 18px;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.tarjeta h3 {
    color: var(--slate-900);
    font-size: 1em;
    font-weight: 600;
    margin-top: 0;
}

.tarjeta-destacada {
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
}

.formulario-container {
    background: #ffffff;
    max-width: 560px;
    margin: 0 auto;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--slate-200);
}

/* =========================================================
   5. DISEÑO DE FORMULARIOS
========================================================= */
.grupo-form { margin-bottom: 16px; }
.grupo-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--slate-700);
    font-size: 0.85em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="tel"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.92em;
    background: #ffffff;
    color: var(--slate-900);
    transition: all .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: var(--ring);
}

input::placeholder, textarea::placeholder { color: var(--slate-400); }
textarea { resize: vertical; min-height: 84px; }

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.campo-bloqueado,
input[readonly],
input[disabled],
select[disabled] {
    background: var(--slate-100) !important;
    color: var(--slate-500) !important;
    cursor: not-allowed;
    border-color: var(--slate-200) !important;
}

/* =========================================================
   6. BOTONERÍA
========================================================= */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all .15s ease;
    font-weight: 600;
}

.btn-accion {
    background: var(--blue-600);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.20);
}
.btn-accion:hover {
    background: var(--blue-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.30);
}

.btn-add-principal {
    background: var(--blue-600);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    border: none;
}
.btn-add-principal:hover {
    background: var(--blue-700);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.btn-atender {
    background: var(--blue-600);
    color: #ffffff;
    padding: 8px 14px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}
.btn-atender:hover {
    background: var(--blue-700);
    color: #ffffff;
}

.btn-crm {
    background: var(--blue-600);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    font-weight: 600;
}
.btn-crm:hover { background: var(--blue-700); }

.btn-crear {
    background: var(--slate-900);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.btn-crear:hover { background: var(--slate-700); }

.btn-menu-nuevo {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500)) !important;
    color: #ffffff !important;
    margin: 8px 6px 14px !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 600 !important;
    justify-content: center !important;
    text-align: center;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.30) !important;
    padding: 12px 14px !important;
}
.btn-menu-nuevo::before {
    background-color: #ffffff !important;
}
.btn-menu-nuevo:hover {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-600)) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.btn-descarga {
    background: var(--green-600);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
.btn-descarga:hover { background: #15803d; color: #ffffff; }

/* =========================================================
   7. TABLAS DE DATOS - CON ADAPTABILIDAD AÑADIDA
========================================================= */
/* MEJORA RESPONSIVE: Wrapper para evitar que las tablas rompan en móvil */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-200);
    background: #ffffff;
    margin-top: 4px;
}

table.tabla-datos {
    width: 100%;
    min-width: 600px; /* Evita que la tabla se colapse demasiado */
    border-collapse: collapse;
    margin-top: 0;
    border: none;
}

table.tabla-datos th,
table.tabla-datos td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--slate-100);
    vertical-align: middle;
    font-size: 0.9em;
}

table.tabla-datos th {
    background: var(--slate-50);
    color: var(--slate-500);
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--slate-200);
}

table.tabla-datos tbody tr {
    transition: background .12s;
}
table.tabla-datos tbody tr:hover { background: var(--slate-50); }
table.tabla-datos tbody tr:last-child td { border-bottom: none; }

/* =========================================================
   8. ALERTAS Y ETIQUETAS VISUALES (BADGES)
========================================================= */
.alerta-exito {
    background: var(--green-50);
    color: #14532d;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    border: 1px solid #86efac;
    border-left: 4px solid var(--green-600);
    font-size: 0.92em;
}
.alerta-error {
    background: var(--red-50);
    color: #991b1b;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    border: 1px solid #fca5a5;
    border-left: 4px solid var(--red-600);
    font-size: 0.92em;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72em;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.badge-verde, .asignado, .estado-resuelto {
    background: var(--green-100);
    color: #166534;
}
.badge-rojo {
    background: var(--red-100);
    color: #991b1b;
}
.estado-recibido {
    background: #fef3c7;
    color: #92400e;
}
.estado-curso {
    background: var(--blue-100);
    color: var(--blue-700);
}

.badge-count {
    background: var(--blue-600) !important;
    color: #ffffff !important;
    font-weight: 700;
    padding: 2px 8px !important;
    border-radius: 999px;
    font-size: 0.72em !important;
    margin-left: 8px;
    min-width: 20px;
    text-align: center;
    line-height: 1.5;
}

/* =========================================================
   9. DASHBOARD, TARJETAS KPI Y LÍNEAS DE TIEMPO
========================================================= */
.grid-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: #ffffff;
    padding: 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-xs);
}
.kpi-card .numero {
    font-size: 2em;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

.historial-timeline {
    border-left: 2px solid var(--slate-200);
    margin-left: 10px;
    padding-left: 22px;
}
.item-timeline {
    position: relative;
    margin-bottom: 14px;
    background: #ffffff;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200);
}
.item-timeline::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 18px;
    width: 10px;
    height: 10px;
    background: var(--blue-600);
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px var(--blue-600);
}
.item-timeline.auto::before {
    background: var(--amber-500);
    box-shadow: 0 0 0 2px var(--amber-500);
}
.fecha-crm {
    color: var(--slate-500);
    font-size: 0.78em;
    margin-bottom: 4px;
    display: block;
}
.tipo-crm {
    font-weight: 600;
    color: var(--blue-700);
    font-size: 0.78em;
    display: inline-block;
    margin-bottom: 4px;
    background: var(--blue-50);
    padding: 2px 8px;
    border-radius: 999px;
}

.caja-ia {
    background: linear-gradient(135deg, #f0f9ff, #faf5ff);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 24px;
    position: relative;
}
.caja-ia::before {
    content: '✨ AXA Inteligencia Artificial';
    position: absolute;
    top: -12px;
    left: 18px;
    background: linear-gradient(135deg, var(--violet-600), var(--blue-600));
    color: #ffffff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.30);
}

/* =========================================================
   10. CALENDARIO
========================================================= */
.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.cal-header a {
    text-decoration: none;
    color: var(--slate-700);
    font-weight: 600;
    font-size: 1.1em;
    padding: 0 10px;
}
.cal-header span {
    font-weight: 700;
    color: var(--slate-900);
    text-transform: capitalize;
}

table.cal-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    text-align: center;
    margin-top: 12px;
}
table.cal-grid th {
    padding: 8px;
    background: transparent;
    border: none;
    font-size: 0.72em;
    color: var(--slate-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
table.cal-grid td {
    padding: 14px 4px;
    border: 1px solid var(--slate-100);
    border-radius: var(--radius-sm);
    vertical-align: middle;
    cursor: pointer;
    color: var(--slate-700);
    font-size: 0.9em;
    background: #ffffff;
    transition: all .15s;
}
table.cal-grid td:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
}

.dia-hoy {
    background: var(--blue-600) !important;
    color: #ffffff !important;
    border-radius: 50%;
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-weight: 700;
}
.dia-cita {
    background: var(--blue-50) !important;
    color: var(--blue-700) !important;
    border-color: var(--blue-600) !important;
    font-weight: 700;
    position: relative;
}
.dia-cita::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--blue-600);
    border-radius: 50%;
}
.dia-cita:hover { background: var(--blue-100) !important; }

/* =========================================================
   11. SISTEMA DE VALORACIÓN (RATING STARS)
========================================================= */
.rating-box {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.star-rating input[type="radio"] { display: none; }
.star-rating label {
    font-size: 1.8em;
    color: var(--slate-300);
    cursor: pointer;
    transition: .15s;
    padding: 0 3px;
    line-height: 1;
}
.star-rating input[type="radio"]:checked ~ label { color: var(--amber-500); }
.star-rating label:hover,
.star-rating label:hover ~ label { color: #fbbf24; }

/* =========================================================
   12. MENSAJERÍA Y BUZÓN INTERNO
========================================================= */
.mensaje-email {
    padding: 16px 18px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    background: #ffffff;
    border: 1px solid var(--slate-200);
}
.mensaje-nuevo {
    border-left: 4px solid var(--blue-600);
    background: var(--blue-50);
}
.mensaje-leido {
    border-left: 4px solid var(--slate-300);
    background: var(--slate-50);
}

.tarjeta-poliza {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    transition: all .2s;
}
.tarjeta-poliza:hover {
    border-color: var(--blue-100);
    box-shadow: var(--shadow-md);
}

/* =========================================================
   13. COMPONENTE DE CHAT INTERNO
========================================================= */
.chat-container {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: #ffffff;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--slate-50);
}
.chat-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.92em;
    line-height: 1.45;
    position: relative;
    box-shadow: var(--shadow-xs);
}
.chat-bubble.me {
    background: var(--blue-600);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    color: #ffffff;
}
.chat-bubble.me > div:first-child { color: rgba(255, 255, 255, 0.75); }
.chat-bubble.them {
    background: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--slate-200);
    color: var(--slate-900);
}
.chat-bubble.admin {
    background: var(--blue-50);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--blue-100);
    color: var(--blue-700);
}
.chat-author {
    font-size: 0.75em;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--slate-500);
}
.chat-time {
    font-size: 0.7em;
    color: var(--slate-400);
    display: block;
    text-align: right;
    margin-top: 4px;
}
.chat-input-area {
    padding: 14px;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    display: flex;
    gap: 10px;
}
.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
}
.chat-input-area button {
    background: var(--blue-600);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.chat-input-area button:hover { background: var(--blue-700); }

.grid-chat-traspaso {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* =========================================================
   14. CONTENIDO GENERADO POR IA (Formateo HTML interno)
========================================================= */
.contenido-html-ia ul {
    margin: 10px 0;
    padding-left: 22px;
    list-style-type: disc;
}
.contenido-html-ia li {
    margin-bottom: 6px;
    color: var(--slate-700);
}
.contenido-html-ia strong { color: var(--slate-900); }
.contenido-html-ia .titulo-pros {
    color: var(--green-600) !important;
    font-size: 1.05em;
    font-weight: 700;
    margin-top: 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--green-100);
    padding-bottom: 6px;
}
.contenido-html-ia .titulo-contras {
    color: var(--red-600) !important;
    font-size: 1.05em;
    font-weight: 700;
    margin-top: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--red-100);
    padding-bottom: 6px;
}

/* =========================================================
   16. NUEVOS COMPONENTES BASADOS EN EL MOCKUP
========================================================= */
.kpi-stat-card {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.kpi-label { font-size: 0.75em; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.kpi-number { font-size: 2.5em; font-weight: 800; color: var(--blue-600); margin-bottom: 8px; }
.kpi-variation { font-size: 0.85em; font-weight: 600; color: var(--green-600); display: inline-block; background: var(--green-50); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--green-200); }
.kpi-variation.negative { color: var(--red-600); background: var(--red-50); border-color: var(--red-200); }

.section-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--slate-200); }
.section-header h2 { margin: 0; font-size: 1.3em; color: var(--slate-900); }
.section-header-sub { font-size: 0.9em; color: var(--slate-600); margin-top: 4px; display: block; }
.section-header-actions { display: flex; gap: 10px; }

.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--slate-200); }
.filter-bar select, .filter-bar input[type="date"], .filter-bar input[type="text"] { padding: 8px 12px; border: 1px solid var(--slate-200); border-radius: 6px; background: #ffffff; font-size: 0.85em; color: var(--slate-700); cursor: pointer; }
.filter-bar button { padding: 8px 14px; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 6px; cursor: pointer; font-size: 0.85em; font-weight: 500; transition: all 0.15s; }
.filter-bar button:hover { background: var(--slate-200); }

.badge-estado-nuevo { background: var(--blue-100); color: var(--blue-700); }
.badge-estado-contactado { background: #e9d5ff; color: #6b21a8; }
.badge-estado-negociacion { background: var(--orange-100); color: var(--orange-600); }
.badge-estado-pendiente { background: #fef3c7; color: #92400e; }
.badge-estado-aceptado { background: var(--green-100); color: var(--green-700); }
.badge-estado-rechazado { background: var(--red-100); color: var(--red-700); }

.badge-prioridad-alta { background: var(--red-100); color: var(--red-700); }
.badge-prioridad-media { background: var(--orange-100); color: var(--orange-600); }
.badge-prioridad-baja { background: var(--green-100); color: var(--green-700); }

/* MEJORA RESPONSIVE: Kanban táctil y scroll horizontal suave */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.kanban-col { min-width: 300px; flex-shrink: 0; background: var(--slate-50); border-radius: var(--radius-md); overflow: hidden; display: flex; flex-direction: column; max-height: 600px; scroll-snap-align: start; }
.kanban-col-header { padding: 14px; background: #ffffff; border-bottom: 2px solid var(--slate-200); font-weight: 600; color: var(--slate-900); display: flex; align-items: center; gap: 8px; font-size: 0.95em; }
.kanban-col-header::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--blue-600); }
.kanban-col-content { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: #ffffff; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 12px; cursor: move; transition: all 0.15s; box-shadow: var(--shadow-xs); }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card-title { font-weight: 600; color: var(--slate-900); margin-bottom: 6px; font-size: 0.92em; }
.kanban-card-type { font-size: 0.8em; color: var(--slate-600); margin-bottom: 8px; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.8em; color: var(--slate-500); }

.timeline-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--slate-100); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; background: var(--blue-600); }
.timeline-content { flex: 1; }
.timeline-date { font-size: 0.8em; color: var(--slate-500); font-weight: 600; }
.timeline-type { font-size: 0.8em; color: var(--blue-600); font-weight: 600; background: var(--blue-50); padding: 2px 8px; border-radius: 4px; display: inline-block; margin-top: 2px; }
.timeline-text { font-size: 0.9em; color: var(--slate-700); margin-top: 4px; }

.quick-agenda-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--slate-100); }
.quick-agenda-item:last-child { border-bottom: none; }
.quick-agenda-time { font-weight: 600; color: var(--slate-900); min-width: 60px; }
.quick-agenda-details { flex: 1; margin-left: 12px; }
.quick-agenda-title { font-weight: 600; color: var(--slate-900); font-size: 0.9em; }
.quick-agenda-subtitle { font-size: 0.8em; color: var(--slate-600); margin-top: 2px; }

.ia-insight-card { background: linear-gradient(135deg, #f0f9ff, #faf5ff); border: 1px solid #c7d2fe; border-radius: var(--radius-md); padding: 20px; position: relative; }
.ia-insight-card::before { content: '✨ IA Comercial'; position: absolute; top: -12px; left: 18px; background: linear-gradient(135deg, var(--violet-600), var(--blue-600)); color: #ffffff; padding: 4px 14px; border-radius: 999px; font-size: 0.75em; font-weight: 600; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.30); }

.activity-feed-item { display: flex; gap: 12px; padding: 12px; border-bottom: 1px solid var(--slate-100); background: #ffffff; border-radius: 6px; margin-bottom: 8px; }
.activity-feed-item:last-child { border-bottom: none; margin-bottom: 0; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-50); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.2em; }
.activity-content { flex: 1; }
.activity-title { font-weight: 600; color: var(--slate-900); font-size: 0.9em; }
.activity-subtitle { font-size: 0.8em; color: var(--slate-600); margin-top: 2px; }
.activity-time { font-size: 0.75em; color: var(--slate-500); margin-top: 4px; }

.policy-mini-card { background: #ffffff; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; }
.policy-mini-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.policy-mini-title { font-weight: 600; color: var(--slate-900); font-size: 0.9em; }
.policy-mini-status { font-size: 0.75em; padding: 2px 6px; border-radius: 4px; background: var(--green-50); color: var(--green-700); }
.policy-mini-info { font-size: 0.8em; color: var(--slate-600); display: flex; justify-content: space-between; }

.client-quick-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.client-quick-actions button { padding: 8px 16px; border: 1px solid var(--slate-300); background: #ffffff; border-radius: 6px; cursor: pointer; font-size: 0.85em; font-weight: 500; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.client-quick-actions button:hover { background: var(--slate-100); border-color: var(--slate-400); }

/* =========================================================
   17. TARJETAS DE ESTADÍSTICAS DEL DASHBOARD
========================================================= */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.6s ease-out backwards;
}
.stat-card:hover { border-color: var(--blue-100); box-shadow: var(--shadow-md); transform: translateY(-4px); }
.stat-card small { font-size: 0.8em; font-weight: 500; display: block; margin-top: 6px; }
.stat-card p { margin: 0; color: var(--slate-600); font-size: 0.85em; font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; }

/* =========================================================
   18. BARRA DE DESPLAZAMIENTO (SCROLLBAR)
========================================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--slate-200);
    border-radius: 999px;
    border: 2px solid var(--slate-50);
}
::-webkit-scrollbar-thumb:hover { background: var(--slate-300); }

/* =========================================================
   19. PANEL DE NOTIFICACIONES DESPLEGABLE
========================================================= */
.topbar-notif-container {
    position: relative;
    display: flex;
    align-items: center;
}

.panel-notificaciones {
    display: none;
    position: absolute;
    right: 0;
    top: 130%;
    width: 340px;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    text-align: left;
    overflow: hidden;
}

.panel-notif-header {
    background: var(--slate-50);
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    font-weight: 600;
    color: var(--slate-900);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-notif-header {
    background: var(--red-500);
    color: #ffffff;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.panel-notif-body {
    max-height: 320px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    transition: background 0.2s ease;
    background: #ffffff;
}

.notif-item:hover {
    background: var(--slate-50);
}

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

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1em;
}

.notif-content {
    flex: 1;
}

.notif-text {
    font-size: 0.9em;
    color: var(--slate-800);
    line-height: 1.4;
}

.notif-time {
    font-size: 0.75em;
    color: var(--slate-500);
    margin-top: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.panel-notif-footer {
    background: var(--slate-50);
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--slate-200);
}

.panel-notif-footer a {
    color: var(--blue-600);
    font-size: 0.85em;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.panel-notif-footer a:hover {
    color: var(--blue-700);
}

/* =========================================================
   20. ADAPTABILIDAD MÓVIL (MEDIA QUERIES)
   Mover esto al final garantiza que no haya conflictos.
========================================================= */
.btn-menu-movil {
    display: none;
    background: none;
    border: none;
    font-size: 1.6em;
    color: var(--slate-700);
    cursor: pointer;
    padding: 4px 10px;
    margin-right: 10px;
    border-radius: var(--radius-sm);
}
.btn-menu-movil:hover { background: var(--slate-100); }

.overlay-menu {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}
.overlay-menu.activo { display: block; }

/* =========================================================
   RESPONSIVE DESIGN - BREAKPOINTS COMPLETOS
========================================================= */

/* === EXTRA LARGE (1400px+) === */
@media (min-width: 1401px) {
    .sidebar { width: var(--sidebar-w); }
    .main-content { flex: 1; }
    .content-area { padding: 28px; }
}

/* === LARGE (1200px - 1400px) === */
@media (max-width: 1400px) {
    .login-hero-footer { flex-direction: column; gap: 12px; bottom: 30px; left: 40px; right: 40px; }
}

@media (max-width: 1200px) {
    .promo-panel { width: 50%; padding: 40px; }
    .login-panel { width: 50%; padding: 30px; }
    .stat-polizas, .stat-renov, .stat-prod { display: none; }
    .sidebar { width: 240px; }
    .content-area { padding: 24px; }
}

/* === TABLETS LARGE (992px - 1199px) === */
@media (max-width: 1199px) {
    .sidebar { width: 220px; }
    .sidebar-menu li { font-size: 0.85em; }
    .topbar-search { flex: 0 0 220px; }
    [style*="grid-template-columns: repeat(auto-fit"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* === TABLETS & MOBILE BREAKPOINT (768px - 991px) === */
@media (max-width: 991px) {
    /* Layout principal */
    .body-panel { flex-direction: column; }

    /* Sidebar off-canvas */
    .sidebar {
        position: fixed;
        left: 0;
        top: 72px;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.15);
        background: #ffffff;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.abierta { transform: translateX(0); }

    /* Overlay menu */
    .overlay-menu {
        display: none;
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    .overlay-menu.activo { display: block; }

    /* Topbar */
    .btn-menu-movil { display: flex; }
    .topbar { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
    .topbar h1, .topbar-title-mobile { font-size: 1.05em; flex: 1; margin: 0; }
    .topbar-search { display: none; }
    .topbar-user-profile { display: none; }
    .topbar-actions { gap: 6px; }

    /* Contenido */
    .main-content { width: 100%; }
    .content-area { padding: 16px; }
    .tarjeta { padding: 18px; margin-bottom: 16px; }
    .tarjeta h2 { font-size: 1em; padding-bottom: 12px; margin-bottom: 14px; }

    /* Grids responsivos */
    [style*="grid-template-columns: repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
    [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
    [style*="grid-template-columns: repeat(auto-fit"] { grid-template-columns: repeat(2, 1fr) !important; }
    [style*="grid-template-columns: 2fr 1fr"] { grid-template-columns: 1fr !important; }

    /* Flexbox */
    [style*="display:flex"][style*="gap:20px"] { flex-direction: column; gap: 12px !important; }

    /* Formularios */
    .grupo-form { margin-bottom: 14px; }
    input, select, textarea { font-size: 16px; padding: 12px; }

    /* Botones */
    .btn-accion, .btn-add-principal, button[type="submit"], button[type="button"] {
        width: 100%;
        padding: 12px 16px;
        min-height: 48px;
    }

    /* Tablas */
    table.tabla-datos { font-size: 0.85em; }
    table.tabla-datos th, table.tabla-datos td { padding: 10px 12px; }

    /* Chat */
    [style*="display:flex"][style*="height:500px"] { height: 400px !important; flex-direction: column; }

    /* Header */
    .section-header { flex-direction: column; gap: 12px; align-items: flex-start; }

    /* Login */
    .body-split-screen { flex-direction: column; height: auto; overflow: visible; }
    .promo-panel { width: 100%; padding: clamp(20px, 6vw, 30px) clamp(16px, 4vw, 20px); min-height: 280px; }
    .login-panel { width: 100%; padding: clamp(20px, 6vw, 30px) clamp(16px, 4vw, 20px); }
    .stat-polizas, .stat-renov, .stat-prod { display: none !important; }
    .login-hero-footer { position: relative; bottom: auto; left: auto; right: auto; margin-top: clamp(20px, 5vw, 30px); flex-wrap: wrap; }
    .footer-item { flex: 1; min-width: 280px; }

    #panel-notificaciones { position: fixed !important; top: 72px !important; right: 0 !important; width: auto !important; max-width: none !important; }
}

/* === PHONES LARGE (576px - 767px) === */
@media (max-width: 767px) {
    .topbar { padding: 10px 12px; min-height: 72px; }
    .topbar h1 { font-size: 0.95em; order: 2; }
    .btn-menu-movil { order: 1; font-size: 1.5em; padding: 8px 12px; }
    .topbar-actions { order: 3; gap: 4px; }

    .sidebar { width: 260px; }
    .sidebar-header { padding: 12px; gap: 10px; }
    .logo-mark { width: 36px; height: 36px; font-size: 11px; }
    .logo-name { font-size: 0.8em; }
    .logo-sub { font-size: 0.6em; }
    .sidebar-menu { padding: 10px 6px; }
    .sidebar-menu li { font-size: 0.82em; padding: 8px 8px; gap: 8px; }
    .sidebar-menu li i { width: 20px; font-size: 1em; }
    .sidebar-footer { padding: 10px; gap: 8px; }

    .content-area { padding: 12px; }
    .tarjeta { padding: 14px; margin-bottom: 12px; border-radius: var(--radius-sm); }
    .tarjeta h2 { font-size: 0.95em; padding-bottom: 10px; margin-bottom: 12px; }
    .tarjeta h3 { font-size: 0.9em; }

    [style*="grid-template-columns: repeat"] { grid-template-columns: 1fr !important; gap: 10px !important; }

    .btn-accion, .btn-add-principal, button { font-size: 0.9em; padding: 10px 14px; min-height: 44px; }

    input, select, textarea { font-size: 16px; padding: 10px; }

    table.tabla-datos { font-size: 0.8em; }
    table.tabla-datos th, table.tabla-datos td { padding: 8px 8px; }

    .topbar-user-avatar { width: 28px; height: 28px; font-size: 0.8em; }
}

/* === PHONES STANDARD (480px - 575px) === */
@media (max-width: 575px) {
    :root { font-size: 13px; }

    .topbar { padding: 8px 8px; min-height: 64px; }
    .topbar h1 { font-size: 0.9em; }
    .btn-menu-movil { font-size: 1.3em; padding: 6px 8px; }

    .sidebar { width: 240px; }
    .sidebar-header { flex-direction: column; text-align: center; padding: 10px; }
    .logo-mark { width: 32px; height: 32px; font-size: 10px; }
    .logo-info { width: 100%; }
    .logo-name { font-size: 0.75em; }
    .sidebar-menu li { font-size: 0.8em; padding: 6px 6px; }
    .card-seguridad { font-size: 0.75em; }

    .content-area { padding: 10px; }
    .tarjeta { padding: 12px; margin-bottom: 10px; }
    .tarjeta h2 { font-size: 0.9em; }

    [style*="flex:"] { flex: 1 !important; min-width: 100% !important; }
    .grupo-form { margin-bottom: 10px; }
    label { font-size: 0.8em; }

    input, select, textarea { font-size: 15px; padding: 8px; height: 40px; }
    textarea { height: auto; min-height: 80px; }

    .btn-accion, .btn-add-principal, button { font-size: 0.85em; padding: 8px 12px; min-height: 40px; width: 100%; }

    table.tabla-datos { font-size: 0.75em; }
    table.tabla-datos th, table.tabla-datos td { padding: 6px 4px; }

    #panel-notificaciones { width: 90vw !important; left: 5vw !important; right: auto !important; }

    canvas { max-width: 100%; height: auto; }
    .star-rating label { font-size: 1.4em; }

    /* Mejoras para login en móvil */
    .contenedor-login { width: 95% !important; max-width: none !important; margin: 0 auto; padding: clamp(20px, 5vw, 30px) !important; }
    .login-hero-title { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 20px; }
    .login-hero-text { font-size: clamp(0.9rem, 2.5vw, 1.1rem); }
    .footer-item { min-width: 100%; margin-bottom: 8px; }
}

/* === PHONES EXTRA SMALL (< 480px) === */
@media (max-width: 479px) {
    :root { font-size: 12px; }

    .topbar { padding: 6px 6px; min-height: 56px; }
    .topbar h1 { font-size: 0.85em; min-width: 100px; }
    .btn-menu-movil { font-size: 1.2em; padding: 4px 6px; }

    .sidebar { width: 220px; }
    .sidebar-menu li i { width: 18px; font-size: 0.95em; }

    .content-area { padding: 8px; }
    .tarjeta { padding: 10px; margin-bottom: 8px; border-radius: 8px; }
    .tarjeta h2 { font-size: 0.85em; margin-bottom: 10px; padding-bottom: 8px; }

    [style*="display:flex"], [style*="display:grid"] { flex-direction: column !important; grid-template-columns: 1fr !important; }
    [style*="gap:20px"] { gap: 8px !important; }

    input, select, textarea { font-size: 14px; padding: 6px; width: 100% !important; }

    button, .btn-accion, .btn-add-principal { width: 100%; padding: 6px 10px; font-size: 0.8em; min-height: 36px; }

    .table-responsive-wrapper { margin: 0 -10px; }
    table.tabla-datos { font-size: 0.7em; }
    table.tabla-datos th, table.tabla-datos td { padding: 4px 2px; }

    .topbar-search, .topbar-user-profile, .card-seguridad, [style*="display:none"] { display: none !important; }

    /* Mejoras extremas para login en phones muy pequeños */
    .contenedor-login { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 16px !important; border-radius: 0 !important; box-shadow: none !important; }
    .login-brand { gap: 10px; margin-bottom: 24px; }
    .logo-mark { width: 48px; height: 48px; font-size: 1.2rem; }
    .logo-name { font-size: 1.3rem; }
    .login-hero-title { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 16px; }
    .input-wrapper { margin-bottom: 12px; }
    .input-wrapper input { height: 48px; font-size: 16px; }
    .btn-login { height: 48px; font-size: 0.95rem; }
    .footer-item { font-size: 0.75em; padding: 10px; min-width: 100%; }
    .footer-item strong { font-size: 0.85em; }
    .footer-item small { font-size: 0.7em; }
}

/* === TABLETS VERTICAL (480px - 768px) === */
@media (min-width: 480px) and (max-width: 768px) {
    .promo-panel { padding: clamp(30px, 5vw, 50px) clamp(20px, 4vw, 40px); }
    .login-panel { padding: clamp(30px, 5vw, 50px) clamp(20px, 4vw, 40px); }
    .contenedor-login { padding: clamp(25px, 4vw, 40px) !important; }
    .login-hero-title { font-size: clamp(2rem, 4.5vw, 2.8rem); }
    .footer-item { flex: 1; min-width: calc(50% - 10px); }
}

/* === LANDSCAPE PHONES === */
@media (max-height: 600px) and (orientation: landscape) {
    .sidebar { height: 100vh; overflow-y: auto; }
    .topbar { min-height: 48px; }
    .content-area { max-height: calc(100vh - 48px); overflow-y: auto; }
}

/* === ULTRA WIDE (> 1800px) === */
@media (min-width: 1801px) {
    .sidebar { width: 280px; }
    .content-area { padding: 32px; }
    .tarjeta { padding: 28px; }
    [style*="grid-template-columns: repeat(auto-fit"] { grid-template-columns: repeat(4, 1fr) !important; }
}

/* === PRINT MEDIA === */
@media print {
    .sidebar, .topbar, .overlay-menu, .btn-menu-movil { display: none !important; }
    .main-content { width: 100%; }
    body { background: white; }
    .tarjeta { page-break-inside: avoid; box-shadow: none; }
}