/* Mise en page : barre d'onglets par rôle en haut, contenu en colonne lisible ; la carte occupe tout l'espace sous la barre */
:root {
  --bg: #f2f3f7; --surface: #ffffff; --sunk: #eef0f4; --fg: #343a40; --muted: #6c757d; --line: #e3e6ea;
  --accent: var(--brand, #3f51b5); --accent-fg: #ffffff; --accent-soft: color-mix(in srgb, var(--accent) 13%, #ffffff);
  --danger: #b42318; --warn: #b54708; --ok: #15803d; --info: #1d4ed8; --idle: #667085; --violet: #6d28d9;
  --st-unassigned: #dc2626; --st-planned: #eab308; --st-late: #f97316; --st-progress: #2563eb; --st-received: #0d9488; --st-done: #16a34a; --st-cancel: #7c3aed; --st-rework: #ec4899;
  /* Polices du système : aucune police chargée depuis un service tiers */
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1614; --surface: #18211f; --sunk: #121a18; --fg: #e5ece9; --muted: #93a29e; --line: #2a3734;
  --accent: color-mix(in srgb, var(--brand, #3f51b5) 50%, #ffffff); --accent-fg: #0b1512; --accent-soft: color-mix(in srgb, var(--brand, #3f51b5) 30%, #18211f);
  --danger: #f97066; --warn: #f79009; --ok: #47cd89; --info: #6ea8ff; --idle: #98a2b3; --violet: #a78bfa;
  --st-unassigned: #f87171; --st-planned: #facc15; --st-late: #fb923c; --st-progress: #60a5fa; --st-received: #2dd4bf; --st-done: #4ade80; --st-cancel: #a78bfa; --st-rework: #f472b6;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1614; --surface: #18211f; --sunk: #121a18; --fg: #e5ece9; --muted: #93a29e; --line: #2a3734;
  --accent: color-mix(in srgb, var(--brand, #3f51b5) 50%, #ffffff); --accent-fg: #0b1512; --accent-soft: color-mix(in srgb, var(--brand, #3f51b5) 30%, #18211f);
  --danger: #f97066; --warn: #f79009; --ok: #47cd89; --info: #6ea8ff; --idle: #98a2b3; --violet: #a78bfa;
  --st-unassigned: #f87171; --st-planned: #facc15; --st-late: #fb923c; --st-progress: #60a5fa; --st-received: #2dd4bf; --st-done: #4ade80; --st-cancel: #a78bfa; --st-rework: #f472b6;
  color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 13.5px; margin: 0; min-height: 1em; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 9px; padding: 9px 14px; font-weight: 500; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: var(--muted); }
a.btn { color: var(--fg); }
a.btn.primary { color: var(--accent-fg); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn.big { min-height: 52px; font-size: 16px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--fg); min-height: 42px; }
textarea { resize: vertical; }
label.f { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > select { width: auto; max-width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 > * { min-width: 0; }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 14px; }
.login-card p { margin: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .1px; white-space: nowrap; }
.brand.big { font-size: 22px; }

/* Structure */
.app { height: 100%; display: flex; flex-direction: column; }
header.top { display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 1000; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-weight: 500; color: var(--muted); white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.count { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; min-width: 18px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.count.soft { background: var(--sunk); color: var(--fg); }
.account { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.view { flex: 1; overflow-y: auto; padding-block: 16px 96px; padding-inline: 16px; }
.view > .wrap { max-width: 980px; margin: 0 auto; display: grid; gap: 14px; }
.view.wide > .wrap { max-width: 1500px; }
.view.hidden-for-map { display: none; }
.map-wrap { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--sunk); }
.legend { position: absolute; z-index: 500; left: 10px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; display: grid; gap: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend { max-height: calc(100% - 40px); overflow-y: auto; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; flex: 1; min-width: 180px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.filters > * { min-width: 0; }

/* Cartes de liste */
.list { display: grid; gap: 8px; }
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; align-items: center; text-align: left; width: 100%; }
.card:hover { border-color: var(--muted); }
.card > div { min-width: 0; }
.card h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; }
.card .addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.card { box-shadow: inset 6px 0 0 var(--stripe, transparent); padding-left: 16px; }
.thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--sunk); display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; }
.chev { color: var(--muted); font-size: 20px; }
.inbox { border: 2px solid var(--warn); border-radius: 14px; padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.inbox h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card.cr { grid-template-columns: 64px 1fr auto; }
.cr-text { margin: 4px 0 0; font-size: 13.5px; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.banner { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 2px solid var(--warn); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.result.todo { border: 2px solid var(--warn); background: var(--surface); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }

.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 99px; color: #fff; white-space: nowrap; background: var(--idle); }
.pill.st-unassigned { background: var(--st-unassigned); }
.pill.st-planned { background: var(--st-planned); }
.pill.st-late { background: var(--st-late); }
.pill.st-progress { background: var(--st-progress); }
.pill.st-received { background: var(--st-received); }
.pill.st-done { background: var(--st-done); }
.pill.st-cancel { background: var(--st-cancel); }
.pill.st-rework { background: var(--st-rework); }
.pill.st-planned { color: #1f1a00; }
.late { color: var(--st-late); font-weight: 600; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend-row span, .legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.square { border-radius: 2px; }
.legend select { min-height: 32px; padding: 4px 8px; font-size: 12.5px; margin-bottom: 4px; }
.filters.f4 { grid-template-columns: 2fr 1fr 1fr 1fr; }
.status-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 12px; border-radius: 9px; background: var(--sunk); box-shadow: inset 6px 0 0 var(--stripe); }
/* Planning */
.week { font-size: 15px; min-width: 0; }
.planning-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.planning { border-collapse: collapse; width: 100%; min-width: 1180px; table-layout: fixed; font-size: 12.5px; }
.planning th, .planning td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; padding: 6px; }
.planning thead th { font-size: 12px; font-weight: 600; background: var(--sunk); position: sticky; top: 0; text-align: left; }
.planning th.who { width: 150px; text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; font-size: 13px; }
.planning thead th.who { background: var(--sunk); z-index: 2; }
.planning th.who small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.planning tr.unassigned th.who { color: var(--st-unassigned); }
.planning tr.unassigned td { background: color-mix(in srgb, var(--st-unassigned) 6%, transparent); }
.planning td { height: 74px; }
.planning .today { background: var(--accent-soft); }
.planning td.weekend { background: var(--sunk); }
.planning .c-late { background: color-mix(in srgb, var(--st-late) 8%, transparent); }
.planning td.over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.pchip { display: grid; gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 5px 6px 5px 10px; margin-bottom: 5px; cursor: pointer; box-shadow: inset 5px 0 0 var(--stripe); overflow: hidden; }
.pchip[draggable=true] { cursor: grab; }
.pchip:hover { border-color: var(--muted); }
.pchip strong { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.pchip .cat { font-size: 11.5px; }
.cat { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.cat i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.prio { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.prio.urgente { color: var(--danger); } .prio.haute { color: var(--warn); } .prio.normale, .prio.basse { color: var(--muted); }

/* Formulaires */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; }
.panel > h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.step { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.mini-map { height: 240px; border-radius: 8px; border: 1px solid var(--line); z-index: 0; }
.pos-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.acc { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--sunk); }
.acc.good { color: var(--ok); } .acc.bad { color: var(--warn); }
.search-box { position: relative; }
.suggest { position: absolute; z-index: 1200; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.suggest button:hover { background: var(--sunk); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 14px; background: var(--surface); min-height: 40px; }
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip i { width: 10px; height: 10px; border-radius: 3px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg .chip span { width: 100%; justify-content: center; }
.seg .chip input[value="urgente"]:checked + span { border-color: var(--danger); color: var(--danger); background: transparent; }
.seg .chip input[value="haute"]:checked + span { border-color: var(--warn); color: var(--warn); background: transparent; }

.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos .ph { position: relative; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; cursor: zoom-in; background: var(--sunk); }
.photos .rm { position: absolute; top: 4px; right: 4px; border: 0; background: rgba(0,0,0,.65); color: #fff; border-radius: 99px; width: 24px; height: 24px; line-height: 1; }
.addph { width: 96px; height: 96px; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px; }
.addph:hover { border-color: var(--accent); color: var(--accent); }

/* Fenêtre de détail */
dialog#dlg { border: 0; padding: 0; border-radius: 14px; width: min(720px, calc(100vw - 16px)); max-width: calc(100vw - 16px); margin: auto; max-height: calc(100dvh - 16px); background: var(--surface); color: var(--fg); box-shadow: 0 24px 64px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(8,16,14,.55); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.dlg-head h2 { margin: 0; font-size: 17px; flex: 1; }
.dlg-body { padding: 16px 18px; display: grid; gap: 16px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.dlg-foot:empty { display: none; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.desc { white-space: pre-wrap; margin: 0; }
.sec { display: grid; gap: 8px; }
.sec > h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.result { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 10px; background: var(--sunk); }
.callout { border-radius: var(--r); padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); }
.callout.warn { border-color: var(--warn); color: var(--warn); }
.callout.ok { border-color: var(--ok); color: var(--ok); }
.hist { display: grid; gap: 8px; }
.hist div { font-size: 13.5px; border-left: 2px solid var(--line); padding-left: 10px; }
.hist small { color: var(--muted); display: block; font-variant-numeric: tabular-nums; }
.inline-form { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--sunk); }

/* Équipe */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.tbl tr.off td { opacity: .5; }
.scroll-x { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }

/* Marqueurs */
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.pin.urg { outline: 3px solid var(--danger); outline-offset: 1px; }
.leaflet-popup-content { font: 13.5px/1.45 var(--font); }
.leaflet-container a.btn { color: var(--accent-fg); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 9px; z-index: 3000; font-size: 14px; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }
#lightbox { border: 0; padding: 0; background: #000; max-width: 96vw; }
#lightbox img { max-width: 96vw; max-height: 92dvh; display: block; }

@media (max-width: 700px) {
  /* Téléphone : fenêtres en plein écran, fixes (elles ne flottent plus ni ne changent de taille) */
  dialog#dlg { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; inset: 0; position: fixed; display: none; flex-direction: column; box-shadow: none; }
  dialog#dlg[open] { display: flex; }
  dialog#dlg .dlg-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
  dialog#dlg .dlg-body > * { flex-shrink: 0; min-width: 0; }   /* rien n'est comprimé : le contenu défile */
  dialog#dlg .dlg-head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  dialog#dlg .dlg-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  /* 16 px minimum : en dessous, l'iPhone zoome automatiquement sur le champ touché */
  input, select, textarea { font-size: 16px; }
  .hide-xs { display: none; }
  header.top { gap: 6px; padding-inline: 10px; }
  .filters { grid-template-columns: 1fr 1fr; } .filters > :first-child { grid-column: 1 / -1; }
  .grid2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; }
  .filters.f4 { grid-template-columns: 1fr 1fr; }
  .card, .card.cr { grid-template-columns: 56px 1fr; } .card .chev { display: none; }
  .card.cr > .btn { grid-column: 1 / -1; } .thumb { width: 56px; height: 56px; }
  .account { max-width: 90px; }
  .seg { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Identité, connexion, mot de passe, thème */
.login-card { width: min(420px, 100%); }
.login-brand { display: grid; justify-items: center; gap: 6px; text-align: center; }
.login-brand p { margin: 0; }
.brand-logo { max-height: 120px; max-width: 220px; width: auto; display: block; }
.brand-logo.small { max-height: 34px; max-width: 120px; }
.brand-name { margin: 4px 0 0; font-size: 22px; font-weight: 700; letter-spacing: .2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .invert-dark { filter: invert(1); } }
:root[data-theme="dark"] .invert-dark { filter: invert(1); }
.force-invert { filter: invert(1); }
.stack { display: grid; gap: 12px; }
.stack > h2 { margin: 0; font-size: 18px; }
.stack > p { margin: 0; }
.btn.link { border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; padding: 4px 6px; justify-self: center; }
.policy { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.policy li::before { content: "○ "; }
.policy li.done { color: var(--ok); }
.policy li.done::before { content: "✓ "; }
.ok-msg { color: var(--ok); font-size: 13.5px; margin: 0; }
.login-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.icon-btn { min-width: 36px; font-size: 16px; }
.note { margin: 0; font-size: 13px; }
.label { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.to-complete { color: var(--warn); font-style: italic; }
small.block { display: block; font-size: 11.5px; margin-top: 2px; }
.logo-preview { display: flex; gap: 10px; flex-wrap: wrap; }
.logo-preview .lp { width: 180px; height: 110px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; padding: 10px; }
.logo-preview .lp.light { background: #ffffff; }
.logo-preview .lp.dark { background: #18211f; }
.logo-preview img { max-height: 90px; max-width: 160px; }

/* ---- Statistiques (rapports d'activité) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 2px; }
.kpi strong { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--fg); }
.kpi small { font-size: 12px; color: var(--muted); }
label.f.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; color: var(--fg); }
label.f.inline input { width: auto; min-height: 36px; padding: 5px 8px; }
.act-filters > select { min-width: 180px; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-tbl td { font-size: 13.5px; }
.act-tbl tbody tr[data-day] { cursor: pointer; }
.act-tbl tbody tr[data-day]:hover td, .act-tbl tbody tr[data-day]:focus-visible td { background: var(--sunk); }
.small-cell { font-size: 12.5px; color: var(--muted); max-width: 320px; }
.tag-ok { font-size: 11.5px; font-weight: 700; color: var(--ok); white-space: nowrap; }
.tbl.clickable tbody tr { cursor: pointer; }
.tbl.clickable tbody tr:hover td, .tbl.clickable tbody tr:focus-visible td { background: var(--sunk); }
.filters.f2 { grid-template-columns: 2fr 1fr; }
.filters.f5 { grid-template-columns: 2fr 1.2fr 1fr 1fr 1fr; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid3 > * { min-width: 0; }
@media (max-width: 900px) { .filters.f5 { grid-template-columns: 1fr 1fr; } .filters.f5 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 700px) { .grid3 { grid-template-columns: 1fr; } .filters.f2 { grid-template-columns: 1fr; } }

/* ---- Bandeau du super-administrateur dans l'espace d'un client */
.acting { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 16px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-bottom: 1px solid var(--warn); font-size: 13.5px; }
.acting span { flex: 1; min-width: 200px; }

/* ---- Véhicules */
.veh-chip { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.veh-chip i, .vdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.vdot { margin-right: 6px; vertical-align: 1px; }
.vcard { grid-template-columns: 52px 1fr auto; }
.vbadge { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; }
.thumb.mtype { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--fg); font-weight: 600; font-size: 10.5px; line-height: 1.2; padding: 4px; border-left: 4px solid var(--c); }
/* Chauffeur : carte de mission avec bouton d'itinéraire */
.card.dcard { grid-template-columns: 1fr auto; cursor: default; }
.dmain { border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 3px; min-width: 0; cursor: pointer; color: inherit; }
.dmain h3 { white-space: normal; }
.dtime { font-variant-numeric: tabular-nums; color: var(--accent); }

/* ---- Choix du lieu : POI ou adresse */
.seg2, .seg3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg2 .chip span, .seg3 .chip span { width: 100%; justify-content: center; text-align: center; }
.pp-sel { font-size: 13.5px; padding: 8px 10px; border-radius: 8px; background: var(--sunk); }
.mini-map.tall { height: 360px; }
.suggest { max-height: 320px; overflow-y: auto; }
@media (max-width: 700px) { .seg3 { grid-template-columns: 1fr; } .card.dcard { grid-template-columns: 1fr; } .veh-chip { max-width: 120px; padding-inline: 8px; } }

/* ---- Carte : marqueurs */
.sigpin { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); display: grid; place-items: center; }
.sigpin span { font-size: 10.5px; font-weight: 700; color: #fff; text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 1px #000; }
.sg-props { font-size: 12px; margin-top: 4px; border-collapse: collapse; } .sg-props td { padding: 1px 6px 1px 0; vertical-align: top; } .sg-props td:first-child { color: var(--muted); }
.vpin { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); display: grid; place-items: center; font-size: 16px; }
.vpin.moving { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent), 0 2px 8px rgba(0,0,0,.5); }
.vpin.stale { filter: grayscale(.8); opacity: .75; }
.vlabel { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 11px/1.3 var(--font); background: rgba(255,255,255,.92); color: #17201e; padding: 0 5px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* ---- Carte : panneau des couches */
.legend { width: min(330px, calc(100vw - 20px)); gap: 6px; }
.legend .lg-sec { border-bottom: 1px solid var(--line); padding-bottom: 6px; display: grid; gap: 4px; }
.legend .lg-sec:last-of-type { border-bottom: 0; }
.legend .lg-sec > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; font-weight: 600; list-style: none; }
.legend .lg-sec > summary::-webkit-details-marker { display: none; }
.legend .lg-sec > summary::after { content: "▾"; color: var(--muted); font-size: 11px; }
.legend .lg-sec:not([open]) > summary::after { content: "▸"; }
.legend .lg-sec > summary small { margin-left: auto; font-weight: 400; }
.legend summary label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.legend input[type=checkbox] { width: auto; min-height: 0; }
.legend select, .legend input[type=search] { min-height: 32px; padding: 4px 8px; font-size: 12.5px; }
.legend .lg-scroll { display: grid; gap: 3px; max-height: min(40vh, 320px); overflow-y: auto; }
.legend .lg-scroll.short { max-height: 160px; }
.legend .lg-item { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12.5px; color: var(--fg); text-align: left; cursor: pointer; }
.legend .lg-item:disabled { opacity: .55; cursor: default; }
.legend .lg-item small { margin-left: auto; }
.legend .lg-colors { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.legend .lg-tip { font-size: 11.5px; margin: 0; }
.legend i.sq { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.legend .sg-l { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.legend .sg-layer { display: grid; gap: 2px; }
.legend .sg-title { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--fg); cursor: pointer; text-align: left; }
.legend .chev2 { width: 10px; color: var(--muted); }
.legend .sg-list { display: grid; gap: 1px; margin: 0 0 6px 18px; }
.legend .sg-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.legend .sg-item button { border: 0; background: none; padding: 1px 0; font: inherit; color: var(--fg); cursor: pointer; text-align: left; display: flex; gap: 6px; align-items: center; min-width: 0; }
.legend .sg-item button:hover { text-decoration: underline; }
.legend .sg-num { min-width: 22px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--c); color: #fff; font-size: 10.5px; display: inline-grid; place-items: center; text-shadow: 0 0 2px rgba(0,0,0,.8); flex: none; }
@media (max-width: 700px) { .legend { max-height: 45%; } }

/* ==== Habillage inspiré de la plateforme TEKSAT (Minton) : barre indigo, menu latéral blanc, cartes à ombre légère ==== */
.app { height: 100%; display: flex; flex-direction: column; }
header.top { background: var(--brand, #3f51b5); color: #fff; border: 0; height: calc(64px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0;
  gap: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.18); flex: none; }
header.top .brand { color: #fff; font-size: 19px; font-weight: 500; letter-spacing: .2px; min-width: 0; overflow: hidden; }
header.top .brand span { overflow: hidden; text-overflow: ellipsis; }
header.top .brand-logo.small { max-height: 42px; max-width: 170px; }
.top-fill { flex: 1; }
.top-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; min-height: 42px; padding: 6px 12px; border-radius: 4px; font-weight: 500; white-space: nowrap; }
.top-btn:hover, .top-btn:focus-visible { background: rgba(255,255,255,.14); }
.top-btn.account { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.top-btn.veh-chip { background: rgba(255,255,255,.16); }
.top-btn.veh-chip i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }
:focus-visible { outline-color: var(--accent); }
header.top :focus-visible { outline-color: #fff; }

.shell { flex: 1; display: flex; min-height: 0; }
.side { width: 260px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; z-index: 900; }
.side-profile { display: grid; justify-items: center; gap: 4px; padding: 26px 16px 20px; text-align: center;
  background: linear-gradient(155deg, color-mix(in srgb, var(--fg) 7%, var(--surface)) 0 46%, color-mix(in srgb, var(--fg) 3%, var(--surface)) 46% 62%, var(--surface) 62%); border-bottom: 1px solid var(--line); }
.side-avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--brand, #3f51b5); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 500;
  border: 4px solid var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.25); margin-bottom: 6px; position: relative; }
.side-avatar::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2px solid var(--surface); }
.side-profile strong { font-size: 15.5px; font-weight: 500; }
.side-profile small { font-size: 12.5px; color: var(--muted); }
.side-nav { display: grid; padding: 6px 0; }
.side-nav button { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; border-left: 3px solid transparent; background: none; color: var(--fg);
  padding: 13px 22px; font-size: 15px; text-align: left; letter-spacing: .1px; }
.side-nav button:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.side-nav button[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 500; }
.side-nav .count { margin-left: auto; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { margin-top: auto; padding: 12px 18px 16px; display: grid; justify-items: start; gap: 2px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.side-foot .btn.link { justify-self: start; padding: 2px 0; min-height: 0; font-size: 12.5px; }
.side-shade { position: fixed; inset: 0; background: rgba(8,12,20,.45); z-index: 890; }
body.side-mini .side { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 28px 16px;
  background: color-mix(in srgb, var(--surface) 55%, var(--bg)); border-bottom: 1px solid var(--line); flex: none; }
.pagehead h1 { margin: 0; font-size: 26px; font-weight: 300; color: color-mix(in srgb, var(--fg) 80%, var(--bg)); line-height: 1.2; }
.pagehead small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.crumb { display: flex; gap: 8px; align-items: center; font-size: 14.5px; background: var(--surface); padding: 6px 14px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.crumb span:first-child { color: var(--accent); }
.crumb .sep { color: var(--muted); }
.view { padding: 24px 28px 96px; }
.view > .wrap { max-width: 1240px; gap: 20px; }
.view.wide > .wrap { max-width: 1680px; }
.page-head { justify-content: flex-end; }
.ph-fill { flex: 1; }

/* Cartes, panneaux, tableaux */
.panel, .card, .scroll-x, .kpi, .empty, .inbox, .banner, .tile { border-radius: 4px; }
.panel, .scroll-x, .kpi { border: 0; box-shadow: 0 1px 4px rgba(15,23,42,.08), 0 0 0 1px rgba(15,23,42,.03); }
.panel { padding: 20px; gap: 14px; }
.panel > h2, .panel-head h2 { font-size: 17px; font-weight: 500; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.card { border: 0; box-shadow: 0 1px 4px rgba(15,23,42,.08), 0 0 0 1px rgba(15,23,42,.03), inset 5px 0 0 var(--stripe, transparent); }
.card:hover { box-shadow: 0 3px 10px rgba(15,23,42,.12), 0 0 0 1px rgba(15,23,42,.04), inset 5px 0 0 var(--stripe, transparent); }
.scroll-x.flat { box-shadow: none; border: 1px solid var(--line); }
.tbl th { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--fg); font-weight: 600; border-bottom: 2px solid var(--line); padding: 14px 12px; }
.tbl td { padding: 13px 12px; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--fg) 2.5%, transparent); }
.btn { border-radius: 4px; }
.btn.primary { box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: color-mix(in srgb, var(--accent) 85%, #000); }
input, select, textarea { border-radius: 4px; }
.filters, .act-filters { background: var(--surface); padding: 14px; border-radius: 4px; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.pill { border-radius: 4px; }
dialog#dlg { border-radius: 6px; }
.dlg-head h2 { color: var(--accent); font-weight: 500; }
.legend { border-radius: 4px; border: 0; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
dialog#dlg.nudge { animation: nudge .22s ease 2; }

/* Tableau de bord : tuiles colorées et listes */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.tile { display: grid; grid-template-columns: 76px 1fr; border: 0; padding: 0; overflow: hidden; color: #fff; text-align: left; min-height: 84px; cursor: pointer;
  background: var(--tc); box-shadow: 0 3px 8px rgba(0,0,0,.16); transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.2); }
.tile-ico { display: grid; place-items: center; background: rgba(0,0,0,.16); }
.tile-ico .ico { width: 34px; height: 34px; stroke-width: 1.7; }
.tile-body { display: grid; align-content: center; gap: 1px; padding: 10px 16px; min-width: 0; }
.tile-body strong { font-size: 27px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-body span { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
.tile-body small { font-size: 12.5px; opacity: .88; }
.t-blue { --tc: #3f51b5; } .t-purple { --tc: #6a3ab2; } .t-teal { --tc: #00897b; } .t-orange { --tc: #ef8a00; } .t-sky { --tc: #1e88e5; }
/* Cinq encadrés (avec les capteurs) : une seule rangée sur grand écran, icône plus étroite */
.tiles.five { grid-template-columns: repeat(5, 1fr); gap: 16px; }
.tiles.five .tile { grid-template-columns: 62px 1fr; }
.tiles.five .tile-ico .ico { width: 30px; height: 30px; }
.tiles.five .tile-body { padding: 12px 14px; }
.tiles.five .tile-body span { font-size: 13px; }
.tile-body small b { font-weight: 600; }
@media (max-width: 1150px) and (min-width: 601px) { .tiles.five { grid-template-columns: repeat(3, 1fr); } }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #e53935; margin-right: 4px; }
.dot.on { background: #22c55e; }

@media (max-width: 1200px) and (min-width: 601px) { .tiles, .tiles.five { grid-template-columns: repeat(2, 1fr); } .tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .side { position: fixed; top: calc(64px + env(safe-area-inset-top, 0px)); bottom: 0; left: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 18px rgba(0,0,0,.2); }
  body.side-open .side { transform: none; }
  body.side-mini .side { display: flex; }
  .pagehead { padding: 12px 16px; }
  .pagehead h1 { font-size: 21px; }
  .crumb { display: none; }
  .view { padding: 14px 12px 96px; }
}
@media (max-width: 600px) {
  .tiles, .tiles.five { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile, .tiles.five .tile { grid-template-columns: 1fr; min-height: 0; }
  .tiles.five .tile-body { padding: 8px 12px 12px; } .tiles.five .tile-ico .ico { width: 28px; height: 28px; }
  .tile-ico { padding: 8px 0; } .tile-ico .ico { width: 28px; height: 28px; }
  .tile-body { padding: 8px 12px 12px; } .tile-body strong { font-size: 24px; } .tile-body span { font-size: 12px; }
  header.top .brand span { display: none; }
  header.top .brand { flex-shrink: 0; }
  header.top .brand-logo.small { max-width: 92px; max-height: 34px; }
  .top-btn.veh-chip { max-width: 112px; padding-inline: 8px; overflow: hidden; text-overflow: ellipsis; }
  .top-btn.account { max-width: 110px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-btn { padding: 6px 8px; }
}

/* ---- Tableau de bord : carte ; rapports d'activité : boutons de ligne, onglets, carte des trajets */
.dash-map { height: 380px; border-radius: 4px; z-index: 0; }
.act-filters { gap: 10px; }
.act-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.act-tbl td, .act-tbl th { vertical-align: middle; }
.act-tbl th { font-size: 13px; line-height: 1.3; }
.tbl .act-btns { width: 1%; white-space: nowrap; }
.sq-btn { display: inline-grid; place-items: center; width: 44px; height: 34px; border: 0; border-radius: 3px; color: #fff; margin: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sq-btn .ico { width: 17px; height: 17px; }
.sq-btn:hover { filter: brightness(1.08); }
.sq-green { background: #4caf50; } .sq-orange { background: #ff9800; }
.addr-cell { font-size: 13px; min-width: 180px; max-width: 320px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-family: var(--mono); font-size: 12.5px; text-decoration: underline; cursor: pointer; }
dialog#dlg.wide { width: min(1400px, calc(100vw - 16px)); }
.act-sum { gap: 18px; font-size: 14px; }
.dtabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); gap: 0; }
.dtabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--sunk); color: var(--fg); padding: 10px 18px; font-weight: 500; margin-right: -1px; border-radius: 3px 3px 0 0; }
.dtabs button[aria-selected="true"] { background: var(--surface); position: relative; top: 1px; }
.leg-map { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; }
.leg-map .mini-map.tall { height: 520px; }
.leg-list { display: grid; align-content: start; gap: 0; max-height: 520px; overflow-y: auto; border: 1px solid var(--line); border-radius: 4px; }
.leg-head { padding: 10px 14px; font-weight: 500; border-bottom: 1px solid var(--line); background: var(--sunk); }
.leg-item { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 10px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.leg-item input { width: auto; min-height: 0; margin-top: 2px; }
.leg-item > b { color: var(--muted); font-weight: 500; }
.leg-item > span { display: grid; gap: 1px; min-width: 0; }
.leg-item small { color: var(--muted); font-size: 12px; }
.leg-item:has(input:checked) { background: color-mix(in srgb, var(--accent) 7%, transparent); }
@media (max-width: 900px) { .leg-map { grid-template-columns: 1fr; } .leg-map .mini-map.tall { height: 360px; } .act-presets { margin-left: 0; } .dash-map { height: 300px; } }
/* Une colonne de grille ne doit jamais s'élargir à la taille d'un tableau : c'est le cadre du tableau qui défile */
.view > .wrap { grid-template-columns: minmax(0, 1fr); }
.view > .wrap > *, .panel > * { min-width: 0; }

/* ---- Tableau de bord : carte du jour et véhicules en direct (à droite) */
.dash2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr); gap: 22px; align-items: start; }
.dash2 .dash-map { height: calc(100vh - 330px); min-height: 420px; }
.vc-panel .panel-head input { width: 160px; min-height: 34px; padding: 5px 10px; }
.vc-list { display: grid; gap: 10px; max-height: calc(100vh - 340px); min-height: 300px; overflow-y: auto; padding-right: 2px; }
.vcard2 { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 0; background: var(--surface); }
.vcard2[data-vcard] { cursor: pointer; transition: background .15s, box-shadow .15s; }
.vcard2[data-vcard]:hover { background: color-mix(in srgb, var(--c) 6%, var(--surface)); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.vcard2[data-vcard]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vcard2 header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vcard2 header small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.vc-name { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; }
.vc-name:hover { text-decoration: underline; }
.vc-new { margin-left: auto; min-height: 30px; padding: 3px 10px; font-size: 12.5px; }
.vc-state { font-size: 13.5px; }
.vc-addr { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-mission { display: grid; gap: 3px; width: 100%; text-align: left; border: 0; border-radius: 3px; padding: 8px 10px 8px 14px; cursor: pointer; color: var(--fg);
  background: color-mix(in srgb, var(--stripe) 14%, var(--surface)); box-shadow: inset 4px 0 0 var(--stripe); }
.vc-mission:hover { background: color-mix(in srgb, var(--stripe) 22%, var(--surface)); }
.vc-mission strong { font-weight: 500; font-size: 14px; }
.vc-mission small { font-size: 12.5px; }
.vc-mtop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vc-none { font-size: 13px; padding: 6px 0 2px; }
.tm { font-size: 12.5px; font-weight: 500; }
.late-t { color: var(--danger); } .ok-t { color: var(--ok); }
@media (max-width: 1100px) { .dash2 { grid-template-columns: 1fr; } .vc-list { max-height: none; } .dash2 .dash-map { height: 340px; min-height: 0; } }

/* ---- Planning : sélecteur de vue et tournée du jour (liste ordonnée + carte) */
.seg-sw { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--surface); }
.seg-sw button { border: 0; background: none; padding: 8px 16px; font-weight: 500; color: var(--muted); }
.seg-sw button + button { border-left: 1px solid var(--line); }
.seg-sw button[aria-selected="true"] { background: var(--accent); color: var(--accent-fg); }
.th-day { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.tour { display: grid; grid-template-columns: minmax(340px, 1fr) minmax(0, 1.5fr); gap: 20px; align-items: start; }
.tour-list { display: grid; gap: 12px; max-height: calc(100vh - 260px); overflow-y: auto; padding-right: 2px; }
.tour-all { border: 1px dashed var(--line); background: var(--surface); border-radius: 4px; padding: 9px 12px; text-align: left; font-weight: 500; color: var(--fg); }
.tour-all.on { border: 1px solid var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.tg { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c); padding: 10px 12px; display: grid; gap: 6px; }
.tg.on { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent); }
.tg.over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.tg-head { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; text-align: left; color: var(--fg); font: inherit; cursor: pointer; }
.tg-head small { margin-left: auto; font-size: 12px; }
.tg-start { font-size: 12px; }
.tg-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tg-leg { font-size: 11.5px; color: var(--muted); padding-left: 38px; }
.ti { display: grid; grid-template-columns: 26px 92px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 3px;
  background: color-mix(in srgb, var(--stripe) 9%, var(--surface)); box-shadow: inset 3px 0 0 var(--stripe); }
.ti[draggable=true] { cursor: grab; }
.ti-n { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; text-shadow: 0 0 2px rgba(0,0,0,.6); }
.ti-time { min-height: 32px; padding: 3px 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ti-body { display: grid; border: 0; background: none; padding: 0; text-align: left; color: var(--fg); font: inherit; cursor: pointer; min-width: 0; }
.ti-body strong { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-body small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-body:hover strong { text-decoration: underline; }
.ti-empty { font-size: 12.5px; padding: 6px 2px; }
.tour-map-panel { padding: 10px; position: sticky; top: 0; }
.tour-map { height: calc(100vh - 300px); min-height: 420px; border-radius: 4px; z-index: 0; }
.sigpin.stop { width: 26px; height: 26px; }
.sigpin.stop span { font-size: 12px; }
.sigpin.faded { opacity: .35; }
@media (max-width: 1100px) { .tour { grid-template-columns: 1fr; } .tour-list { max-height: none; } .tour-map { height: 360px; min-height: 0; } .tour-map-panel { position: static; } }
@media (max-width: 600px) { .ti { grid-template-columns: 24px 84px minmax(0, 1fr); } .ti > .pill { grid-column: 3; justify-self: start; } }

/* ---- Planning : agenda du jour (une colonne par véhicule, heures de haut en bas) */
.grid4 { display: grid; grid-template-columns: 1.4fr 1fr .8fr 1fr; gap: 12px; }
.grid4 > * { min-width: 0; }
@media (max-width: 700px) { .grid4 { grid-template-columns: 1fr 1fr; } .grid4 > :first-child { grid-column: 1 / -1; } }
.ag-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 420px; background: var(--surface); border-radius: 4px; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.ag { display: grid; grid-template-columns: 58px repeat(var(--n), minmax(170px, 1fr)); min-width: max-content; position: relative; }
.ag-corner, .ag-colh { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.ag-colh { display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 44px; box-sizing: border-box; border-left: 1px solid var(--line); border-top: 3px solid var(--c); font-size: 13.5px; min-width: 0; }
.ag-colh strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ag-colh small { margin-left: auto; font-size: 11.5px; white-space: nowrap; }
.ag-corner { left: 0; z-index: 4; height: 44px; }
.ag-ut-h { position: sticky; top: 44px; left: 0; z-index: 4; font-size: 11px; color: var(--muted); padding: 6px 4px; text-align: right; background: var(--sunk); border-bottom: 1px solid var(--line); }
.ag-ut { position: sticky; top: 44px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; min-height: 38px; padding: 5px; background: var(--sunk); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ag-chip { font-size: 12px; padding: 3px 7px; border-radius: 3px; background: color-mix(in srgb, var(--stripe) 16%, var(--surface)); box-shadow: inset 3px 0 0 var(--stripe); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ag-hours { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); }
.ag-hours span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-hours span:first-child { transform: none; }
.ag-col { position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--hour) / 2), color-mix(in srgb, var(--line) 45%, transparent) calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px) var(--hour)); }
.ag-col.over, .ag-ut.over { background-color: color-mix(in srgb, var(--accent) 8%, transparent); }
.ag-ev { position: absolute; margin-left: 2px; padding: 3px 6px 6px 8px; border-radius: 4px; overflow: hidden; display: grid; align-content: start; gap: 1px; cursor: pointer;
  background: color-mix(in srgb, var(--stripe) 18%, var(--surface)); box-shadow: inset 4px 0 0 var(--stripe), 0 1px 2px rgba(0,0,0,.12); font-size: 12px; line-height: 1.3; z-index: 1; }
.ag-ev:hover { z-index: 2; box-shadow: inset 4px 0 0 var(--stripe), 0 3px 8px rgba(0,0,0,.2); }
.ag-ev.mv, .ag-chip.mv { cursor: grab; touch-action: none; user-select: none; }
.ag-ev strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-ev small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.ag-ev .ag-st { color: var(--fg); opacity: .8; }
.ag-rs { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ag-rs::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: color-mix(in srgb, var(--stripe) 70%, #000); opacity: .45; }
.ag-ev.dragging { opacity: .45; }
.ag-ghost { z-index: 3000; pointer-events: none; opacity: .92; box-shadow: 0 8px 22px rgba(0,0,0,.3); }
.ag-now { position: absolute; left: 0; right: 0; height: 2px; background: #e53935; z-index: 2; pointer-events: none; }
.ag-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e53935; }

/* Bouton « Centrer sur la flotte » des cartes */
.map-ctl { box-shadow: 0 2px 8px rgba(0,0,0,.2); gap: 6px; background: var(--surface); }
.map-ctl .ico { width: 16px; height: 16px; }

/* ---- Alerte du chauffeur (mission reçue en direct) et invitation à activer les notifications */
.live-alert { position: fixed; z-index: 3500; left: 50%; top: calc(74px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); width: min(520px, calc(100vw - 20px));
  display: flex; gap: 10px; align-items: center; padding: 14px 14px 14px 18px; border-radius: 6px; background: var(--surface); color: var(--fg);
  border-left: 6px solid var(--accent); box-shadow: 0 10px 30px rgba(0,0,0,.28); animation: la-in .25s ease; }
.live-alert.new { border-left-color: var(--st-progress); } .live-alert.removed { border-left-color: var(--danger); }
.live-alert > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
.live-alert strong { font-size: 16px; }
.live-alert span { font-size: 14px; color: var(--muted); }
@keyframes la-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.banner.push-inv { border-color: var(--accent); }
.banner.push-inv small { color: var(--muted); }

/* ---- Agenda : filtre des véhicules affichés */
.ag-filter { position: relative; }
.ag-filter > summary { list-style: none; cursor: pointer; }
.ag-filter > summary::-webkit-details-marker { display: none; }
.ag-fpanel { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 300px; max-width: calc(100vw - 32px); display: grid; gap: 8px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.ag-fpanel .row { gap: 6px; }
.ag-fq { min-height: 34px; padding: 5px 10px; }
.ag-flist { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; }
.ag-fi { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 3px; cursor: pointer; font-size: 14px; }
.ag-fi:hover { background: var(--sunk); }
.ag-fi input { width: auto; min-height: 0; }
.ag-fi span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Assistant IA : bulle et fenêtre de conversation */
.ai-fab { position: fixed; z-index: 1200; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 99px; padding: 12px 18px; background: var(--accent); color: var(--accent-fg); font-weight: 600; font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.ai-fab:hover { filter: brightness(1.07); }
.ai-panel { position: fixed; z-index: 1300; right: 20px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: min(420px, calc(100vw - 24px)); height: min(600px, calc(100dvh - 120px));
  display: flex; flex-direction: column; background: var(--surface); border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.3); overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.ai-head strong { font-size: 15px; } .ai-head small { flex: 1; font-size: 12px; min-width: 0; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-msg ul { margin: 4px 0; padding-left: 18px; }
.ai-me { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 3px; white-space: pre-wrap; }
.ai-bot { align-self: flex-start; background: var(--sunk); border-bottom-left-radius: 3px; }
.ai-typing { color: var(--muted); font-style: italic; }
.ai-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-sugg .btn { font-size: 12.5px; min-height: 30px; padding: 4px 10px; text-align: left; }
.ai-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-form textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; }
.ai-quota { display: grid; gap: 6px; align-content: center; font-size: 13.5px; }
.ai-bar { display: block; height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.ai-bar i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 600px) { .ai-fab span { display: none; } .ai-fab { padding: 13px 15px; } .ai-panel { right: 12px; left: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }

/* ---- Capteurs (entrées 2 à 4 TEKSAT) : pastilles en direct, colonne du rapport, onglet « Capteurs » */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sq-blue { background: #2b65ee; }
.sens-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sens-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--sunk); color: var(--muted); border: 1px solid var(--line); transition: background .3s, color .3s; }
.sens-chip .ico { width: 14px; height: 14px; }
.sens-chip.on { background: #2b65ee; color: #fff; border-color: #2b65ee; box-shadow: 0 0 0 3px color-mix(in srgb, #2b65ee 22%, transparent); }
.sens-cell { white-space: nowrap; }
.sens-sum1 { display: block; font-size: 13px; } .sens-sum1 b { font-weight: 600; }
.sens-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 12px 0; }
.sens-card { border: 1px solid var(--line); border-left: 4px solid #2b65ee; border-radius: var(--r); padding: 10px 14px; background: var(--surface); }
.sens-card h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 15px; }
.sens-card h3 .ico { width: 17px; height: 17px; color: #2b65ee; }
.sens-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; font-size: 13px; }
.sens-card dt { color: var(--muted); } .sens-card dd { margin: 0; font-variant-numeric: tabular-nums; }
#sens-map { margin-bottom: 10px; }
.sens-tbl td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sens-tbl tr.sel td { background: color-mix(in srgb, #2b65ee 10%, var(--surface)); }
@media (max-width: 600px) {
  /* Téléphone : chaque utilisation devient une petite carte */
  .sens-tbl thead { display: none; }
  .sens-tbl, .sens-tbl tbody, .sens-tbl tr, .sens-tbl td { display: block; width: 100%; }
  .sens-tbl tr { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; padding: 6px 60px 6px 10px; position: relative; background: var(--surface); }
  .sens-tbl td, .tbl.sens-tbl tbody tr:nth-child(even) td { border: 0; padding: 2px 0; text-align: left; background: transparent; }
  .sens-tbl td[data-l]::before { content: attr(data-l) " : "; color: var(--muted); font-size: 12px; }
  .sens-tbl td.r { display: inline-block; width: auto; margin-right: 12px; }
  .sens-tbl td.act-btns { position: absolute; top: 4px; right: 4px; width: auto; }
  .sens-cell { white-space: normal; }
}

/* ---- Options de l'entreprise : sans gestion des missions, tout ce qui s'y rapporte est masqué */
body.no-missions .opt-missions { display: none !important; }

/* ---- Fenêtre d'un véhicule : position en direct */
.vw-live { display: flex; align-items: flex-start; gap: 12px; margin: 12px 0 10px; flex-wrap: wrap; }
.vw-state { flex: 1; min-width: 220px; display: grid; gap: 4px; font-size: 14px; }
.vw-state .sens-row { margin-top: 2px; }
.vw-follow { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.vw-follow input { width: auto; min-height: 0; }
#vw-map.tall { height: min(520px, 60vh); }
/* Onglets des fenêtres : intitulé complet sur ordinateur ; sur téléphone, grille d'icônes avec intitulé court (tout est visible, rien à faire glisser) */
.dtabs button .ico, .dtabs button .ts { display: none; }
@media (max-width: 700px) {
  .dtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border: 0; min-height: min-content; }
  .dtabs.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dtabs.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .dtabs button { display: grid; justify-items: center; gap: 3px; padding: 8px 2px 7px; margin: 0; min-height: 0; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; top: 0 !important; }
  .dtabs button .ico { display: block; width: 20px; height: 20px; }
  .dtabs button .tl { display: none; } .dtabs button .ts { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dtabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
}
/* Petite carte d'un trajet : seulement sur téléphone, sous la carte de texte du trajet */
.tbl td.m-map { display: none; }
@media (max-width: 700px) {
  .tbl.mcards td.m-map { display: block; grid-column: 1 / -1; order: 98; }
  .leg-mini { height: 140px; border-radius: 8px; border: 1px solid var(--line); z-index: 0; }
}
/* Téléphone et tablette : pas de carte sur l'accueil (la cartographie est dans la barre du bas) */
@media (max-width: 900px) { .dash-map-panel { display: none; } }
.sens-only { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }

/* ================================================================ Téléphone : barre de navigation en bas, encadrés compacts, rapports en cartes */
.bnav { display: none; }
@media (max-width: 900px) {
  .bnav { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); position: fixed; z-index: 1150; left: 0; right: 0; bottom: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 24px -12px rgba(0,0,0,.18); }
  .bnav button { position: relative; border: 0; background: none; display: grid; justify-items: center; gap: 2px; font: inherit; font-size: 11px; font-weight: 600;
    color: var(--muted); padding: 2px 0; min-width: 0; min-height: 0; -webkit-tap-highlight-color: transparent; }
  .bnav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bnav .ico { width: 22px; height: 22px; padding: 4px 14px; box-sizing: content-box; border-radius: 99px; transition: background .15s, transform .15s; }
  .bnav button:active .ico { transform: scale(.92); }
  .bnav button[aria-current="page"] { color: var(--accent); }
  .bnav button[aria-current="page"] .ico { background: var(--accent-soft); }
  .bn-badge { position: absolute; top: -2px; left: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 99px; background: #e53935; color: #fff; font-size: 10.5px;
    font-weight: 700; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--surface); }
  /* Le menu complet s'ouvre par « Menu » : plus de bouton ☰ en haut ; le contenu laisse la place à la barre */
  #btn-menu { display: none; }
  .side { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .shell { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .view { padding-bottom: 88px; }
  .ai-fab { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .ai-panel { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); height: min(560px, calc(100dvh - 210px)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 600px) {
  /* Encadrés du tableau de bord : petits, trois par ligne (deux par ligne s'il y en a quatre) */
  .tiles, .tiles.five { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tiles.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.n5 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .tiles.n5 > .tile { grid-column: span 2; } .tiles.n5 > .tile:nth-child(n+4) { grid-column: span 3; }
  .tile, .tiles.five .tile { grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; min-height: 0; border-radius: 10px; padding: 9px 10px; gap: 2px 6px; }
  .tile-ico, .tiles.five .tile-ico { background: none; padding: 0; grid-row: 1; }
  .tile-ico .ico, .tiles.five .tile-ico .ico { width: 18px; height: 18px; stroke-width: 2; opacity: .9; }
  .tile-body, .tiles.five .tile-body { display: contents; }
  .tile-body strong { grid-row: 1; grid-column: 2; font-size: 21px; font-weight: 500; }
  .tile-body span, .tiles.five .tile-body span { grid-row: 2; grid-column: 1 / -1; font-size: 10.5px; letter-spacing: .2px; line-height: 1.2; }
  .tile-body small { display: none; }
  .tile:hover { transform: none; }
}
@media (max-width: 700px) {
  /* Rapports : une carte par ligne de tableau ; les intitulés des colonnes passent au-dessus des valeurs */
  .scroll-x:has(> table.mcards) { overflow: visible; border: 0; background: none; box-shadow: none; }
  table.mcards thead { display: none; }
  table.mcards, table.mcards tbody { display: block; width: 100%; }
  table.mcards tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .tbl.mcards td { display: block; grid-column: 1 / -1; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; }
  .tbl.mcards tbody tr:nth-child(even) td, .tbl.mcards tbody tr:nth-child(odd) td { background: transparent; }
  .tbl.mcards td.r { grid-column: span 2; text-align: left; font-variant-numeric: tabular-nums; }
  .tbl.mcards td.m-half { grid-column: span 3; font-weight: 600; font-size: 15px; }
  table.mcards td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; font-weight: 500; }
  table.mcards td.m-half::before, table.mcards td.act-btns::before { display: none; }
  .tbl.mcards td.act-btns { order: 99; display: flex; flex-direction: row; gap: 8px; flex-wrap: wrap; width: auto; border-top: 1px solid var(--line); padding-top: 10px; }
  .tbl.mcards td.act-btns .sq-btn { margin: 0; }
  table.mcards td.act-btns:empty { display: none; }
  .tbl.mcards td.m-empty { display: none; }
  .tbl.mcards td[colspan] { grid-column: 1 / -1; }
}

/* ================================================================ Relevés terrain */
.rl-card { grid-template-columns: 72px 1fr; align-items: start; }
.rl-thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; display: block; background: var(--sunk); }
.rl-thumb.none { display: grid; place-items: center; font-size: 24px; color: var(--muted); }
.rl-body { display: grid; gap: 3px; min-width: 0; }
.rl-body strong { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rl-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-top { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.rl-new { width: 100%; justify-content: center; gap: 10px; min-height: 64px; font-size: 18px; border-radius: 14px; }
.rl-new .ico { width: 26px; height: 26px; }
.rl-h { font-size: 17px; font-weight: 600; margin: 8px 0 0; }
.rl-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr); gap: 16px; align-items: start; }
.rl-mappanel { padding: 0; overflow: hidden; position: sticky; top: 0; }
.rl-map { height: min(620px, 70vh); z-index: 0; }
.rl-gps { align-items: center; gap: 10px; }
.rl-addr { font-size: 14px; min-height: 20px; }
.rl-cats .chip { border: 0; background: none; padding: 0; cursor: pointer; }
.rl-cats .chip.on span { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rl-desc { white-space: pre-wrap; font-size: 15px; margin: 0; }
.rl-mis { display: block; grid-template-columns: none; }
@media (max-width: 900px) { .rl-split { grid-template-columns: 1fr; } .rl-mappanel { position: static; } .rl-map { height: 280px; } }

/* ================================================================ Réservation de véhicules */
.rs-card { grid-template-columns: 14px 1fr; align-items: start; }
.rs-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.my-resa { display: grid; gap: 12px; border-left: 5px solid var(--c); }
.my-head { display: flex; gap: 12px; align-items: center; }
.my-head h2 { margin: 0; font-size: 20px; }
.rs-badge { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.rs-badge .ico { width: 26px; height: 26px; }
.my-actions .btn { justify-content: center; min-height: 54px; }
.btn.big { min-height: 50px; font-size: 16px; padding-inline: 18px; gap: 8px; }
.rs-seg2 { grid-template-columns: repeat(2, 1fr); }
.rs-sum { font-size: 14px; padding: 8px 12px; background: var(--sunk); border-radius: 8px; }
.rs-picks { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.rs-pick { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid var(--c, var(--line));
  border-radius: 10px; background: var(--surface); cursor: pointer; }
.rs-pick input { width: auto; min-height: 0; }
.rs-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.rs-pick.busy { opacity: .65; cursor: default; }
.rs-pick.auto { grid-template-columns: auto 1fr; border-style: dashed; }
.rs-pick > div:first-child:not(:has(input)) { grid-column: 1 / 3; }
.rs-week td, .rs-week th { vertical-align: top; min-width: 120px; }
.rs-week th.today { color: var(--accent); }
.rs-cell { cursor: pointer; }
.rs-cell:hover { background: var(--accent-soft); }
.rs-bar { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 4px 6px 4px 9px; margin-bottom: 4px; font-size: 12px; background: var(--sunk);
  box-shadow: inset 4px 0 0 var(--stripe); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-veh { grid-template-columns: 14px 1fr auto; align-items: start; }
@media (max-width: 700px) { .rs-veh { grid-template-columns: 14px 1fr; } .rs-veh > .row { grid-column: 1 / -1; } .rs-week td, .rs-week th { min-width: 96px; } }
.filters.f3 { grid-template-columns: 2fr 1fr 1fr; } @media (max-width: 700px) { .filters.f3 { grid-template-columns: 1fr; } }

/* ================================================================ Statistiques (réservations, relevés) : repris de RESACAR, préfixe sx- */
.sx-filters { gap: 10px; }
.sx-pers { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-pers .btn[aria-pressed="true"], .sx-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.sx-frow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sx-frow > select { width: auto; min-width: 170px; max-width: 100%; }
.sx-frow label.f.inline { display: inline-flex; align-items: center; gap: 6px; }
.sx-frow label.f.inline input { width: auto; }
.sx-exp { display: flex; gap: 6px; }
.sx-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.sx-kpis .kpi.sx-warn strong { color: var(--warn); }
.sx-ins ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sx-ins li { padding: 8px 12px 8px 30px; border-radius: 6px; background: var(--sunk); position: relative; font-size: 14px; }
.sx-ins li::before { position: absolute; left: 10px; top: 8px; font-weight: 700; }
.sx-ins li.sx-warn::before { content: "!"; color: var(--warn); }
.sx-ins li.sx-info::before { content: "i"; color: var(--info); font-style: italic; }
.sx-ins li.sx-ok::before { content: "✓"; color: var(--ok); }
.sx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: start; }
.sx-card.sx-wide { grid-column: 1 / -1; }
.sx-card .panel-head small { font-size: 12px; }
.sx-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sx-seg button { border: 0; background: var(--surface); padding: 5px 12px; font-size: 13px; }
.sx-seg button + button { border-left: 1px solid var(--line); }
.sx-hb { display: grid; gap: 7px; }
.sx-hb > div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.sx-hb > div[data-vfiche] { cursor: pointer; }
.sx-hb > div[data-vfiche]:hover .sx-hl { text-decoration: underline; }
.sx-hl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-hl small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.sx-ht { height: 12px; background: var(--sunk); border-radius: 6px; overflow: hidden; }
.sx-ht i { display: block; height: 100%; border-radius: 6px; }
.sx-hb b { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.sx-bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 18px; }
.sx-bars > div { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.sx-bars i { display: block; width: 100%; max-width: 46px; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 3px 3px 0 0; }
.sx-bars i.hl { background: var(--accent); }
.sx-bars b { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-bars span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sx-bars.dense b { display: none; }
.sx-bars.dense span { font-size: 9.5px; writing-mode: vertical-rl; transform: rotate(180deg); }
.sx-stack { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; }
.sx-stack i { display: block; min-width: 3px; }
.sx-stack-leg { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; }
.sx-stack-leg span { display: inline-flex; align-items: center; gap: 6px; }
.sx-stack-leg i { width: 10px; height: 10px; border-radius: 3px; }
.sx-heat { display: grid; grid-template-columns: 38px repeat(var(--cols), minmax(0, 1fr)); gap: 3px; font-size: 11px; }
.sx-heat .sx-hh { text-align: center; color: var(--muted); }
.sx-heat .sx-hd { color: var(--muted); align-self: center; }
.sx-heat i { font-style: normal; height: 30px; border-radius: 4px; display: grid; place-items: center; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--accent) calc(var(--a) * 85% + 4%), var(--sunk)); color: var(--fg); }
.sx-kv { grid-template-columns: minmax(150px, 40%) 1fr; }
.sx-tbl .sx-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.sx-tbl td.late { color: var(--danger); font-weight: 600; }
.sx-tbl td:first-child, .sx-tbl td.r { white-space: nowrap; }
.sx-occ { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--sunk); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.sx-occ i { display: block; height: 100%; background: var(--accent); }
.sx-print-head { display: none; }
@media (max-width: 700px) {
  .sx-hb > div { grid-template-columns: minmax(90px, 42%) 1fr auto; }
  .sx-heat { font-size: 9px; grid-template-columns: 30px repeat(var(--cols), minmax(0, 1fr)); gap: 2px; }
  .sx-heat i { height: 24px; font-size: 0; }
  .sx-exp { width: 100%; } .sx-exp .btn { flex: 1; }
}

/* Impression et PDF (Statistiques) : seul le rapport est imprimé, en couleurs */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  /* Toujours en thème clair sur papier (:not(#_p) l'emporte sur les règles du thème sombre) */
  :root:not(#_p) { --bg: #fff; --surface: #fff; --sunk: #f1f3f5; --fg: #222; --muted: #666; --line: #ddd; --accent: var(--brand, #3f51b5); --accent-fg: #fff;
    --warn: #b54708; --ok: #15803d; --info: #1d4ed8; --vs-alert: #dc2626; --rs-next: #2563eb; --rs-due: #ca8a04; --rs-busy: #7c3aed; --rs-late: #dc2626; --rs-done: #16a34a; --rs-none: #6b7280; color-scheme: light; }
  html, body { height: auto; background: #fff; }
  body { font-size: 11.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .top, .side, .side-shade, .pagehead, .acting, #map-wrap, .sx-filters, .ai-fab, .ai-panel, .toast, dialog { display: none !important; }
  .app, .shell, .main-col, .view { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; background: #fff; }
  .view > .wrap { max-width: none !important; gap: 10px; }
  .sx-print-head { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid #3f51b5; padding-bottom: 8px; margin-bottom: 4px; }
  .sx-print-head img { height: 40px; width: auto; }
  .sx-print-head div { display: grid; gap: 1px; }
  .sx-print-head strong { font-size: 16px; }
  .sx-print-head span { color: #555; font-size: 12px; }
  .panel, .kpi, .scroll-x { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .panel { padding: 10px 12px; gap: 8px; }
  .panel-head h2 { font-size: 13.5px; }
  .sx-kpis { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .kpi { padding: 7px 9px; } .kpi strong { font-size: 18px; }
  .sx-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sx-bars { height: 130px; }
  .sx-seg, .sx-tblp .panel-head small { display: none; }
  .sx-tblp { break-inside: auto; }
  .tbl th, .tbl td { padding: 4px 6px; font-size: 10.5px; }
  .tbl thead { display: table-header-group; }
  .tbl tr { break-inside: avoid; }
  .scroll-x { overflow: visible !important; }
}
@media print { .bnav, #acting, .acting, .live-alert, #push-invite { display: none !important; } }

.rl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-chips .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.rlsx-map { height: 380px; border-radius: 8px; }
@media print { .rlsx-map { height: 300px; } }

/* Menu latéral : sous-rubrique (Statistiques sous Réservations et Relevés terrain) */
.side-nav button.sub { padding-left: 44px; font-size: 13.5px; min-height: 0; padding-block: 8px; color: var(--muted); }
.side-nav button.sub .ico { width: 16px; height: 16px; }
.side-nav button.sub[aria-current="page"] { color: var(--accent); }

/* Menu latéral : rubrique à sous-menu (chevron), sous-menu ouvert seulement quand la rubrique est active */
.side-nav button.has-sub::after { content: "›"; margin-left: auto; font-size: 18px; line-height: 1; color: var(--muted); transition: transform .15s; }
.side-nav button.has-sub[aria-expanded="true"]::after { transform: rotate(90deg); }
.side-nav button.has-sub .count { margin-left: auto; } .side-nav button.has-sub .count + * { margin-left: 6px; }
/* Réservations : filtres, calendrier (semaine, agenda, mois), parc en cartes */
.rs-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rs-filters > input[type=search] { flex: 1 1 260px; width: auto; }
.rs-filters > select { width: auto; min-width: 170px; }
.rs-nav { margin-left: auto; gap: 6px; flex-wrap: wrap; }
.rs-planning .pchip span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip.rs-off { background: var(--sunk); box-shadow: inset 5px 0 0 var(--idle); cursor: default; color: var(--muted); }
.ag-buf { position: absolute; left: 0; right: 3px; margin-left: 2px; border-radius: 0 0 4px 4px; pointer-events: none;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--muted) 22%, transparent) 0 4px, transparent 4px 9px); }
.ag-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--sunk) 0 8px, color-mix(in srgb, var(--idle) 25%, var(--sunk)) 8px 16px);
  display: grid; place-items: start center; padding-top: 4px; font-size: 12px; color: var(--muted); pointer-events: none; }
.rs-month { display: grid; gap: 4px; }
.rs-mh, .rs-mw { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.rs-mh span { font-size: 12px; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .3px; }
.rs-md { min-height: 104px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 5px; display: grid; align-content: start; gap: 3px; cursor: pointer; min-width: 0; }
.rs-md:hover { border-color: var(--accent); }
.rs-md.out { opacity: .45; }
.rs-md.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rs-md > b { font-size: 12.5px; font-weight: 600; }
.rs-mi { font-size: 11.5px; padding: 2px 4px 2px 7px; border-radius: 4px; background: var(--sunk); box-shadow: inset 3px 0 0 var(--stripe); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-mi .vdot { width: 7px; height: 7px; margin-right: 3px; }
.vc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; }
.rs-vc { box-shadow: inset 0 3px 0 var(--stripe); }
.rs-vc header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rs-vc header small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vc-act { gap: 6px; margin-top: 2px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .rs-nav { margin-left: 0; width: 100%; }
  .rs-md { min-height: 64px; } .rs-mi { font-size: 0; padding: 0; height: 6px; } .rs-mi .vdot { display: none; }
}

/* Tableau de bord sans géolocalisation : la carte du jour seule */
.dash2.solo { grid-template-columns: 1fr; }
/* Profils et droits : matrice droits × profils */
.pm-matrix th, .pm-matrix td { vertical-align: middle; }
.pm-matrix .pm-perm { min-width: 260px; }
.pm-matrix .pm-col { text-align: center; min-width: 108px; white-space: normal; }
.pm-matrix .pm-col .btn.link { font-weight: 600; }
.pm-matrix .pm-cell { text-align: center; }
.pm-matrix .pm-cell input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); cursor: pointer; }
.pm-matrix .pm-group th { background: var(--sunk); text-align: left; font-size: 12px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.pm-matrix tr.off td { opacity: .5; }
/* Droits individuels d'un compte */
.urt { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface); }
.urt summary { cursor: pointer; font-weight: 600; }
.urt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px 18px; margin-top: 10px; }
.urt-g { display: grid; gap: 4px; align-content: start; }
.urt-g > strong { font-size: 12px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.urt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 14px; padding: 3px 6px; border-radius: 6px; }
.urt-row select { width: auto; min-width: 170px; }
.urt-row.set { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.urt-row.off { opacity: .55; }

/* Connexion : fond vidéo (repris de Minton), carte au premier plan */
.login { position: relative; isolation: isolate; background: #0b1b33 url(media/fond-connexion.jpg) center / cover no-repeat; }
.login-video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; pointer-events: none; }
.login-card { box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
/* Double authentification : QR code et étapes */
.tf-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.tf-qr { display: grid; place-items: center; }
.tf-qr svg { width: min(220px, 70vw); height: auto; border-radius: 8px; border: 1px solid var(--line); }
.tf-key summary { cursor: pointer; font-size: 13.5px; color: var(--accent); }
.tf-key p { margin-top: 6px; overflow-wrap: anywhere; }
#tf-code { font: 600 22px/1 var(--mono, monospace); letter-spacing: 6px; text-align: center; }
