:root {
    --tb-primary: #0D9488;
    --tb-primary-deep: #0F766E;
    --tb-secondary: #D97706;
    --tb-slate-950: #020617;
    --tb-slate-900: #0F172A;
    --tb-slate-800: #1E293B;
    --tb-slate-100: #F1F5F9;
    --tb-surface: #FFFFFF;
    --tb-radius: 10px;
    --tb-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --tb-auth-gradient: linear-gradient(145deg, #0F172A 0%, #134E4A 48%, #0D9488 100%);
}

html, body {
    font-family: var(--mud-typography-default-family); /* body face, defined once in ApplicationTheme */
}

#blazor-error-ui {
    color-scheme: light;
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    box-sizing: border-box;
    display: none;
    left: 50%;
    right: auto;
    bottom: 1rem;
    width: min(52rem, calc(100vw - 2rem));
    transform: translateX(-50%);
    padding: 0.85rem 4rem 0.85rem 1rem;
    position: fixed;
    z-index: 2000;
}

    #blazor-error-ui .reload {
        color: #2DD4BF;
        font-weight: 600;
        margin-left: 0.5rem;
        text-decoration: none;
    }

        #blazor-error-ui .reload:hover {
            text-decoration: underline;
        }

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 1rem;
        top: 0.55rem;
        width: 1.75rem;
        height: 1.75rem;
        line-height: 1.65rem;
        text-align: center;
        border-radius: 999px;
        color: #d7d7df;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

        #blazor-error-ui .dismiss:hover {
            background: rgba(255, 255, 255, 0.12);
        }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

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

        .loading-progress circle:last-child {
            stroke: var(--tb-primary);
            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;
    font-family: var(--mud-typography-h5-family); /* display face, defined once in ApplicationTheme */
    color: var(--tb-slate-800);
}

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

code {
    color: #0F766E;
}

.text-align-right .mud-input-slot input,
.text-align-right input {
    text-align: right;
}

.capacity-week-day {
    background-color: var(--mud-palette-action-default-hover);
    border-radius: 0;
}

/* —— Shell motion & polish —— */

@keyframes tb-page-enter {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes tb-auth-panel {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tb-auth-card {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.page-enter {
    animation: tb-page-enter 0.35s ease-out both;
}

.tb-drawer-brand {
    padding: 1.1rem 1rem 0.85rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 0.35rem;
}

/* The brand mark is the package's BrandMark component (nv-brand-mark*); only the drawer's colour override lives here. */
.tb-drawer-brand .nv-brand-mark__title {
    color: var(--mud-palette-text-primary);
}

.tb-drawer-brand .nv-brand-mark__subtitle {
    color: var(--mud-palette-text-secondary);
}

/* Version line at the bottom of the drawer: the drawer is a flex column, so "auto" keeps it below the menu. */
.tb-drawer-footer {
    margin-top: auto;
    padding: 0.75rem 1rem 0.9rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
    opacity: 0.85;
}

.mud-nav-link.active:not(.mud-nav-link-disabled) {
    border-inline-start: 3px solid var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    font-weight: 600;
}

.tb-table-row--passive {
    opacity: 0.62;
    transition: opacity 0.15s ease-in-out;
}

.tb-table-row--passive:hover {
    opacity: 1;
}

.tb-passive-chip.mud-chip {
    height: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--mud-palette-action-default-hover);
    color: var(--mud-palette-text-secondary);
}

.tb-surface-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--tb-radius);
    box-shadow: var(--tb-shadow);
    overflow: hidden;
}

.tb-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 1rem;
}

.tb-kpi-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--tb-radius);
    padding: 1rem 1.1rem;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    background: var(--mud-palette-surface);
}

    .tb-kpi-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
        border-color: color-mix(in srgb, var(--mud-palette-primary) 45%, var(--mud-palette-lines-default));
    }

.tb-kpi-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.7rem;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
    color: var(--mud-palette-primary);
    margin-bottom: 0.75rem;
}

.tb-kpi-card__value {
    font-family: var(--mud-typography-h5-family); /* display face, defined once in ApplicationTheme */
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.tb-kpi-card__label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.tb-auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 960px) {
    .tb-auth-shell {
        grid-template-columns: 1fr;
    }

    .tb-auth-panel {
        min-height: 220px;
    }
}

.tb-auth-panel {
    position: relative;
    overflow: hidden;
    background: var(--tb-auth-gradient);
    color: #f8fafc;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    animation: tb-auth-panel 0.55s ease-out both;
}

    .tb-auth-panel::before {
        content: "";
        position: absolute;
        inset: 0;
        background:
            radial-gradient(circle at 20% 20%, rgba(251, 191, 36, 0.22), transparent 42%),
            radial-gradient(circle at 80% 0%, rgba(45, 212, 191, 0.25), transparent 35%),
            repeating-linear-gradient(
                -18deg,
                transparent 0,
                transparent 18px,
                rgba(255, 255, 255, 0.03) 18px,
                rgba(255, 255, 255, 0.03) 19px
            );
        pointer-events: none;
    }

