/* ============================================================
   DYPCE Growth OS — App Styles
   ============================================================ */

/* === Login === */
.login-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: linear-gradient(135deg, var(--navy-darkest) 0%, var(--navy-dark) 50%, var(--navy) 100%);
}
.login-card { width: 400px; max-width: 90vw; }
.login-header { text-align: center; padding: var(--space-8) var(--space-5) var(--space-4); }
.login-logo { font-size: 40px; font-weight: 800; letter-spacing: -1px; color: var(--gray-900); }
.login-logo .logo-d { color: var(--primary); font-size: 48px; }
.login-subtitle { color: var(--gray-400); font-size: var(--font-sm); letter-spacing: 2px; text-transform: uppercase; margin-top: var(--space-1); }
.login-form { padding: 0 var(--space-5) var(--space-6); }
.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-size: var(--font-sm); font-weight: 500; color: var(--gray-600); margin-bottom: var(--space-1); }
.form-group input, .form-group select {
    width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--gray-200);
    border-radius: var(--radius-md); font-family: var(--font-family); font-size: var(--font-md);
    transition: border-color 0.2s; outline: none; background: white;
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,150,108,0.1); }
.form-error { background: #fee2e2; color: #991b1b; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--font-sm); margin-bottom: var(--space-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* === App Layout === */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width); background: var(--navy-darkest); color: white; display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 10; border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar__logo {
    padding: var(--space-5); font-size: 24px; font-weight: 800; letter-spacing: -1px;
    border-bottom: 1px solid rgba(255,255,255,0.05); font-family: var(--font-titles);
}
.sidebar__logo .logo-d { color: var(--vibrant-lime); font-size: 28px; }
.sidebar__nav { flex: 1; padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4);
    color: var(--slate-ice); opacity: 0.85; border-radius: var(--radius-md); font-size: var(--font-sm);
    text-decoration: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-titles); font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; opacity: 1; }
.nav-item.active {
    background: rgba(9, 195, 84, 0.1); color: var(--vibrant-lime); opacity: 1;
    border-left: 4px solid var(--vibrant-lime); border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-weight: 600;
}
.sidebar__footer { padding: var(--space-4); border-top: 1px solid rgba(255,255,255,0.05); }
.sidebar__user { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.avatar {
    width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--vibrant-lime); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--font-md); font-family: var(--font-titles);
}

/* Sidebar Material Symbol sizing */
.sidebar .nav-item .material-symbols-outlined,
.sidebar .nav-section__toggle .material-symbols-outlined {
    font-size: 20px;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    flex-shrink: 0;
    transition: color 0.2s, font-variation-settings 0.2s;
}
.sidebar .nav-item.active .material-symbols-outlined,
.sidebar .nav-section__toggle.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    color: var(--vibrant-lime);
}
.sidebar .nav-section__items .nav-item .material-symbols-outlined {
    font-size: 16px;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: var(--font-sm); font-weight: 600; color: white; }
.user-role { font-size: var(--font-xs); color: var(--slate-ice); opacity: 0.7; text-transform: capitalize; }
.main-content { flex: 1; margin-left: var(--sidebar-width); background: var(--gray-50); }
.top-header {
    display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-6);
    background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border); height: var(--header-height);
    position: sticky; top: 0; z-index: 9;
}
.header-actions { display: flex; align-items: center; gap: var(--space-3); }
.page-title { font-size: var(--font-2xl); font-weight: 700; color: var(--primary); font-family: var(--font-titles); }
.page-content { padding: var(--space-6); }
.loading { text-align: center; padding: var(--space-8); color: var(--slate-ice); }
.text-muted { color: var(--gray-500); font-size: var(--font-sm); }

/* === KPI Grid === */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi-card { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-5); }
.kpi-card__icon { width: 48px; height: 48px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-card__data { display: flex; flex-direction: column; }
.kpi-value { font-size: var(--font-3xl); font-weight: 700; color: var(--gray-900); line-height: 1; font-family: var(--font-titles); }
.kpi-label { font-size: var(--font-sm); color: var(--gray-500); margin-top: var(--space-1); }
.kpi-trend { font-size: var(--font-xs); font-weight: 600; margin-top: 4px; letter-spacing: 0.3px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.sem-row, .ind-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) 0; }
.sem-dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; margin-right: var(--space-2); flex-shrink: 0; }
.sem-count { font-weight: 600; font-size: var(--font-lg); }

