/* ============================================================
   MOINSA RFID - DASHBOARD CORPORATIVO
   Solo estilos. No modifica lógica ni endpoints.
   ============================================================ */

.dashboard-page {
    --dash-accent: var(--brand-accent-ink);
    --dash-accent-dark: var(--brand-ink);
    --dash-ink: var(--brand-ink);
    --dash-muted: #7b767d;
    --dash-border: #e6e3e5;
    --dash-surface: #ffffff;
    --dash-bg-soft: #faf9fa;

    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: .35rem .25rem 3rem;
    color: var(--dash-ink);
}

/* CABECERA */
.dashboard-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    overflow: hidden;
    border: 1px solid #e3dee0;
    border-radius: 18px;
    background:
        radial-gradient(circle at 94% 10%, rgba(0, 159, 227, .10), transparent 13rem),
        linear-gradient(120deg, #ffffff 0%, #fbf8f9 100%);
    box-shadow: 0 10px 30px rgba(45, 31, 34, .055);
}

.dashboard-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--dash-accent), var(--dash-accent-dark));
}

.dashboard-header h3 {
    margin: 0;
    color: #211e21;
    font-size: 1.55rem;
    font-weight: 780;
}

.dashboard-header p {
    margin-top: .35rem !important;
    color: #817b82 !important;
    font-size: .88rem;
}

.dashboard-header .btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff;
}

/* LOADING */
.dashboard-loading {
    min-height: 18rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    margin-top: 1rem;
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    color: var(--dash-muted);
    background: #fff;
    box-shadow: 0 8px 26px rgba(39, 30, 32, .04);
}

.dashboard-loading .spinner-border {
    color: var(--dash-accent);
}

/* MÉTRICAS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card {
    position: relative;
    min-width: 0;
    min-height: 135px;
    padding: 1.15rem 1.2rem 1.05rem 1.35rem;
    overflow: hidden;
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    background:
        linear-gradient(150deg, #fff 0%, #fbfafb 100%);
    box-shadow: 0 8px 24px rgba(38, 28, 31, .045);
    transition:
        transform .16s ease,
        box-shadow .16s ease,
        border-color .16s ease;
}

.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--dash-accent);
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 88px;
    height: 88px;
    right: -30px;
    top: -34px;
    border-radius: 50%;
    background: rgba(0, 159, 227, .045);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: #E5F5FC;
    box-shadow: 0 14px 32px rgba(0, 159, 227, .085);
}

.stat-label {
    position: relative;
    z-index: 1;
    color: #7d767e;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.stat-value {
    position: relative;
    z-index: 1;
    margin-top: .38rem;
    color: var(--brand-ink);
    font-size: 2.15rem;
    font-weight: 810;
    line-height: 1;
    letter-spacing: -.045em;
}

.stat-detail {
    position: relative;
    z-index: 1;
    margin-top: .55rem;
    color: #969097;
    font-size: .74rem;
}

.stat-success::before {
    background: #27865a;
}

.stat-success::after {
    background: rgba(39, 134, 90, .06);
}

.stat-danger::before {
    background: #bb0915;
}

.stat-danger::after {
    background: rgba(187, 9, 21, .07);
}

.stat-warning::before {
    background: #c58c16;
}

.stat-warning::after {
    background: rgba(197, 140, 22, .07);
}

.stat-secondary::before {
    background: #746d74;
}

.stat-secondary::after {
    background: rgba(116, 109, 116, .06);
}

.stat-info::before {
    background: #71606d;
}

.stat-info::after {
    background: rgba(113, 96, 109, .06);
}

/* SECCIONES */
.dashboard-section {
    overflow: hidden;
    border: 1px solid var(--dash-border);
    border-radius: 17px;
    background: var(--dash-surface);
    box-shadow: 0 9px 28px rgba(40, 30, 33, .045);
}

.section-header {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.05rem 1.2rem;
    border-bottom: 1px solid #efedef;
    background:
        linear-gradient(180deg, #fff 0%, #fcfbfc 100%);
}

.section-header h5 {
    margin: 0;
    color: #2b272b;
    font-size: 1rem;
    font-weight: 740;
}

.section-header p {
    margin-top: .25rem !important;
    color: #8b858c !important;
    font-size: .76rem;
}

.section-header > .badge {
    min-width: 30px;
    padding: .5rem .65rem;
    background: #302d31 !important;
    color: #fff !important;
}

/* TABLA DEL DASHBOARD */
.dashboard-table thead th {
    padding: .72rem 1rem;
    background: #f8f7f8;
    color: #817a82;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom: 1px solid #ebe8ea;
}

.dashboard-table tbody td {
    padding: .82rem 1rem;
    border-bottom: 1px solid #efedef;
    color: #484248;
    font-size: .80rem;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: 0;
}

.dashboard-table tbody tr:hover {
    background: #fffafa;
}

.company-cell,
.date-cell {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.company-cell > span:first-child {
    color: #2f2a2f;
}

.company-cell small,
.date-cell small {
    color: #989198 !important;
}

/* Estados */
.dashboard-table .status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: .35rem .55rem;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .035em;
}

/* ACCIONES EN TABLA */
.action-group {
    display: inline-flex;
    justify-content: flex-end;
    gap: .4rem;
    flex-wrap: wrap;
}

.action-group .btn {
    min-height: 31px;
    padding: .28rem .55rem;
    border-radius: 8px;
    font-size: .70rem;
    font-weight: 650;
}

/* VACÍO */
.empty-state {
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    color: #777178;
}

.empty-state-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    border-radius: 13px;
    color: #2d7b52;
    background: #eff8f3;
    font-size: 1.15rem;
    font-weight: 800;
}

/* ACCIONES RÁPIDAS */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .85rem;
    padding: 1.15rem;
}

.quick-action {
    min-width: 0;
    min-height: 94px;
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem;
    border: 1px solid #e6e2e4;
    border-radius: 13px;
    color: #403a40;
    background: linear-gradient(145deg, #fff 0%, #fbfafb 100%);
    text-decoration: none;
    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        background .15s ease;
}

.quick-action:hover {
    color: #2f2a2f;
    transform: translateY(-2px);
    border-color: #E5F5FC;
    background: #fffafa;
    box-shadow: 0 10px 22px rgba(0, 159, 227, .075);
}

.quick-action-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 11px;
    color: #fff;
    background:
        linear-gradient(145deg, var(--dash-accent), var(--dash-accent-dark));
    box-shadow: 0 6px 14px rgba(0, 159, 227, .16);
    font-size: 1rem;
    font-weight: 800;
}

.quick-action > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.quick-action strong {
    color: #342e33;
    font-size: .82rem;
    font-weight: 720;
}

.quick-action small {
    margin-top: .2rem;
    color: #948d94;
    font-size: .70rem;
    line-height: 1.35;
}

/* RESPONSIVE */
@media (max-width: 1180px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .dashboard-page {
        padding-inline: 0;
    }

    .dashboard-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-header .btn {
        width: 100%;
    }

    .stats-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-height: 118px;
    }

    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .quick-actions {
        padding: .9rem;
    }
}
