/* CarManager — design system 2026.
   No build step, no CDN. Mobile-first components, desktop-density layouts. */

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --ink: #122b2c;
  --ink-soft: #2c4b4c;
  --brand: #0e3839;
  --brand-2: #175455;
  --accent: #c8ecb5;
  --accent-2: #a8d996;
  --canvas: #f3f6f1;
  --paper: #ffffff;
  --line: #dfe7df;
  --line-strong: #cfdacf;
  --muted: #6d7f76;
  --muted-2: #91a098;
  --danger: #b14535;
  --danger-bg: #feece7;
  --warn: #9a6b18;
  --warn-bg: #fff4dc;
  --ok: #3e7651;
  --ok-bg: #e9f4e5;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(16, 42, 43, .04), 0 6px 20px rgba(16, 42, 43, .05);
  --shadow-md: 0 16px 44px rgba(16, 42, 43, .11);
  --shadow-lg: 0 30px 100px rgba(10, 34, 35, .28);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 90% -10%, #e7f1de 0%, transparent 60%),
    radial-gradient(900px 500px at 5% 0%, #eef3e7 0%, transparent 55%),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
svg { width: 20px; height: 20px; flex-shrink: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #6db3a8; outline-offset: 2px; }

/* ---------- Typography and utilities ---------- */

.muted { color: var(--muted); }
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 750;
  color: var(--muted);
}
.help { font-size: 11px; color: var(--muted-2); margin: 7px 0 0; line-height: 1.65; }
.spaced { margin-top: 20px; }
.no-margin { margin: 0; }
.footer-note { font-size: 10px; color: var(--muted-2); text-align: center; margin-top: 38px; }
.screen-reader {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.text-link {
  color: var(--brand-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.text-link:hover { text-decoration: underline; }
.amount { font-weight: 750; color: #214c3d; font-variant-numeric: tabular-nums; }
.subtext { display: block; font-size: 10.5px; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.status-pill {
  font-size: 10px;
  background: var(--ok-bg);
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--ok);
  font-weight: 700;
}

/* ---------- Buttons ---------- */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  border-radius: 11px;
  background: #e9efea;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
button svg { width: 18px; height: 18px; }
button.primary {
  background: linear-gradient(180deg, #195b5c 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(14, 56, 57, .18);
}
button.ghost { background: rgba(255, 255, 255, .72); border: 1px solid var(--line-strong); }
button.danger { background: var(--danger-bg); color: var(--danger); }
button.accent { background: var(--accent); color: var(--brand); }
button.small { min-height: 34px; padding: 7px 11px; font-size: 11.5px; border-radius: 9px; }
button.icon { padding: 9px; width: 40px; height: 40px; }
button.icon.small { width: 34px; height: 34px; padding: 6px; }
button:active { transform: translateY(1px); }
@media (hover: hover) {
  button:hover { background: #dfe8e1; }
  button.primary:hover { background: linear-gradient(180deg, #1c6667 0%, #104344 100%); }
  button.ghost:hover { background: #fff; border-color: #b9c9bc; }
  button.danger:hover { background: #fde0d9; }
}

/* ---------- App shell ---------- */

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 26px;
  color: #fff;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(200, 236, 181, .14), transparent 62%),
    linear-gradient(180deg, #103c3d 0%, #092a2b 100%);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 800; letter-spacing: -.7px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: var(--brand);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand small {
  display: block;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 2.3px;
  margin-top: 4px;
  color: #a9c9bf;
}
.sidebar nav { display: grid; gap: 6px; margin-top: 42px; }
.sidebar nav button {
  justify-content: flex-start;
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  background: transparent;
  color: #b8cec9;
  font-size: 13px;
  font-weight: 550;
  border-radius: 11px;
}
.sidebar nav button.active { background: rgba(255, 255, 255, .10); color: #e7f7df; box-shadow: inset 0 0 0 1px rgba(200, 236, 181, .14); }
.sidebar nav svg { width: 20px; height: 20px; }
.sidebar .side-caption { font-size: 9.5px; letter-spacing: 1.8px; color: #84a69e; margin: 26px 12px 8px; font-weight: 700; }
.side-bottom { margin-top: auto; }
.side-tip {
  padding: 16px 14px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(200, 236, 181, .14);
  border-radius: 14px;
  font-size: 11.5px;
  line-height: 1.65;
  color: #c3d7cf;
}
.side-tip strong { display: block; color: #e4f6d7; font-size: 12.5px; margin-bottom: 5px; }
.profile { display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 22px; padding-top: 20px; }
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4f7c72, #2f5d57);
  color: #eaf7df;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .5px;
}
.profile-info { flex: 1; min-width: 0; }
.profile-info strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-info small { font-size: 10px; color: #9cbab2; }
.profile button { color: #c1d5cd; background: transparent; padding: 4px; min-height: 38px; }

.main {
  grid-column: 2;
  min-width: 0;
  padding: 0 clamp(20px, 4vw, 48px) 64px;
}
.main > .topbar,
.main > #page-content,
.main > .footer-note { max-width: 1320px; margin-left: auto; margin-right: auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 246, 241, .86);
  backdrop-filter: blur(14px);
}
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); min-width: 0; }
.breadcrumb strong { color: var(--ink); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 20px; align-items: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.online-dot { display: inline-block; width: 7px; height: 7px; background: #58a476; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 0 3px #58a47618; }

.mobile-nav { display: none; }
.offline {
  background: var(--warn-bg);
  padding: 11px 20px;
  text-align: center;
  font-size: 12px;
  color: #7b6332;
  border-bottom: 1px solid #efdfba;
}

/* ---------- Headings, stats and cards ---------- */

.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin: 36px 0 28px;
}
.heading h1 {
  font-size: clamp(27px, 3vw, 38px);
  letter-spacing: -1px;
  margin: 8px 0 9px;
  line-height: 1.08;
  font-weight: 750;
}
.heading p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.stat {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); font-weight: 600; }
.stat-top svg { width: 17px; height: 17px; padding: 6px; box-sizing: content-box; border-radius: 50%; background: var(--ok-bg); color: var(--ok); }
.stat-value {
  font-size: clamp(23px, 2.2vw, 30px);
  letter-spacing: -.8px;
  margin: 13px 0 7px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.stat-value span { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat-note { font-size: 10.5px; color: var(--muted-2); line-height: 1.4; }
.stat.dark { background: linear-gradient(155deg, #164a4b 0%, #0d3031 100%); color: #fff; border-color: transparent; box-shadow: 0 12px 32px rgba(13, 48, 49, .18); }
.stat.dark .stat-top, .stat.dark .stat-value span { color: #c8dbc8; }
.stat.dark .stat-note { color: #a9c4b4; }
.stat.dark .stat-top svg { background: rgba(200, 236, 181, .13); color: var(--accent); }

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel h3 { margin: 0 0 15px; font-size: 14px; font-weight: 750; letter-spacing: -.1px; }
.quick-panel { background: linear-gradient(155deg, #eef5e7, #e4efdb); border-color: #d9e6ce; }
.quick-panel p { font-size: 12px; color: #61765f; line-height: 1.7; }
.quick-panel button { width: 100%; margin-top: 9px; }
.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 40px 22px;
  text-align: center;
  background: rgba(255, 255, 255, .62);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.empty svg { width: 46px; height: 46px; color: #7fa287; margin: 0 auto 6px; }
.empty h3 { color: var(--ink); font-size: 17px; margin: 8px 0; }
.empty p { max-width: 380px; margin: 8px auto 18px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.35px; }
.section-head small { color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.dashboard-grid > * { min-width: 0; }
.dashboard-grid .table-panel { max-width: 100%; min-width: 0; }
/* The dashboard keeps the essentials; the full table lives on the fuel page. */
.dashboard-grid .table-panel th:nth-child(3),
.dashboard-grid .table-panel td:nth-child(3),
.dashboard-grid .table-panel th:nth-child(6),
.dashboard-grid .table-panel td:nth-child(6) { display: none; }

/* ---------- Vehicles ---------- */

.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 16px;
}
.dashboard-grid .vehicles-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); }
.vehicle-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
@media (hover: hover) {
  .vehicle-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
}
.car-visual {
  height: 126px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(220px 120px at 70% 15%, #ffffff, transparent 70%),
    linear-gradient(155deg, #edf3e6, #dfeadb);
}
.car-visual > svg, .car-visual .car-art { width: 218px; height: auto; color: #50766c; }
.car-year {
  position: absolute;
  right: 12px;
  top: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  padding: 4px 8px;
  font-size: 10px;
  color: #55716a;
  font-weight: 650;
  backdrop-filter: blur(6px);
}
.vehicle-content { padding: 17px; }
.vehicle-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vehicle-title h3 { font-size: 15.5px; margin: 0 0 4px; letter-spacing: -.3px; line-height: 1.25; }
.vehicle-sub { font-size: 10.5px; color: var(--muted); }
.plate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .9px;
  background: #fff;
  border: 1px solid #d3dfd6;
  border-left: 4px solid #3f6b9b;
  border-radius: 5px;
  padding: 4px 6px;
  white-space: nowrap;
  color: #223b3b;
}
.vehicle-meta { display: flex; gap: 13px; align-items: center; padding: 16px 0 13px; border-bottom: 1px solid var(--line); font-size: 10.5px; color: #61766e; flex-wrap: wrap; }
.vehicle-meta span { display: flex; align-items: center; gap: 5px; }
.vehicle-meta svg { width: 14px; height: 14px; }
.vehicle-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 10px; }
.vehicle-bottom .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Badges and reminders ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.soon { background: var(--warn-bg); color: var(--warn); }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: #edf1ed; color: #718077; }
.reminder { display: flex; align-items: flex-start; gap: 11px; padding: 13px 0; border-bottom: 1px solid #eef1ea; }
.reminder:last-child { border: 0; padding-bottom: 0; }
.reminder-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); flex-shrink: 0; }
.reminder-icon.overdue { background: var(--danger-bg); color: var(--danger); }
.reminder-icon.ok { background: var(--ok-bg); color: var(--ok); }
.reminder-icon svg { width: 16px; height: 16px; }
.reminder strong { font-size: 12px; display: block; margin-bottom: 4px; }
.reminder p { font-size: 10.5px; color: var(--muted); margin: 0; line-height: 1.6; }
.reminder button { margin-left: auto; flex-shrink: 0; }

/* ---------- Filter bar ---------- */

.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.filterbar select { max-width: 320px; }
.filterbar .actions { margin-left: auto; }

/* ---------- Tables (desktop) ---------- */

.table-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; white-space: nowrap; }
th { text-align: left; color: var(--muted-2); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafcf8; }
td { padding: 15px 14px; border-bottom: 1px solid #edf1ea; vertical-align: top; }
td:first-child { white-space: normal; min-width: 150px; }
tbody tr:last-child td { border-bottom: 0; }
@media (hover: hover) { tbody tr:hover td { background: #fbfdf9; } }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button + button { margin-left: 6px; }

/* ---------- Alerts and charts ---------- */

.alert { padding: 12px 15px; border-radius: var(--radius-sm); background: var(--warn-bg); color: #7d6226; font-size: 12px; line-height: 1.7; margin-bottom: 16px; border: 1px solid #efdfba; }
.alert.error { background: var(--danger-bg); color: #993f31; border-color: #efd3ca; }
.alert.info { background: var(--ok-bg); color: #42684c; border-color: #d9e7d6; }
.chart { height: 160px; width: 100%; color: #4f907a; }
.chart line { stroke: #e1e8dd; stroke-width: 1; }
.chart polyline { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart circle { fill: currentColor; stroke: #fff; stroke-width: 2; }
.chart-labels { display: flex; justify-content: space-between; gap: 15px; font-size: 10px; color: var(--muted); flex-wrap: wrap; }

/* ---------- Details, settings ---------- */

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-grid dt { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; font-weight: 650; }
.detail-grid dd { margin: 0; font-size: 13px; word-break: break-word; }
.settings { max-width: 820px; display: grid; gap: 18px; }
.settings p { font-size: 12.5px; line-height: 1.8; color: #61746a; overflow-wrap: anywhere; }
.settings .actions { margin-top: 15px; }

/* ---------- Forms ---------- */

input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-soft);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus { border-color: #639b83; box-shadow: 0 0 0 4px rgba(80, 143, 114, .14); }
input[type=checkbox] { width: 19px; height: 19px; min-height: 19px; accent-color: #2c6a50; }
input[type=file] { font-size: 12px; padding: 9px; }
input[type=file]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 7px; }
label.check { display: flex; align-items: center; gap: 9px; margin: 12px 0; font-weight: 550; color: var(--ink-soft); }
.field { margin-bottom: 16px; min-width: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row .field { min-width: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 10px; }

/* ---------- Carte grise help ---------- */

.carte-grise { margin-bottom: 20px; padding: 0; overflow: hidden; }
.carte-grise summary {
  cursor: pointer;
  padding: 15px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.carte-grise summary::-webkit-details-marker { display: none; }
.carte-grise summary::before { content: "+"; font-size: 17px; line-height: 1; color: var(--ok); font-weight: 500; }
.carte-grise[open] summary::before { content: "−"; }
.carte-grise .detail-grid { padding: 0 18px 16px; margin-top: 0; gap: 14px; }
.carte-grise dd { font-size: 12px; line-height: 1.55; }
.carte-grise .help { padding: 0 18px 16px; font-size: 11px; margin: 0; }

/* ---------- Dialog and OCR ---------- */

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(92dvh, 920px);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  background: var(--paper);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
dialog[open] { display: block; }
dialog::backdrop { background: rgba(8, 30, 32, .55); backdrop-filter: blur(4px); }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  padding: 24px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.modal-head h2 { font-size: 22px; letter-spacing: -.6px; margin: 0; }
.modal-head p { font-size: 12px; color: var(--muted); margin: 7px 0 0; }
.modal-head button { background: transparent; flex-shrink: 0; }
.modal-body { padding: 16px 28px 26px; }
.modal-body h3 { font-size: 13px; margin: 20px 0 12px; }
.modal-body .preview { max-height: 220px; max-width: 100%; display: block; margin: 14px auto; border-radius: 12px; object-fit: contain; }
.ocr-drop { border: 1px dashed #a7bfa3; background: #f3f8ed; border-radius: 14px; padding: 16px; margin-bottom: 18px; transition: background .16s ease, border-color .16s ease; }
.ocr-drop:hover { background: #eef6e7; border-color: #82a97c; }
.ocr-drop strong { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 9px; }
.ocr-drop input { background: transparent; border: 0; padding: 5px 0; }
.ocr-drop p { font-size: 10.5px; color: #71876c; margin: 5px 0; line-height: 1.65; }
.ocr-status { font-size: 11.5px; color: #58735a; margin-top: 8px; min-height: 18px; }
.ocr-warnings { font-size: 11px; padding: 12px 14px; background: var(--warn-bg); border-radius: 10px; margin: 12px 0; line-height: 1.65; color: #7d6226; }
.ocr-warnings strong { display: block; margin-bottom: 3px; }
.ocr-warnings p { margin: 2px 0; }
.ocr-summary { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fbfdfa; }
.ocr-summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 15px 16px 12px; border-bottom: 1px solid var(--line); }
.ocr-summary-head h3 { margin: 4px 0 0; font-size: 15px; }
.ocr-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.ocr-field { background: #fff; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ocr-field-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); font-weight: 750; }
.ocr-field strong { font-size: 15px; font-weight: 750; color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; }
.ocr-field.is-missing strong { color: var(--muted-2); font-weight: 550; font-size: 12.5px; }
.ocr-confidence { font-size: 10px; font-weight: 700; color: var(--ok); }
.ocr-confidence.medium { color: var(--warn); }
.ocr-confidence.low, .ocr-confidence.missing { color: var(--danger); }
.ocr-confidence.missing { color: var(--muted-2); }
.ocr-evidence { font-size: 10px; color: var(--muted-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ocr-warnings:last-child { margin-bottom: 0; }
.ocr-summary > .ocr-warnings { margin: 0; border-radius: 0; }
.ocr-raw { border-top: 1px solid var(--line); padding: 10px 16px; }
.ocr-raw summary { cursor: pointer; font-size: 11px; color: var(--muted); font-weight: 700; }
.ocr-raw pre { margin: 10px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 10px; line-height: 1.5; color: var(--ink-soft); background: #f2f6f0; padding: 10px; border-radius: 8px; }
.ocr-preview-link { display: block; background: #f3f6f1; border-bottom: 1px solid var(--line); }
.ocr-summary .preview { max-height: 220px; width: 100%; object-fit: contain; background: #f3f6f1; margin: 0; border-radius: 0; }
.spinner { width: 14px; height: 14px; border: 2px solid #b9cdb9; border-top-color: var(--ok); border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 7px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.import-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 11px; }
.import-card h3 { margin: 0 0 9px; }
.import-card p { font-size: 11px; line-height: 1.7; color: var(--muted); }
.note-box { font-size: 12px; white-space: pre-wrap; line-height: 1.7; color: #61746a; }

/* ---------- Auth ---------- */

.auth-layout { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
.auth-story {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 5vw, 64px);
  color: #fff;
  background:
    radial-gradient(600px 400px at 90% 10%, rgba(200, 236, 181, .16), transparent 60%),
    radial-gradient(500px 400px at 0% 100%, rgba(93, 160, 146, .18), transparent 60%),
    linear-gradient(155deg, #123f40 0%, #092a2b 100%);
}
.auth-story::after {
  content: "";
  position: absolute;
  inset: auto -120px -160px auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(200, 236, 181, .12);
  pointer-events: none;
}
.auth-story > * { position: relative; z-index: 1; }
.auth-story h1 { font-size: clamp(34px, 4.2vw, 62px); font-weight: 600; line-height: 1.06; letter-spacing: -2.2px; max-width: 520px; margin: 44px 0 22px; }
.auth-story h1 em { color: var(--accent); font-style: normal; }
.auth-story p { font-size: 14px; line-height: 1.8; color: #b3cbc0; max-width: 380px; }
.auth-story .car-art { width: 100%; max-width: 480px; color: #b4d3ad; align-self: center; margin: 26px 0; height: auto; }
.auth-foot { font-size: 11px; color: #9dbbb0; display: flex; align-items: center; gap: 7px; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 38px; }
.auth-form { width: 100%; max-width: 400px; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .78); box-shadow: var(--shadow-md); backdrop-filter: blur(12px); }
.auth-form h2 { font-size: 27px; letter-spacing: -1px; margin: 10px 0 9px; }
.auth-form > p { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-bottom: 24px; }
.auth-form button.primary { width: 100%; margin-top: 8px; }
.auth-switch { font-size: 12px; text-align: center; margin-top: 18px; color: var(--muted); }
.auth-switch button { padding: 5px 8px; min-height: 36px; font-size: 12px; color: var(--brand-2); background: transparent; }
.auth-mobile-brand { display: none; }

/* ---------- Toast, install banner, loading ---------- */

#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  max-width: calc(100vw - 24px);
  padding: 13px 18px;
  border-radius: 12px;
  background: #123d34;
  color: #fff;
  font-size: 12px;
  box-shadow: var(--shadow-md);
  animation: toast-in .2s ease both;
}
#toast.error { background: #963f31; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.install-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--radius-sm); background: #e8f1df; border: 1px solid #d9e6ce; font-size: 12px; color: #4f664f; }
.install-banner button { margin-left: auto; flex-shrink: 0; }
.loading { padding: 26vh 20px; text-align: center; color: var(--muted); }
.loading h1 { color: var(--ink); font-size: clamp(22px, 4vw, 30px); margin-bottom: 10px; }
.loading button { margin-top: 14px; }

/* ---------- Responsive: large desktop ---------- */

@media (min-width: 1450px) {
  .main { padding-left: 56px; padding-right: 56px; }
  .heading { margin-top: 44px; }
  .stat { padding: 22px; }
  .car-visual { height: 140px; }
}

/* ---------- Responsive: compact desktop ---------- */

@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 224px minmax(0, 1fr); }
  .sidebar { width: 224px; padding: 26px 15px 22px; }
  .main { padding-left: 26px; padding-right: 26px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .dashboard-aside .section-head { grid-column: 1 / -1; }
  .heading h1 { font-size: 30px; }
  .topbar-right time { display: none; }
}

/* ---------- Responsive: tablet / mobile navigation ---------- */

@media (max-width: 900px) {
  .app-layout { display: block; }
  .sidebar { display: none; }
  .main { padding: 0 18px 108px; }
  .topbar { height: 66px; }
  .breadcrumb { font-size: 11px; }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 56px;
    min-height: 50px;
    padding: 5px 8px;
    background: transparent;
    color: #72857a;
    font-size: 9.5px;
    font-weight: 650;
    border-radius: 11px;
  }
  .mobile-nav button.active { color: var(--brand); background: #edf4e7; }
  .mobile-nav svg { width: 21px; height: 21px; }
  .heading { margin: 26px 0 22px; align-items: flex-start; flex-direction: column; gap: 14px; }
  .heading h1 { font-size: 27px; }
  .heading p { font-size: 12.5px; }
  .heading .actions { width: 100%; }
  .heading .actions button { flex: 1; }
  .stats { gap: 12px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 26px; }
  .dashboard-aside { display: block; }
  .dashboard-aside .panel { margin-bottom: 14px; }
  .vehicle-title { display: block; }
  .vehicle-title .plate { margin-top: 8px; }
  .auth-layout { display: block; }
  .auth-story { display: none; }
  .auth-form-wrap { min-height: 100vh; min-height: 100dvh; padding: 26px 18px; align-items: flex-start; }
  .auth-form { margin: auto; padding: 24px; }
  .auth-mobile-brand { display: flex; color: var(--brand); margin-bottom: 28px; }
  .auth-mobile-brand small { color: #7e9a85; }
  #toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
  dialog { max-height: 92dvh; }
}

/* ---------- Responsive: phones ---------- */

@media (max-width: 680px) {
  .main { padding-left: 14px; padding-right: 14px; }
  input, select, textarea { font-size: 16px; }
  .topbar-right { display: none; }
  .heading h1 { font-size: 25px; }
  .heading .actions button { flex: 1 1 auto; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; border-radius: 13px; }
  .stat-top { font-size: 10px; align-items: flex-start; }
  .stat-value { font-size: 23px; margin: 11px 0 6px; }
  .stat-note { font-size: 9.5px; }
  .section-head { margin-top: 23px; }
  .section-head h2 { font-size: 16px; }
  .section-head small { display: none; }
  .filterbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .filterbar select { max-width: none; }
  .filterbar .actions { margin-left: 0; }
  .filterbar .actions button, .filterbar .actions .text-link { flex: 1; justify-content: center; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-row .field { margin-bottom: 14px; }
  .detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .settings { gap: 14px; }
  .settings .actions button, .settings .actions .text-link { flex: 1; justify-content: center; }
  .vehicles-grid, .dashboard-grid .vehicles-grid { grid-template-columns: 1fr; }
  .car-visual { height: 132px; }
  .car-visual > svg, .car-visual .car-art { width: 210px; }
  .actions { gap: 8px; }
  .actions button { min-height: 42px; }
  .amount { font-variant-numeric: tabular-nums; }

  /* Tables become readable cards. */
  .table-panel { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 11px; }
  tr { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
  td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 14px;
    padding: 6px 0;
    border: 0;
    white-space: normal;
    font-size: 12px;
    text-align: right;
    min-width: 0;
  }
  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 9.5px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--muted-2);
    text-align: left;
  }
  td:first-child { display: block; text-align: left; padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
  td:first-child::before { display: none; }
  td:first-child .subtext { text-align: left; }
  td .subtext { flex-basis: 100%; text-align: right; margin-top: 3px; }
  td.row-actions { justify-content: flex-end; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); }
  td.row-actions::before { display: none; }
  td.row-actions button { flex: 0 0 auto; }
  .table-panel .badge { vertical-align: middle; }

  .carte-grise .detail-grid { grid-template-columns: 1fr; }
  .carte-grise summary { padding: 14px 15px; }
  .carte-grise .detail-grid { padding: 0 15px 14px; }
  .carte-grise .help { padding: 0 15px 14px; }

  dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .modal-head { padding: calc(16px + env(safe-area-inset-top)) 18px 12px; }
  .modal-head h2 { font-size: 20px; }
  .modal-head p { font-size: 11px; }
  .modal-body { padding: 14px 18px calc(22px + env(safe-area-inset-bottom)); }
  .form-actions { position: sticky; bottom: 0; z-index: 2; background: var(--paper); padding: 12px 0 calc(6px + env(safe-area-inset-bottom)); margin-top: 12px; }
  .form-actions button { flex: 1; }
  .ocr-fields { grid-template-columns: 1fr 1fr; }
  .ocr-summary-head { padding: 13px 14px 11px; }
  .ocr-field { padding: 11px 12px; }
  .ocr-summary .preview { max-height: 160px; }
  .install-banner { flex-wrap: wrap; }
  .install-banner button { margin-left: 0; width: 100%; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .ocr-fields { grid-template-columns: 1fr; }
  .heading h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
