:root {
  --jaune: #f5c518; --jaune-soft: #fff7d6; --cyan: #19b4d6;
  --bg: #f2f3f6;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --ink: #141a26;
  --muted: #6d6a63;
  --line: #dfe3ea;
  --line-2: #c5ccd8;
  --side: #15213a;
  --side-ink: #c9d2e3;
  --accent: #1c64d1;
  --accent-dark: #154ea6;
  --accent-soft: #e8f0fc;
  --blue: #1971c2; --blue-soft: #e7f1fb;
  --green: #2f7d4f; --green-soft: #e8f5ec;
  --yellow: #b7791f; --yellow-soft: #fdf6e3;
  --red: #c92a2a; --red-soft: #fdecec;
  --violet: #6741d9; --violet-soft: #f0ecfd;
  --gray-soft: #eceff4;
  --radius: 8px;
  --cond: 'Chakra Petch', 'Arial Narrow', sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --tap: 46px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-text-size-adjust: 100%; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 1.1em; height: 1.1em; display: inline-block; vertical-align: -0.18em; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* Structure */
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 16px; border-bottom: 1px solid #2a3650; }
.side .mark { width: 36px; height: 36px; background: var(--jaune); color: var(--ink); display: grid; place-items: center; border-radius: 4px; transform: rotate(-3deg); }
.side .mark .icon { width: 1.3em; height: 1.3em; stroke-width: 2.4; }
.side .gname { font: 800 1.15rem/1.05 var(--cond); text-transform: uppercase; color: #fff; letter-spacing: .02em; }
.side .gname small { display: block; font: 500 .72rem var(--body); color: #8c9ab5; text-transform: none; letter-spacing: 0; }
.side nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 6px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: #223050; color: #fff; }
.side nav a.active { background: var(--accent); color: #fff; }
.side nav a .count { margin-left: auto; background: #fff; color: var(--ink); font: 700 .72rem/1 var(--body); padding: 3px 6px; border-radius: 10px; }
.side nav a.active .count { color: var(--accent-dark); }
.side nav .sep { height: 1px; background: #2a3650; margin: 8px 6px; }
.side .me { padding: 12px 16px; border-top: 1px solid #2a3650; font-size: .85rem; display: flex; align-items: center; gap: 10px; }
.side .me .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; }
.side .me button { margin-left: auto; background: none; border: 1px solid #3a4a6a; color: var(--side-ink); border-radius: 5px; padding: 5px 8px; cursor: pointer; font-size: .78rem; }

main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
.topbar h1 { font: 800 1.55rem/1 var(--cond); text-transform: uppercase; margin: 0; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .search { margin-left: auto; position: relative; width: min(360px, 40vw); }
.topbar .search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel-2); }
.topbar .search .icon { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.14); max-height: 420px; overflow-y: auto; z-index: 30; }
.search-results a { display: block; padding: 10px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.hl { background: var(--accent-soft); }
.search-results small { display: block; color: var(--muted); }
.content { padding: 22px 24px 90px; max-width: 1400px; width: 100%; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--panel); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: #a9b3c4; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: .85rem; }
.btn.lg { min-height: 54px; padding: 12px 20px; font-size: 1.05rem; }
.btn.icon-only { padding: 8px; min-width: 40px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Panneaux */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.grid-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font: 800 1.15rem/1 var(--cond); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.panel-h .count { background: var(--gray-soft); color: var(--muted); font: 700 .75rem/1 var(--body); padding: 4px 7px; border-radius: 10px; }
.panel-h .count.hot { background: var(--accent); color: #fff; }
.panel-h .actions { margin-left: auto; display: flex; gap: 6px; }
.panel-b { padding: 14px 16px; }
.panel-b.flush { padding: 0; }
.empty { padding: 22px 16px; color: var(--muted); text-align: center; font-size: .92rem; }

/* Listes */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows > li.click { cursor: pointer; }
.rows > li.click:hover { background: var(--panel-2); }
.rows .main { flex: 1; min-width: 0; }
.rows .t { font-weight: 600; }
.rows .s { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.rows .time { font: 600 .95rem var(--mono); min-width: 54px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font: 700 .78rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--panel-2); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* Pastilles de statut */
.chip { display: inline-flex; align-items: center; gap: 5px; font: 600 .78rem/1 var(--body); padding: 5px 9px; border-radius: 20px; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.chip.soumission { background: var(--violet-soft); color: var(--violet); }
.chip.approuve { background: var(--blue-soft); color: var(--blue); }
.chip.en_cours { background: var(--accent-soft); color: var(--accent-dark); }
.chip.attente_pieces { background: var(--yellow-soft); color: var(--yellow); }
.chip.pret { background: var(--green-soft); color: var(--green); }
.chip.facture { background: #fff4e6; color: #a35200; }
.chip.paye { background: var(--gray-soft); color: #4d4a44; }
.chip.annule { background: var(--red-soft); color: var(--red); text-decoration: line-through; }
.chip.demande { background: var(--accent); color: #fff; }
.chip.web { background: var(--blue-soft); color: var(--blue); }
.chip.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters button { border: 1px solid var(--line-2); background: var(--panel); padding: 7px 13px; border-radius: 20px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters button .n { font-weight: 500; opacity: .7; margin-left: 3px; }
.filters input { margin-left: auto; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 6px; min-width: 220px; }

/* Cartes de travail (atelier) */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; padding: 14px; }
.job { border: 1px solid var(--line); border-left: 5px solid var(--line-2); border-radius: 6px; padding: 12px 13px; background: var(--panel); cursor: pointer; }
.job:hover { box-shadow: 0 3px 12px rgba(0,0,0,.07); }
.job.en_cours { border-left-color: var(--accent); }
.job.attente_pieces { border-left-color: var(--yellow); }
.job.approuve { border-left-color: var(--blue); }
.job.pret { border-left-color: var(--green); }
.job.soumission { border-left-color: var(--violet); }
.job .veh { font: 700 1.12rem/1.15 var(--cond); text-transform: uppercase; letter-spacing: .02em; }
.job .who { font-size: .88rem; color: var(--muted); margin: 2px 0 8px; }
.job .what { font-size: .9rem; margin-bottom: 9px; }
.job .foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.av-s { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font: 700 .7rem var(--body); }

/* Agenda */
.ag-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.ag-head h2 { font: 800 1.45rem/1 var(--cond); text-transform: uppercase; margin: 0 8px; min-width: 230px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 8px 14px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--ink); color: #fff; }
.ag-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.ag { display: grid; position: relative; min-width: 560px; }
.ag .col-h { position: sticky; top: 0; z-index: 3; background: var(--panel-2); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 10px; font: 700 1rem/1.1 var(--cond); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.ag .col-h small { display: block; font: 500 .75rem var(--body); text-transform: none; letter-spacing: 0; color: var(--muted); }
.ag .col-h.today { color: var(--accent-dark); }
.ag .gutter { border-right: 1px solid var(--line); }
.ag .hour { height: 64px; font: 500 .75rem var(--mono); color: var(--muted); text-align: right; padding: 2px 8px 0 0; border-top: 1px solid var(--line); }
.ag .col { position: relative; border-left: 1px solid var(--line); }
.ag .slot { height: 32px; border-top: 1px solid var(--line); cursor: pointer; }
.ag .slot:nth-child(even) { border-top-style: dashed; border-top-color: #edf0f5; }
.ag .slot:hover { background: var(--accent-soft); }
.ag .closed { background: repeating-linear-gradient(135deg, transparent 0 6px, #eef1f6 6px 12px); }
.ag .now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.ag .now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 5px; padding: 5px 7px; font-size: .8rem; line-height: 1.25; overflow: hidden; cursor: pointer; z-index: 1;
  background: var(--blue-soft); border-left: 4px solid var(--blue); color: var(--ink); }
.appt:hover { z-index: 4; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.appt b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .s { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.demande { background: repeating-linear-gradient(135deg, #fff 0 7px, var(--accent-soft) 7px 14px); border: 1.5px dashed var(--accent); border-left: 4px solid var(--accent); }
.appt.arrive { box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.appt.termine { opacity: .55; }
.appt.annule { opacity: .4; text-decoration: line-through; }
.appt .tag { position: absolute; top: 4px; right: 5px; font: 700 .62rem/1 var(--body); text-transform: uppercase; letter-spacing: .04em; padding: 3px 5px; border-radius: 3px; background: rgba(255,255,255,.85); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 10px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Bon de travail */
.wo-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.wo-head .veh { font: 800 1.9rem/1 var(--cond); text-transform: uppercase; letter-spacing: .01em; margin: 4px 0; }
.wo-head .meta { color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; }
.wo-head .meta b { color: var(--ink); font-weight: 600; }
.wo-num { font: 600 .9rem var(--mono); color: var(--muted); }
.flow { display: flex; gap: 0; margin-bottom: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.flow div { flex: 1; text-align: center; padding: 9px 4px; font: 700 .82rem/1.15 var(--cond); text-transform: uppercase; letter-spacing: .04em; color: #9aa3b5; border-right: 1px solid var(--line); position: relative; }
.flow div:last-child { border-right: 0; }
.flow div.done { color: var(--ink); background: var(--panel-2); }
.flow div.on { background: var(--ink); color: #fff; }
.next-step { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; background: var(--accent-soft); border: 1px solid #f8cfb3; border-radius: var(--radius); margin-bottom: 18px; }
.next-step .txt { flex: 1; min-width: 200px; }
.next-step .txt b { display: block; font-size: 1.02rem; }
.next-step.green { background: var(--green-soft); border-color: #bfe3cb; }
.next-step.violet { background: var(--violet-soft); border-color: #d6ccf9; }
.next-step.gray { background: var(--panel-2); border-color: var(--line); }
.lines td { vertical-align: top; }
.lines td.c-desc { min-width: 220px; }
.sm-only { display: none; }
.lines .kind { font: 700 .7rem/1 var(--body); text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; border-radius: 3px; display: inline-block; }
.lines .kind.main_oeuvre, .lines .kind.service { background: var(--blue-soft); color: var(--blue); }
.lines .kind.piece { background: var(--gray-soft); color: #4d4a44; }
.lines .kind.frais { background: var(--yellow-soft); color: var(--yellow); }
.lines .cond { font-size: .75rem; font-weight: 600; color: var(--yellow); margin-left: 6px; }
.lines tr.done-line .desc { text-decoration: line-through; color: var(--muted); }
.check { width: 26px; height: 26px; border: 2px solid var(--line-2); border-radius: 5px; background: #fff; cursor: pointer; display: grid; place-items: center; color: #fff; }
.check.on { background: var(--green); border-color: var(--green); }
.totals { margin-left: auto; width: min(360px, 100%); font-family: var(--mono); font-size: .92rem; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .big { font-size: 1.15rem; font-weight: 700; border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 9px; }
.totals .owner { color: var(--muted); font-size: .82rem; border-top: 1px dashed var(--line-2); margin-top: 6px; padding-top: 8px; }
.add-line { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel-2); }
.notify { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.notify .btn { flex-direction: column; min-height: 72px; gap: 4px; font-size: .9rem; }
.notify .btn .icon { width: 1.5em; height: 1.5em; }
.notify .btn.pref { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.notify .btn small { font-weight: 500; font-size: .7rem; color: var(--green); }
.log { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.log li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.log li:last-child { border-bottom: 0; }
.log .when { color: var(--muted); font-family: var(--mono); font-size: .78rem; white-space: nowrap; min-width: 92px; }

/* Formulaires */
.field { margin-bottom: 13px; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.in, select.in, textarea.in { width: 100%; padding: 10px 11px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; min-height: 42px; }
.in:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea.in { resize: vertical; min-height: 70px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.money-in { position: relative; }
.money-in input { padding-right: 28px; text-align: right; font-family: var(--mono); }
.money-in::after { content: '$'; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.radio-cards label { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px; cursor: pointer; text-align: center; font-weight: 600; font-size: .9rem; margin: 0; }
.radio-cards input { display: none; }
.radio-cards input:checked + span { color: var(--accent-dark); }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.days-pick { display: flex; gap: 4px; }
.days-pick label { width: 38px; height: 38px; border: 1px solid var(--line-2); border-radius: 6px; display: grid; place-items: center; cursor: pointer; font-weight: 600; margin: 0; }
.days-pick input { display: none; }
.days-pick label:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 42px; height: 24px; appearance: none; background: var(--line-2); border-radius: 12px; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 21px; }

/* Sélecteur de client */
.picker { position: relative; }
.picker .opts { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 260px; overflow-y: auto; z-index: 60; }
.picker .opts div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker .opts div:hover { background: var(--accent-soft); }
.picker .opts small { display: block; color: var(--muted); }
.picked { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 6px; }
.picked .main { flex: 1; }

/* Fenêtre modale */
.modal-bg { position: fixed; inset: 0; background: rgba(20,20,22,.5); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 10px; width: min(560px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(820px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font: 800 1.35rem/1.05 var(--cond); text-transform: uppercase; margin: 0; flex: 1; }
.modal-b { padding: 16px 18px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 10px 10px; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.msg-preview { background: #e9f5ec; border-radius: 14px 14px 14px 4px; padding: 12px 14px; font-size: .95rem; white-space: pre-wrap; }

.toast-box { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; animation: toast-in .2s ease-out; max-width: 90vw; }
.toast.err { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Notes de maquette */
.note-maquette { background: #e7f0fd; border: 1.5px dashed #1c64d1; color: #0f3d82; padding: 9px 12px 9px 36px; margin: 0 0 14px; font: 500 .86rem/1.45 var(--body); position: relative; border-radius: 6px; }
.note-maquette::before { content: 'i'; position: absolute; left: 10px; top: 9px; width: 17px; height: 17px; border-radius: 50%; background: #1c64d1; color: #fff; font: 700 .75rem/17px Georgia, serif; text-align: center; }
body.notes-off .note-maquette { display: none !important; }
#notes-toggle { position: fixed; right: 14px; bottom: 14px; z-index: 70; background: #1c64d1; color: #fff; border: 0; padding: 9px 13px; font: 600 .8rem var(--body); cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.25); border-radius: 6px; }
body.notes-off #notes-toggle { background: #555; }


.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { font: 700 .76rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi .v { font: 700 1.55rem/1.2 var(--mono); margin-top: 4px; }
.kpi .v.sm { font-size: 1.15rem; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* Cell : barre d'onglets en bas, gros boutons */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 1.3rem; }
  .topbar .search { width: auto; flex: 1; max-width: none; }
  .topbar .search input { min-height: 42px; }
  .content { padding: 14px 12px 100px; }
  .grid-2, .grid-2-eq { grid-template-columns: 1fr; }
  .row-3, .row-4 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .btn { min-height: var(--tap); }
  .btn.sm { min-height: 38px; }
  .jobs { grid-template-columns: 1fr; padding: 10px; }
  .job { padding: 14px; }
  .job .veh { font-size: 1.25rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--side); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { color: var(--side-ink); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: .72rem; font-weight: 600; position: relative; }
  .bottom-nav a .icon { width: 1.55em; height: 1.55em; }
  .bottom-nav a.active { color: #fff; background: #223050; box-shadow: inset 0 3px 0 var(--accent); }
  .bottom-nav a .count { position: absolute; top: 4px; right: calc(50% - 22px); background: var(--accent); color: #fff; font: 700 .65rem/1 var(--body); padding: 3px 5px; border-radius: 9px; }
  .filters input { min-width: 0; width: 100%; margin-left: 0; order: -1; min-height: 44px; }
  .notify .btn { min-height: 78px; }
  table.data.stack-sm thead { display: none; }
  table.data.stack-sm tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.data.stack-sm td { display: flex; justify-content: space-between; border: 0; padding: 4px 12px; }
  table.data.stack-sm td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .85rem; margin-right: 12px; font-family: var(--body); }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; }
  .modal-f { position: sticky; bottom: 0; border-radius: 0; }
  .modal-f .btn { flex: 1; }
  .rack { grid-template-columns: 1fr 1fr; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { flex: 1; min-width: 0; }
  .topbar .search { order: 3; flex-basis: 100%; }
  #new-btn .lbl { display: none; }
  #new-btn { min-width: 46px; padding: 8px 12px; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 38px 1fr auto; grid-template-areas: "check desc total" "check qty act"; column-gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.data.lines td { border: 0; padding: 0; min-width: 0 !important; }
  table.data.lines td.c-qty, table.data.lines td.c-act { padding-top: 4px; }
  .lines .c-check { grid-area: check; }
  .lines .c-desc { grid-area: desc; }
  .lines .c-total { grid-area: total; }
  .lines .c-qty { grid-area: qty; text-align: left; color: var(--muted); font-size: .85rem; }
  .lines .c-act { grid-area: act; text-align: right; }
  .lines .c-kind, .lines .c-price, .lines .c-cost { display: none; }
  .lines .sm-only { display: inline; }
  table.lines, table.lines tbody { display: block; }
  .wo-head .veh { font-size: 1.55rem; }
  .flow div { font-size: .66rem; padding: 8px 2px; }
  .ag { min-width: 0; --ag-col: 112px; --ag-gutter: 40px; }
  .ag .hour { font-size: .68rem; padding-right: 4px; }
  .appt { font-size: .74rem; padding: 4px 5px; }
  .ag-head h2 { min-width: 0; font-size: 1.2rem; order: -1; width: 100%; margin: 0 0 4px; }
  #notes-toggle { bottom: 74px; }
}
@media print {
  .side, .topbar, .bottom-nav, #notes-toggle, .note-maquette { display: none !important; }
  .layout { display: block; }
}

/* Inventaire */
.stock-grid td.loc { font-family: var(--mono); text-align: center; white-space: nowrap; }
.stock-grid td.loc.zero { color: #c5ccd8; }
.stock-grid td.low, .low-pill { color: var(--red); font-weight: 700; }
.low-pill { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; background: var(--red-soft); padding: 3px 7px; border-radius: 10px; }
.cat-h td { background: var(--panel-2); font: 700 .8rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 12px !important; }
.loc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.loc-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.loc-card .ic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.loc-card .ic.entrepot { background: var(--jaune-soft); color: #9a6b00; }
.loc-card b { display: block; }
.loc-card small { color: var(--muted); }

/* Courriel */
.mail { display: grid; grid-template-columns: 190px 1fr; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 70vh; overflow: hidden; }
.mail-side { border-right: 1px solid var(--line); padding: 12px 8px; background: var(--panel-2); }
.mail-side a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; }
.mail-side a.on { background: var(--accent); color: #fff; }
.mail-side a .count { margin-left: auto; font: 700 .72rem/1 var(--body); background: var(--jaune); color: var(--ink); padding: 3px 6px; border-radius: 10px; }
.mail-side a.on .count { background: #fff; }
.mail-main { min-width: 0; display: flex; flex-direction: column; }
.mail-tools { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mail-tools input { flex: 1; min-width: 160px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: 6px; }
.mail-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.mail-list li { display: grid; grid-template-columns: 26px 190px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-list li:hover { background: var(--panel-2); }
.mail-list li.unread { background: #fff; }
.mail-list li.unread .from, .mail-list li.unread .subj { font-weight: 800; }
.mail-list .from { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-list .subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-list .subj span { color: var(--muted); font-weight: 400; }
.mail-list .when { color: var(--muted); font: 500 .78rem var(--mono); white-space: nowrap; }
.mail-list .star { color: #c5ccd8; cursor: pointer; }
.mail-list .star.on { color: #e9b400; }
.mail-read { padding: 18px 22px; }
.mail-read h2 { font: 700 1.3rem/1.2 var(--body); margin: 0 0 10px; }
.mail-read .meta { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: 16px; flex-wrap: wrap; }
.mail-read .body { white-space: pre-wrap; line-height: 1.55; font-size: .97rem; max-width: 760px; }
.kind-tag { font: 700 .68rem/1 var(--body); text-transform: uppercase; letter-spacing: .05em; padding: 3px 6px; border-radius: 3px; background: var(--gray-soft); color: var(--muted); }
.kind-tag.formulaire { background: var(--jaune-soft); color: #8a5a00; }
.kind-tag.rdv { background: var(--accent-soft); color: var(--accent-dark); }
.kind-tag.fournisseur { background: var(--violet-soft); color: var(--violet); }
.kind-tag.systeme { background: var(--green-soft); color: var(--green); }
.demo-ribbon { background: var(--jaune-soft); border-bottom: 1px solid #f0dd8a; color: #6b4d00; padding: 7px 14px; font-size: .84rem; font-weight: 600; }
.ag .col-h .av-s { vertical-align: middle; margin-right: 4px; }
.ag .col-h.ok { color: var(--ink); }
.appt .who-dot { position: absolute; top: 5px; right: 6px; width: 10px; height: 10px; border-radius: 50%; }
.appt.en_route { box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.appt.refuse { opacity: .35; text-decoration: line-through; }
.chip.termine { background: var(--green-soft); color: var(--green); }
.chip.confirme { background: var(--blue-soft); color: var(--blue); }
.chip.en_route { background: var(--jaune-soft); color: #8a5a00; }
.chip.nouvelle { background: var(--jaune); color: var(--ink); }
.chip.traitee { background: var(--gray-soft); color: var(--muted); }
.chip.zyko { background: #fdebd3; color: #9a5300; }
.chip.mt { background: var(--blue-soft); color: var(--blue); }
.brand-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); vertical-align: middle; margin-right: 5px; }
.brand-dot.zyko { background: #e8912a; }
.job.termine { border-left-color: var(--green); }
.job.facture { border-left-color: #a35200; }
.lines .kind.deplacement { background: var(--green-soft); color: var(--green); }
@media (max-width: 900px) {
  .mail { grid-template-columns: 1fr; }
  .mail-side { display: flex; overflow-x: auto; gap: 4px; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mail-side a { white-space: nowrap; padding: 8px 10px; }
  .mail-list li { grid-template-columns: 22px 1fr auto; }
  .mail-list .subj { grid-column: 2 / span 2; }
  .loc-cards { grid-template-columns: 1fr 1fr; }
}

html.prod .note-maquette, html.prod #notes-toggle { display: none !important; }
