/* ====================================================================
   eRAsolar Cloud System - CRM Clientes & Máquina de Ventas 360°
   Styles & UI Design System
   ==================================================================== */

:root {
    --era-gold: #fdb813;
    --era-gold-dark: #d97706;
    --era-gold-light: #fef3c7;
    --era-navy: #0f172a;
    --era-navy-light: #1e293b;
    --era-blue: #0ea5e9;
    --era-blue-dark: #0284c7;
    --era-blue-light: #e0f2fe;
    --era-emerald: #10b981;
    --era-emerald-dark: #059669;
    --era-emerald-light: #d1fae5;
    --era-purple: #8b5cf6;
    --era-purple-light: #ede9fe;
    --era-red: #ef4444;
    --era-red-light: #fee2e2;
    --era-orange: #f97316;
    --era-orange-light: #ffedd5;
    --era-slate-50: #f8fafc;
    --era-slate-100: #f1f5f9;
    --era-slate-200: #e2e8f0;
    --era-slate-300: #cbd5e1;
    --era-slate-400: #94a3b8;
    --era-slate-500: #64748b;
    --era-slate-600: #475569;
    --era-slate-700: #334155;
    --era-slate-800: #1e293b;
    --era-slate-900: #0f172a;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-brand: 'Outfit', var(--font-sans);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: #f8fafc;
    color: var(--era-slate-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- HEADER PRINCIPAL --- */
.era-header {
    background: #0f172a;
    color: white;
    padding: 0.75rem 1.5rem;
    border-bottom: 2px solid var(--era-gold);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-text h1 {
    font-family: var(--font-brand);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.brand-tag {
    background: var(--era-gold);
    color: #0f172a;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--era-slate-400);
}

/* --- NAVEGACIÓN UNIVERSAL eRASOLAR --- */
.era-suite-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.era-suite-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--era-slate-300);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.era-suite-pill:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: var(--era-gold);
}

.era-suite-pill.active {
    background: var(--era-gold);
    color: #0f172a;
    font-weight: 800;
    border-color: var(--era-gold);
}

.era-suite-pill i {
    width: 14px;
    height: 14px;
}

.era-suite-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.2rem;
}

/* --- CONTENEDOR PRINCIPAL --- */
.crm-container {
    max-width: 100%;
    padding: 1rem 1.25rem 3rem 1.25rem;
    margin: 0 auto;
}

/* --- TOP KPI CARDS --- */
.crm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.crm-kpi-card {
    background: white;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--era-slate-200);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.crm-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--era-gold));
}

.kpi-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.kpi-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--era-slate-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--icon-bg, #fef3c7);
    color: var(--icon-color, #d97706);
}

.kpi-val {
    font-size: 1.25rem;
    font-weight: 800;
    font-family: var(--font-brand);
    color: var(--era-slate-900);
    line-height: 1.2;
}

.kpi-meta {
    font-size: 0.7rem;
    color: var(--era-slate-500);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* --- TOOLBAR & FILTERS --- */
.crm-toolbar {
    background: white;
    padding: 0.85rem 1.15rem;
    border-radius: 12px;
    border: 1px solid var(--era-slate-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.crm-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    width: 100%;
}

.crm-toolbar-search-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 280px;
}

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

.search-input-wrap i,
.search-input-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--era-slate-400);
    width: 15px;
    height: 15px;
    pointer-events: none;
    z-index: 2;
}

.search-input {
    width: 100%;
    height: 38px;
    padding: 0 0.75rem 0 2.25rem;
    font-size: 0.82rem;
    border: 1px solid var(--era-slate-300);
    border-radius: 7px;
    outline: none;
    background: var(--era-slate-50);
    color: var(--era-slate-800);
    font-family: inherit;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--era-gold);
    background: white;
    box-shadow: 0 0 0 3px rgba(253, 184, 19, 0.2);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-select {
    height: 38px;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    border: 1px solid var(--era-slate-300);
    border-radius: 7px;
    background: white;
    color: var(--era-slate-700);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.filter-select:focus {
    border-color: var(--era-gold);
    box-shadow: 0 0 0 2px rgba(253, 184, 19, 0.15);
}

.crm-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 0.65rem;
    border-top: 1px solid var(--era-slate-100);
}

