/* Fleet - minimal route-manage model
   Only --background for backgrounds
   No outer border, no border-bottom dividers
   Accent is --brand-color-mid, never --text-soft on hover
   Buttons 0.75em, mobile-first, livery boxes 90deg
*/
.companies-container { max-width: 100%; }
.vehicles-page { background: var(--background); margin-top: .5rem; }

/* - toggle - */
.vehicles-toggle {
    display: inline-flex;
    gap: .3rem;
    margin: 1rem 0 1.1rem;
    padding: .3rem;
    background: var(--background);
    border: 1px solid var(--brand-color-lighter);
    border-radius: .75em;
}
.vehicles-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .42rem .9rem;
    border-radius: .75em;
    font-size: .82rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-soft);
    background: var(--background);
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    transition: border-color .12s, color .12s, background .12s;
}
.vehicles-toggle-btn:hover {
    color: var(--text);
    border-color: var(--brand-color-mid);
    background: var(--background);
}
.vehicles-toggle-btn.is-active {
    background: var(--brand-color-mid);
    border-color: var(--brand-color-mid);
    color: var(--text);
    font-weight: 600;
}
.vehicles-toggle-btn.is-active:hover { border-color: var(--brand-color-light); }

/* - fleet table - bustimes style compact grid, inner dividers only, no outer board */
.table-wrapper {
    margin: 0 -1em;
    overflow-x: auto;
    background: var(--background);
}
.table-wrapper table.fleet {
    border-collapse: separate;
    border-spacing: 0;
    padding: 0 1rem;
    white-space: nowrap;
    background: var(--background);
}
.fleet.compact {
    font-size: .875em;
}
.fleet th,
.fleet td {
    border: 0;
    border-bottom: 1px solid var(--brand-color-lighter);
    border-right: 1px solid var(--brand-color-lighter);
    padding: .45rem .6rem;
    text-align: left;
    vertical-align: top;
    background: var(--background);
    color: var(--text);
}
.fleet th:last-child,
.fleet td:last-child {
    border-right: 0;
}
.fleet tbody tr:last-child td {
    border-bottom: 0;
}
.fleet thead th {
    font-weight: 600;
}
.fleet td.tabular {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.fleet td.reg {
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.fleet .livery-cell {
    position: relative;
    padding-left: 3.5em;
}
.fleet .fleet-livery {
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 24px;
    border: 1px solid var(--brand-color-lighter);
    border-radius: 0;
    display: inline-block;
}
.fleet .trivia {
    display: none;
}
@media (min-width: 700px) {
    .fleet .trivia {
        display: table-cell;
    }
}

/* - status row colours - withdrawn and scrapped read as removed */
.fleet tbody tr.fleet-row--withdrawn td,
.fleet tbody tr.fleet-row--scrapped td {
    background-color: color-mix(in srgb, var(--brand-danger-mid) 30%, var(--background));
}
.fleet tbody tr.fleet-row--withdrawn td:not(.fleet-action),
.fleet tbody tr.fleet-row--scrapped td:not(.fleet-action) {
    text-decoration: line-through;
}
/* for sale, on loan and preserved read as not in normal service */
.fleet tbody tr.fleet-row--for-sale td,
.fleet tbody tr.fleet-row--on-loan td,
.fleet tbody tr.fleet-row--preserved td {
    background-color: color-mix(in srgb, var(--brand-color-mid) 30%, var(--background));
}

/* - formation strip swatches stay square */
.livery-icon,
.icon-border {
    width: 36px;
    height: 24px;
    border: 1px solid var(--brand-color-lighter);
    border-radius: 0 !important;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    background: var(--background);
}

/* - empty - */
.vehicles-empty {
    text-align: left;
    padding: 1.2rem 0;
    background: var(--background);
    color: var(--text-soft);
    font-size: .85rem;
}
.vehicles-empty--boxed {
    border: 1px dashed var(--brand-color-lighter);
    border-radius: .75em;
    padding: 2rem 1rem;
    text-align: center;
}

/* - responsive - trivia columns appear at bigger widths, table scrolls on phones */
@media (max-width: 640px) {
    .vehicles-toggle { width: 100%; }
    .vehicles-toggle-btn { flex: 1 1 0; }
    .vehicles-meta { margin-bottom: .5rem; }
}
/* - formations - */
.formation-block {
    margin-bottom: 1.4rem;
    background: var(--background);
    border: none;
}
.formation-block + .formation-block {
    margin-top: -1rem;
}
.formation-title {
    margin: 0 0 .6rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -.01em;
}
.formation-meta {
    font-size: .76rem;
    color: var(--text-soft);
    margin-bottom: .45rem;
}

.formation-livery-strip .livery-icon,
.formation-livery-strip .icon-border,
.formation-car .livery-icon,
.formation-car .icon-border {
    width: 48px;
    height: 32px;
    border-radius: 0 !important;
}

.formation-livery-strip {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
    padding: .4rem 0 .5rem;
    margin-bottom: .35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    background: var(--background);
}
.formation-livery-strip::-webkit-scrollbar { height: 4px; }
.formation-livery-strip::-webkit-scrollbar-thumb { background: var(--brand-color-lighter); border-radius: 999px; }
.formation-car {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
}
.formation-car-number {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    white-space: nowrap;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.formation-car-number--coach {
    font-size: .58rem;
    font-weight: 500;
    color: var(--text-soft);
}

/* fleet count meta - if used */
.vehicles-meta {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 .6rem;
    flex-wrap: wrap;
    background: var(--background);
}
.vehicles-count {
    display: inline-flex;
    align-items: center;
    padding: .2em .55em;
    border-radius: 999px;
    border: 1px solid var(--brand-color-lighter);
    background: var(--background);
    color: var(--text-soft);
    font-size: .72rem;
    font-weight: 600;
}
.vehicles-meta span.vehicles-summary {
    font-size: .84rem;
    color: var(--text-soft);
}
