/* Interventions — feuille de style unique.
   Palette inspirée des conducteurs électriques : bleu (neutre), vert/jaune (terre), et l'ambre haute visibilité
   réservé au chrono, l'action la plus fréquente sur le terrain. */

:root {
  --ink: #17212b;
  --ink-2: #4a5866;
  --ink-3: #7b8794;
  --paper: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --line: #d6dce3;
  --line-2: #e6eaee;
  --blue: #1f5fbf;
  --blue-ink: #174a96;
  --blue-wash: #e5edf9;
  --amber: #f2a900;
  --amber-ink: #5c4000;
  --amber-wash: #fff4d6;
  --green: #23804f;
  --green-wash: #e2f2e9;
  --red: #c2362f;
  --red-wash: #fbe8e6;
  --grey: #8a96a3;
  --grey-wash: #edf0f3;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.06), 0 4px 14px rgba(23, 33, 43, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --rail: 214px;
  --tap: 44px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 8px; }
.num, time, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }

/* ---------- Coque ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink); color: #dfe6ec; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 700; }
.brand img { width: 30px; height: 30px; border-radius: 6px; background: #fff; object-fit: contain; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-size: 13px; font-weight: 800;
}
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #c9d3dc; font-weight: 550;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, 0.11); color: #fff; }
.nav a .count {
  margin-left: auto; font-size: 12px; background: var(--amber); color: var(--amber-ink); border-radius: 999px; padding: 0 7px; font-weight: 700;
}
.nav svg { width: 18px; height: 18px; flex: none; }
.rail .me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 13px; }
.rail .me button { background: none; border: 0; color: #9fb0bf; padding: 0; cursor: pointer; }
.rail .me button:hover { color: #fff; }

.main { min-width: 0; padding: 22px 28px 60px; }
.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-2); margin-top: 3px; }

.tabbar { display: none; }
.offline {
  position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- Composants ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-ink); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn.danger:hover { background: var(--red-wash); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--grey-wash); }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent;
  cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--grey-wash); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.panel > .panel-body { padding: 14px 16px 16px; }
.panel + .panel { margin-top: 14px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 650;
  white-space: nowrap; background: var(--grey-wash); color: var(--ink-2);
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.a_planifier { background: var(--grey-wash); color: #5d6976; }
.badge.planifiee { background: var(--blue-wash); color: var(--blue-ink); }
.badge.en_cours { background: var(--amber-wash); color: var(--amber-ink); }
.badge.en_cours::before { background: var(--amber); }
.badge.terminee { background: var(--green-wash); color: var(--green); }
.badge.annulee { background: var(--grey-wash); color: var(--ink-3); text-decoration: line-through; }
.badge.urgent { background: var(--red-wash); color: var(--red); }
.badge.plain::before { display: none; }
.badge.inv-done { background: var(--green-wash); color: var(--green); }
.badge.inv-error { background: var(--red-wash); color: var(--red); }
.badge.inv-pending { background: var(--amber-wash); color: var(--amber-ink); }
.ref { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink-2); font-size: 13px; letter-spacing: 0.01em; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .input-bare,
.form-field input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-field select, .form-field textarea,
.tpl-field input:not([type=checkbox]):not([type=radio]), .tpl-field select, .tpl-field textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.form-field textarea, .tpl-field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus,
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .tpl-field input:focus, .tpl-field select:focus, .tpl-field textarea:focus { border-color: var(--blue); outline: 3px solid var(--blue-wash); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 550; font-size: 14px; user-select: none;
}
.chip input { display: none; }
.chip.on { border-color: var(--blue); background: var(--blue-wash); color: var(--blue-ink); }
.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 11px; width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 35px !important; }
.error-box { background: var(--red-wash); color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.note-box { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 14px; }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table .right { text-align: right; }
.table-wrap { overflow-x: auto; }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* Bandeau d'onglets (réglages) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--blue); }

/* Modales et panneau latéral */
.overlay { position: fixed; inset: 0; background: rgba(23, 33, 43, 0.42); z-index: 75; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: min(640px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; gap: 10px; }
.modal-body { padding: 10px 18px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.drawer-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(23, 33, 43, 0.25); }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); z-index: 41;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15); display: flex; flex-direction: column; animation: slide-in 0.18s ease-out;
}
.drawer .drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 92vw; font-size: 14px; }
.toast.error { background: var(--red); }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); }
.auth-card .brand-big { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-card .brand-big img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: #fff; }
.auth-card .brand-big .mark { width: 48px; height: 48px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; }

/* ---------- Planning ---------- */
.planning { display: grid; grid-template-columns: 1fr 270px; gap: 16px; align-items: start; }
.board { overflow-x: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); }
.board-grid { display: grid; min-width: 760px; }
.board-grid .corner, .board-grid .day-head, .board-grid .tech-head, .board-grid .cell { border-bottom: 1px solid var(--line-2); }
.board-grid .day-head { padding: 10px 10px 8px; border-left: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); }
.day-head .d { font-weight: 650; }
.day-head .d.today { color: var(--blue-ink); }
.day-head .n { font-size: 12.5px; color: var(--ink-3); }
.tech-head { padding: 10px 12px; display: flex; align-items: flex-start; gap: 9px; background: var(--surface-2); }
.tech-head .name { font-weight: 650; line-height: 1.2; }
.tech-head .load { font-size: 12px; color: var(--ink-3); }
.cell { border-left: 1px solid var(--line-2); padding: 6px; min-height: 92px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.cell.today { background: color-mix(in srgb, var(--blue-wash) 45%, transparent); }
.cell.drop { background: var(--blue-wash); outline: 2px dashed var(--blue); outline-offset: -3px; }
.cell .add {
  position: absolute; right: 4px; bottom: 4px; opacity: 0; border: 0; background: var(--surface); border-radius: 6px; color: var(--ink-3);
  width: 26px; height: 26px; cursor: pointer; box-shadow: var(--shadow);
}
.cell:hover .add, .cell .add:focus-visible { opacity: 1; }

/* Le « bon » : la fiche d'intervention en papier sur le tableau */
.slip {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--grey); border-radius: var(--radius-sm);
  padding: 6px 8px 7px; font-size: 13px; line-height: 1.3; cursor: pointer; user-select: none;
}
.slip:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.slip[draggable=true] { cursor: grab; }
.slip.dragging { opacity: 0.45; }
.slip.planifiee { border-left-color: var(--blue); }
.slip.en_cours { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber-wash) 55%, var(--surface)); }
.slip.terminee { border-left-color: var(--green); background: var(--surface-2); color: var(--ink-2); }
.slip .when { font-weight: 700; font-variant-numeric: tabular-nums; }
.slip .who { font-weight: 600; }
.slip .what { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slip .where { color: var(--ink-3); font-size: 12px; }
.slip .urgent-flag { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.slip .techs { display: flex; gap: 3px; margin-top: 4px; }
.slip .techs .dot { width: 8px; height: 8px; }

.tray { position: sticky; top: 16px; }
.tray .slip { margin-bottom: 8px; }
.tray-drop.drop { outline: 2px dashed var(--blue); outline-offset: 4px; border-radius: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 4px; height: 14px; border-radius: 2px; display: inline-block; }

.agenda-day { margin-bottom: 16px; }
.agenda-day > h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.agenda-day .slip { margin-bottom: 8px; font-size: 14px; }

/* ---------- Écran intervention ---------- */
.iv-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.iv-head h1 { font-size: 23px; margin: 6px 0 4px; }
.iv-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.addr-link { display: inline-flex; gap: 6px; align-items: flex-start; }
.addr-link svg { flex: none; margin-top: 2px; color: var(--ink-3); }

/* Le chrono : l'élément central sur le terrain */
.timer {
  display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.timer-btn {
  width: 84px; height: 84px; flex: none; border-radius: 50%; border: 0; cursor: pointer; font-weight: 800; font-size: 15px;
  background: var(--amber); color: var(--amber-ink); box-shadow: 0 0 0 6px var(--amber-wash), 0 6px 16px rgba(242, 169, 0, 0.35);
  display: grid; place-items: center; line-height: 1.1; text-align: center;
}
.timer-btn:active { transform: scale(0.97); }
.timer-btn.running { background: var(--ink); color: #fff; box-shadow: 0 0 0 6px #dfe4e9; }
.timer-btn:disabled { background: var(--grey-wash); color: var(--ink-3); box-shadow: none; cursor: default; }
.timer .clock { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.timer .clock-sub { color: var(--ink-2); font-size: 13.5px; }
.timer.running .clock { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .timer.running .live::before { animation: blink 1.6s infinite; }
}
.live::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; }
@keyframes blink { 50% { opacity: 0.25; } }

.lines > li { display: flex; gap: 10px; align-items: center; }
.lines .qty { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 54px; text-align: right; }
.planned-tag { font-size: 12px; color: var(--blue-ink); background: var(--blue-wash); border-radius: 4px; padding: 0 6px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--grey-wash); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photos .del { position: absolute; top: 4px; right: 4px; background: rgba(23, 33, 43, 0.65); color: #fff; border: 0; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; }
.photo-add {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px dashed var(--line); display: grid; place-items: center; color: var(--ink-2); cursor: pointer;
  background: var(--surface); font-size: 13px; text-align: center; padding: 6px;
}
.photo-add input { display: none; }
.report-text { white-space: pre-line; margin: 0; }
.signed { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.signed img { max-height: 70px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.activity { font-size: 13px; color: var(--ink-2); }
.activity li { padding: 6px 0; }
.finish-bar { margin-top: 14px; }

/* Signature plein écran */
.sign-screen { position: fixed; inset: 0; z-index: 70; background: var(--surface); display: flex; flex-direction: column; }
.sign-screen header { padding: 14px 16px 8px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sign-screen .sign-body { flex: 1; overflow-y: auto; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sign-pad { position: relative; border: 2px solid var(--line); border-radius: 12px; background: #fff; height: 230px; touch-action: none; }
.sign-pad canvas { width: 100%; height: 100%; display: block; border-radius: 10px; }
.sign-pad .baseline { position: absolute; left: 20px; right: 20px; bottom: 46px; border-bottom: 1px solid var(--line); pointer-events: none; }
.sign-pad .placeholder { position: absolute; left: 22px; bottom: 54px; color: var(--ink-3); pointer-events: none; font-size: 14px; }
.sign-summary { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.sign-screen footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); display: flex; gap: 10px; }

/* Vue « Ma journée » (technicien) */
.day-title { font-size: 26px; font-weight: 750; letter-spacing: -0.015em; }
.job { display: block; padding: 14px 14px 13px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); color: inherit; position: relative; border-left: 5px solid var(--grey); }
.job + .job { margin-top: 10px; }
.job:hover { text-decoration: none; border-color: var(--line); }
.job.planifiee { border-left-color: var(--blue); }
.job.en_cours { border-left-color: var(--amber); }
.job.terminee { border-left-color: var(--green); opacity: 0.8; }
.job .t { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.job .c { font-size: 17px; font-weight: 650; margin: 2px 0; }
.job .a { color: var(--ink-2); font-size: 14px; }

/* Vignette photo agrandie */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 6px; }

/* ---------- Réactif ---------- */
@media (max-width: 1100px) {
  .planning { grid-template-columns: 1fr; }
  .tray { position: static; }
  .iv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  :root { --tap: 48px; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--ink-2); padding: 4px 0;
    font-weight: 600; text-decoration: none; min-width: 0;
  }
  .tabbar a.active { color: var(--blue-ink); }
  .tabbar svg { width: 22px; height: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .btn { min-height: var(--tap); }
  .btn.small { min-height: 36px; }
  .panel > .panel-head { padding: 12px 14px 0; }
  .panel > .panel-body { padding: 12px 14px 14px; }
  .overlay { padding: 0; align-items: stretch; }
  .modal, .modal.wide { width: 100%; border-radius: 0; min-height: 100%; display: flex; flex-direction: column; }
  .modal-body { flex: 1; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .table.responsive td { display: block; border: 0; padding: 1px 0; }
  .hide-mobile { display: none !important; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (min-width: 821px) {
  .show-mobile { display: none !important; }
}
@media print {
  .rail, .tabbar, .page-head .btn { display: none !important; }
  .shell { display: block; }
}

/* Documents techniques */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.doc-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.doc-list li:last-child { border-bottom: 0; }
.doc-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; background: var(--surface-2, #f5f7f9); }
.doc-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; background: var(--blue-wash); color: var(--blue-ink); flex: none; }
.doc-main { min-width: 0; flex: 1; }
.doc-name { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Formulaires de contrôle */
.control-form .panel-head h2 { display: inline-flex; align-items: center; gap: 4px; }
.form-section { margin: 8px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--blue-ink); }
.form-field { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.form-field.missing { border-color: var(--red); background: var(--red-wash); }
.form-label { font-weight: 600; }
.form-label .req { color: var(--red); }
.form-value { margin-top: 2px; }
.form-field > .row + * { margin-top: 6px; }
.form-field input:not([type=file]), .form-field select, .form-field textarea { margin-top: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.seg-btn { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-weight: 600; cursor: pointer; }
.seg-btn.on { background: var(--green-wash); border-color: var(--green); color: var(--green); }
.seg-btn.neg.on { background: var(--red-wash); border-color: var(--red); color: var(--red); }
.tpl-field { padding: 10px; border: 1px solid var(--line-2); border-radius: 10px; }
.tpl-field.is-section { background: var(--blue-wash); }
