html, body {
    height: 100%;
}

app {
    display: block;
    height: 100%;
}

.header-logo {
    flex-shrink: 0;
    background-image: url('../images/Logo.svg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    width: 60px;
    height: 28px;
}

#blazor-error-ui {
    background: inherit;
    bottom: 0;
    display: none;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: 100001;
}

/* ==========================================================================
   Fleet Map layout
   The map is hosted inside an XAF DetailView property editor. Leaflet needs a
   real pixel height on its container or it renders blank. The host establishes
   a fixed height; the container is a flex row (sidebar + canvas); the canvas
   fills the remaining space so the Leaflet div (height:100%) has something to
   fill.
   ========================================================================== */
.fleet-map-host {
    height: 78vh;
    min-height: 520px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.fleet-map-container {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
}

.fleet-map-sidebar {
    display: flex;
    flex-direction: column;
    width: 320px;
    min-width: 260px;
    max-width: 360px;
    height: 100%;
    border-right: 1px solid #ddd;
    background: #fff;
}

.fleet-map-list {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.fleet-map-canvas {
    flex: 1 1 auto;
    position: relative;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.fleet-map-canvas > div {
    height: 100%;
    width: 100%;
}

.fleet-list-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.fleet-list-item:hover {
    background: #f5f7fa;
}

.fleet-list-item.selected {
    background: #e3f2fd;
}

.fleet-list-unit {
    font-weight: 600;
    font-size: 14px;
}

.fleet-freshness-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* Fleet Map marker right-click context menu (Overwatch / Center on Truck). */
.fleet-context-menu {
    background: #ffffff;
    border: 1px solid #c7ccd1;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    min-width: 170px;
    padding: 4px 0;
    font-size: 13px;
    user-select: none;
}

.fleet-context-title {
    padding: 6px 12px;
    font-weight: 600;
    color: #37474f;
    border-bottom: 1px solid #eceff1;
    margin-bottom: 4px;
}

.fleet-context-item {
    padding: 7px 12px;
    cursor: pointer;
    color: #263238;
}

.fleet-context-item:hover {
    background: #e3f2fd;
}

/* Truck Overwatch (historical playback) layout. */
.overwatch-host {
    height: 82vh;
    min-height: 560px;
    overflow: hidden;
    border: 1px solid #d0d5db;
    border-radius: 6px;
}

.overwatch-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.overwatch-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.overwatch-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.overwatch-map {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
}

.overwatch-map > div {
    height: 100%;
    width: 100%;
}

.overwatch-canvas {
    flex: 1 1 auto;
    position: relative;
    min-height: 0;
}

.overwatch-canvas > div {
    height: 100%;
    width: 100%;
}

.overwatch-panel {
    flex: 0 0 300px;
    max-width: 300px;
    border-left: 1px solid #e0e0e0;
    padding: 10px 12px;
    overflow-y: auto;
    background: #ffffff;
}

.overwatch-info {
    flex: 0 0 300px;
    max-width: 300px;
    border-left: 1px solid #e0e0e0;
    padding: 10px 12px;
    overflow-y: auto;
    background: #ffffff;
}

.overwatch-info-header {
    font-weight: 600;
    font-size: 15px;
    color: #263238;
    margin-bottom: 8px;
}

.overwatch-point {
    font-size: 13px;
    color: #37474f;
    line-height: 1.6;
}

.overwatch-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.overwatch-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.overwatch-range,
.overwatch-truck-picker {
    display: flex;
    align-items: center;
    gap: 6px;
}

.overwatch-label {
    font-size: 12px;
    color: #607d8b;
}

.overwatch-slider {
    flex: 1 1 auto;
}

.overwatch-slider-label {
    font-size: 12px;
    color: #37474f;
    white-space: nowrap;
}

.overwatch-scrubber {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.overwatch-scrubber input[type="range"] {
    flex: 1 1 auto;
}

.overwatch-vin {
    font-family: "Courier New", Courier, monospace;
}

/* Weekly Valuation Pivot (vehicles down rows, week-ending Fridays across columns) */
.pivot-host {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pivot-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
}

.pivot-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.pivot-label {
    font-size: 12px;
    color: #607d8b;
}

.pivot-summary {
    margin-left: auto;
    font-size: 12px;
    color: #607d8b;
}

.pivot-toolbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.pivot-select-sm {
    width: 140px;
}

.pivot-select-md {
    width: 190px;
}

.pivot-tagbox {
    min-width: 220px;
    max-width: 340px;
}

.pivot-error {
    color: #b00020;
    padding: 10px 12px;
    font-size: 13px;
}

.pivot-loading,
.pivot-empty {
    padding: 16px;
    color: #666;
}

.pivot-scroll {
    flex: 1 1 auto;
    overflow: auto;
}

.pivot-table {
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

.pivot-table th,
.pivot-table td {
    border: 1px solid #e0e0e0;
    padding: 4px 8px;
    text-align: right;
}

.pivot-table th:nth-child(-n+3),
.pivot-table td:nth-child(-n+3) {
    text-align: left;
}

.pivot-table thead th {
    position: sticky;
    top: 0;
    background: #fafafa;
    z-index: 1;
}

.pivot-sticky-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
}

/* The Historical Valuations matrix freezes three identifying columns (Company/Unit/Year)
   instead of the Weekly Pivot's one - each needs its own left offset so they don't stack. Fixed
   widths keep the offsets predictable. */
.pivot-sticky-1 { left: 0; min-width: 160px; max-width: 160px; }
.pivot-sticky-2 { left: 160px; min-width: 90px; max-width: 90px; }
.pivot-sticky-3 { left: 250px; min-width: 70px; max-width: 70px; }

.pivot-table thead .pivot-sticky-col {
    z-index: 2;
    background: #fafafa;
}

.pivot-table tfoot td {
    background: #f5f5f5;
}

/* Total Fleet Valuation drill-down: a Company/period or Total Fleet/period cell that switches
   to the per-vehicle Valuation view narrowed to that company and period on click. */
.pivot-drilldown {
    cursor: pointer;
}

.pivot-drilldown:hover {
    background: #e3f2fd;
    text-decoration: underline;
}
