/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

#login-screen { display: flex; }
#main-app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Transiciones suaves */
button, .lead-card, .nav-btn, .action-btn, .modal-content { transition: all 0.2s ease; }

/* Iconos SVG */
.icon-svg { display: inline-flex; align-items: center; justify-content: center; }
.icon-svg svg { width: 100%; height: 100%; stroke: currentColor; }

/* Nav icons */
.nav-btn .icon-svg { width: 24px; height: 24px; color: #6b7280; }
.nav-btn.active .icon-svg { color: var(--accent); }

/* Header icon */
.logo .icon-svg { width: 20px; height: 20px; color: white; margin-right: 4px; }

/* Search icon */
#search-btn .icon-svg { width: 18px; height: 18px; }

/* Action icons */
.action-btn .icon-svg { width: 28px; height: 28px; color: var(--accent); margin-bottom: 4px; }

/* Modal header */
.back-btn .icon-svg { width: 24px; height: 24px; color: var(--text); }

/* Stats icon */
.stats-panel h3 .icon-svg { width: 20px; height: 20px; color: var(--accent); margin-right: 6px; }

/* Action modal title */
.action-content h3 .icon-svg { width: 20px; height: 20px; color: var(--accent); margin-right: 6px; }

/* Login logo */
.login-logo .icon-svg { width: 48px; height: 48px; color: var(--accent); margin: 0 auto; }

/* Detail view icons */
.detail-row .icon-svg { width: 18px; height: 18px; color: var(--text-light); margin-right: 8px; }
.detail-section h3 .icon-svg { width: 20px; height: 20px; color: var(--accent); margin-right: 6px; }

/* Lead card icons */
.lead-meta .icon-svg { width: 14px; height: 14px; color: var(--text-light); margin-right: 4px; }
.lead-actions .icon-svg { width: 14px; height: 14px; color: currentColor; }

/* Status dots como iconos */
.estado-icono { display: inline-flex; align-items: center; margin-right: 6px; }
.estado-icono .icon-svg { width: 16px; height: 16px; }

:root {
    --primary: #1a1a1a;
    --accent: #2563eb;
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #1a1a1a;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
}

html, body { height: 100%; font-family: -apple-system, sans-serif; background: var(--bg); overflow: hidden; }

#app { height: 100vh; display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; }
#app::before { content: ''; display: block; height: 8px; background: white; flex-shrink: 0; }

/* Stats Panel */
.stats-panel {
    padding: 16px;
    background: var(--bg);
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}
.stats-panel h3 { font-size: 20px; margin-bottom: 20px; color: var(--text); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: 8px; padding: 10px; text-align: center; border: 1px solid var(--border); }
.stat-number { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 10px; color: var(--text-light); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.stats-section { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); }
.stats-section h4 { font-size: 14px; color: var(--text-light); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.stat-bar-fill { height: 8px; background: var(--accent); border-radius: 4px; min-width: 20px; }
.stat-bar-bg { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }

/* Login */
.login-screen { position: fixed; inset: 0; background: linear-gradient(135deg, #1a1a1a, #333); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-box { background: var(--card); border-radius: 16px; padding: 40px; width: 90%; max-width: 360px; text-align: center; }
.login-logo { margin-bottom: 12px; }
.login-box h2 { font-size: 24px; margin-bottom: 4px; }
.login-box p { color: var(--text-light); margin-bottom: 24px; font-size: 14px; }
#login-btn { width: 100%; margin-top: 20px; padding: 14px; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0.1); touch-action: manipulation; }
.login-error { color: #ef4444; margin-top: 12px; font-size: 14px; }

/* Header */
.app-header { background: white; color: var(--text); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-img { height: 28px; width: auto; object-fit: contain; }
.logo-text { font-weight: 600; font-size: 16px; }
.stats-mini { font-size: 13px; opacity: 0.8; background: rgba(255,255,255,0.15); padding: 4px 10px; border-radius: 12px; }

/* Search */
.search-bar { display: flex; gap: 8px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.search-bar input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; }
.search-bar button { padding: 10px 14px; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; }

/* Filters */
.filters { display: flex; gap: 4px; padding: 6px 8px; background: var(--card); border-bottom: 1px solid var(--border); overflow-x: auto; }
.filters select { flex: 0 0 auto; min-width: 80px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; background: white; outline: none; }

/* Leads List */
.leads-list { flex: 1; overflow-y: auto; padding: 4px 8px; padding-bottom: 80px; }
.lead-card { background: var(--card); border-radius: 8px; padding: 8px 10px; margin-bottom: 4px; border: 1px solid var(--border); border-left: 3px solid transparent; cursor: pointer; }
.lead-card.no_contactado { border-left-color: #9ca3af; }
.lead-card.contactado { border-left-color: var(--warning); }
.lead-card.en_negociacion { border-left-color: #f97316; }
.lead-card.cerrado { border-left-color: var(--success); }
.lead-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.lead-name { font-weight: 600; font-size: 14px; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-badge { font-size: 10px; padding: 1px 5px; border-radius: 6px; font-weight: 500; text-transform: uppercase; white-space: nowrap; }
.badge-hotel { background: #dbeafe; color: #1e40af; }
.badge-gimnasio { background: #dcfce7; color: #166534; }
.badge-residencia { background: #fef3c7; color: #92400e; }
.badge-spa { background: #fce7f3; color: #9d174d; }
.badge-hospital { background: #fee2e2; color: #991b1b; }
.badge-otro { background: #f3f4f6; color: #4b5563; }
.lead-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-light); }
.lead-last { font-size: 10px; color: #9ca3af; }

/* Estado dot */
.estado-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 3px; }
.estado-gris { background: #9ca3af; }
.estado-amarillo { background: var(--warning); }
.estado-naranja { background: #f97316; }
.estado-verde { background: var(--success); }

/* Actions */
.lead-actions { display: flex; gap: 4px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.lead-action-btn { flex: 1; padding: 3px 6px; border: none; border-radius: 4px; font-size: 10px; font-weight: 500; cursor: pointer; }
.btn-call { background: #dcfce7; color: #166534; }
.btn-action { background: #dbeafe; color: #1e40af; }
.btn-view { background: #f3f4f6; color: #4b5563; }

/* Bottom Nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 8px 0; z-index: 100; max-width: 600px; margin: 0 auto; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 20px; border: none; background: none; color: var(--text-light); font-size: 11px; cursor: pointer; }
.nav-btn.active { color: var(--accent); }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: flex-end; }
.modal.hidden { display: none; }
.modal-content { background: var(--card); width: 100%; max-width: 600px; margin: 0 auto; border-radius: 20px 20px 0 0; max-height: 85vh; overflow-y: auto; padding: 20px; }
.modal-header { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 10; }
.back-btn { font-size: 24px; background: none; border: none; padding: 4px 12px 4px 0; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--card); }
.btn-primary { flex: 1; padding: 14px; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-secondary { flex: 1; padding: 14px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; }

/* Detail */
.detail-section { margin-bottom: 20px; }
.detail-section h3 { font-size: 14px; text-transform: uppercase; color: var(--text-light); margin-bottom: 10px; letter-spacing: 0.5px; }
.detail-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-value { font-size: 14px; color: var(--text); margin-top: 2px; }
.detail-value a { color: var(--accent); text-decoration: none; }

/* Action buttons in modal */
.action-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.action-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; font-size: 14px; font-weight: 600; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Fix: Iconos en botones */
.btn-primary .icon-svg, .btn-secondary .icon-svg {
    width: 20px; height: 20px;
    margin-right: 6px;
    vertical-align: middle;
    display: inline-block;
}

/* Fix: Iconos en acciones */
.action-btn .icon-svg {
    width: 28px; height: 28px;
    margin: 0 auto 4px auto;
    display: block;
}

/* Fix: Iconos en detalle */
.detail-row .icon-svg {
    width: 16px; height: 16px;
    color: var(--text-light);
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}

/* Fix: Renderizado post-DOM */
.icon-svg svg {
    width: 100%; height: 100%;
    stroke: currentColor;
    fill: none;
}

/* FIX: Iconos en botones primarios y secundarios */
.btn-primary .icon-svg, .btn-secondary .icon-svg {
    width: 18px !important;
    height: 18px !important;
    margin-right: 6px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* FIX: Iconos en botones de acción */
.action-btn .icon-svg {
    width: 32px !important;
    height: 32px !important;
    margin: 0 auto 6px auto !important;
    display: block !important;
}

/* FIX: Asegurar que los SVG no se desborden */
.icon-svg svg {
    max-width: 100%;
    max-height: 100%;
}

/* Stats mejorados */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 8px; 
    margin-bottom: 16px; 
}
.stat-card { 
    background: var(--card); 
    border-radius: 8px; 
    padding: 10px; 
    text-align: center; 
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.stat-number { 
    font-size: 22px; 
    font-weight: 700; 
    color: var(--accent); 
    line-height: 1;
}
.stat-label { 
    font-size: 10px; 
    color: var(--text-light); 
    margin-top: 2px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

/* Barras de progreso */
.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.stat-bar-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    font-size: 13px;
}
.stat-bar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.stat-bar-track {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.stat-bar-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    min-width: 24px;
    text-align: right;
}

/* FIX: Iconos en stats */
.stats-section .icon-svg {
    width: 16px !important;
    height: 16px !important;
    color: var(--text-light);
}
.stats-section .stat-bar-info .icon-svg {
    width: 14px !important;
    height: 14px !important;
}

/* Map Panel */
.map-panel { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); padding-bottom: 160px; }
.map-header { margin-bottom: 20px; }
.map-header h3 { font-size: 20px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.map-header p { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.map-ciudad-section { margin-bottom: 24px; }
.map-ciudad-section h4 { font-size: 16px; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.map-count { background: var(--accent); color: white; font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

.map-leads-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.map-card { background: var(--card); border-radius: 12px; padding: 14px; border: 1px solid var(--border); text-decoration: none; color: var(--text); display: block; transition: all 0.2s; }
.map-card:active { transform: scale(0.98); background: #f0f4ff; }
.map-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.map-card-name { font-weight: 600; font-size: 14px; flex: 1; }
.map-card-tipo { font-size: 10px; background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.map-card-address { font-size: 13px; color: var(--text-light); display: flex; align-items: flex-start; gap: 6px; line-height: 1.4; }
.map-card-address .icon-svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.map-card-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.map-link { font-size: 13px; color: var(--accent); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.map-link .icon-svg { width: 14px; height: 14px; }

/* FIX: Iconos en mapa */
.map-header .icon-svg { width: 24px !important; height: 24px !important; }
.map-ciudad-section h4 .icon-svg { width: 18px !important; height: 18px !important; }
.map-card-address .icon-svg { width: 14px !important; height: 14px !important; }
.map-link .icon-svg { width: 14px !important; height: 14px !important; }

/* Mapa embebido */
#embedded-map {
    width: 100%;
    height: 40vh;
    max-height: 350px;
    min-height: 200px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.map-container {
    padding: 16px;
    background: var(--bg);
    flex: 1;
    overflow-y: auto;
    padding-bottom: 120px;
}

/* Lead Card Compacta */
.lead-card { cursor: pointer; }
.lead-card:active { background: #f0f4ff; }

.lead-info-compact { padding: 8px 0; }
.lead-info-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; color: var(--text-light); }
.lead-info-row .icon-svg { width: 14px; height: 14px; flex-shrink: 0; }

.lead-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--border); }
.lead-status { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.lead-status .icon-svg { width: 14px; height: 14px; }

.lead-actions-compact { display: flex; gap: 4px; }
.lead-btn-icon { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; display: flex; align-items: center; }
.lead-btn-icon .icon-svg { width: 16px; height: 16px; color: var(--text-light); }
.lead-btn-icon:active { background: var(--bg); }

/* Detail icons */
.detail-icon-svg { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--accent); }
.detail-icon-svg .icon-svg { width: 100%; height: 100%; }

/* Detail view mejorado */
.detail-section { margin-bottom: 24px; }
.detail-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}
.detail-section h3 .icon-svg { width: 20px; height: 20px; color: var(--accent); }

.detail-grid { display: flex; flex-direction: column; gap: 12px; }

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.detail-item:last-child { border-bottom: none; }

.detail-icon-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}
.detail-icon-svg .icon-svg { width: 100%; height: 100%; }

.detail-content { flex: 1; }
.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.detail-value {
    font-size: 15px;
    color: var(--text);
    line-height: 1.4;
}
.detail-value a { color: var(--accent); text-decoration: none; }

/* Historial */
.historial-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
}
.historial-fecha {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.historial-fecha .icon-svg { width: 14px; height: 14px; }

/* Notas box */
.notas-box {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

/* Modal actions */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0 0 0;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}
.btn-primary .icon-svg, .btn-secondary .icon-svg {
    width: 16px; height: 16px;
    margin-right: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* Colores botones acción */
.lead-btn-icon.btn-call .icon-svg { color: #10b981; }
.lead-btn-icon.btn-action .icon-svg { color: #f59e0b; }
.lead-btn-icon.btn-info .icon-svg { color: #2563eb; }

/* Fecha pequeña en tarjeta */
.lead-fecha { font-size: 10px; color: #9ca3af; margin-left: 8px; }
.lead-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--card);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid #ef4444; }
.toast .icon-svg { width: 18px; height: 18px; }

/* Action Modal mejorado */
.action-content { padding: 0; }
.action-content h3 {
    padding: 20px 20px 0 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.action-content h3 .icon-svg { width: 22px; height: 22px; color: var(--accent); }

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
}
.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.action-btn:active {
    transform: scale(0.96);
    background: #f0f4ff;
}
.action-btn .icon-svg { width: 32px; height: 32px; }
.action-btn[data-action="llamar"] .icon-svg { color: #10b981; }
.action-btn[data-action="email"] .icon-svg { color: #2563eb; }
.action-btn[data-action="visita"] .icon-svg { color: #f97316; }
.action-btn[data-action="whatsapp"] .icon-svg { color: #10b981; }

/* Form mejorado */
.form-group { padding: 0 20px; margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group textarea, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    background: var(--card);
    resize: none;
}
.form-group textarea:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Modal actions mejorado */
.modal-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px 20px 20px;
    border-top: 1px solid var(--border);
}
.btn-secondary, .btn-primary {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:active { background: #e5e7eb; }
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:active { background: #1d4ed8; }

/* Botón añadir lead en header */
.header-actions { display: flex; align-items: center; gap: 12px; }
.btn-add-lead {
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    background: transparent;
    color: #4CAF50;
    border: 1.5px solid #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    min-width: fit-content;
    letter-spacing: 0.3px;
}
.btn-add-lead .btn-text { color: #4CAF50; font-weight: 700; }
.btn-add-lead .plus-sign {
    display: inline-block;
    color: #4CAF50;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    position: relative;
    top: -1px;
}
.btn-add-lead:active {
    border-color: #388E3C;
}

/* Modal añadir lead compacto y estético */
.add-lead-content { padding: 0; max-height: 85vh; overflow-y: auto; }
.add-lead-content .modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.add-lead-content .modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}
.add-lead-content .modal-header h3 .icon-svg { width: 22px; height: 22px; color: var(--accent); }
.add-lead-content .modal-body { padding: 16px 20px; }
.add-lead-content .form-group { margin-bottom: 12px; }
.add-lead-content .form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.add-lead-content input, .add-lead-content select, .add-lead-content textarea {
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 100%;
    background: var(--card);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.add-lead-content input:focus, .add-lead-content select:focus, .add-lead-content textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.add-lead-content .modal-actions {
    padding: 12px 20px 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    bottom: 0;
}
.add-lead-content .btn-secondary, .add-lead-content .btn-primary {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.add-lead-content .btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.add-lead-content .btn-primary:active { background: #1d4ed8; }

/* Filtros del mapa */
.map-filters { display: flex; gap: 8px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.map-filters select { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; background: white; }
.map-filters select:focus { border-color: var(--accent); }


/* === MAPA - RESUMEN POR CIUDAD === */
.map-summary {
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    margin: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.map-summary h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-summary h3 .icon-svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.ciudades-list {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.ciudad-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.ciudad-row:last-child {
    border-bottom: none;
}

.ciudad-row:hover {
    background: var(--bg-hover);
}

.ciudad-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ciudad-nombre {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.ciudad-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    min-width: 30px;
    text-align: right;
}

.ciudad-bar-track {
    width: 60px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.ciudad-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.map-total {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    padding: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
}

.map-total .icon-svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    margin-right: 4px;
}

/* Modal de ciudad */
.city-modal .modal-content {
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.city-modal .modal-body {
    overflow-y: auto;
    padding: 0;
}

.city-lead-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.city-lead-item:hover {
    background: var(--bg-hover);
}

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

.city-lead-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.city-lead-tipo {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
}

.city-lead-address {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
}

.city-lead-phone {
    font-size: 12px;
    color: var(--success);
    margin-top: 4px;
}

/* === ESTILOS FASE 2D - SCORING Y ACCIONES RÁPIDAS === */

/* Badge de scoring */
.lead-badge.badge-scoring {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    color: white;
}

.lead-badge.scoring-80 { background: #dc2626; }   /* 🔥 Rojo */
.lead-badge.scoring-60 { background: #ea580c; }    /* 🟢 Naranja */
.lead-badge.scoring-40 { background: #ca8a04; }    /* 🟡 Amarillo */
.lead-badge.scoring-20 { background: #6b7280; }    /* 🔵 Gris */
.lead-badge.scoring-0  { background: #374151; }     /* ⚫ Oscuro */

.lead-badges {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Próxima acción visible */
.lead-proxima-accion {
    font-size: 0.8rem;
    color: #f59e0b;
    margin-top: 4px;
    padding: 2px 0;
}

/* Botones rápidos en tarjeta */
.lead-actions-compact {
    display: flex;
    gap: 4px;
}

.lead-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
}

.lead-btn-icon.btn-action-llamar { background: #10b981; color: white; }
.lead-btn-icon.btn-action-whatsapp { background: #25d366; color: white; }
.lead-btn-icon.btn-action-noaplica { background: #6b7280; color: white; }

/* Select de scoring en filtros */
#filter-scoring option[value="80"] { color: #dc2626; font-weight: bold; }
#filter-scoring option[value="60"] { color: #ea580c; }
#filter-scoring option[value="40"] { color: #ca8a04; }
