/* =====================================================================
   GestConvoi — Feuille de style
   Pensée pour de longues sessions : contrastes doux, pas de blanc pur
   en mode sombre, espacements généreux, mode compact disponible.
   ===================================================================== */

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --sidebar: #fbfbfc;
  --border: #e3e6eb;
  --border-strong: #d2d7de;
  --text: #1c2330;
  --text-2: #546072;
  --muted: #8a94a4;

  --accent: #1d6f80;
  --accent-hover: #175c6b;
  --accent-soft: #e3f1f3;
  --accent-text: #155766;

  --success: #2b8a5e; --success-soft: #e3f4ea;
  --warning: #b9770e; --warning-soft: #fbf0dc;
  --danger:  #c94141; --danger-soft:  #fbe6e6;
  --info:    #2f6fc4; --info-soft:    #e4eefb;
  --violet:  #6d55c9; --violet-soft:  #eee9fb;

  --c1: #1d6f80; --c2: #e0913a; --c3: #6d55c9; --c4: #2b8a5e; --c5: #c94141; --c6: #3f8fd2; --c7: #b5568c; --c8: #8a94a4;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
  --pad: 20px;
  --row: 12px;
  --sb-w: 248px;
  --top-h: 60px;
}

[data-theme="dark"] {
  --bg: #0f1318;
  --surface: #161b22;
  --surface-2: #1a2028;
  --surface-3: #212833;
  --sidebar: #12161c;
  --border: #252d38;
  --border-strong: #323c49;
  --text: #dde3ea;
  --text-2: #a2adbb;
  --muted: #6f7b8b;

  --accent: #4aa9bb;
  --accent-hover: #63bccd;
  --accent-soft: #17323a;
  --accent-text: #7cc6d4;

  --success: #4cb784; --success-soft: #16302a;
  --warning: #e0a443; --warning-soft: #362a16;
  --danger:  #e46a6a; --danger-soft:  #3a1d20;
  --info:    #6aa4ec; --info-soft:    #182a42;
  --violet:  #a08ced; --violet-soft:  #272044;

  --c1: #4aa9bb; --c2: #e8a456; --c3: #a08ced; --c4: #4cb784; --c5: #e46a6a; --c6: #6aa4ec; --c7: #d77fb0; --c8: #7b8798;

  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.45);
}