/* === Leads === */
.leads-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
/* === Modern Data Tables === */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); }
.data-table { width: 100%; border-collapse: collapse; font-family: var(--font-family); }
.data-table thead tr {
    background: linear-gradient(135deg, var(--navy-darkest) 0%, var(--navy) 100%);
}
.data-table th {
    padding: 14px 16px; text-align: left; font-size: 11px; font-weight: 600;
    color: var(--slate-ice); border-bottom: none; background: transparent;
    text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-titles);
    white-space: nowrap;
}
.data-table th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
.data-table td {
    padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: var(--font-sm); color: var(--gray-700); vertical-align: middle;
}
.data-table tbody tr { transition: all 0.15s ease; position: relative; }
.data-table tbody tr:nth-child(even) td { background: rgba(175,197,218,0.04); }
.data-table tbody tr:hover td { background: rgba(9,195,84,0.04); }
.data-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--vibrant-lime); }
.data-table tbody tr:last-child td:first-child { border-radius: 0 0 0 var(--radius-lg); }
.data-table tbody tr:last-child td:last-child { border-radius: 0 0 var(--radius-lg) 0; }

/* Table avatar cell */
.tbl-avatar {
    width: 32px; height: 32px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--navy));
    color: white; display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; font-family: var(--font-titles);
    flex-shrink: 0; margin-right: 10px; vertical-align: middle;
}
.tbl-avatar.av-lime { background: linear-gradient(135deg, var(--vibrant-lime), #06a844); color: var(--primary); }
.tbl-avatar.av-amber { background: linear-gradient(135deg, var(--yellow), #e5a800); color: var(--primary); }

/* Table name cell */
.tbl-name-cell { display: inline-flex; align-items: center; gap: 0; }
.tbl-name-cell strong { font-size: 13px; font-weight: 600; color: var(--gray-800); font-family: var(--font-titles); }
.tbl-name-cell small { display: block; font-size: 11px; color: var(--gray-400); margin-top: 1px; }

/* Score pill in table */
.score-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 24px; padding: 0 8px;
    border-radius: var(--radius-full); font-size: 12px; font-weight: 700;
    color: white; font-family: var(--font-titles);
}
.score-high { background: linear-gradient(135deg, #059669, #10b981); }
.score-mid { background: linear-gradient(135deg, #d97706, #f59e0b); }
.score-low { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* Modernized search bar */
.search-bar-wrap { position: relative; display: inline-flex; align-items: center; }
.search-bar-wrap .material-symbols-outlined {
    position: absolute; left: 12px; font-size: 18px;
    color: var(--gray-400); pointer-events: none;
}
.search-bar-wrap .search-input { padding-left: 38px; }
.search-input {
    padding: 9px 14px 9px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
    font-family: var(--font-family); font-size: var(--font-sm); width: 300px; outline: none;
    background: white; transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--gray-800);
}
.search-input:focus { border-color: var(--vibrant-lime); box-shadow: 0 0 0 3px rgba(9,195,84,0.1); }

/* === Pipeline === */
.pipeline-board { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-4); min-height: calc(100vh - 180px); }
.pipeline-column { min-width: 260px; flex: 1; display: flex; flex-direction: column; }
.pipeline-column__header {
    padding: var(--space-3) var(--space-4); background: white; border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2);
}
.stage-name { font-weight: 600; font-size: var(--font-md); }
.pipeline-column__body { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); min-height: 100px; padding: var(--space-1); border-radius: var(--radius-md); transition: background 0.2s; }
.pipeline-column__body.drag-over { background: rgba(2,150,108,0.08); }
.pipeline-card { cursor: grab; }
.pipeline-card.dragging { opacity: 0.4; }
.pipeline-card__header { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--space-3) var(--space-1); }
.pipeline-card__body { padding: 0 var(--space-3); }
.pipeline-card__body span { display: block; font-size: var(--font-sm); }
.pipeline-card__footer { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3) var(--space-3); }
.empty-stage { text-align: center; padding: var(--space-6); color: var(--gray-300); font-size: var(--font-sm); }

/* === Modal === */
.modal, .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal-content { width: 600px; max-width: 90vw; max-height: calc(100vh - 40px); overflow-y: auto; background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); }
.modal-content.card { overflow-y: auto; } /* gana sobre .card { overflow: hidden } para permitir scroll interno */
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }

