/* ═══════════════════════════════════════════════
   AteliX v2 — Design System
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors */
  --primary:            #2563eb;
  --primary-dk:         #1d4ed8;
  --primary-lt:         #eff6ff;
  --primary-ring:       rgba(37,99,235,.18);
  --primary-text:       #ffffff;
  --sidebar-active-bg:  rgba(37,99,235,.25);
  --sidebar-active-txt: #93c5fd;
  --green:         #16a34a;
  --green-lt:      #dcfce7;
  --amber:         #d97706;
  --amber-lt:      #fef3c7;
  --red:           #dc2626;
  --red-lt:        #fee2e2;
  --purple:        #7c3aed;
  --purple-lt:     #ede9fe;

  /* Surfaces */
  --bg-page:   #f1f5f9;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --border:    #e2e8f0;
  --border-2:  #cbd5e1;

  /* Text */
  --text:   #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;

  /* Sidebar */
  --sidebar-bg:     linear-gradient(160deg, #1e3a8a 0%, #2558c9 55%, #3b82f6 100%);
  --sidebar-text:   #94a3b8;
  --sidebar-active: #2563eb;
  --sidebar-w:      220px;
  --sidebar-w-col:  58px;

  /* Sizes */
  --topbar-h:  54px;
  --drawer-w:  560px;
  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.08);
  --shadow-xl: 0 25px 60px rgba(0,0,0,.25);

  /* Z-index layers */
  --z-dropdown:   300;
  --z-drawer-ovl: 100;
  --z-drawer:     101;
  --z-modal:      200;
  --z-toast:      10000;
  --z-ctx-menu:   9999;
  --z-tooltip:    9999;
}

html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg-page); overflow: hidden; }

/* ══ APP LAYOUT ════════════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ══ SIDEBAR ════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg, #0f172a);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  position: relative;
  transition: width .2s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  z-index: 20;
}
.sidebar.collapsed { width: var(--sidebar-w-col); }

/* Cercles décoratifs style login */
.sidebar::before {
  content: '';
  position: absolute;
  width: 340px; height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.07);
  top: -110px; right: -110px;
  pointer-events: none; z-index: 0;
}
.sidebar::after {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.05);
  bottom: -70px; left: -70px;
  pointer-events: none; z-index: 0;
}

.sidebar-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  overflow: hidden;
  position: relative; z-index: 1;
}
.sidebar-logo { width: 30px; height: 30px; background: var(--primary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; color: #fff; flex-shrink: 0; }
.sidebar-logo-img { width: calc(var(--sidebar-w) * 0.75); max-height: 60px; object-fit: contain; object-position: center; border-radius: var(--radius-sm); }
.sidebar-name { font-size: 15px; font-weight: 800; color: #f1f5f9; white-space: nowrap; }
.sidebar-collapse { margin-left: auto; width: 26px; height: 26px; border: none; background: none; color: rgba(255,255,255,.4); cursor: pointer; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-collapse:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar.collapsed .sidebar-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-logout { display: none; }
.sidebar.collapsed .sidebar-collapse { margin-left: 0; transform: rotate(180deg); }

/* ── Remisage pneus (modal) ───────────────────────── */
.ts-tire-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}
.ts-tire-card { min-width: 0; }
.ts-tire-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 6px; position: relative; z-index: 1; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.nav-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: rgba(255,255,255,.3);
  padding: 14px 10px 5px;
  white-space: nowrap;
}

.nav-group { margin-bottom: 6px; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 10px 6px;
  border: none; background: none; cursor: pointer;
  color: rgba(255,255,255,.3); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
}
.nav-group-toggle:hover { color: rgba(255,255,255,.5); }
.nav-group-chevron { margin-left: auto; opacity: .5; transition: transform .15s; }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }
.sidebar.collapsed .nav-group-toggle { justify-content: center; padding: 10px 0 6px; }
.sidebar.collapsed .nav-group-label { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  border: none; background: none; width: 100%; text-align: left;
  font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap;
  margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .55; }

.sidebar-footer { padding: 8px 6px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; position: relative; z-index: 1; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius); cursor: default; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.4); white-space: nowrap; }
.user-logout { margin-left: auto; width: 26px; height: 26px; border: none; background: none; color: rgba(255,255,255,.35); cursor: pointer; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ══ TOPBAR ═════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title { font-size: 16px; font-weight: 700; white-space: nowrap; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.global-search { display: flex; align-items: center; gap: 8px; background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; width: 100%; max-width: 360px; }
.global-search svg { color: var(--text-3); flex-shrink: 0; }
.global-search input { border: none; background: none; outline: none; font-size: 13.5px; width: 100%; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none; cursor: pointer; color: var(--text-2); display: flex; align-items: center; justify-content: center; position: relative; }
.notif-badge { position: absolute; top: -5px; right: -5px; background: #dc2626; color: #fff; border-radius: 999px; font-size: 10px; line-height: 1; padding: 2px 5px; border: 2px solid #fff; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: none; }
.notif-list strong { display: block; font-size: 13px; }
.notif-list div { color: var(--text-2); font-size: 12px; }
.topbar-btn:hover { background: var(--bg-page); }

/* ══ DASHBOARD ══════════════════════════════════ */
.dash-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.dash-grid {
  position: relative;
  padding: 16px;
  min-height: 600px;
  flex: 1;
}
.dash-widget {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: box-shadow .15s;
}
.dash-widget:hover { box-shadow: var(--shadow-md); }
.dash-ghost { box-shadow: var(--shadow-xl) !important; border-color: var(--primary) !important; }
.dash-editing .dash-widget { border-style: dashed; }
.dash-widget-header {
  display: flex; align-items: center; gap-8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  gap: 8px;
  user-select: none;
}
.dash-widget-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-3); display: flex; align-items: center; }
.dash-widget-icon svg { width: 16px; height: 16px; }
.dash-widget-title { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; flex: 1; }
.dash-widget-body {
  flex: 1; min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.dash-widget-loading {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
}
.dash-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  cursor: se-resize;
  z-index: 10;
}
.dash-resize-handle::after {
  content: '';
  position: absolute; bottom: 4px; right: 4px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--border-2);
  border-bottom: 2px solid var(--border-2);
  border-radius: 1px;
  transition: border-color .15s;
}
.dash-resize-handle:hover::after { border-color: var(--primary); }

