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


:root {
    --primary: #0b2545;
    --secondary: #174d7d;
    --blue: #2669a8;

    --background: #f4f7fb;
    --white: #ffffff;

    --text: #172033;
    --soft: #6d7889;
    --border: #e2e8f0;

    --green: #159957;
    --red: #c0392b;
    --orange: #d97706;

    --sidebar: 260px;
}


body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}


button,
input,
select {
    font-family: inherit;
}


button {
    cursor: pointer;
}


.hidden {
    display: none !important;
}


/* =========================================================
   LOGIN
   ========================================================= */

.login-view {
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 30px;

    background:
        radial-gradient(
            circle at top left,
            rgba(56, 120, 180, 0.35),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #07192d,
            #0d3158,
            #164c77
        );
}


.login-card {
    width: 100%;
    max-width: 430px;

    padding: 38px;

    background: white;

    border-radius: 20px;

    box-shadow:
        0 28px 80px
        rgba(0, 0, 0, 0.25);
}


.brand {
    display: flex;
    align-items: center;
    gap: 14px;

    margin-bottom: 35px;
}


.brand-logo {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--blue)
        );

    font-weight: 800;
}


.brand h1 {
    color: var(--primary);
    font-size: 25px;
}


.brand p {
    margin-top: 4px;

    color: var(--soft);
    font-size: 12px;
}


.login-title span,
.section-label {
    color: var(--blue);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 1px;
}


.login-title h2 {
    margin-top: 7px;
    margin-bottom: 7px;

    font-size: 28px;

    color: var(--primary);
}


.login-title p {
    margin-bottom: 27px;

    color: var(--soft);

    font-size: 14px;
    line-height: 1.5;
}


.form-group {
    margin-bottom: 18px;
}


.form-group label {
    display: block;

    margin-bottom: 8px;

    color: #3c4655;

    font-size: 13px;
    font-weight: 650;
}


.form-group input,
.form-group select {
    width: 100%;
    height: 46px;

    padding: 0 13px;

    border: 1px solid #d5dce6;
    border-radius: 9px;

    outline: none;

    background: #fafbfd;
}


.form-group input:focus,
.form-group select:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px
        rgba(38, 105, 168, 0.1);

    background: white;
}


.password-wrapper {
    position: relative;
}


.password-wrapper input {
    padding-right: 75px;
}


.btn-password {
    position: absolute;

    top: 7px;
    right: 7px;

    height: 33px;

    padding: 0 12px;

    border: none;
    border-radius: 6px;

    background: #eaf0f7;

    color: var(--primary);

    font-size: 11px;
    font-weight: 700;
}


.btn-login {
    width: 100%;
    height: 48px;

    margin-top: 4px;

    border: none;
    border-radius: 9px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--blue)
        );

    font-weight: 700;
}


.btn-login:disabled,
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


.message {
    margin-bottom: 14px;

    padding: 11px;

    border-radius: 8px;

    font-size: 13px;
}


.message-error {
    color: #a2281d;
    background: #fff0ee;
    border: 1px solid #ffd0ca;
}


.message-success {
    color: #14663b;
    background: #eaf8ef;
    border: 1px solid #bee6cd;
}


.login-footer {
    margin-top: 24px;
    padding-top: 18px;

    text-align: center;

    border-top: 1px solid var(--border);

    color: var(--soft);

    font-size: 11px;
}


/* =========================================================
   BOTONES
   ========================================================= */

.btn-primary,
.btn-secondary,
.btn-light,
.btn-danger,
.btn-table {
    border: none;
    border-radius: 8px;

    font-weight: 650;
}


.btn-primary {
    min-height: 42px;

    padding: 0 18px;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--blue)
        );
}


.btn-secondary {
    height: 40px;

    padding: 0 17px;

    color: white;

    background: var(--secondary);
}


.btn-light {
    min-height: 40px;

    padding: 0 16px;

    border: 1px solid var(--border);

    color: var(--text);

    background: white;
}


.btn-danger {
    min-height: 34px;

    padding: 0 11px;

    color: white;

    background: var(--red);
}


.btn-table {
    min-height: 34px;

    padding: 0 11px;

    border: 1px solid #d5dce6;

    color: var(--primary);

    background: white;
}


/* =========================================================
   APP
   ========================================================= */

.app-layout {
    min-height: 100vh;
    display: flex;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    width: var(--sidebar);

    position: fixed;

    top: 0;
    bottom: 0;
    left: 0;

    display: flex;
    flex-direction: column;

    color: white;

    background:
        linear-gradient(
            180deg,
            #071a31,
            #0d2e51
        );
}


