/* ============================================
   GESTI+ SALES HUB - Design System
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --purple: #7c3aed;
    --purple-light: #ede9fe;
    --teal: #0d9488;
    --teal-light: #ccfbf1;
    --indigo: #4f46e5;

    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
    --transition: 0.2s ease;
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    /* 4 ago 2026 — era "max-width: 100vw". En Chrome/Edge la unidad vw INCLUYE el ancho de
       la barra de scroll vertical (~15px): el body quedaba 15px más ancho que la ventana y
       el "overflow-x: hidden" de la línea de arriba se comía esa franja. Se perdía el borde
       derecho de TODAS las pantallas — el botón de la última columna de una tabla, el borde
       de la última tarjeta. "100%" es el ancho real disponible. */
    max-width: 100%;
}

/* 4 ago 2026 — EL CONTENEDOR QUE NO CONTENÍA.

   `body` es flex y `.main-content` trae `flex: 1; min-width: 0` desde hace meses — pero
   entre los dos hay un `<div id="appContainer">` que envuelve el sidebar y el main y que
   NO estaba declarado en ninguna parte, así que era `display: block`. Resultado: el main
   nunca fue un elemento flexible de nadie, y ese `flex: 1; min-width: 0` no hacía nada.
   El appContainer, como único hijo flexible del body, crecía hasta el ancho de su
   contenido y el `overflow-x: hidden` del body se comía lo que sobraba.

   Medido en banco (scripts/app_layout_probe.mjs, sección pipeline, ventana 1902px):
     antes  → #appContainer 3076px · #pipelineBoard ancho 2772 y scrollWidth 2772
              (o sea: NADA que desplazar, 1174px de tablero recortados y fuera de alcance)
     después → #appContainer 1902px · #pipelineBoard visible 1598 y scrollWidth 3252
              (la barra del tablero aparece y las 12 etapas de Pensiones se alcanzan)

   Esto es lo que había detrás de *"El pipeline no me deja recorrer para ver las demás
   etapas"*: el `overflow-x: auto` del tablero estaba bien puesto, pero nunca se activaba
   porque su contenedor jamás le puso un límite de ancho. Tocaba una línea más arriba de
   donde se estuvo buscando. */
#appContainer {
    width: 100%;
    min-width: 0;
    display: flex;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-profile {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

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

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

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
}