.crm-toolbar-actions button {
    height: 36px;
    padding: 0 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

/* --- BOTONES --- */
.btn-gold {
    background: var(--era-gold);
    color: #0f172a;
    border: 1px solid var(--era-gold-dark);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gold:hover {
    background: #eab308;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-primary {
    background: #0f172a;
    color: white;
    border: 1px solid #1e293b;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #1e293b;
    color: var(--era-gold);
}

.btn-secondary {
    background: white;
    color: var(--era-slate-700);
    border: 1px solid var(--era-slate-300);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--era-slate-50);
    border-color: var(--era-slate-400);
}

.btn-whatsapp {
    background: #25d366;
    color: white;
    border: none;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-whatsapp:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

/* --- KANBAN BOARD CONTAINER --- */
.kanban-board {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
    min-height: calc(100vh - 270px);
}

.kanban-column {
    flex: 0 0 315px;
    min-width: 315px;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid var(--era-slate-200);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 210px);
}

.kanban-column-header {
    padding: 0.75rem 0.85rem;
    border-bottom: 2px solid var(--col-color, #cbd5e1);
    background: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.col-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.col-icon {
    width: 16px;
    height: 16px;
    color: var(--col-color, var(--era-slate-700));
}

.col-title {
    font-weight: 800;
    font-size: 0.82rem;
    color: var(--era-slate-900);
}

.col-badge {
    background: var(--era-slate-100);
    color: var(--era-slate-700);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid var(--era-slate-200);
}

.col-amount {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--era-slate-500);
}

.kanban-column-body {
    padding: 0.55rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* --- KANBAN CARD --- */
.kanban-card {
    background: white;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--era-slate-200);
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
}

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

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.35rem;
}

.card-client-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--era-slate-900);
    line-height: 1.25;
}

.card-code {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--era-slate-500);
    background: var(--era-slate-100);
    padding: 1px 4px;
    border-radius: 3px;
    display: inline-block;
}

/* --- BADGES LEAD SCORING --- */
.tier-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    text-transform: uppercase;
}

.tier-a {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.tier-b {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.tier-c {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

/* --- SEMÁFORO DE ACTIVIDAD / TEMPERATURA --- */
.temp-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.temp-hot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.temp-warm {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

.temp-cold {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.5rem;
    font-size: 0.7rem;
    color: var(--era-slate-600);
    background: var(--era-slate-50);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--era-slate-100);
}

.card-stat-label {
    color: var(--era-slate-400);
    font-size: 0.65rem;
    display: block;
}

.card-stat-val {
    font-weight: 700;
    color: var(--era-slate-800);
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.2rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--era-slate-100);
    gap: 0.25rem;
}

.card-footer .btn-whatsapp {
    background: #25d366;
    color: white;
    border: none;
    font-weight: 700;
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 24px;
    flex-shrink: 0;
}

.card-footer .btn-whatsapp:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.card-btn-action {
    background: #ffffff;
    border: 1px solid var(--era-slate-200);
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    color: var(--era-slate-600);
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.card-btn-action:hover {
    background: var(--era-slate-100);
    color: var(--era-slate-900);
    border-color: var(--era-slate-300);
}

.card-btn-action[onclick*="deleteLead"]:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626 !important;
}

/* --- MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.wide {
    max-width: 960px;
}

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

.modal-header {
    background: #0f172a;
    color: white;
    padding: 0.85rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--era-gold);
}

.modal-header h3 {
    font-family: var(--font-brand);
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--era-slate-400);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: white;
}

.modal-card form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
}

/* Scrollbar estilizada, moderna y suave para modales */
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    background: var(--era-slate-50);
    border-top: 1px solid var(--era-slate-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* --- FORM STYLES --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--era-slate-700);
}

.form-control {
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    border: 1px solid var(--era-slate-300);
    border-radius: 6px;
    outline: none;
    background: white;
    color: var(--era-slate-800);
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--era-gold);
    box-shadow: 0 0 0 2px rgba(253, 184, 19, 0.2);
}

/* --- PITCH CALCULATOR & FINANCIAL BOXES --- */
.pitch-box {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--era-gold);
    margin-bottom: 1rem;
}

.pitch-headline {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--era-gold);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.pitch-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.pitch-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pitch-label {
    font-size: 0.65rem;
    color: var(--era-slate-400);
    text-transform: uppercase;
}

.pitch-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: white;
    font-family: var(--font-brand);
}

