:root {
    --y-navy: #071a3c;
    --y-blue: #0a2350;
    --y-blue-2: #0d2f68;
    --y-yellow: #ffd200;
    --y-yellow-soft: #fff1a8;
    --y-ink: #101725;
    --y-paper: #f5f7fc;
    --y-muted: #aebdde;
    --y-green: #25d366;
    --y-red: #ff5f57;
    --panel-border: rgba(255, 210, 0, .24);
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    background:
        linear-gradient(135deg, rgba(255, 210, 0, .10), transparent 28%),
        linear-gradient(180deg, var(--y-navy), #0a1635 58%, #030e24);
    color: #fff;
    font-family: "Source Sans 3", sans-serif;
}

a {
    color: inherit;
}

.app-shell {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-topbar {
    border-bottom: 2px solid var(--y-yellow);
}

.app-topbar .mud-toolbar {
    min-width: 0;
    gap: .4rem;
}

.app-topbar .brand-wordmark {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-drawer {
    border-right: 1px solid var(--panel-border);
}

.app-content {
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 100vh;
    padding: 88px clamp(1rem, 3vw, 2rem) 2rem;
    overflow-x: clip;
}

.mud-main-content.app-content {
    flex: 1 1 auto;
    min-width: 0;
}

.app-content > * {
    max-width: 100%;
    min-width: 0;
}

.app-content > .page-stack {
    padding-top: .45rem;
}

.brand-wordmark {
    color: var(--y-yellow);
    font-family: "Barlow Semi Condensed", sans-serif;
    font-weight: 800;
}

.drawer-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--panel-border);
}

.drawer-logo {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--y-yellow);
    color: var(--y-ink);
    font-family: "Barlow Semi Condensed", sans-serif;
    font-weight: 800;
}

.page-stack {
    display: grid;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
}

.page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: 1rem;
    align-items: end;
    min-width: 0;
    max-width: 100%;
}

.page-header > * {
    min-width: 0;
}

.page-kicker {
    color: var(--y-yellow);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    min-width: 0;
}

.stat-tile {
    min-width: 0;
    min-height: 108px;
    padding: 1rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(10, 35, 80, .82);
}

.stat-tile strong {
    display: block;
    color: var(--y-yellow);
    font: 800 2rem/1 "Barlow Semi Condensed", sans-serif;
}

.work-grid {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 1rem;
    align-items: start;
    min-width: 0;
}

.kb-layout {
    display: grid;
    grid-template-columns: minmax(260px, .42fr) minmax(0, .58fr);
    gap: 1rem;
    align-items: start;
    min-width: 0;
}

.core-data {
    display: grid;
    gap: .75rem;
    min-width: 0;
}

.core-item,
.kb-panel,
.job-plate-panel {
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(8, 20, 46, .86);
}

.core-item {
    padding: .85rem;
    overflow-wrap: anywhere;
}

.core-item span {
    display: block;
    color: var(--y-muted);
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.kb-panel {
    padding: 1rem;
    overflow: hidden;
}

.kb-panel .mud-table-container {
    max-width: 100%;
    overflow-x: auto;
}

.kb-hero-header {
    align-items: center;
}

.kb-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
}

.kb-hero-actions > *,
.kb-hero-actions .mud-button-root {
    max-width: 100%;
}

.kb-vehicle-title {
    overflow-wrap: anywhere;
}

.manufacturer-logo {
    display: grid;
    place-items: center;
    width: 5.5rem;
    height: 4rem;
    padding: .55rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    color: var(--y-blue);
    box-shadow: none;
}

.manufacturer-logo-small {
    width: 4.2rem;
    height: 3rem;
    padding: .42rem;
    box-shadow: none;
}

.manufacturer-logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.manufacturer-logo-fallback {
    align-items: center;
    color: var(--mud-palette-primary);
    display: flex;
    font-family: "Oswald", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    height: 100%;
    justify-content: center;
    width: 100%;
}

.manufacturer-logo-fallback[hidden] {
    display: none;
}

.vehicle-thumb {
    width: min(26vw, 22rem);
    min-width: 14rem;
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    overflow: hidden;
}

