:root {
  --bg:        #f5efe6;
  --surface:   #fdfaf5;
  --surface2:  #ede5d8;
  --border:    rgba(0,0,0,0.07);
  --border2:   rgba(0,0,0,0.13);
  --text:      #1c1714;
  --text2:     #5c5248;
  --text3:     #9c9080;
  --accent:    #1c1714;

  --blue-bg:    #dde8f5;  --blue-text:   #1e3f68;
  --green-bg:   #daeedd;  --green-text:  #1e5030;
  --red-bg:     #f5dede;  --red-text:    #702020;
  --amber-bg:   #f5e8cc;  --amber-text:  #6e3c10;
  --purple-bg:  #e8e0f5;  --purple-text: #3c2878;
  --teal-bg:    #d4eeea;  --teal-text:   #1a5045;

  --radius:    6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg:       #161616;
    --surface:  #1e1e1e;
    --surface2: #272727;
    --border:   rgba(255,255,255,0.07);
    --border2:  rgba(255,255,255,0.13);
    --text:     #e8e8e8;
    --text2:    #a0a0a0;
    --text3:    #606060;
    --accent:   #e8e8e8;
    --lime:     #c8f020;
    --lime-bg:  #1a2600;

    --blue-bg:    #0e1a28;  --blue-text:   #7aaed0;
    --green-bg:   #0e1a10;  --green-text:  #80b860;
    --red-bg:     #2a1010;  --red-text:    #d08080;
    --amber-bg:   #261804;  --amber-text:  #cca058;
    --purple-bg:  #181230;  --purple-text: #a090d0;
    --teal-bg:    #081e1a;  --teal-text:   #58aaa0;
  }
}

/* Force dark */
html.dark {
  --bg:       #161616;
  --surface:  #1e1e1e;
  --surface2: #272727;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.13);
  --text:     #e8e8e8;
  --text2:    #a0a0a0;
  --text3:    #606060;
  --accent:   #e8e8e8;
  --lime:     #c8f020;
  --lime-bg:  #1a2600;
  --blue-bg:    #0e1a28;  --blue-text:   #7aaed0;
  --green-bg:   #0e1a10;  --green-text:  #80b860;
  --red-bg:     #2a1010;  --red-text:    #d08080;
  --amber-bg:   #261804;  --amber-text:  #cca058;
  --purple-bg:  #181230;  --purple-text: #a090d0;
  --teal-bg:    #081e1a;  --teal-text:   #58aaa0;
}

/* Force light */
html.light {
  --bg:        #f2f1ec;
  --surface:   #ffffff;
  --surface2:  #ebebE4;
  --border:    rgba(0,0,0,0.08);
  --border2:   rgba(0,0,0,0.15);
  --text:      #181816;
  --text2:     #5a5955;
  --text3:     #9a9891;
  --accent:    #181816;
  --lime:      #d8ff42;
  --lime-bg:   #f0ffb0;
  --blue-bg:    #ddeeff;  --blue-text:   #0a3d6e;
  --green-bg:   #e0f2d2;  --green-text:  #1e4d07;
  --red-bg:     #fde8e8;  --red-text:    #6e1a1a;
  --amber-bg:   #fdecd4;  --amber-text:  #5a3002;
  --purple-bg:  #eae8fd;  --purple-text: #352f88;
  --teal-bg:    #d8f3e8;  --teal-text:   #065038;
}