.sidebar-brand {
    height: 86px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 0 23px;

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.08);
}


.sidebar-logo {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.13);

    font-size: 12px;
    font-weight: 800;
}


.sidebar-brand strong {
    display: block;
}


.sidebar-brand span {
    display: block;

    margin-top: 3px;

    color: #9fb5cc;

    font-size: 10px;
}


.sidebar-user {
    display: flex;
    align-items: center;

    gap: 11px;

    margin: 18px;

    padding: 13px;

    border-radius: 11px;

    background:
        rgba(255, 255, 255, 0.07);
}


.avatar {
    width: 38px;
    height: 38px;

    flex-shrink: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    border-radius: 50%;

    background: #edf3fa;

    color: var(--primary);

    font-weight: 800;
}


.sidebar-user strong {
    display: block;
    font-size: 12px;
}


.sidebar-user span {
    display: block;

    margin-top: 3px;

    color: #9fb5cc;

    font-size: 9px;
}


.sidebar-nav {
    flex: 1;

    padding: 4px 13px;

    overflow-y: auto;
}


.nav-item {
    width: 100%;
    min-height: 44px;

    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 4px;

    padding: 0 14px;

    border: none;
    border-radius: 8px;

    background: transparent;

    color: #b8c6d8;

    text-align: left;
    font-size: 13px;
}


.nav-item:hover {
    color: white;

    background:
        rgba(255, 255, 255, 0.07);
}


.nav-item.active {
    color: white;

    background:
        rgba(255, 255, 255, 0.13);
}


.nav-item span {
    width: 22px;
    text-align: center;
}


.sidebar-footer {
    padding: 17px;

    border-top:
        1px solid
        rgba(255, 255, 255, 0.08);
}


.btn-logout {
    width: 100%;
    height: 39px;

    border:
        1px solid
        rgba(255, 255, 255, 0.15);

    border-radius: 8px;

    background: transparent;

    color: #d6e0ec;
}


/* =========================================================
   MAIN
   ========================================================= */

.main {
    width:
        calc(
            100% - var(--sidebar)
        );

    min-height: 100vh;

    margin-left:
        var(--sidebar);
}


.topbar {
    height: 86px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 33px;

    background: white;

    border-bottom:
        1px solid var(--border);
}


.topbar small {
    color: var(--soft);
    font-size: 10px;
}


.topbar h2 {
    margin-top: 4px;

    color: var(--primary);

    font-size: 21px;
}


.topbar-right {
    display: flex;
    align-items: center;

    gap: 28px;
}


.online-status {
    display: flex;
    align-items: center;

    gap: 8px;

    color: var(--soft);

    font-size: 12px;
}


.online-status > span {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: #18a05c;
}


.top-user {
    display: flex;
    align-items: center;

    gap: 10px;
}


.top-avatar {
    width: 37px;
    height: 37px;
}


.top-user strong {
    display: block;
    font-size: 12px;
}


.top-user small {
    display: block;
    margin-top: 2px;
}


/* =========================================================
   PAGE
   ========================================================= */

.page-section {
    padding: 28px 33px 45px;
}


/* =========================================================
   DASHBOARD
   ========================================================= */

.welcome {
    min-height: 177px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 30px;

    padding: 32px 35px;

    border-radius: 17px;

    color: white;

    background:
        radial-gradient(
            circle at right,
            rgba(255, 255, 255, 0.13),
            transparent 31%
        ),
        linear-gradient(
            135deg,
            #092440,
            #1d5684
        );
}


.welcome > div > span {
    color: #aac9e3;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 1px;
}


.welcome h1 {
    margin-top: 8px;
    margin-bottom: 9px;

    font-size: 28px;
}


.welcome p {
    max-width: 650px;

    color: #d4e2ee;

    font-size: 13px;
    line-height: 1.6;
}


.welcome-code {
    min-width: 155px;
    height: 105px;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    border:
        1px solid
        rgba(255, 255, 255, 0.17);

    border-radius: 13px;

    background:
        rgba(255, 255, 255, 0.07);
}


.welcome-code strong {
    font-size: 26px;
}


.welcome-code small {
    margin-top: 5px;

    color: #bbd2e5;
}


.stats {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-top: 21px;
}


.stat-card {
    min-height: 115px;

    display: flex;
    align-items: center;

    gap: 17px;

    padding: 21px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background: white;
}


