:root {
    --sidebar-width: 260px;
    --brand-color: #0d5c63;
    --brand-color-dark: #093f44;
    --brand-color-light: #e6f1f1;
    --radius-md: .65rem;
}

* { scrollbar-width: thin; }

body {
    background-color: #f4f6f8;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1f2a30;
}

h1, h2, h3, h4, h5, h6, .h4, .h5, .h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
}

a { color: var(--brand-color); }
a:hover { color: var(--brand-color-dark); }

/* ---------- Layout con sidebar ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--brand-color) 0%, var(--brand-color-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1045;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.25rem 1rem;
    font-weight: 600;
    font-size: .95rem;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.app-sidebar-brand i {
    font-size: 1.4rem;
}

.app-sidebar .nav {
    padding: .75rem 0;
    flex: 1;
    overflow-y: auto;
}

.app-sidebar .nav-link {
    color: rgba(255, 255, 255, .85);
    padding: .65rem 1.25rem;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-radius: 0;
    transition: background-color .12s ease, border-color .12s ease;
}

.app-sidebar .nav-link i {
    width: 1.1rem;
    text-align: center;
}

.app-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: rgba(255, 255, 255, .12);
    border-left-color: #fff;
    color: #fff;
    font-weight: 600;
}

.app-sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .15);
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1040;
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e9ec;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.btn-sidebar-toggle {
    display: none;
    border: none;
    background: transparent;
    font-size: 1.4rem;
    color: var(--brand-color-dark);
    padding: .25rem .4rem;
    line-height: 1;
    border-radius: .4rem;
}

.btn-sidebar-toggle:hover { background: var(--brand-color-light); }

.app-content-body {
    padding: 1.5rem;
    flex: 1;
}

.cursor-pointer {
    cursor: pointer;
}

/* ---------- Tarjetas ---------- */
.card {
    border: 1px solid #e5e9ec;
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card-header {
    background: #fbfcfd;
    border-bottom: 1px solid #e5e9ec;
}

tr.cursor-pointer:hover {
    background-color: var(--brand-color-light);
}

/* ---------- Tarjetas de estadística ---------- */
.stat-card .card-body {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: .5rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    color: #6c757d;
    font-size: .85rem;
}

/* ---------- Tablas con encabezado fijo (para formularios largos) ---------- */
.table-responsive.table-sticky-head {
    max-height: 70vh;
}

.table-sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
    box-shadow: 0 1px 0 #dee2e6;
}

/* ---------- Formularios ---------- */
.form-control:focus, .form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 .2rem rgba(13, 92, 99, .15);
}

.form-label {
    font-weight: 500;
    color: #33424a;
}

/* Fila resaltada cuando ya tiene información guardada. */
.fila-completa {
    background-color: #f1f8f4 !important;
}

.fila-completa td:first-child {
    border-left: 3px solid #198754;
}

.fila-pendiente td:first-child {
    border-left: 3px solid #dee2e6;
}

/* ---------- Estado vacío reutilizable ---------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 2.2rem;
    color: #adb5bd;
    margin-bottom: .5rem;
    display: block;
}

/* ---------- Barra de progreso de diligenciamiento ---------- */
.progreso-diligenciamiento {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.progreso-diligenciamiento .progress {
    flex: 1;
    height: .55rem;
}

/* ---------- Botones con estado de carga ---------- */
.btn.is-loading {
    pointer-events: none;
    opacity: .75;
}

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-color) 0%, var(--brand-color-dark) 100%);
    padding: 1.5rem;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, .25);
}

.login-icon {
    font-size: 2.2rem;
    color: var(--brand-color);
}

@media (max-width: 992px) {
    .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        transition: left .2s ease-in-out;
    }

    .app-sidebar.is-open {
        left: 0;
    }

    .app-sidebar-backdrop.is-open {
        display: block;
    }

    .btn-sidebar-toggle {
        display: inline-block;
    }

    .app-content-body {
        padding: 1rem;
    }
}
