* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f4f5;
    font-family: 'Montserrat', sans-serif;
    color: #1e293b;
    
}

.page {
    min-height: 100vh;
    height: 1000px !important;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #002A3A;
    color: #fff;
    padding: 16px;
}

.topbar-line {
    width: 20px;
    height: 44px;
    border-right: 2px solid #fff;
    flex-shrink: 0;
}

.topbar-title p {
    margin: 0;
    font-size: 22px;
    line-height: 1.05;
}

.main-content {
    position: relative;
    width: 100%;
    padding: 12px;
    padding-bottom: 96px;
}

.section-ranking {
    width: 100%;
}

.section-title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.gerentes-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.gerente-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid #e4e4e7;
    background: #fff;
    box-shadow: 0 0 16px -4px rgba(216, 216, 216, 1);
}

.gerente-head {
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
    padding: 12px;
}

.gerente-hero {
    margin-bottom: 12px;
    border-radius: 18px;
    background: linear-gradient(to right, #002A3A 0%, #0b3f55 50%, #145a78 100%);
    padding: 10px 12px;
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 42, 58, 0.18);
}

.gerente-hero-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gerente-identidad {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.20);
    flex-shrink: 0;
}

.gerente-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    background: #cbd5e1;
}

.gerente-info {
    min-width: 0;
}

.gerente-nombre {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gerente-sucursal {
    margin-top: 2px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-box-final {
    flex-shrink: 0;
    min-width: 92px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.10);
    padding: 8px 10px;
    text-align: center;
    backdrop-filter: blur(6px);
}

.score-box-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: rgba(255, 255, 255, 0.70);
}

.score-box-value {
    margin-top: 2px;
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

.alerta-card {
    pointer-events: none;
    position: absolute;
    top: 0;
    right: 106px;
    z-index: 20;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.18);
    opacity: 1;
    transform: translateY(0);
    transition: opacity .35s ease, transform .35s ease;
}

.alerta-card.ocultando {
    opacity: 0;
    transform: translateY(-6px);
}

.alerta-card.ok {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.alerta-card.error {
    border: 1px solid #fecdd3;
    background: #fff1f2;
    color: #be123c;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.stat-box {
    position: relative;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
    text-align: center;
}

.stat-label-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    margin-bottom: 4px;
}

.stat-label-wrap-with-action {
    gap: 4px;
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    line-height: 1.2;
}

.stat-value {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.pending {
    font-size: 14px;
    color: #94a3b8;
}

.btn-calificar-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font-size: 11px;
    font-weight: 700;
    transition: all .15s ease;
}

.btn-calificar-mini.sin-calificacion {
    color: #94a3b8;
}

.btn-calificar-mini.sin-calificacion:hover {
    color: #64748b;
    background: #f1f5f9;
}

.btn-calificar-mini.con-calificacion {
    color: #2563eb;
}

.btn-calificar-mini.con-calificacion:hover {
    color: #1d4ed8;
    background: #eff6ff;
}

.manual-form-wrap {
    position: relative;
    margin-top: 8px;
}

.form-calificacion-mini {
    display: none;
}

.form-calificacion-mini.visible {
    display: block;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 30;
    width: 160px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 8px;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.14);
}

.row-mini {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.form-calificacion-mini input {
    width: 100%;
    height: 32px;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0 8px;
    font-size: 12px;
    outline: none;
    background: #fff;
}

.form-calificacion-mini input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.btn-guardar-mini {
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    padding: 0 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.score-detail-toggle-wrap {
    margin-top: 12px;
}

.score-detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 0;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s ease;
}

.score-detail-toggle:hover {
    color: #334155;
}

.score-detail-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    transition: transform .2s ease, color .2s ease;
    flex-shrink: 0;
}

.score-detail-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.score-detail-toggle:hover .score-detail-icon {
    color: #64748b;
}

.score-detail-icon.rotated {
    transform: rotate(180deg);
}

