/* =================================================================
   ESTILOS "PREMIUM" COMPARTIDOS POR LAS PANTALLAS DE REPORTES
   (/reportes-personalizados y /rplatos) — no se comparten con el
   resto de la app, todo prefijado con "rp-"
================================================================= */

.rp-page {
    max-width: 1320px;
}

.rp-header {
    margin-bottom: 18px;
}

.rp-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}

.rp-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------------------------  toolbar de filtros  --------------------------- */

.rp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--borde);
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
}

.rp-presets {
    display: flex;
    gap: 3px;
    background: var(--bg);
    padding: 4px;
    border-radius: 999px;
    flex-shrink: 0;
}

.rp-pill {
    border: none;
    background: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
    white-space: nowrap;
}

.rp-pill:hover {
    color: var(--text);
}

.rp-pill-activo,
.rp-pill-activo:hover {
    background: var(--text);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(31, 41, 55, .25);
}

.rp-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.rp-campo {
    position: relative;
}

.rp-campo-fecha svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.rp-filtros .rp-campo-fecha input {
    padding-left: 30px;
    padding-right: 8px;
    width: 122px;
}

.rp-filtros input,
.rp-filtros select {
    margin-bottom: 0;
    font-size: 12.5px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid transparent;
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.rp-filtros input:hover,
.rp-filtros select:hover {
    border-color: var(--borde);
}

.rp-filtros input:focus,
.rp-filtros select:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

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

.rp-btn-generar,
.rp-btn-primario {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), #dd4614);
    cursor: pointer;
    box-shadow: 0 6px 16px -4px rgba(242, 101, 34, .55);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    white-space: nowrap;
}

.rp-btn-generar:hover,
.rp-btn-primario:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -6px rgba(242, 101, 34, .6);
}

.rp-btn-generar:disabled,
.rp-btn-primario:disabled {
    opacity: .7;
    cursor: default;
    transform: none;
}

.rp-btn-generar svg,
.rp-btn-primario svg {
    width: 14px;
    height: 14px;
}

.rp-btn-generar .rp-girando {
    animation: rp-spin .7s linear infinite;
}

/* variante neutra del botón de acción (fila de acciones dentro de una tarjeta) */
.rp-btn-secundario {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--borde);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--white);
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
    white-space: nowrap;
}

.rp-btn-secundario:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.rp-btn-secundario svg {
    width: 14px;
    height: 14px;
}

@keyframes rp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------  resultado  --------------------------- */

.rp-resultado {
    transition: opacity .2s ease;
}

.rp-resultado.rp-cargando {
    opacity: .5;
    pointer-events: none;
}

/* ---------------------------  KPIs  --------------------------- */

.rp-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.rp-kpi {
    background: var(--white);
    border: 1px solid var(--borde);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03), 0 16px 32px -26px rgba(17, 24, 39, .45);
    transition: transform .2s ease, box-shadow .2s ease;
}

.rp-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 20px 34px -20px rgba(17, 24, 39, .3);
}

.rp-kpi-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    margin-bottom: 14px;
}

.rp-kpi-icon svg {
    width: 19px;
    height: 19px;
}

.rp-kpi-icon.rp-naranja {
    background: var(--primary-bg);
    color: var(--primary);
}

.rp-kpi-icon.rp-verde {
    background: var(--green-bg);
    color: var(--green-text);
}

.rp-kpi-icon.rp-dorado {
    background: #fef3c7;
    color: #b45309;
}

.rp-kpi-label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

.rp-kpi-valor {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-top: 5px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-kpi-valor-texto {
    font-size: 17px;
}

.rp-kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ---------------------------  tarjetas / gráficos  --------------------------- */

.rp-grid-charts {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .rp-grid-charts {
        grid-template-columns: 1fr;
    }
}

/* en /reportes-personalizados las dos tarjetas de gráfico pueden tener
   cantidades de filas muy distintas (una categoría vs. varios platos); si el
   grid las estira parejo queda un bloque de espacio vacío enorme en la más
   corta, así que cada una usa su propia altura de contenido */
.rp-grid-charts.rp-grid-libre {
    align-items: start;
}

.rp-grid-libre .rp-chart {
    margin-top: 0;
    margin-bottom: 16px;
    flex: none;
}

.rp-card {
    background: var(--white);
    border: 1px solid var(--borde);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rp-grid-charts .rp-card {
    margin-bottom: 0;
}

.rp-card-head h2 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.rp-card-head p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: 16px;
}

.rp-chart {
    flex: 1;
    min-height: 240px;
    margin-top: auto;
    margin-bottom: auto;
}

.rp-chart-dona {
    min-height: 320px;
}

.rp-vacio {
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
    padding: 20px 0;
    margin-top: auto;
    margin-bottom: auto;
}

/* ---------------------------  tabla ranking  --------------------------- */

.rp-tabla-scroll {
    width: 100%;
    overflow-x: auto;
}

.rp-tabla {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.rp-tabla th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    padding: 0 10px 10px;
    border-bottom: 1px solid var(--borde);
    white-space: nowrap;
}

.rp-tabla td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--bg);
    vertical-align: middle;
}

.rp-tabla tbody tr:last-child td {
    border-bottom: none;
}

.rp-tabla tbody tr {
    transition: background .15s ease;
}

.rp-tabla tbody tr:hover {
    background: var(--bg);
}

.rp-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rp-rank {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg);
    color: var(--text-secondary);
}

.rp-rank-1 {
    background: #fef3c7;
    color: #92400e;
}

.rp-rank-2 {
    background: #e5e7eb;
    color: #374151;
}

.rp-rank-3 {
    background: #fde4cf;
    color: #9a3412;
}

.rp-plato-nombre {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.rp-punto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rp-badge-categoria {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.rp-porcentaje-celda {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.rp-porcentaje-barra {
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
    flex-shrink: 0;
}

.rp-porcentaje-barra span {
    display: block;
    height: 100%;
    border-radius: 999px;
}

/* ---------------------------  acceso denegado  --------------------------- */

.acceso-denegado {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--borde);
    border-radius: 16px;
    padding: 56px 32px;
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
    max-width: 460px;
    margin: 40px auto 0;
}

.acceso-denegado-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #fef3c7;
    color: #b45309;
    margin-bottom: 20px;
}

.acceso-denegado-icon svg {
    width: 28px;
    height: 28px;
}

.acceso-denegado h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.acceso-denegado p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ---------------------------  responsive  --------------------------- */

@media (max-width: 640px) {
    .rp-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .rp-presets {
        justify-content: space-between;
    }

    .rp-filtros {
        flex-direction: column;
        align-items: stretch;
        justify-content: stretch;
    }

    .rp-filtros>* {
        width: 100%;
    }

    .rp-campo-fecha input {
        width: 100%;
    }

    .rp-separador {
        display: none;
    }

    .rp-btn-generar,
    .rp-btn-primario {
        justify-content: center;
        width: 100%;
    }
}
