/* --- Layout --- */

.app-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.app-header {
    background: var(--bs-body-bg);
    color: var(--bs-emphasis-color);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    position: sticky;
    top: 0;
    z-index: 1020;
    --app-header-height: 64px;
}

.app-logo {
    font-size: 1.8rem;
}

.app-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.app-sidebar {
    width: 230px;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color, #dee2e6);
    padding: 1rem 0.5rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-main {
    flex: 1;
    min-width: 0;
    background: var(--bs-body-bg);
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    background-color: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.6rem 0.35rem;
    text-decoration: none;
    color: var(--bs-body-color);
    border-radius: 0.85rem;
    font-size: 0.9rem;
}

.bottom-nav-item .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.bottom-nav-item:hover {
    color: var(--bs-emphasis-color);
    text-decoration: none;
    background: var(--bs-secondary-bg, rgba(0,0,0,0.04));
}

.bottom-nav-item.active {
    color: var(--bs-primary);
    font-weight: 600;
    background: var(--bs-tertiary-bg, rgba(0,0,0,0.06));
}

/* --- Nav menu --- */

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    padding: 0.25rem 0.75rem;
    letter-spacing: 0.04em;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.95rem;
}

    .nav-link-item .nav-icon {
        width: 1.5rem;
        text-align: center;
    }

    .nav-link-item:hover {
        background-color: var(--bs-secondary-bg, rgba(0,0,0,0.04));
        text-decoration: none;
        color: var(--bs-body-color);
    }

    .nav-link-item.active {
        background-color: var(--bs-primary);
        color: var(--bs-body-bg);
    }

        .nav-link-item.active .nav-icon {
            filter: brightness(1.1);
        }

/* --- Cards & tables tweaks --- */

.card {
    border-radius: 0.75rem;
}

    .card .card-body {
        padding: 1rem 1.25rem;
    }

table.table-sm th,
table.table-sm td {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

/* --- Responsive action layouts for buttons --- */

.action-grid {
    display: grid;
    gap: 0.75rem;
}

.action-grid .span-2 {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .action-grid .btn {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .action-grid {
        grid-template-columns: 1fr;
    }

    .action-grid .btn {
        width: 100%;
    }
}

/* --- Helper styles for statuses --- */

/* Keep default bootstrap badge colors; no overrides needed */

/* Highlight rows where current user is involved (we used table-info) */
.table-info {
    --bs-table-bg: color-mix(in srgb, var(--bs-info) 15%, var(--bs-body-bg));
}

/* Responsive: on small screens, sidebar goes on top */

@media (max-width: 768px) {
    .app-body {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    }

    .app-sidebar.mobile-open {
        display: block !important;
        position: fixed;
        top: var(--app-header-height, 64px);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        background: var(--bs-body-bg);
        border-right: none;
        border-bottom: none;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
    }

    .mobile-nav-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1035;
    }
}

@media (min-width: 769px) {
    .app-body {
        flex-direction: row;
    }

    .app-main {
        padding-bottom: 2rem;
    }

    .bottom-nav {
        display: none;
    }
}
