.drawer-content-flex {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

    .drawer-content-flex .navmenu-user-section {
        margin-top: auto;
        padding: 1rem 0.5rem 0.5rem 0.5rem;
    }

.navmenu-user-card {
    border-radius: 12px;
    /* Was hardcoded #fff, which turned into a white slab in dark mode. */
    background: var(--mud-palette-surface);
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.04);
}

h1:focus {
    outline: none;
}

/* Blazor-template leftovers, repointed at the MudBlazor palette so they follow
   light/dark instead of staying Bootstrap blue. */
a, .btn-link {
    color: var(--mud-palette-primary);
}

.btn-primary {
    color: var(--mud-palette-primary-text);
    background-color: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary-darken);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem var(--mud-palette-primary-hover);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mud-palette-success);
}

.invalid {
    outline: 1px solid var(--mud-palette-error);
}

.validation-message {
    color: var(--mud-palette-error);
}

#blazor-error-ui {
    background: var(--mud-palette-warning);
    color: var(--mud-palette-warning-text);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0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40NDg2Ni4wNTQ3IDI2My41NzYgODYuMDU0N0oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #C4433B;
    background: var(--mud-palette-error) !important;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #D7D0C4;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #D97960;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: var(--mud-palette-secondary);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* SortableJS drag-and-drop */
.sortable-ghost {
    opacity: 0.25 !important;
    background-color: var(--mud-palette-primary-hover) !important;
    border-radius: 4px;
}

.sortable-chosen {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    opacity: 0.95;
}

