/* =========================================================
   SOAP UNJu
   Responsive UI
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f4f6f9;
    color: #1d2939;
    font-size: 14px;
}

a {
    color: inherit;
}


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

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

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

    padding: 20px;

    background:
        linear-gradient(
            135deg,
            #172554,
            #1e3a8a,
            #0369a1
        );
}

.login-container {
    width: 100%;
    max-width: 410px;
}

.login-brand {
    text-align: center;
    color: white;
    margin-bottom: 22px;
}

.logo {
    width: 68px;
    height: 68px;

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

    margin: auto;

    background: white;
    color: #1e3a8a;

    border-radius: 16px;

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

.login-brand h1 {
    margin: 15px 0 5px;
    font-size: 28px;
}

.login-brand p {
    margin: 0;
    opacity: .85;
    line-height: 1.5;
}

.login-card {
    background: white;

    padding: 30px;

    border-radius: 16px;

    box-shadow:
        0 20px 50px
        rgba(0, 0, 0, .22);
}

.login-card h2 {
    margin: 0 0 5px;
    font-size: 22px;
}

.subtitle {
    color: #667085;
    margin: 0 0 22px;
}


/* =========================================================
   FORMULARIOS
   ========================================================= */

label {
    display: block;

    margin-top: 16px;
    margin-bottom: 6px;

    font-weight: 600;
}

input,
select {
    width: 100%;

    padding: 11px 12px;

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

    background: white;

    font-family: inherit;
    font-size: 14px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #2563eb;

    box-shadow:
        0 0 0 3px
        rgba(37, 99, 235, .10);
}

button {
    margin-top: 22px;

    width: 100%;

    padding: 12px 15px;

    border: 0;
    border-radius: 8px;

    background: #1d4ed8;
    color: white;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;

    cursor: pointer;
}

button:hover {
    background: #1e40af;
}


/* =========================================================
   ALERTAS
   ========================================================= */

.alert {
    padding: 12px 14px;

    background: #fef2f2;
    color: #b42318;

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

    margin: 15px 0;
}

.alert-success {
    padding: 12px 14px;

    background: #ecfdf3;
    color: #027a48;

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

    margin: 18px 0;
}

.login-footer {
    text-align: center;

    color: rgba(255, 255, 255, .7);

    margin-top: 18px;

    font-size: 12px;
}


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

.sidebar {
    position: fixed;

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

    width: 205px;

    overflow-y: auto;

    background: #172554;

    padding: 17px 12px;

    z-index: 100;
}

.nav-title {
    color: white;

    font-size: 22px;
    font-weight: 900;

    padding: 6px 10px 20px;
}

.sidebar a {
    display: block;

    color: #dbeafe;

    text-decoration: none;

    padding: 10px 12px;

    margin-bottom: 4px;

    border-radius: 7px;

    transition: .15s;
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, .12);
    color: white;
}

.sidebar hr {
    border: 0;

    border-top:
        1px solid
        rgba(255, 255, 255, .15);

    margin: 13px 0;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
    min-height: 60px;

    margin-left: 205px;

    background: white;

    border-bottom: 1px solid #e4e7ec;

    padding: 10px 22px;

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

    gap: 20px;

    position: sticky;
    top: 0;

    z-index: 50;
}

.topbar > div:first-child {
    min-width: 0;
}

.topbar strong {
    font-size: 16px;
}

.topbar > div:first-child > span {
    margin-left: 8px;

    color: #667085;
    font-size: 12px;
}

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

    gap: 8px;

    font-size: 13px;

    white-space: nowrap;
}

.user-area .role {
    margin: 0;
}

.user-area a {
    text-decoration: none;
    color: #dc2626;

    margin-left: 5px;
}

