/* ══ Tokens ══════════════════════════════════════════════════════════════════════════════════
   The design's one source of shape, colour roles, depth, type and layout ("quiet confidence",
   .claude/rules/ui-conventions.md). Every colour role derives from a MudBlazor palette variable —
   ThemeBuilder writes those, light or dark, for the tenant's preset — so nothing here is restated
   per mode except depth, which switches on <html data-aura-theme> (theme-preflash.js sets it before
   first paint, aura-ui.js when the theme changes). Components read these through var(); nothing
   restates a value. Load order (App.razor): tokens → typography → motion → skin → shell →
   utilities → vendor. This file is also loaded by the sign-in pages. */
:root {
    /* ── Shape ─────────────────────────────────────────────────────────────────────────────── */
    --aura-radius-badge: 6px;
    --aura-radius-control: 8px;
    --aura-radius-card: 12px;
    /* Dialogs, the command palette, a large panel: a sheet laid over the page. */
    --aura-radius-sheet: 16px;
    --aura-radius-pill: 999px;

    /* ── Space: a 4px scale, and the rhythm built from it ─────────────────────────────────── */
    --aura-space-1: 4px;
    --aura-space-2: 8px;
    --aura-space-3: 12px;
    --aura-space-4: 16px;
    --aura-space-5: 20px;
    --aura-space-6: 24px;
    --aura-space-7: 32px;
    --aura-space-8: 40px;
    --aura-space-9: 48px;
    --aura-space-10: 64px;

    /* Header to content and card to card; inside a card; a card's own padding; the page's edge. */
    --aura-space-page: var(--aura-space-6);
    --aura-space-stack: var(--aura-space-4);
    --aura-card-pad: var(--aura-space-5);
    --aura-page-gutter: var(--aura-space-7);

    /* ── Colour roles ──────────────────────────────────────────────────────────────────────── */
    /* Three levels: the canvas the page sits on, the surface a card is, the inset a group inside a
       card recedes to. Chrome is the sidebar's source-list grey. */
    --aura-canvas: var(--mud-palette-background);
    --aura-surface: var(--mud-palette-surface);
    --aura-surface-inset: var(--mud-palette-background-gray);
    --aura-surface-raised: var(--mud-palette-surface);
    --aura-chrome: var(--mud-palette-drawer-background);

    /* A card's edge is the divider (a hairline), not lines-default, which is the input border and
       reads heavy around a whole card. */
    --aura-line: var(--mud-palette-divider);
    --aura-line-strong: var(--mud-palette-lines-default);

    --aura-text: var(--mud-palette-text-primary);
    --aura-text-muted: var(--mud-palette-text-secondary);

    /* The accent — the tenant's preset. Purple marks what can be acted on, never the frame. */
    --aura-accent: var(--mud-palette-primary);
    /* The accent as words on its own tint (the selected nav item): its deeper shade in light, where
       four presets fell under 4.5:1 on the sidebar's tint; the accent itself in dark (below). */
    --aura-accent-ink: var(--mud-palette-primary-darken);
    --aura-tint-primary: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    --aura-tint-primary-strong: color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);

    /* Interaction washes: over any surface, in either mode. */
    --aura-hover: color-mix(in srgb, var(--mud-palette-text-primary) 4.5%, transparent);
    --aura-pressed: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
    --aura-selected: color-mix(in srgb, var(--mud-palette-primary) 7%, transparent);
    --aura-focus-ring: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
    /* What is on screen while its replacement loads — a table's rows, a chart, a preview — dims to
       this rather than vanishing behind a spinner, so the page holds still. */
    --aura-busy-opacity: 0.55;

    /* A segmented control (skin.css → MudToggleGroup): a recessed track, the chosen option a
       raised chip on it. Dark (below) draws both from the text colour, because a menu's own ground
       is the raised surface and the inset is near black: a chip of either read as a hole there. */
    --aura-segment-track: var(--aura-surface-inset);
    --aura-segment-thumb: var(--aura-surface-raised);

    /* Status: a fill (dots, bars, borders), an ink (text, icons, a filled control's background)
       and a tint (a badge's or notice's ground). The fills are too light to carry text; the inks
       clear 4.5:1 on the surfaces and on their tints (ThemeContrastTests). The ink is MudBlazor's
       base slot, so everything MudBlazor colours by status wears it; the fill is the -lighten one
       (ThemeBuilder). */
    --aura-success: var(--mud-palette-success-lighten);
    --aura-success-ink: var(--mud-palette-success);
    --aura-success-tint: color-mix(in srgb, var(--mud-palette-success-lighten) 12%, transparent);
    --aura-warning: var(--mud-palette-warning-lighten);
    --aura-warning-ink: var(--mud-palette-warning);
    --aura-warning-tint: color-mix(in srgb, var(--mud-palette-warning-lighten) 12%, transparent);
    --aura-danger: var(--mud-palette-error-lighten);
    --aura-danger-ink: var(--mud-palette-error);
    --aura-danger-tint: color-mix(in srgb, var(--mud-palette-error-lighten) 12%, transparent);
    --aura-info: var(--mud-palette-info-lighten);
    --aura-info-ink: var(--mud-palette-info);
    --aura-info-tint: color-mix(in srgb, var(--mud-palette-info-lighten) 12%, transparent);

    /* How much of its tone a status chip's ground takes: none in light, where the chip is the card
       with a toned border; a tint on graphite, where a border alone reads as an outline drawn on
       the dark. StatusBadge mixes it, so every chip follows the appearance. */
    --aura-status-ground: 0%;

    /* What dims the page behind a dialog — MudBlazor's own, so other windows match it. */
    --aura-scrim: var(--mud-palette-overlay-dark);

    /* ── Depth ─────────────────────────────────────────────────────────────────────────────── */
    /* Light: hairlines do most of the work and shadows stay near-invisible until something is
       laid over the page. Dark (below): shadows can't be seen on graphite, so a raised thing is a
       lighter surface with a faint top highlight. */
    --aura-shadow-color: 16 24 40;
    --aura-shadow-card: 0 1px 2px rgb(var(--aura-shadow-color) / 0.04);
    --aura-shadow-raised: 0 8px 24px -6px rgb(var(--aura-shadow-color) / 0.18), 0 2px 6px -2px rgb(var(--aura-shadow-color) / 0.06);
    --aura-shadow-popover: 0 12px 32px -8px rgb(var(--aura-shadow-color) / 0.18), 0 2px 8px -2px rgb(var(--aura-shadow-color) / 0.06);
    --aura-shadow-dialog: 0 24px 64px -12px rgb(var(--aura-shadow-color) / 0.28), 0 4px 12px -4px rgb(var(--aura-shadow-color) / 0.08);
    --aura-highlight: inset 0 0 0 0 transparent;

    /* ── Type ──────────────────────────────────────────────────────────────────────────────── */
    --aura-font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --aura-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    /* cv05: the lowercase l with a tail, so l, I and 1 never read alike in a name or an amount. */
    --aura-font-features: 'cv05';
    /* Sizes for scoped CSS that sets its own, each with its line height and Inter's tracking. */
    --aura-text-xs: 0.75rem;
    --aura-text-xs-leading: 1rem;
    --aura-text-sm: 0.8125rem;
    --aura-text-sm-leading: 1.125rem;
    --aura-text-md: 0.875rem;
    --aura-text-md-leading: 1.25rem;
    --aura-text-lg: 1rem;
    --aura-text-lg-leading: 1.375rem;
    --aura-text-xl: 1.1875rem;
    --aura-text-xl-leading: 1.625rem;
    --aura-tracking-tight: -0.011em;
    --aura-weight-medium: 500;
    --aura-weight-strong: 600;

    /* ── Layout ────────────────────────────────────────────────────────────────────────────── */
    --aura-appbar-height: 48px;
    /* The bar and the hairline at its foot: where the page, and anything stuck under the bar, begins. */
    --aura-appbar-clearance: calc(var(--aura-appbar-height) + 1px);
    --aura-sticky-top: calc(var(--aura-appbar-height) + 32px);
    /* A record page's sticky sidebar (DetailLayout), not the side nav. */
    --aura-sidebar-width: 360px;
    --aura-rail-width: 240px;
    --aura-content-max: 1600px;

    /* ── Product signals ───────────────────────────────────────────────────────────────────── */
    /* Fixed, not the tenant's brand: impersonation must read the same in every tenant, whatever
       colour its preset makes the primary. */
    --aura-impersonation: #7c3aed;
    --aura-impersonation-text: #ffffff;
    --aura-sandbox: var(--aura-warning);

    /* Paper: a rendered document — an email, a letter, a statement — is authored on white and
       previewed on white in either theme, because that is how it will be read. */
    --aura-paper: #ffffff;
    --aura-paper-ink: #1a1a1a;
}