.score-detail-panel {
    display: none;
    margin-top: 10px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 12px;
}

.score-detail-panel.visible {
    display: block;
    animation: fadeSlide .25s ease;
}

.detail-card,
.detail-result-card {
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 12px;
}

.detail-card + .detail-card,
.detail-card + .detail-result-card,
.detail-result-card + .detail-card {
    margin-top: 8px;
}

.detail-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}

.detail-rows {
    margin-top: 8px;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 10px;
    color: #475569;
    padding: 3px 0;
}

.detail-row strong {
    color: #0f172a;
}

.detail-row-separator {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

.text-sky {
    color: #0369a1 !important;
}

.text-indigo {
    color: #4338ca !important;
}

.equivalencias-box {
    margin-top: 12px;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px 12px;
}

.equivalencias-title {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.equivalencias-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
}

.detail-note {
    margin-top: 10px;
    font-size: 10px;
    color: #64748b;
    line-height: 1.45;
}

.detail-note-strong {
    color: #334155;
    font-weight: 600;
}

.detail-result-card {
    border-style: dashed;
    border-color: #cbd5e1;
}

.detail-result-row {
    margin-top: 8px;
}

.detail-result-total {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.asesores-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 1000px;
    overflow-y: auto;
    padding: 12px;
}

.asesor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 8px 10px;
}

.asesor-item.gracia {
    border-color: #fde68a;
    background: #fffbeb;
}

.asesor-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.asesor-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
    background: #cbd5e1;
}

.asesor-texto {
    min-width: 0;
}

.asesor-nombre {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asesor-desempeno {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.2;
    color: #64748b;
}

.asesor-desempeno-emoji {
    flex-shrink: 0;
}

.asesor-desempeno-texto {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asesor-puntos {
    margin-left: 6px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    color: #002A3A;
}

.sin-asesores {
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    background: #fff;
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: #64748b;
}

.footer-desempeno {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 9999;
    border-top: 1px solid #cbd5e1;
    background: #fff;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
}

.footer-legend-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1px;
    background: #cbd5e1;
    padding: 1px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    padding: 10px 12px;
    font-size: 12px;
}

.legend-label {
    min-width: 0;
    color: #475569;
    word-break: break-word;
}

.legend-emoji {
    margin-right: 4px;
}

.legend-points {
    flex-shrink: 0;
    font-weight: 700;
    color: #002A3A;
}

.asesores-lista::-webkit-scrollbar {
    width: 8px;
}

.asesores-lista::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
}

.asesores-lista::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 640px) {
    .topbar {
        padding: 16px 48px;
    }

    .topbar-title p {
        font-size: 26px;
    }

    .gerentes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-legend-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .equivalencias-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .gerentes-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .footer-legend-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1520px) {
    .gerentes-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .footer-legend-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .form-calificacion-mini.visible {
        right: auto;
        left: 0;
    }

    .score-box-value {
        font-size: 21px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding-inline: 10px;
    }

    .gerente-hero-row {
        align-items: flex-start;
    }

    .score-box-final {
        min-width: 82px;
        padding: 8px;
    }

    .score-box-value {
        font-size: 20px;
    }

    .alerta-card {
        right: 0;
        top: -42px;
    }
}

@media (max-width: 380px) {
    .asesor-desempeno-texto {
        display: none;
    }

    .asesor-desempeno {
        gap: 0;
    }
}

@media (max-width: 345px) {
    .gerente-hero-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .gerente-identidad {
        flex-direction: column;
        align-items: center;
    }

    .gerente-info {
        text-align: center;
    }

    .gerente-nombre,
    .gerente-sucursal {
        white-space: normal;
    }

    .alerta-card {
        position: static;
        margin-top: 8px;
    }
}

        /* Scrollbar base */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  /* Track */
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  
  /* Handle */
  ::-webkit-scrollbar-thumb {
    background-color: #cbd5e1; /* slate-300 */
    border-radius: 10px;
  }