html, body {
    margin: 0;
    height: 100%;
    font-family: Roboto, Helvetica, Arial, sans-serif;
}

.spotter-main-content {
    padding: 56px 16px 16px !important;
}

.mud-appbar a.spotter-top-link,
a.spotter-top-link {
    color: #ffffff !important;
    font-size: 1rem;
    font-weight: 400;
    text-decoration: none;
}

.reads-board-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px);
    min-height: 0;
}

.reads-slim-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    padding: 6px 4px;
    margin: 0 0 8px;
    flex-shrink: 0;
}

.reads-board-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
}

.reads-board-page .reads-board-switch {
    margin: 0 !important;
}

.reads-board-page .mud-switch {
    margin: 0;
}

.reads-board-title {
    margin: 0;
    border: 0;
    outline: none;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: #1a1a1a;
}

.reads-board-subtitle,
.reads-board-count {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1;
    color: #3c4043;
}

.reads-board-count {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.reads-board-dismiss-all {
    height: 36px;
    min-height: 36px;
    min-width: 7.25rem;
    padding: 0 0.9rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.reads-board-split {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 0;
    border: 1px solid #dadce0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.reads-board-detail {
    flex: 1 1 58%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #dadce0;
}

.reads-board-detail-dismiss,
.reads-board-dismiss-all {
    min-width: 7.25rem;
    border: 2px solid #5c0a0a;
    border-radius: 6px;
    background: #8a1212;
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.reads-board-detail-dismiss {
    height: 36px;
    min-height: 36px;
    padding: 0 1rem;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    align-self: center;
}

.reads-board-detail-dismiss:hover:not(:disabled),
.reads-board-dismiss-all:hover:not(:disabled) {
    background: #6e0e0e;
}

.reads-board-detail-dismiss:disabled,
.reads-board-dismiss-all:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.reads-board-detail-dismiss:focus-visible,
.reads-board-dismiss-all:focus-visible {
    outline: 3px solid #0b57d0;
    outline-offset: 3px;
}

.reads-board-detail-nok {
    background: #fce8e6;
}

.reads-board-detail-pending {
    background: #f1f3f4;
}

.reads-board-detail-head {
    display: grid;
    grid-template-columns: 7.25rem 1fr 7.25rem;
    align-items: center;
    gap: 8px;
    padding: 16px;
    flex-shrink: 0;
}

.reads-board-detail-head-spacer {
    display: block;
}

.reads-board-detail-head-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.reads-board-detail-plate {
    max-width: min(280px, 100%);
    height: 48px;
    object-fit: contain;
    background: #111;
    border-radius: 4px;
    display: block;
}

.reads-board-detail-plate-placeholder {
    width: min(280px, 100%);
    height: 48px;
    border-radius: 4px;
    background: #eceff1;
    border: 1px dashed #5f6368;
    color: #3c4043;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reads-board-detail-vrn {
    margin: 0;
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.15;
    text-align: center;
    color: #1a1a1a;
}

.reads-board-detail-overview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #e8eaed;
}

.reads-board-detail-overview.is-fallback {
    object-fit: contain;
    max-height: 40%;
}

.reads-board-detail-overview.is-missing,
.reads-board-history-overview.is-missing {
    visibility: hidden;
}

.reads-board-history-overview.is-fallback {
    object-fit: contain;
    background: #111;
}

.reads-board-detail-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid #dadce0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #1a1a1a;
    flex-shrink: 0;
}

.reads-board-detail-gps {
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reads-board-detail-zone {
    font-weight: 700;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reads-board-history-scroll {
    flex: 0 0 40%;
    min-width: 300px;
    max-width: 440px;
    overflow-y: auto;
    background: #f8f9fa;
}

.reads-board-history-row {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 4.75rem 3.4rem;
    align-items: center;
    column-gap: 10px;
    width: 100%;
    min-height: 76px;
    padding: 12px 12px;
    margin: 0;
    appearance: none;
    font: inherit;
    color: #1a1a1a;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #dadce0;
    background: #fff;
    cursor: pointer;
}

.reads-board-history-row:hover {
    background: #e8f0fe;
}

.reads-board-history-row:focus-visible {
    outline: 3px solid #0b57d0;
    outline-offset: -3px;
    z-index: 1;
}

.reads-board-history-selected {
    background: #d2e3fc !important;
    box-shadow: inset 4px 0 0 #0b57d0;
}

.reads-board-history-nok {
    background: #fce8e6;
}

.reads-board-history-nok:hover {
    background: #f9d4d1;
}

.reads-board-history-pending {
    background: #f1f3f4;
}

.reads-board-history-overview {
    width: 80px;
    height: 52px;
    object-fit: cover;
    border-radius: 4px;
    background: #e8eaed;
    display: block;
}

.reads-board-history-plate-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.reads-board-history-plate {
    width: 100%;
    max-width: 112px;
    height: 26px;
    object-fit: contain;
    background: #111;
    border-radius: 2px;
    display: block;
}

.reads-board-history-plate-placeholder {
    width: 100%;
    max-width: 112px;
    height: 26px;
    border-radius: 2px;
    background: #e8eaed;
    border: 1px dashed #5f6368;
}

.reads-board-history-vrn {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    color: #1a1a1a;
}

.reads-board-history-time {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 0.8125rem;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.reads-board-history-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    min-width: 3.25rem;
    min-height: 1.7rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: center;
    color: #fff;
}

.reads-board-status-ok {
    background: #0d652d;
}

.reads-board-status-nok {
    background: #8a1212;
}

.reads-board-status-pending {
    background: #3c4043;
}

@media (max-width: 900px) {
    .reads-board-split {
        flex-direction: column;
    }

    .reads-board-detail {
        flex: 0 0 auto;
        min-height: 320px;
        border-right: 0;
        border-bottom: 1px solid #dadce0;
    }

    .reads-board-detail-overview-wrap {
        min-height: 180px;
    }

    .reads-board-history-scroll {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }

    .reads-board-detail-head {
        grid-template-columns: 1fr auto;
        padding: 16px;
    }

    .reads-board-detail-head-spacer {
        display: none;
    }

    .reads-board-detail-head-main {
        grid-column: 1;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reads-board-history-row,
    .reads-board-detail-dismiss {
        transition: none;
    }
}

.reads-vrn-link {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1a1a1a;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.reads-vrn-link:hover {
    color: #b71c1c;
}

.reads-action {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.reads-action-ok { color: #0d652d; }
.reads-action-nok { color: #8a1212; }
.reads-action-pending { color: #3c4043; }

.reads-plate-modal-img {
    display: block;
    width: 100%;
    max-height: 120px;
    object-fit: contain;
    background: #111;
    border-radius: 4px;
}

.reads-overview-modal-img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #111;
    border-radius: 4px;
}

.spotter-map {
    width: 100%;
    height: 360px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d0d7de;
    background: #dbe4ea;
}

.spotter-map.full {
    height: calc(100vh - 180px);
    min-height: 480px;
}

.spotter-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    background: #0078d4;
}

.spotter-pin.inside { background: #107c10; }
.spotter-pin.outside { background: #d13438; }
.spotter-pin.pending { background: #c19c00; }
.spotter-pin.in-zone { background: #22c55e; }
.spotter-pin.near-miss { background: #f59e0b; }
.spotter-pin.mismatch { background: #8b5cf6; }
.spotter-pin.size-1 {
    width: 16px;
    height: 16px;
}
.spotter-pin.size-2,
.spotter-pin.size-many {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}
.spotter-pin.size-2 {
    width: 28px;
    height: 28px;
    font-size: 13px;
}
.spotter-pin.size-many {
    width: 34px;
    height: 34px;
    font-size: 14px;
}

.spotter-geo-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 12px;
    height: calc(100vh - 72px);
    min-height: 0;
}

.spotter-geo-sidebar {
    overflow: auto;
    min-height: 0;
    padding-right: 4px;
}

.spotter-geo-map {
    min-width: 0;
    min-height: 0;
}

.spotter-map.geo {
    height: 100%;
    min-height: 480px;
}

.spotter-legend-item,
.spotter-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.spotter-stat {
    justify-content: space-between;
}

.spotter-stat strong {
    font-variant-numeric: tabular-nums;
}

.spotter-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.spotter-legend-swatch.in-zone { background: #22c55e; }
.spotter-legend-swatch.near-miss { background: #f59e0b; }
.spotter-legend-swatch.outside { background: #ef4444; }
.spotter-legend-swatch.mismatch { background: #8b5cf6; border-color: #6d28d9; }

.spotter-read-detail {
    font-size: 0.82rem;
    line-height: 1.45;
}

.zone-card {
    cursor: pointer;
    position: relative;
    padding-left: 12px;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.zone-card.selected {
    border-color: #e65100 !important;
    border-width: 2px !important;
    background: #fff3e0;
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.28);
}

.zone-card.selected::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: #e65100;
    border-radius: 4px 0 0 4px;
}

.zone-selected-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #e65100;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    font-family: Roboto, Helvetica, Arial, sans-serif;
    white-space: nowrap;
    max-width: 240px;
}

.zone-selected-label strong {
    font-size: 0.9rem;
    line-height: 1.1;
}

.zone-selected-label span {
    font-size: 0.75rem;
    line-height: 1.2;
    opacity: 0.95;
    overflow: hidden;
    text-overflow: ellipsis;
}

.draw-home-marker {
    pointer-events: auto;
}

.draw-home-close-btn {
    margin: 0;
    padding: 4px 8px;
    border: 1px solid #2e7d32;
    color: #1b5e20;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.draw-home-close-btn:hover {
    background: #e8f5e9;
}

@media (max-width: 900px) {
    .spotter-geo-page {
        grid-template-columns: 1fr;
        height: auto;
    }

    .spotter-map.geo {
        height: 60vh;
        min-height: 360px;
    }
}

.spotter-pin.selected {
    width: 18px;
    height: 18px;
    box-shadow: 0 0 0 2px #0078d4;
}

.plate-thumb {
    width: 72px;
    height: 28px;
    object-fit: contain;
    background: #111;
    border-radius: 2px;
    display: block;
}

.spotter-selected-row > td {
    color: #fff !important;
    background-color: #3f37c9 !important;
}

.spotter-selected-row > td .mud-chip-outlined {
    color: #222 !important;
    background-color: #fff !important;
    border-color: #fff !important;
}

.spotter-selected-row:hover > td {
    background-color: #352fb0 !important;
}

/* Reads page: STUFF lifecycle row colours */
.stuff-row-pending > td {
    background-color: #e8e8e8 !important;
}

.stuff-row-pending:hover > td {
    background-color: #dcdcdc !important;
}

.stuff-row-ok > td {
    background-color: #d9f2e3 !important;
}

.stuff-row-ok:hover > td {
    background-color: #c5ebd4 !important;
}

.stuff-row-failed > td {
    background-color: #f8d7da !important;
}

.stuff-row-failed:hover > td {
    background-color: #f1c0c5 !important;
}

.detail-plate-header {
    min-height: 82px;
}

.detail-vrn {
    font-weight: 700;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.detail-plate-patch {
    width: min(180px, 46%);
    max-height: 92px;
    object-fit: contain;
    flex-shrink: 0;
    margin-left: 12px;
    border-radius: 4px;
    background: #111;
}

.timing-stack {
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
}

.timing-label {
    display: inline-block;
    width: 4.2rem;
    color: var(--mud-palette-text-secondary);
}

.timing-delta {
    color: var(--mud-palette-primary);
    margin-left: 0.25rem;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
}