/* === Loading === */
.loading-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--navy-darkest), var(--navy-dark), var(--navy)); color: white; }
.loading-logo { font-size: 48px; font-weight: 800; letter-spacing: -1px; margin-bottom: var(--space-3); }
.logo-d { color: var(--primary-light, #0ab98a); font-size: 56px; }
.logo-rest { color: white; }
.loading-subtitle { font-size: var(--font-md); color: var(--primary-light, #0ab98a); letter-spacing: 2px; text-transform: uppercase; margin-bottom: var(--space-8); }
.loading-bar { width: 200px; height: 3px; background: rgba(255,255,255,0.15); border-radius: var(--radius-full); overflow: hidden; }
.loading-bar__fill { height: 100%; background: linear-gradient(90deg, var(--primary-light, #0ab98a), white); border-radius: var(--radius-full); animation: loadingBar 2s ease-in-out infinite; }

/* === Form Select === */
.form-select {
    width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--gray-200);
    border-radius: var(--radius-md); font-family: var(--font-family); font-size: var(--font-md);
    outline: none; background: white; cursor: pointer;
}
.form-select:focus { border-color: var(--primary); }

/* === Lead Detail 360° === */
.ld-back { margin-bottom: var(--space-4); }
.ld-hero { padding: var(--space-5); display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.ld-hero__main { display: flex; align-items: center; gap: var(--space-4); }
.ld-avatar-lg {
    width: 56px; height: 56px; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; display: flex; align-items: center; justify-content: center; font-size: var(--font-3xl); font-weight: 700; flex-shrink: 0;
}
.ld-hero__info h2 { font-size: var(--font-2xl); margin-bottom: 2px; }
.ld-hero__info p { color: var(--gray-500); font-size: var(--font-md); margin-bottom: var(--space-2); }
.ld-hero__badges { display: flex; align-items: center; gap: var(--space-2); }
.ld-hero__actions { display: flex; gap: var(--space-2); }
.ld-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--space-4); margin-bottom: var(--space-4); }

/* Info List */
.info-list { display: flex; flex-direction: column; }
.info-item { display: flex; justify-content: space-between; padding: var(--space-2) 0; border-bottom: 1px solid var(--gray-100); font-size: var(--font-md); }
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--gray-500); font-weight: 500; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
    display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-left: 2px solid var(--gray-200);
    margin-left: 14px; padding-left: var(--space-4); position: relative;
}
.tl-item::before {
    content: ''; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px;
    border-radius: var(--radius-full); background: var(--gray-300); border: 2px solid white;
}
.tl-note::before { background: #3b82f6; }
.tl-call::before { background: #10b981; }
.tl-email::before { background: #8b5cf6; }
.tl-meeting::before { background: #f59e0b; }
.tl-stage_change::before { background: var(--primary); }
.tl-whatsapp::before { background: #25D366; }
.tl-system::before { background: var(--gray-400); }
.tl-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.tl-content { flex: 1; min-width: 0; }
.tl-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.tl-header strong { font-size: var(--font-sm); }
.tl-content p { font-size: var(--font-md); color: var(--gray-700); margin: 0; word-break: break-word; }

/* Tasks */
.task-list { display: flex; flex-direction: column; }
.task-item {
    display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) 0;
    border-bottom: 1px solid var(--gray-100); transition: opacity 0.2s;
}
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] {
    width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}
.task-item__body { flex: 1; min-width: 0; }
.task-title { font-size: var(--font-md); font-weight: 500; display: block; }
.task-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: 2px; flex-wrap: wrap; }
.task-prio-dot { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; flex-shrink: 0; }
.task-done { opacity: 0.5; }
.task-done .task-title { text-decoration: line-through; }
.task-filters { display: flex; gap: var(--space-2); }
.task-filter { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.task-filter.active { background: var(--primary); color: white; border-color: var(--primary); }
.ld-tasks { margin-bottom: var(--space-4); }

/* === Proposal Wizard === */
.btn-accent { background: linear-gradient(135deg, #FFCE38, #f59e0b); color: #1e293b; font-weight: 600; border: none; }
.btn-accent:hover { filter: brightness(1.08); transform: translateY(-1px); }
.services-checklist { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; padding: 8px; background: var(--gray-50); border-radius: var(--radius-md); border: 1px solid var(--gray-200); }
.svc-check { display: flex; align-items: center; gap: var(--space-2); padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--font-md); transition: background 0.15s; }
.svc-check:hover { background: var(--gray-100); }
.svc-check input { accent-color: var(--primary); width: 16px; height: 16px; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.proposal-row { cursor: pointer; transition: background 0.15s; }
.proposal-row:hover { background: var(--gray-50); }

/* === Notifications Bell === */
.notif-bell { position: relative; cursor: pointer; padding: 8px; border-radius: var(--radius-md); transition: background 0.15s; display: flex; align-items: center; }
.notif-bell:hover { background: var(--gray-100); }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: white; font-size: 10px; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: pulse 2s infinite; }

/* === Toasts === */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
    min-width: 300px; padding: 16px 20px; border-radius: var(--radius-lg);
    background: white; color: var(--gray-900); box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 12px;
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    border-left: 4px solid var(--primary);
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.notif-dropdown { position: absolute; top: 52px; right: 16px; width: 360px; background: white; border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(0,0,0,0.15); z-index: 1000; border: 1px solid var(--gray-200); overflow: hidden; }
.notif-dropdown__header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.notif-dropdown__body { max-height: 320px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--gray-100); }
.notif-item:hover { background: var(--gray-50); }
.notif-unread { background: #eff6ff; border-left: 3px solid #3b82f6; }
.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: 11px; color: var(--gray-400); }
.notif-empty { padding: 24px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* === Score Breakdown === */
.score-breakdown { padding: 8px 0; }
.score-bar-group { display: flex; flex-direction: column; gap: 6px; }
.score-bar-item { display: flex; align-items: center; gap: 8px; }
.score-bar-label { font-size: 11px; color: var(--gray-500); width: 80px; text-align: right; }
.score-bar-track { flex: 1; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.score-bar-val { font-size: 11px; font-weight: 600; width: 40px; color: var(--gray-600); }
.score-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--gray-100); }
.score-detail-grid small { font-size: 11px; color: var(--gray-500); }

/* === Automations Module === */
.auto-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--gray-100); padding: 4px; border-radius: var(--radius-lg); }
.auto-tab { flex: 1; padding: 10px 16px; border: none; background: transparent; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; color: var(--gray-500); }
.auto-tab.active { background: white; color: var(--gray-900); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.template-card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); padding: 20px; cursor: pointer; transition: all 0.2s; }
.template-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(2,150,108,0.1); transform: translateY(-2px); }
.template-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.template-icon { font-size: 28px; }
.template-card__title { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.template-card__subject { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; }
.template-card__vars { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.var-tag { font-size: 10px; background: var(--gray-100); color: var(--gray-600); padding: 2px 8px; border-radius: 12px; font-family: monospace; }
.template-card__actions { display: flex; gap: 8px; }

.rules-list { display: flex; flex-direction: column; gap: 12px; }
.rule-card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); padding: 20px; transition: all 0.2s; }
.rule-card:hover { border-color: var(--gray-300); }
.rule-inactive { opacity: 0.5; }
.rule-card__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.rule-card__info { display: flex; gap: 12px; align-items: flex-start; }
.rule-icon { font-size: 24px; }
.rule-card__title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.rule-trigger { font-size: 12px; color: var(--gray-500); }
.rule-card__controls { display: flex; gap: 8px; align-items: center; }
.rule-actions-list { display: flex; flex-direction: column; gap: 6px; padding-left: 36px; }
.rule-action-item { font-size: 13px; color: var(--gray-600); padding: 4px 0; }

.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 12px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* === Lead edit button — icon only === */
.btn-edit-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border-radius: var(--radius-md); border: 1px solid var(--gray-200);
    background: transparent; color: var(--gray-500);
    cursor: pointer; transition: all 0.2s;
}
.btn-edit-icon:hover { background: var(--primary); color: white; border-color: var(--primary); transform: scale(1.05); }
.btn-edit-icon .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20; }
.nav-section { margin-bottom: 2px; }
.nav-section__toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: var(--space-2) var(--space-4); color: var(--slate-ice); opacity: 0.85; border-radius: var(--radius-md);
    font-size: var(--font-sm); text-decoration: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer;
    background: none; border: none; font-family: var(--font-titles); font-weight: 500;
}
.nav-section__toggle:hover { background: rgba(255,255,255,0.05); color: white; opacity: 1; }
.nav-section__toggle.active { color: white; opacity: 1; font-weight: 600; }
.nav-section__toggle svg { flex-shrink: 0; }
.nav-section__toggle .toggle-left { display: flex; align-items: center; gap: var(--space-3); }
.nav-section__arrow { transition: transform 0.2s; font-size: 10px; opacity: 0.7; }
.nav-section__arrow.open { transform: rotate(90deg); }
.nav-section__items {
    display: none; flex-direction: column; gap: 2px;
    padding-left: var(--space-4); margin-top: 2px;
    border-left: 1px solid rgba(175, 197, 218, 0.15); margin-left: 28px;
}
.nav-section__items.open { display: flex; }
.nav-section__items .nav-item {
    font-size: var(--font-sm); padding: 6px var(--space-3);
    font-family: var(--font-family); font-weight: 400;
}
.nav-section__items .nav-item.active {
    background: rgba(9, 195, 84, 0.08); color: var(--vibrant-lime); opacity: 1;
    border-left: 3px solid var(--vibrant-lime); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-weight: 600;
}

