/* ==========================================================================
   Tracker GPS — "Mission Control" 2026
   Redesign complet : palette profonde, accents émeraude→cyan, verres affinés,
   deux colonnes bureau, badges machine discrets, statuts en avant-plan.
   Tous les ids/classes utilisés par app.js sont conservés.
   ========================================================================== */

/* ----------------------------- Tokens ----------------------------------- */
:root {
  --ink: #0c1420;
  --ink-soft: #43536a;
  --ink-faint: #71809a;
  --bg: #eef3f7;
  --bg-glow-1: rgba(5, 150, 105, .16);
  --bg-glow-2: rgba(8, 145, 178, .14);
  --surface: rgba(255, 255, 255, .78);
  --surface-2: rgba(255, 255, 255, .55);
  --surface-solid: #ffffff;
  --line: rgba(12, 20, 32, .10);
  --line-strong: rgba(12, 20, 32, .20);
  --accent: #059669;
  --accent-2: #0d9488;
  --accent-ink: #043527;
  --accent-soft: rgba(5, 150, 105, .11);
  --accent-glow: rgba(5, 150, 105, .38);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .09);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .10);
  --radius: 20px;
  --radius-sm: 12px;
  /* Ombres "verre 3D" : reflet du haut, liseré bas, profondeur en couches */
  --shadow-sm: inset 0 1px 0 rgba(255,255,255,.62), inset 0 -1px 1px rgba(12,20,32,.05),
               0 1px 2px rgba(8,15,26,.10), 0 6px 18px -8px rgba(8,15,26,.20),
               0 14px 30px -18px rgba(8,15,26,.22);
  --shadow: inset 0 1px 0 rgba(255,255,255,.72), inset 0 -1px 2px rgba(12,20,32,.07),
            0 2px 4px rgba(8,15,26,.12), 0 16px 36px -10px rgba(8,15,26,.26),
            0 30px 64px -22px rgba(8,15,26,.30);
  --glass-edge: rgba(255,255,255,.75);
  --blur: blur(18px) saturate(160%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --ring: 0 0 0 3px rgba(5, 150, 105, .22);
  --ring-line: rgba(12, 20, 32, .18);
  color-scheme: light;
}

[data-theme="dark"] {
  --ink: #e9eef5;
  --ink-soft: #a4b4c8;
  --ink-faint: #6d7f97;
  --bg: #05070c;
  --bg-glow-1: rgba(5, 150, 105, .17);
  --bg-glow-2: rgba(8, 145, 178, .14);
  --surface: rgba(255, 255, 255, .055);
  --surface-2: rgba(255, 255, 255, .035);
  --surface-solid: #0d131d;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --accent: #34d399;
  --accent-2: #22d3ee;
  --accent-ink: #04170f;
  --accent-soft: rgba(52, 211, 153, .12);
  --accent-glow: rgba(52, 211, 153, .34);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .13);
  /* Ombres "verre 3D" (sombre) : arête lumineuse en haut, creux en bas, profondeur */
  --shadow-sm: inset 0 1px 0 rgba(255,255,255,.13), inset 0 -1px 2px rgba(0,0,0,.55),
               0 1px 3px rgba(0,0,0,.5), 0 10px 26px -10px rgba(0,0,0,.6);
  --shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 3px rgba(0,0,0,.6),
            0 2px 6px rgba(0,0,0,.55), 0 22px 52px -14px rgba(0,0,0,.72);
  --glass-edge: rgba(255,255,255,.28);
  --ring: 0 0 0 3px rgba(52, 211, 153, .25);
  --ring-line: rgba(255, 255, 255, .22);
  --blur: blur(18px) saturate(150%);
  color-scheme: dark;
}

