html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: #f4f6f9;
    color: #343a40;
}

a {
    text-decoration: none;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.app-sidebar {
    width: 270px;
    min-width: 270px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #172033;
    color: #ffffff;
    transition: transform 0.25s ease;
    z-index: 1040;
}

.sidebar-header {
    min-height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
}

    .sidebar-brand:hover {
        color: #ffffff;
    }

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background-color: #0d6efd;
    font-size: 1.25rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 12px;
}

.sidebar-section-title {
    margin: 20px 12px 8px;
    color: #8f9bb3;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    padding: 11px 14px;
    border-radius: 8px;
    color: #c8d0df;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .sidebar-link i {
        width: 20px;
        font-size: 1.1rem;
        text-align: center;
    }

    .sidebar-link:hover {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.08);
    }

    .sidebar-link.disabled {
        opacity: 0.55;
        pointer-events: none;
    }

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-icon {
    font-size: 1.8rem;
}

.sidebar-user-data {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    overflow: hidden;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    color: #8f9bb3;
    font-size: 0.75rem;
}

/* =========================================================
   CONTENIDO PRINCIPAL
   ========================================================= */

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-header {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 24px;
    background-color: #ffffff;
    border-bottom: 1px solid #e4e7ec;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.sidebar-toggle {
    display: none;
    padding: 4px 8px;
    font-size: 1.5rem;
}

.header-title {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-content {
    flex: 1;
    padding: 24px;
}

.app-footer {
    padding: 15px 24px;
    color: #667085;
    font-size: 0.85rem;
    text-align: center;
    background-color: #ffffff;
    border-top: 1px solid #e4e7ec;
}

/* =========================================================
   COMPONENTES
   ========================================================= */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.page-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
}

.page-subtitle {
    margin: 4px 0 0;
    color: #667085;
}

.content-card {
    background-color: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.04);
}

.content-card-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e4e7ec;
}

.content-card-body {
    padding: 20px;
}

.table-responsive {
    border-radius: 8px;
}

.table {
    margin-bottom: 0;
}

    .table th {
        color: #475467;
        font-size: 0.82rem;
        font-weight: 700;
        text-transform: uppercase;
        white-space: nowrap;
        background-color: #f8fafc;
    }

    .table td {
        vertical-align: middle;
    }

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    white-space: nowrap;
}

.form-label {
    font-weight: 600;
}

.required-label::after {
    content: " *";
    color: #dc3545;
}

.form-control,
.form-select {
    min-height: 42px;
}

textarea.form-control {
    min-height: 110px;
}

.validation-summary-valid,
.field-validation-valid {
    display: none;
}

.validation-summary-errors,
.field-validation-error {
    color: #dc3545;
}

.badge-status {
    min-width: 75px;
    padding: 7px 10px;
}

.empty-state {
    padding: 50px 20px;
    color: #667085;
    text-align: center;
}

    .empty-state i {
        display: block;
        margin-bottom: 10px;
        font-size: 3rem;
        color: #98a2b3;
    }

.sidebar-overlay {
    display: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }

        .app-sidebar.show {
            transform: translateX(0);
        }

    .sidebar-toggle {
        display: inline-block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        display: block;
        visibility: hidden;
        background-color: rgba(16, 24, 40, 0.5);
        opacity: 0;
        transition: opacity 0.25s ease;
        z-index: 1030;
    }

        .sidebar-overlay.show {
            visibility: visible;
            opacity: 1;
        }
}

@media (max-width: 767.98px) {
    .app-header {
        padding: 10px 15px;
    }

    .header-title {
        display: none;
    }

    .header-actions .btn {
        font-size: 0;
    }

        .header-actions .btn i {
            margin: 0;
            font-size: 1rem;
        }

    .app-content {
        padding: 15px;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

        .page-header .btn {
            width: 100%;
        }

    .content-card-body {
        padding: 15px;
    }

    .table-actions {
        justify-content: flex-start;
    }
}