/* === Generic List/Detail Styles (reusable across modules) === */
.module-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); gap: var(--space-3); }
.module-toolbar .search-input { flex: 1; max-width: 360px; }
.detail-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5); margin-bottom: var(--space-4); }
.detail-header__main { display: flex; align-items: center; gap: var(--space-4); }
.detail-header__info h2 { font-size: var(--font-2xl); margin-bottom: 2px; }
.detail-header__info p { color: var(--gray-500); font-size: var(--font-md); }
.detail-header__actions { display: flex; gap: var(--space-2); }
.detail-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--space-4); margin-bottom: var(--space-4); }
.detail-section { margin-bottom: var(--space-4); }
.detail-section .card__header { display: flex; justify-content: space-between; align-items: center; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: var(--space-4); }
.tab-btn {
    padding: var(--space-2) var(--space-4); border: none; background: none; font-size: var(--font-md);
    font-weight: 500; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.2s; font-family: var(--font-family);
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Items Table (Ofertas) */
.items-table { width: 100%; border-collapse: collapse; font-size: var(--font-sm); }
.items-table th { background: var(--gray-50); padding: var(--space-2) var(--space-3); text-align: left; font-weight: 600; color: var(--gray-500); border-bottom: 1px solid var(--gray-200); }
.items-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--gray-100); }
.items-total { display: flex; justify-content: flex-end; padding: var(--space-3); font-size: var(--font-lg); font-weight: 700; color: var(--primary); }

