.view-switch {
    display: flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid #cbd1d7;
    border-radius: 6px;
    background: #eef1f4;
}

main,
aside,
.content,
.table-wrap,
.vehicle-list-scroll,
#vehicles {
    min-height: 0;
}

aside {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.vehicle-list-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

#vehicles {
    overflow: visible;
}

.table-wrap {
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

header > strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-main {
    display: grid;
    grid-template-columns: 115px 45px 100px 95px 105px;
    align-items: center;
}

.vehicle-list-head {
    display: block;
    top: 0;
}

.vehicle-list-head span {
    display: block !important;
}

.vehicle-row {
    display: block;
}

.vehicle-main > span {
    padding: 6px 4px 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-details {
    display: grid;
    grid-template-columns: 115px 45px 100px 95px 105px;
    align-items: center;
    gap: 0;
    padding: 2px 0 6px;
    color: #66717c;
    font-size: 10px;
}

.vehicle-details span:first-child {
    grid-column: 1 / 5;
    min-width: 0;
    padding-inline: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-details span:last-child {
    grid-column: 5;
    padding-inline: 4px;
    font-weight: 600;
}

.vehicle-list-head .vehicle-details {
    padding: 0;
    color: #4d5660;
    font-weight: 700;
}

.vehicle-list-head .vehicle-main > span {
    padding-block: 4px 2px;
    line-height: 1.1;
}

.vehicle-list-head .vehicle-details > span {
    padding: 1px 4px 4px;
    line-height: 1.1;
}

.vehicle-list-head .vehicle-details > span:last-child {
    font-weight: 700;
}

.vehicle-row.maintenance-warning {
    background: #fff7d6;
    box-shadow: inset 4px 0 #e3ad18;
}

.vehicle-row.maintenance-overdue {
    background: #ffe0de;
    box-shadow: inset 5px 0 #c72c20;
    color: #71140d;
    font-weight: 600;
}

.maintenance-icon {
    color: #d49b00;
    font-size: 13px;
    line-height: 1;
}

.maintenance-overdue .maintenance-icon {
    color: #c52318;
}

.popup-maintenance {
    margin-top: 5px;
    padding: 5px 6px;
    border-left: 3px solid #d49b00;
    background: #fff7d6;
    font-weight: 600;
}

.popup-maintenance.overdue {
    border-color: #c52318;
    background: #ffe0de;
    color: #861a12;
}

.manager-table-wrap tr.maintenance-warning td {
    background: #fff7d6;
}

.manager-table-wrap tr.maintenance-overdue td {
    background: #ffe0de;
    color: #861a12;
    font-weight: 600;
}

#vehicleEditDialog {
    width: min(760px, 92vw);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.driver-manager-grid {
    display: grid;
    grid-template-columns: minmax(240px, .8fr) minmax(440px, 1.7fr);
    gap: 18px;
    max-height: 65vh;
    overflow: auto;
}

.driver-manager-grid h4 {
    margin: 4px 0 8px;
}

.driver-manager-grid section {
    min-width: 0;
}

@media (max-width: 760px) {
    .form-grid,
    .driver-manager-grid {
        grid-template-columns: 1fr;
    }
}

.view-switch button {
    padding: 6px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #3d4650;
    font: 600 12px system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    cursor: pointer;
}

.view-switch button:hover {
    background: #fff;
}

.view-switch button.active {
    background: #2563a6;
    color: #fff;
    box-shadow: 0 1px 2px #0002;
}

#trips tr.date-group-start td {
    border-top: 2px solid #cfd5db;
}

#trips tr.date-group-start:first-child td {
    border-top-width: 1px;
}

#trips tr.track-active,
#trips tr.track-active:hover {
    background: #dcecff;
    box-shadow: inset 4px 0 #2563a6;
}

body.view-map .content {
    grid-template-rows: 1fr;
}

body.view-map .toolbar,
body.view-map .table-wrap {
    display: none;
}

body.view-trips .content {
    grid-template-rows: auto 1fr;
}

body.view-trips #map {
    display: none;
}

body.view-split .content {
    grid-template-rows: minmax(330px, 55vh) auto 1fr;
}

@media (max-width: 1050px) {
    header nav {
        display: none;
    }

    .view-switch button {
        padding-inline: 7px;
    }
}

@media (max-width: 900px) {
    aside {
        display: none;
    }
}