/* --- OBJECIONES ACORDEÓN --- */
.objection-item {
    background: var(--era-slate-50);
    border: 1px solid var(--era-slate-200);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.objection-trigger {
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--era-slate-800);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.objection-trigger:hover {
    background: #fef3c7;
}

.objection-content {
    padding: 0.75rem 0.85rem;
    font-size: 0.75rem;
    color: var(--era-slate-600);
    border-top: 1px solid var(--era-slate-200);
    background: var(--era-slate-50);
    display: none;
}

.objection-item.open .objection-content {
    display: block;
}

/* --- CHECKLIST REQUISITOS --- */
.req-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    background: var(--era-slate-50);
    border: 1px solid var(--era-slate-200);
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
}

.req-item input[type="checkbox"] {
    accent-color: var(--era-gold);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* --- TOAST NOTIFICATIONS --- */
.crm-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0f172a;
    color: white;
    padding: 0.75rem 1.15rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--era-gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 2000;
    animation: toastIn 0.25s ease-out;
}

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

/* ====================================================================
   COMPONENTES MÓVILES EXCLUSIVOS (Ocultos en Pantallas de Escritorio/PC)
   Garantiza 100% de aislamiento visual en computadores.
   ==================================================================== */
.crm-mobile-stage-bar {
    display: none;
}

.crm-mobile-fab {
    display: none;
}

/* ====================================================================
   DISEÑO RESPONSIVO MÓVIL (Android & iOS - Máx 768px)
   ==================================================================== */