.tb-auth-panel__content {
    position: relative;
    z-index: 1;
    max-width: 28rem;
}

.tb-auth-panel__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    opacity: 0.8;
    margin-bottom: 0.75rem;
}

.tb-auth-panel__title {
    font-family: var(--mud-typography-h5-family); /* display face, defined once in ApplicationTheme */
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.tb-auth-panel__copy {
    opacity: 0.85;
    max-width: 26rem;
}

.tb-auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(circle at 100% 0%, rgba(13, 148, 136, 0.08), transparent 40%),
        var(--mud-palette-background, var(--tb-slate-100));
}

.tb-auth-card {
    width: min(100%, 420px);
    animation: tb-auth-card 0.45s ease-out 0.08s both;
}

.tb-dashboard-hero {
    margin-bottom: 1.25rem;
}

.tb-dashboard-hero__title {
    font-family: var(--mud-typography-h5-family); /* display face, defined once in ApplicationTheme */
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tb-chart-card {
    height: 100%;
}

/* —— Loading —— */

.tb-loading-root--page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: min(28rem, calc(100vh - 10rem));
    padding: 2rem 1rem;
}

.tb-loading-root--viewport {
    position: fixed;
    inset: 0;
    z-index: 1600;
}

.tb-loading-scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
}

.tb-loading-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    pointer-events: none;
}

.tb-loading-panel {
    pointer-events: auto;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    padding: 1.75rem 2rem 1.5rem;
    text-align: center;
    min-width: 260px;
    max-width: 90vw;
    animation: tb-auth-card 0.28s ease-out both;
}

.tb-loading-panel--inline {
    min-width: 0;
    box-shadow: none;
    background: transparent;
    border: none;
    padding: 0.5rem;
    pointer-events: none;
    animation: none;
}

.tb-loading-spinner {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
}

.tb-loading-spinner--sm {
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 0.65rem;
}

.tb-loading-spinner__ring {
    box-sizing: border-box;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--mud-palette-primary) 18%, transparent);
    border-top-color: var(--mud-palette-primary);
    animation: tb-spin 0.85s linear infinite;
}

.tb-loading-spinner__icon {
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.35rem;
    height: 2.35rem;
    margin: 0;
    transform: translate(-50%, -50%);
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
}

.tb-loading-spinner--sm .tb-loading-spinner__icon {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.45rem;
}

.tb-loading-spinner__icon .mud-icon-root {
    display: block;
    margin: 0;
}

.tb-loading-panel__title {
    font-family: var(--mud-typography-h5-family); /* display face, defined once in ApplicationTheme */
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.05rem;
}

.tb-loading-panel__copy {
    margin-top: 0.3rem;
    color: var(--mud-palette-text-secondary);
    font-size: 0.875rem;
}

.tb-table-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mud-palette-surface) 82%, transparent);
}

@keyframes tb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fixed columns keep plate, status, duration and actions aligned from row to row. The action column is wide enough for the
   longest button set (three buttons on a vehicle that has arrived) on one line, down to the 1280 px breakpoint. */
.tb-field-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 220px) minmax(100px, 130px) minmax(24rem, max-content);
    align-items: center;
    column-gap: 1rem;
    border-radius: 12px;
}

.tb-field-list {
    padding: 12px;
    border-radius: var(--tb-radius);
    background: var(--mud-palette-background-gray);
}

.tb-field-row-actions .mud-button-root {
    border-radius: 12px;
    white-space: nowrap;
    flex: none;
}

.tb-field-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

@media (max-width: 1279px) {
    .tb-field-row {
        grid-template-columns: 1fr;
        row-gap: 0.75rem;
    }

    .tb-field-row-actions {
        justify-content: flex-start;
    }
}

.tb-field-caption {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.tb-field-duration {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

.tb-field-plate {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
    color: var(--mud-palette-text-primary);
}

.tb-field-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
}

.tb-shell-app {
    --tb-field-board-offset: 176px;
}

.tb-shell-screen {
    --tb-field-board-offset: 112px;
}

.tb-field-board {
    overflow-x: auto;
    align-items: stretch;
    min-height: calc(100vh - var(--tb-field-board-offset));
}

.tb-field-column {
    display: flex;
    flex-direction: column;
    flex: 1 0 250px;
    padding: 0.5rem;
    border-radius: var(--tb-radius);
    background: var(--mud-palette-background-gray);
}

.tb-field-column-collapsed {
    flex: 0 0 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.tb-field-column-title-vertical {
    writing-mode: vertical-rl;
}

.tb-field-drop-allowed {
    outline: 2px dashed var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, var(--mud-palette-background-gray));
}

.tb-field-drop-denied {
    opacity: 0.6;
}

/* The slots of a day: as many columns as fit, every button the same width. */
.tb-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
    gap: 0.5rem;
}
