/* MitaBase Pro — a product of ETMITA · https://etmita.com
   Copyright © ETMITA. All rights reserved. */
/* ════════════════════════════════════════════════════════════════
   VERLAUF — the archive the billing runs on.

   v3 (2026-08-30): the page is src/features/history/history.page.ts →
   public/js/pages/history.js; this sheet holds every .vl3-* rule.
   Token-native under .mt-scope (overview-tokens.css) — dark mode is a
   token swap, never a parallel rule set. Shares the KPI / action /
   dialog grammar with fuhrpark.css + dispatch.css (.fp3-*, .dsp3-*).

   Reading order: FAHRTEN (KPIs → toolbar → the day-grouped timeline →
   pager) → PRÜFUNG (review cards) → the in-module dialog. Times and
   counts are mono + tabular and bidi-isolated; payment/form state is
   never a colour alone — the chip carries its text.
   ════════════════════════════════════════════════════════════════ */

.vl3 { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 12px; padding: 14px 16px 16px; overflow-y: auto; }
.vl3-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vl3-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vl3-title { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-family: var(--font-display), sans-serif; font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; color: var(--text-primary); }
.vl3-sub { margin: 0; font-size: .74rem; color: var(--text-muted); }
/* The view switch — a REAL segmented control, not two words of text.
   Styled here in full: the page must not lean on another sheet's
   .mt-seg scope (operator caught exactly that, 2026-08-30). */
.vl3-tabs {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 4px; border-radius: 13px;
  border: 1px solid var(--border-subtle); background: var(--surface-inset);
}
.vl3-tabs .mt-seg {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 0 16px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-secondary);
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.vl3-tabs .mt-seg:hover { color: var(--text-primary); }
.vl3-tabs .mt-seg.is-on {
  background: var(--surface-card); color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.vl3-tabs .mt-seg:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.vl3-tab-n { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--status-expiring-soft); color: var(--status-expiring); font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; display: inline-block; }
.vl3-tab-n.hidden { display: none !important; }
.vl3-head-acts { display: inline-flex; gap: 8px; margin-inline-start: auto; }
.vl3-body { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.vl3-ic { flex: 0 0 auto; }
.vl3-mono { font-family: var(--font-mono), monospace; font-variant-numeric: tabular-nums; }
.vl3-avfall { display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-inset); color: var(--text-secondary); font-size: .7rem; font-weight: 800; flex: 0 0 auto; }
.vl3-av { flex: 0 0 auto; }
.vl3-note { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .76rem; color: var(--text-muted); }

/* ── KPI strip (fp3-kpi grammar + page accents) ─────────────────── */
.vl3-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.vl3-kpi { text-align: start; cursor: default; }
button.vl3-kpi { cursor: pointer; }
button.vl3-kpi:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 2px; }
.vl3-kpi-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-inset); color: var(--text-secondary); }
.vl3-kpi-v { font-family: var(--font-mono), monospace; font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.vl3-kpi-l { font-size: .7rem; font-weight: 600; color: var(--text-muted); }

/* ── toolbar ────────────────────────────────────────────────────── */
.vl3-toolbar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border-subtle);
  background: var(--surface-card); box-shadow: var(--shadow-sm);
}
.vl3-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 40px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--surface-inset); color: var(--text-muted); }
.vl3-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: .84rem; }
.vl3-search input:focus { outline: none; }
.vl3-search:focus-within { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.vl3-search-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; }
.vl3-search-x:hover { background: var(--surface-hover); color: var(--text-primary); }
.vl3-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vl3-filters .is-end, .vl3-count.is-end { margin-inline-start: auto; }
.vl3-select {
  height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-subtle);
  background: var(--surface-inset); color: var(--text-primary); font: inherit; font-size: .8rem; min-width: 0; max-width: 100%;
}
.vl3-select:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.vl3-select.is-text { width: 150px; }
.vl3-select.is-date { width: 138px; }
.vl3-select.is-psize { width: auto; }
.vl3-count { font-size: .74rem; color: var(--text-muted); white-space: nowrap; }

/* ── chips: payment + form-check (text, never colour alone) ─────── */
.vl3-pay, .vl3-fc {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 0;
  border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-inset); color: var(--text-secondary); flex: 0 0 auto;
}
button.vl3-fc { cursor: pointer; min-height: 24px; }
button.vl3-fc:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.vl3-pay.is-paid { background: var(--status-valid-soft); color: var(--status-valid); }
.vl3-pay.is-unpaid { background: var(--status-expired-soft); color: var(--status-expired); }
.vl3-pay.is-exempt { background: var(--accent-soft); color: var(--accent-text); }
.vl3-pay.is-private { background: var(--status-expiring-soft); color: var(--status-expiring); }
.vl3-pay.is-accident, .vl3-pay.is-other { background: var(--surface-inset); color: var(--text-secondary); }
.vl3-fc.is-ok { background: var(--status-valid-soft); color: var(--status-valid); }
.vl3-fc.is-warn { background: var(--status-expiring-soft); color: var(--status-expiring); }
.vl3-fc.is-danger { background: var(--status-expired-soft); color: var(--status-expired); }
.vl3-fc.is-info { background: var(--accent-soft); color: var(--accent-text); }
.vl3-fc.is-muted { background: transparent; color: var(--text-muted); }
.vl3-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: .66rem; font-weight: 700; }

