html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background-color: #ffffff;
    color: #212529;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Header fijo */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    z-index: 1040;
    background-color: #ffffff;
}

.app-navbar {
    height: 56px;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.app-navbar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-navbar-brand {
    display: inline-flex;
    align-items: center;
    height: 100%;
    margin-right: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.app-navbar-logo {
    display: block;
    height: 38px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

/* Sidebar escritorio fijo */
.sidebar-wrapper {
    position: fixed;
    top: 56px;
    left: 0;
    width: 260px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 1rem;
    z-index: 1030;
}

/* Sidebar general */
.sidebar {
    font-size: 0.95rem;
}

    .sidebar h4 {
        font-weight: 700;
    }

    .sidebar .nav-link {
        border-radius: 8px;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.15rem;
        transition: background-color 0.2s ease;
    }

        .sidebar .nav-link:hover {
            background-color: #e9ecef;
        }

        .sidebar .nav-link.text-muted {
            color: #6c757d !important;
        }

/* Contenido principal con scroll propio */
.main-content-area {
    margin-top: 56px;
    margin-left: 260px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    padding: 1.5rem;
}

/* Ocultamos footer porque con layout fijo suele estorbar */
.footer {
    display: none;
}

/* Filas clicables en tablas */
.table-clickable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background-color: #dfeee8;
}

.clickable-row:active {
    background-color: #c7ddd4;
}

/* Botón hamburguesa */
.mobile-menu-toggle {
    font-size: 1.4rem;
    line-height: 1;
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    color: #212529;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-width: 40px;
}

/* Menú móvil desplegable */
.mobile-sidebar-collapse {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    z-index: 1035;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
}

.mobile-sidebar-content {
    padding: 1rem;
}

    .mobile-sidebar-content .sidebar {
        font-size: 0.95rem;
    }

    .mobile-sidebar-content .nav-link {
        border-radius: 8px;
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.15rem;
        transition: background-color 0.2s ease;
    }

        .mobile-sidebar-content .nav-link:hover {
            background-color: #e9ecef;
        }

/* Dashboard Home */
.dnm-page-title {
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.dnm-page-subtitle {
    color: #6c757d;
    margin-bottom: 0;
}

.dnm-search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dnm-search-button {
    background-color: #2f5d50;
    color: #ffffff;
    border: 1px solid #2f5d50;
    min-width: 110px;
}

    .dnm-search-button:hover {
        background-color: #284f44;
        color: #ffffff;
        border-color: #284f44;
    }

.dnm-quick-action {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background-color: #2f5d50;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    border: 1px solid #2f5d50;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

    .dnm-quick-action:hover {
        background-color: #284f44;
        border-color: #284f44;
        color: #ffffff;
    }

.dnm-stat-card {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem;
    height: 100%;
}

.dnm-stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.4rem;
}

.dnm-stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #2f5d50;
    line-height: 1.1;
}

.dnm-panel {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    height: 100%;
}

.dnm-panel-header {
    background-color: #f8f9fa;
    padding: 0.85rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid #dee2e6;
}

.dnm-panel-body {
    padding: 1rem;
}

.dnm-results-section + .dnm-results-section {
    margin-top: 1.5rem;
}

/* Perfil misionero */
.profile-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0;
    margin-bottom: 0;
}

    .profile-tabs .nav-item {
        margin-bottom: 0;
    }

    .profile-tabs .nav-link {
        white-space: nowrap;
    }

.profile-subsection {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.fm-clickable-row,
.fm-clickable-card,
.fs-clickable-row,
.fs-clickable-card,
.ex-clickable-row,
.ex-clickable-card {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

    .fm-clickable-row:hover,
    .fm-clickable-card:hover,
    .fs-clickable-row:hover,
    .fs-clickable-card:hover,
    .ex-clickable-row:hover,
    .ex-clickable-card:hover {
        background-color: #f8f9fa;
    }

    .fm-clickable-row.active,
    .fm-clickable-card.active,
    .fs-clickable-row.active,
    .fs-clickable-card.active,
    .ex-clickable-row.active,
    .ex-clickable-card.active {
        background-color: #e9f2ff !important;
    }

.ex-vencido {
    background-color: #ffe5e5 !important;
}

    .ex-vencido:hover {
        background-color: #ffd6d6 !important;
    }

.fm-detail-wrapper,
.fs-detail-wrapper,
.ex-detail-wrapper {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.25s ease;
    margin-top: 0;
}

    .fm-detail-wrapper.open,
    .fs-detail-wrapper.open,
    .ex-detail-wrapper.open {
        max-height: 1200px;
        opacity: 1;
        margin-top: 15px;
    }

.profile-mobile-accordion .accordion-item {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.profile-mobile-accordion .accordion-button {
    font-weight: 600;
    background-color: #f8f9fa;
}

    .profile-mobile-accordion .accordion-button:not(.collapsed) {
        background-color: #eef4f1;
        color: #212529;
        box-shadow: none;
    }

.profile-mobile-accordion .accordion-body {
    padding: 1rem;
}

.profile-mobile-accordion p:last-child {
    margin-bottom: 0;
}

.email-link {
    text-decoration: none;
    color: inherit;
}

    .email-link:hover {
        opacity: 0.7;
    }

.sidebar-user-label {
    font-size: 1rem;
    font-weight: 600;
    color: #2f5d50;
}

.app-user-info {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2f5d50;
}

.app-logout-btn {
    border: 1px solid #2f5d50;
    color: #2f5d50;
    background-color: transparent;
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

    .app-logout-btn:hover {
        background-color: #2f5d50;
        color: #ffffff;
    }

.app-mobile-user-info {
    font-size: 1rem;
    font-weight: 600;
    color: #2f5d50;
}

.app-mobile-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .app-mobile-user-row .app-logout-btn {
        flex-shrink: 0;
    }

/* Login */
.login-page {
    margin: 0;
    min-height: 100vh;
    background: #f5f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.login-card-body {
    padding: 2rem;
}

.login-logo {
    max-height: 70px;
    width: auto;
    margin-bottom: 12px;
}

.login-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.login-subtitle {
    margin-top: 6px;
    color: #6c757d;
}

/* Inactividad tipo banco */
.session-warning {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 14px 16px;
    display: none;
}

    .session-warning.show {
        display: block;
    }

.session-warning-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.session-warning-text {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.session-warning-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.session-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    z-index: 1990;
    display: none;
}

    .session-overlay.show {
        display: block;
    }

.session-expired-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2010;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #dee2e6;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 22px 20px;
    display: none;
}

    .session-expired-modal.show {
        display: block;
    }

.session-expired-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #212529;
}

.session-expired-text {
    color: #6c757d;
    margin-bottom: 16px;
}

.session-countdown {
    font-weight: 700;
    color: #b02a37;
}

/* Escritorio */
@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-sidebar-collapse {
        display: none !important;
    }

    .app-navbar-logo {
        height: 40px;
        max-width: 220px;
    }
}

/* Móvil */
@media (max-width: 767.98px) {
    body {
        overflow: hidden;
    }

    .sidebar-wrapper {
        display: none !important;
    }

    .main-content-area {
        margin-top: 56px;
        margin-left: 0;
        height: calc(100vh - 56px);
        overflow-y: auto;
        padding: 1rem;
    }

    .dnm-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .dnm-search-button {
        width: 100%;
    }

    .app-navbar {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .app-navbar-logo {
        height: 32px;
        max-width: 150px;
    }

    .login-card-body {
        padding: 1.5rem;
    }

    .session-warning {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }
}
