/* =========================================================
   MyCars — feuille de style
   Sidebar noire · contenu clair · accent rouge
   ========================================================= */

:root {
  --red: #e10b17;
  --red-dark: #c00812;
  --red-soft: #fdeced;
  --orange: #f2780c;
  --orange-soft: #fff1e3;
  --blue: #2463eb;
  --blue-soft: #e9f0fe;
  --green: #17a34a;
  --green-soft: #e7f7ed;

  --ink: #111216;
  --ink-2: #3b3f48;
  --muted: #7a808c;
  --line: #eaecf0;
  --bg: #f5f6f8;
  --card: #ffffff;
  --side: #0c0d10;
  --side-2: #17181c;
  --side-text: #9ba0aa;

  --r: 14px;
  --r-sm: 10px;
  --sh: 0 1px 2px rgba(16, 18, 24, .04), 0 2px 8px rgba(16, 18, 24, .04);
  --sh-lg: 0 18px 50px rgba(16, 18, 24, .18);
  --side-w: 236px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

i[data-ico] { display: inline-flex; font-style: normal; }
i[data-ico] svg, .ico {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Logo ---------- */
.logo { position: relative; display: inline-flex; font-size: 25px; font-weight: 800; letter-spacing: -.03em; color: #fff; padding-top: 8px; }
.logo b { color: var(--red); font-weight: 800; }
.logo-swoosh { position: absolute; left: 4px; top: -2px; width: 74px; height: 18px; fill: var(--red); }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--side-w);
  display: flex; flex-direction: column;
  padding: 26px 14px 18px;
  background: var(--side); color: var(--side-text);
}
.sidebar .logo { margin: 0 0 30px 10px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-sub {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover, .nav-sub:hover { color: #fff; background: var(--side-2); }
.nav a.active { color: #fff; background: var(--side-2); box-shadow: inset 3px 0 0 var(--red); }
.nav a.active i { color: var(--red); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.user { display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--side-2); }
.user b { display: block; color: #fff; font-weight: 600; }
.user small { font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #e10b17, #6d0309);
}

.main { margin-left: var(--side-w); padding: 0 28px 40px; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0; background: var(--bg);
}
.logo-mobile, .avatar-mobile { display: none; }

.search { position: relative; flex: 1; max-width: 460px; margin-right: auto; }
.search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 42px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(17, 18, 22, .06); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-lg);
  display: none; max-height: 360px; overflow-y: auto; padding: 6px;
}
.search-results.open { display: block; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; }
.search-results a:hover { background: var(--bg); }
.search-results small { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-results .empty { padding: 12px; color: var(--muted); }

.icon-btn {
  position: relative; width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  transition: background .15s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: 10px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-ghost { background: var(--card); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Pages ---------- */
.page { display: none; }
.page.active { display: block; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; }
.panel .section-head { margin-top: 0; }
.section-head h2 { font-size: 17px; }
.more { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 600; font-size: 13px; }
.more i svg { width: 15px; height: 15px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 20px; }
.col-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }

.mobile-only, .greeting { display: none; }

/* ---------- Sélecteur de véhicule ---------- */
.vpills { display: flex; gap: 8px; margin: 4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.vpills::-webkit-scrollbar { display: none; }
.vpills button {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 4px 14px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; font-size: 13px; transition: border-color .15s, background .15s;
}
.vpills button span { width: 30px; height: 30px; border-radius: 50%; background: #1b1c20 center/cover no-repeat; }
.vpills button:hover { border-color: #cfd3da; }
.vpills button.active { border-color: var(--ink); background: var(--ink); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  height: 260px; border-radius: 18px;
  background: #08090b;
  display: flex; align-items: center; justify-content: center;
}
.hero::before, .hero::after { content: ""; position: absolute; top: 0; bottom: 0; background-size: cover; }
.hero::before {
  left: 0; width: 62%;
  background-image: url("https://images.unsplash.com/photo-1615644406166-3c3538dac1f3?auto=format&fit=crop&w=1200&q=70");
  background-position: center 55%;
  filter: brightness(.8);
  -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent);
          mask-image: linear-gradient(90deg, #000 55%, transparent);
}
.hero::after {
  right: 0; width: 48%;
  background-image: url("https://images.unsplash.com/photo-1760716801761-a2b7bd687979?auto=format&fit=crop&w=1000&q=70");
  background-position: center 55%;
  -webkit-mask-image: linear-gradient(270deg, #000 55%, transparent);
          mask-image: linear-gradient(270deg, #000 55%, transparent);
}
.hero-text {
  position: relative; z-index: 1; text-align: center; color: #fff;
  padding: 18px 28px; border-radius: 14px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
}
.hero-logo { position: relative; display: inline-block; font-size: 46px; font-weight: 800; letter-spacing: -.035em; padding-top: 10px; }
.hero-logo b { color: var(--red); }
.hero-logo .logo-swoosh { width: 130px; height: 30px; left: 6px; top: -6px; }
.hero-text p { font-size: 18px; font-weight: 600; line-height: 1.35; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }

/* ---------- Vehicle cards ---------- */
.vehicle-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.vcard {
  display: grid; grid-template-columns: 130px 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.vcard:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.vcard-photo { background: #1b1c20 center/cover no-repeat; min-height: 128px; }
.vcard-body { padding: 14px 16px 12px; display: flex; flex-direction: column; min-width: 0; }
.vcard-body h3 { font-size: 16px; }
.vcard-year { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; align-self: flex-start; margin-top: 8px; padding: 2px 9px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.vcard-stats { display: flex; gap: 14px; margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.vcard-stats span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.vcard-stats svg { width: 14px; height: 14px; color: var(--muted); }

.vcard-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 128px; border: 1.5px dashed #d5d8de; border-radius: var(--r); background: transparent;
  color: var(--muted); font-weight: 500; cursor: pointer; transition: border-color .15s, color .15s;
}
.vcard-add:hover { border-color: var(--red); color: var(--red); }
.vcard-add span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); }

/* garage (page véhicules) */
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.gcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.gcard:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.gcard-photo { position: relative; height: 190px; background: #1b1c20 center/cover no-repeat; }
.gcard-photo .tag { position: absolute; left: 12px; top: 12px; margin: 0; background: rgba(255, 255, 255, .92); }
.gcard-body { padding: 16px 18px; }
.gcard-body h3 { font-size: 18px; }
.gcard-body .vcard-stats { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.gcard-next { margin-top: 12px; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.gcard-next span { color: var(--muted); }

/* ---------- Dashboard grid ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }

.due-list { list-style: none; margin: 0; padding: 0; }
.due-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.due-list li:first-child { border-top: 0; padding-top: 0; }
.due-list li:last-child { padding-bottom: 0; }
.due-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.due-main { flex: 1; min-width: 0; }
.due-main b { display: block; font-weight: 600; }
.due-main small { color: var(--muted); font-size: 12px; }
.due-when { font-weight: 600; font-size: 13px; white-space: nowrap; }
.due-list .chev { color: #c3c7cf; }

.c-red { color: var(--red); } .bg-red { background: var(--red-soft); color: var(--red); }
.c-orange { color: var(--orange); } .bg-orange { background: var(--orange-soft); color: var(--orange); }
.c-blue { color: var(--blue); } .bg-blue { background: var(--blue-soft); color: var(--blue); }
.c-green { color: var(--green); } .bg-green { background: var(--green-soft); color: var(--green); }
.bg-grey { background: var(--bg); color: var(--ink-2); }

.shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shortcut {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px;
  padding: 16px 8px; border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.shortcut:hover { border-color: transparent; transform: translateY(-2px); box-shadow: var(--sh-lg); }
.shortcut i svg { width: 26px; height: 26px; margin-bottom: 6px; }
.shortcut b { font-size: 13px; }
.shortcut small { font-size: 11px; color: var(--muted); line-height: 1.3; }

.interventions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.icard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); }
.icard-photo { height: 130px; background: #1b1c20 center/cover no-repeat; }
.icard-body { position: relative; padding: 12px 14px; }
.icard-body b { display: block; font-size: 14px; padding-right: 24px; }
.icard-body small { display: block; color: var(--muted); font-size: 12px; }
.icard-check { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.icard-check svg { width: 12px; height: 12px; stroke-width: 3; }

/* ---------- Fiche véhicule ---------- */
.cover {
  position: relative; height: 240px; border-radius: 18px; overflow: hidden;
  background: #111 center/cover no-repeat; color: #fff;
  display: flex; align-items: flex-end; padding: 24px;
}
.cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.8)); }
.cover > * { position: relative; }
.cover-main { flex: 1; }
.cover-main h1 { font-size: 30px; font-weight: 800; }
.cover-main p { opacity: .85; margin-top: 4px; }
.cover .btn-ghost { background: rgba(255,255,255,.95); color: var(--ink); border: 0; }

.tabs { display: flex; gap: 4px; margin: 18px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; padding: 10px 14px; margin-bottom: -1px;
  font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: rise .25s ease; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--sh); }
.kpi .due-ico { width: 42px; height: 42px; }
.kpi b { display: block; font-size: 19px; letter-spacing: -.02em; }
.kpi small { color: var(--muted); font-size: 12px; }

.infos { margin: 0; display: grid; grid-template-columns: auto 1fr; }
.infos dt, .infos dd { padding: 9px 0; border-top: 1px solid var(--line); margin: 0; }
.infos dt:first-of-type, .infos dd:first-of-type { border-top: 0; padding-top: 0; }
.infos dt { color: var(--muted); padding-right: 20px; }
.infos dd { text-align: right; font-weight: 600; }
.plate { display: inline-block; padding: 1px 8px; border: 1.5px solid var(--ink); border-radius: 5px; font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: .04em; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; padding-top: 0; }
.history-photo { width: 64px; height: 48px; border-radius: 8px; background: #1b1c20 center/cover no-repeat; }
.history b { display: block; }
.history small { color: var(--muted); font-size: 12px; }
.history .price { text-align: right; font-weight: 700; }
.history .price small { display: block; font-weight: 500; }

/* ---------- RTA ---------- */
.rta { display: grid; grid-template-columns: 220px minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.rta > *, .eclate > *, .dash-grid > * { min-width: 0; }
.rta-cats { padding: 16px 10px; position: sticky; top: 84px; }
.rta-cats .col-title { padding-left: 10px; }
.rta-cats ul, .rta-list ul, .ecl-tree ul { list-style: none; margin: 0; padding: 0; }
.rta-cat {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-weight: 500;
  transition: background .15s;
}
.rta-cat:hover { background: var(--bg); }
.rta-cat.active { background: var(--red-soft); color: var(--red); }
.rta-cat i svg { width: 16px; height: 16px; }
.rta-cat small { margin-left: auto; color: var(--muted); font-size: 12px; }
.rta-cat.active small { color: var(--red); }

.field-search { position: relative; margin-bottom: 14px; }
.field-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.field-search input { width: 100%; height: 38px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); outline: none; }
.field-search input:focus { background: var(--card); border-color: var(--ink-2); }

.proc {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center;
  padding: 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; transition: background .15s;
}
.proc:hover { background: var(--bg); }
.proc.active { background: var(--red-soft); }
.proc-photo { width: 64px; height: 48px; border-radius: 8px; background: #1b1c20 center/cover no-repeat; }
.proc b { display: block; font-size: 13px; line-height: 1.3; }
.proc small { color: var(--muted); font-size: 12px; display: flex; gap: 10px; margin-top: 2px; }
.diff { font-weight: 600; }
.diff-1 { color: var(--green); } .diff-2 { color: var(--orange); } .diff-3 { color: var(--red); }
.empty-state { padding: 30px 10px; text-align: center; color: var(--muted); }

.rta-doc { padding: 0; overflow: hidden; }
.doc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.doc-head b { font-size: 13px; }
.doc-head small { color: var(--muted); font-size: 12px; }
.doc-page { padding: 24px 28px 28px; }
.doc-page h2 { font-size: 22px; margin-bottom: 4px; }
.doc-meta { color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; }
.doc-photo { height: 210px; border-radius: 12px; margin: 18px 0; background: #1b1c20 center/cover no-repeat; }
.doc-page h3 { font-size: 14px; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.doc-page h3::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--red); }
.specs { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs td { padding: 9px 12px; border: 1px solid var(--line); }
.specs td:first-child { color: var(--ink-2); background: #fafbfc; width: 58%; }
.specs td:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tools span { padding: 4px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 500; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 12px 38px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
}
.warn { display: flex; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--orange-soft); border: 1px solid #fbd7b0; font-size: 13px; }
.warn i { color: var(--orange); }
.demo-note { margin-top: 18px; font-size: 11px; color: var(--muted); }

/* ---------- Pièces éclatées ---------- */
.eclate { display: grid; grid-template-columns: 210px 1fr 380px; gap: 16px; align-items: start; }
.ecl-tree { padding: 16px 10px; }
.ecl-tree .col-title { padding-left: 10px; }
.ecl-group > b { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; font-size: 13px; }
.ecl-group > b i svg { width: 15px; height: 15px; color: var(--muted); }
.ecl-item {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px 7px 33px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 13px; color: var(--ink-2);
}
.ecl-item:hover:not(:disabled) { background: var(--bg); }
.ecl-item.active { background: var(--red-soft); color: var(--red); font-weight: 600; }
.ecl-item:disabled { color: #b4b8c0; cursor: default; }
.ecl-item small { font-size: 11px; }

.ecl-view { position: relative; padding: 0; overflow: hidden; }
.ecl-tools { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.ecl-tools .icon-btn { width: 36px; height: 36px; }
.ecl-stage {
  height: 540px; cursor: grab; touch-action: none; overflow: hidden;
  background: #fff radial-gradient(#e5e7eb 1px, transparent 1px) 0 0 / 16px 16px;
}
.ecl-stage:active { cursor: grabbing; }
.ecl-stage svg { width: 100%; height: 100%; transition: transform .2s ease; }

.drawing { stroke: #1d1f24; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.drawing .f1 { fill: #ffffff; }
.drawing .f2 { fill: #f1f2f4; }
.drawing .f3 { fill: #dfe1e5; }
.drawing .nf { fill: none; }
.drawing .axis { fill: none; stroke: #9aa0aa; stroke-width: 1; stroke-dasharray: 6 4; }
.drawing .lead { fill: none; stroke: #6b7280; stroke-width: .9; }
.drawing g[data-part] { transition: opacity .2s; }
.drawing.focus g[data-part]:not(.on) { opacity: .28; }
.drawing g.on .f1, .drawing g.on .f2 { fill: #ffe3e4; }
.drawing g.on .f3 { fill: #fbc4c7; }
.drawing g.on { stroke: var(--red); }
.callout { cursor: pointer; }
.callout circle { fill: #fff; stroke: #1d1f24; stroke-width: 1.3; transition: fill .15s; }
.callout text { fill: #1d1f24; stroke: none; font: 700 11px var(--font); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.callout:hover circle, .callout.on circle { fill: var(--red); stroke: var(--red); }
.callout:hover text, .callout.on text { fill: #fff; }

.ecl-parts { padding: 16px 0 0; }
.ecl-parts .col-title { padding: 0 18px; }
.table-scroll { max-height: 440px; overflow-y: auto; }
.parts { width: 100%; border-collapse: collapse; font-size: 13px; }
.parts th { position: sticky; top: 0; background: #fafbfc; text-align: left; padding: 9px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); }
.parts td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.parts th:first-child, .parts td:first-child { padding-left: 18px; }
.parts th:last-child, .parts td:last-child { padding-right: 18px; }
.parts .r { text-align: right; }
.parts tbody tr { cursor: pointer; transition: background .15s; }
.parts tbody tr:hover { background: var(--bg); }
.parts tbody tr.on { background: var(--red-soft); }
.parts .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.3px solid var(--ink); font-size: 11px; font-weight: 700; }
.parts tr.on .num { background: var(--red); border-color: var(--red); color: #fff; }
.parts .ref { font-family: ui-monospace, monospace; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.parts small { display: block; color: var(--muted); }
.ecl-total { display: flex; justify-content: space-between; padding: 14px 18px; font-weight: 600; }
.ecl-total b { font-size: 16px; }

/* ---------- Dépenses ---------- */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; max-width: 28px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 2px 2px; overflow: hidden; height: 0; transition: height .7s cubic-bezier(.2, .8, .2, 1); }
.bar-stack span { display: block; }
.bar small { font-size: 11px; color: var(--muted); }
.cat-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.cat-bars .row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.cat-bars .row b { font-weight: 600; }
.track { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.track span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--red); transition: width .7s ease; }

/* ---------- Documents ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.doc { display: flex; gap: 12px; align-items: center; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.doc .due-ico { width: 44px; height: 44px; font-size: 11px; font-weight: 800; }
.doc b { display: block; font-size: 14px; }
.doc small { color: var(--muted); font-size: 12px; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 9, 11, .55); backdrop-filter: blur(3px); }
.modal.open { display: flex; animation: rise .2s ease; }
.modal-box { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border-radius: 18px; box-shadow: var(--sh-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; }
.modal-head .icon-btn { width: 36px; height: 36px; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); outline: none; width: 100%; }
.field input[type="file"] { padding: 9px 12px; }
.field input:focus, .field select:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(17, 18, 22, .06); }
.field-row { display: flex; gap: 12px; }
.type-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pick input { position: absolute; opacity: 0; }
.type-pick span { display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.type-pick input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red); }

.segmented { display: inline-flex; padding: 3px; background: #eceef1; border-radius: 10px; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: var(--sh); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 200;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--sh-lg);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast i { color: #4ade80; }

.bottom-nav { display: none; }

/* =========================================================
   Responsive
   ========================================================= */

/* Grand écran intermédiaire */
@media (max-width: 1360px) {
  .eclate { grid-template-columns: 200px 1fr; }
  .ecl-parts { grid-column: 1 / -1; }
  .rta { grid-template-columns: 200px 300px 1fr; }
}

/* Tablette : sidebar réduite aux icônes */
@media (max-width: 1100px) {
  :root { --side-w: 76px; }
  .sidebar { padding: 22px 12px; align-items: center; }
  .sidebar .logo { font-size: 0; margin: 0 0 26px; width: 44px; height: 30px; }
  .sidebar .logo::after { content: "M"; font-size: 24px; color: #fff; position: absolute; left: 13px; top: 6px; }
  .sidebar .logo-swoosh { width: 44px; left: 0; }
  .nav a span, .nav-sub span, .user div { display: none; }
  .nav a, .nav-sub { justify-content: center; padding: 12px; }
  .user { padding: 12px 0 0; justify-content: center; }
  .interventions { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .rta { grid-template-columns: 1fr 1.4fr; }
  .rta-cats { grid-column: 1 / -1; position: static; }
  .rta-cats ul { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .rta-cats ul::-webkit-scrollbar { display: none; }
  .rta-cat { white-space: nowrap; border: 1px solid var(--line); }
  .rta-cat small { margin-left: 4px; }
  .eclate { grid-template-columns: 1fr; }
  .ecl-tree ul { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .ecl-group > b { display: none; }
  .ecl-group { display: contents; }
  .ecl-item { white-space: nowrap; padding: 7px 12px; border: 1px solid var(--line); width: auto; gap: 6px; }
}

/* Mobile */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

  .topbar { gap: 10px; padding: 12px 0; flex-wrap: wrap; }
  .logo-mobile { display: inline-flex; color: var(--ink); font-size: 22px; margin-right: auto; }
  .avatar-mobile { display: grid; width: 38px; height: 38px; }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .btn-add { display: none; }

  .greeting { display: block; margin: 4px 0 14px; }
  .greeting h1 { font-size: 22px; }
  .greeting p { color: var(--muted); }
  .hero { display: none; }
  .mobile-only { display: flex; margin-top: 16px; }

  .vehicle-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; gap: 12px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .vehicle-row::-webkit-scrollbar { display: none; }
  .vehicle-row > * { flex: 0 0 82%; scroll-snap-align: start; }
  .vcard { grid-template-columns: 1fr; }
  .vcard-photo { min-height: 150px; }

  .dash-grid { grid-template-columns: 1fr; gap: 14px; }
  .panel { padding: 16px; }
  .shortcut { padding: 14px 4px; }
  .shortcut small { display: none; }

  .interventions { display: flex; overflow-x: auto; gap: 12px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .interventions::-webkit-scrollbar { display: none; }
  .icard { flex: 0 0 62%; }

  .page-head h1 { font-size: 22px; }
  .page-head .btn { width: 100%; }
  .cover { height: 200px; padding: 18px; border-radius: 16px; }
  .cover-main h1 { font-size: 24px; }
  .cover .btn { display: none; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi .due-ico { width: 36px; height: 36px; }
  .kpi b { font-size: 16px; }
  .history li { grid-template-columns: 52px 1fr; }
  .history .price { grid-column: 2; text-align: left; }
  .history-photo { width: 52px; height: 42px; }

  .rta { grid-template-columns: 1fr; }
  .doc-page { padding: 18px; }
  .doc-photo { height: 170px; }
  .ecl-stage { height: 360px; }
  .ecl-tools { top: auto; bottom: 10px; flex-direction: row; }
  .garage { grid-template-columns: 1fr; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 4px 0; }
  .bottom-nav a i svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--red); }

  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 20px 20px 0 0; max-height: 92vh; }
  .field-row { flex-direction: column; }
  .toast { bottom: 96px; }
}