/* Status badges */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-activo { background: #10b981; }
.status-inactivo { background: #ef4444; }
.status-prospecto { background: #f59e0b; }
.status-abierta { background: #3b82f6; }
.status-ganada { background: #10b981; }
.status-perdida { background: #ef4444; }
.status-borrador { background: #94a3b8; }
.status-enviada { background: #3b82f6; }
.status-aceptada { background: #10b981; }
.status-rechazada { background: #ef4444; }

/* === Responsive === */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}
/* Botón hamburguesa + fondo del cajón (solo aparecen en móvil) */
.mobile-menu-btn {
    display: none; background: none; border: none; cursor: pointer;
    color: var(--primary); padding: 4px; align-items: center; justify-content: center;
}
.mobile-menu-btn .material-symbols-outlined { font-size: 28px; }
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0, 14, 35, 0.5);
    z-index: 1090; -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    /* El sidebar pasa a ser un cajón deslizante en vez de ocultarse */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1100;
    }
    .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, 0.45); }
    .sidebar-backdrop.is-open { display: block; }
    .mobile-menu-btn { display: inline-flex; }
    .main-content { margin-left: 0; }
    .kpi-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .pipeline-board { flex-direction: column; }
    .pipeline-column { min-width: 100%; }
}


/* === Phase 3: AI Copilot Styles === */
.copilot-page { max-width: 900px; }
.copilot-hero { display: flex; align-items: center; gap: 16px; padding: 20px 24px; }
.copilot-hero__icon { font-size: 36px; }
.copilot-hero__info h2 { margin-bottom: 2px; }
.copilot-status { margin-left: auto; }
.copilot-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.copilot-card { min-height: 180px; }
.ai-result { padding: 8px 0; }
.ai-result h4 { font-size: 16px; }
.ai-result h5 { font-size: 13px; }
.ai-result ul { list-style: disc; }
.ai-result ul li { margin-bottom: 4px; font-size: 13px; line-height: 1.5; }
.badge-success { background: #10b981; color: white; }
.badge-error { background: #ef4444; color: white; }
.badge-warning { background: #f59e0b; color: white; }
@media (max-width: 768px) {
    .copilot-grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   PHASE 4: MARKETING + SOCIAL MEDIA
   ========================================================================== */

/* Marketing Page */
.marketing-page { padding: 0; }
.marketing-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 0; border-bottom: 1px solid var(--gray-200);
}
.marketing-header h1 { font-size: 1.6rem; margin: 0; }
.marketing-header .subtitle { color: var(--gray-500); margin-top: 4px; }
.btn-ai-agent {
    background: linear-gradient(135deg, var(--primary), var(--navy));
    color: white; border: none; padding: 10px 20px; border-radius: 10px;
    cursor: pointer; font-weight: 600; transition: all 0.3s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-ai-agent:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,14,35,0.3); }
.btn-ai-agent:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Marketing Tabs */
.marketing-tabs {
    display: flex; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
}
.mtab {
    padding: 8px 18px; border: none; background: transparent; cursor: pointer;
    border-radius: 8px; font-size: 0.85rem; white-space: nowrap; transition: all 0.2s;
    color: var(--gray-500);
}
.mtab:hover { background: var(--gray-100); }
.mtab.active { background: var(--primary); color: white; font-weight: 600; }

/* KPI Cards */
.mkt-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; padding: 20px 0;
}
.kpi-card {
    background: white; border: 1px solid var(--gray-200); border-radius: 14px;
    padding: 20px; text-align: center; transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-3px); }
.kpi-icon { font-size: 2rem; margin-bottom: 8px; }
.kpi-value { font-size: 2.2rem; font-weight: 700; color: var(--gray-900); }
.kpi-label { font-size: 0.85rem; color: var(--gray-500); margin-top: 4px; }
.kpi-sub { font-size: 0.75rem; color: var(--gray-500); margin-top: 6px; opacity: 0.8; }
.kpi-campaigns { border-left: 4px solid #3b82f6; }
.kpi-social { border-left: 4px solid #10b981; }
.kpi-ai { border-left: 4px solid var(--vibrant-lime); }
.kpi-selling { border-left: 4px solid #f59e0b; }

.mkt-engagement {
    background: white; border-radius: 14px; padding: 20px; margin-top: 8px;
    border: 1px solid var(--gray-200);
}
.engagement-row { display: flex; gap: 30px; margin-top: 12px; }
.eng-item { font-size: 1.1rem; font-weight: 600; }

/* Calendar */
.calendar-view { padding: 20px 0; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-total { color: var(--gray-500); font-size: 0.85rem; }
.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    background: var(--gray-200); border-radius: 12px; overflow: hidden;
}
.cal-header {
    background: var(--primary); color: white; text-align: center; padding: 10px;
    font-weight: 600; font-size: 0.8rem;
}
.cal-day {
    background: white; min-height: 70px; padding: 8px; position: relative;
}
.cal-day.empty { background: var(--gray-100); }
.cal-day.today { background: rgba(59,130,246,0.1); }
.day-num { font-weight: 600; font-size: 0.85rem; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.cal-dot {
    width: 8px; height: 8px; border-radius: 50%; cursor: pointer;
}
.cal-dot.linkedin { background: #0a66c2; }
.cal-dot.facebook { background: #1877f2; }
.cal-dot.instagram { background: #e4405f; }
.cal-dot.whatsapp { background: #25d366; }

/* Campaigns Table */
.campaigns-section { padding: 20px 0; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; }
.data-table th { background: var(--gray-100); padding: 12px 14px; text-align: left; font-size: 0.8rem; text-transform: uppercase; color: var(--gray-500); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); font-size: 0.9rem; }
.data-table tr:hover td { background: var(--gray-100); }
.badge-status { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-paused { background: #fecaca; color: #991b1b; }
.badge-completed { background: rgba(0,14,35,0.08); color: var(--primary); }
.badge-new { background: #ede9fe; color: #5b21b6; }
.badge-converted { background: #d1fae5; color: #065f46; }
.badge-dismissed { background: #f3f4f6; color: #6b7280; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-executed { background: rgba(9,195,84,0.12); color: #059669; }
.badge-rejected { background: #fecaca; color: #991b1b; }
.badge-ai { background: linear-gradient(135deg, var(--primary), var(--navy)); color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; }
.badge-seg { background: rgba(175,197,218,0.2); color: var(--primary); padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; }
.btn-sm { padding: 4px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.8rem; transition: all 0.2s; }
.btn-start { background: #10b981; color: white; }
.btn-del { background: #fee2e2; color: #dc2626; }
.btn-convert { background: #10b981; color: white; }
.btn-dismiss { background: #f3f4f6; color: #6b7280; }
.btn-approve { background: #10b981; color: white; }
.btn-reject { background: #fee2e2; color: #dc2626; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn-secondary { background: var(--gray-100); color: var(--gray-900); border: 1px solid var(--gray-200); padding: 10px 20px; border-radius: 10px; cursor: pointer; }
.empty-state { text-align: center; padding: 40px; color: var(--gray-500); font-size: 0.95rem; }

/* Intent Alert Cards */
.social-selling-section { padding: 20px 0; }
.intent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.intent-card {
    background: white; border: 1px solid var(--gray-200); border-radius: 14px;
    padding: 18px; transition: transform 0.2s;
}
.intent-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.intent-card.intent-new { border-left: 4px solid #f59e0b; }
.intent-card.intent-converted { border-left: 4px solid #10b981; opacity: 0.7; }
.intent-card.intent-dismissed { border-left: 4px solid #9ca3af; opacity: 0.5; }
.intent-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.source-badge { padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.source-badge.whatsapp { background: #d1fae5; color: #065f46; }
.source-badge.linkedin { background: rgba(0,14,35,0.08); color: var(--primary); }
.source-badge.reddit { background: #fef3c7; color: #92400e; }
.source-badge.google { background: #fce7f3; color: #9d174d; }
.intent-score { position: relative; width: 80px; height: 6px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.score-bar { position: absolute; left: 0; top: 0; height: 100%; background: linear-gradient(90deg, #10b981, #f59e0b); border-radius: 4px; transition: width 0.5s; }
.score-text { position: absolute; right: -35px; top: -6px; font-size: 0.75rem; font-weight: 700; }
.intent-author { font-size: 0.95rem; }
.intent-author strong { color: var(--gray-900); }
.author-handle { color: var(--gray-500); font-size: 0.85rem; margin-left: 6px; }
.intent-company { color: var(--gray-500); font-size: 0.8rem; margin-top: 2px; }
.intent-content { background: var(--gray-100); padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-style: italic; color: var(--gray-900); font-size: 0.9rem; line-height: 1.5; }
.intent-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.tag { background: var(--gray-100); padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; color: var(--gray-500); }
.intent-response { background: rgba(0,14,35,0.05); padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; margin: 8px 0; border-left: 3px solid var(--primary); }
.intent-actions { display: flex; gap: 8px; margin-top: 12px; }

/* AI Suggestions */
.suggestions-section { padding: 20px 0; }
.suggestions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.suggestion-card {
    background: white; border: 1px solid var(--gray-200); border-radius: 14px;
    padding: 18px; transition: all 0.2s;
}
.suggestion-card:hover { transform: translateY(-2px); }
.suggestion-card.sug-pending { border-left: 4px solid #f59e0b; }
.suggestion-card.sug-approved, .suggestion-card.sug-executed { border-left: 4px solid #10b981; opacity: 0.75; }
.suggestion-card.sug-rejected { border-left: 4px solid #ef4444; opacity: 0.5; }
.sug-header { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.sug-type { background: var(--gray-100); padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; }
.sug-priority { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.priority-alta { color: #dc2626; }
.priority-media { color: #f59e0b; }
.priority-baja { color: #6b7280; }
.sug-platform { font-size: 0.75rem; color: var(--gray-500); }
.suggestion-card h4 { margin: 6px 0; font-size: 1rem; color: var(--gray-900); }
.sug-content { font-size: 0.88rem; color: var(--gray-500); line-height: 1.5; margin: 8px 0; }
.sug-reasoning { font-size: 0.8rem; color: var(--navy); background: rgba(0,14,35,0.04); padding: 8px 12px; border-radius: 8px; margin: 8px 0; border-left: 2px solid var(--vibrant-lime); }
.sug-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Social Media Page */
.social-page { padding: 0; }
.social-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--gray-200); }
.social-content { display: grid; grid-template-columns: 1fr 280px; gap: 20px; padding: 20px 0; }
.social-sidebar {
    background: white; border: 1px solid var(--gray-200); border-radius: 14px;
    padding: 18px; height: fit-content; position: sticky; top: 20px;
}
.social-sidebar h3 { font-size: 0.9rem; margin-bottom: 12px; }
.account-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-200); }
.account-status { margin-left: auto; }
.platform-icon { font-size: 1.2rem; }

/* Post Cards */
.post-card {
    background: white; border: 1px solid var(--gray-200); border-radius: 14px;
    padding: 18px; margin-bottom: 12px; transition: transform 0.2s;
}
.post-card:hover { transform: translateY(-2px); }
.post-card.post-published { border-left: 4px solid #10b981; }
.post-card.post-scheduled { border-left: 4px solid #3b82f6; }
.post-card.post-draft { border-left: 4px solid #f59e0b; }
.post-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-type { font-size: 0.75rem; color: var(--gray-500); text-transform: capitalize; }
.post-content { font-size: 0.9rem; line-height: 1.6; margin: 8px 0; }
.post-hashtags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.hashtag { color: var(--primary); font-size: 0.85rem; }
.post-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-200); }
.post-date { font-size: 0.8rem; color: var(--gray-500); }
.post-actions { display: flex; gap: 8px; align-items: center; }
.btn-publish { background: var(--primary); color: white; }
.btn-publish-now { background: #10b981; color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.metrics-inline { font-size: 0.8rem; color: var(--gray-500); }

/* Post Composer Modal */
.modal-wide { max-width: 600px; }
.composer-body { padding: 20px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.form-row select, .form-row input, .form-row textarea {
    width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--gray-200);
    background: white; color: var(--gray-900); font-size: 0.9rem; font-family: inherit;
}
.form-row textarea { resize: vertical; }
.btn-ai-gen {
    margin-top: 8px; background: linear-gradient(135deg, var(--primary), var(--navy));
    color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer;
    font-size: 0.85rem; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-ai-gen:hover { opacity: 0.9; box-shadow: var(--shadow-md); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Loading */
.loading-pulse { text-align: center; padding: 40px; color: var(--gray-500); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }


/* ==========================================================================
   PHASE 5: REPORTS + ADMIN + PWA
   ========================================================================== */

/* Reports */
.reports-page { padding: 0; }
.reports-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--gray-200); }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 20px 0; }
.report-card { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; cursor: pointer; transition: all 0.2s; }
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.report-icon { font-size: 2rem; margin-bottom: 10px; }
.report-card h3 { font-size: 1rem; margin: 6px 0; }
.report-card p { font-size: 0.85rem; color: var(--gray-500); }
.report-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-excel { background: #d1fae5; color: #065f46; }
.btn-preview { background: var(--gray-100); color: var(--gray-900); }
.report-preview { padding: 20px 0; }
.report-result { background: white; border: 1px solid var(--gray-200); border-radius: 14px; padding: 24px; }
.report-title-bar { display: flex; justify-content: space-between; align-items: center; }
.report-date { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.report-summary { display: flex; gap: 30px; margin: 16px 0; font-size: 1.05rem; }
.report-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 16px 0; }
.rm { text-align: center; padding: 16px; background: var(--gray-100); border-radius: 12px; }
.rm-val { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.rm-label { display: block; font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.funnel-chart { margin: 16px 0; }
.funnel-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.funnel-label { width: 120px; font-size: 0.85rem; text-align: right; }
.funnel-bar-wrap { flex: 1; background: var(--gray-100); border-radius: 8px; height: 32px; overflow: hidden; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--vibrant-lime)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.85rem; min-width: 30px; transition: width 0.5s; }

/* Reportes v2 */
.report-card.active-report { border-color: var(--vibrant-lime); box-shadow: 0 0 0 2px rgba(9,195,84,0.18); }
.report-card .report-icon { display: flex; }
.rp-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin: 18px 0 14px; }
.rp-period-group { display: inline-flex; background: var(--gray-100); border-radius: 9999px; padding: 3px; gap: 2px; }
.rp-period-btn { border: none; background: transparent; cursor: pointer; padding: 6px 16px; border-radius: 9999px; font-size: 13px; font-weight: 600; color: var(--gray-500); transition: all 0.2s; }
.rp-period-btn.active { background: var(--primary); color: white; }
.rp-select { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 13px; min-width: 220px; background: white; }
.rp-section { margin-top: 20px; }
.rp-section-title { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 700; color: var(--primary); margin: 0 0 10px; font-family: var(--font-titles); }
.rp-ai { background: rgba(9,195,84,0.05); border: 1px solid rgba(9,195,84,0.25); border-radius: 12px; padding: 16px 18px; margin: 16px 0 4px; }
.rp-ai-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary); margin-bottom: 8px; font-family: var(--font-titles); }
.rp-ai-body { font-size: 13.5px; color: #334155; line-height: 1.65; }

/* Vista previa de lanzamiento de campaña */
.launch-step { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.launch-step-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 6px; }
.launch-step-sub { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.launch-step-body { font-size: 13px; color: #334155; line-height: 1.5; white-space: pre-wrap; max-height: 140px; overflow-y: auto; }

/* Admin */
.admin-page { padding: 0; }
.admin-header { padding: 20px 0; border-bottom: 1px solid var(--gray-200); }
.admin-tabs { display: flex; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--gray-200); overflow-x: auto; }
.atab { padding: 8px 18px; border: none; background: transparent; cursor: pointer; border-radius: 8px; font-size: 0.85rem; color: var(--gray-500); transition: all 0.2s; }
.atab:hover { background: var(--gray-100); }
.atab.active { background: var(--primary); color: white; font-weight: 600; }
.badge-role { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-director_comercial { background: rgba(0,14,35,0.08); color: var(--primary); }
.badge-vendedor { background: #d1fae5; color: #065f46; }
.status-active { color: #10b981; font-size: 0.85rem; }
.status-inactive { color: #9ca3af; font-size: 0.85rem; }
.btn-edit { background: rgba(0,14,35,0.06); color: var(--primary); }
.stages-list { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; }
.stage-item { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: white; border: 1px solid var(--gray-200); border-radius: 10px; }
.stage-order { font-weight: 700; color: var(--gray-500); width: 30px; }
.stage-name { flex: 1; font-weight: 600; }
.stage-color { width: 20px; height: 20px; border-radius: 50%; }
.flags-list { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.flag-item { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: white; border: 1px solid var(--gray-200); border-radius: 10px; }
.flag-info p { font-size: 0.8rem; color: var(--gray-500); margin: 2px 0 0; }
.toggle-switch { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 26px; cursor: pointer; transition: 0.3s; }
.toggle-slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.config-group { margin: 16px 0; }
.config-group h4 { text-transform: capitalize; color: var(--gray-500); margin-bottom: 8px; }
.config-item { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.config-item label { width: 200px; font-size: 0.85rem; font-weight: 600; }
.config-input { flex: 1; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: 8px; background: white; color: var(--gray-900); }

/* Dark Mode Toggle */
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--gray-200); margin-top: auto; }
.theme-toggle { width: 100%; padding: 8px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--gray-100); color: var(--gray-900); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.theme-toggle:hover { background: var(--gray-100); }
