/* Compact, aligned cards with details and history opened on request. */
.drawer-list-panel > .search-field { margin-bottom: 10px; }
.vehicle-view-actions, .fleet-list-open .vehicles-heading > .vehicle-view-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.vehicle-view-actions .icon-button { width: 32px; height: 32px; }
.vehicle-row-hint { margin: 0 17px 10px; font-size: var(--text-small); color: var(--secondary); }
.vehicle-list-item { min-width: 0; margin-bottom: 8px; }
.vehicle-card, .vehicle-detail-card, body.compact-cards .vehicle-card {
  --card-band: #f7f5f0; --card-divider: #e8e4dc;
  margin-bottom: 0; border: 1px solid var(--card-divider); border-radius: 13px;
  background: #fff; box-shadow: 0 2px 7px #34304206; contain-intrinsic-block-size: auto 145px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.vehicle-card:hover { transform: none; background: #fff; border-color: #c9bddc; box-shadow: 0 3px 10px #4936650b; }
.vehicle-card.selected { border-color: #b39ad7; background: #fff; box-shadow: 0 0 0 1px #e9dff7, 0 3px 10px #49366508; }
.vehicle-card.selected::before { display: none; }
.vehicle-card.is-expanded { contain-intrinsic-block-size: auto 380px; }
.vehicle-detail-card { overflow: hidden; }
.vehicle-card > .vehicle-select, .vehicle-detail-card > .vehicle-select,
body.compact-cards .vehicle-card > .vehicle-select { padding: 10px 11px 9px; border: 0; background: linear-gradient(115deg,#fcfbf8,var(--card-band)); border-radius: 12px 12px 0 0; }
.vehicle-select .vehicle-card-top { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 7px; align-items: center; }
.vehicle-select .vehicle-type-icon { width: 30px; height: 30px; border-radius: 8px; }
.vehicle-select .vehicle-type-icon svg { width: 21px; height: 21px; }
.vehicle-card .vehicle-select .vehicle-registration, .vehicle-detail-card .vehicle-select .vehicle-registration {
  display: block; min-width: 0; font-size: var(--text-body); line-height: 1.3;
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.vehicle-select .vehicle-updated { min-width: 0; gap: 4px; font-size: var(--text-tiny); white-space: nowrap; line-height: 1.3; color: var(--secondary); }
.vehicle-select .vehicle-updated .icon { width: 12px; height: 12px; }
.vehicle-card .vehicle-select .vehicle-address, .vehicle-detail-card .vehicle-select .vehicle-address {
  display: block; margin-top: 7px; font-size: var(--text-small); line-height: 1.4; min-width: 0; color: var(--secondary);
}
.vehicle-select .vehicle-address > span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vehicle-quick-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; padding: 5px 11px; background: white; border-top: 1px solid var(--card-divider); }
.vehicle-quick-stats > button, .vehicle-quick-stats > span { display: flex; align-items: center; justify-content: flex-start; gap: 7px; min-width: 0; min-height: 30px; padding: 0; font-size: var(--text-body); font-weight: 600; line-height: 1.4; color: var(--ink); }
.vehicle-quick-stats > :last-child { padding-left: 12px; border-left: 1px solid var(--card-divider); }
.vehicle-quick-stats > button:hover { color: var(--violet); }
.vehicle-quick-stats .icon { width: 15px; height: 15px; color: var(--secondary); }
.vehicle-quick-stats > button > span, .vehicle-quick-stats > span > span { overflow-wrap: anywhere; }
.vehicle-card-toggle { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 32px; padding: 6px 11px; border-top: 1px solid var(--card-divider); border-radius: 0 0 12px 12px; background: var(--card-band); color: var(--violet); font-size: var(--text-small); font-weight: 600; }
.vehicle-card-toggle::after { content: ''; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.is-expanded > .vehicle-card-toggle::after { transform: translateY(1px) rotate(225deg); }
.is-expanded > .vehicle-card-toggle { border-radius: 0; }
.vehicle-card-toggle:hover { background: var(--violet-soft); }
.vehicle-card-details { padding: 11px; border-top: 1px solid var(--card-divider); background: white; border-radius: 0 0 12px 12px; }
.vehicle-expanded-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.vehicle-recorded-time { display: flex; gap: 4px; align-items: center; min-width: 0; max-width: 100%; color: var(--secondary); font-size: var(--text-tiny); line-height: 1.5; }
.vehicle-recorded-time time { overflow-wrap: anywhere; }
.vehicle-recorded-time .icon { width: 13px; height: 13px; }
.vehicle-card-details .card-telemetry { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 0; gap: 6px; }
.vehicle-card-details .telemetry-item { flex-direction: row; gap: 6px; align-items: flex-start; padding: 8px; min-height: 52px; border: 1px solid #eeeae3; border-radius: 8px; background: #fbfaf7; }
.vehicle-card-details .telemetry-item strong { font-size: var(--text-body); }
.vehicle-card-details .telemetry-item small { font-size: var(--text-tiny); }
.vehicle-card-details .vehicle-action-strip { padding-top: 9px; gap: 6px; border-top-color: var(--card-divider); }
.vehicle-card-details .vehicle-action { border: 1px solid transparent; border-radius: 8px; min-height: 42px; }
.vehicle-card-details .vehicle-action:hover, .vehicle-card-details .vehicle-action:focus-visible { border-color: #dfd3ef; background: #f6f1fc; }
.vehicle-card-details .gps-warning { font-size: var(--text-small); margin-top: 8px; }
.vehicle-detail-card + .vehicle-route-history { margin-top: 8px; }
.drawer-detail-heading { justify-content: flex-end; margin-bottom: 6px; }

.vehicle-route-history { padding: 12px 11px; margin: 7px 0 10px; min-width: 0; border: 1px solid #e8e4dc; border-radius: 13px; background: #fff; box-shadow: 0 2px 7px #34304206; }
.route-history-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.route-history-heading h3 { font-size: var(--text-body); font-weight: 700; }
.route-history-heading .text-button, .vehicle-route-history > .text-button { font-size: var(--text-small); }
.route-history-filter { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--secondary); font-size: var(--text-small); }
.route-history-filter select { flex: 1; min-width: 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--ink); font-size: var(--text-small); }
.route-history-summary { display: flex; flex-wrap: wrap; gap: 5px 10px; padding-bottom: 9px; font-size: var(--text-small); color: var(--secondary); border-bottom: 1px solid var(--line); }
.route-history-rows { display: grid; }
.route-history-row { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.route-history-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 6px; border: 1px solid currentColor; border-radius: 50%; color: #64748b; }
.route-history-icon .icon { width: 16px; height: 16px; }
.route-history-row > div { min-width: 0; }
.route-history-row strong { font-size: var(--text-small); }
.route-history-row time, .route-history-row small, .route-history-metrics { display: block; font-size: var(--text-tiny); line-height: 1.5; overflow-wrap: anywhere; color: var(--secondary); margin-top: 3px; }
.route-history-row.is-running .route-history-icon, .route-history-row.is-running strong { color: #16864c; }
.route-history-row.is-idle .route-history-icon, .route-history-row.is-idle strong { color: #946200; }
.route-history-row.is-stopped .route-history-icon, .route-history-row.is-stopped strong { color: #b02e42; }
.route-history-row.is-start .route-history-icon { color: #2563a0; }
.route-history-note { font-size: var(--text-tiny); line-height: 1.5; color: var(--secondary); margin-top: 9px; }
.route-history-map-label { max-width: 220px; white-space: normal; font-family: var(--font-ui); font-size: var(--text-small); }
.vehicle-quick-stats, .vehicle-updated, .route-history-metrics { font-variant-numeric: tabular-nums; }

/* Full-width rows reuse the live cards and their action controls. */
.dashboard-active.vehicle-rows-mode .fleet-workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); }
.vehicle-rows-mode .map-panel { display: none; }
.dashboard-active.vehicle-rows-mode .vehicles-panel[data-drawer] { display: flex; position: relative; inset: auto; grid-row: 1; width: 100%; height: 100%; min-width: 0; }
.vehicle-rows-mode .vehicles-panel .sheet-handle, .vehicle-rows-mode #drawer-detail-panel { display: none; }
.vehicle-rows-mode .vehicles-panel #drawer-list-panel { display: flex; min-width: 0; }
.vehicle-rows-mode .vehicles-panel .vehicle-list { overflow: auto; min-width: 0; max-height: none; flex: 1; }
.vehicle-rows-mode .vehicle-list-item { min-width: 960px; }
.vehicle-rows-mode .vehicle-card, body.vehicle-rows-mode.compact-cards .vehicle-card {
  display: grid; grid-template-columns: minmax(220px,1.3fr) 110px 160px minmax(230px,1.5fr) 210px;
  align-items: stretch; overflow: hidden; contain-intrinsic-block-size: auto 145px;
}
.vehicle-rows-mode .vehicle-card > .vehicle-select, body.vehicle-rows-mode.compact-cards .vehicle-card > .vehicle-select {
  padding: 12px; border: 0; border-radius: 0; align-self: stretch;
}
.vehicle-rows-mode .vehicle-card .vehicle-card-top { grid-template-columns: 30px minmax(0,1fr); }
.vehicle-rows-mode .vehicle-card .vehicle-updated { grid-column: 2; }
.vehicle-rows-mode .vehicle-card .vehicle-registration, .vehicle-rows-mode .vehicle-card .vehicle-address > span { white-space: normal; overflow-wrap: anywhere; }
.vehicle-rows-mode .vehicle-card > .vehicle-quick-stats { grid-template-columns: minmax(0,1fr); align-content: center; gap: 8px; padding: 12px; border-top: 0; border-left: 1px solid var(--card-divider); }
.vehicle-rows-mode .vehicle-quick-stats > button, .vehicle-rows-mode .vehicle-quick-stats > span { display: grid; grid-template-columns: 15px minmax(0,1fr); gap: 3px 6px; min-height: 0; padding: 0; border: 0; }
.vehicle-rows-mode .vehicle-quick-stats > button::after, .vehicle-rows-mode .vehicle-quick-stats > span::after { grid-column: 2; font-size: var(--text-tiny); font-weight: 400; color: var(--secondary); }
.vehicle-rows-mode .vehicle-quick-stats > button::after { content: 'Today'; }
.vehicle-rows-mode .vehicle-quick-stats > span::after { content: 'Speed'; }
.vehicle-rows-mode .vehicle-card > .vehicle-card-toggle { display: none; }
.vehicle-rows-mode .vehicle-card > .vehicle-card-details:not([hidden]) { display: contents; }
.vehicle-rows-mode .vehicle-card-details > .vehicle-expanded-status { flex-direction: column; justify-content: center; align-items: flex-start; padding: 12px; border-left: 1px solid var(--card-divider); }
.vehicle-rows-mode .vehicle-card-details .gps-warning { margin-top: 0; }
.vehicle-rows-mode .vehicle-card-details > .card-telemetry { margin: 0; padding: 10px; border-left: 1px solid var(--card-divider); align-content: center; }
.vehicle-rows-mode .vehicle-card-details .telemetry-item { min-height: 48px; padding: 6px; background: transparent; border: 0; }
.vehicle-rows-mode .vehicle-card-details > .vehicle-action-strip { padding: 10px 8px; gap: 3px; align-content: center; border-top: 0; border-left: 1px solid var(--card-divider); }
.vehicle-rows-mode .vehicle-card-details .vehicle-action { padding: 6px 2px; white-space: nowrap; }
.vehicle-rows-mode .vehicle-route-history { position: sticky; left: 0; max-width: 720px; }
@media (min-width:1280px) {
  .vehicle-rows-mode .vehicle-row-hint { display: none; }
}
@media (min-width:761px) and (min-height:501px), (min-width:1025px) {
  .dashboard-active .page-content { padding-left: 5px; padding-right: 5px; max-width: none; margin-left: 0; margin-right: 0; }
  .dashboard-active .fleet-workspace { column-gap: 5px; }
  .dashboard-active .fleet-status-bar, .dashboard-active .topbar { padding-left: 5px; padding-right: 5px; }
}
@media (max-width:760px), (max-width:1024px) and (max-height:500px) {
  .vehicle-view-actions .icon-button { width: 36px; height: 36px; }
  .vehicle-rows-mode .vehicle-route-history { max-width: calc(100vw - 34px); }
  .vehicle-card-toggle { min-height: 36px; }
  .route-history-icon { min-height: 36px; width: 30px; border-radius: 9px; }
  .vehicle-detail-card .vehicle-address { display: block; }
}
@media (max-width:1024px) and (max-height:500px) {
  .fleet-list-open .drawer-list-panel > .search-field { margin-right: 105px; }
}