.role {
    display: inline-block;

    background: #eff6ff;

    color: #1d4ed8 !important;

    padding: 4px 7px;

    border-radius: 6px;

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


/* =========================================================
   CONTENIDO
   ========================================================= */

.content {
    margin-left: 205px;

    padding: 22px;

    width: calc(100% - 205px);
}

.content > * {
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;

    font-size: clamp(
        22px,
        2vw,
        28px
    );
}

.page-header p {
    color: #667085;

    margin: 5px 0 0;
}


/* =========================================================
   CARDS
   ========================================================= */

.cards {
    display: grid;

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

    gap: 14px;

    margin: 20px auto;
}

.metric-card,
.panel {
    background: white;

    border-radius: 10px;

    border: 1px solid #e4e7ec;

    padding: 18px;
}

.metric-card {
    min-width: 0;
}

.metric-card span {
    display: block;

    color: #667085;

    font-size: 13px;
}

.metric-card strong {
    display: block;

    margin: 8px 0;

    font-size: clamp(
        19px,
        1.7vw,
        24px
    );

    line-height: 1.25;

    overflow-wrap: anywhere;
}

.metric-card small {
    display: block;

    color: #98a2b3;

    line-height: 1.4;
}


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

.dashboard-grid {
    display: grid;

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

    gap: 14px;

    margin-bottom: 14px;
}

.panel {
    min-width: 0;
}

.panel h3 {
    margin: 0 0 8px;

    font-size: 16px;
}

.chart-description {
    color: #667085;

    font-size: 12px;

    margin: 0 0 8px;
}


/* =========================================================
   GRAFICOS
   ========================================================= */

.chart-large {
    width: 100%;
    height: 330px;
}

.chart-medium {
    width: 100%;
    height: 360px;
}


/* =========================================================
   CREDITO / RESUMEN
   ========================================================= */

.credit-box {
    padding: 12px 0 18px;

    margin-bottom: 8px;

    border-bottom: 1px solid #eaecf0;
}

.credit-box span {
    display: block;

    color: #667085;

    margin-bottom: 7px;
}

.credit-box strong {
    display: block;

    font-size: clamp(
        20px,
        2vw,
        26px
    );

    overflow-wrap: anywhere;

    margin-bottom: 7px;
}

.credit-box small {
    color: #667085;

    line-height: 1.45;
}

.summary-row {
    display: flex;

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

    gap: 15px;

    padding: 9px 0;

    border-bottom: 1px solid #f2f4f7;
}

.summary-row span {
    color: #667085;
}

.summary-row strong {
    text-align: right;

    overflow-wrap: anywhere;
}


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

.placeholder {
    min-height: 180px;

    display: flex;

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

    padding: 20px;

    background: #f9fafb;

    border-radius: 8px;

    color: #98a2b3;

    text-align: center;
}


/* =========================================================
   ESTADO SISTEMA
   ========================================================= */

.system-status {
    display: flex;

    align-items: center;

    gap: 9px;

    flex-wrap: wrap;
}

.status-ok {
    width: 9px;
    height: 9px;

    flex: 0 0 9px;

    background: #16a34a;

    border-radius: 50%;
}

.system-status strong {
    margin-left: auto;
}


/* =========================================================
   ADMINISTRACION
   ========================================================= */

.admin-form {
    margin-bottom: 16px;
}

.form-grid {
    display: grid;

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

    gap: 14px;
}

.btn-small {
    width: auto;

    padding: 10px 20px;
}

.panel-title-row {
    display: flex;

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

    gap: 15px;
}

.panel-title-row span {
    color: #667085;

    font-size: 13px;
}

.table-responsive {
    width: 100%;

    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}

.users-table {
    width: 100%;

    min-width: 760px;

    border-collapse: collapse;

    margin-top: 12px;
}

.users-table th {
    text-align: left;

    padding: 11px;

    color: #667085;
    background: #f9fafb;

    border-bottom: 1px solid #eaecf0;

    font-size: 12px;
}

.users-table td {
    padding: 12px 11px;

    border-bottom: 1px solid #eaecf0;

    font-size: 13px;
}

.user-email {
    display: block;

    color: #98a2b3;

    margin-top: 3px;
}

.role-badge {
    display: inline-block;

    background: #eff6ff;
    color: #1d4ed8;

    border-radius: 6px;

    padding: 4px 7px;

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

.status-active {
    color: #079455;

    font-weight: 600;
}

.status-inactive {
    color: #d92d20;

    font-weight: 600;
}

.inline-form {
    margin: 0;
}

.inline-form button {
    margin: 0;

    width: auto;
}

.btn-danger {
    background: #d92d20;

    padding: 7px 10px;
}

.btn-danger:hover {
    background: #b42318;
}

.btn-enable {
    background: #079455;

    padding: 7px 10px;
}

.btn-enable:hover {
    background: #067647;
}

.current-user {
    color: #667085;

    font-size: 11px;
}


/* =========================================================
   NOTEBOOKS / TABLETS
   ========================================================= */

@media (max-width: 1100px) {

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

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

    .chart-large {
        height: 320px;
    }

    .chart-medium {
        height: 350px;
    }
}


/* =========================================================
   CELULAR / TABLET
   ========================================================= */

@media (max-width: 780px) {

    body {
        font-size: 14px;
    }


    /* MENU SUPERIOR HORIZONTAL */

    .sidebar {
        position: relative;

        top: auto;
        left: auto;
        bottom: auto;

        width: 100%;
        height: auto;

        display: flex;
        align-items: center;

        gap: 5px;

        overflow-x: auto;
        overflow-y: hidden;

        padding: 9px;

        white-space: nowrap;

        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .nav-title {
        flex: 0 0 auto;

        padding: 7px 10px;

        font-size: 18px;
    }

    .sidebar a {
        flex: 0 0 auto;

        margin: 0;

        padding: 8px 11px;

        font-size: 13px;
    }

    .sidebar hr {
        display: none;
    }


    /* TOPBAR */

    .topbar {
        margin-left: 0;

        position: relative;

        min-height: auto;

        padding: 11px 14px;

        align-items: flex-start;
    }

    .topbar > div:first-child > span {
        display: none;
    }

    .user-area {
        font-size: 12px;
    }


    /* CONTENIDO */

    .content {
        margin-left: 0;

        width: 100%;

        padding: 14px;
    }

    .page-header {
        margin-bottom: 14px;
    }

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

    .page-header p {
        font-size: 12px;

        line-height: 1.5;
    }


    /* TARJETAS */

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

        gap: 10px;

        margin: 14px auto;
    }

    .metric-card,
    .panel {
        padding: 14px;
    }

    .metric-card span {
        font-size: 12px;
    }

    .metric-card strong {
        font-size: 18px;
    }

    .metric-card small {
        font-size: 11px;
    }


    /* DASHBOARD */

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

        gap: 10px;

        margin-bottom: 10px;
    }

    .panel h3 {
        font-size: 15px;
    }

    .chart-large {
        height: 290px;
    }

    .chart-medium {
        height: 330px;
    }


    /* ADMIN */

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

    .btn-small {
        width: 100%;
    }

    .system-status strong {
        width: 100%;

        margin-left: 18px;
    }
}


/* =========================================================
   CELULARES CHICOS
   ========================================================= */

@media (max-width: 520px) {

    .login-body {
        padding: 14px;
    }

    .login-card {
        padding: 22px;
    }


    /* CABECERA */

    .topbar {
        gap: 8px;
    }

    .topbar strong {
        font-size: 15px;
    }

    .user-area {
        gap: 5px;
    }

    .user-area > .role {
        display: none;
    }


    /* MENU */

    .nav-title {
        font-size: 16px;
    }

    .sidebar a {
        font-size: 12px;

        padding: 7px 9px;
    }


    /* CONTENIDO */

    .content {
        padding: 10px;
    }


    /* UNA TARJETA POR FILA */

    .cards {
        grid-template-columns: 1fr;

        gap: 8px;
    }

    .metric-card {
        padding: 13px 15px;
    }

    .metric-card strong {
        font-size: 20px;
    }


    /* GRAFICOS */

    .chart-large {
        height: 270px;
    }

    .chart-medium {
        height: 300px;
    }


    /* RESUMEN */

    .summary-row {
        align-items: flex-start;

        flex-direction: column;

        gap: 3px;
    }

    .summary-row strong {
        text-align: left;
    }

    .credit-box strong {
        font-size: 22px;
    }


    /* TABLAS */

    .users-table {
        min-width: 700px;
    }
}
