/* ══ Shell ═══════════════════════════════════════════════════════════════════════════════════
   The app's frame: the boot splash, the app bar, the sidebar (its organization block, the nav and
   the folded rail), the drawers, the page frame and the product signals. Global because MudBlazor
   renders these elements, so no component's scoped CSS reaches them. */

/* WASM loading splash — replaced by <Routes> when the runtime boots. Palette variables, so it
   tracks the theme (and theme-preflash.js's dark first paint). */
#app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--mud-palette-background);
    z-index: 9999;
}

#app-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--aura-line);
    border-top-color: var(--mud-palette-primary);
    border-radius: 50%;
    animation: aura-spin var(--aura-dur-spin) linear infinite;
}

/* ── App bar ──────────────────────────────────────────────────────────────────────────────────
   A translucent sheet over the page: the content scrolls beneath it, softly blurred, with a
   hairline at its foot. Solid where the person has asked for less transparency. The sheet is the
   bar's ::before, not the bar: an element with a backdrop-filter becomes the containing block of
   every fixed element inside it, so a blurred bar would trap an overlay opened from it (a modal
   menu's scrim, a dialog-like layer) inside its own 48px. */
.mud-appbar.aura-appbar {
    background-color: transparent;
    border-bottom: 1px solid var(--aura-line);
}

.mud-appbar.aura-appbar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: color-mix(in srgb, var(--mud-palette-appbar-background) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
}

