:root {
    --mb-sidebar-width: 240px;
}

body {
    background-color: #f4f6f9;
    font-size: 0.9rem;
}

/* ---- Login / pre-auth layout ---- */
.login-wrapper {
    min-height: 100vh;
}

.login-card {
    max-width: 680px;
    width: 100%;
}

.box-shadow {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* ---- Authenticated layout ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--mb-sidebar-width);
    background-color: #1f2d3d;
    color: #c2c7d0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
}

.sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: #c2c7d0;
    text-decoration: none;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar-section-label {
    padding: 1rem 1rem 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c7a91;
}

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

.sidebar-user-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #c2c7d0;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-user-toggle:hover,
.sidebar-user-toggle:focus {
    color: #fff;
}

#mainContent {
    margin-left: var(--mb-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#mainContent .content {
    flex: 1 1 auto;
    padding: 1.5rem;
}

.footer {
    padding: 1rem 0;
    color: #6c7a91;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }

    #mainContent {
        margin-left: 0;
    }
}

/* ---- Loading overlay ---- */
#loading {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.6);
}

#loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3rem;
    height: 3rem;
    margin: -1.5rem;
    border: 0.35rem solid #c2c7d0;
    border-top-color: #1f2d3d;
    border-radius: 50%;
    animation: mb-spin 0.8s linear infinite;
}

@keyframes mb-spin {
    to { transform: rotate(360deg); }
}

/* ---- Alerts ---- */
.alert-popup {
    position: relative;
}

/* ---- Project tree ---- */
.project-tree {
    list-style: none;
    padding-left: 0;
}

.project-tree .project-tree {
    padding-left: 1.15rem;
    margin-left: 0.6rem;
    margin-top: 0.25rem;
    border-left: 1px dashed #d8dde4;
}

.project-tree-row {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.1s ease-in-out;
}

.project-tree-row:hover {
    background-color: #eef1f5;
}

.project-tree-toggle {
    width: 1.25rem;
    text-align: center;
    color: #f0ad4e;
}

.project-tree-toggle:hover {
    color: #d99325;
}

.project-tree-leaf-icon {
    display: inline-block;
    width: 1.25rem;
    text-align: center;
    color: #adb5bd;
}

.project-tree-name {
    flex: 1 1 auto;
    font-weight: 500;
}

.project-tree-row-inactive .project-tree-name {
    color: #6c757d;
    font-style: italic;
}

.project-tree-row-inactive .project-tree-toggle,
.project-tree-row-inactive .project-tree-leaf-icon {
    opacity: 0.6;
}