/* KPI */
.dash-kpi {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  height: 100%;
}
.dash-kpi-icon {
  width: 46px; height: 46px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-kpi-icon svg { width: 22px; height: 22px; }
.dash-kpi-data { flex: 1; min-width: 0; }
.dash-kpi-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.dash-kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* Listes */
.dash-list { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.dash-list-header {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 8px; align-items: center;
  padding: 6px 12px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.dash-list-row {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 8px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background .1s;
}
.dash-list-row:last-child { border-bottom: none; }
.dash-list-row:hover { background: var(--surface-2); }
.dash-list { overflow-y: auto; }
.dash-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 13px; color: var(--text-3);
  font-style: italic;
}

/* Catalogue widgets */
.dash-catalog-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
  text-align: center;
}
.dash-catalog-item:hover {
  background: var(--primary-lt); border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ══ CONTENT AREA ═══════════════════════════════ */
.content-area { flex: 1; overflow-y: auto; display: flex; flex-direction: column; position: relative; }

/* Module header */
.module-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.module-actions { display: flex; gap: 8px; align-items: center; }
.module-actions-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Stats strip */
.stats-strip { display: grid; gap: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.stat-item { padding: 14px 20px; border-right: 1px solid var(--border); }
.stat-item:last-child { border-right: none; }
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1; }
.stat-sub { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-tabs { display: flex; gap: 3px; }
.filter-tab { padding: 5px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: none; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.filter-tab:hover { background: var(--bg-page); color: var(--text); }
.filter-tab.active { background: var(--primary-lt); color: var(--primary); }
.filter-count { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; background: currentColor; color: #fff; }
.filter-tab.active .filter-count { background: var(--primary); color: var(--primary-text); }
.filter-tab:not(.active) .filter-count { background: var(--text-3); color: #fff; }
.filter-bar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search-input { padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; width: 200px; font-family: inherit; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ══ DATA TABLE ═════════════════════════════════ */
.table-wrap { flex: 1; overflow: auto; scrollbar-gutter: stable; }
table.data-table { border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
.data-table th.dt-filler,
.data-table td.dt-filler { padding: 0; pointer-events: none; user-select: none; width: auto; }
.data-table thead th {
  text-align: left; padding: 9px 16px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
  text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden;
  user-select: none; cursor: pointer;
  /* resize handle needs relative */
  position: relative;
}
.data-table thead th:hover { color: var(--text); background: var(--bg-page); }
.data-table thead th.dt-drag-over { box-shadow: inset 2px 0 0 var(--primary); }
.data-table thead th.dt-dragging  { opacity: 0.45; }
/* Resize handle */
.th-resize-handle {
  position: absolute; right: 0; top: 20%; bottom: 20%;
  width: 5px; cursor: col-resize; z-index: 2;
  border-right: 2px solid var(--border);
}
.th-resize-handle:hover, .th-resize-handle.dt-resizing { border-right-color: var(--primary); }
/* Overflow ellipsis on th label */
.th-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
/* Column picker context menu */
.dt-col-picker {
  position: fixed; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-xl);
  z-index: var(--z-ctx-menu);
  padding: 6px 0; z-index: 9999; min-width: 210px; max-height: 420px; overflow-y: auto;
}
.dt-picker-title { padding: 4px 14px 6px; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.dt-picker-sep   { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.dt-picker-item  { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.dt-picker-item:hover { background: var(--bg-page); }
.dt-picker-item input[type="checkbox"] { cursor: pointer; width: 14px; height: 14px; }
.dt-picker-hint  { padding: 4px 14px; font-size: 11px; color: var(--text-2); font-style: italic; }
.data-table tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background .08s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr.selected { background: var(--primary-lt); }
.data-table tbody td { padding: 11px 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-bold { font-weight: 600; }
.td-muted { color: var(--text-2); font-size: 13px; }
.td-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .1s; justify-content: flex-end; }
.data-table tbody tr:hover .td-actions { opacity: 1; }
.data-table td.dt-actions-td { text-align: right; padding-right: 12px; pointer-events: auto; }

/* ══ STATUS PILLS ═══════════════════════════════ */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill-green  { background: var(--green-lt);  color: var(--green); }
.pill-amber  { background: var(--amber-lt);  color: var(--amber); }
.pill-blue   { background: var(--primary-lt); color: var(--primary); }
.pill-red    { background: var(--red-lt);    color: var(--red); }
.pill-gray   { background: #f1f5f9;          color: #64748b; }
.pill-purple { background: var(--purple-lt); color: var(--purple); }
.pill-no-dot::before { display: none; }

/* ══ PROGRESS BAR ═══════════════════════════════ */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 60px; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.progress-pct { font-size: 12px; color: var(--text-2); width: 30px; flex-shrink: 0; }

/* ══ BUTTONS ════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: background .12s, box-shadow .12s, opacity .12s;
  font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-primary:not(:disabled):hover { background: var(--primary-dk); }
.btn-ghost    { background: none; color: var(--text-2); border-color: var(--border); }
.btn-ghost:not(:disabled):hover { background: var(--bg-page); }
.btn-danger   { background: var(--red-lt); color: var(--red); border-color: #fecaca; }
.btn-danger:not(:disabled):hover { background: #fecaca; }
.btn-success  { background: var(--green-lt); color: var(--green); border-color: #bbf7d0; }
.btn-success:not(:disabled):hover { background: #bbf7d0; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

/* ══ FORMS ══════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px;
  outline: none; font-family: inherit; color: var(--text);
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.field textarea { resize: vertical; min-height: 70px; }
.field input[type="color"] { padding: 2px 4px; height: 36px; cursor: pointer; }
#wo-odo-in::-webkit-outer-spin-button,
#wo-odo-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#wo-odo-in { -moz-appearance: textfield; appearance: textfield; }
#wo-odo-in.odo-empty { background: var(--red-lt) !important; }
#wo-odo-in.odo-empty::placeholder { color: var(--red); opacity: 1; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.input-error { border-color: var(--red) !important; background: #fff5f5 !important; }
.field-error { font-size: 11.5px; color: var(--red); margin-top: 3px; }
.label-req { color: var(--red); }

/* Places autocomplete */
.places-wrap { position: relative; }
.places-dropdown {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: var(--z-ctx-menu);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(0,0,0,.12);
  max-height: 260px; overflow-y: auto;
}
.places-item {
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.places-item:last-child { border-bottom: none; }
.places-item:hover, .places-item.active { background: var(--primary-ring); }
.places-item-name { font-size: 13px; font-weight: 600; color: var(--text); }
.places-item-address { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }
.places-item-badges { display: flex; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.places-badge { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; background: var(--bg-page); color: var(--text-2); border: 1px solid var(--border); }
.places-badge.has-phone { color: var(--green); border-color: var(--green); background: #f0fdf4; }
.places-searching { padding: 10px 12px; font-size: 13px; color: var(--text-2); text-align: center; }

/* Inline editable field */
.inline-edit {
  width: 100%; padding: 6px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text);
  background: transparent; outline: none; resize: vertical;
  transition: border-color .12s, background .12s;
}
.inline-edit:hover { border-color: var(--border); background: var(--surface-2); }
.inline-edit:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ══ SECTION ════════════════════════════════════ */
.section { padding: 16px 20px; }
.section + .section { border-top: 1px solid var(--border); }
.section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-title-actions { margin-left: auto; }

/* ══ CARDS ══════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 13.5px; font-weight: 600; }
.card-actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 16px; }

/* ══ INFO GRID ══════════════════════════════════ */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 3px; }
.info-value { font-size: 14px; }
.info-value-sm { font-size: 13px; color: var(--text-2); margin-top: 1px; }

/* ══ INLINE EDIT ═════════════════════════════════ */
[data-ie-field] { cursor: default; border-radius: var(--radius-sm); transition: background .15s; }
[data-ie-field]:hover { background: var(--primary-lt); }
.ie-hint { display: none; font-size: 11px; color: var(--primary); margin-left: 4px; opacity: .8; vertical-align: middle; line-height: 1; }
[data-ie-field]:hover .ie-hint { display: inline; }
.ie-wrap { display: flex; align-items: flex-start; gap: 4px; position: relative; }
.ie-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: var(--z-ctx-menu); max-height: 240px; overflow-y: auto; display: none; margin-top: 2px; }
.ie-dropdown-item { padding: 8px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ie-dropdown-item:hover { background: var(--primary-lt); color: var(--primary); }
.ie-dropdown-empty { padding: 8px 12px; font-size: 13px; color: var(--text-2); }
.ie-input { flex: 1; padding: 5px 8px; border: 1.5px solid var(--primary); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; outline: none; min-width: 0; background: var(--surface); color: var(--text); }
textarea.ie-input { resize: vertical; }
select.ie-input { cursor: pointer; }
.ie-save, .ie-cancel { flex-shrink: 0; width: 26px; height: 26px; border: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.ie-save { background: var(--green); color: #fff; }
.ie-save:hover { background: #15803d; }
.ie-save:disabled { opacity: .5; cursor: default; }
.ie-cancel { background: var(--border); color: var(--text-2); font-size: 16px; line-height: 1; }
.ie-cancel:hover { background: var(--border-2); }

/* ══ TASK LIST ══════════════════════════════════ */
.task-list { display: flex; flex-direction: column; gap: 5px; }
.task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.task-item:hover { border-color: var(--primary); background: var(--primary-lt); }
.task-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.task-time { font-size: 12.5px; font-weight: 600; color: var(--text-2); flex-shrink: 0; }
.task-actions { display: flex; gap: 4px; flex-shrink: 0; }

.btn-play { width: 26px; height: 26px; border-radius: var(--radius-sm); border: none; background: var(--green-lt); color: var(--green); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.btn-play:hover { background: #bbf7d0; }
.btn-stop { background: var(--amber-lt); color: var(--amber); }
.btn-stop:hover { background: #fde68a; }

.add-row-btn { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-2); background: none; width: 100%; text-align: left; }
.add-row-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }

/* ══ PARTS TABLE ════════════════════════════════ */
.parts-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.parts-table th { text-align: left; padding: 7px 10px; font-size: 11px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .3px; }
.parts-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.parts-table tbody tr:last-child td { border-bottom: none; }
.parts-table tfoot td { padding: 9px 10px; font-weight: 700; border-top: 2px solid var(--border); background: var(--surface-2); }
.parts-table .num { text-align: right; }
.parts-table tbody tr:hover { background: var(--surface-2); }

/* Quick part search */
.quick-part-wrap { position: relative; }
.quick-part-input { width: 100%; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; }
.quick-part-input:focus { border-color: var(--primary); }
.quick-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  z-index: 50; overflow: hidden;
}
.sugg-header { display: grid; grid-template-columns: 90px 1fr 80px; padding: 5px 10px; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.sugg-item { display: grid; grid-template-columns: 90px 1fr 80px; padding: 8px 10px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.sugg-item > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.sugg-item:last-child { border-bottom: none; }
.sugg-item:hover, .sugg-item.sugg-highlighted { background: var(--primary-lt); color: var(--primary); }
.sugg-new, .sugg-create { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-new { color: var(--primary); font-weight: 500; }

/* ══ PCC ════════════════════════════════════════ */
.pcc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pcc-label { font-size: 11.5px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.pcc-grid .inline-edit { min-height: 80px; }

/* ══ DRAWER ═════════════════════════════════════ */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.2); z-index: var(--z-drawer-ovl); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer-resize-handle {
  position: fixed;
  right: calc(var(--drawer-w) - 10px);
  top: 50%;
  transform: translateX(100vw) translateY(-50%);
  transition: transform .25s cubic-bezier(.4,0,.2,1), border-color .15s, box-shadow .15s;
  width: 20px; height: 45px;
  cursor: col-resize; z-index: calc(var(--z-drawer) + 1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: -3px 0 10px rgba(0,0,0,.10);
  display: flex; align-items: center; justify-content: center;
}
.drawer-resize-handle.visible {
  transform: translateX(0) translateY(-50%);
}
.drawer-resize-handle::after {
  content: ''; width: 3px; height: 26px;
  background: var(--border-2); border-radius: 3px;
  transition: background .15s;
}
.drawer-resize-handle:hover { border-color: var(--primary); box-shadow: -3px 0 10px var(--primary-ring); }
.drawer-resize-handle:hover::after,
.drawer-resize-handle.dragging::after { background: var(--primary); }
.drawer-resize-handle.dragging { border-color: var(--primary); }

.drawer {
  position: fixed; right: 0; top: 0;
  height: 100dvh;
  width: var(--drawer-w);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-drawer);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.drawer-header-info { flex: 1; min-width: 0; }
.drawer-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-subtitle { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.drawer-header-actions { display: flex; gap: 6px; align-items: flex-start; }
.drawer-close { width: 30px; height: 30px; border: 1px solid var(--border); background: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; }
.drawer-close:hover { background: var(--bg-page); }

.drawer-tabs { display: flex; padding: 0 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.drawer-tab { padding: 9px 14px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-2); border: none; background: none; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.drawer-tab:hover { color: var(--text); }
.drawer-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.drawer-body { flex: 1 1 0; min-height: 0; height: 0; overflow-y: auto; padding-bottom: 8px; }
.drawer-body::-webkit-scrollbar,
.content-area::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.config-nav::-webkit-scrollbar,
.config-panel::-webkit-scrollbar,
.appt-cal-scroll::-webkit-scrollbar { width: 10px; height: 10px; }

.drawer-body::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.config-nav::-webkit-scrollbar-track,
.config-panel::-webkit-scrollbar-track,
.appt-cal-scroll::-webkit-scrollbar-track { background: var(--bg-page); }

.drawer-body::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.config-nav::-webkit-scrollbar-thumb,
.config-panel::-webkit-scrollbar-thumb,
.appt-cal-scroll::-webkit-scrollbar-thumb { background: var(--text-3); border-radius: 4px; }

.drawer-body::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.config-nav::-webkit-scrollbar-thumb:hover,
.config-panel::-webkit-scrollbar-thumb:hover,
.appt-cal-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

.drawer-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-shrink: 0;
  background: var(--surface);
}
/* ══ TASK ACCORDION (unified drawer tab) ══════════ */
.task-accordion { border: 1px solid var(--border); border-left: 4px solid var(--border-2); border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); box-shadow: var(--shadow); }
.task-accordion[data-task-status="open"]        { border-left-color: var(--text-3); }
.task-accordion[data-task-status="in_progress"] { border-left-color: var(--amber); }
.task-accordion[data-task-status="closed"]      { border-left-color: var(--green); }
.task-accordion[data-task-status="waiting"]     { border-left-color: var(--purple); }
.task-acc-header { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; user-select: none; background: var(--bg-page); transition: background .12s; border-radius: var(--radius) var(--radius) 0 0; }
.task-acc-header:hover { background: var(--border); }
.task-acc-chevron { font-size: 11px; color: var(--text-2); transition: transform .18s; flex-shrink: 0; }
.task-acc-info { flex: 1; min-width: 0; }
.task-acc-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-acc-meta { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.task-acc-btns { display: flex; gap: 4px; flex-shrink: 0; }
.task-acc-body { padding: 12px; border-top: 1px solid var(--border); flex-direction: column; gap: 12px; }
.task-acc-insp { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.task-acc-insp-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.task-insp-select { flex: 1; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; background: var(--bg-page); color: var(--text); font-family: inherit; cursor: pointer; }
.task-insp-select:focus { outline: none; border-color: var(--primary); }
.task-acc-pcc { display: flex; flex-direction: column; gap: 8px; }
.task-acc-pcc label { font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; display: block; }
.task-acc-pcc textarea { width: 100%; resize: vertical; min-height: 56px; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-page); color: var(--text); font-family: inherit; box-sizing: border-box; }
.task-acc-pcc textarea:focus { outline: none; border-color: var(--primary); }
.task-acc-parts { display: flex; flex-direction: column; gap: 6px; }
.task-acc-parts-hdr { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.task-acc-parts-hdr span { font-size: 11.5px; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .4px; }
.part-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--bg-page); border-radius: var(--radius-sm); font-size: 12px; }
.part-row-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.part-row-qty { color: var(--text-2); flex-shrink: 0; font-size: 11px; }
.part-row-price { color: var(--text-2); flex-shrink: 0; font-size: 11px; min-width: 52px; text-align: right; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.part-row-disc { font-size: 10px; font-weight: 600; color: var(--amber); background: var(--amber-lt); padding: 1px 4px; border-radius: 4px; flex-shrink: 0; }
/* ── Grille pièces inline (estimés) ──────────────── */
.est-parts-grid { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.est-parts-grid-hdr,
.est-parts-grid-row,
.est-parts-grid-new { display: grid; grid-template-columns: 16px 52px 82px 1fr 54px 76px 76px 110px 26px 26px; gap: 3px; align-items: center; }
.epg-drag-handle { cursor: grab; color: var(--text-3); font-size: 14px; display: flex; align-items: center; justify-content: center; line-height: 1; user-select: none; padding: 2px 0; }
.epg-drag-handle:active { cursor: grabbing; }
.est-parts-grid-row.epg-dragging { opacity: 0.4; }
.est-parts-grid-row.epg-drag-over-top { border-top: 2px solid var(--primary); }
.est-parts-grid-row.epg-drag-over-bottom { border-bottom: 2px solid var(--primary); }
.epg-input[type=number]::-webkit-inner-spin-button,
.epg-input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.epg-input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.epg-total { background: var(--surface-2) !important; color: var(--text-2); font-weight: 500; cursor: default; }
.est-parts-grid-hdr { padding: 2px 2px 5px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.est-parts-grid-hdr span { font-size: 10.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.est-parts-grid-row { padding: 1px 0; }
.est-parts-grid-new { padding: 4px 0 2px; border-top: 1px dashed var(--border); margin-top: 2px; }
.task-labor-summary { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-top: 4px; background: var(--primary-lt); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.task-labor-summary--empty { background: var(--surface-2); }
.task-labor-badge { font-size: 11.5px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.task-labor-summary--empty .task-labor-badge { color: var(--text-2); }
.task-labor-time { font-size: 12px; color: var(--text-2); flex: 1; }
.task-labor-amount { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; margin-left: auto; }
.task-labor-summary--empty .task-labor-amount { color: var(--text-3); font-weight: 400; }
.epg-input { padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-family: inherit; color: var(--text); background: var(--surface); width: 100%; box-sizing: border-box; height: 28px; }
.epg-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-ring); outline: none; }
.est-parts-grid-row .epg-input { background: var(--surface-2); }
.est-parts-grid-row .epg-input:focus,
.est-parts-grid-new .epg-input:focus { background: var(--surface); }
.est-parts-grid-new { position: relative; }
.epg-sku-sugg { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 220px; overflow-y: auto; }
.epg-sku-item { display: grid; grid-template-columns: 16px 52px 82px 1fr 54px 76px 76px 110px 26px 26px; gap: 3px; padding: 5px 2px; cursor: pointer; font-size: 12px; align-items: center; }
.epg-sku-item:hover, .epg-sku-item-hl { background: var(--primary-lt); }
.epg-si-sku { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epg-si-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epg-si-price { text-align: right; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.task-acc-pcc { display: flex; flex-direction: column; gap: 4px; }
.task-acc-notes { display: flex; flex-direction: column; gap: 4px; }
.task-acc-notes textarea { width: 100%; resize: vertical; min-height: 56px; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-page); color: var(--text); font-family: inherit; box-sizing: border-box; }
.task-acc-notes textarea:focus { outline: none; border-color: var(--primary); }
.task-acc-logs { display: flex; flex-direction: column; gap: 4px; }
.task-sec-drag { cursor: grab; color: var(--text-3); padding: 0 4px; user-select: none; font-size: 14px; line-height: 1; }
.task-sec-drag:hover { color: var(--primary); }
.sec-dragging { opacity: 0.35; }
.sec-over-top { border-top: 2px solid var(--primary); }
.sec-over-bot { border-bottom: 2px solid var(--primary); }
.task-sec-popover { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px 4px; z-index: 300; min-width: 190px; }
.task-sec-pop-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer; font-size: 13px; border-radius: var(--radius-sm); color: var(--text); }
.task-sec-pop-item:hover { background: var(--surface-2); }
.task-sec-pop-item input { accent-color: var(--primary); cursor: pointer; width: 14px; height: 14px; }
.tl-grid { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.tl-grid-hdr,
.tl-grid-row { display: grid; grid-template-columns: 1fr 90px 120px 120px 52px 110px 26px; gap: 3px; align-items: center; }
.tl-grid-hdr { padding: 2px 2px 5px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.tl-grid-hdr span { font-size: 10.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.tl-grid-row { padding: 1px 0; }
.tlg-input { padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-family: inherit; color: var(--text); background: var(--surface-2); width: 100%; box-sizing: border-box; height: 28px; }
.tlg-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-ring); outline: none; background: var(--surface); }
.tlg-dur { background: var(--surface-2) !important; color: var(--text-2); font-weight: 500; cursor: default; }

/* ── Grille factures fournisseurs ──────────────────── */
.si-lines-grid { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.si-lines-hdr,
.si-line-row { display: grid; grid-template-columns: 58px 74px 1fr 148px 90px 26px; gap: 3px; align-items: center; }
.si-lines-hdr { padding: 2px 2px 5px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.si-lines-hdr span { font-size: 10.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.si-line-row { padding: 1px 0; }
.si-line-new { padding: 4px 0 2px; border-top: 1px dashed var(--border); margin-top: 2px; }
.epg-del { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-3); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0; }
.epg-del:hover { background: var(--red-lt); color: var(--red); }
.si-line-row .epg-input { background: var(--surface-2); }
.si-line-row .epg-input:focus { background: var(--surface); }
.si-ro { display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; height: 28px; padding: 0 6px; color: var(--text); cursor: default; }
.si-col-sku   { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-col-desc  { }
.si-col-qty   { text-align: center; }
.si-col-price { text-align: right; }
.si-col-gl    { }
.si-col-total { text-align: right; }
.si-col-del   { display: flex; justify-content: center; }
.si-totals-wrap { margin: 8px 20px 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.si-total-row { display: flex; gap: 32px; font-size: 13px; color: var(--text-2); align-items: center; }
.si-total-row > span:first-child { min-width: 80px; }
.si-total-row > span:last-child, .si-total-row > .si-tax-val { min-width: 90px; text-align: right; font-weight: 500; color: var(--text); }
.si-tax-input { width: 90px; text-align: right; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; color: var(--text); background: var(--surface); }
.si-tax-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.si-total-grand { font-size: 14px; font-weight: 700; color: var(--text); border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.si-total-grand span:last-child { color: var(--primary); }

.task-part-search-wrap { position: relative; }
.task-part-search-wrap input { width: 100%; font-size: 12px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-page); color: var(--text); font-family: inherit; box-sizing: border-box; }
.task-part-search-wrap input:focus { outline: none; border-color: var(--primary); }
.task-part-sugg { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 160px; overflow-y: auto; display: none; }
.task-part-sugg.open { display: block; }
.task-part-sugg-item { padding: 6px 10px; font-size: 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.task-part-sugg-item:hover { background: var(--bg-page); }
.task-part-sugg-item span:last-child { color: var(--text-2); flex-shrink: 0; }

/* ── Part-form live-search dropdown ── */
.pf-sugg { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: var(--z-dropdown); max-height: 200px; overflow-y: auto; display: none; }
.pf-sugg.open { display: block; }
.pf-sugg-item { padding: 7px 10px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.pf-sugg-item:hover, .pf-sugg-item.sugg-highlighted { background: var(--primary-lt); color: var(--primary); }
.pf-sugg-sku   { font-weight: 600; color: var(--text); flex-shrink: 0; min-width: 70px; }
.pf-sugg-name  { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-sugg-price { color: var(--text-2); flex-shrink: 0; }

/* ══ MODAL ══════════════════════════════════════ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); backdrop-filter: blur(3px); z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .18s; }
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 560px; max-height: 88vh;
  box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  transform: scale(.96) translateY(8px);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }
.confirm-modal { width: 380px; }

.modal-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; flex: 1; }
.modal-close { width: 30px; height: 30px; border: 1px solid var(--border); background: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.modal-close:hover { background: var(--bg-page); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }

/* ══ TOAST ══════════════════════════════════════ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn .25s cubic-bezier(.4,0,.2,1);
  max-width: 340px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast-success { background: var(--green-lt); color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background: var(--red-lt);   color: #991b1b; border: 1px solid #fecaca; }
.toast-info    { background: var(--primary-lt); color: var(--primary-dk); border: 1px solid #bfdbfe; }
.toast-icon    { flex-shrink: 0; }
.toast-out     { animation: toastOut .25s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ══ LOADING ════════════════════════════════════ */
.loading-page { flex: 1; display: flex; align-items: center; justify-content: center; }
.loading-state { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; animation: spin .7s linear infinite; border-color: var(--border); border-top-color: var(--primary); border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-3); gap: 10px; }
.empty-state p { font-size: 14px; }

/* ══ CALENDRIER APPOINTMENTS ════════════════════ */
.cal-tooltip { position: fixed; z-index: var(--z-tooltip); background: #1e293b; color: #f1f5f9; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12px; line-height: 1.6; max-width: 280px; pointer-events: none; box-shadow: var(--shadow-lg); display: none; }
.cal-ctx-menu { position: fixed; z-index: var(--z-ctx-menu); }
.cal-week-label { font-size:14px; font-weight:600; padding:0 12px; color:var(--text); }

/* Zone racine — prend la hauteur restante */
.appt-cal-root { flex:1; overflow:hidden; display:flex; flex-direction:column; min-height:0; }
.appt-cal-scroll { flex:1; overflow:auto; }
.appt-cal-inner { display:block; }


/* Ligne heure courante */
.cal-now-line { position:absolute; top:0; bottom:0; width:2px; background:#f97316; z-index:10; pointer-events:none; border-radius:1px; }
.cal-now-line::before { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:8px; height:8px; border-radius:50%; background:#f97316; }

/* Barre des heures */
.appt-time-bar { display:flex; background:var(--surface); border-bottom:2px solid var(--border); }
.cal-th-cell { flex-shrink:0; text-align:left; padding:5px 4px 4px; font-size:10.5px; font-weight:700; color:var(--text-3); border-right:1px solid var(--border); }

/* Section par technicien */
.cal-tech-section { border-bottom:2px solid var(--border); }
.cal-tech-hdr { display:flex; align-items:center; gap:8px; padding:6px 12px; background:var(--surface-2); font-size:13px; font-weight:700; color:var(--text); position:sticky; left:0; }
.cal-tech-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.cal-tech-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-tech-name--clickable { cursor:pointer; border-radius:var(--radius-sm); padding:1px 4px; transition:background .12s,color .12s; }
.cal-tech-name--clickable:hover { background:var(--primary-lt); color:var(--primary); }
.cal-tv-grp { display:flex; gap:2px; margin-left:auto; flex-shrink:0; }
.cal-tv-btn { padding:2px 7px; font-size:11px; font-weight:600; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-2); cursor:pointer; line-height:1.6; transition:background .12s,color .12s; }
.cal-tv-btn:hover { background:var(--primary-lt); color:var(--primary); border-color:var(--primary); }
.cal-tv-btn.active { background:var(--primary); color:var(--primary-text); border-color:var(--primary); }
.cal-tv-btn-close.active { background:#64748b; border-color:#64748b; }
.cal-tech-collapsed .cal-tech-hdr { opacity:.75; }

/* Ligne de jour */
.cal-day-row { display:flex; align-items:stretch; border-bottom:1px solid var(--border); }
.cal-day-row.cal-today { background:var(--primary-lt); }
.cal-day-row.cal-weekend .cal-slots-wrap { background:rgba(0,0,0,.025); }
.cal-day-lbl { display:flex; align-items:center; gap:5px; padding:0 10px; font-size:12px; color:var(--text-2); border-right:2px solid var(--border); background:var(--surface); position:sticky; left:0; z-index:5; flex-shrink:0; }
.cal-day-name { font-weight:600; }
.cal-day-num { font-size:13px; }
.cal-day-today { background:var(--primary); color:var(--primary-text); border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; }

/* Grille de slots */
.cal-slots-wrap { position:relative; flex:1; }
.cal-slots-grid { display:flex; height:100%; }
.cal-slot { flex-shrink:0; border-right:1px solid rgba(0,0,0,.15); cursor:crosshair; user-select:none; }
.cal-slot-hr { border-right-color:rgba(0,0,0,.06); }
.cal-slot:hover { background:var(--primary-lt) !important; }

/* Événements */
.cal-events-layer { position:absolute; inset:0; pointer-events:none; }
.cal-event { position:absolute; border-radius:var(--radius-sm); pointer-events:all; display:flex; align-items:stretch; overflow:hidden; user-select:none; }
.cal-event:hover { filter:brightness(.92); }
.cal-event-body { flex:1; padding:2px 4px 2px 6px; font-size:11.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:grab; display:flex; align-items:center; }
.cal-event-body:active { cursor:grabbing; }
.cal-event-resize { width:7px; flex-shrink:0; cursor:ew-resize; background:rgba(0,0,0,.12); opacity:0; transition:opacity .15s; }
.cal-event:hover .cal-event-resize { opacity:1; }

/* Drag ghost / selection */
.cal-drag-ghost { border-radius:var(--radius-sm); }

/* Zones indisponibles du technicien */
.cal-unavail {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(0,0,0,.10);
  pointer-events: none;
  z-index: 1;
}
.cal-unavail-lunch {
  background: rgba(0,0,0,.07);
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 4px,
    rgba(0,0,0,.05) 4px, rgba(0,0,0,.05) 8px
  );
}

/* Plage réservée (hachures) */
.cal-event--reserved {
  background: repeating-linear-gradient(
    45deg,
    rgba(99,102,241,.30),
    rgba(99,102,241,.30) 4px,
    rgba(99,102,241,.08) 4px,
    rgba(99,102,241,.08) 9px
  ) !important;
}
.cal-event--reserved .cal-event-body,
.cal-event--reserved .cal-v-event-body {
  font-style: italic;
  opacity: .85;
}

/* Événement sélectionné (clic simple) */
.cal-event--selected {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  filter: brightness(.9);
  z-index: 6;
}

/* Menu contextuel (clic droit) */
.cal-ctx-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  padding: 4px 0;
  overflow: hidden;
}
.ctx-menu-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
  padding: 6px 14px 4px;
}
.ctx-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.ctx-menu-item:hover { background: var(--surface-2); }
.ctx-menu-item--active { font-weight: 700; color: var(--primary); }
.ctx-menu-item--danger { color: var(--red); }
.ctx-menu-item--danger:hover { background: var(--red-lt); }
.ctx-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sélecteur de vue calendrier */
.cal-view-grp { display:flex; border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.cal-view-btn { padding:5px 11px; font-size:12px; font-weight:600; border:none; background:var(--surface); color:var(--text-2); cursor:pointer; transition:background .12s,color .12s; border-right:1px solid var(--border); }
.cal-view-btn:last-child { border-right:none; }
.cal-view-btn:hover { background:var(--bg-page); color:var(--text); }
.cal-view-btn.active { background:var(--primary); color:var(--primary-text); }

/* Boutons de mode d'affichage h/v/l */
.cal-mode-grp { display:flex; border:1px solid var(--border-2); border-radius:var(--radius-sm); overflow:hidden; flex-shrink:0; }
.cal-mode-btn { display:flex; align-items:center; justify-content:center; width:30px; height:30px; border:none; border-left:1px solid var(--border-2); background:var(--surface); color:var(--text-2); cursor:pointer; transition:background .1s,color .1s; }
.cal-mode-btn:first-child { border-left:none; }
.cal-mode-btn:hover { background:var(--surface-2); color:var(--text); }
.cal-mode-btn.active { background:var(--primary); color:#fff; }

/* ── VUE VERTICALE par technicien ─────────────────────────── */
.appt-cal-root:has(.cal-v-wrap-outer) { overflow-y:auto; overflow-x:auto; }
.cal-v-wrap-outer { display:flex; flex-direction:column; gap:0; min-width:600px; }
.cal-v-tech-section { border-bottom:2px solid var(--border-2); }
.cal-v-tech-section.cal-tech-collapsed .cal-v-grid-wrap { display:none; }
.cal-v-tech-hdr { display:flex; align-items:center; gap:8px; padding:6px 12px; background:var(--surface-2); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:10; font-size:13px; font-weight:700; color:var(--text); }
.cal-v-grid-wrap { overflow:visible; }
.cal-v-hdr { display:flex; border-bottom:1px solid var(--border-2); background:var(--surface); position:sticky; top:35px; z-index:8; flex-shrink:0; }
.cal-v-day-hdr { flex:1; display:flex; flex-direction:column; align-items:center; padding:5px 4px; border-left:1px solid var(--border); min-width:0; }
.cal-v-day-hdr-today { background:var(--primary-lt); }
.cal-v-inner { position:relative; display:flex; }
.cal-v-time-col { position:sticky; left:0; z-index:4; background:var(--surface); border-right:1px solid var(--border-2); flex-shrink:0; }
.cal-v-time-lbl { position:absolute; right:6px; font-size:10.5px; color:var(--text-3); transform:translateY(-50%); white-space:nowrap; user-select:none; }
.cal-v-grid-lines { position:absolute; inset:0; pointer-events:none; }
.cal-v-grid-line { position:absolute; left:0; right:0; height:1px; }
.cal-v-grid-hr   { background:var(--border-2); }
.cal-v-grid-half { background:var(--border); }
.cal-v-day-cols { position:absolute; top:0; bottom:0; right:0; display:flex; }
.cal-v-day-col { flex:1; position:relative; border-left:1px solid var(--border); min-width:80px; }
.cal-v-col-today   { background:var(--primary-lt); }
.cal-v-col-weekend { background:var(--surface-2); }
.cal-v-unavail { position:absolute; left:0; right:0; background:rgba(0,0,0,.06); pointer-events:none; z-index:1; }
.cal-v-slot { z-index:1; pointer-events:auto; cursor:crosshair; }
.cal-v-event { position:absolute; border-radius:var(--radius-sm); overflow:hidden; cursor:pointer; z-index:2; transition:filter .1s; display:flex; flex-direction:column; }
.cal-v-event:hover { filter:brightness(.93); }
.cal-v-event-body { display:flex; flex-direction:column; padding:2px 5px; flex:1; overflow:hidden; }
.cal-v-event-resize { height:6px; cursor:s-resize; flex-shrink:0; background:transparent; }
.cal-v-event-resize:hover { background:rgba(0,0,0,.15); }
.cal-v-now-line { position:absolute; left:0; right:0; height:2px; background:var(--red); opacity:.85; pointer-events:none; z-index:3; }

/* ── VUE LISTE ────────────────────────────────────────────── */
.appt-cal-root:has(.cal-list-wrap) { overflow-y:auto; }
.cal-list-wrap { padding:0 0 24px; display:flex; flex-direction:column; gap:0; }
.cal-list-tech-section { display:flex; flex-direction:column; }
.cal-list-tech-section + .cal-list-tech-section { border-top:2px solid var(--border); margin-top:16px; }
.cal-list-tech-section .cal-v-tech-hdr { position:sticky; top:0; z-index:10; }
.cal-list-tech-body { padding:8px 16px 16px; display:flex; flex-direction:column; gap:12px; }
.cal-list-day-hdr { display:flex; align-items:center; gap:8px; padding:6px 0 6px 4px; margin-bottom:4px; border-bottom:2px solid var(--border); position:sticky; top:35px; background:var(--bg-page); z-index:2; }
.cal-list-wrap--flat .cal-list-day-hdr { top:0; }
.cal-list-day-hdr-today { border-bottom-color:var(--primary); }
.cal-list-day-label { font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--text-2); }
.cal-list-day-hdr-today .cal-list-day-label { color:var(--primary); }
.cal-list-today-badge { font-size:11px; font-weight:600; background:var(--primary); color:#fff; padding:2px 7px; border-radius:20px; }
.cal-list-items { display:flex; flex-direction:column; gap:4px; }
.cal-list-empty { font-size:13px; color:var(--text-3); padding:10px 4px; font-style:italic; }
.cal-list-item { display:flex; align-items:center; gap:10px; padding:10px 14px; background:var(--surface); border-radius:var(--radius-sm); border:1px solid var(--border); border-left-width:4px; cursor:pointer; transition:background .1s; }
.cal-list-item:hover { background:var(--surface-2); }
.cal-list-item--reserved { border-left:1px solid var(--border) !important; background:repeating-linear-gradient(45deg,rgba(99,102,241,.18),rgba(99,102,241,.18) 4px,rgba(99,102,241,.05) 4px,rgba(99,102,241,.05) 9px) !important; font-style:italic; }
.cal-list-time { font-size:12px; font-weight:600; color:var(--text-2); white-space:nowrap; min-width:110px; flex-shrink:0; }
.cal-list-info { flex:1; min-width:0; }
.cal-list-name { font-size:14px; font-weight:600; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cal-list-sub { font-size:12px; color:var(--text-3); margin-top:1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cal-list-status { font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:20px; white-space:nowrap; flex-shrink:0; }

/* ══ MISC ════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 12.5px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ══ CONFIG LAYOUT ══════════════════════════════ */
/* ── Time wheel wrapper ──────────────────────────── */
.tw-wrap { position: relative; display: inline-flex; }
.tw-wrap input[type="time"] { width: 78px; font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; }
.tw-overlay { position: absolute; inset: 0; cursor: pointer; border-radius: var(--radius); }
.tw-overlay:hover { background: var(--primary-lt); }

/* ── Drum time picker popup ──────────────────────── */
.tdrum-popup { position: fixed; z-index: var(--z-ctx-menu); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xl); width: 168px; display: none; }
.tdrum-body { position: relative; display: flex; align-items: center; justify-content: center; height: 200px; overflow: hidden; padding: 0 8px; }
.tdrum-col { flex: 1; height: 200px; overflow: hidden; position: relative; cursor: pointer; }
.tdrum-list { display: flex; flex-direction: column; transition: transform .12s ease; }
.tdrum-item { height: 40px; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 500; color: var(--text-2); user-select: none; border-radius: var(--radius-sm); transition: color .1s, font-size .1s; }
.tdrum-item.sel { color: var(--text); font-size: 22px; font-weight: 700; }
.tdrum-sep { font-size: 22px; font-weight: 700; color: var(--text); padding: 0 2px; flex-shrink: 0; }
.tdrum-sel-bar { position: absolute; left: 8px; right: 8px; top: 80px; height: 40px; background: var(--primary-lt); border-radius: var(--radius); pointer-events: none; border: 1px solid var(--primary); opacity: .3; }
.tdrum-fade { position: absolute; inset: 0; background: linear-gradient(to bottom, var(--surface) 0%, transparent 28%, transparent 72%, var(--surface) 100%); pointer-events: none; z-index: 1; }
.tdrum-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }

.config-layout { display: flex; height: 100%; overflow: hidden; }
.config-nav { width: 200px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface); padding: 8px 0; }
.config-nav-group { padding: 14px 14px 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }
.config-nav-item { display: block; width: 100%; text-align: left; padding: 7px 14px; font-size: 13.5px; border: none; background: none; cursor: pointer; color: var(--text); border-radius: 0; }
.config-nav-item:hover { background: var(--bg-page); }
.config-nav-item.active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }
.config-panel { flex: 1; overflow-y: auto; padding: 24px; }
.config-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.config-section-title { font-size: 17px; font-weight: 700; margin: 0; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }

/* Responsive: mobile friendly */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 200; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .drawer { width: 100%; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
}

/* ══ INSPECTION TAB ════════════════════════════ */
/* ── Inspection — style timeline ── */
.insp-category { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.insp-category-title { display: flex; align-items: center; gap: 8px; padding: 9px 12px; }
.insp-cat-chevron { font-size: 10px; flex-shrink: 0; transition: transform .2s; }
.insp-category.open .insp-cat-chevron { transform: rotate(90deg); }
.insp-cat-name { flex: 1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.insp-cat-counter { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; flex-shrink: 0; }
.insp-category-items { display: none; padding: 12px 12px 8px 12px; position: relative; }
.insp-category-items::before { content: ''; position: absolute; left: 23px; top: 16px; bottom: 16px; width: 2px; background: var(--border); border-radius: 1px; }
.insp-category.open .insp-category-items { display: block; }
.insp-item { display: flex; align-items: flex-start; gap: 10px; padding: 0 0 12px 0; position: relative; }
.insp-item:last-child { padding-bottom: 4px; }
.insp-node { width: 14px; height: 14px; border-radius: 50%; background: var(--border-2); border: 2.5px solid #fff; box-shadow: 0 0 0 2px var(--border-2); flex-shrink: 0; margin-top: 3px; position: relative; z-index: 1; transition: background .2s, box-shadow .2s; }
.insp-item[data-insp-status="ok"]        .insp-node { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.insp-item[data-insp-status="attention"] .insp-node { background: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.insp-item[data-insp-status="urgent"]    .insp-node { background: var(--red);   box-shadow: 0 0 0 2px var(--red); }
.insp-item[data-insp-status="na"]        .insp-node { background: var(--text-3); box-shadow: 0 0 0 2px var(--text-3); }
.insp-item-body { flex: 1; min-width: 0; }
.insp-item-name { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.insp-status-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.insp-status-btn { padding: 3px 9px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-page); cursor: pointer; color: var(--text-2); transition: all .15s; }
.insp-status-btn:hover { border-color: var(--primary); color: var(--primary); }
.insp-status-btn.active-ok      { background: var(--green-lt); color: var(--green);  border-color: #86efac; font-weight: 600; }
.insp-status-btn.active-attention{ background: var(--amber-lt); color: var(--amber);  border-color: #fde68a; font-weight: 600; }
.insp-status-btn.active-urgent  { background: var(--red-lt);   color: var(--red);    border-color: #fca5a5; font-weight: 600; }
.insp-status-btn.active-na      { background: var(--surface-2); color: var(--text-3); border-color: var(--border); font-weight: 600; }
.insp-item-value { margin: 6px 0; display: flex; align-items: center; gap: 6px; }
.insp-val { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--bg-page); color: var(--text); }
.insp-val-wrap { display: flex; align-items: center; gap: 4px; }
.insp-val-unit { font-size: 12px; color: var(--text-2); }
.insp-item-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.insp-notes-input { flex: 1; min-width: 140px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; background: var(--bg-page); color: var(--text); }
.insp-media-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.insp-media-thumb { position: relative; width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.insp-media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.insp-media-pdf { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 10px; font-weight: 700; background: var(--red-lt); color: var(--red); text-decoration: none; }
.insp-media-del { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 2px; cursor: pointer; font-size: 9px; display: flex; align-items: center; justify-content: center; padding: 0; }
.insp-photo-btn { width: 48px; height: 48px; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3); transition: border-color .15s, color .15s; }
.insp-photo-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Inspection archivée — lecture seule */
.insp-locked .insp-status-btn:disabled { cursor: default; opacity: .55; }
.insp-locked .insp-notes-input:disabled,
.insp-locked .insp-val:disabled,
.insp-locked input[type=range]:disabled { cursor: default; opacity: .7; background: var(--surface-2); }
.insp-locked .insp-photo-btn { display: none; }

/* ══ CATALOGUE TREE (config page) ══════════════ */
.insp-tree { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.insp-tree-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.insp-tree-hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.insp-tree-hd-name { font-size: 13px; font-weight: 700; flex: 1; color: var(--text); }
.insp-tree-hd-count { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.insp-tree-zone { padding: 6px 8px; min-height: 42px; transition: background .15s; }
.insp-tree-zone.drag-over { background: color-mix(in srgb, var(--primary) 8%, transparent); outline: 2px dashed var(--primary); outline-offset: -3px; border-radius: 0 0 7px 7px; }
.insp-tree-empty { padding: 10px 8px; font-size: 12px; color: var(--text-3); text-align: center; font-style: italic; pointer-events: none; }
.insp-tree-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); margin-bottom: 3px; background: var(--surface); border: 1px solid var(--border); cursor: grab; transition: background .1s, opacity .15s; user-select: none; }
.insp-tree-item:active { cursor: grabbing; }
.insp-tree-item:last-child { margin-bottom: 0; }
.insp-tree-item.dragging { opacity: .35; }
.insp-tree-item.drag-insert-before { border-top: 2px solid var(--primary); }
.insp-tree-item-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.insp-tree-item-name:hover { color: var(--primary); }
.insp-tree-item-actions { display: flex; gap: 4px; }
.insp-tree-hd-actions { display: flex; gap: 4px; }
.insp-tree-hd-name { cursor: pointer; }
.insp-tree-hd-name:hover { color: var(--primary); }
.insp-tree-add-row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); background: var(--bg-page); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.insp-tree > .insp-tree-add-row { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 2px; border-top: 1px solid var(--border); }
.insp-add-input { flex: 1; padding: 5px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); color: var(--text); outline: none; transition: border-color .15s; }
.insp-add-input:focus { border-color: var(--primary); }
.insp-add-input:disabled { opacity: .5; }
.insp-add-type { padding: 5px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; background: var(--surface); color: var(--text); cursor: pointer; }

/* ══ WEAR SLIDER (inspection mm / /32) ═════════ */
.insp-wear-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.insp-mm-value { font-weight: 900; min-width: 72px; font-size: 15px; color: var(--text); }
.insp-mm-range { position: relative; height: 44px; min-width: 200px; flex: 1; }
.insp-mm-bar { position: absolute; left: 0; right: 0; top: 50%; height: 14px; transform: translateY(-50%);
  background: linear-gradient(to right, rgba(34,197,94,.95) 0%, rgba(34,197,94,.85) 33%, rgba(234,179,8,.9) 66%, rgba(239,68,68,.95) 100%); }
.insp-mm-slider { position: absolute; inset: 0; width: 100%; background: transparent; appearance: none;
  cursor: pointer; border: none; outline: none; box-shadow: none; padding: 0 !important; margin: 0 !important; }
.insp-mm-slider::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.insp-mm-slider::-webkit-slider-thumb { appearance: none; width: 26px; height: 26px; border-radius: 0;
  background: var(--mmThumb, rgb(34 197 94)); border: 2px solid #fff; margin-top: 9px;
  box-shadow: 0 14px 26px rgba(0,0,0,.22); }
.insp-mm-slider:active::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 18px 34px rgba(0,0,0,.28); }
.insp-wear-status { font-weight: 800; min-width: 100px; font-size: 13px; color: var(--text); }

/* ══ PUNCH ACTIF (colonne liste BT) ════════════ */
.punch-active-badge { display: inline-flex; align-items: center; gap: 5px; background: var(--green-lt); color: #15803d; border: 1px solid #86efac; border-radius: var(--radius-sm); padding: 2px 7px; font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; }
.punch-active-badge svg { flex-shrink: 0; }
.punch-active-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.punch-active-task { color: var(--green); font-weight: 400; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }

/* ══ WO INFO — client/véhicule search + card ═══ */
.wo-search-wrap { position: relative; margin-bottom: 8px; }
.wo-search-input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); color: var(--text); font-family: inherit; box-sizing: border-box; outline: none; transition: border-color .15s; }
.wo-search-input:focus { border-color: var(--primary); }
.wo-search-input:disabled { opacity: .45; cursor: not-allowed; }
.wo-search-input::-webkit-search-cancel-button,
.wo-search-input::-webkit-search-decoration { display: none; }
.wo-veh-sugg .sugg-item,
.wo-cust-sugg .sugg-item,
.est-cust-sugg .sugg-item,
.est-veh-sugg .sugg-item,
.wo-task-quick-sugg .sugg-item,
.est-task-quick-sugg .sugg-item,
#task-quick-sugg .sugg-item { display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; }
.wo-veh-sugg .sugg-main,
.wo-cust-sugg .sugg-main,
.est-cust-sugg .sugg-main,
.est-veh-sugg .sugg-main,
.wo-task-quick-sugg .sugg-main,
.est-task-quick-sugg .sugg-main,
#task-quick-sugg .sugg-main { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-veh-sugg .sugg-sub,
.wo-cust-sugg .sugg-sub,
.est-cust-sugg .sugg-sub,
.est-veh-sugg .sugg-sub,
.wo-task-quick-sugg .sugg-sub,
.est-task-quick-sugg .sugg-sub,
#task-quick-sugg .sugg-sub { flex-shrink: 0; color: var(--text-2); font-size: 12px; }
.sugg-create { color: var(--primary); font-weight: 500; border-top: 1px solid var(--border) !important; }
.sugg-create:hover { background: var(--primary-lt) !important; }
.vin-input-wrap { display: flex; gap: 6px; align-items: center; }
.vin-input-wrap input { flex: 1; }
.vin-decode-banner { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 10px; }
.vin-decode-banner.loading { background: var(--surface-2); color: var(--text-2); }
.vin-decode-banner.success { background: var(--green-lt); color: #166534; border: 1px solid #bbf7d0; }
.vin-decode-banner.error   { background: var(--red-lt);   color: #991b1b; border: 1px solid #fecaca; }
/* PDF template picker */
.pdf-tpl-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.pdf-tpl-option { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.pdf-tpl-option:hover { background: var(--surface-2); }
.pdf-tpl-option--selected { border-color: var(--primary); background: var(--primary-lt); }
.pdf-tpl-option input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; }
.pdf-tpl-name { flex: 1; font-size: 14px; font-weight: 500; }
.wo-info-card { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 4px; }
.wo-info-card-row { display: flex; gap: 8px; font-size: 12px; }
.wo-info-label { color: var(--text-3); min-width: 80px; flex-shrink: 0; }
.wo-info-val { color: var(--text); }

/* ══ INSP LIST DETAIL (inline master-detail) ═══ */
.insp-list-actions { display: flex; gap: 4px; }
.insp-check-group { margin-bottom: 14px; }
.insp-check-group-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); padding: 0 0 5px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.insp-check-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background .1s; }
.insp-check-row:hover { background: var(--surface-2); }
.insp-check-name { flex: 1; font-size: 13px; }

/* ══ INVOICE DESIGNER ════════════════════════════ */
#id-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #1e1e2e;
  user-select: none;
}
#id-topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: #16213e;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
#id-topbar input[type=text] {
  background: transparent;
  color: white;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  outline: none;
  padding: 2px 6px;
  min-width: 200px;
}
#id-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}
#id-left-panel {
  width: 220px;
  flex-shrink: 0;
  background: #0f172a;
  overflow-y: auto;
  padding: 12px;
  color: #cbd5e1;
}
#id-canvas-container {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  background: #374151;
}
#id-canvas {
  width: 816px;
  height: 1056px;
  background: white;
  position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
#id-right-panel {
  width: 260px;
  flex-shrink: 0;
  background: #0f172a;
  overflow-y: auto;
  padding: 12px;
  color: #cbd5e1;
}
.id-panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.id-field-group { margin-bottom: 4px; }
.id-field-group-title { font-size: 11px; font-weight: 600; color: #94a3b8; margin-bottom: 4px; }
.id-field-group-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; padding: 3px 4px; border-radius: 4px; user-select: none; margin-bottom: 0; }
.id-field-group-toggle:hover { background: rgba(255,255,255,0.06); color: #cbd5e1; }
.id-field-group-arrow { font-size: 9px; color: #64748b; transition: transform 0.15s; }
.id-field-group--collapsed .id-field-group-arrow { transform: rotate(0deg); }
.id-field-group:not(.id-field-group--collapsed) .id-field-group-arrow { transform: rotate(90deg); }
.id-field-group-items { margin-top: 2px; margin-bottom: 8px; }
.id-field-group--collapsed .id-field-group-items { display: none; }
.id-field-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #cbd5e1;
}
.id-field-item:hover { background: rgba(255,255,255,0.08); }
.id-field-item:active { cursor: grabbing; }
.id-field-item.id-dragging { opacity: 0.35; }
.id-field-drag-icon { color: #475569; font-size: 14px; margin-right: 4px; flex-shrink: 0; pointer-events: none; }
.id-field-item:hover .id-field-drag-icon { color: #94a3b8; }
.id-field-item .id-add-btn { opacity: 0; color: #60a5fa; background: none; border: none; cursor: pointer; font-size: 16px; font-weight: 700; padding: 0 2px; }
.id-field-item:hover .id-add-btn { opacity: 1; }
#id-canvas.id-drop-over { outline: 2px dashed #60a5fa; outline-offset: -3px; }
.id-block { cursor: move; min-height: 10px; }
.id-block[data-type="line"] { min-height: 1px; }
.id-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #2563eb;
  border: 1px solid white;
  border-radius: 1px;
  z-index: 20;
  cursor: se-resize;
}
.id-props-section { margin-bottom: 16px; }
.id-props-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.id-props-label { font-size: 11px; color: #94a3b8; min-width: 50px; }
.id-props-input {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  width: 100%;
  outline: none;
}
.id-props-input:focus { border-color: #2563eb; }
.id-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: opacity .15s;
}
.id-btn:hover { opacity: 0.88; }
.id-btn-primary { background: #2563eb; color: white; }
.id-btn-ghost { background: transparent; color: #94a3b8; border: 1px solid #334155; }
.id-btn-danger { background: #dc2626; color: white; }
.id-align-btn {
  width: 28px;
  height: 28px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 0;
}
.id-align-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
.id-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.id-menu-item:hover { background: rgba(255,255,255,0.08); }

/* Block tool icons in topbar */
.id-topbar-sep { width: 1px; height: 28px; background: rgba(255,255,255,0.12); flex-shrink: 0; }
.id-block-tools { display: flex; align-items: center; gap: 2px; }
.id-block-tool {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #94a3b8;
  cursor: grab;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.id-block-tool:hover { background: rgba(255,255,255,0.1); border-color: #334155; color: #e2e8f0; }
.id-block-tool:active { cursor: grabbing; }
.id-block-tool.id-dragging { opacity: 0.35; }
.id-rot-handle { position:absolute; top:-28px; left:50%; transform:translateX(-50%); width:20px; height:20px; background:#2563eb; border:2px solid #fff; border-radius:50%; cursor:crosshair; display:flex; align-items:center; justify-content:center; font-size:13px; color:#fff; user-select:none; z-index:200; }
.id-rot-handle:hover { background:#1d4ed8; }
.id-ctx-item { display:block; width:100%; text-align:left; background:none; border:none; color:#cbd5e1; font-size:12px; padding:7px 14px; cursor:pointer; white-space:nowrap; }
.id-ctx-item:hover { background:rgba(255,255,255,0.08); color:#f1f5f9; }
.id-ctx-danger { color:#f87171; }
.id-ctx-danger:hover { background:rgba(248,113,113,0.12); color:#fca5a5; }

/* Invoice designer — image picker */
#id-img-picker { position: absolute; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: flex; align-items: center; justify-content: center; }
.id-img-picker-box { background: #1e293b; border-radius: 8px; width: 600px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.id-img-picker-header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid #334155; }
.id-img-picker-upload { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #334155; }
.id-img-gallery { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; overflow-y: auto; flex: 1; }
.id-img-tile { position: relative; width: 120px; height: 90px; border: 2px solid #334155; border-radius: 6px; overflow: hidden; cursor: pointer; background: #0f172a; }
.id-img-tile:hover { border-color: #60a5fa; }
.id-img-tile img { width: 100%; height: 100%; object-fit: contain; }
.id-img-tile-del { position: absolute; top: 3px; right: 3px; background: rgba(239,68,68,.85); color: #fff; border: none; border-radius: 4px; width: 20px; height: 20px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.id-img-thumb { display: block; width: 100%; height: 80px; object-fit: contain; background: #0f172a; border: 1px solid #334155; border-radius: 4px; }
.id-img-thumb--logo { display: flex; align-items: center; justify-content: center; text-align: center; color: #64748b; font-size: 11px; background: #0f172a; border: 1px solid #334155; border-radius: 4px; height: 80px; }

/* ══ ONGLET FACTURATION ══════════════════════════ */
.billing-kpi { flex: 1; background: var(--bg-page); border-radius: var(--radius); padding: 12px 10px; text-align: center; border: 1px solid var(--border); }
.billing-kpi--total { background: var(--text); border-color: var(--text); }
.billing-kpi-val { font-size: 17px; font-weight: 700; line-height: 1.2; }
.billing-kpi--total .billing-kpi-val { color: #fff; }
.billing-kpi-lbl { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.billing-kpi--total .billing-kpi-lbl { color: rgba(255,255,255,.55); }

.billing-task-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.billing-task-header { background: var(--bg-page); padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; }
.billing-task-title { font-weight: 600; font-size: 13px; }
.billing-line { display: flex; align-items: center; padding: 7px 14px; border-top: 1px solid var(--border); font-size: 13px; gap: 6px; }
.billing-line-desc { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-line-qty { color: var(--text-3); font-size: 12px; flex-shrink: 0; }
.billing-line-amount { font-weight: 500; min-width: 80px; text-align: right; flex-shrink: 0; }
.billing-task-subtotal { display: flex; justify-content: space-between; padding: 8px 14px; background: var(--primary-lt); font-size: 13px; font-weight: 600; color: var(--primary); border-top: 1px solid var(--border); }
.billing-labor-badge { display: inline-block; font-size: 11px; color: var(--text-2); background: var(--surface); padding: 1px 7px; border-radius: 20px; border: 1px solid var(--border); vertical-align: middle; }

.billing-summary-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.billing-summary-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.billing-summary-row:last-child { border-bottom: none; }
.billing-summary-total { background: var(--text); color: #fff; font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; }

/* ── DB Debug ──────────────────────────────────────────────────────────── */
.dbg-layout { display: flex; height: 100%; overflow: hidden; }

/* Sidebar liste des tables */
.dbg-sidebar { width: 280px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.dbg-sidebar-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.dbg-title { font-size: 13px; font-weight: 600; color: var(--text); }
.dbg-badge { font-size: 11px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; }
.dbg-search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dbg-search { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); color: var(--text); font-family: inherit; box-sizing: border-box; }
.dbg-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.dbg-table-list { flex: 1; overflow-y: auto; }

/* Item d'une table dans la sidebar */
.dbg-table-item { border-bottom: 1px solid var(--border); }
.dbg-table-item.is-active > .dbg-table-header { background: var(--primary-lt); color: var(--primary); }
.dbg-table-header { display: flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer; user-select: none; font-size: 13px; }
.dbg-table-header:hover { background: var(--surface-2); }
.dbg-table-item.is-open > .dbg-table-header { background: var(--surface-2); }
.dbg-chevron { flex-shrink: 0; color: var(--text-3); transition: transform .15s; }
.dbg-table-item.is-open > .dbg-table-header .dbg-chevron { transform: rotate(90deg); }
.dbg-table-name { flex: 1; font-weight: 500; color: var(--text); font-size: 12.5px; font-family: 'SF Mono', 'Consolas', monospace; }
.dbg-col-count { font-size: 11px; color: var(--text-3); }
.dbg-row-est { font-size: 11px; color: var(--text-3); background: var(--surface-2); border-radius: 20px; padding: 1px 6px; }

/* Corps du schéma (colonnes) */
.dbg-schema-body { background: var(--bg-page); border-top: 1px solid var(--border); padding: 0 0 8px; }
.dbg-schema-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.dbg-schema-table thead tr { background: var(--surface-2); }
.dbg-schema-table th { padding: 5px 10px; text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.dbg-schema-table td { padding: 4px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dbg-schema-table tr:last-child td { border-bottom: none; }
.dbg-col-name { font-family: 'SF Mono', 'Consolas', monospace; color: var(--text); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dbg-col-type { font-family: 'SF Mono', 'Consolas', monospace; color: var(--text-2); font-size: 11px; }
.dbg-col-fk { font-size: 11px; }
.dbg-fk-hint { color: var(--primary); font-size: 10.5px; font-family: 'SF Mono', 'Consolas', monospace; cursor: help; }
.dbg-badge-key { display: inline-block; font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 3px; text-transform: uppercase; }
.dbg-badge-key.pri { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.dbg-badge-key.mul { background: var(--primary-lt); color: var(--primary-dk); border: 1px solid #bfdbfe; }
.dbg-badge-key.uni { background: var(--purple-lt); color: var(--purple); border: 1px solid #e9d5ff; }
.dbg-not-null { display: inline-block; font-size: 9px; font-weight: 700; padding: 0 3px; border-radius: 3px; background: var(--red-lt); color: var(--red); border: 1px solid #fecaca; }
.dbg-schema-actions { padding: 8px 10px 4px; }

/* Zone principale (données / accueil) */
.dbg-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-page); }
.dbg-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-3); font-size: 14px; }

/* En-tête de la vue données */
.dbg-data-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.dbg-data-title { display: flex; align-items: center; gap: 8px; }
.dbg-data-table-name { font-size: 14px; font-weight: 600; color: var(--text); font-family: 'SF Mono', 'Consolas', monospace; }
.dbg-data-toolbar { display: flex; align-items: center; gap: 6px; }
.dbg-data-search { padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; width: 180px; font-family: inherit; background: var(--surface); color: var(--text); }
.dbg-data-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.dbg-page-info { font-size: 12px; color: var(--text-2); min-width: 90px; text-align: center; }
.dbg-data-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* Tableau de données */
.dbg-data-scroll { flex: 1; overflow: auto; }
.dbg-data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-family: 'SF Mono', 'Consolas', monospace; }
.dbg-data-table thead th { position: sticky; top: 0; background: var(--surface-2); padding: 7px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); border-bottom: 2px solid var(--border); white-space: nowrap; z-index: 1; }
.dbg-data-table tbody tr:hover { background: var(--surface-2); }
.dbg-data-table td { padding: 5px 12px; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.dbg-cell-null { color: var(--text-3); font-style: italic; }

/* ── À faire ──────────────────────────────────────────────────────────────── */
.todo-list { padding: 20px 24px; max-width: 680px; display: flex; flex-direction: column; gap: 16px; }
.todo-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.todo-group-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.todo-group-title { font-size: 13.5px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-del-group:hover { background: var(--red-lt) !important; color: var(--red) !important; }
.todo-items { list-style: none; margin: 0; padding: 0; }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: var(--surface-2); }
.todo-item-done .todo-item-label { text-decoration: line-through; color: var(--text-3); }
.todo-item-label { flex: 1; min-width: 0; }
.todo-check:hover { border-color: var(--green) !important; }
.todo-del-item:hover { color: var(--red) !important; }
.todo-add-item-row { padding: 8px 14px; }
.todo-add-item-input { width: 100%; padding: 7px 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; color: var(--text); background: transparent; outline: none; }
.todo-add-item-input:focus { border-color: var(--primary); border-style: solid; box-shadow: 0 0 0 3px var(--primary-ring); background: var(--surface); }
.todo-add-item-input::placeholder { color: var(--text-3); }
.todo-new-group-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.todo-new-group-input { flex: 1; border: none; outline: none; font-size: 13.5px; font-family: inherit; color: var(--text); background: transparent; }
.todo-new-group-input::placeholder { color: var(--text-3); }
.todo-new-group-row:focus-within { border-color: var(--primary); border-style: solid; box-shadow: 0 0 0 3px var(--primary-ring); }
.todo-item-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.todo-checked-by { font-size: 11px; color: var(--green); font-weight: 500; }
.todo-item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.todo-created-by { font-size: 11px; color: var(--text-3); }
