/* ============================================
   NOD SYSTEMS DPO — Design System v2
   Style : Light, Clean, Apple-inspired
   Accent : Nod Orange #FF6B00
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --orange:      #FF6B00;
  --orange-h:    #E55F00;
  --orange-soft: #FFF3EB;
  --orange-mid:  rgba(255,107,0,.15);

  --bg:          #F5F5F7;
  --white:       #FFFFFF;
  --surface:     #FFFFFF;
  --surface2:    #F5F5F7;
  --surface3:    #E8E8ED;

  --border:      #D2D2D7;
  --border2:     #E8E8ED;

  --text:        #1D1D1F;
  --text2:       #6E6E73;
  --text3:       #AEAEB2;

  --success:     #28A745;
  --danger:      #DC3545;
  --warning:     #F59E0B;
  --info:        #0071E3;

  --sw:          220px;
  --r:           10px;
  --r-sm:        7px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
  --font:        'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sw);
  background: var(--white);
  border-right: 1px solid var(--border2);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 28px;
}
.logo img { height: 44px; width: auto; object-fit: contain; }

.nav-section { margin-bottom: 20px; }
.nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.nav-item .icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.badge-count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sidebar-bottom { margin-top: auto; }
.logout-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text3); font-size: 14px; cursor: pointer;
  width: 100%; border: none; background: none; font-family: var(--font);
  transition: color .15s;
}
.logout-btn:hover { color: var(--danger); }

/* ── MAIN ────────────────────────────────── */
.main { margin-left: var(--sw); flex: 1; padding: 28px 32px; min-height: 100vh; }

/* ── PAGE HEADER ─────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.page-header p  { color: var(--text2); font-size: 14px; margin-top: 3px; }

/* ── STAT CARDS ──────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat .lbl { font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.stat .val { font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: -.02em; line-height: 1; }
.stat .sub { font-size: 12px; color: var(--text3); margin-top: 4px; }
.stat .s-icon { float: right; font-size: 20px; opacity: .15; }

/* ── PANELS / CARDS ──────────────────────── */
.panel, .card {
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}
.panel-header, .card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
}
.panel-header h2, .card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.panel-body { padding: 18px; }

/* ── TABLE ───────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  padding: 10px 14px;
  text-align: left;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
}
td {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-h); box-shadow: 0 2px 10px rgba(255,107,0,.3); }
.btn-ghost { background: var(--white); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { background: #FFF0F0; color: var(--danger); border: 1px solid #FECACA; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: #F0FDF4; color: var(--success); border: 1px solid #BBF7D0; }

/* ── BADGES ──────────────────────────────── */
.badge, .status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.b-active, .s-active   { background: #DCFCE7; color: #16A34A; }
.b-inactive,.s-inactive { background: #F3F4F6; color: #6B7280; }
.b-pending,.s-pending   { background: #FEF9C3; color: #92400E; }
.b-done,.s-done         { background: #DCFCE7; color: #16A34A; }
.b-refused,.s-refused   { background: #FEE2E2; color: #DC2626; }
.b-cours,.s-cours       { background: #DBEAFE; color: #1D4ED8; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px) scale(.99);
  transition: transform .2s;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.ff { margin-bottom: 14px; }
.ff label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.ff input, .ff select, .ff textarea {
  width: 100%; padding: 9px 13px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font); font-size: 14px; color: var(--text);
  outline: none; transition: border-color .15s;
}
.ff input:focus, .ff select:focus, .ff textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-mid);
}
.ff textarea { min-height: 80px; resize: vertical; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border2);
}

/* ── GAUGE ───────────────────────────────── */
.gauge-wrap { height: 6px; background: var(--surface3); border-radius: 10px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 10px; background: var(--orange); transition: width 1s ease; }

/* ── TOGGLE ──────────────────────────────── */
.toggle { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track { position: absolute; inset: 0; border-radius: 26px; background: var(--surface3); cursor: pointer; transition: background .25s; }
.toggle input:checked + .toggle-track { background: var(--orange); }
.toggle-track::after {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track::after { transform: translateX(22px); }

/* ── TOAST ───────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  z-index: 9999;
  opacity: 0; transform: translateY(8px);
  transition: all .2s;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok  { background: var(--success); }
.toast.err { background: var(--danger); }

/* ── GRILLES ─────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 22px; }

/* ── CHECK ITEMS ─────────────────────────── */
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border2);
  font-size: 14px; color: var(--text);
}
.check-item:last-child { border-bottom: none; }
.check-icon {
  width: 22px; height: 22px; min-width: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.ci-ok      { background: #DCFCE7; color: #16A34A; }
.ci-partial { background: #FEF9C3; color: #92400E; }
.ci-no      { background: #FEE2E2; color: #DC2626; }

/* ── T-ROWS (traitements) ────────────────── */
.t-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border2);
  cursor: pointer; border-radius: var(--r-sm);
  transition: background .1s;
}
.t-row:last-child { border-bottom: none; }
.t-row:hover { background: var(--bg); }
.t-num {
  width: 26px; height: 26px; min-width: 26px;
  border-radius: 6px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text3);
}
.t-name { font-size: 14px; font-weight: 500; color: var(--text); }
.t-base { font-size: 12px; color: var(--text2); margin-top: 1px; }

/* ── TOGGLE ROWS ─────────────────────────── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border2); gap: 12px;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info { display: flex; align-items: center; gap: 10px; }
.toggle-icon { width: 32px; height: 32px; min-width: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--text); }
.toggle-sub   { font-size: 12px; color: var(--text2); }

/* ── BASE BARS ───────────────────────────── */
.base-bar { margin-bottom: 12px; }
.base-bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); margin-bottom: 5px; }
.base-bar-track { height: 6px; background: var(--surface3); border-radius: 10px; overflow: hidden; }
.base-bar-fill  { height: 100%; border-radius: 10px; transition: width 1s ease; }

/* ── DIVERS ──────────────────────────────── */
.section-page { display: none; }
.section-page.active { display: block; }
.empty { text-align: center; padding: 32px; color: var(--text3); font-size: 14px; }
.anim-in { animation: fadeUp .25s ease both; }
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)} }
@keyframes pulse  { 0%,100%{opacity:1}50%{opacity:.4} }
@keyframes spin   { to{transform:rotate(360deg)} }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }
