/* Fleet workspace and its dialogs. */
#vehiclesView.page-view {
  min-width: 0;
  max-width: none;
  padding: 24px;
  color: var(--ui-text, #172b3a);
}
#vehiclesView .page-header {min-height: 64px; gap: 12px; margin: 0 0 12px; padding: 0;}
#vehiclesView .page-header h1 {margin: 0; font-size: 28px; font-weight: 700;}
#vehiclesView .header-actions {display: flex; flex-wrap: wrap; gap: 8px;}
#vehiclesView .header-actions button {min-height: 40px;}
.vehicles-kpis {display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin: 0 0 12px;}
.vehicle-kpi, .vehicle-reminder, .vehicle-history-item, .fleet-metrics, .fleet-comparison details {
  min-width: 0;
  border: 1px solid var(--ui-border,#dce3e8);
  border-radius: 12px;
  background: var(--ui-surface,#fff);
  color: var(--ui-text,#172b3a);
}
.vehicle-kpi {display: grid; gap: 4px; padding: 10px 12px; font: inherit; text-align: left; cursor: pointer;}
.vehicle-kpi strong {font-size: 16px; line-height: 1.25; overflow-wrap: anywhere;}
.vehicle-kpi span, .fleet-metrics dt {font-size: 12px; color: var(--ui-muted,#647581);}
.vehicle-kpi:hover {background: var(--ui-surface-muted,#f3f6f8);}
.fleet-tabs {display: flex; flex-wrap: nowrap; gap: 4px; overflow: auto; margin-bottom: 12px;}
.fleet-tabs .tab {flex: 0 0 auto; min-height: 40px; border-radius: 8px; padding: 8px 14px; white-space: nowrap;}
.fleet-tabs .tab.active {
  color: var(--ui-accent-text,#0f6f67);
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 9%,var(--ui-surface,#fff));
  font-weight: 700;
}
.fleet-filters, .fleet-date-fields, .fleet-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#vehiclesView .fleet-filters {margin: 0 0 12px;}
.fleet-filters input, .fleet-filters select {min-width: 0; max-width: 100%; min-height: 40px;}
#vehiclesSearch {width: min(100%, 340px);}
.fleet-filters label {min-width: 0; max-width: 100%; font-size: 12px;}
.fleet-filters label input, .fleet-filters label select {display: block;}
.fleet-filters [hidden], .fleet-cost-workspace [hidden], .fleet-batch-fields [hidden], #financeVehicleDetails [hidden] {display: none;}
#fleetPageStatus:empty {display: none;}
#fleetPageStatus, [data-fleet-cost-status] {margin: 8px 0; color: var(--ui-muted,#647581);}
.fleet-list th {font-size: 12px;}
.fleet-list td {padding: 8px 12px; font-size: 14px; overflow-wrap: anywhere;}
.fleet-name small, .fleet-transaction small, .vehicle-history-head small {display: block; color: var(--ui-muted,#647581);}
.fleet-link {
  appearance: none;
  display: inline-block;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: var(--ui-accent-text,#0f6f67);
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.fleet-link:hover, .fleet-link:focus-visible {text-decoration: underline;}
.fleet-warning.is-overdue {color: var(--fleet-danger,#b42332);}
.vehicles-reminder-list, .vehicle-history-list, [data-fleet-history], [data-fleet-cost-rows], .fleet-comparison {display: grid; gap: 8px; min-width: 0;}
.vehicles-reminder-list h3, .fleet-history-header h3, #fleetDetailBody h3 {margin: 8px 0; font-size: 15px;}
.vehicle-reminder, .fleet-transaction {display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px 12px; padding: 10px 12px;}
.vehicle-reminder {border-inline-start: 3px solid #94630f;}
.vehicle-reminder.is-overdue {border-inline-start-color: var(--fleet-danger,#b42332);}
.vehicle-reminder-main, .vehicle-history-item {overflow-wrap: anywhere;}
.vehicle-reminder-meta, .vehicle-history-meta, .vehicle-history-item small {color: var(--ui-muted,#647581); font-size: 12px;}
.vehicle-status {display: inline-block; width: fit-content; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 650; color: #78500b; background: #fff2d8;}
.vehicle-status.is-overdue {color: #b42332; background: #fce8e8;}
.vehicle-status.is-ok {color: #247447; background: #e6f3eb;}
.vehicle-status.is-neutral {color: var(--ui-muted,#647581); background: var(--ui-surface-muted,#f3f6f8);}
.vehicle-dialog {width: min(800px, calc(100vw - 32px));}
.fleet-detail {width: min(1120px, calc(100vw - 32px));}
.fleet-detail[open], .fleet-editor[open] {display: flex; flex-direction: column; max-height: min(94dvh, 100vh - 24px); overflow: hidden;}
.fleet-detail > .ui-scroll-dialog-body, .fleet-editor form > .ui-scroll-dialog-body {flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain;}
.fleet-editor .vehicle-dialog-form {min-height: 0; display: flex; flex-direction: column;}
.vehicle-dialog .modal-head, .vehicle-dialog .modal-actions, .fleet-detail .fleet-tabs {flex: none;}
.vehicle-dialog .modal-head h2 {margin: 0; overflow-wrap: anywhere;}
#fleetDetailBody > * + * {margin-top: 12px;}
.vehicle-history-item {padding: 10px 12px;}
.vehicle-history-item > * + * {margin-top: 6px;}
.vehicle-history-head, .fleet-history-header {display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;}
.vehicle-history-meta, .vehicle-attachment-links, .vehicle-plan-preset-row {display: flex; flex-wrap: wrap; gap: 8px 12px;}
.vehicle-attachment-links a {color: var(--ui-accent-text,#0f6f67); overflow-wrap: anywhere;}
.vehicle-form-help {margin-top: 8px; font-size: 13px; color: var(--ui-muted,#647581);}
.vehicle-form-help.error {color: var(--fleet-danger,#b42332);}
.vehicle-inline-message {padding: 8px; background: var(--ui-surface-muted,#f3f6f8); color: var(--ui-text,#172b3a);}
.fleet-note {margin-bottom: 0; white-space: pre-wrap; overflow-wrap: anywhere;}
.fleet-menu {position: relative; min-width: 36px;}
.fleet-menu summary {cursor: pointer; padding: 4px 8px;}
.fleet-menu[open] > div {position: absolute; z-index: 2; width: max-content; background: var(--ui-surface,#fff); border: 1px solid var(--ui-border,#dce3e8); border-radius: 8px; padding: 4px;}
.fleet-metrics {display: grid; grid-template-columns: repeat(auto-fit,minmax(min(155px,100%),1fr)); gap: 10px; padding: 12px; margin: 8px 0;}
.fleet-metrics dd {margin: 2px 0 0; font-weight: 650;}
/* Period fuel breakdown */
.fleet-energy-summary {margin:12px 0;min-width:0;}
.fleet-energy-summary h3 {margin:0 0 5px;font-size:1rem;}
.fleet-energy-summary > p {margin:0 0 8px;font-size:.8125rem;}
.fleet-energy-list {display:grid;gap:6px;min-width:0;}
.fleet-energy-group {padding:8px 10px;border:1px solid var(--er-redesign-line);border-radius:8px;background:var(--er-redesign-surface);color:var(--er-redesign-ink);}
.fleet-energy-group h4 {margin:0 0 4px;font-size:.875rem;}
.fleet-energy-group dl {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0;}
.fleet-energy-group :is(dt,dd) {margin:0;overflow-wrap:anywhere;}
.fleet-energy-group dd {font-size:.875rem;font-weight:650;}
.fleet-energy-group :is(dt,dd small) {font-size:.75rem;color:var(--er-redesign-muted);font-weight:400;}
.fleet-energy-group dd small {display:block;margin-top:2px;}
@media(max-width:370px) {
  .fleet-energy-group dl {grid-template-columns:repeat(2,minmax(0,1fr));}
  .fleet-energy-group dl > :last-child {grid-column:1/-1;}
}
.fleet-comparison details {padding: 8px 12px;}
.fleet-comparison summary {cursor: pointer;}
.fleet-comparison summary span {float: inline-end;}
.fleet-history-header {margin-top: 12px;}
.fleet-history-header + div {margin-top: 8px;}
.fleet-transaction > :last-child {text-align: right;}
.fleet-check {display: flex; align-items: center; gap: 8px;}
.fleet-check input {width: 18px; height: 18px; min-height: 0; flex: none;}
#financeVehicleDetails [data-fin-duplicate] button {margin: 4px 0;}
.fleet-batch-fields {grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(160px,100%),1fr)); gap: 8px; border: 1px solid var(--ui-border,#dce3e8); border-radius: 8px; padding: 8px;}
.fleet-batch-fields[hidden] {display: none;}
.fleet-batch-fields p {grid-column: 1 / -1; margin: 0;}
.vehicle-assignment-dialog {max-height: min(88dvh, 100vh - 32px); overflow: auto;}
:root[data-theme="dark"] #vehiclesView, :root[data-theme="dark"] .vehicle-dialog {--fleet-danger:#f3a5a5;}
:root[data-theme="dark"] .fleet-tabs .tab.active, :root[data-theme="dark"] .fleet-link, :root[data-theme="dark"] .vehicle-attachment-links a {color: #81cfc1;}
:root[data-theme="dark"] .fleet-warning.is-overdue, :root[data-theme="dark"] .vehicle-form-help.error {color: #f3a5a5;}
:root[data-theme="dark"] .vehicle-status {color: #f3ca85; background: #382d1d;}
:root[data-theme="dark"] .vehicle-status.is-overdue {color: #f3a5a5; background: #40242a;}
:root[data-theme="dark"] .vehicle-status.is-ok {color: #85d4a0; background: #20362c;}
:root[data-theme="dark"] .vehicle-status.is-neutral {color: #a8b8c5; background: #202e3b;}
@media(max-width: 800px) {
  #vehiclesView.page-view {padding: 12px 14px calc(78px + env(safe-area-inset-bottom));}
  #vehiclesView .page-header {flex-wrap: wrap; min-height: 0;}
  #vehiclesView .page-header h1 {font-size: 24px;}
  .vehicles-kpis {grid-template-columns: repeat(2,minmax(0,1fr));}
  .fleet-list, .fleet-list tbody {display: block; width: 100%; min-width: 0;}
  .fleet-list thead {display: none;}
  .fleet-list tr {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 0 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--ui-border,#dce3e8);
  }
  .fleet-list td {padding: 0; border: 0; min-width: 0; justify-self: start;}
  .fleet-list td:nth-child(2), .fleet-list td:nth-child(4) {justify-self: end;}
  .fleet-filters {align-items: flex-end;}
  #vehiclesSearch {width: 100%;}
  .fleet-filters input, .fleet-filters select, .vehicle-dialog input, .vehicle-dialog select, .vehicle-dialog textarea,
  .fleet-batch-fields input, .fleet-batch-fields select {font-size: 16px;}
  .fleet-filters :is(input,select), .vehicle-dialog :is(button,input:not([type=checkbox]),select), .fleet-inline button,
  .fleet-tabs .tab, .fleet-link, #vehiclesView .header-actions button {min-height: 44px;}
  .fleet-detail[open], .fleet-editor[open] {
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .vehicle-dialog .modal-head, .vehicle-dialog .modal-actions, .vehicle-dialog .ui-scroll-dialog-body {padding: 12px 16px;}
  .fleet-detail .fleet-tabs {padding: 0 12px; margin: 0;}
  .fleet-editor .form-grid {grid-template-columns: minmax(0,1fr);}
  .fleet-editor .form-grid input, .fleet-editor .form-grid select {width: 100%; min-width: 0; max-width: 100%;}
  .vehicle-history-head {align-items: flex-start;}
  .fleet-assignment-dialog .form-grid {grid-template-columns: minmax(0,1fr);}
}
.fleet-detail > .ui-scroll-dialog-body, .fleet-editor form > .ui-scroll-dialog-body {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
}
@media(max-width: 800px) {
  .fleet-detail .fleet-tabs .tab {padding-inline: 10px; font-size: 13px;}
}