.vehicle-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
    background: rgba(255, 255, 255, .92);
}

.vehicle-thumb-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, .68);
    background: var(--y-blue);
}

.vehicle-thumb-placeholder[hidden] {
    display: none;
}

.vehicle-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "brand brand"
        "visual actions"
        "plate actions";
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.vehicle-hero-brand {
    grid-area: brand;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.vehicle-hero-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.vehicle-hero-visual {
    grid-area: visual;
    justify-self: start;
    min-width: 0;
}

.vehicle-description {
    margin-top: .45rem;
    text-align: center;
    overflow-wrap: anywhere;
}

.vehicle-hero-plate {
    grid-area: plate;
    justify-self: start;
}

.vehicle-hero-actions {
    grid-area: actions;
    justify-content: flex-end;
    align-self: end;
}

.kb-copy,
.core-item .mud-typography,
.kb-item-content {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.kb-chip-row,
.kb-item-meta {
    flex-wrap: wrap !important;
    min-width: 0;
}

.kb-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: start;
    min-width: 0;
    padding: .85rem 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.kb-item-row:first-child {
    border-top: 0;
}

.kb-summary-item-row {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(3, 15, 42, .42);
}

.kb-summary-item-row:first-child {
    border-top: 1px solid var(--panel-border);
}

.kb-summary-card-title {
    min-width: 0;
}

.plate {
    display: inline-flex;
    align-items: stretch;
    width: min(190px, 100%);
    min-width: 0;
    min-height: 58px;
    padding: 0;
    border: 3px solid #101010;
    border-radius: 6px;
    background: #ffd200;
    color: #0a0a0a;
    font: 800 2rem/1 "Barlow Semi Condensed", sans-serif;
    text-transform: uppercase;
    overflow: hidden;
}

.plate-country {
    display: grid;
    place-items: center;
    align-content: center;
    gap: .1rem;
    width: 2.35rem;
    flex: 0 0 2.35rem;
    background: #003399;
    color: #fff;
    font: 700 .7rem/1 "Barlow Semi Condensed", sans-serif;
}

.plate-stars {
    color: #ffd200;
    font-size: .75rem;
}

.plate-value {
    display: grid;
    place-items: center;
    flex: 1 1 auto;
    padding: .35rem .7rem;
    min-width: 0;
}

.vehicle-photo {
    width: 100%;
    min-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: var(--y-blue);
}

.mobile-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: .6rem;
    min-width: 0;
    max-width: 100%;
}

.developer-selector-grid {
    display: grid;
    grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
    gap: 1rem;
    align-items: start;
    min-width: 0;
    max-width: 100%;
}

.developer-match-panel {
    border-color: rgba(0, 210, 255, .35);
    background: rgba(13, 37, 78, .74);
}

.developer-match-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    min-width: 0;
}

.developer-match-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.developer-match-mode {
    width: min(100%, 15rem);
}

.developer-filter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    min-width: 0;
}

.developer-filter-strip .mud-chip-root {
    max-width: 100%;
}

.mobile-actions > *,
.mobile-actions .mud-button-root,
.kb-action-button {
    width: 100%;
    min-width: 0;
}

.mobile-actions .mud-button-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-tabs {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.kb-tabs .mud-tabs-toolbar {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.kb-tabs .mud-tabs-toolbar-content,
.kb-tabs .mud-tabs-toolbar-wrapper,
.kb-tabs .mud-tabs-toolbar-inner,
.kb-tabs .mud-tabs-panels {
    max-width: 100%;
    min-width: 0;
}

.kb-tabs .mud-tabs-toolbar-wrapper {
    overflow-x: auto;
}

.kb-tabs .mud-tabs-toolbar-inner {
    width: max-content;
    min-width: 100%;
}

.kb-tabs .mud-tab {
    flex: 0 0 auto;
    white-space: nowrap;
}

.job-kb-layout {
    grid-template-columns: minmax(280px, .34fr) minmax(0, .66fr);
}

.legacy-kb-section-head,
.legacy-kb-group-header,
.legacy-kb-meta {
    flex-wrap: wrap !important;
    min-width: 0;
}

.legacy-kb-panel {
    display: grid;
    gap: .85rem;
}

.legacy-kb-panel-candidate {
    border-color: rgba(255, 190, 0, .42);
}

.legacy-candidate-alert {
    margin-top: .25rem;
}

.legacy-kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: .75rem;
    min-width: 0;
}

.legacy-kb-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: .85rem;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 8px;
    background: rgba(4, 16, 40, .72);
    overflow-wrap: anywhere;
}

