/* C&G Motors OS — style simple, gros boutons, lisible sur téléphone */
:root {
  --bg: #f3f4f6; --card: #fff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --side: #0b0c0f; --blue: #1d4ed8; --blue-soft: #e0e7ff; --red: #dc2626; --red-soft: #fee2e2;
  --green: #15803d; --green-soft: #dcfce7; --amber: #b45309; --amber-soft: #fef3c7;
  --violet: #6d28d9; --violet-soft: #ede9fe; --slate: #334155; --slate-soft: #e2e8f0;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 10px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 1.6rem; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── mise en page */
.layout { display: flex; min-height: 100vh; }
.side { width: 240px; background: var(--side); color: #e5e7eb; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 14px 12px; }
.side .logo img { width: 100%; border-radius: 10px; display: block; margin-bottom: 14px; }
.side nav a { display: flex; align-items: center; gap: 12px; color: #d1d5db; padding: 12px 12px; border-radius: 10px; font-weight: 600; margin-bottom: 2px; }
.side nav a:hover { background: #1f2937; color: #fff; }
.side nav a.on { background: #fff; color: var(--ink); }
.side .who { margin-top: auto; padding: 10px 12px; font-size: .9rem; color: #9ca3af; display: flex; justify-content: space-between; align-items: center; }
.side .who button { background: none; border: 0; color: #9ca3af; cursor: pointer; padding: 4px; }
main { flex: 1; margin-left: 240px; padding: 26px 30px 60px; max-width: 1280px; }
.topbar, .bottom { display: none; }

@media (max-width: 900px) {
  .layout { display: block; }
  .side { display: none; }
  .stat { padding: 13px 14px; }
  .stat b { font-size: 1.3rem; }
  main { margin-left: 0; padding: 14px 12px 100px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--side); padding: 6px 12px; position: sticky; top: 0; z-index: 10; }
  .topbar img { height: 40px; border-radius: 6px; }
  .topbar span { color: #9ca3af; font-size: .9rem; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; color: var(--muted); font-size: .72rem; font-weight: 600; }
  .bottom a.on { color: var(--blue); }
  h1 { font-size: 1.35rem; }
}

/* ── éléments */
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 0;
  background: var(--blue); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.08); }
.btn.big { min-height: 58px; font-size: 1.08rem; padding: 0 26px; }
.btn.full { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.dark { background: var(--ink); }
.btn.green { background: var(--green); }
.btn.red { background: #fff; color: var(--red); border: 1.5px solid #fecaca; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: 10px; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 6px; text-decoration: underline; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { background: var(--bg); color: var(--red); }

.flash { padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; background: var(--green-soft); color: #14532d; }
.flash.error { background: var(--red-soft); color: #7f1d1d; }

/* formulaires */
form.stack > * + * { margin-top: 12px; }
label { display: block; font-weight: 600; font-size: .92rem; }
label .hint { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; margin-top: 5px; font: inherit; font-size: 16px; padding: 12px 13px; border: 1.5px solid #d1d5db; border-radius: 11px; background: #fff; color: var(--ink); min-height: 48px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--blue-soft); border-color: var(--blue); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .fields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0; }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .choice { grid-template-columns: 1fr; } }
.choice label { border: 1.5px solid #d1d5db; border-radius: 12px; padding: 14px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 600; background: #fff; }
.choice label:has(input:checked) { border-color: var(--blue); background: #eff6ff; }
.choice small { display: block; font-weight: 400; color: var(--muted); }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--blue); padding: 8px 0; }

/* badges & étapes */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.s-achete { background: var(--slate-soft); color: var(--slate); }
.s-preparation { background: var(--amber-soft); color: var(--amber); }
.s-en_vente { background: var(--blue-soft); color: var(--blue); }
.s-reserve { background: var(--violet-soft); color: var(--violet); }
.s-vendu { background: var(--green-soft); color: var(--green); }
.s-repere { background: var(--slate-soft); color: var(--slate); }
.s-contacte { background: var(--amber-soft); color: var(--amber); }
.s-offre { background: var(--blue-soft); color: var(--blue); }
.s-abandon { background: #f3f4f6; color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0 16px; }
.steps div { text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); padding-top: 10px; border-top: 5px solid var(--line); }
.steps div.done { border-color: var(--green); color: var(--green); }
.steps div.now { border-color: var(--blue); color: var(--blue); }

/* tableau de bord */
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat b { display: block; font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .88rem; font-weight: 600; }
.stat.good b { color: var(--green); }
.stat.bad b { color: var(--red); }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }
.col { background: #e9ebef; border-radius: var(--radius); padding: 10px; min-height: 90px; }
.col h3 { display: flex; justify-content: space-between; padding: 2px 4px 8px; font-size: .92rem; }
.col .empty { color: var(--muted); font-size: .85rem; padding: 4px; }

.vcard { display: flex; gap: 12px; background: #fff; border-radius: 12px; padding: 10px; color: var(--ink); box-shadow: var(--shadow); margin-bottom: 8px; align-items: center; }
.vcard:hover { outline: 2px solid var(--blue-soft); }
.vcard .ph { width: 74px; height: 56px; border-radius: 8px; background: #e5e7eb center/cover no-repeat; flex: none; display: grid; place-items: center; color: #9ca3af; overflow: hidden; }
.vcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.vcard .t { font-weight: 700; line-height: 1.25; }
.vcard .m { color: var(--muted); font-size: .84rem; }
.vcard .warn { color: var(--amber); font-size: .8rem; font-weight: 700; }

.vlist { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.vlist .vcard { margin: 0; }
.vlist .vcard .ph { width: 96px; height: 72px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tabs a { white-space: nowrap; padding: 9px 15px; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; font-size: .92rem; border: 1.5px solid var(--line); }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input { margin: 0; }

/* fiche véhicule */
.money { display: grid; gap: 8px; }
.money div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.money div.total { border: 0; font-size: 1.15rem; font-weight: 800; padding-top: 10px; }
.money .pos { color: var(--green); }
.money .neg { color: var(--red); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.alerts { background: var(--amber-soft); color: #78350f; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.alerts ul { margin: 6px 0 0; padding-left: 20px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; background: #e5e7eb; }
.gallery figcaption { font-size: .75rem; color: var(--muted); margin-top: 3px; display: flex; justify-content: space-between; align-items: center; }
.doclist a.doc { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.upload { border: 2px dashed #cbd5e1; border-radius: 14px; padding: 16px; background: #f8fafc; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }

.todo { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.todo form { margin: 0; }
.todo .tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; cursor: pointer; display: grid; place-items: center; color: transparent; padding: 0; }
.todo .tick:hover { border-color: var(--green); color: var(--green); }
.todo.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.todo.done .txt { text-decoration: line-through; color: var(--muted); }
.todo .txt { flex: 1; }
.feed { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.feed li { padding: 6px 0; border-bottom: 1px solid var(--line); }

.login { max-width: 440px; margin: 6vh auto; padding: 0 14px; }
.login .logo { width: 100%; border-radius: 16px; display: block; margin-bottom: 20px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who-pick label { border: 2px solid #d1d5db; border-radius: 14px; padding: 18px 10px; text-align: center; font-size: 1.15rem; cursor: pointer; background: #fff; }
.who-pick input { position: absolute; opacity: 0; pointer-events: none; }
.who-pick label:has(input:checked) { border-color: var(--blue); background: #eff6ff; color: var(--blue); }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-grid a { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 14px; color: var(--ink); font-weight: 700; display: flex; flex-direction: column; gap: 8px; }

@media print {
  .side, .topbar, .bottom, .noprint, .flash { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; font-size: 11px; }
  .card { box-shadow: none; padding: 0; }
  table.list td, table.list th { padding: 4px; }
}