@media (prefers-reduced-transparency: reduce) {
    .mud-appbar.aura-appbar::before {
        background-color: var(--mud-palette-appbar-background);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* Three columns, search in the middle (MainLayout's aura-appbar-start / -center / -end). The two
   sides share what's left equally, each at least as wide as what it holds, so the search sits at
   the bar's true centre whichever controls a person's permissions show, and only drifts when the
   window is too narrow for both sides to match. It grows to 560px and gives way first. On a phone
   the middle is the space between: search is an icon beside the others. */
.mud-appbar.aura-appbar .mud-toolbar-appbar {
    display: grid;
    grid-template-columns: minmax(max-content, 1fr) minmax(0, 560px) minmax(max-content, 1fr);
    align-items: center;
    column-gap: var(--aura-space-4);
    padding-inline: var(--aura-space-3);
}

@media (max-width: 599.98px) {
    .mud-appbar.aura-appbar .mud-toolbar-appbar {
        grid-template-columns: max-content minmax(0, 1fr) max-content;
        column-gap: 2px;
    }
}

.aura-appbar-logo.mud-link {
    display: inline-flex;
    align-items: center;
    margin-inline: var(--aura-space-2) var(--aura-space-4);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────────────────────────
   A source list on the chrome surface: the organization at the top, labelled sections, a tinted
   pill and a bar at its edge for the current page. */
.mud-drawer.aura-nav-drawer {
    border-inline-end: 1px solid var(--aura-line);
}

.mud-drawer.aura-nav-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
}

.aura-nav-head {
    flex: 0 0 auto;
    padding: var(--aura-space-3) var(--aura-space-3) var(--aura-space-2);
}

.aura-nav-full {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0 var(--aura-space-3) var(--aura-space-3);
}

.aura-nav-rail {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.aura-nav-section {
    padding: var(--aura-space-4) var(--aura-space-3) var(--aura-space-1);
    color: var(--mud-palette-text-secondary);
    font-size: var(--aura-text-xs);
    font-weight: var(--aura-weight-strong);
    line-height: var(--aura-text-xs-leading);
}

.mud-navmenu.aura-nav .mud-nav-link {
    position: relative;
    min-height: 34px;
    margin-block: 1px;
    padding: 6px 10px;
    border-radius: var(--aura-radius-control);
    color: var(--mud-palette-drawer-text);
    font-size: var(--aura-text-md);
    font-weight: var(--aura-weight-medium);
    line-height: var(--aura-text-md-leading);
    transition:
        background-color var(--aura-dur-hover) var(--aura-ease-standard),
        color var(--aura-dur-hover) var(--aura-ease-standard);
}

.mud-navmenu.aura-nav .mud-nav-link .mud-nav-link-icon {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: var(--mud-palette-drawer-icon);
    transition: color var(--aura-dur-hover) var(--aura-ease-standard);
}

@media (hover: hover) and (pointer: fine) {
    .mud-navmenu.aura-nav .mud-nav-link:not(.active):hover {
        background-color: var(--aura-hover);
        color: var(--mud-palette-text-primary);
    }
}

/* An area's link (NavMenu adds nav-area-current to the link's wrapper) is current on every page the
   area owns, as a link is on its own address. */
.mud-navmenu.aura-nav .mud-nav-link.active:not(.mud-nav-link-disabled),
.mud-navmenu.aura-nav .nav-area-current .mud-nav-link:not(.mud-nav-link-disabled) {
    color: var(--aura-accent-ink);
    background-color: var(--aura-tint-primary);
    border-inline-end-width: 0;
    font-weight: var(--aura-weight-strong);
}

.mud-navmenu.aura-nav .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-icon,
.mud-navmenu.aura-nav .nav-area-current .mud-nav-link .mud-nav-link-icon {
    color: var(--mud-palette-primary);
}

/* The current page's bar at the pill's leading edge, springing in as the page changes. */
.mud-navmenu.aura-nav .mud-nav-link.active:not(.mud-nav-link-disabled)::before,
.mud-navmenu.aura-nav .nav-area-current .mud-nav-link::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: var(--aura-radius-pill);
    background-color: var(--mud-palette-primary);
    animation: aura-pop var(--aura-dur-base) var(--aura-ease-spring) backwards;
}

/* A group's links sit a little in from its heading, without a second set of icons fighting it. */
.mud-navmenu.aura-nav .mud-nav-group .mud-navmenu .mud-nav-link {
    padding-inline-start: 18px;
}

/* ── Sidebar folded to its icons (a wide screen only) ─────────────────────────────────────────
   The drawer and the page's margin both read --mud-drawer-width-left, so narrowing it here moves
   the page over in step, on the drawer's own transition. */
@media (min-width: 960px) {
    .mud-layout.aura-nav-collapsed {
        --mud-drawer-width-left: 64px;
    }

    .mud-layout.aura-nav-collapsed .aura-nav-full,
    .mud-layout.aura-nav-collapsed .app-version {
        display: none;
    }

    .mud-layout.aura-nav-collapsed .aura-nav-rail {
        display: block;
    }

    .mud-layout.aura-nav-collapsed .aura-nav-head {
        padding-inline: var(--aura-space-2);
    }
}

.mud-layout .mud-main-content {
    transition: margin var(--aura-dur-drawer) var(--aura-ease-out);
}

/* ── Drawers beside the page ──────────────────────────────────────────────────────────────── */
.mud-drawer.aura-side-drawer {
    border-inline-start: 1px solid var(--aura-line);
    background-color: var(--aura-surface-raised);
}

/* A closed temporary drawer keeps MudBlazor's shadow, which falls back onto the page's right edge. */
.mud-drawer.aura-side-drawer.mud-drawer--closed {
    box-shadow: none;
}

/* The help drawer's root is the MudDrawer itself, so its rules can't be scoped (HelpDrawer.razor.css). */
.help-drawer-root {
    max-width: 100vw;
}

/* Full width on a phone. Set through the width variable, not `width`: MudBlazor closes the drawer by
   moving it right by --mud-drawer-width, so widening it with `width` alone left it closing short —
   a 100vw drawer pushed out by only 480px, and a strip of it stayed on screen at 481-600px wide. */
@media (max-width: 600px) {
    .help-drawer-root {
        --mud-drawer-width: 100vw !important;
    }
}

/* ── Page frame ───────────────────────────────────────────────────────────────────────────────
   The page starts below the whole app bar — its 48px and the hairline at its foot — so a signal
   strip pulled up to the page's edge meets the bar rather than sliding 9px under it. */
.mud-main-content.aura-main {
    margin-top: var(--aura-appbar-clearance);
    padding: var(--aura-page-gutter) !important;
}

.mud-main-content.aura-onboarding-main {
    min-height: 100vh;
}

.aura-page {
    max-width: var(--aura-content-max);
    margin-inline: auto;
}

/* A page settling in when it opens: MainLayout keys this wrapper on the page's type, so it is new
   (and replays aura-enter) only when the page is. backwards, so no transform is left on it after —
   a transformed ancestor would capture every fixed overlay the page opens. */
.aura-route {
    animation: aura-enter var(--aura-dur-base) var(--aura-ease-out) backwards;
}

/* The administration breadcrumb: small and quiet above the page's title. */
.mud-breadcrumbs.aura-breadcrumbs {
    padding: 0;
    margin-bottom: var(--aura-space-2);
    font-size: var(--aura-text-sm);
    color: var(--mud-palette-text-secondary);
}

/* ── Signals ──────────────────────────────────────────────────────────────────────────────────
   Slim strips across the top of the page: what it would be dangerous to forget. */
.aura-impersonation-banner.mud-alert,
.aura-sandbox-banner.mud-alert,
.aura-shell-notice.mud-alert {
    margin: 0 calc(var(--aura-page-gutter) * -1);
    padding: 8px var(--aura-page-gutter);
    border-radius: 0;
    font-size: var(--aura-text-sm);
    align-items: center;
}

/* One line, its icon and words centred on it — a notice's own top-aligned, separately padded
   layout is for a paragraph, and left a strip's words riding high. */
.aura-impersonation-banner .mud-alert-position,
.aura-sandbox-banner .mud-alert-position,
.aura-shell-notice .mud-alert-position {
    align-items: center;
}

.aura-impersonation-banner .mud-alert-icon,
.aura-impersonation-banner .mud-alert-message,
.aura-sandbox-banner .mud-alert-icon,
.aura-sandbox-banner .mud-alert-message,
.aura-shell-notice .mud-alert-icon,
.aura-shell-notice .mud-alert-message {
    padding-block: 0;
}

/* Edge to edge under the app bar: the first strip meets it, and the page keeps its rhythm below
   the last. (Not :last-of-type — that matches by tag, and the page after the strips is a div too.) */
.mud-main-content.aura-main > .mud-alert:first-child {
    margin-top: calc(var(--aura-page-gutter) * -1);
}

.mud-main-content.aura-main > .mud-alert + .aura-page {
    margin-top: var(--aura-space-5);
}

.aura-impersonation-banner.mud-alert {
    background-color: var(--aura-impersonation);
    color: var(--aura-impersonation-text);
    position: sticky;
    top: var(--aura-appbar-clearance);
    z-index: 11;
}

/* Stuck under the bar as the page scrolls, so its tint is mixed onto the canvas rather than laid
   over it — the page would show through a 12% wash. */
.aura-sandbox-banner.mud-alert {
    background-color: color-mix(in srgb, var(--aura-warning) 12%, var(--aura-canvas));
    position: sticky;
    top: var(--aura-appbar-clearance);
    z-index: 10;
    border-bottom: 1px solid color-mix(in srgb, var(--aura-warning) 30%, transparent);
}

.aura-impersonation-avatar.mud-avatar {
    background-color: var(--aura-impersonation);
    color: var(--aura-impersonation-text);
}

.aura-impersonation-text {
    color: var(--aura-impersonation);
}