.legacy-kb-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .6rem;
    align-items: start;
    min-width: 0;
}

.legacy-kb-title {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
}

.legacy-kb-card-kind {
    min-width: 0;
    color: var(--mud-palette-text-secondary);
}

.legacy-kb-match-chip {
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(0, 202, 138, .28);
}

.legacy-kb-operational {
    margin-top: .75rem;
}

.legacy-kb-primary-title {
    margin-bottom: .35rem;
    color: var(--mud-palette-text-primary);
}

.legacy-kb-primary-copy,
.kb-item-primary-copy {
    color: var(--mud-palette-text-primary);
    font-weight: 500;
    line-height: 1.5;
}

.legacy-kb-lines {
    min-width: 0;
}

.legacy-kb-meta {
    margin-top: auto;
    padding-top: .85rem;
    opacity: .8;
}

.legacy-kb-source {
    opacity: .72;
}

.legacy-kb-image-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 260px;
    margin: .6rem 0;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    overflow: hidden;
    isolation: isolate;
    background: #071126;
}

.legacy-kb-image-backdrop {
    position: absolute;
    z-index: 0;
    inset: -12%;
    width: 124%;
    height: 124%;
    object-fit: cover;
    filter: blur(18px) saturate(.8) brightness(.6);
    opacity: .82;
    transform: scale(1.04);
}

.legacy-kb-image {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    background: rgba(0, 0, 0, .24);
}

.legacy-kb-candidates .mud-expand-panel {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(8, 20, 46, .86);
    overflow: hidden;
}

.updates-date {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
}

#blazor-error-ui {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2000;
    display: none;
    max-width: min(460px, calc(100vw - 2rem));
    padding: 1rem;
    border-radius: 8px;
    background: #441313;
    color: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

#blazor-error-ui .dismiss {
    margin-left: .75rem;
    cursor: pointer;
}

@media (max-width: 960px) {
    .app-content {
        padding: 76px .8rem 1.25rem;
    }

    .page-header,
    .work-grid,
    .kb-layout,
    .job-kb-layout,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .mobile-actions {
        grid-template-columns: 1fr;
    }

    .developer-selector-grid {
        grid-template-columns: 1fr;
    }

    .developer-match-toolbar {
        grid-template-columns: 1fr;
    }

    .developer-match-controls {
        justify-content: stretch;
    }

    .developer-match-controls > *,
    .developer-match-controls .mud-button-root,
    .developer-match-mode {
        width: 100%;
    }

    .kb-hero-actions {
        justify-content: flex-start;
    }

    .vehicle-hero-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "brand"
            "visual"
            "plate"
            "actions";
    }

    .vehicle-hero-visual,
    .vehicle-hero-plate {
        justify-self: stretch;
    }

    .vehicle-thumb {
        width: 100%;
        min-width: 0;
    }

    .vehicle-hero-actions {
        justify-content: stretch;
    }
}

@media (max-width: 600px) {
    .app-topbar .mud-chip-root {
        max-width: 120px;
    }

    .page-header {
        align-items: start;
    }

    .vehicle-hero-brand {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .manufacturer-logo {
        width: 4.6rem;
        height: 3.25rem;
    }

    .kb-vehicle-title {
        font-size: 2.35rem;
        line-height: 1.05;
    }

    .kb-item-row {
        grid-template-columns: 1fr;
    }

    .kb-item-row > .mud-stack {
        align-items: flex-start !important;
    }

    .legacy-kb-card-head {
        grid-template-columns: 1fr;
    }
}
