/* ---------------------------------------------------------------------
   Logged-in app shell (AppLayout.razor). Pure HTML/CSS on purpose:
   AppLayout is static SSR and can't carry a @rendermode, so the
   collapsible groups are <details> and the mobile drawer is a checkbox.
   --------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: var(--mw-sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.nav-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--mw-surface);
    border-right: 1px solid var(--mw-border);
    padding: 18px 12px 14px;
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    color: var(--mw-primary-text);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.02em;
}

.brand:hover {
    text-decoration: none;
}

.brand svg {
    color: var(--mw-primary-text);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav a,
.nav summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 35px;
    padding: 0 12px;
    border-radius: var(--mw-radius-sm);
    color: var(--mw-text);
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.nav a:hover,
.nav summary:hover {
    background: var(--mw-hover);
    text-decoration: none;
}

.nav a.active {
    background: var(--mw-primary);
    color: #fff;
}

.nav summary {
    color: var(--mw-muted);
}

.nav summary::-webkit-details-marker {
    display: none;
}

.nav summary .caret {
    width: 7px;
    height: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
    margin-right: 3px;
}

.nav details[open] > summary .caret {
    transform: rotate(45deg);
}

.nav details[open] > summary {
    color: var(--mw-text);
}

.nav .sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px 10px;
    margin-left: 12px;
    border-left: 1px solid var(--mw-border);
}

.nav .sub a {
    height: 32px;
    font-weight: 400;
    color: var(--mw-text-2);
}

.nav .sub a.active {
    color: #fff;
    font-weight: 500;
}

.nav .count {
    font-size: 11px;
    font-weight: 600;
    background: var(--mw-warning-soft);
    color: var(--mw-warning);
    border-radius: 999px;
    padding: 1px 7px;
}

.nav a.active .count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 12px;
}

/* "Report an issue" is a MudButton (it opens a MudDialog) styled to read as one more sidebar row. */
.sidebar-foot .mud-button-root.sidebar-foot-btn {
    justify-content: flex-start;
    width: 100%;
    height: 35px;
    padding: 0 12px;
    border-radius: var(--mw-radius-sm);
    color: var(--mw-muted);
    font-size: 13.5px;
    font-weight: 500;
    text-transform: none;
}

.sidebar-foot .mud-button-root.sidebar-foot-btn:hover {
    background: var(--mw-hover);
    color: var(--mw-text);
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--mw-topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: var(--mw-surface);
    border-bottom: 1px solid var(--mw-border);
}

.topbar .identity {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.topbar .identity b {
    font-weight: 600;
    white-space: nowrap;
}

.topbar .identity span {
    color: var(--mw-muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .spacer {
    flex: 1;
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    background: var(--mw-surface);
    cursor: pointer;
}

.scrim {
    display: none;
}

.content {
    padding: 28px 24px 64px;
}

.page {
    max-width: 1080px;
}

.page.wide {
    max-width: 1320px;
}

/* Banner stack under the top bar (SES health, billing alert, email verification). */
.banners {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px 0;
    max-width: 1128px;
}

.banners:empty {
    display: none;
}

/* Banner components each render their own wrapper; keep them stacked and spaced consistently. */
.billing-alert-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px 0;
    max-width: 1128px;
}

.ses-domain-health-banner {
    margin: 16px 24px 0;
    max-width: 1080px;
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform .2s;
        box-shadow: var(--mw-shadow-pop);
    }

    .nav-toggle:checked ~ .sidebar {
        transform: none;
    }

    .nav-toggle:checked ~ .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: var(--mw-overlay);
        z-index: 35;
    }

    .hamburger {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .content {
        padding: 20px 16px 48px;
    }

    .banners,
    .billing-alert-stack {
        padding: 12px 16px 0;
    }

    .ses-domain-health-banner {
        margin: 12px 16px 0;
    }

    .topbar .identity span {
        display: none;
    }
}

/* Pages that need more than the default reading width (inbox, admin tables) drop an empty
   <div class="wide-marker"></div> anywhere inside themselves — the layout's .page widens to match. */
.wide-marker {
    display: none;
}

.page:has(.wide-marker) {
    max-width: 1320px;
}