@media (max-width: 768px) {

    /* 1. Header & Navegación Suite */
    .era-header {
        padding: 0.6rem 0.85rem;
        gap: 0.5rem;
        flex-direction: column;
        align-items: stretch;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .brand-section {
        justify-content: space-between;
        width: 100%;
    }

    .brand-logo {
        height: 34px;
    }

    .brand-text h1 {
        font-size: 1.05rem;
    }

    .brand-sub {
        display: none; /* Ocultar subtítulo largo en móvil para ahorrar espacio vertical */
    }

    .era-suite-links {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 0.2rem 0.15rem 0.35rem 0.15rem !important;
        gap: 0.35rem !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .era-suite-links::-webkit-scrollbar {
        display: none !important;
    }

    .era-suite-pill {
        font-size: 0.72rem !important;
        padding: 0.32rem 0.65rem !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        border-radius: 9999px !important;
        height: 32px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.35rem !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    .era-suite-pill.active {
        background: linear-gradient(135deg, #fdb813, #f59e0b) !important;
        color: #0f172a !important;
        font-weight: 800 !important;
        border-color: #fdb813 !important;
    }

    .era-suite-divider {
        display: none !important;
    }

    /* 2. Contenedor Principal */
    .crm-container {
        padding: 0.65rem 0.65rem 5.5rem 0.65rem;
    }

    /* 3. Métricas y KPIs Compactos */
    .crm-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .crm-kpi-card {
        padding: 0.6rem 0.75rem;
    }

    .crm-kpi-card:last-child {
        grid-column: 1 / -1; /* Última tarjeta ocupa ancho completo */
    }

    .kpi-title {
        font-size: 0.65rem;
    }

    .kpi-val {
        font-size: 1.1rem;
    }

    .kpi-meta {
        font-size: 0.68rem;
    }

    /* 4. Barra de Búsqueda y Filtros */
    .crm-toolbar {
        padding: 0.75rem;
        margin-bottom: 0.65rem;
    }

    .crm-toolbar-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .crm-toolbar-search-group {
        width: 100%;
    }

    .search-input-wrap {
        min-width: 100%;
        width: 100%;
    }

    .filter-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }

    .filter-select {
        width: 100%;
        height: 36px;
        font-size: 0.78rem;
        padding: 0 0.5rem;
    }

    .crm-toolbar-actions {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 0.4rem;
        padding-top: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .crm-toolbar-actions::-webkit-scrollbar {
        display: none;
    }

    .crm-toolbar-actions button {
        height: 34px;
        font-size: 0.75rem;
        padding: 0 0.65rem;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* 5. Selector Móvil de Etapas (Tabs Deslizables de Pulgar) */
    .crm-mobile-stage-bar {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        overflow-x: auto;
        padding: 0.2rem 0.15rem 0.65rem 0.15rem;
        margin-bottom: 0.5rem;
        position: sticky;
        top: 86px;
        z-index: 95;
        background: #f8fafc;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .crm-mobile-stage-bar::-webkit-scrollbar {
        display: none;
    }

    .crm-mobile-stage-tab {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.45rem 0.8rem;
        border-radius: 20px;
        font-size: 0.74rem;
        font-weight: 700;
        background: white;
        color: var(--era-slate-700);
        border: 1px solid var(--era-slate-300);
        white-space: nowrap;
        flex-shrink: 0;
        box-shadow: var(--shadow-sm);
        cursor: pointer;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .crm-mobile-stage-tab i,
    .crm-mobile-stage-tab svg {
        width: 14px;
        height: 14px;
    }

    .crm-mobile-stage-tab.active {
        background: #0f172a;
        color: var(--era-gold);
        border-color: #0f172a;
        font-weight: 800;
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
    }

    .crm-mobile-stage-badge {
        display: inline-block;
        font-size: 0.65rem;
        padding: 1px 6px;
        border-radius: 10px;
        background: var(--era-slate-100);
        color: var(--era-slate-700);
        font-weight: 800;
    }

    .crm-mobile-stage-tab.active .crm-mobile-stage-badge {
        background: var(--era-gold);
        color: #0f172a;
    }

    /* 6. Tablero Kanban Móvil (Snap Carousel) */
    .kanban-board {
        display: flex;
        gap: 0.75rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0.25rem 0.25rem 2rem 0.25rem;
        min-height: calc(100vh - 280px);
        scrollbar-width: thin;
    }

    .kanban-column {
        flex: 0 0 88vw;
        min-width: 88vw;
        max-width: 88vw;
        scroll-snap-align: center;
        max-height: calc(100vh - 220px);
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
    }

    .kanban-column-header {
        padding: 0.65rem 0.75rem;
    }

    .kanban-column-body {
        padding: 0.6rem;
        gap: 0.6rem;
    }

    /* 7. Tarjetas de Prospectos Móviles */
    .kanban-card {
        padding: 0.75rem;
        border-radius: 10px;
        margin-bottom: 0.5rem;
        flex-shrink: 0;
    }

    .card-client-name {
        font-size: 0.92rem;
    }

    .card-details {
        padding: 0.5rem 0.6rem;
        gap: 0.35rem 0.5rem;
    }

    .card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.3rem;
        padding-top: 0.45rem;
    }

    .card-footer .btn-whatsapp {
        height: 30px;
        font-size: 0.75rem;
        padding: 2px 8px;
        flex-shrink: 0;
    }

    .card-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-left: auto;
        flex-shrink: 0;
    }

    .card-btn-action {
        width: 28px;
        height: 28px;
        padding: 0;
        justify-content: center;
        border-radius: 6px;
        background: var(--era-slate-50);
        border: 1px solid var(--era-slate-200);
        flex-shrink: 0;
    }

    .card-btn-action i,
    .card-btn-action svg {
        width: 13px;
        height: 13px;
    }

    /* 8. Modales tipo Bottom Sheet (Deslizan desde abajo en móvil) */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-card,
    .modal-card.wide {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
        animation: mobileSheetSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes mobileSheetSlide {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .modal-header {
        padding: 0.85rem 1.15rem;
        border-radius: 20px 20px 0 0;
    }

    .modal-header h3 {
        font-size: 0.98rem;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.6rem;
    }

    .modal-body {
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Prevención de Auto-Zoom en Safari iOS cuando el usuario toca un input */
    .form-control,
    .search-input,
    .filter-select {
        font-size: 16px !important;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer > div {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .modal-footer button {
        flex: 1;
        height: 44px;
        font-size: 0.85rem;
        justify-content: center;
    }

    /* 9. Botón Flotante "+" (FAB para crear prospectos en la calle) */
    .crm-mobile-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 1.25rem;
        right: 1.25rem;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        background: var(--era-gold);
        color: #0f172a;
        border: 3px solid white;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        z-index: 999;
        cursor: pointer;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .crm-mobile-fab:active {
        transform: scale(0.92);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }

    .crm-mobile-fab i,
    .crm-mobile-fab svg {
        width: 26px;
        height: 26px;
        stroke-width: 2.8;
    }
}

/* Ajuste fino para pantallas extra pequeñas (< 400px, e.g. iPhone SE) */
@media (max-width: 400px) {
    .kanban-column {
        flex: 0 0 92vw;
        min-width: 92vw;
        max-width: 92vw;
    }
    .crm-kpi-grid {
        grid-template-columns: 1fr;
    }
}