.stat-icon {
    width: 50px;
    height: 50px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background: #edf3fa;

    font-size: 21px;
}


.stat-card span {
    display: block;

    color: var(--soft);

    font-size: 10px;

    text-transform: uppercase;
}


.stat-card strong {
    display: block;

    margin-top: 2px;

    color: var(--primary);

    font-size: 25px;
}


.stat-card small {
    display: block;

    color: #9aa5b3;

    font-size: 10px;
}


.dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 20px;

    margin-top: 21px;
}


.panel {
    padding: 23px;

    border: 1px solid var(--border);
    border-radius: 13px;

    background: white;
}


.panel-title {
    padding-bottom: 16px;

    border-bottom:
        1px solid var(--border);
}


.panel-title span {
    color: var(--blue);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 1px;
}


.panel-title h3 {
    margin-top: 5px;

    font-size: 16px;
}


.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    padding: 14px 0;

    border-bottom:
        1px solid #edf1f5;
}


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


.summary-item span {
    color: var(--soft);
    font-size: 13px;
}


.summary-item strong {
    color: var(--primary);
    font-size: 13px;
}


.system-row {
    display: grid;

    grid-template-columns:
        10px 1fr auto;

    align-items: center;

    gap: 10px;

    padding: 14px 0;

    border-bottom:
        1px solid #edf1f5;

    color: var(--soft);

    font-size: 13px;
}


.system-row:last-child {
    border-bottom: none;
}


.system-row strong {
    color: var(--green);
    font-size: 10px;
}


.system-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);
}


/* =========================================================
   DASHBOARD AVANZADO APF3
   ========================================================= */

.dashboard-advanced-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 21px;
}

.dashboard-kpi-card {
    min-height: 112px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--white);
}

.dashboard-kpi-card span {
    display: block;
    color: var(--soft);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
}

.dashboard-kpi-card strong {
    display: block;
    margin-top: 8px;
    color: var(--primary);
    font-size: 24px;
}

.dashboard-kpi-card small {
    display: block;
    margin-top: 4px;
    color: #8a96a7;
    font-size: 11px;
}

.dashboard-grid-advanced {
    align-items: start;
}

.dashboard-notifications {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.dashboard-notification {
    width: 100%;
    display: grid;
    grid-template-columns: 38px 1fr 18px;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    text-align: left;
}

.dashboard-notification:hover {
    border-color: #cbd7e5;
    background: #f2f6fa;
}

.dashboard-notification-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--white);
    font-size: 18px;
}

.dashboard-notification-content {
    min-width: 0;
}

.dashboard-notification-content strong {
    display: block;
    color: var(--primary);
    font-size: 12px;
}

.dashboard-notification-content small {
    display: block;
    margin-top: 3px;
    color: var(--soft);
    font-size: 11px;
    line-height: 1.35;
}

.dashboard-notification-arrow {
    color: #98a5b5;
    font-size: 22px;
}

.dashboard-notification-advertencia {
    border-left: 4px solid var(--orange);
}

.dashboard-notification-critica {
    border-left: 4px solid var(--red);
}

.dashboard-notification-info {
    border-left: 4px solid var(--blue);
}

.dashboard-notification-ok {
    border-left: 4px solid var(--green);
}

.dashboard-notification-warning {
    border-left: 4px solid var(--orange);
}

.dashboard-empty {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    color: var(--soft);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 1100px) {
    .dashboard-advanced-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .dashboard-advanced-stats {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   MÓDULO
   ========================================================= */

.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 22px;
}


.module-header h1 {
    margin-top: 5px;

    color: var(--primary);

    font-size: 27px;
}


.module-header p {
    margin-top: 6px;

    color: var(--soft);

    font-size: 13px;
}


.module-card {
    border: 1px solid var(--border);
    border-radius: 14px;

    background: white;

    overflow: hidden;
}


.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    padding: 20px;

    border-bottom:
        1px solid var(--border);
}


.search-wrapper {
    width: min(620px, 100%);

    display: flex;

    gap: 9px;
}


.search-wrapper input {
    flex: 1;

    height: 40px;

    padding: 0 13px;

    border: 1px solid #d7dee7;
    border-radius: 8px;

    outline: none;
}


.search-wrapper input:focus {
    border-color: var(--blue);
}


.table-container {
    width: 100%;

    overflow-x: auto;
}


table {
    width: 100%;

    border-collapse: collapse;
}


thead {
    background: #f8fafc;
}