/* ----------------------------- Base ------------------------------------- */
* { 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(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

/* Fond : double halo + grille subtile */
body::before {
  content: "";
  position: fixed;
  inset: -20% 0 auto 0;
  height: 70vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 420px at 88% -80px, var(--bg-glow-1), transparent 65%),
    radial-gradient(720px 460px at -120px 30%, var(--bg-glow-2), transparent 65%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(#000 0%, transparent 62%);
  -webkit-mask-image: linear-gradient(#000 0%, transparent 62%);
}

button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* ----------------------------- Icônes ----------------------------------- */
.icon {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  vertical-align: -.16em;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.ic-check   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E"); }
.ic-search  { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27a6.5 6.5 0 1 0-.7.7l.27.28v.79l5 4.99L20.49 19zm-6 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 9.5 14'/%3E%3C/svg%3E"); }
.ic-edit    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z'/%3E%3C/svg%3E"); }
.ic-trash   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 19c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z'/%3E%3C/svg%3E"); }
.ic-copy    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 1H4a2 2 0 0 0-2 2v14h2V3h12zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m0 16H8V7h11z'/%3E%3C/svg%3E"); }
.ic-doc     { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zm-1 7V3.5L18.5 9z'/%3E%3C/svg%3E"); }
.ic-chart   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 9.2h3V19H5zM10.6 5h2.8v14h-2.8zm5.6 8H19v6h-2.8z'/%3E%3C/svg%3E"); }
.ic-share   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 1 0-3-3c0 .24.04.47.09.7L8.04 9.81A2.99 2.99 0 1 0 6 16c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65a2.92 2.92 0 1 0 2.92-2.92'/%3E%3C/svg%3E"); }
.ic-save    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7zm-5 16a3 3 0 1 1 0-6 3 3 0 0 1 0 6m3-10H5V5h10z'/%3E%3C/svg%3E"); }
.ic-restore { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 3a9 9 0 0 0-9 9H1l3.89 3.89.07.14L9 12H6a7 7 0 1 1 2.05 4.95l-1.42 1.42A9 9 0 1 0 13 3m-1 8v5l4.28-2.54z'/%3E%3C/svg%3E"); }
.ic-print   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 8h-1V3H6v5H5a3 3 0 0 0-3 3v6h4v3h12v-3h4v-6a3 3 0 0 0-3-3M7 19v-7h10v7zm10-12H7V5h10zM9 9h2v2H9zm4 0h2v2h-2z'/%3E%3C/svg%3E"); }
.ic-phone   { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.62 10.79a15.05 15.05 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.02-.24 11.4 11.4 0 0 0 3.57.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1 11.4 11.4 0 0 0 .57 3.57 1 1 0 0 1-.25 1.02z'/%3E%3C/svg%3E"); }
.ic-pin     { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7m0 9.5A2.5 2.5 0 1 1 14.5 9 2.5 2.5 0 0 1 12 11.5'/%3E%3C/svg%3E"); }
.ic-grid    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h8v8H3zm10 0h8v8h-8zM3 13h8v8H3zm10 0h8v8h-8z'/%3E%3C/svg%3E"); }
.ic-rows    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18v4H3zm0 6h18v4H3zm0 6h18v4H3z'/%3E%3C/svg%3E"); }
.ic-x       { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E"); }
.ic-plus    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z'/%3E%3C/svg%3E"); }
.ic-sun     { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 7a5 5 0 1 0 5 5 5 5 0 0 0-5-5m0-5h1v4h-1zm0 16h1v4h-1zM2 11h4v1H2zm16 0h4v1h-4zM4.9 4.2l2.9 2.9-1.4 1.4L3.5 5.6zm13.8 13.8 2.9 2.9-1.4 1.4-2.9-2.9zm2.9-16.7 1.4 1.4-2.9 2.9-1.4-1.4zM6.8 18.7l1.4 1.4-2.9 2.9-1.4-1.4z'/%3E%3C/svg%3E"); }
.ic-moon    { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.34 2.05a10 10 0 1 0 11.37 11.63A8 8 0 0 1 12.34 2.05z'/%3E%3C/svg%3E"); }
.ic-refresh { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17.65 6.35A8 8 0 1 0 20 12h-2a6 6 0 1 1-1.76-4.24L13 11h8V3z'/%3E%3C/svg%3E"); }

/* ----------------------------- Boutons ---------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .01em;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 1px 2px rgba(8,15,26,.12), 0 4px 12px -6px rgba(8,15,26,.18);
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .25s ease, color .2s ease;
}
[data-theme="dark"] .btn { box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 3px rgba(0,0,0,.45); }
.btn:hover { border-color: var(--line-strong); background: var(--surface-solid); }
.btn:active { transform: scale(.97); }
.btn .icon { font-size: 1.1em; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 8px 22px -8px var(--accent-glow), var(--shadow-sm);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 28px -8px var(--accent-glow); }

.btn-secondary { background: var(--surface-2); }

.btn-mini {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 10px;
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}
.btn-mini:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

.link-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease;
}
.link-btn:hover { color: var(--danger); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .25s ease;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-solid); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .icon { font-size: 19px; }

/* ----------------------------- Header ----------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 14px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}
.app-header h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(18px, 2.4vw, 21px);
  font-weight: 800;
  letter-spacing: -.02em;
}
.app-header h1 .icon {
  font-size: 1.3em;
  color: var(--accent);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.progress-wrap {
  max-width: 1240px;
  margin: 12px auto 0;
  padding: 0 20px;
}
.progress-wrap > div,
.progress-wrap {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
}
.progress-wrap {
  height: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 10px auto 0;
  padding: 0 20px;
}
.stats {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.stats::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  vertical-align: 1px;
}

/* Point de synchronisation (base partagée) */
.sync-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  flex: 0 0 auto;
  transition: background 0.25s, box-shadow 0.25s;
}
.sync-dot.ok {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.7);
  animation: syncpulse 2.2s ease-in-out infinite;
}
.sync-dot.off {
  background: #94a3b8;
}
@keyframes syncpulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 12px rgba(34,197,94,0.9); }
}
[data-theme="dark"] .sync-dot.ok { background: #4ade80; }
[data-theme="dark"] .sync-dot.off { background: #64748b; }

/* ----------------------------- Layout ----------------------------------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 40px);
}

/* Barre d'outils */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-sm);
}

.search-input {
  flex: 1 1 240px;
  min-width: 180px;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 2px 4px rgba(8,15,26,.07), inset 0 1px 0 var(--glass-edge);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
[data-theme="dark"] .search-input { box-shadow: inset 0 2px 5px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08); }
.search-input::placeholder { color: var(--ink-faint); }
.search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: var(--ring);
  background: var(--surface-solid);
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.filter-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 2px 4px rgba(8,15,26,.06), inset 0 1px 0 var(--glass-edge);
}
[data-theme="dark"] .filter-tabs { box-shadow: inset 0 2px 5px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); }
.tab {
  padding: 8px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.sort-select {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 1px 2px rgba(8,15,26,.12);
}
[data-theme="dark"] .sort-select { box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 3px rgba(0,0,0,.45); }
.sort-select:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: var(--ring); }

#btnView {
  width: 42px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Barre de sélection multiple */
.select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  animation: rise-in .3s ease;
}
.select-info {
  font-size: 13px;
  font-weight: 750;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.select-bar .btn { padding: 8px 12px; font-size: 12.5px; }
.select-bar #btnSelectClose { margin-left: auto; }

/* ----------------------------- Catégories ------------------------------- */
.category { margin-top: 26px; }
.category:first-of-type { margin-top: 4px; }

.cat-banner {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--c) 16%, var(--surface)) 0%, var(--surface) 55%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
[data-theme="dark"] .cat-banner { box-shadow: var(--shadow-sm); }

.cat-banner-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.cat-banner-kicker {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: color-mix(in srgb, var(--c) 75%, var(--ink));
}
.cat-banner-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 27px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.05;
}
.cat-banner-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.cat-count {
  font-size: 12px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  color: color-mix(in srgb, var(--c) 82%, var(--ink));
  font-variant-numeric: tabular-nums;
}
.cat-actions { display: inline-flex; gap: 8px; margin-left: auto; }
.btn-add {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  color: color-mix(in srgb, var(--c) 88%, var(--ink));
  font-size: 19px;
}
.btn-add:hover { background: var(--c); color: #fff; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--c) 55%, transparent); }

.cat-banner-media {
  flex: 0 0 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface-2), transparent);
  border: 1px solid color-mix(in srgb, var(--c) 26%, var(--line));
}
.cat-banner-img {
  width: 100%;
  height: 100%;
  min-height: 104px;
  object-fit: contain;
  padding: 4px;
  /* Véhicule découpé (fond transparent) : ombre portée double
     pour qu'il "flotte" sur la bannière, proche + large. */
  filter:
    drop-shadow(0 2px 3px rgba(8, 14, 24, .32))
    drop-shadow(0 14px 18px rgba(8, 14, 24, .22));
}
[data-theme="dark"] .cat-banner-img {
  filter:
    drop-shadow(0 2px 3px rgba(0, 0, 0, .55))
    drop-shadow(0 14px 20px rgba(0, 0, 0, .40));
}

/* Listes */
.list { margin-top: 12px; display: grid; gap: 10px; }

/* Liste vide */
.list:empty {
  min-height: 64px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
}
.list:empty::before { content: "Aucun élément — utilisez le bouton + de la section"; }

/* ----------------------------- Carte (vignettes) ------------------------ */
.item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
  animation: rise-in .5s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@media (hover: hover) and (pointer: fine) {
  .item:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
  }
}
.item:active { transform: scale(.988); }

/* Pastille d'état */
.item::before {
  content: "";
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: transparent;
  transition: all .25s ease;
}
.item.done::before {
  background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 78%, #000));
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  mask: none;
}
/* coche à l'intérieur de la pastille "fait" */
.item.done::after {
  content: "";
  position: absolute;
  left: calc(16px + 4px);
  top: calc(14px + 4px);
  width: 11px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(1px);
}
[data-theme="dark"] .item.done::after { border-color: #04170f; }
.item.user-added::after { display: none; }

.item-head {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.item-select { position: absolute; opacity: 0; pointer-events: none; }
.item-code {
  font-family: var(--font-mono);
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: .01em;
  transition: color .25s ease;
}
.item.done .item-code { color: var(--ink-faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.item-imma {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.item-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: .08em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.item-badge.fait {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 85%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}
.item-badge.nonfait {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

/* Badge machine (discret, coloré) */
.item-machine {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .07em;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid;
  white-space: nowrap;
  /* Relief verre : liseré clair en haut, creux en bas, ombre portée fine */
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 1px 2px rgba(8, 15, 26, .18);
}
[data-theme="dark"] .item-machine { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 3px rgba(0,0,0,.5); }
.item-machine.mdtp { background: rgba(37, 99, 235, .12);  color: #2563eb; border-color: rgba(37, 99, 235, .35); }
.item-machine.mds  { background: rgba(5, 150, 105, .12);  color: #059669; border-color: rgba(5, 150, 105, .35); }
.item-machine.mdc  { background: rgba(217, 119, 6, .12);  color: #d97706; border-color: rgba(217, 119, 6, .35); }
.item-machine.mddd { background: rgba(220, 38, 38, .12);  color: #dc2626; border-color: rgba(220, 38, 38, .35); }
.item-machine.mdts { background: rgba(124, 58, 237, .12); color: #7c3aed; border-color: rgba(124, 58, 237, .35); }
.item-machine.ruiz { background: rgba(219, 39, 119, .12); color: #db2777; border-color: rgba(219, 39, 119, .35); }
.item-machine.unk  { background: rgba(100, 116, 139, .12); color: #64748b; border-color: rgba(100, 116, 139, .35); }
[data-theme="dark"] .item-machine.mdtp { color: #60a5fa; background: rgba(59, 130, 246, .14); border-color: rgba(96, 165, 250, .35); }
[data-theme="dark"] .item-machine.mds  { color: #34d399; background: rgba(16, 185, 129, .14); border-color: rgba(52, 211, 153, .35); }
[data-theme="dark"] .item-machine.mdc  { color: #fbbf24; background: rgba(245, 158, 11, .14); border-color: rgba(251, 191, 36, .35); }
[data-theme="dark"] .item-machine.mddd { color: #f87171; background: rgba(239, 68, 68, .14);  border-color: rgba(248, 113, 113, .35); }
[data-theme="dark"] .item-machine.mdts { color: #a78bfa; background: rgba(139, 92, 246, .14); border-color: rgba(167, 139, 250, .35); }
[data-theme="dark"] .item-machine.ruiz { color: #f472b6; background: rgba(236, 72, 153, .14); border-color: rgba(244, 114, 182, .35); }
[data-theme="dark"] .item-machine.unk  { color: #94a3b8; background: rgba(148, 163, 184, .14); border-color: rgba(148, 163, 184, .35); }

.item-info {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.item-info b { font-weight: 650; color: var(--ink); }
.item-tel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none !important;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.item-tel .icon { font-size: 13px; color: var(--accent); }
.item-tel:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.item-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.item.done .item-actions { margin-left: 0; }

.btn-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 118px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 1px rgba(12,20,32,.05), 0 2px 6px rgba(8,15,26,.16);
  transition: all .2s ease;
}
[data-theme="dark"] .btn-toggle { box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 2px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.5); }
.btn-toggle .icon { font-size: 15px; }
.btn-toggle:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
.btn-toggle:active { transform: scale(.96); }
.item.done .btn-toggle {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

/* Boutons icône (édition / suppression / duplication) — app.js les génère en
   .btn-edit/.btn-del/.btn-dup ; .icon-act est leur classe de présentation. */
.icon-act,
.item-actions .btn-edit,
.item-actions .btn-del,
.item-actions .btn-dup,
.detail-actions .btn-edit,
.detail-actions .btn-del,
.detail-actions .btn-dup {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 1px 3px rgba(8,15,26,.14);
  transition: all .18s ease;
}
[data-theme="dark"] .icon-act,
[data-theme="dark"] .item-actions .btn-edit,
[data-theme="dark"] .item-actions .btn-del,
[data-theme="dark"] .item-actions .btn-dup,
[data-theme="dark"] .detail-actions .btn-edit,
[data-theme="dark"] .detail-actions .btn-del,
[data-theme="dark"] .detail-actions .btn-dup { box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 4px rgba(0,0,0,.45); }
.icon-act:hover,
.item-actions .btn-edit:hover,
.item-actions .btn-dup:hover,
.detail-actions .btn-edit:hover,
.detail-actions .btn-dup:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-solid); }
.icon-act:active,
.item-actions .btn-edit:active,
.item-actions .btn-del:active,
.item-actions .btn-dup:active,
.detail-actions .btn-edit:active,
.detail-actions .btn-del:active,
.detail-actions .btn-dup:active { transform: scale(.92); }
.item-actions .btn-del:hover,
.detail-actions .btn-del:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}
.item-actions .btn-dup:hover,
.item-actions .btn-edit:hover,
.detail-actions .btn-dup:hover,
.detail-actions .btn-edit:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* Cartes faites : teinte douce */
.item.done {
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface) 60%);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

/* ----------------------------- Vue détail ------------------------------- */
.view-detail .list { align-items: stretch; }

.detail-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.detail-table thead th {
  padding: 11px 12px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  text-align: left;
  color: var(--ink-faint);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.detail-table tbody td {
  padding: 11px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.detail-table tbody tr:last-child td { border-bottom: none; }

.detail-row:nth-child(even) { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.detail-row { transition: background .2s ease; }
.detail-row:hover { background: var(--surface-2); }
.detail-row.done {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.detail-row.done .detail-code { text-decoration: line-through; color: var(--ink-faint); }

.detail-code { font-family: var(--font-mono); font-size: 14px; font-weight: 750; }
.detail-imma { font-size: 12.5px; color: var(--ink-soft); }
.detail-resp { font-weight: 600; }
.detail-tel-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none !important;
}
.detail-tel-link .icon { font-size: 13px; color: var(--accent); }

.detail-status {
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: .08em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.detail-status.fait {
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 85%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}
.detail-status.nonfait {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.detail-actions { display: flex; align-items: center; gap: 7px; }
.detail-actions .btn-toggle { min-width: 0; padding: 8px 12px; font-size: 12.5px; }

/* ----------------------------- Actions globales ------------------------- */
.global-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.global-actions .btn { width: 100%; }
.global-actions #btnExport { grid-column: span 2; padding: 13px; font-size: 15px; }

.footer-note {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ----------------------------- Toast ------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 480px);
  padding: 12px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 600;
  animation: toast-in .3s cubic-bezier(.22, 1, .36, 1);
}
.toast .link-btn { color: var(--accent); white-space: nowrap; }
.toast .link-btn:hover { color: var(--ink); }

/* ----------------------------- Modal ------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 8, 14, .58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in .22s ease;
  padding: 0;
}
.modal {
  width: 100%;
  max-width: 680px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  padding: 20px 22px calc(env(safe-area-inset-bottom, 0px) + 24px);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .35);
  animation: sheet-up .34s cubic-bezier(.22, 1, .36, 1);
  max-height: 92vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.btn-close {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  transition: all .18s ease;
}
.btn-close:hover { color: var(--ink); border-color: var(--line-strong); }

.modal-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .02em;
  color: var(--ink-soft);
}
.field .required { color: var(--danger); }
.field input {
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-2);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: var(--ring);
  background: var(--surface-solid);
}
.field input[readonly] { opacity: .65; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.modal-actions .btn { flex: 1; padding: 13px; font-size: 15px; }
.modal-actions .btn-secondary { flex: 0 0 auto; padding: 13px 20px; }

/* ----------------------------- Animations ------------------------------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ----------------------------- Responsive ------------------------------- */
/* Bureau : deux colonnes — bannières en rail gauche sticky */
@media (min-width: 1024px) {
  .category {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
  }
  .cat-banner { position: sticky; top: 118px; }
  .cat-banner-media { flex-basis: 118px; }
  .list { gap: 12px; }
  .item { padding: 16px 18px; }

  .global-actions { grid-template-columns: repeat(3, 1fr); }
  .global-actions #btnExport { grid-column: span 3; }

  /* Modal centré en mode bureau */
  .modal-overlay { align-items: center; padding: 24px; }
  .modal { border-radius: 24px; border-bottom: 1px solid var(--line); }
}

/* Mobile : bannière sticky compacte (mini-titre visible pendant le scroll) */
@media (max-width: 759px) {
  .cat-banner {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px 10px;
  }
  .cat-banner-kicker { display: none; }
  .cat-banner-title { font-size: 17px; }
  .cat-banner-meta { margin-top: 0; gap: 7px; }
  .cat-count { font-size: 11px; padding: 4px 9px; }
  .cat-actions { margin-left: 0; }
  .btn-mini { padding: 6px 10px; font-size: 12px; }
  .btn-add { width: 36px; height: 36px; }
  .cat-banner-media { flex-basis: 62px; border-radius: 12px; }
  .cat-banner-img { min-height: 48px; }

  .app-header { padding-bottom: 10px; }
  .header-row { padding: 0 14px; }
  .progress-wrap { padding: 0 14px; margin-top: 10px; }
  .stats-row { padding: 0 14px; margin-top: 8px; }
  .container { padding: 16px 12px calc(env(safe-area-inset-bottom, 0px) + 36px); }

  .toolbar { padding: 10px; gap: 8px; border-radius: 16px; }
  .search-input { flex-basis: 100%; }
  .filter-tabs { flex: 1; }
  .filter-tabs .tab { flex: 1; padding: 9px 6px; font-size: 12.5px; text-align: center; }
  .sort-select { flex: 1; min-width: 0; padding: 10px 8px; font-size: 12.5px; }
  #btnView { width: 40px; height: 38px; flex: 0 0 auto; }

  .item { padding: 12px; gap: 5px 10px; }
  .item-info { padding-top: 8px; }
  .item-actions { flex-basis: 100%; margin-left: 0; justify-content: flex-end; }
  .btn-toggle { flex: 1; min-width: 0; }
  .icon-act { width: 36px; height: 36px; }
}

/* Vue détail sur mobile : 8 cellules sur 2 rangées — chaque cellule reste dans
   sa piste (plus de chevauchement). Rangée 1 : Code + Immatriculation + Machine,
   rangée 2 : case + Responsable + Tél + actions. */
@media (max-width: 759px) {
  .detail-table,
  .detail-table thead,
  .detail-table tbody { display: block; }
  .detail-table thead tr,
  .detail-table tbody tr {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 42px 32px 52px;
    column-gap: 6px;
    row-gap: 6px;
    align-items: center;
    padding: 10px;
    white-space: normal;
  }
  /* Badge Machine : taille réduite pour tenir dans sa colonne (plus de coupure) */
  .detail-table .item-machine {
    font-size: 9.5px;
    letter-spacing: .04em;
    padding: 3px 7px;
    border-radius: 7px;
    white-space: nowrap;
  }
  /* En-tête : les 6 pistes = 3 colonnes réelles (Code / Immat. / Machine) */
  .detail-table thead tr th { grid-column: auto; }
  .detail-table thead tr th:nth-child(2) { grid-column: 2 / span 2; } /* Code */
  .detail-table thead tr th:nth-child(3) { grid-column: 4 / span 2; } /* Immat. */
  .detail-table thead tr th:nth-child(6) { grid-column: 6; }          /* Machine */
  .detail-table thead tr th:nth-child(1),
  .detail-table thead tr th:nth-child(4),
  .detail-table thead tr th:nth-child(5),
  .detail-table thead tr th:nth-child(7),
  .detail-table thead tr th:nth-child(8) { display: none; }
  /* Lignes : rangée 1 = code, immat., machine · rangée 2 = case, resp., tél., actions */
  .detail-table tbody tr td:nth-child(2) { grid-column: 2 / span 2; } /* code */
  .detail-table tbody tr td:nth-child(3) { grid-column: 4 / span 2; } /* immat. */
  .detail-table tbody tr td:nth-child(6) { grid-column: 6; }          /* machine */
  .detail-table tbody tr td:nth-child(1) { grid-row: 2; grid-column: 1; justify-self: start; }
  .detail-table tbody tr td:nth-child(4) { grid-row: 2; grid-column: 2 / span 2; }
  .detail-table tbody tr td:nth-child(5) { grid-row: 2; grid-column: 4 / span 2; }
  .detail-table tbody tr td:nth-child(8) { grid-row: 2; grid-column: 6; }
  /* L'état est déjà porté par la case + la teinte de la ligne */
  .detail-table tbody tr td:nth-child(7) { display: none; }
  .detail-table th,
  .detail-table td {
    display: block;
    padding: 0 2px;
    border: none;
    background: transparent !important;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .detail-table thead tr th { font-size: 8.5px; letter-spacing: .1em; }
  .detail-table tbody tr td { font-size: 11.5px; }
  .detail-table tbody tr { border-bottom: 1px solid var(--line); box-shadow: none; }
  .detail-table tbody tr:last-child { border-bottom: none; }
  .detail-code { font-size: 12.5px; }
  .detail-imma { font-size: 11.5px; }
  .detail-resp { font-size: 11.5px; }
  .detail-tel-link { flex-wrap: wrap; }
  .detail-tel-link .icon { display: none; }
  .detail-actions { justify-content: flex-end; gap: 5px; }
  .detail-actions .btn-toggle { display: none; }
  .detail-actions .btn-edit,
  .detail-actions .btn-del,
  .detail-actions .btn-dup { width: 30px; height: 30px; font-size: 13.5px; }
}

/* Très petites largeurs */
@media (max-width: 380px) {
  .btn { padding: 9px 12px; font-size: 13.5px; }
  .global-actions { grid-template-columns: 1fr 1fr; }
  .global-actions #btnExport { grid-column: span 2; }
  .modal { padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 20px); }
  .modal-actions .btn { padding: 12px; font-size: 14px; }
}

/* ----------------------------- Mouvement réduit ------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ----------------------------- Impression ------------------------------- */
@media print {
  :root, [data-theme="dark"] {
    --ink: #111827;
    --ink-soft: #374151;
    --ink-faint: #6b7280;
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f3f4f6;
    --surface-solid: #fff;
    --line: #d1d5db;
    --line-strong: #9ca3af;
    --accent: #059669;
    --accent-2: #047857;
    --accent-soft: rgba(5, 150, 105, .1);
    --danger: #dc2626;
    --warn: #b45309;
  }
  body, body::before, body::after { background: #fff !important; }
  .app-header, .toolbar, .select-bar, .global-actions, .footer-note,
  .toast, .modal-overlay, .cat-actions, .item-actions, .item-select,
  .btn-toggle, .icon-act, .btn, .icon-btn, .link-btn { display: none !important; }
  .cat-banner { box-shadow: none; border: 1px solid #d1d5db; break-inside: avoid; }
  .cat-banner-media { display: none; }
  .item, .detail-table, .detail-row { box-shadow: none; break-inside: avoid; }
  .item { border: 1px solid #d1d5db; background: #fff; }
  .item::before, .item.done::after { display: none; }
  .item-machine { background: #f3f4f6 !important; color: #374151 !important; border-color: #d1d5db !important; }
  .item-badge, .detail-status { background: none; }
  .item-badge.fait, .detail-status.fait { color: #059669; border-color: #059669; }
  .item-badge.nonfait, .detail-status.nonfait { color: #b91c1c; border-color: #b91c1c; }
  .item-info { border-top-color: #e5e7eb; }
  a { color: inherit; text-decoration: none; }
}