/* Native controls (scrollbars, a date input's own picker, form autofill) follow the appearance. */
:root {
    color-scheme: light;
}

/* Dark depth. Four levels, each a step lighter (ThemeBuilder): the canvas, the chrome, a card, and
   the raised surface — the card lifted 4% toward white, Apple's elevated step — for everything laid
   over the page. A card carries a faint highlight along its top edge and a shadow below it, so it
   sits on the canvas rather than being drawn round; every overlay carries the same highlight. */
:root[data-aura-theme="dark"] {
    color-scheme: dark;
    --aura-surface-raised: color-mix(in srgb, var(--mud-palette-surface) 96%, #ffffff);
    --aura-shadow-color: 0 0 0;
    --aura-shadow-card: inset 0 1px 0 0 rgb(255 255 255 / 0.035), 0 1px 3px 0 rgb(0 0 0 / 0.35);
    /* The accent marks a choice more surely on graphite than its light-mode wash would: a selected
       nav item, a chosen tab's ground, an icon tile — still a tint, never a fill. */
    --aura-tint-primary: color-mix(in srgb, var(--mud-palette-primary) 18%, transparent);
    --aura-tint-primary-strong: color-mix(in srgb, var(--mud-palette-primary) 26%, transparent);
    --aura-selected: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    --aura-hover: color-mix(in srgb, var(--mud-palette-text-primary) 5.5%, transparent);
    --aura-status-ground: 14%;
    --aura-accent-ink: var(--mud-palette-primary);
    --aura-shadow-raised: 0 8px 24px -6px rgb(0 0 0 / 0.55);
    --aura-shadow-popover: 0 16px 40px -8px rgb(0 0 0 / 0.6);
    --aura-shadow-dialog: 0 28px 72px -12px rgb(0 0 0 / 0.7);
    --aura-highlight: inset 0 1px 0 0 rgb(255 255 255 / 0.05);
    /* A light wash over whatever it sits on (a card, a menu) and a chip clearly lighter than it,
       as macOS draws one in the dark; the unselected labels stay 4.5:1 on the track. */
    --aura-segment-track: color-mix(in srgb, var(--mud-palette-text-primary) 6%, transparent);
    --aura-segment-thumb: color-mix(in srgb, var(--mud-palette-text-primary) 26%, var(--mud-palette-surface));
}

@media (min-width: 1280px) {
    :root {
        --aura-sidebar-width: 380px;
    }
}

@media (max-width: 960px) {
    :root {
        --aura-page-gutter: var(--aura-space-6);
    }
}

@media (max-width: 600px) {
    :root {
        --aura-card-pad: var(--aura-space-4);
        --aura-page-gutter: var(--aura-space-4);
    }
}