/* Soft table look to reduce visual weight and bottom seam */
.soft-table .mud-table-head {
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.soft-table .mud-table-container {
  border-bottom: 0 !important;
}
.soft-table .mud-table {
  border-collapse: separate;
  border-spacing: 0;
}

/* ============================================
   MudBlazor Theme Extensions
   These classes use MudBlazor CSS variables from the ThemeProvider.
   Only add classes here for functionality MudBlazor doesn't provide.
   ============================================ */

/* Background colors - MudPaper/MudCard don't have Color prop for backgrounds */
.bg-background-grey { background-color: var(--mud-palette-background-gray) !important; }
.bg-primary-light { background-color: var(--mud-palette-primary-lighten) !important; }
.bg-success-light { background-color: var(--mud-palette-success-lighten) !important; }
.bg-info-light { background-color: var(--mud-palette-info-lighten) !important; }
.bg-primary-gradient {
    background: linear-gradient(135deg, var(--mud-palette-primary) 0%, var(--mud-palette-primary-darken) 100%) !important;
}

/* Text colours follow the palette's contrast text rather than assuming white. */
.text-on-primary { color: var(--mud-palette-primary-text) !important; }
.text-on-primary-muted { color: var(--mud-palette-primary-text) !important; opacity: 0.85; }
.text-white { color: white !important; }

/* Border accents - MudBlazor doesn't have border-left color utilities */
.border-left-info { border-left: 4px solid var(--mud-palette-info) !important; }
.border-left-success { border-left: 4px solid var(--mud-palette-success) !important; }
.border-primary { border: 2px solid var(--mud-palette-primary) !important; }

/* Border radius - supplements MudBlazor's rounded classes */
.rounded-lg { border-radius: 12px !important; }
.rounded-md { border-radius: 8px !important; }

/* Text formatting not in MudBlazor */
.white-space-pre-wrap { white-space: pre-wrap !important; }

/* Width utilities not in MudBlazor - for menus/dropdowns */
.w-100 { width: 100% !important; }
.min-w-300 { min-width: 300px !important; }
.max-w-360 { max-width: 360px !important; }

/* Icon sizes beyond MudBlazor's Size enum */
.icon-3x { font-size: 3rem !important; }
.icon-4x { font-size: 4rem !important; }
.icon-5x { font-size: 5rem !important; }

/* Layout */
.min-vh-100 { min-height: 100vh !important; }
.logo-100 { max-width: 100px !important; max-height: 100px !important; }
/* The WASM loading indicator renders before MudBlazor publishes CSS variables. */
@media (prefers-color-scheme: dark) {
    .loading-progress circle { stroke: #263746; }
    .loading-progress circle:last-child { stroke: #D97960; }
    .loading-progress-text { color: #F3EFE5; }
}

/* MudThemeProvider changes palette variables without a stable DOM mode class.
   This mode-neutral ring remains clear on warm paper (Nocturne separation) and
   Nocturne surfaces (Moon focus). */
:focus-visible {
    outline: 3px solid #E7DCC3 !important;
    outline-offset: 0;
    box-shadow: 0 0 0 5px #111925 !important;
}

/* Warm Editorial portal shell ------------------------------------------------ */
.lumevia-shell {
    min-height: 100dvh;
    background: var(--mud-palette-background);
}

.signed-out-main {
    padding-top: 0 !important;
}

h1[tabindex="-1"]:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.lumevia-shell,
.lumevia-shell .mud-appbar,
.lumevia-shell .mud-drawer,
.editorial-page,
.editorial-panel,
.editorial-toolbar {
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.editorial-page {
    min-width: 0;
    min-height: calc(100dvh - var(--mud-appbar-height));
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-background);
}

.editorial-page h1,
.editorial-page h2,
.editorial-page h3 {
    font-family: Manrope, Inter, sans-serif;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.editorial-panel {
    min-width: 0;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
}

.editorial-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0.9rem 1rem;
    background: var(--mud-palette-surface);
    border-block: 1px solid var(--mud-palette-divider);
}

.editorial-status {
    display: inline-flex;
    gap: 0.45rem;
    align-items: center;
    color: var(--mud-palette-success-darken);
    font-weight: 650;
}

.editorial-empty {
    max-width: 48rem;
    padding: clamp(2rem, 5vw, 4rem);
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
    border-left: 4px solid var(--mud-palette-primary);
}

.login-workspace > h4 {
    margin-bottom: 0.35rem;
    font-family: Manrope, Inter, sans-serif;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.045em;
}

.login-workspace .mud-input-control,
.login-workspace .mud-button-root {
    min-height: 44px;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* Warm Editorial management surfaces --------------------------------------- */
.editorial-dashboard {
    display: grid;
    gap: clamp(2rem, 5vw, 4.5rem);
    padding-block: clamp(2.5rem, 7vw, 6rem);
}

.editorial-page-heading {
    max-width: 58rem;
}

.editorial-page-heading h3,
.editorial-page-heading h4 {
    max-width: 18ch;
    margin-bottom: 1rem;
    font-family: Manrope, Inter, sans-serif;
    font-weight: 590;
    line-height: 1.03;
    letter-spacing: -0.05em;
}

.editorial-page-heading > p:last-child {
    max-width: 64ch;
    color: var(--mud-palette-text-secondary);
    line-height: 1.7;
}

.editorial-eyebrow {
    display: block;
    margin-bottom: 0.85rem;
    padding-left: 0.65rem;
    color: var(--mud-palette-text-primary) !important;
    border-left: 3px solid var(--mud-palette-primary);
    font-weight: 750 !important;
    letter-spacing: 0.14em !important;
}

.editorial-task-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--mud-palette-divider);
    border-left: 1px solid var(--mud-palette-divider);
}

.editorial-task-link {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    min-height: 8.5rem;
    padding: 1.5rem;
    color: var(--mud-palette-text-primary) !important;
    background: var(--mud-palette-surface);
    border-right: 1px solid var(--mud-palette-divider);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.editorial-task-link:hover {
    background: var(--mud-palette-primary-hover);
}

.editorial-task-link > .mud-icon-root:first-child {
    color: var(--mud-palette-primary);
}

.editorial-task-link strong,
.editorial-task-link small {
    display: block;
}

.editorial-task-link strong {
    margin-bottom: 0.3rem;
    font-family: Manrope, Inter, sans-serif;
    font-size: 1rem;
}

.editorial-task-link small {
    color: var(--mud-palette-text-secondary);
    line-height: 1.5;
}

.editorial-page-shell {
    display: grid;
    gap: 1.5rem;
    padding-block: clamp(1.5rem, 4vw, 3rem);
}

.editorial-section-title,
.editorial-row-title {
    font-weight: 650 !important;
}

.editorial-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--mud-palette-divider);
    border-left: 1px solid var(--mud-palette-divider);
}

.editorial-summary-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    min-height: 7rem;
    padding: 1.25rem;
    background: var(--mud-palette-surface);
    border-right: 1px solid var(--mud-palette-divider);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.editorial-summary-item .mud-typography-h4 {
    font-family: Manrope, Inter, sans-serif;
}

.editorial-panel {
    overflow: hidden;
}

.editorial-panel-heading {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    min-height: 3.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.editorial-filter {
    flex: 1 1 18rem;
    min-width: 0;
}

.editorial-list {
    max-height: calc(100dvh - 21rem);
    overflow: auto;
    overscroll-behavior: contain;
}

.editorial-list.is-compact {
    max-height: calc(100dvh - 24rem);
}

.editorial-list.is-tall {
    max-height: 40rem;
}

.editorial-row {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    min-height: 3.25rem;
    padding: 0.45rem 0.75rem;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
}

.editorial-row:last-child {
    border-bottom: 0;
}

.editorial-row:hover {
    background: var(--mud-palette-action-default-hover);
}

.editorial-row.is-selected {
    background: var(--mud-palette-primary-hover);
    box-shadow: inset 4px 0 0 var(--mud-palette-primary);
}

.editorial-row.is-dimmed {
    opacity: 0.35;
    pointer-events: none;
}

.editorial-row.is-divider {
    min-height: 2.25rem;
    padding-block: 0.25rem;
}

.editorial-row-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.editorial-row-copy .mud-typography {
    overflow: hidden;
    text-overflow: ellipsis;
}

.editorial-drag-handle {
    display: flex;
    align-items: center;
    min-width: 2rem;
    min-height: 2rem;
    cursor: grab;
    touch-action: none;
}

.editorial-drag-handle:active {
    cursor: grabbing;
}

.editorial-position-editor,
.editorial-chip-row,
.editorial-status-metrics {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.editorial-position-input {
    width: 3.75rem;
}

.editorial-divider-flex {
    flex: 1 1 auto;
}

.editorial-channel-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.editorial-sticky-actions {
    position: sticky;
    z-index: 4;
    top: calc(var(--mud-appbar-height) + 0.5rem);
    box-shadow: 0 10px 30px rgba(11, 17, 24, 0.08);
}

.editorial-status.is-synced {
    padding: 0.5rem 0.75rem;
    color: var(--mud-palette-success);
    background: var(--mud-palette-success-hover);
    border: 1px solid currentColor;
}

.editorial-status-metrics {
    gap: clamp(1rem, 4vw, 3rem);
    padding: 1.25rem;
}

.editorial-status-metric {
    min-width: 8rem;
}

.editorial-status-metric strong {
    display: block;
    margin-top: 0.2rem;
    font-weight: 650;
}

.editorial-history,
.editorial-tooltip-content {
    max-height: 40rem;
    overflow: auto;
}

.editorial-tooltip-content {
    max-width: 18.75rem;
    text-align: left;
}

.editorial-help-link {
    width: fit-content;
    cursor: help;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.editorial-emoji {
    font-size: 1.2rem !important;
}

.mud-button-root:active,
.mud-icon-button:active {
    transform: translateY(1px);
}

@media (max-width: 960px) {
    .editorial-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .login-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
    }

    .editorial-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .editorial-task-grid,
    .editorial-summary-grid {
        grid-template-columns: 1fr;
    }

    .editorial-task-link {
        min-height: 7rem;
    }

    .editorial-sticky-actions {
        position: static;
    }

    .editorial-row {
        padding-inline: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