th {
    padding: 13px 15px;

    color: #566274;

    text-align: left;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
}


td {
    padding: 14px 15px;

    border-top:
        1px solid #edf1f5;

    color: #354154;

    font-size: 12px;

    vertical-align: middle;
}


tbody tr:hover {
    background: #fafcff;
}


.table-empty {
    height: 130px;

    color: var(--soft);

    text-align: center;
}


.table-actions {
    display: flex;

    gap: 7px;

    white-space: nowrap;
}


.badge {
    display: inline-flex;
    align-items: center;

    min-height: 25px;

    padding: 0 9px;

    border-radius: 20px;

    font-size: 10px;
    font-weight: 700;
}


.badge-active {
    color: #10683b;
    background: #e7f7ef;
}


.badge-inactive {
    color: #9d2c20;
    background: #ffefed;
}


.table-footer {
    padding: 14px 20px;

    border-top:
        1px solid var(--border);

    color: var(--soft);

    font-size: 11px;
}


/* =========================================================
   MENSAJES
   ========================================================= */

.module-message {
    margin: 15px 20px 0;

    padding: 11px 13px;

    border-radius: 8px;

    font-size: 12px;
}


.module-message.success {
    color: #126a3b;
    background: #e9f8f0;
    border: 1px solid #c3ead3;
}


.module-message.error {
    color: #a32b20;
    background: #fff0ee;
    border: 1px solid #ffd1cb;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal-overlay {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 25px;

    background:
        rgba(5, 18, 34, 0.65);
}


.modal-card {
    width: 100%;
    max-width: 700px;

    max-height: 90vh;

    overflow-y: auto;

    padding: 26px;

    border-radius: 16px;

    background: white;

    box-shadow:
        0 25px 70px
        rgba(0, 0, 0, 0.3);
}


.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;

    padding-bottom: 18px;

    border-bottom:
        1px solid var(--border);
}


.modal-header h2 {
    margin-top: 5px;

    color: var(--primary);

    font-size: 22px;
}


.modal-close {
    width: 36px;
    height: 36px;

    border: none;
    border-radius: 8px;

    color: #6c7787;

    background: #f0f3f7;

    font-size: 22px;
}


.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 0 17px;
}


.full-column {
    grid-column: 1 / -1;
}


.modal-actions {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 8px;

    padding-top: 18px;

    border-top:
        1px solid var(--border);
}


/* =========================================================
   PLACEHOLDER
   ========================================================= */

.module-placeholder {
    min-height: 470px;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: center;

    padding: 40px;

    border:
        1px dashed #cbd5e1;

    border-radius: 15px;

    background: white;

    text-align: center;
}


.module-placeholder-icon {
    width: 68px;
    height: 68px;

    display: flex;
    justify-content: center;
    align-items: center;

    margin-bottom: 17px;

    border-radius: 50%;

    background: #edf3fa;

    color: var(--primary);

    font-size: 27px;
}


.module-placeholder h2 {
    color: var(--primary);
}


.module-placeholder p {
    margin-top: 8px;

    color: var(--soft);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1050px) {

    .stats {
        grid-template-columns:
            repeat(2, 1fr);
    }


    .dashboard-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 760px) {

    :root {
        --sidebar: 78px;
    }


    .sidebar-brand div:last-child,
    .sidebar-user div:last-child {
        display: none;
    }


    .sidebar-brand,
    .sidebar-user {
        justify-content: center;
    }


    .sidebar-brand {
        padding: 0;
    }


    .sidebar-user {
        margin: 15px 9px;
        padding: 9px;
    }


    .nav-item {
        justify-content: center;

        padding: 0;

        font-size: 0;
    }


    .nav-item span {
        font-size: 18px;
    }


    .btn-logout {
        font-size: 0;
    }


    .btn-logout::after {
        content: "Salir";
        font-size: 10px;
    }


    .topbar {
        padding: 0 19px;
    }


    .online-status {
        display: none;
    }


    .page-section {
        padding: 22px 19px;
    }


    .welcome-code {
        display: none;
    }


    .table-toolbar,
    .module-header {
        align-items: stretch;
        flex-direction: column;
    }


    .search-wrapper {
        width: 100%;
    }

}


@media (max-width: 560px) {

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


    .login-card {
        padding: 28px 22px;
    }


    .top-user > div:last-child {
        display: none;
    }


    .form-grid {
        grid-template-columns: 1fr;
    }


    .full-column {
        grid-column: auto;
    }


    .search-wrapper {
        flex-direction: column;
    }

}