/* ── the day-grouped timeline ───────────────────────────────────── */
.vl3-list { display: flex; flex-direction: column; gap: 14px; min-height: 120px; }
.vl3-day { display: flex; flex-direction: column; gap: 8px; }
.vl3-day-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  background: var(--surface-page); backdrop-filter: blur(6px);
}
.vl3-day-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent-fill-solid); flex: 0 0 auto; }
.vl3-day-head h3 { margin: 0; font-size: .8rem; font-weight: 700; color: var(--text-primary); }
.vl3-day-n { font-size: .7rem; color: var(--text-muted); }
.vl3-day-rows { display: flex; flex-direction: column; gap: 6px; border-inline-start: 2px solid var(--border-subtle); padding-inline-start: 12px; margin-inline-start: 3px; }
.vl3-row { border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--surface-card); overflow: hidden; }
.vl3-row.is-open { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.vl3-row-head {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;
  padding: 8px 12px; border: 0; background: transparent; color: inherit; font: inherit;
  text-align: start; cursor: pointer;
}
.vl3-row-head:hover { background: var(--surface-hover); }
.vl3-row-head:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: -2px; }
.vl3-time { flex: 0 0 auto; font-size: .76rem; font-weight: 700; color: var(--text-secondary); min-width: 42px; }
.vl3-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.vl3-who b { font-size: .84rem; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl3-route { font-size: .7rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl3-drv { flex: 0 1 auto; font-size: .74rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14ch; }
.vl3-chev { color: var(--text-muted); transition: transform .18s ease; }
.vl3-row.is-open .vl3-chev { transform: rotate(180deg); }

/* detail */
.vl3-detail { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; border-top: 1px dashed var(--border-subtle); }
.vl3-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.vl3-field { display: flex; flex-direction: column; gap: 1px; font-size: .74rem; min-width: 0; }
.vl3-field span { color: var(--text-muted); font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.vl3-field b { color: var(--text-primary); font-weight: 600; overflow-wrap: anywhere; }
.vl3-photos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vl3-thumb { width: 64px; height: 64px; padding: 0; border: 1px solid var(--border-subtle); border-radius: 10px; overflow: hidden; background: var(--surface-inset); cursor: zoom-in; }
.vl3-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vl3-thumb.is-broken { opacity: .4; cursor: default; }
.vl3-thumb:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 2px; }
.vl3-nophoto { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-muted); }
.vl3-row-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── pager ──────────────────────────────────────────────────────── */
.vl3-pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 2px 0 8px; }
.vl3-pager:empty { display: none; }
.vl3-page {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--border-subtle); background: var(--surface-card);
  color: var(--text-secondary); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.vl3-page:hover:not(:disabled) { background: var(--surface-hover); }
.vl3-page.is-active { background: var(--accent-fill-solid); border-color: var(--accent-fill-solid); color: var(--accent-contrast); }
.vl3-page:disabled { opacity: .4; cursor: default; }
.vl3-page:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 1px; }
.vl3-gap { color: var(--text-muted); font-size: .78rem; }

/* ── empty states (a suggestion, never a dead end) ──────────────── */
.vl3-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 52px 16px; text-align: center; color: var(--text-muted); }
.vl3-empty p { margin: 0; font-size: .84rem; max-width: 46ch; line-height: 1.5; }
.vl3-empty-sub { font-size: .74rem !important; }

/* ── Prüfung: review cards ──────────────────────────────────────── */
.vl3-rev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.vl3-rev { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--surface-card); box-shadow: var(--shadow-sm); min-width: 0; }
.vl3-rev-photo { flex: 0 0 96px; width: 96px; height: 128px; padding: 0; border: 1px solid var(--border-subtle); border-radius: 10px; overflow: hidden; background: var(--surface-inset); cursor: zoom-in; }
.vl3-rev-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vl3-rev-photo.is-empty { display: grid; place-items: center; color: var(--text-muted); cursor: default; }
.vl3-rev-photo:focus-visible { outline: 2px solid var(--accent-fill-solid); outline-offset: 2px; }
.vl3-rev-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.vl3-rev-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vl3-rev-top b { font-size: .88rem; color: var(--text-primary); }
.vl3-rev-meta { display: flex; align-items: center; gap: 7px; font-size: .72rem; color: var(--text-muted); }
.vl3-rev-sum { margin: 0; font-size: .76rem; line-height: 1.45; color: var(--text-secondary); }
.vl3-rev-issues { margin: 0; padding-inline-start: 16px; font-size: .74rem; color: var(--status-expiring); display: flex; flex-direction: column; gap: 2px; }
.vl3-rev-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.vl3-rev-acts .is-end { margin-inline-start: auto; }

/* ── the form-check dialog ──────────────────────────────────────── */
.vl3-dialog-wide { max-width: 720px; width: 100%; }
.vl3-fc-body { display: flex; flex-direction: column; gap: 10px; }
.vl3-fc-photo { width: 100%; max-height: 320px; padding: 0; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: var(--surface-inset); cursor: zoom-in; }
.vl3-fc-photo img { width: 100%; height: 100%; max-height: 320px; object-fit: contain; display: block; }
.vl3-fc-clean { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .78rem; font-weight: 600; color: var(--status-valid); }
.vl3-e-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── phone ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .vl3 { padding: 10px; }
  .vl3-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vl3-drv { display: none; }
  .vl3-select, .vl3-select.is-text, .vl3-select.is-date { flex: 1 1 46%; width: auto; }
  .vl3-count.is-end { flex-basis: 100%; text-align: end; }
  .vl3-rev-grid { grid-template-columns: 1fr; }
  .vl3-e-grid { grid-template-columns: 1fr; }
  .vl3-page, .vl3-row-head, .vl3-select { min-height: 44px; }
  .vl3-search { height: 44px; }
}

/* ── calm by default ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vl3 *, .vl3-chev { transition: none !important; animation: none !important; }
}
