/* ══ Skin ════════════════════════════════════════════════════════════════════════════════════
   MudBlazor's own elements restyled in the app's language — the half of the design system that
   needs no page to change. MudBlazor owns the behaviour (focus, keyboard, positioning); this file
   owns how it looks and moves, on the tokens. It is the one file whose rules may target a bare
   .mud-* class: MudBlazor renders these elements, so no component's scoped CSS reaches them, and
   the sign-in pages wear it too. Every class named here exists in the MudBlazor version the app
   references (SkinSelectorTests), so an upgrade that renames one fails the build, not the look.
   See .claude/rules/ui-conventions.md → Skin. */

/* ── Type ────────────────────────────────────────────────────────────────────────────────────── */
/* Titles break into even lines rather than leaving one word alone on the last. */
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6,
.mud-typography-subtitle1 {
    text-wrap: balance;
}

/* Running text avoids a lone last word too. */
.mud-typography-body1,
.mud-typography-body2 {
    text-wrap: pretty;
}

/* Figures line up: every metric and every number in a table is tabular. */
.mud-typography-h5 {
    font-variant-numeric: tabular-nums;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────────────────────
   Flat and tactile: no Material shadow or ripple (the theme sets the ripple's opacity to 0), a
   colour change on hover, and a press that gives a little under the pointer and springs back on
   release — the press is quick and plain, the release takes the spring. */
.mud-button-root {
    transition:
        background-color var(--aura-dur-hover) var(--aura-ease-standard),
        color var(--aura-dur-hover) var(--aura-ease-standard),
        border-color var(--aura-dur-hover) var(--aura-ease-standard),
        box-shadow var(--aura-dur-hover) var(--aura-ease-standard),
        transform var(--aura-dur-base) var(--aura-ease-spring),
        scale var(--aura-dur-base) var(--aura-ease-spring);
}

/* The press is the scale property, not a transform, so it adds to whatever transform the element
   already has (a switch's thumb slides by one) instead of replacing it. */
.mud-button-root:active:not(:disabled) {
    scale: var(--aura-press-scale);
    transition:
        background-color var(--aura-dur-hover) var(--aura-ease-standard),
        transform var(--aura-dur-base) var(--aura-ease-spring),
        scale var(--aura-dur-press) var(--aura-ease-standard);
}

.mud-button-root:focus-visible {
    outline: none;
    box-shadow: var(--aura-focus-ring);
}

.mud-button {
    min-height: 36px;
    padding: 7px 14px;
    border-radius: var(--aura-radius-control);
}

.mud-button.mud-button-filled-size-small,
.mud-button.mud-button-outlined-size-small,
.mud-button.mud-button-text-size-small {
    min-height: 30px;
    padding: 4px 10px;
    font-size: var(--aura-text-sm);
}

.mud-button.mud-button-filled-size-large,
.mud-button.mud-button-outlined-size-large,
.mud-button.mud-button-text-size-large {
    min-height: 44px;
    padding: 10px 20px;
}

.mud-button-filled,
.mud-button-filled:hover,
.mud-button-filled:active {
    box-shadow: 0 1px 2px rgb(var(--aura-shadow-color) / 0.14), inset 0 1px 0 rgb(255 255 255 / 0.08);
}

.mud-button-filled:focus-visible {
    box-shadow: var(--aura-focus-ring);
}

@media (hover: hover) and (pointer: fine) {
    .mud-button-outlined:hover,
    .mud-button-text:hover {
        background-color: var(--aura-hover);
    }
}

/* A secondary button: a hairline on the surface, the text's own colour. */
.mud-button-outlined.mud-button-outlined-default {
    border-color: var(--aura-line-strong);
    background-color: var(--aura-surface);
}

/* On graphite it is a faint lift over whatever it sits on — the card's grey would sink it into a
   raised dialog or menu, where the ground is lighter than the card. */
:root[data-aura-theme="dark"] .mud-button-outlined.mud-button-outlined-default {
    background-color: color-mix(in srgb, var(--mud-palette-text-primary) 4%, transparent);
}

/* Icon buttons are rounded squares, as a toolbar's are, not Material's circles. */
.mud-icon-button {
    border-radius: var(--aura-radius-control);
}

/* An icon with a count or dot on it (IconButton): MudBlazor sets an icon button's own content as a
   line of body text, whose baseline gap made the button taller than its neighbours and lifted the
   icon off their line. */
.mud-icon-button > .mud-typography:has(> .mud-badge-root),
.mud-icon-button > .mud-typography > .mud-badge-root {
    display: flex;
}

/* ── Fields ──────────────────────────────────────────────────────────────────────────────────
   A quiet line that darkens on hover. The label floats into a notch in the line, so focus is the
   line itself — the accent, two pixels — which the notch breaks cleanly: a ring around the box
   (a box-shadow) can't follow the notch and ran through the label. */
.mud-input.mud-input-outlined .mud-input-outlined-border {
    transition: border-color var(--aura-dur-hover) var(--aura-ease-standard);
}

@media (hover: hover) and (pointer: fine) {
    .mud-input.mud-input-outlined:not(.mud-disabled):not(:focus-within):hover .mud-input-outlined-border {
        border-color: color-mix(in srgb, var(--mud-palette-lines-inputs) 55%, var(--mud-palette-text-secondary));
    }
}

.mud-input.mud-input-outlined:focus-within > .mud-input-outlined-border,
.mud-input.mud-input-outlined:focus-within .mud-shrink > .mud-input-outlined-border {
    border-width: 2px;
    border-color: var(--mud-palette-primary);
}

/* A field with a problem stays red while it is being fixed. */
.mud-input.mud-input-outlined.mud-input-error:focus-within > .mud-input-outlined-border {
    border-color: var(--mud-palette-error);
}

/* What is typed and the label are text, not headings. MudBlazor sets a field in the subtitle1
   style, which this theme makes semibold for sub-section titles. */
.mud-input.mud-typography-subtitle1,
.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
    font-weight: var(--mud-typography-body1-weight);
}

/* The label at rest is centred in the box, on the line the text will be typed on: MudBlazor
   places it for its own 16px type, which left it 2–3px low in these 14px fields (most visible in
   a select). The box is 53.6px (37.6px dense) and the label's line 18.4px. */
.mud-input-label-outlined {
    transform: translate(14px, 17.6px) scale(1);
}

.mud-input-label-outlined.mud-input-label-margin-dense {
    transform: translate(14px, 9.6px) scale(1);
}

/* Floated into the notch at 12px — the notch's own size — rather than MudBlazor's three-quarters
   of 14px, whose 10.5px label sat in a gap cut for a bigger one. */
.mud-shrink ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined,
.mud-input:focus-within ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined,
.mud-input:has(:-webkit-autofill) ~ label.mud-input-label.mud-input-label-inputcontrol.mud-input-label-outlined {
    transform: translate(14px, -7.4px) scale(0.8571);
    max-width: 116%;
}

/* A label at rest stops before a select's arrow or an end icon instead of running under it. */
.mud-input.mud-input-adorned-end:not(.mud-shrink):not(:focus-within) ~ label.mud-input-label-outlined {
    max-width: calc(100% - 48px);
}

/* Disabled reads as quieter than enabled, not darker: a hairline and the inset ground. */
.mud-input.mud-input-outlined.mud-disabled .mud-input-outlined-border {
    border-color: var(--aura-line);
}

.mud-input.mud-input-outlined.mud-disabled {
    background-color: var(--aura-surface-inset);
    border-radius: var(--aura-radius-control);
}

/* ── Menus, selects and pickers ──────────────────────────────────────────────────────────────
   A raised sheet with a hairline, dropping from its anchor; rows highlight inside the sheet with
   a little inset, as a macOS menu's do. Tooltips are popovers too, but carry no paper. */
.mud-popover.mud-paper {
    border-radius: var(--aura-radius-card);
    background-color: var(--aura-surface-raised);
    box-shadow: var(--aura-shadow-popover), 0 0 0 1px var(--aura-line), var(--aura-highlight);
}

.mud-popover.mud-popover-open.mud-paper {
    animation: aura-drop var(--aura-dur-fast) var(--aura-ease-out) backwards;
}

.mud-popover.mud-paper .mud-list {
    padding: var(--aura-space-1);
}

.mud-popover.mud-paper .mud-list-item,
.mud-popover.mud-paper .mud-menu-item {
    border-radius: var(--aura-radius-badge);
    transition: background-color var(--aura-dur-hover) var(--aura-ease-standard);
}

.mud-list-item.mud-selected-item {
    background-color: var(--aura-selected);
}

/* ── Tooltips ────────────────────────────────────────────────────────────────────────────────── */
/* On graphite a tooltip is a small raised sheet, lighter than the menu it may sit over — MudBlazor's
   grey read as a hole in the dark. In light it keeps MudBlazor's dark label. */
:root[data-aura-theme="dark"] .mud-tooltip.mud-tooltip-default {
    background-color: color-mix(in srgb, var(--mud-palette-surface) 84%, #ffffff);
    color: var(--mud-palette-text-primary);
    box-shadow: var(--aura-shadow-popover), 0 0 0 1px var(--aura-line);
}

.mud-tooltip {
    padding: 5px 8px;
    border-radius: var(--aura-radius-badge);
    font-size: var(--aura-text-xs);
    font-weight: var(--aura-weight-medium);
    line-height: var(--aura-text-xs-leading);
    box-shadow: var(--aura-shadow-popover);
}

/* ── Chips and badges ────────────────────────────────────────────────────────────────────────── */
.mud-chip {
    border-radius: var(--aura-radius-badge);
    transition:
        background-color var(--aura-dur-hover) var(--aura-ease-standard),
        border-color var(--aura-dur-hover) var(--aura-ease-standard),
        color var(--aura-dur-hover) var(--aura-ease-standard);
}

.mud-chip.mud-chip-size-small {
    border-radius: var(--aura-radius-badge);
}

.mud-badge.mud-badge-dot {
    animation: aura-pop var(--aura-dur-base) var(--aura-ease-spring) backwards;
}

/* ── Notices ─────────────────────────────────────────────────────────────────────────────────
   A status colour on text, an icon or a filled control is its ink without a rule here: the theme
   puts the ink in MudBlazor's base slot (ThemeBuilder), so buttons, chips, badges, field errors and
   .mud-*-text all wear it. The fill is for dots and tints.

   Notices are calm: a tinted ground, the ink for the words and icon, no border shouting. */
.mud-alert {
    border-radius: var(--aura-radius-card);
    padding: 8px 14px;
    align-items: flex-start;
}

.mud-alert-text-info { background-color: var(--aura-info-tint); color: var(--aura-info-ink); }
.mud-alert-text-success { background-color: var(--aura-success-tint); color: var(--aura-success-ink); }
.mud-alert-text-warning { background-color: var(--aura-warning-tint); color: var(--aura-warning-ink); }
.mud-alert-text-error { background-color: var(--aura-danger-tint); color: var(--aura-danger-ink); }

.mud-alert-outlined-info { background-color: var(--aura-info-tint); border-color: transparent; color: var(--aura-info-ink); }
.mud-alert-outlined-success { background-color: var(--aura-success-tint); border-color: transparent; color: var(--aura-success-ink); }
.mud-alert-outlined-warning { background-color: var(--aura-warning-tint); border-color: transparent; color: var(--aura-warning-ink); }
.mud-alert-outlined-error { background-color: var(--aura-danger-tint); border-color: transparent; color: var(--aura-danger-ink); }

/* ── Toasts ──────────────────────────────────────────────────────────────────────────────────
   A raised card rising from the corner, the tone in its icon — the words stay the text's colour,
   so a run of toasts reads as calm, not as a row of coloured slabs. */
.mud-snackbar {
    min-height: 44px;
    padding: 6px 10px 6px 14px;
    border-radius: var(--aura-radius-card);
    background-color: var(--aura-surface-raised) !important;
    color: var(--mud-palette-text-primary) !important;
    box-shadow: var(--aura-shadow-popover), 0 0 0 1px var(--aura-line), var(--aura-highlight);
    font-weight: var(--aura-weight-medium);
    animation: aura-rise var(--aura-dur-dialog) var(--aura-ease-spring) backwards;
}

.mud-snackbar .mud-snackbar-icon {
    padding: 4px 0;
    font-size: 20px;
}

.mud-snackbar.mud-alert-filled-success .mud-snackbar-icon { color: var(--aura-success-ink); }
.mud-snackbar.mud-alert-filled-warning .mud-snackbar-icon { color: var(--aura-warning-ink); }
.mud-snackbar.mud-alert-filled-error .mud-snackbar-icon { color: var(--aura-danger-ink); }
.mud-snackbar.mud-alert-filled-info .mud-snackbar-icon { color: var(--aura-info-ink); }

/* The toast's action ("Undo") is a text button in the accent; its close is a quiet icon. */
.mud-snackbar .mud-snackbar-content-action > .mud-button {
    background-color: transparent !important;
    box-shadow: none !important;
    color: var(--mud-palette-primary) !important;
    font-weight: var(--aura-weight-strong);
}

.mud-snackbar .mud-snackbar-content-action > .mud-icon-button {
    color: var(--mud-palette-text-secondary) !important;
}

/* ── Dialogs ─────────────────────────────────────────────────────────────────────────────────
   A sheet that rises a few pixels and scales up to size on a spring while the page dims behind
   it. MudBlazor removes a dialog the moment it closes, so it leaves without motion. */
.mud-dialog {
    /* The close button is placed absolutely in the title; MudBlazor's own entrance leaves a
       transform on the dialog for good, which happened to anchor it. Ours leaves none (a lingering
       transform traps fixed overlays), so the dialog anchors it itself — without this the X slid to
       the window's corner the moment the dialog finished opening. A corner dialog's own absolute
       position anchors it as well. */
    position: relative;
    border-radius: var(--aura-radius-sheet);
    background-color: var(--aura-surface-raised);
    box-shadow: var(--aura-shadow-dialog), 0 0 0 1px var(--aura-line), var(--aura-highlight);
    animation: aura-enter-scale var(--aura-dur-dialog) var(--aura-ease-spring) backwards;
}

.mud-overlay .mud-overlay-scrim {
    animation: aura-fade-in var(--aura-dur-dialog) var(--aura-ease-standard) backwards;
}

/* ── Drawers ─────────────────────────────────────────────────────────────────────────────────
   Decelerating into place over the drawer's duration — MudBlazor slides drawers by their edge,
   so these restate its own rules with the design's timing. */
.mud-drawer.mud-drawer-temporary.mud-drawer-pos-right:not(.mud-drawer--initial) {
    transition: right var(--aura-dur-drawer) var(--aura-ease-out), box-shadow var(--aura-dur-drawer) var(--aura-ease-out);
}

.mud-drawer.mud-drawer-temporary.mud-drawer-pos-left:not(.mud-drawer--initial),
.mud-drawer.mud-drawer-responsive.mud-drawer-pos-left:not(.mud-drawer--initial),
.mud-drawer.mud-drawer-persistent.mud-drawer-pos-left:not(.mud-drawer--initial) {
    transition: left var(--aura-dur-drawer) var(--aura-ease-out), width var(--aura-dur-drawer) var(--aura-ease-out);
}

.mud-drawer.mud-drawer-mini {
    transition: width var(--aura-dur-drawer) var(--aura-ease-out);
}

.mud-drawer.mud-drawer-temporary.mud-drawer--open {
    box-shadow: var(--aura-shadow-dialog);
}

/* ── Disclosure (nav groups, expansion panels) ───────────────────────────────────────────────── */
.mud-collapse-container {
    transition: grid-template-rows var(--aura-dur-base) var(--aura-ease-standard);
}

.mud-nav-link-expand-icon {
    transition: transform var(--aura-dur-fast) var(--aura-ease-standard);
}

/* ── Tabs ────────────────────────────────────────────────────────────────────────────────────── */
/* CLAUDE.md: never render UI text in ALL CAPS — MudBlazor uppercases .mud-tab in its own
   stylesheet, which the theme's typography cannot reach. */
.mud-tab {
    text-transform: none;
    letter-spacing: normal;
    transition: color var(--aura-dur-hover) var(--aura-ease-standard), background-color var(--aura-dur-hover) var(--aura-ease-standard);
}

.mud-tab-slider.mud-tab-slider-horizontal {
    border-radius: var(--aura-radius-pill);
    transition: left var(--aura-dur-base) var(--aura-ease-standard), width var(--aura-dur-base) var(--aura-ease-standard);
}

/* Tab counts on graphite: a filled accent badge on every tab flooded the bar with purple, so each
   count is a quiet pill and only the chosen tab's takes the accent's tint. A warning count (overdue
   tasks) keeps its tone, as a tint. */
:root[data-aura-theme="dark"] .mud-tab .mud-badge.mud-theme-primary {
    background-color: var(--aura-hover) !important;
    color: var(--mud-palette-text-secondary) !important;
}

:root[data-aura-theme="dark"] .mud-tab.mud-tab-active .mud-badge.mud-theme-primary {
    background-color: var(--aura-tint-primary-strong) !important;
    color: var(--mud-palette-primary) !important;
}

:root[data-aura-theme="dark"] .mud-tab .mud-badge.mud-theme-warning {
    background-color: color-mix(in srgb, var(--aura-warning) 22%, transparent) !important;
    color: var(--aura-warning-ink) !important;
}

/* ── Segmented controls (MudToggleGroup) ─────────────────────────────────────────────────────
   A recessed track holding its options, the chosen one a raised chip on it — the macOS segmented
   control, not a row of buttons with one filled in. MudBlazor renders each option as a button and
   marks the chosen one with aria-checked, which is what this keys on. */
.mud-toggle-group.mud-toggle-group-outlined {
    gap: 2px;
    padding: 2px;
    border: 0;
    border-radius: var(--aura-radius-control);
    background-color: var(--aura-segment-track);
    box-shadow: inset 0 0 0 1px var(--aura-line);
}

.mud-toggle-group.mud-toggle-group-outlined > .mud-toggle-item {
    min-width: 0;
    min-height: 26px;
    padding: 2px 10px;
    border-width: 0 !important;
    border-radius: var(--aura-radius-badge) !important;
    background-color: transparent;
    box-shadow: none;
    color: var(--mud-palette-text-secondary);
    font-weight: var(--aura-weight-medium);
    transition:
        background-color var(--aura-dur-hover) var(--aura-ease-standard),
        color var(--aura-dur-hover) var(--aura-ease-standard),
        box-shadow var(--aura-dur-hover) var(--aura-ease-standard),
        transform var(--aura-dur-base) var(--aura-ease-spring);
}

.mud-toggle-group.mud-toggle-group-outlined > .mud-toggle-item[aria-checked="true"] {
    background-color: var(--aura-segment-thumb);
    color: var(--mud-palette-text-primary);
    box-shadow: 0 1px 2px rgb(var(--aura-shadow-color) / 0.12), 0 0 0 1px var(--aura-line), var(--aura-highlight);
}

@media (hover: hover) and (pointer: fine) {
    .mud-toggle-group.mud-toggle-group-outlined > .mud-toggle-item:not([aria-checked="true"]):hover {
        background-color: var(--aura-hover);
        color: var(--mud-palette-text-primary);
    }
}

/* ── Tables ──────────────────────────────────────────────────────────────────────────────────
   A row answers the pointer quickly and quietly; while a table loads new rows, the old ones dim
   rather than vanishing behind a spinner, so the page holds still. */
.mud-table-row {
    transition: background-color var(--aura-dur-hover) var(--aura-ease-standard);
}

.mud-table .mud-table-body {
    transition: opacity var(--aura-dur-base) var(--aura-ease-standard);
}

.mud-table:has(.mud-table-loading-progress) .mud-table-body {
    opacity: var(--aura-busy-opacity);
}

/* ── Loading ─────────────────────────────────────────────────────────────────────────────────
   A skeleton breathes with a slow, soft sweep; Reduce Motion holds it still. */
.mud-skeleton {
    border-radius: var(--aura-radius-badge);
}

.mud-skeleton.mud-skeleton-pulse,
.mud-skeleton.mud-skeleton-wave {
    background-image: linear-gradient(90deg, transparent 0%, var(--aura-hover) 40%, var(--aura-hover) 60%, transparent 100%);
    background-size: 200% 100%;
    animation: aura-shimmer var(--aura-dur-ambient) linear infinite;
}

.mud-skeleton.mud-skeleton-wave::after {
    display: none;
}

.mud-progress-linear .mud-progress-linear-bar {
    transition: transform var(--aura-dur-base) var(--aura-ease-standard);
}