[data-density="compact"] { --pad: 14px; --row: 7px; }
html[data-fontsize="sm"] { font-size: 13.5px; }
html, html[data-fontsize="md"] { font-size: 14.5px; }
html[data-fontsize="lg"] { font-size: 16px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
kbd { font-family: var(--mono); font-size: .72rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }
.ico { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .86rem; }
.mono { font-family: var(--mono); font-size: .92em; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.warn { color: var(--warning); }
.strong { font-weight: 650; }
.mt { margin-top: var(--pad); }
.mb { margin-bottom: var(--pad); }
.gap-sm { gap: 8px; }
::selection { background: var(--accent-soft); color: var(--text); }

/* Scrollbars discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w); flex-shrink: 0; background: var(--sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; transition: width .2s ease;
  z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: var(--top-h); border-bottom: 1px solid var(--border); }
.logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #2a8f84); color: #fff; flex-shrink: 0; }
.brand-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt strong { font-size: 1.02rem; }
.brand-txt small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.sb-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 16px 10px 6px; }
.sb-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; margin-bottom: 2px; position: relative;
}
.sb-link:hover { background: var(--surface-3); color: var(--text); }
.sb-link.active { background: var(--accent-soft); color: var(--accent-text); }
.sb-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-count { margin-left: auto; font-size: .72rem; font-weight: 600; background: var(--surface-3); color: var(--text-2); padding: 1px 8px; border-radius: 20px; }
.sb-link.active .sb-count { background: var(--accent); color: #fff; }
.sb-foot { padding: 12px 22px; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); }

.sb-collapsed .sidebar { width: 68px; }
.sb-collapsed .sidebar .lbl, .sb-collapsed .sidebar .brand-txt, .sb-collapsed .sidebar .sb-count, .sb-collapsed .sb-section { display: none; }
.sb-collapsed .sb-link { justify-content: center; padding: 10px; }
.sb-collapsed .sb-brand { justify-content: center; padding: 0; }
.sb-collapsed .sb-link:hover::after {
  content: attr(data-tip); position: absolute; left: 56px; background: var(--text); color: var(--surface);
  padding: 4px 10px; border-radius: 6px; font-size: .8rem; white-space: nowrap; z-index: 50;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; border: 0; background: transparent; outline: 0; padding: 8px 2px; color: var(--text); font: inherit; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.dot-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
[data-theme="light"] .only-dark, [data-theme="dark"] .only-light { display: none; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 8px 4px 4px; border-radius: 10px; cursor: pointer; color: var(--text-2); font: inherit; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta strong { color: var(--text); font-size: .88rem; }
.user-meta small { color: var(--muted); font-size: .75rem; }

.content { padding: 24px 28px 40px; flex: 1; max-width: 1600px; width: 100%; margin: 0 auto; }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 28px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-menu > a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.dropdown-menu > a:hover { background: var(--surface-3); }
.dm-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px; }
.seg { display: flex; gap: 4px; padding: 2px 8px 6px; }
.seg button { flex: 1; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); padding: 5px; border-radius: 6px; cursor: pointer; font: inherit; font-size: .82rem; }
.seg button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.notif-menu { width: 380px; padding: 0; }
.dm-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.dm-head a { font-size: .8rem; }
.notif-list { max-height: 400px; overflow-y: auto; }
.dm-foot { display: block !important; text-align: center; padding: 10px; border-top: 1px solid var(--border); font-size: .85rem; border-radius: 0 0 var(--radius) var(--radius) !important; }
.notif-item { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); color: var(--text); }
.notif-item.unread { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.notif-item .ni-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item strong { display: block; font-size: .86rem; font-weight: 600; }
.notif-item p { margin: 1px 0 0; font-size: .8rem; color: var(--text-2); }
.notif-item small { font-size: .72rem; color: var(--muted); }
.empty-sm { padding: 28px; text-align: center; color: var(--muted); font-size: .88rem; }

/* tons */
.t-danger { background: var(--danger-soft); color: var(--danger); }
.t-warning { background: var(--warning-soft); color: var(--warning); }
.t-info { background: var(--info-soft); color: var(--info); }
.t-success { background: var(--success-soft); color: var(--success); }
.t-violet { background: var(--violet-soft); color: var(--violet); }
.t-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--text-2); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550; font-size: .9rem;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0b1a1e; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); background: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); background: var(--success); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { padding: 6px 11px; font-size: .84rem; }
.btn-xs { padding: 3px 8px; font-size: .78rem; border-radius: 6px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-link { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; color: var(--text-2); }
.icon-link:hover { background: var(--surface-3); color: var(--accent); }
.icon-link.danger:hover { color: var(--danger); background: var(--danger-soft); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.inline { display: inline; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--pad); border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 9px; }
.card-head .sub { font-size: .8rem; color: var(--muted); font-weight: 400; }
.card-body { padding: var(--pad); }
.card-body.flush { padding: 0; }
.card + .card { margin-top: var(--pad); }

.grid { display: grid; gap: var(--pad); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: .8rem; color: var(--text-2); font-weight: 500; }
.kpi-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.kpi-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi-value small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 1px 7px; border-radius: 20px; font-size: .74rem; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: var(--surface-3); color: var(--text-2); }
.kpi-spark { position: absolute; right: 0; bottom: 0; opacity: .9; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th {
  text-align: left; font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table td { padding: var(--row) 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 11px 14px; font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: .8rem; color: var(--muted); }
a.cell-main:hover { color: var(--accent); }
.table th.sortable { cursor: pointer; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-muted { background: var(--surface-3); color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.tag-ext { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.f-12 { grid-column: span 12; } .f-8 { grid-column: span 8; } .f-6 { grid-column: span 6; }
.f-5 { grid-column: span 5; } .f-4 { grid-column: span 4; } .f-3 { grid-column: span 3; } .f-2 { grid-column: span 2; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .92rem;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94a4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.input-group { display: flex; }
.input-group .input { border-radius: 8px 0 0 8px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); font-size: .84rem; }
.form-section { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); grid-column: span 12; padding-top: 10px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; grid-column: span 12; }
.choice-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { position: relative; display: flex; gap: 10px; align-items: center; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 9px; cursor: pointer; }
.choice input { accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice strong { display: block; font-size: .9rem; }
.choice small { color: var(--muted); font-size: .78rem; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .9rem; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 19px; }
.ext-only { display: none; }
.is-ext .ext-only { display: block; }

/* Filtres */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px var(--pad); border-bottom: 1px solid var(--border); }
.filters .input { width: auto; min-width: 150px; padding: 7px 11px; font-size: .86rem; }
.filters .grow { flex: 1; min-width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .82rem; font-weight: 500; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { opacity: .65; margin-left: 4px; }

/* ---------- Alertes ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; border: 1px solid transparent; }
.alert span { flex: 1; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-x { border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .7; padding: 0; }
.callout { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: .88rem; color: var(--text-2); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 var(--pad); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .9rem; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .n { font-size: .72rem; background: var(--surface-3); padding: 0 7px; border-radius: 10px; color: var(--text-2); }

/* ---------- Divers ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty p { margin: 0 0 14px; }
.progress { height: 8px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 10px; background: var(--accent); transition: width .4s ease; }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }
.progress.success > span { background: var(--success); }
.dl { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 9px 14px; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.stat-line { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.stat-line:last-child { border-bottom: 0; }
.stat-line.total { font-weight: 700; font-size: 1rem; border-top: 1px solid var(--border-strong); border-bottom: 0; margin-top: 4px; padding-top: 12px; }
.hero-strip { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.route-line { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.05rem; }
.route-line .arrow { color: var(--muted); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px var(--pad); border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .ttl { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: .8rem; color: var(--muted); }
.sq { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.date-box { width: 44px; text-align: center; border-radius: 9px; background: var(--surface-3); padding: 4px 0; flex-shrink: 0; line-height: 1.1; }
.date-box b { display: block; font-size: 1.05rem; }
.date-box small { font-size: .68rem; text-transform: uppercase; color: var(--muted); }

/* Insights */
.insight { display: flex; gap: 12px; padding: 13px var(--pad); border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: 0; }
.insight .sq { width: 32px; height: 32px; }
.insight p { margin: 0; font-size: .88rem; color: var(--text-2); }
.insight strong { color: var(--text); font-size: .9rem; display: block; margin-bottom: 1px; }
.insight a { font-size: .8rem; font-weight: 600; }

/* Graphiques */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-lbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 11px; font-size: .8rem; white-space: nowrap; z-index: 5; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; margin-bottom: 3px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; font-size: .84rem; }
.donut-legend .lg-row { display: flex; align-items: center; gap: 8px; }
.donut-legend .lg-row span:nth-child(2) { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.hbar { display: flex; flex-direction: column; gap: 12px; }
.hbar-row .hb-top { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: 5px; gap: 10px; }
.hbar-row .hb-top span:first-child { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; }
.pagination a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text-2); font-size: .85rem; padding: 0 8px; }
.pagination a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .dots { padding: 6px; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px; overflow-y: auto; }
.modal.open { display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-box.sm { max-width: 420px; }
.modal-box.lg { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* Lignes dynamiques (estimatif, véhicules du convoi) */
.dyn-row { display: grid; gap: 10px; align-items: end; margin-bottom: 10px; }
.dyn-row .rm { height: 40px; }
.dyn-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--accent-soft); color: var(--accent-text); border-radius: 9px; font-weight: 700; margin-top: 8px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); font-size: .86rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li.done::before { background: var(--accent); }
.timeline small { color: var(--muted); display: block; }

/* Étapes du convoi */
.steps { display: flex; gap: 0; }
.step { flex: 1; text-align: center; position: relative; font-size: .78rem; color: var(--muted); padding-top: 30px; }
.step::before { content: ""; position: absolute; top: 9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); z-index: 1; }
.step::after { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 2px; background: var(--border-strong); }
.step:first-child::after { display: none; }
.step.done { color: var(--text-2); }
.step.done::before { background: var(--accent); border-color: var(--accent); }
.step.done::after { background: var(--accent); }
.step.current { color: var(--accent-text); font-weight: 650; }
.step.current::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step.current::after { background: var(--accent); }

/* Connexion */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(160deg, #134e5a 0%, #1d6f80 55%, #2a8f84 100%); color: #e9f4f5; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h1 { font-size: 2.1rem; line-height: 1.2; max-width: 460px; color: #fff; }
.auth-side p { color: #c4e1e5; max-width: 440px; }
.auth-side .feat { display: flex; gap: 10px; align-items: center; margin: 10px 0; color: #d9eef0; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255,255,255,.05); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 1.5rem; margin-bottom: 6px; }

/* Impression */
@media print {
  .sidebar, .topbar, .foot, .no-print, .page-head .actions, .tabs { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 1280px) { .g-6 { grid-template-columns: repeat(3, 1fr); } .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .g-main { grid-template-columns: 1fr; } .g-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s ease; width: var(--sb-w) !important; }
  .sb-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .sb-open .sb-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .sb-collapsed .sidebar .lbl, .sb-collapsed .sidebar .brand-txt, .sb-collapsed .sb-section { display: initial; }
  .content { padding: 18px 16px 30px; }
  .topbar { padding: 0 14px; }
  .search kbd, .hide-sm { display: none !important; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .g-6 { grid-template-columns: repeat(2, 1fr); }
  .form-grid > [class*="f-"] { grid-column: span 12; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .notif-menu { width: calc(100vw - 30px); right: -60px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Cases à cocher en forme de pastille */
.check-chip { position: relative; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span { display: inline-block; min-width: 40px; text-align: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-strong); font-weight: 600; font-size: .85rem; color: var(--text-2); background: var(--surface); }
.check-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.check-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Correctifs de mise en page */
.grid > .card + .card, .grid > * > .card:first-child { margin-top: 0; }
.kpi-value { white-space: nowrap; }
.g-6 .kpi-value { font-size: clamp(1.05rem, 1.35vw, 1.45rem); }
.kpi-foot { flex-wrap: wrap; }
.kpi-foot strong { white-space: nowrap; }
.empty .ico { width: 44px; height: 44px; padding: 10px; }
.empty .btn .ico, .empty-sm .ico { width: auto; height: auto; padding: 0; background: none; color: inherit; margin: 0; border-radius: 0; }
.g-form { grid-template-columns: minmax(0, 1.75fr) minmax(330px, 1fr); }
@media (max-width: 1100px) { .g-form { grid-template-columns: 1fr; } }
.search { min-width: 0; }
.search input { min-width: 0; width: 100%; }
@media (max-width: 600px) { .topbar { gap: 6px; } .top-actions { gap: 2px; } .user-btn { padding: 2px; } .user-btn > .ico { display: none; } }

/* ---------- Assistant d'installation ---------- */
.wiz { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.wiz-side { background: linear-gradient(170deg, #134e5a 0%, #1d6f80 60%, #2a8f84 100%); color: #e6f3f4; padding: 28px 22px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; }
.wiz-brand { display: flex; gap: 12px; align-items: center; }
.wiz-brand strong { display: block; color: #fff; font-size: 1.05rem; }
.wiz-brand small { color: #b9dde2; font-size: .76rem; }
.wiz-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.wiz-steps a, .wiz-steps span { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; color: #cfe7ea; font-size: .9rem; font-weight: 500; }
.wiz-steps a:hover { background: rgba(255,255,255,.08); color: #fff; }
.wiz-steps span { opacity: .55; }
.wiz-steps i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; border: 1.5px solid rgba(255,255,255,.45); flex-shrink: 0; }
.wiz-steps li.done i { background: rgba(255,255,255,.9); color: #1d6f80; border-color: transparent; }
.wiz-steps li.current a { background: rgba(255,255,255,.14); color: #fff; }
.wiz-steps li.current i { background: #fff; color: #1d6f80; border-color: #fff; }
.wiz-help { font-size: .8rem; color: #b9dde2; line-height: 1.5; }
.wiz-help a { display: block; color: #fff; margin-top: 8px; text-decoration: underline; }
.wiz-main { padding: 40px 32px; display: flex; justify-content: center; align-items: flex-start; background: var(--bg); }
.wiz-card { width: 100%; max-width: 860px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.wiz-head { padding: 26px 30px 20px; border-bottom: 1px solid var(--border); }
.wiz-head h1 { font-size: 1.45rem; margin-top: 4px; }
.wiz-head p { color: var(--text-2); margin: 6px 0 0; }
.wiz-count { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); }
.wiz-body { padding: 24px 30px; }
.wiz-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 30px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; position: sticky; bottom: 0; }
.wiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wiz-choice { align-items: flex-start; padding: 16px; gap: 12px; }
.wiz-choice input { margin-top: 10px; }
.wiz-choice strong { margin-bottom: 3px; }
.wiz-choice small { display: block; line-height: 1.45; }
.wiz-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wiz-sum { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.wiz-sum-h { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.wiz-sum-h a { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
@media (max-width: 900px) {
  .wiz { grid-template-columns: 1fr; }
  .wiz-side { position: static; height: auto; padding: 18px; gap: 14px; }
  .wiz-steps { flex-direction: row; overflow-x: auto; }
  .wiz-steps a, .wiz-steps span { white-space: nowrap; font-size: .8rem; }
  .wiz-help { display: none; }
  .wiz-main { padding: 16px; }
  .wiz-head, .wiz-body, .wiz-foot { padding-left: 18px; padding-right: 18px; }
  .wiz-choices, .wiz-summary { grid-template-columns: 1fr; }
  .dyn-row { grid-template-columns: 1fr !important; }
}
/* Logo de la société */
.logo.has-img { background: #fff; padding: 3px; overflow: hidden; }
.logo.has-img img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Barres d'action toujours visibles (ordinateur et mobile) ---------- */
.form-actions {
  position: sticky; bottom: 0; z-index: 25;
  margin: 6px calc(-1 * var(--pad)) calc(-1 * var(--pad));
  padding: 12px var(--pad);
  background: var(--surface);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -10px 20px -16px rgba(16, 24, 40, .45);
}
.action-bar {
  position: sticky; bottom: 0; z-index: 25;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  margin-top: var(--pad); padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 -10px 26px -14px rgba(16, 24, 40, .4);
}
.action-bar .ab-info { margin-right: auto; display: flex; gap: 8px; align-items: baseline; }
.action-bar .ab-info strong { font-size: 1.1rem; color: var(--accent-text); }
.action-bar .ab-grow { flex: 1; min-width: 0; }
.action-bar.in-card { margin: 0; border-width: 1px 0 0; border-radius: 0 0 var(--radius) var(--radius); }
.sticky-side { position: sticky; top: 76px; }
@media (max-width: 1100px) { .sticky-side { position: static; } }
@media (max-width: 600px) {
  .form-actions, .action-bar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; flex-wrap: wrap; }
  .form-actions .btn, .action-bar .btn { flex: 1 1 0; }
  .action-bar .ab-info, .action-bar .ab-grow { flex-basis: 100%; }
}

/* Modales : en-tête et boutons fixes, seul le contenu défile */
.modal { align-items: center; padding: 16px; }
.modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.modal-head, .modal-foot { flex-shrink: 0; }
.modal-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
@media (max-width: 600px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-box, .modal-box.sm, .modal-box.lg { max-width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .wiz-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .wiz-foot .btn { flex: 1; }
  .wiz-foot > span:empty { display: none; }
}

/* ---------- Fluidité ---------- */
/* Transitions douces entre les pages (navigateurs récents) ; menu et barre du haut restent immobiles */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: gc-sidebar; }
.topbar { view-transition-name: gc-topbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .14s; }
/* Barre de progression lors d'un changement de page ou d'un enregistrement */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 200; background: var(--accent); box-shadow: 0 0 8px var(--accent); opacity: 0; pointer-events: none; }
html.is-loading .nav-progress { opacity: 1; animation: navprog 8s cubic-bezier(.08,.6,.2,1) forwards; }
@keyframes navprog { 0% { width: 0; } 10% { width: 35%; } 40% { width: 70%; } 100% { width: 92%; } }
html.is-loading { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html.is-loading .nav-progress { animation: none; width: 60%; }
}

/* Calcul automatique de la distance */
.addon-btn { cursor: pointer; color: var(--text-2); font: inherit; }
.addon-btn:hover { color: var(--accent); background: var(--accent-soft); }
.addon-btn[disabled] { opacity: .5; cursor: progress; }
.dist-hint { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); margin-top: -6px; }
.dist-hint[hidden] { display: none; }
.dist-hint .ico { margin-top: 2px; }
.dist-hint.ok { background: var(--success-soft); border-color: transparent; color: var(--text); }
.dist-hint.ok > .ico { color: var(--success); }
.dist-hint.estim { background: var(--warning-soft); border-color: transparent; color: var(--text); }
.dist-hint.estim > .ico { color: var(--warning); }
.dist-hint .btn-xs { margin-left: 6px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; flex-shrink: 0; margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.input.flash { animation: flashbg 1.2s ease; }
@keyframes flashbg { 0% { background: var(--accent-soft); border-color: var(--accent); } 100% { background: var(--surface); } }

/* =====================================================================
   Mobile (1.5.0) — navigation au pouce, listes en cartes, en-têtes compacts
   ===================================================================== */
.grid > * { min-width: 0; }               /* aucun bloc ne déborde de sa colonne */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  :root { --bn-h: 62px; --top-h: 56px; }
  /* Barre du haut : recherche pleine largeur, le menu passe en bas */
  .has-bn .topbar > [data-action="toggle-sidebar"] { display: none; }
  .topbar { height: var(--top-h); gap: 8px; }
  .search { max-width: none; }
  .search input { padding: 9px 2px; font-size: 16px; } /* 16px : pas de zoom automatique sur iPhone */

  /* Navigation du bas */
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: stretch;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 32;
    height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 20px -12px rgba(16, 24, 40, .25);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font: inherit; font-size: .7rem; font-weight: 600; background: none; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent; position: relative;
  }
  .bottom-nav a.on { color: var(--accent-text); }
  .bottom-nav a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .bottom-nav a:active, .bottom-nav button:active { transform: scale(.94); }
  .bn-fab { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 70%, transparent); margin-top: -18px; border: 3px solid var(--bg); }
  .has-bn .main { padding-bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); }
  .has-bn .form-actions, .has-bn .action-bar { bottom: calc(var(--bn-h) + env(safe-area-inset-bottom)); }
  html.kb-open .bottom-nav { display: none; }
  html.kb-open .has-bn .main { padding-bottom: 0; }
  html.kb-open .has-bn .form-actions, html.kb-open .has-bn .action-bar { bottom: 0; }
  .sidebar { z-index: 40; }

  /* En-têtes de page */
  .content { padding: 16px 14px 24px; }
  .page-head { margin-bottom: 16px; gap: 12px; align-items: stretch; flex-direction: column; }
  .page-head h1 { font-size: 1.3rem; }
  .page-head p { font-size: .9rem; }
  .page-head .actions { width: 100%; gap: 8px; }
  .page-head .actions > .btn, .page-head .actions > form > .btn, .page-head .actions > a.btn { flex: 1 1 auto; justify-content: center; }
  .page-head .actions > form { display: flex; flex: 1 1 auto; }
  .page-head .actions > .dropdown { flex: 0 0 auto; }
  .crumb { font-size: .8rem; }
  .route-line { flex-wrap: wrap; row-gap: 2px; font-size: 1rem; }
  .route-meta { flex-basis: 100%; }

  /* Indicateurs : deux par ligne au lieu d'un */
  .g-4:has(> .kpi), .g-3:has(> .kpi), .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g-4:has(> .kpi) > :last-child:nth-child(odd), .g-3:has(> .kpi) > :last-child:nth-child(odd), .g-6 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 13px 14px; gap: 4px; }
  .kpi-ico { width: 30px; height: 30px; }
  .kpi-value, .g-6 .kpi-value { font-size: 1.2rem; }
  .kpi-label { font-size: .76rem; }

  /* Filtres et onglets */
  .filters { padding: 10px 12px; gap: 8px; }
  .filters .input, .filters select { flex: 1 1 130px; min-width: 0; font-size: 16px; }
  .filters .grow { flex-basis: 100%; min-width: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; width: 100%; }
  .chips::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; flex-shrink: 0; }
  .tabs { padding: 0 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .tab { padding: 12px 11px; scroll-snap-align: center; }
  .card-head { padding: 12px 14px; flex-wrap: wrap; }

  /* Listes (rappels, notifications…) */
  .list-row { flex-wrap: wrap; padding: 12px 14px; align-items: flex-start; }
  .list-row .ttl { white-space: normal; overflow: visible; }
  .list-row > .row-actions { width: 100%; justify-content: flex-start; padding-left: 48px; gap: 6px; }
  .list-row > .badge { margin-left: 48px; }

  /* Tableaux → cartes */
  .table-wrap:has(> .t-cards) { overflow: visible; }
  table.t-cards, table.t-cards tbody, table.t-cards tfoot { display: block; width: 100%; }
  table.t-cards thead { display: none; }
  table.t-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; padding: 13px 14px; border-bottom: 1px solid var(--border); position: relative; }
  table.t-cards tbody tr:last-child { border-bottom: 0; }
  table.t-cards tbody tr:hover td { background: none; }
  table.t-cards td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; background: none !important; }
  table.t-cards td.num { text-align: left; }
  table.t-cards td, table.t-cards td .mono { overflow-wrap: anywhere; }
  table.t-cards td::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 1px; }
  table.t-cards td[data-label=""]::before, table.t-cards td:first-child::before { display: none; }
  table.t-cards td:first-child { grid-column: 1 / -1; padding-right: 44px; font-size: 1rem; }
  table.t-cards td.td-span { grid-column: 1 / -1; }
  table.t-cards td.td-empty { display: none; }
  table.t-cards td.td-act { position: absolute; top: 9px; right: 8px; }
  table.t-cards td.td-act::before { display: none; }
  table.t-cards tfoot tr { background: var(--surface-2); border-top: 1px solid var(--border-strong); }
  table.t-cards tfoot td { padding: 0; background: none; border: 0; }
  table.t-cards .progress { max-width: 160px; }
  /* Tableaux gardés en colonnes : défilement horizontal avec 1re colonne fixe */
  table.t-keep th:first-child, table.t-keep td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  table.t-keep thead th:first-child { z-index: 2; }
  table.t-keep td:first-child { white-space: nowrap; }

  /* Divers */
  .foot { padding: 12px 16px; flex-direction: column; gap: 2px; }
  .modal-head { padding-top: 10px; position: relative; }
  .notif-menu { position: fixed; top: calc(var(--top-h) + 4px); left: 10px; right: 10px; width: auto; max-height: calc(100dvh - var(--top-h) - 90px); display: none; flex-direction: column; }
  .dropdown.open .notif-menu { display: flex; }
  .notif-menu .notif-list { overflow-y: auto; max-height: none; flex: 1; }
}
@media (max-width: 600px) {
  .modal-box::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--border-strong); }
  .modal-box { position: relative; }
  .top-actions .icon-btn { width: 38px; height: 38px; }
}
@media (max-width: 380px) {
  table.t-cards tr { gap: 8px 10px; padding: 12px; }
  .bottom-nav a, .bottom-nav button { font-size: .66rem; }
}

/* Caisse de départ (fiche convoi) */
.caisse-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.caisse-sum > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.caisse-sum strong { font-size: 1.25rem; letter-spacing: -.01em; white-space: nowrap; }
.caisse-sum small { font-size: .78rem; }
.caisse-input .input { font-size: 1.2rem; font-weight: 650; text-align: right; }
@media (max-width: 700px) { .caisse-sum { grid-template-columns: 1fr; } .caisse-sum > div { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 10px; } .caisse-sum > div > span { flex-basis: 100%; } }
#caisseHint { margin: -8px 0 14px; }

/* =====================================================================
   Autonomie (1.7.0) — prochaine étape, aide, guide, bulles d'explication
   ===================================================================== */
/* Prochaine étape d'un convoi */
.next-step { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: var(--pad); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.next-step .ns-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-text); }
.next-step .ns-txt { flex: 1; min-width: 0; }
.next-step .ns-txt strong { display: block; font-size: 1rem; }
.next-step .ns-txt p { margin: 2px 0 0; color: var(--text-2); font-size: .88rem; }
.next-step .ns-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ns-info { border-left-color: var(--info); } .ns-info .ns-ico { background: var(--info-soft); color: var(--info); }
.ns-warning { border-left-color: var(--warning); } .ns-warning .ns-ico { background: var(--warning-soft); color: var(--warning); }
.ns-success { border-left-color: var(--success); } .ns-success .ns-ico { background: var(--success-soft); color: var(--success); }
.ns-muted { border-left-color: var(--border-strong); } .ns-muted .ns-ico { background: var(--surface-3); color: var(--text-2); }

/* Bulles d'explication (i) */
.qtip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 2px; vertical-align: -3px; border: 0; background: none; color: var(--muted); cursor: help; border-radius: 50%; }
.qtip:hover, .qtip:focus-visible, .qtip.on { color: var(--accent); outline: none; }
.qtip-b { position: absolute; z-index: 70; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 280px; padding: 10px 12px; border-radius: 9px; background: var(--text); color: var(--surface); font-size: .8rem; font-weight: 400; line-height: 1.45; text-align: left; text-transform: none; letter-spacing: 0; white-space: normal; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none; }
.qtip-b strong { display: block; margin-bottom: 2px; color: inherit; font-size: .82rem; }
.qtip:hover .qtip-b, .qtip:focus-visible .qtip-b, .qtip.on .qtip-b { opacity: 1; visibility: visible; }
.kpi .qtip-b, .card-head .qtip-b { left: 0; transform: none; }
.kpi { overflow: visible; }
.modal-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 9px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: .84rem; }
.modal-hint .ico { margin-top: 2px; color: var(--accent); }
.kbd-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); vertical-align: -6px; color: var(--accent); }

/* Panneau d'aide */
.help-btn { color: var(--accent); }
.help-drawer { position: fixed; inset: 0; z-index: 110; visibility: hidden; }
.help-drawer.open { visibility: visible; }
.hd-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .35); opacity: 0; transition: opacity .18s; }
.help-drawer.open .hd-backdrop { opacity: 1; }
.hd-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.help-drawer.open .hd-panel { transform: none; }
.hd-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.hd-head > div { flex: 1; min-width: 0; }
.hd-head small { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.hd-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.hd-body { flex: 1; overflow-y: auto; padding: 18px; }
.hd-intro { margin: 0 0 14px; font-size: .95rem; }
.hd-steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: hs; display: flex; flex-direction: column; gap: 10px; }
.hd-steps li { counter-increment: hs; display: flex; gap: 10px; font-size: .9rem; line-height: 1.5; }
.hd-steps li::before { content: counter(hs); flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: .78rem; font-weight: 700; margin-top: 1px; }
.hd-tip { display: flex; gap: 8px; padding: 10px 12px; border-radius: 9px; background: var(--warning-soft); font-size: .86rem; margin-bottom: 8px; }
.hd-tip .ico { color: var(--warning); margin-top: 2px; }
.hd-foot { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.hd-foot .btn { justify-content: center; }
@media (max-width: 600px) {
  .hd-panel { top: auto; left: 0; width: 100%; max-height: 88dvh; border-radius: 16px 16px 0 0; transform: translateY(100%); }
}

/* Guide de premiers pas */
.guide-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); overflow: hidden; }
.guide-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.guide-next { padding: 16px; border-radius: 10px; background: var(--accent-soft); }
.guide-next small { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent-text); }
.guide-next strong { display: block; font-size: 1.08rem; margin-top: 2px; }
.guide-next p { margin: 4px 0 12px; color: var(--text-2); font-size: .88rem; }
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.guide-list.compact { grid-template-columns: 1fr; }
.guide-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .9rem; }
.guide-list li a { color: var(--text); }
.guide-list li.ok a { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.guide-list li.cur a { font-weight: 650; color: var(--accent-text); }
.gl-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.guide-list li.ok .gl-check { background: var(--success); border-color: var(--success); }
.guide-list li.cur .gl-check { border-color: var(--accent); }

/* Actions rapides */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.quick-a { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; min-width: 0; }
.quick-a:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.quick-a > .ico { color: var(--accent); flex-shrink: 0; }
.quick-a span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.quick-a small { font-weight: 400; color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-a.primary > .ico { color: #fff; }

/* Page Aide */
.cycle { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.cycle li { position: relative; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.cycle li strong { display: block; margin: 8px 0 4px; font-size: .92rem; }
.cycle li p { margin: 0; font-size: .82rem; color: var(--text-2); line-height: 1.45; }
.cy-n { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; list-style: none; padding: 13px var(--pad); font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 var(--pad) 14px; color: var(--text-2); }
.lexique { margin: 0; }
.lexique > div { padding: 11px var(--pad); border-bottom: 1px solid var(--border); }
.lexique > div:last-child { border-bottom: 0; }
.lexique dt { font-weight: 650; font-size: .9rem; }
.lexique dd { margin: 2px 0 0; color: var(--text-2); font-size: .86rem; }
.secours-code { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; letter-spacing: .08em; text-align: center; padding: 16px; border-radius: 10px; border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent-text); word-break: break-all; }
@media (max-width: 1100px) { .cycle { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .next-step { flex-wrap: wrap; align-items: flex-start; }
  .next-step .ns-txt { flex-basis: calc(100% - 54px); }
  .next-step .ns-act { width: 100%; justify-content: stretch; }
  .next-step .ns-act .btn { flex: 1 1 auto; justify-content: center; }
  .guide-body { grid-template-columns: 1fr; }
  .guide-list { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cycle { grid-template-columns: 1fr; }
  .cycle li { display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; }
  .cycle li strong { margin: 0; align-self: center; }
  .cycle li p { grid-column: 2; }
  .qtip-b { position: fixed; left: 16px !important; right: 16px; bottom: auto; top: 30%; transform: none !important; max-width: none; width: auto; }
}
@media print { .help-drawer, .quick, .guide-card, .next-step .ns-act { display: none !important; } }
@media (max-width: 900px) { .guide-card .guide-list li.ok, .guide-card .guide-list li.cur { display: none; } .guide-card .guide-list:not(:has(li:not(.ok):not(.cur))) { display: none; } }

/* =====================================================================
   Gestionnaire unique (1.8.0) — saisie groupée, clôture en une fois
   ===================================================================== */
.dep-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr) 40px; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.dep-row.has-veh { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.4fr) 40px; }
.dep-row .field { margin: 0; }
.dep-row .rm { padding: 0; height: 38px; }
.dep-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; font-size: .9rem; }
.dep-foot strong { color: var(--accent-text); font-size: 1rem; }
.close-now { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.close-now .switch { font-size: .92rem; }
.close-now-detail { display: none; margin-top: 10px; }
.close-now:has(input[name="tout_cloturer"]:checked) { border-color: var(--success); background: var(--success-soft); }
.close-now:has(input[name="tout_cloturer"]:checked) .close-now-detail { display: block; }
.regl-list { list-style: none; margin: 0; padding: 0; }
.regl-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.regl-list li small { color: var(--muted); margin-left: 4px; }
.regl-list li.tot { border-bottom: 0; border-top: 1px solid var(--border-strong); font-weight: 700; margin-top: 2px; }
.welcome-code { border: 2px solid var(--accent); }
.welcome-code .card-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.welcome-code h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.welcome-code p { margin: 0; color: var(--text-2); }
.more-users { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 14px; }
.more-users summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.more-users[open] summary { margin-bottom: 10px; }
@media (max-width: 900px) {
  .dep-row, .dep-row.has-veh { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px !important; }
  .dep-row > .field:nth-child(1) { grid-column: 1 / -1; }
  .dep-row > .field:last-of-type { grid-column: 1 / 3; }
  .dep-row .rm { grid-column: 3; grid-row: 2; }
  .dep-row.has-veh .rm { grid-row: 2; }
  .welcome-code .card-body { grid-template-columns: 1fr; }
}
@media print { body:has(.welcome-code) .content > *:not(.welcome-code) { display: none !important; } }
@media (max-width: 900px) { .dep-row:not(.has-veh) > .field:nth-child(2) { grid-column: 1 / 3; } }
/* Mode une seule personne avec d'autres comptes (Paramètres) */
.solo-others { display: none; margin-top: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--warning); background: var(--warning-soft); }
.solo-others p { margin: 0 0 10px; display: block; }
.solo-others p .ico { vertical-align: -3px; color: var(--warning); }
.card-body:has(input[name="mode_solo"][value="1"]:checked) .solo-others { display: block; }
@media (max-width: 900px) { .solo-others .choice-cards { grid-template-columns: 1fr; } }

/* =====================================================================
   Reconnaissance des appareils (1.9.0)
   ===================================================================== */
.device-box { text-align: left; }
.device-ico { position: relative; width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--warning-soft); color: var(--warning); margin-bottom: 16px; }
.device-ico.refused { background: var(--danger-soft); color: var(--danger); }
.device-pulse { position: absolute; inset: -6px; border-radius: 22px; border: 2px solid var(--warning); opacity: 0; animation: devpulse 2s ease-out infinite; }
@keyframes devpulse { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.15); opacity: 0; } }
.device-code { margin: 18px 0 12px; padding: 14px; border-radius: 12px; border: 2px dashed var(--accent); background: var(--accent-soft); text-align: center; }
.device-code small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent-text); }
.device-code strong { font-family: var(--mono); font-size: 2rem; letter-spacing: .25em; color: var(--accent-text); }
.device-wait { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .9rem; color: var(--text-2); }
.device-wait .spin { margin-top: 0; }
.dev-code-sm { text-align: center; padding: 4px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); line-height: 1.2; }
.dev-code-sm small { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.dev-code-sm strong { font-size: 1.05rem; letter-spacing: .15em; }
.dev-toggle { padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-weight: 600; font-size: .9rem; }
@media (max-width: 900px) { .dev-req .dev-code-sm { margin-left: 48px; } }
@media (prefers-reduced-motion: reduce) { .device-pulse { animation: none; } }