/* ── LIGHT MODE COZY ─────────────────────────────────────────────────────── */
html.light {
  --bg:       #f5efe6;
  --surface:  #fdfaf5;
  --surface2: #ede5d8;
  --border:   rgba(0,0,0,0.07);
  --border2:  rgba(0,0,0,0.13);
  --text:     #1c1714;
  --text2:    #5c5248;
  --text3:    #9c9080;
}
html.light .sidebar { background: #e8dfd4; }
html.light .stat    { background: #fdf8f2; border-color: rgba(0,0,0,0.06); }

html.light .b-en-cours   { background: #dde8f5; color: #1e3f68; }
html.light .b-réussi     { background: #daeedd; color: #1e5030; }
html.light .b-échoué     { background: #f5dede; color: #702020; }
html.light .b-bloqué     { background: #f5e8cc; color: #6e3c10; }
html.light .b-clôturé    { background: #e8e8e8; color: #555555; }
html.light .b-en-attente { background: #e8e0f5; color: #3c2878; }
html.light .b-critique   { background: #f5dede; color: #702020; }
html.light .b-haute      { background: #f5e8cc; color: #6e3c10; }
html.light .b-moyenne    { background: #dde8f5; color: #1e3f68; }
html.light .b-faible     { background: #daeedd; color: #1e5030; }
html.light .b-dev        { background: #e8e0f5; color: #3c2878; }
html.light .b-staging    { background: #f5e8cc; color: #6e3c10; }
html.light .b-prod       { background: #f5dede; color: #702020; }

/* ── LIGHT MODE LIME ACCENTS ─────────────────────────────────────────────── */
html.light .nav-item.active {
  border-left-color: var(--lime) !important;
  color: var(--text);
}
html.light .logo {
  border-left: 3px solid var(--lime);
  padding-left: calc(1.1rem - 3px);
}
html.light .btn-new {
  background: var(--lime);
  color: #2a3800;
}
html.light .btn-new:hover { opacity: 0.88; }
html.light .btn-save {
  background: var(--lime);
  color: #2a3800;
}
html.light .search:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(216,255,66,0.25);
}
html.light .nav-item.active .count {
  background: var(--lime-bg);
  color: #3a6000;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.app  { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
}

.logo {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  padding: 1.25rem 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
}
.logo span {
  font-weight: 400;
  color: var(--text3);
  font-size: 11px;
  display: block;
  margin-top: 3px;
  letter-spacing: 0;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 1.1rem;
  margin: 1.1rem 0 0.35rem;
}

/* ── DOTS SIDEBAR ────────────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red    { background: #e03535; }
.dot-orange { background: #e07d10; }
.dot-blue   { background: #2e7de0; }
.dot-green  { background: #1aac4a; }
.dot-gray   { background: #a0a0a0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 1.1rem;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--text); border-left-color: var(--text); font-weight: 600; }
.nav-item .count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--surface2);
  border-radius: 20px;
  padding: 1px 7px;
  color: var(--text3);
  min-width: 22px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.1rem;
  border-top: 1px solid var(--border);
}
.btn-export, .btn-import {
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.btn-export:hover, .btn-import:hover { background: var(--surface2); color: var(--text); }

/* ── TOOLBAR ─────────────────────────────────────────────────────────────── */
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.toolbar-title { font-size: 15px; font-weight: 600; flex: 1; letter-spacing: -0.01em; }

.search {
  flex: 1;
  max-width: 260px;
  padding: 7px 11px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus { outline: none; border-color: var(--text3); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.search::placeholder { color: var(--text3); }

.btn-new {
  padding: 7px 15px;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: opacity 0.1s;
}
.btn-new:hover { opacity: 0.82; }

/* ── STATS BAR ───────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 10px;
  padding: 1rem 1.5rem;
  flex-shrink: 0;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11px; color: var(--text3); margin-bottom: 5px; font-weight: 500; }
.stat-val   { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* ── SELECTION BAR ───────────────────────────────────────────────────────── */
.selection-bar {
  display: none;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
  padding: 0.6rem 1.5rem;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.selection-bar.open { display: flex; }
.selection-count { font-size: 13px; font-weight: 600; flex: 1; color: var(--text2); }

.btn-export-sel {
  padding: 6px 14px;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.1s;
}
.btn-export-sel:hover { opacity: 0.82; }

.btn-delete-sel {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  color: var(--red-text);
  font-family: inherit;
  transition: background 0.1s;
}
.btn-delete-sel:hover { background: var(--red-bg); }

.btn-clear-sel {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  color: var(--text2);
  font-family: inherit;
  transition: background 0.1s;
}
.btn-clear-sel:hover { background: rgba(0,0,0,0.04); }

/* ── FILTERS ─────────────────────────────────────────────────────────────── */
.filters { padding: 0 1.5rem 0.75rem; display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.chip {
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text2);
  background: var(--surface);
  transition: all 0.1s;
}
.chip:hover  { border-color: var(--text3); color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ── TABLE ───────────────────────────────────────────────────────────────── */
.table-wrap { padding: 0 1.5rem 1.5rem; flex: 1; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

thead th {
  background: var(--surface2);
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text); }

.row-check { width: 16px; }
input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--text); }

tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s;
}
tbody tr:last-child    { border-bottom: none; }
tbody tr:hover         { background: var(--surface2); }
tbody tr.selected      { background: var(--surface2) !important; }
tbody tr.row-cloture   { opacity: 0.4; }
tbody tr.row-cloture:hover { opacity: 0.6; }

td { padding: 11px 14px; font-size: 13px; color: var(--text); vertical-align: middle; }
td.muted { color: var(--text2); }
.empty { text-align: center; padding: 4rem 2rem; color: var(--text3); font-size: 13px; }
.empty-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 0.35rem; }
.empty-sub { font-size: 13px; color: var(--text3); }

/* ── BADGES ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.b-en-cours   { background: var(--blue-bg);   color: var(--blue-text); }
.b-réussi     { background: var(--green-bg);  color: var(--green-text); }
.b-échoué     { background: var(--red-bg);    color: var(--red-text); }
.b-bloqué     { background: var(--amber-bg);  color: var(--amber-text); }
.b-clôturé    { background: var(--surface2);  color: var(--text2); }
.b-en-attente { background: var(--purple-bg); color: var(--purple-text); }
.b-critique   { background: var(--red-bg);    color: var(--red-text); }
.b-haute      { background: var(--amber-bg);  color: var(--amber-text); }
.b-moyenne    { background: var(--blue-bg);   color: var(--blue-text); }
.b-faible     { background: var(--teal-bg);   color: var(--teal-text); }
.b-dev        { background: var(--purple-bg); color: var(--purple-text); }
.b-staging    { background: var(--amber-bg);  color: var(--amber-text); }
.b-prod       { background: var(--red-bg);    color: var(--red-text); }

/* ── OFFLINE BANNER ─────────────────────────────────────────────────────── */
#offline-banner {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 1.5rem;
  background: var(--amber-bg);
  color: var(--amber-text);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
#offline-banner.show { display: flex; }

/* ── TOAST ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 280px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error { background: var(--red-text); }

/* ── BACK TO PORTAL ──────────────────────────────────────────────────────── */
.btn-back-home {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-family: inherit;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  text-align: left;
}
.btn-back-home:hover { background: var(--surface2); color: var(--text); }

/* ── THEME TOGGLE ────────────────────────────────────────────────────────── */
.btn-theme {
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  text-align: left;
}
.btn-theme:hover { background: var(--surface2); color: var(--text); }

/* ── MODALS ──────────────────────────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(640px, 95vw);
  margin: auto;
  box-shadow: var(--shadow-md);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.btn-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text3);
  padding: 2px 6px;
  border-radius: var(--radius);
  transition: background 0.1s, color 0.1s;
  line-height: 1;
}
.btn-close:hover { background: var(--surface2); color: var(--text); }

.modal-body {
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }

.field input,
.field select,
.field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { outline: none; border-color: var(--text3); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.field textarea { resize: vertical; min-height: 80px; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-del {
  margin-right: auto;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--red-text);
  font-family: inherit;
  transition: background 0.1s;
}
.btn-del:hover { background: var(--red-bg); }

.btn-cancel {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-family: inherit;
  transition: background 0.1s;
}
.btn-cancel:hover { background: var(--surface); }

.btn-save {
  padding: 7px 18px;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: opacity 0.1s;
}
.btn-save:hover { opacity: 0.82; }

/* ── DASHBOARD ───────────────────────────────────────────────────────────── */
/* ── PERIOD BAR ─────────────────────────────────────────────────────────── */
.kpi-period-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 1.5rem;
}
.kpi-period-bar button {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.kpi-period-bar button:hover { background: var(--surface2); color: var(--text); }
.kpi-period-bar button.active { background: var(--text); color: var(--surface); border-color: var(--text); }
html.light .kpi-period-bar button.active { background: #d8ff42; color: #2a3800; border-color: #d8ff42; }

/* ── PAGINATION ─────────────────────────────────────────────────────────── */
#pagination { padding: 0 1.5rem 1rem; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.pagination button {
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.pagination button:hover:not(:disabled) { background: var(--surface2); }
.pagination button:disabled { opacity: 0.35; cursor: default; }
.pagination-info { font-size: 13px; color: var(--text2); }
.pagination-total { color: var(--text3); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.kpi-card-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 6px;
}
.kpi-card-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.kpi-card-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}
.kpi-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin: 1.75rem 0 0.75rem;
}
.kpi-bars { display: flex; flex-direction: column; gap: 8px; }
.kpi-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.kpi-bar-label { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-bar-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.kpi-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.kpi-bar-count { color: var(--text3); font-size: 11px; text-align: right; }
.kpi-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red-text);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 8px;
  font-size: 13px;
}
.kpi-alert.warn { border-left-color: var(--amber-text); }
.kpi-alert.ok   { border-left-color: var(--green-text); }
.kpi-alert-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.kpi-alert-text { color: var(--text2); }
.kpi-alert-text strong { color: var(--text); display: block; margin-bottom: 2px; }

/* ── COMMENTAIRES ────────────────────────────────────────────────────────── */
.comment-item {
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.comment-text { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.comment-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text3); }
.comment-del { background: none; border: none; cursor: pointer; color: var(--text3); padding: 0; font-size: 11px; }
.comment-del:hover { color: var(--red-text); }
.comment-empty { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.comment-input-row { display: flex; gap: 6px; margin-top: 8px; }
.comment-input-row input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.comment-input-row input:focus { outline: none; border-color: var(--accent); }
.comment-input-row button {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.comment-input-row button:hover { background: var(--text); color: var(--surface); }

/* ── CONFIRM DIALOG ──────────────────────────────────────────────────────── */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(360px, 90vw);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.confirm-overlay.open .confirm-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.confirm-msg {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── DETAIL PANEL ────────────────────────────────────────────────────────── */
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}
.detail-overlay.open { display: block; pointer-events: all; }

.detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(400px, 95vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
  overflow-y: auto;
  padding: 1.5rem;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
}
.detail-overlay.open .detail-panel { transform: translateX(0); }

.dp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.dp-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  margin-right: 12px;
  letter-spacing: -0.01em;
}

.dp-section { margin-bottom: 1.25rem; }
.dp-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.dp-val { font-size: 13px; color: var(--text); line-height: 1.6; }
.dp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dp-item { background: var(--surface2); border-radius: var(--radius); padding: 0.6rem 0.8rem; }

.dp-edit {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.dp-edit:hover { background: var(--surface2); color: var(--text); }
.dp-edit.completed { border-color: var(--green-text); color: var(--green-text); }

.dp-statut-inactive { opacity: 0.38; }
.dp-statut-active   { outline: 2px solid currentColor; outline-offset: 2px; opacity: 1 !important; }

/* ── PHOTO UPLOAD ────────────────────────────────────────────────────────── */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 4px;
}
.photo-slot {
  position: relative;
  height: 110px;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.photo-slot:hover { border-color: var(--text3); }
.photo-placeholder { font-size: 12px; color: var(--text3); text-align: center; pointer-events: none; }
.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