.nav-menu {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.nav-icon { font-size: 18px; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-selector {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.user-selector option {
    background: #1e293b;
    color: white;
}

/* ============================================
   MOBILE HEADER
   ============================================ */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #1e293b;
    color: white;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 99;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.mobile-title { font-weight: 700; font-size: 16px; }

.mobile-user {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    /* Sin esto, el flex item toma su ancho min-content (tablas anchas del Plan
       Semanal) y se expande más allá del viewport → las tablas se cortan sin
       scroll. Con min-width:0 respeta "viewport − sidebar" y los .ps-scroll
       muestran su scrollbar horizontal. */
    min-width: 0;
    /* 4 ago 2026 — el padding lateral vive en una variable porque hay reglas que
       necesitan el MISMO número con signo cambiado. El tablero de Pipeline sangra a los
       bordes en móvil con `margin: 0 -14px`, y ese 14 estaba escrito a mano: cuando el
       padding baja a 10px en pantallas de ≤420px, el sangrado se pasaba 4px por lado y la
       página desbordaba 14px sin barra (medido en banco a 414px: #page-pipeline
       scrollWidth 490 contra clientWidth 476). Con la variable, los dos números no se
       pueden volver a desfasar. */
    --pad-lateral: 32px;
    padding: 24px var(--pad-lateral);
    min-height: 100vh;
    overflow-x: hidden;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
/* Páginas con tablas/boards anchos: constreñir el ancho para que scrollen DENTRO
   (mismo parche probado de Pipeline). Sin esto las tablas del Plan Semanal /
   Dashboard / Ranking presencial se salen del viewport y se cortan sin scroll. */
#page-pipeline,
#page-plan-semanal,
#page-dashboard,
#page-ranking,
#page-campanas,
#page-equipo {
    /* 4 ago 2026 — era calc(100vw - sidebar - 64px), que arrastra el mismo error de la barra
       de scroll que el body (ver arriba) y dejaba la página ~15px más ancha que su
       contenedor. 100% es exactamente el ancho disponible, y desde que .main-content lleva
       min-width:0 no hace falta calcularlo a mano.
       Campañas y Equipo entran a la lista: eran las dos que faltaban y las dos tienen tablas
       anchas (Registro de Gasto, Leads de Landing, Historial de Ventas). */
    max-width: 100%;
}
@media (max-width: 768px) {
    #page-pipeline,
    #page-plan-semanal,
    #page-dashboard,
    #page-ranking,
    #page-campanas,
    #page-equipo { max-width: 100%; }
}

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-left: 4px solid var(--primary);
    transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-ventas { border-left-color: var(--primary); }
.kpi-comision { border-left-color: var(--success); }
.kpi-pipeline { border-left-color: var(--warning); }
.kpi-promedio { border-left-color: var(--purple); }

.kpi-icon { font-size: 28px; }

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

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

.progress-fill.green { background: var(--success); }

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-grid {
    display: grid;
    /* 4 ago 2026 — minmax(0, ...) por el canvas de Chart.js: tiene ancho intrínseco y con
       "2fr 1fr" a secas empuja su columna más allá del contenedor (mismo caso que Campañas). */
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card { min-height: 300px; }
/* La gráfica nunca debe salir más ancha que su tarjeta. Esto sólo estaba declarado para
   Campañas y dentro del media query de móvil. */
.chart-card canvas { max-width: 100%; }

.activity-list {
    max-height: 280px;
    overflow-y: auto;
}

.activity-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

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

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-dot.sale { background: var(--success); }
.activity-dot.lead { background: var(--primary); }
.activity-dot.move { background: var(--warning); }

.activity-text {
    font-size: 13px;
    line-height: 1.4;
}

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

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* ============================================
   DASHBOARD STATS ROW (Ritmo, Racha, Badge)
   ============================================ */
.dash-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.stat-icon { font-size: 32px; flex-shrink: 0; }
.stat-body { flex: 1; min-width: 0; }
.stat-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.stat-ritmo { border-left: 4px solid var(--primary); }
.stat-racha { border-left: 4px solid #f59e0b; }
.stat-badge { border-left: 4px solid #8b5cf6; }

.stat-racha .stat-value { color: #f59e0b; }

/* Badge levels */
.badge-bronce .stat-value { color: #b45309; }
.badge-plata .stat-value { color: #6b7280; }
.badge-oro .stat-value { color: #d97706; }
.badge-diamante .stat-value { color: #7c3aed; }

.badge-progress-ring {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

/* Mini ranking card */
.dash-ranking-card {
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: white;
}

.dash-ranking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.dash-ranking-icon { font-size: 20px; }
.dash-ranking-title { font-size: 13px; font-weight: 600; opacity: 0.9; }

.dash-ranking-body {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.dash-ranking-position {
    font-size: 36px;
    font-weight: 900;
}

.dash-ranking-detail {
    font-size: 14px;
    opacity: 0.85;
}

/* 23 oct 2026 (plan A5) — "Asesor vs meta del mes" en Ranking, lista para presentar.
   El botón Presentar la pone en pantalla completa (Fullscreen API) con letra grande. */
.meta-asesor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.meta-asesor-sub { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.meta-asesor-table td, .meta-asesor-table th { white-space: nowrap; }
.meta-asesor-bar { display: inline-block; vertical-align: middle; width: 90px; height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-right: 6px; }
.meta-asesor-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.meta-asesor-bar > span.ok { background: var(--success); }
.meta-asesor-neg { color: var(--danger); font-weight: 600; }
.meta-asesor-pos { color: var(--success); font-weight: 600; }
.meta-asesor-card:fullscreen { background: var(--bg-card); padding: 40px 48px; overflow: auto; }
.meta-asesor-card:fullscreen h3 { font-size: 30px; }
.meta-asesor-card:fullscreen .meta-asesor-sub { font-size: 18px; }
.meta-asesor-card:fullscreen .meta-asesor-table { font-size: 22px; }
.meta-asesor-card:fullscreen .meta-asesor-table td,
.meta-asesor-card:fullscreen .meta-asesor-table th { padding: 14px 16px; }
.meta-asesor-card:fullscreen .meta-asesor-bar { width: 160px; height: 14px; }
@media print { .meta-asesor-head button { display: none; } }

/* Goals grid in Equipo */
.goals-grid {
    display: grid;
    gap: 12px;
}

.goal-row {
    display: grid;
    grid-template-columns: auto 1fr 120px 120px;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.goal-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.goal-name { font-weight: 600; font-size: 14px; }
.goal-role { font-size: 11px; color: var(--text-muted); }

.goal-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

.goal-input:focus { border-color: var(--primary); outline: none; }

/* Motivation enhanced */
.motivation-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
}

.motivation-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.motivation-emoji { font-size: 40px; flex-shrink: 0; }

.motivation-content p {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}

.motivation-tip {
    width: 100%;
    font-size: 13px !important;
    opacity: 0.75;
    font-weight: 400 !important;
    margin-top: -4px;
    font-style: italic;
}

@media (max-width: 768px) {
    .dash-stats-row { grid-template-columns: 1fr; }
    .goal-row { grid-template-columns: auto 1fr; }
    .goal-row .goal-input { grid-column: span 1; }
    .stat-value { font-size: 20px; }
    .badge-progress-ring { display: none; }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-secondary:hover { background: var(--bg); }

.btn-icon {
    background: none;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 12px;
}

.btn-icon:hover { background: var(--bg); }

.btn-danger {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.btn-danger:hover { opacity: 1; }

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    border: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow);
}

.range-value {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
}

/* ============================================
   SIMULATOR
   ============================================ */
.simulator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.sim-result-main {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, #eff6ff 100%);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.sim-big-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -2px;
}

.sim-currency {
    font-size: 28px;
    vertical-align: super;
}

.sim-period {
    font-size: 14px;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.sim-breakdown { padding: 0 8px; }

.sim-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.sim-row span:last-child {
    font-weight: 600;
    color: var(--text);
}

.sim-row.highlight {
    color: var(--text);
    font-weight: 500;
}

.sim-row.big {
    font-size: 18px;
    padding-top: 12px;
}

.sim-row.big span:last-child {
    color: var(--success);
    font-weight: 800;
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.scenario-card {
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.scenario-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.scenario-card h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

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

.scenario-result {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

/* Tiers / Comisiones Panel */
.tiers-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-left: 2px;
}

.tier-current-range {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--primary);
}

.tier-current-range strong {
    color: var(--primary);
}

.tiers-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tiers-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tier-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    border-left: 3px solid var(--border);
    transition: all var(--transition);
}

.tier-row.active {
    background: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.tier-row .tier-range {
    flex: 1;
    color: var(--text);
}

.tier-row .tier-rate {
    font-weight: 800;
    font-size: 16px;
    color: var(--primary);
    min-width: 60px;
    text-align: right;
}

.tier-row .tier-badge {
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.tier-row .tier-earning {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 12px;
    min-width: 80px;
    text-align: right;
}

/* Tier breakdown in results */
.tier-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
}

.tier-breakdown-row.active-tier {
    background: var(--success-light);
    border-left: 3px solid var(--success);
}

.tier-breakdown-row .tier-info {
    display: flex;
    flex-direction: column;
}

.tier-breakdown-row .tier-label {
    font-weight: 600;
    color: var(--text);
}

.tier-breakdown-row .tier-detail {
    font-size: 11px;
    color: var(--text-muted);
}

.tier-breakdown-row .tier-amount {
    font-weight: 800;
    color: var(--success);
}

/* ============================================
   PRORRATEO
   ============================================ */
.prorrateo-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.prorrateo-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.prorrateo-item {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.prorrateo-item h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.prorrateo-item .value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.prorrateo-item .detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   RANKING / PODIUM
   ============================================ */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 30px;
    padding: 20px;
}

.podium-place {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.podium-crown { font-size: 28px; }

.podium-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: white;
}

.first .podium-avatar { width: 70px; height: 70px; font-size: 24px; background: var(--warning); }
.second .podium-avatar { background: #94a3b8; }
.third .podium-avatar { background: #b45309; }

.podium-name { font-weight: 700; font-size: 14px; }
.podium-sales { font-size: 12px; color: var(--text-secondary); }

.podium-block {
    padding: 12px 32px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-weight: 800;
    font-size: 20px;
    color: white;
}

.first .podium-block { background: var(--warning); padding-top: 30px; }
.second .podium-block { background: #94a3b8; padding-top: 20px; }
.third .podium-block { background: #b45309; padding-top: 14px; }

/* 4 ago 2026 — esta regla SÓLO existía dentro del @media (max-width:768px), así que en
   escritorio no había ningún contenedor con scroll: las tablas de 8 columnas (Leads de
   Landing en Campañas, Historial de Ventas en Equipo) se salían del ancho y el
   "overflow-x: hidden" de .main-content las recortaba en seco — la fila se veía cortada a
   media columna y sin barra para desplazarla. Ahora scrollean DENTRO de su tarjeta. */
.ranking-table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ranking-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ranking-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.ranking-table tr:hover { background: var(--bg); }

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
}

.rank-1 { background: var(--warning-light); color: #b45309; }
.rank-2 { background: #f1f5f9; color: #64748b; }
.rank-3 { background: #fef3c7; color: #92400e; }

/* ============================================
   PIPELINE
   ============================================ */
.pipeline-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 20px;
    /* 4 ago 2026 — Marco: *"El pipeline no me deja recorrer para ver las demás etapas"*.
       El tablero SÍ scrolleaba, pero su barra horizontal vive al fondo del elemento — y con
       una columna de 468 tarjetas ("No aplico") el fondo queda a varias pantallas de scroll
       hacia abajo. En la práctica la barra no existía: para llegar a las últimas etapas
       había que adivinar shift+rueda.
       Acotando el alto del tablero al viewport, la barra horizontal queda SIEMPRE visible
       abajo y cada columna scrollea por dentro. El 300px descontado es sidebar + encabezado
       de página + los tres botones de embudo. */
    /* 4 ago 2026, 2º intento — el primero le puso scroll en LOS DOS ejes al tablero
       (overflow-x + overflow-y): con eso, para llegar a la barra horizontal había que bajar
       primero por dentro del tablero. El alto lo resuelve mejor cada columna por dentro
       (regla de abajo), que además es como se comporta cualquier tablero de tarjetas
       conocido: los encabezados con la etapa y el conteo se quedan fijos a la vista.

       Aviso al que venga: aquí decía que el tablero abría corrido por el «anclaje de scroll»
       de Chrome. ERA FALSO y costó tres intentos de arreglo. Medido en banco headless
       (scripts/pipeline_layout_probe.mjs, escenarios anchoring_from_zero / anchoring_scrolled):
       el contenido crece bajo el scroll y el offset no se mueve ni un pixel. La causa real no
       era de CSS — el tablero se quedaba corrido porque NADIE lo devolvía al principio, ni el
       repintado ni el volver a la página. Está explicado y arreglado en app/js/app.js,
       arriba de refreshPipeline(). No busques por aquí. */
    overflow-y: visible;
    align-items: flex-start;
}

/* Cada columna scrollea por dentro. Así el tablero nunca crece hacia abajo, su barra
   horizontal queda siempre a la vista, y el encabezado con la etapa y el conteo —que es lo
   que se lee de un vistazo— no se va con las tarjetas. */
.pipeline-column .column-cards {
    max-height: calc(100vh - 380px);
    overflow-y: auto;
    overflow-x: hidden;
}

.pipeline-column {
    min-width: 220px;
    max-width: 260px;
    flex-shrink: 0;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.column-dot.red { background: var(--danger); }
.column-dot.orange { background: #f97316; }
.column-dot.amber { background: #f59e0b; }
.column-dot.yellow { background: var(--warning); }
.column-dot.blue { background: var(--primary); }
.column-dot.purple { background: var(--purple); }
.column-dot.teal { background: var(--teal); }
.column-dot.indigo { background: var(--indigo); }
.column-dot.green { background: var(--success); }

.column-header h4 { font-size: 12px; flex: 1; font-weight: 700; }

.column-count {
    background: var(--border);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.column-cards { display: flex; flex-direction: column; gap: 8px; min-height: 100px; }

.lead-card {
    background: white;
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
}

.lead-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.lead-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.lead-card-amount { font-size: 14px; font-weight: 700; color: var(--primary); }
.lead-card-product { font-size: 11px; color: var(--text-muted); }

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

.lead-card-asesor { font-size: 11px; color: var(--text-secondary); }

.lead-card-actions {
    display: flex;
    gap: 4px;
}

.lead-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
}

.lead-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.lead-btn.advance { color: var(--success); }
.lead-btn.advance:hover { background: var(--success-light); border-color: var(--success); }

/* ============================================
   CALCULATOR
   ============================================ */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
}

.calc-panel { display: none; }
.calc-panel.active { display: block; }

.calc-big { display: flex; flex-direction: column; gap: 12px; }

.calc-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-radius: var(--radius-sm);
}

.calc-item.highlight { background: var(--warning-light); }
.calc-item.success { background: var(--success-light); }
/* Semáforo de pensiones: 4 colores, no un pasa/no-pasa. 29 jul 2026 — se agregan
   amarillo y gris; antes la calculadora solo tenía verde/rojo y forzaba a un binario
   que el negocio no tiene (el 68% de los leads cae en amarillo). */
.calc-item.pension-pass { background: var(--success-light); border-left: 4px solid var(--success); }
.calc-item.pension-fail { background: var(--danger-light); border-left: 4px solid var(--danger); }
.calc-item.pension-warn { background: var(--warning-light); border-left: 4px solid var(--warning); }
.calc-item.pension-unknown { background: var(--bg); border-left: 4px solid var(--text-muted); }
/* La tarjeta de la regla de cobro reusa los mismos colores. */
.calc-speech-tip.pension-pass { border-left: 4px solid var(--success); }
.calc-speech-tip.pension-fail { border-left: 4px solid var(--danger); }
.calc-speech-tip.pension-warn { border-left: 4px solid var(--warning); }
.calc-speech-tip.pension-unknown { border-left: 4px solid var(--text-muted); }

.calc-label { font-size: 14px; color: var(--text-secondary); }
.calc-value { font-size: 16px; font-weight: 700; }

.calc-speech-tip {
    margin-top: 20px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
    border-left: 3px solid var(--primary);
}

/* ============================================
   SCRIPTS
   ============================================ */
.scripts-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: inherit;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.script-panel { display: none; }
.script-panel.active { display: block; animation: fadeIn 0.3s ease; }

.script-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.script-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
}

.script-text mark {
    background: var(--warning-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.script-tip {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
    border-left: 3px solid var(--success);
}

.objection-list { display: flex; flex-direction: column; gap: 16px; }

.objection {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.objection-q {
    font-weight: 700;
    font-size: 14px;
    color: var(--danger);
    margin-bottom: 8px;
}

.objection-a {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.checklist-items { display: flex; flex-direction: column; gap: 8px; }

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.checklist-item:hover { background: var(--primary-light); }

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.tips-list { display: flex; flex-direction: column; gap: 8px; }

.tip-item {
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

/* ============================================
   TEAM
   ============================================ */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.team-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.team-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    color: white;
}

.team-card-name { font-weight: 700; font-size: 16px; }
.team-card-role { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }

.team-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.team-stat {
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.team-stat-value {
    font-weight: 800;
    font-size: 18px;
    display: block;
}

.team-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.sale-form { margin-bottom: 0; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

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

.modal {
    background: white;
    border-radius: var(--radius);
    width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 280px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

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

/* ============================================
   RESPONSIVE
   ============================================ */
/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e3a5f 100%);
    z-index: 9999;
    padding: 16px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.loading-spinner {
    width: 40px; height: 40px;
    margin: 20px auto 0;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }

.login-form .form-group { text-align: left; margin-bottom: 16px; }
.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition);
}
.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    transition: background var(--transition);
}
.login-btn:hover { background: var(--primary-dark); }

/* ============================================
   LOGOUT BUTTON
   ============================================ */
.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
}
.logout-btn:hover {
    background: rgba(220,38,38,0.2);
    color: #fca5a5;
    border-color: rgba(220,38,38,0.4);
}

/* Link button (forgot password etc) */
.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 0;
    font-family: inherit;
    text-decoration: underline;
    display: block;
    width: 100%;
    text-align: center;
}
.link-btn:hover { color: var(--primary-dark); }

/* Recovery success */
.login-recovery-success {
    color: var(--success);
    font-size: 13px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--success-light);
    border-radius: var(--radius-sm);
    line-height: 1.6;
}
.login-recovery-success code,
.login-error code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Team config credentials */
.team-config-creds {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.cred-label {
    font-size: 11px;
    color: var(--text-muted);
}
.cred-label code {
    background: rgba(0,0,0,0.04);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
}
.team-config-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-delete-user {
    color: white !important;
    padding: 6px 10px !important;
}

/* ============================================
   TEAM CONFIG (Admin)
   ============================================ */
.team-config-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.team-config-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.team-config-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.team-config-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.team-config-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.team-name-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
.team-name-input:focus {
    outline: none;
    border-color: var(--primary);
}
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}
.btn-save-name {
    background: var(--primary);
    color: white;
}
.btn-save-name:hover {
    background: var(--primary-dark);
}

/* ============================================
   RESPONSIVE - Tablet
   ============================================ */
@media (max-width: 1024px) {
    .main-content { --pad-lateral: 20px; padding: 24px var(--pad-lateral); }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .simulator-layout { grid-template-columns: 1fr; }
    .calculator-layout { grid-template-columns: 1fr; }
    .scenario-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   RESPONSIVE - Mobile
   ============================================ */
@media (max-width: 768px) {
    /* Sidebar overlay */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    /* Overlay backdrop when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 99;
    }
    .sidebar-overlay.active { display: block; }

    /* Mobile header */
    .mobile-header { display: flex; }

    /* Main content */
    .main-content {
        margin-left: 0;
        --pad-lateral: 14px;
        padding: 68px var(--pad-lateral) 24px;
        width: 100%;
        min-width: 0;
        max-width: 100vw;
        box-sizing: border-box;
    }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 16px;
    }
    .page-header h1 { font-size: 22px; }
    .page-header .btn-primary {
        font-size: 13px;
        padding: 10px 16px;
        width: 100%;
        text-align: center;
    }
    .month-selector {
        width: 100%;
        justify-content: center;
    }

    /* KPI cards */
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }
    .kpi-card { padding: 14px 12px; }
    .kpi-value { font-size: 24px; }
    .kpi-icon { font-size: 22px; }
    .kpi-label { font-size: 12px; }

    /* Dashboard grid */
    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
    .chart-card { min-height: 200px; overflow: hidden; }
    .chart-card canvas { width: 100% !important; max-width: 100%; }

    /* Prevent horizontal overflow */
    .stat-card { min-width: 0; }
    .stat-body { min-width: 0; overflow: hidden; }
    .stat-sub { word-wrap: break-word; }

    /* All content must fit viewport */
    .page.active { width: 100%; min-width: 0; box-sizing: border-box; }
    .card { max-width: 100%; box-sizing: border-box; word-wrap: break-word; }
    .team-config-grid { max-width: 100%; }
    .team-name-input { max-width: 100%; box-sizing: border-box; }
    .goals-grid { max-width: 100%; }
    .form-group input, .form-group select { max-width: 100%; box-sizing: border-box; }

    /* Cards */
    .card { padding: 14px; margin-bottom: 14px; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; gap: 8px; }

    /* Simulator */
    .sim-big-number { font-size: 36px; }
    .sim-currency { font-size: 22px; }
    .scenario-grid { grid-template-columns: 1fr; }
    .scenario-card { padding: 14px; }
    .scenario-result { font-size: 20px; }

    /* Tiers */
    .tier-row {
        font-size: 12px;
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 4px;
    }
    .tier-earning { font-size: 11px; min-width: auto; }
    .tier-row .tier-rate { font-size: 14px; min-width: 50px; }

    /* Prorrateo */
    .prorrateo-config { grid-template-columns: 1fr; }
    .prorrateo-breakdown { grid-template-columns: 1fr; }
    .prorrateo-item .value { font-size: 20px; }

    /* Ranking */
    .podium {
        flex-direction: row;
        gap: 6px;
        padding: 12px 4px;
        margin-bottom: 16px;
    }
    .podium-avatar { width: 44px; height: 44px; font-size: 16px; }
    .first .podium-avatar { width: 52px; height: 52px; font-size: 18px; }
    .podium-block { padding: 8px 16px; font-size: 16px; }
    .first .podium-block { padding-top: 20px; }
    .second .podium-block { padding-top: 14px; }
    .third .podium-block { padding-top: 10px; }
    .podium-name { font-size: 12px; }
    .podium-sales { font-size: 11px; }
    .podium-crown { font-size: 22px; }

    /* Tables scrollable on mobile */
    .ranking-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .ranking-table { font-size: 12px; white-space: nowrap; }
    .ranking-table th { padding: 8px 6px; font-size: 10px; white-space: nowrap; }
    .ranking-table td { padding: 8px 6px; white-space: nowrap; font-size: 11px; }
    .rank-badge { width: 24px; height: 24px; font-size: 11px; }

    /* Date input compact */
    input[type="date"] {
        font-size: 14px;
        padding: 8px 10px;
    }
    .form-group { margin-bottom: 10px; }

    /* Pipeline */
    .pipeline-board {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: 12px;
        /* Sangra a los bordes de la pantalla: el mismo número del padding de
           .main-content, en negativo. Escrito a mano se desfasaba (ver la variable). */
        margin: 0 calc(-1 * var(--pad-lateral));
        padding-left: var(--pad-lateral);
        padding-right: var(--pad-lateral);
    }
    .pipeline-column {
        min-width: 260px;
        max-width: 260px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    /* Calculator */
    .calc-speech-tip { font-size: 12px; padding: 12px; }

    /* Scripts */
    .scripts-tabs {
        gap: 4px;
        flex-wrap: wrap;
    }
    .tab-btn { padding: 6px 10px; font-size: 11px; }
    .script-text { font-size: 13px; line-height: 1.6; }
    .script-text p { margin-bottom: 8px; }
    .script-badge { font-size: 11px; padding: 3px 10px; margin-bottom: 12px; }
    .script-tip { font-size: 12px; padding: 10px 12px; }
    .objection { padding: 12px; }
    .objection-q { font-size: 13px; }
    .objection-a { font-size: 13px; line-height: 1.5; }
    .checklist-item { padding: 8px 10px; font-size: 13px; }
    .tip-item { padding: 8px 10px; font-size: 13px; }

    /* Team */
    .team-grid { grid-template-columns: 1fr; gap: 10px; }
    .team-card { padding: 14px; }
    .team-avatar { width: 44px; height: 44px; font-size: 18px; }
    .team-card-name { font-size: 14px; }
    .team-stats { gap: 6px; }
    .team-stat-value { font-size: 16px; }
    .team-stat-label { font-size: 10px; }
    .team-config-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
        max-width: 100%;
        box-sizing: border-box;
    }
    .team-config-info {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }
    .team-config-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .team-config-creds { font-size: 10px; word-break: break-all; }

    /* Create user form */
    #createUserCard .form-group label { font-size: 12px; }
    #createUserCard .form-group input,
    #createUserCard .form-group select { font-size: 13px; padding: 8px 10px; }

    /* Sale form compact */
    .sale-form .form-group label { font-size: 12px; }
    .sale-form .form-group input,
    .sale-form .form-group select { font-size: 13px; }

    /* Goals on mobile */
    .goal-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 10px;
    }
    .goal-row .goal-avatar { display: none; }
    .goal-name { font-size: 13px; }
    .goal-input { font-size: 12px; padding: 5px 8px; }

    /* Login responsive */
    .login-card { padding: 28px 20px; }
    .login-title { font-size: 20px; }

    /* Sale form */
    .sale-form .form-row { gap: 8px; }

    /* Modal responsive */
    .modal {
        width: calc(100vw - 24px);
        max-height: 85vh;
        margin: 12px;
    }
    .modal-header { padding: 14px 16px; }
    .modal-header h3 { font-size: 16px; }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }

    /* Toast on mobile */
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .toast {
        min-width: auto;
        font-size: 13px;
        padding: 12px 14px;
    }

    /* Result amount */
    .result-amount { font-size: 28px; }
}

@media (max-width: 420px) {
    .main-content { --pad-lateral: 10px; padding: 64px var(--pad-lateral) 20px; }

    .kpi-grid { grid-template-columns: 1fr; gap: 8px; }
    .kpi-card {
        padding: 12px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    .kpi-value { font-size: 22px; }
    .kpi-icon { font-size: 20px; }

    .page-header h1 { font-size: 20px; }

    .podium-block { padding: 6px 12px; font-size: 14px; }
    .podium-avatar { width: 38px; height: 38px; font-size: 14px; }
    .first .podium-avatar { width: 46px; height: 46px; font-size: 16px; }
    .podium-name { font-size: 11px; }

    .sim-big-number { font-size: 28px; }
    .sim-currency { font-size: 18px; }

    .stat-value { font-size: 18px; }
    .stat-icon { font-size: 26px; }

    .dash-ranking-position { font-size: 28px; }

    .tier-row { padding: 6px 8px; }
    .nav-menu { padding: 8px; }
    .sidebar-header { padding: 14px; }

    .motivation-emoji { font-size: 30px; }
    .motivation-content p { font-size: 14px; }
}

/* ============================================
   CAMPAÑAS DASHBOARD
   ============================================ */
#page-campanas .kpi-grid {
    /* 4 ago 2026 — "1fr" es minmax(auto, 1fr): el mínimo "auto" impide que la columna se
       encoja por debajo de su contenido, así que la cuarta tarjeta ("ROI Estimado") se salía
       y quedaba a medias contra el borde. minmax(0, 1fr) sí deja encogerlas. */
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

#page-campanas .dashboard-grid {
    /* Mismo motivo: el canvas de la gráfica tiene ancho propio y sin minmax(0, ...) empuja
       su columna más allá del contenedor. */
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

#page-campanas .chart-card canvas {
    max-width: 100%;
}

.campanas-filtros {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    /* Con `wrap` los cinco filtros bajan a un segundo renglón cuando no caben, en vez de
       apretarse. `min-width: 0` es lo que permite que el bloque baje de su ancho de
       contenido dentro del encabezado. */
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

/* 4 ago 2026 — QUÉ SOSTIENE ESTA PANTALLA, MEDIDO.

   Aquí decía "EL ARREGLO QUE FALTABA" sobre el tope de ancho de los selects. Medido en
   banco (scripts/app_layout_probe.mjs) después de declarar `#appContainer`, es FALSO, y
   dejarlo escrito manda al siguiente a buscar donde no es — que es como se perdieron tres
   intentos en el Pipeline.

   Ventana 1902px, quitando una cosa a la vez:
     con tope y con wrap  → filtros 927px, borde derecho 1864  (sin desborde)
     sin tope, con wrap   → filtros 1194px, borde derecho 1864  (sin desborde)
     sin tope ni wrap     → los selects se APRIETAN (477 → 408px) y siguen dentro
   En 1366 y 1280 pasa lo mismo: `scrollWidth == clientWidth` en los cuatro escenarios.

   O sea: lo que evitaba el corte NO era este tope, era que el contenedor tuviera un ancho
   acotado — y eso vino de declarar `#appContainer` (ver el comentario grande arriba de
   la sección SIDEBAR). Este tope se queda por una razón distinta y más modesta: sin él,
   el select de campaña mide 477px (el nombre real más largo de Meta tiene 74 caracteres)
   y se lleva un renglón él solo, empujando a los otros cuatro abajo. Con tope, los cinco
   caben en una línea de 927px y se leen parejo. Es presentación, no rescate. */
.campanas-filtros select {
    max-width: 210px;
    min-width: 0;
    flex: 0 1 auto;
    text-overflow: ellipsis;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
}

.campanas-filtros select:focus {
    outline: none;
    border-color: var(--primary);
}

.kpi-campana-leads { border-left: 4px solid #3CBBB1; }
.kpi-campana-costo { border-left: 4px solid var(--warning); }
.kpi-campana-conversion { border-left: 4px solid var(--primary); }
.kpi-campana-roi { border-left: 4px solid var(--success); }

#page-campanas .kpi-card {
    overflow: hidden;
    min-width: 0;
}

#page-campanas .kpi-card .kpi-content,
#page-campanas .kpi-card .kpi-sub {
    min-width: 0;
    overflow: hidden;
}

#page-campanas .kpi-card .kpi-meta {
    display: block;
}

/* Gasto form */
.campana-gasto-card .campana-gasto-form {
    display: grid;
    /* minmax(0, 1fr) + min-width:0 en los hijos: el select "Campaña Meta" se llena con los
       nombres reales de Meta y sin esto estiraba su columna fuera de la tarjeta. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 12px;
    align-items: flex-end;
}

.campana-gasto-card .campana-gasto-form .form-group {
    min-width: 0;
}

.campana-gasto-card .campana-gasto-form select,
.campana-gasto-card .campana-gasto-form input {
    max-width: 100%;
}

.campana-gasto-form .btn-primary {
    white-space: nowrap;
    height: 42px;
    padding: 0 20px;
}

/* 4 ago 2026 — la columna "Campaña" trae el nombre completo de Meta y empujaba la tabla
   fuera de la tarjeta: se cortaba en "Monto" y la ✕ de borrar quedaba pegada al borde, sin
   forma de llegar a ella. Ahora la tabla scrollea dentro de su caja. */
.campana-gasto-historial {
    overflow-x: auto;
    max-width: 100%;
}

.gasto-mini-table {
    width: 100%;
    min-width: 420px;
    margin-top: 12px;
    font-size: 13px;
    border-collapse: collapse;
}

.gasto-mini-table th {
    text-align: left;
    padding: 6px 10px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.gasto-mini-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

/* Estados */
.campana-estados {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.campana-estado-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
}

.estado-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.estado-dot.nuevo { background: var(--primary); }
.estado-dot.contactado { background: var(--warning); }
.estado-dot.en-proceso { background: var(--purple); }
.estado-dot.cerrado { background: var(--success); }
.estado-dot.descartado { background: var(--text-muted); }

.estado-label {
    flex: 1;
    font-size: 13px;
    color: var(--text);
}

.estado-count {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

/* Fuentes */
.campana-fuentes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.campana-fuente-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fuente-bar-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.fuente-name {
    font-weight: 600;
    color: var(--text);
    text-transform: capitalize;
}

.fuente-count {
    color: var(--text-secondary);
}

.fuente-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.fuente-bar-fill {
    height: 100%;
    background: #3CBBB1;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Estado select in table */
.camp-estado-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    background: var(--bg);
}

.camp-estado-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Leads header with export */
.campana-leads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.campana-leads-header h3 {
    margin-bottom: 0;
}

/* Estado badges */
.estado-badge.estado-nuevo { border-color: var(--primary); }
.estado-badge.estado-contactado { border-color: var(--warning); }
.estado-badge.estado-en-proceso { border-color: var(--purple); }
.estado-badge.estado-cerrado { border-color: var(--success); }
.estado-badge.estado-descartado { border-color: var(--text-muted); }

@media (max-width: 1200px) {
    #page-campanas .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    #page-campanas .kpi-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    #page-campanas .kpi-card {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 14px 12px;
    }
    #page-campanas .kpi-card .kpi-icon {
        font-size: 22px;
        flex-shrink: 0;
    }
    #page-campanas .kpi-card .kpi-content {
        flex: 1;
        min-width: 0;
    }
    #page-campanas .kpi-card .kpi-sub {
        flex-shrink: 0;
    }
    #page-campanas .kpi-card .kpi-value {
        font-size: 22px;
    }
    #page-campanas .kpi-card .kpi-label {
        font-size: 11px;
    }
    #page-campanas .kpi-card .kpi-meta {
        font-size: 11px;
        white-space: normal;
    }
    #page-campanas .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .campanas-filtros {
        flex-direction: column;
        width: 100%;
    }
    .campanas-filtros select {
        width: 100%;
    }
    .campana-gasto-card .campana-gasto-form {
        grid-template-columns: 1fr;
    }
    .campana-leads-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

@media (max-width: 420px) {
    #page-campanas .kpi-card {
        padding: 10px;
    }
    #page-campanas .kpi-card .kpi-value {
        font-size: 20px;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================
   MIS FINANZAS — PIN gate + sub-tabs (Fase 1)
   ============================================ */
.finanzas-pin-gate {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
.pin-card {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
    max-width: 360px;
    width: 100%;
    text-align: center;
}
.pin-lock-icon {
    font-size: 36px;
    margin-bottom: 12px;
}
.pin-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #1a2332;
    font-weight: 700;
}
.pin-card > p {
    margin: 0 0 24px;
    color: #64748b;
    font-size: 13px;
}
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
}
.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    transition: all .15s ease;
}
.pin-dot.filled {
    background: #2563eb;
    border-color: #2563eb;
    transform: scale(1.1);
}
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.pin-pad button {
    height: 56px;
    border: none;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 22px;
    font-weight: 500;
    color: #1a2332;
    cursor: pointer;
    transition: background .1s, transform .1s;
    user-select: none;
}
.pin-pad button:hover:not(.pin-pad-empty) { background: #e2e8f0; }
.pin-pad button:active:not(.pin-pad-empty) {
    background: #cbd5e1;
    transform: scale(0.96);
}
.pin-pad button.pin-pad-empty {
    background: transparent;
    pointer-events: none;
    cursor: default;
}
.pin-error {
    margin-top: 18px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
}
.link-btn {
    background: transparent;
    border: none;
    color: #2563eb;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}
.link-btn:hover { color: #1d4ed8; }

/* Mis Finanzas — sub-tabs */
.finanzas-tabs {
    display: flex;
    gap: 4px;
    margin: 16px 0 20px;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    padding-bottom: 0;
}
.finanzas-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    margin-bottom: -1px;
}
.finanzas-tab:hover { color: #1a2332; }
.finanzas-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 600;
}
.finanzas-panel { display: none; }
.finanzas-panel.active { display: block; }

.empty-state-note {
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
    margin-top: 12px;
}

/* Mobile — PIN */
@media (max-width: 480px) {
    .pin-card { padding: 28px 20px; }
    .pin-pad button { height: 50px; font-size: 20px; }
}

/* ============================================
   MIS FINANZAS — KPI grid responsive (Cashflow + Proyección)
   1 may 2026 — antes inline style repeat(4,1fr) cortaba en mobile.
   ============================================ */
.fin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.fin-kpi-grid > div {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    min-width: 0; /* permite que el contenido se ajuste sin desbordar */
}
@media (max-width: 1024px) {
    .fin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .fin-kpi-grid { grid-template-columns: 1fr; gap: 8px; }
    .fin-kpi-grid > div { padding: 12px 14px; }
}

/* Mobile — Mis Finanzas tabs (scroll suave + indicador). NO toca Resumen
   porque el .kpi-grid default ya es responsive (auto-fit minmax 220px). */
@media (max-width: 600px) {
    .finanzas-tabs {
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .finanzas-tab {
        font-size: 13px;
        padding: 10px 12px;
    }
    /* Tablas con scroll horizontal claro (Cashflow + Proyección) */
    .gastos-tabla-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -8px;
        padding: 0 8px;
    }
    .gastos-tabla {
        min-width: 560px;
    }
}

/* ============================================
   MIS FINANZAS — Gastos Fijos (Fase 2)
   ============================================ */
.gastos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.gastos-header h3 {
    margin: 0;
    font-size: 18px;
}
.gastos-mes-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px 12px;
}
.gastos-mes-selector span {
    font-weight: 600;
    color: #1a2332;
    min-width: 130px;
    text-align: center;
}
.gastos-mes-selector .btn-icon {
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    border-radius: 6px;
}
.gastos-mes-selector .btn-icon:hover {
    background: #e2e8f0;
    color: #1a2332;
}
.gastos-tabla-wrapper {
    overflow-x: auto;
}
.gastos-tabla {
    width: 100%;
    border-collapse: collapse;
}
.gastos-tabla thead th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.gastos-tabla th.num,
.gastos-tabla td.num {
    text-align: right;
}
.gastos-tabla tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #1a2332;
}
.gastos-tabla tbody tr:hover {
    background: #fafbfc;
}
.gasto-pago-input {
    width: 90px;
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: right;
    font-size: 13px;
    background: #fff;
}
.gasto-pago-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.gastos-tabla td.pagado-ok { color: #16a34a; font-weight: 600; }
.gastos-tabla td.pagado-parcial { color: #d97706; font-weight: 600; }
.gastos-tabla td.pendiente { color: #dc2626; font-weight: 600; }
.gastos-tabla .acciones {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.btn-icon-mini {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all .1s;
}
.btn-icon-mini:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.btn-icon-mini.btn-danger:hover {
    background: #fee2e2;
    border-color: #fecaca;
}
.gastos-tabla tfoot .totales-row {
    background: #f8fafc;
    border-top: 2px solid #cbd5e1;
}
.gastos-tabla tfoot .totales-row td {
    padding: 12px;
    font-size: 15px;
    border-bottom: none;
}
.badge-mini {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

@media (max-width: 600px) {
    .gastos-header { flex-direction: column; align-items: stretch; }
    .gastos-mes-selector { justify-content: center; }
    .gasto-pago-input { width: 70px; }
}

/* Push FCM toggle button */
.notif-toggle-btn {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f1f5f9;
    color: #1a2332;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.notif-toggle-btn:hover:not(:disabled) {
    background: #e2e8f0;
}
.notif-toggle-btn.notif-active {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
    cursor: default;
}
.notif-toggle-btn.notif-denied {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
    cursor: not-allowed;
}
.notif-toggle-btn:disabled {
    opacity: 0.85;
}

/* 4 ago 2026 — sello de versión en la barra lateral. Discreto a propósito: no es información
   de trabajo, es el número que contesta "¿estás viendo lo último?" sin abrir nada. */
.user-build {
    display: block;
    font-size: 10px;
    letter-spacing: .04em;
    opacity: .55;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* 13 nov 2026 — aviso «Esto ya vive en el sistema nuevo → Abrir» arriba de cada sección que se
   muda (docs/propuestas/mapa_maestro_sistema_13nov.md §2.1 y paso 12). La sección no se quita. */
.aviso-sistema-nuevo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--primary);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}
.aviso-sistema-nuevo > div { flex: 1 1 280px; min-width: 0; }
.aviso-sistema-nuevo .asn-nota { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-secondary); }
.aviso-sistema-nuevo a {
    flex: none;
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.aviso-sistema-nuevo[data-estado="por_publicar"] { border-color: var(--warning, #f59e0b); background: var(--warning-light); }
.aviso-sistema-nuevo[data-estado="nota"] { border-color: var(--border); background: var(--bg-card); }
.kpi-fuente { display: block; margin-top: 4px; font-size: 11px; opacity: .8; }
