.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 12.75rem;
    background: var(--bs-tertiary-bg);
    padding-top: 1rem;
    border-right: 1px solid var(--bs-border-color);
}

/* Site title at the top of the sidebar */
.sidebar-brand {
    display: block;
    padding: 0.5rem 1.5rem 1.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    color: var(--bs-emphasis-color);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: var(--bs-emphasis-color);
}

.sidebar .nav-link {
    color: var(--bs-secondary-color);
    padding: 0.75rem 1.5rem;
}

.sidebar .nav-link:hover {
    color: var(--bs-emphasis-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Sign in/out, pinned to the bottom of the sidebar */
.sidebar-account {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bs-border-color);
}

.sidebar .nav-link.active {
    color: var(--bs-emphasis-color);
    background: rgba(255, 255, 255, 0.08);
    font-weight: 500;
}

/* Cards sit a shade lighter than the page, as white cards did on the light gray page */
.card {
    --bs-card-bg: var(--bs-tertiary-bg);
}

.main-content {
    margin-left: 12.75rem; /* sidebar width */
    min-height: 100vh;
}

.mobile-topbar,
.sidebar-backdrop,
.sidebar-close {
    display: none;
}

/* Phones: the sidebar becomes a drawer from the right, opened by the hamburger in a top bar */
@media (max-width: 767.98px) {
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        background: var(--bs-tertiary-bg);
        border-bottom: 1px solid var(--bs-border-color);
    }

    .mobile-brand {
        color: var(--bs-emphasis-color);
        font-size: 1.25rem;
        font-weight: 600;
        text-decoration: none;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        margin-right: -0.5rem;
        border: none;
        border-radius: 0.5rem;
        background: none;
        color: var(--bs-emphasis-color);
        font-size: 1.75rem;
    }

    .mobile-menu-btn:active {
        background: rgba(255, 255, 255, 0.08);
    }

    .sidebar {
        left: auto;
        right: 0;
        z-index: 1050;
        width: min(80vw, 18rem);
        height: 100dvh;
        border-right: none;
        border-left: 1px solid var(--bs-border-color);
        transform: translateX(100%);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
    }

    .sidebar-open .sidebar {
        transform: none;
        box-shadow: -0.5rem 0 1.5rem rgba(0, 0, 0, 0.2);
    }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0.9rem;
        right: 0.75rem;
        width: 2.25rem;
        height: 2.25rem;
        border: none;
        border-radius: 0.5rem;
        background: none;
        color: var(--bs-secondary-color);
        font-size: 1.1rem;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Keep the page from scrolling behind the open drawer */
    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Delete confirmation modal */
.confirm-delete-dialog {
    max-width: 24rem;
}

.confirm-delete-dialog .modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.2);
}

.confirm-delete-dialog .modal-body {
    padding: 1.5rem 1.5rem 0.5rem;
    text-align: center;
}

.confirm-delete-dialog .modal-title {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.confirm-delete-dialog .modal-footer {
    /* Equal space at the left edge, between the buttons, and at the right edge */
    justify-content: space-evenly;
    padding: 1rem 0 1.25rem;
    border-top: none;
}

.confirm-delete-dialog .modal-footer > .btn {
    margin: 0;
    min-width: 5.5rem;
}

/* Rounded, unlabeled toolbar dropdowns (e.g. the users picker from user-filter.js) */
.toolbar-select {
    appearance: none;
    min-width: 8rem;
    padding: 0.4rem 2.25rem 0.4rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 50rem;
    background: var(--bs-body-bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.9rem center / 0.7rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--bs-body-color);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.toolbar-select:hover {
    border-color: var(--bs-secondary-color);
}

.toolbar-select:focus-visible,
.toolbar-select[aria-expanded="true"] {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.toolbar-menu {
    margin-top: 0.35rem !important;
    padding: 0.35rem;
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
}

.toolbar-menu .dropdown-item {
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* Date in a card's bottom-right corner, pinned in its bottom padding so the card's content can't run into it */
.card-age {
    position: absolute;
    right: 0.5rem;
    bottom: 0.2rem;
    color: #adb5bd;
    font-size: 0.65rem;
    line-height: 1;
    white-space: nowrap;
}

/* Card's other bottom corner, e.g. who created a list */
.card-owner {
    position: absolute;
    left: 0.5rem;
    bottom: 0.2rem;
    color: #adb5bd;
    font-size: 0.65rem;
    line-height: 1;
    white-space: nowrap;
}

/* Shared page toolbar */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-toolbar h2 {
    margin: 0;
    font-weight: 700;
    flex-shrink: 0;
}

.page-toolbar .btn-primary {
    margin-left: auto;
}
