/* ═══════════════════════════════════════════════════════════
   MENGES v1.1 — MENARA CONSTRUCTION
   ═══════════════════════════════════════════════════════════ */

:root {
  --navy:   #1a3a5c;
  --orange: #e8550a;
  --bg:     #f4f4f4;
  --white:  #ffffff;
  --gray-1: #f7f7f7;
  --gray-2: #e4e4e4;
  --gray-3: #999999;
  --gray-4: #555555;
  --text:   #1a1a1a;
  --card-bg: #ffffff;
  --sidebar-w: 210px;
  --topbar-h:  40px;
}

[data-theme="dark"] {
  --bg:     #0f172a;
  --white:  #1e293b;
  --gray-1: #1e293b;
  --gray-2: #334155;
  --gray-3: #64748b;
  --gray-4: #94a3b8;
  --text:   #e2e8f0;
  --card-bg: #1e293b;
  --navy:   #7eb8f7;
  color-scheme: dark;
}

/* ── Layout & base ── */
[data-theme="dark"] body           { color: var(--text); background: var(--bg); }
[data-theme="dark"] .main          { background: var(--bg); }

/* ── Cards & panels ── */
[data-theme="dark"] .card          { background: var(--card-bg); border-color: #334155; }
[data-theme="dark"] .detail-form   { background: var(--card-bg); border-color: #334155; }
[data-theme="dark"] .stat-card     { background: var(--card-bg); border-color: #334155; }

/* ── Typography ── */
[data-theme="dark"] .page-title         { color: #e2e8f0; }
[data-theme="dark"] .card-title         { color: #7eb8f7; }
[data-theme="dark"] .stat-value         { color: #7eb8f7; }
[data-theme="dark"] .section-tile-title { color: #e2e8f0; }
[data-theme="dark"] .form-label         { color: #94a3b8; }
[data-theme="dark"] .detail-value       { color: var(--text); }
[data-theme="dark"] .detail-label       { border-color: #334155; }
[data-theme="dark"] .detail-label ~ .detail-value { border-color: #334155; }
[data-theme="dark"] code                { background: #0f172a; color: #e2e8f0; }

/* ── Navigation ── */
[data-theme="dark"] .nav-item { color: #94a3b8; }
[data-theme="dark"] .nav-item:hover, [data-theme="dark"] .nav-item.active { background: rgba(255,255,255,.08); color: #fff; }

/* ── Tabs ── */
[data-theme="dark"] .tabs          { border-color: #334155; }
[data-theme="dark"] .tab           { color: #64748b; }
[data-theme="dark"] .tab:hover     { color: #cbd5e1; }
[data-theme="dark"] .tab.active    { color: #e2e8f0; border-bottom-color: var(--orange); }

/* ── Forms ── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select {
  background: #0f172a; color: var(--text); border-color: #334155;
}
[data-theme="dark"] .form-control::placeholder { color: #475569; }
[data-theme="dark"] .form-section-title { border-color: #334155; }
[data-theme="dark"] .drop-zone {
  background: #0f172a; border-color: #334155; color: #64748b;
}

/* ── Buttons ── */
[data-theme="dark"] .btn-ghost {
  color: #cbd5e1; border-color: #475569;
}
[data-theme="dark"] .btn-ghost:hover {
  background: #334155; color: #f1f5f9;
}
[data-theme="dark"] .btn-danger {
  background: #3b1414; color: #f87171; border-color: #7f1d1d;
}
[data-theme="dark"] .btn-danger:hover { background: #4a1a1a; }
[data-theme="dark"] .btn-orange {
  background: #2a1500; color: #fb923c; border-color: #7c2d12;
}
[data-theme="dark"] .btn-orange:hover { background: #3a1e00; }
[data-theme="dark"] .btn-success {
  background: #14532d; color: #4ade80; border-color: #166534;
}
[data-theme="dark"] .btn-success:hover { background: #166534; }
[data-theme="dark"] .btn-primary {
  background: #c94408; color: #fff;
}
[data-theme="dark"] .btn-primary:hover { background: #ea580c; }

/* ── Select & toolbar ── */
[data-theme="dark"] .filter-select option { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .toolbar { border-color: #334155; }

/* ── Validation user cards ── */
[data-theme="dark"] .validation-card        { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .validation-card.approved { background: #052e16; border-color: #166534; }
[data-theme="dark"] .validation-card.rejected { background: #2a0a0a; border-color: #7f1d1d; }
[data-theme="dark"] .user-card              { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .user-card.user-inactive { opacity: 0.5; }
[data-theme="dark"] .user-role-badge        { filter: brightness(1.2); }

/* ── Login box ── */
[data-theme="dark"] .login-box  { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .login-input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .login-input::placeholder { color: #475569; }
[data-theme="dark"] .login-label { color: #94a3b8; }
[data-theme="dark"] .login-forgot { color: #7eb8f7; }

/* ── Misc text ── */
[data-theme="dark"] .breadcrumb-link { color: #7eb8f7; }
[data-theme="dark"] .ft-link         { color: #7eb8f7; }
[data-theme="dark"] .required        { color: #f87171; }
[data-theme="dark"] .form-section-title { color: #94a3b8; }
[data-theme="dark"] .empty-state     { color: #475569; }
[data-theme="dark"] .page-header { border-color: #334155; }

/* ── Badges ── */
[data-theme="dark"] .badge-green  { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-red    { background: #450a0a; color: #f87171; }
[data-theme="dark"] .badge-orange { background: #431407; color: #fb923c; }
[data-theme="dark"] .badge-navy   { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge-gray   { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }

/* ── Tables ── */
[data-theme="dark"] .table-wrap table { background: var(--card-bg); }
[data-theme="dark"] thead              { background: #0f172a !important; }
[data-theme="dark"] thead th           { color: #94a3b8 !important; border-color: #334155 !important; }
[data-theme="dark"] tbody td           { border-color: #334155; }
[data-theme="dark"] .avis-table th     { background: #0f172a; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .avis-table td     { border-color: #334155; }
[data-theme="dark"] tr.row-green td   { background: #052e16 !important; }
[data-theme="dark"] tr.row-green:hover td { background: #064e24 !important; }
[data-theme="dark"] tr.row-red td     { background: #2a0a0a !important; }
[data-theme="dark"] tr.row-red:hover td { background: #3d0f0f !important; }

/* ── Modal ── */
[data-theme="dark"] .modal            { background: #1e293b; }
[data-theme="dark"] .modal-header     { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .modal-header h2  { color: #e2e8f0; }
[data-theme="dark"] .modal-close:hover { background: #334155; }
[data-theme="dark"] .modal-footer     { background: #0f172a; border-color: #334155; }

/* ── Section tiles ── */
[data-theme="dark"] .section-tile          { background: var(--card-bg); border-color: #334155; }
[data-theme="dark"] .section-tile.blue     { border-color: #1e3a5f; }
[data-theme="dark"] .section-tile.orange   { border-color: #431407; }
[data-theme="dark"] .section-tile.green    { border-color: #14532d; }
[data-theme="dark"] .section-tile.navy     { border-color: #1e3a5f; }
[data-theme="dark"] .section-tile:hover    { border-color: var(--orange); box-shadow: 0 8px 24px rgba(0,0,0,.4); }

/* ── Semantic info/alert boxes ── */
.box-fiche     { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:6px; padding:8px 12px; }
.box-fiche span.label { color:#16a34a; font-size:13px; }
.box-no-fiche  { background:#fef9c3; border:1px solid #fde047; border-radius:6px; padding:6px 12px; font-size:12px; color:#854d0e; }
.box-caution   { background:#fffbeb; border:1px solid #fcd34d; border-radius:8px; padding:12px 16px; font-size:13px; color:#92400e; margin-bottom:16px; }
.box-orange    { background:#fff7ed; border:1px solid #fed7aa; border-radius:8px; padding:12px 16px; margin-bottom:16px; }

[data-theme="dark"] .box-fiche     { background:#052e16; border-color:#166534; }
[data-theme="dark"] .box-fiche span.label { color:#4ade80; }
[data-theme="dark"] .box-no-fiche  { background:#1c1400; border-color:#713f12; color:#fbbf24; }
[data-theme="dark"] .box-caution   { background:#1c1400; border-color:#713f12; color:#fbbf24; }
[data-theme="dark"] .box-orange    { background:#1c0a00; border-color:#7c2d12; }
[data-theme="dark"] .box-orange { color:#cbd5e1; }

/* ── Readonly display ── */
.ref-display {
  font-family: monospace; padding: 8px 12px;
  background: var(--gray-1); border: 1px solid var(--gray-2); border-radius: 6px;
  color: var(--gray-4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  text-transform: uppercase;
}

/* ── TOP BAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #111c2b;
  border-bottom: 1px solid #0a1220;
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  z-index: 100;
  padding: 0 12px 0 0;
}
.topbar-logo {
  height: 22px;
  width: auto;
  display: block;
  padding: 0 14px;
  flex-shrink: 0;
}
.topbar-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  flex: 1;
}
.topbar-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.2px;
  padding: 0 14px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
  text-transform: uppercase;
}
.topbar-btn:hover  { color: #cbd5e1; }
.topbar-btn.active { color: #fff; border-bottom-color: var(--orange); }

/* ── APP LAYOUT ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0e1c2d;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); }

.nav-section-title {
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #334155;
  padding: 12px 14px 3px;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  color: #64748b;
  text-decoration: none;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 400;
  transition: color .1s;
  border-left: 2px solid transparent;
  user-select: none;
  text-transform: uppercase;
}
.nav-item:hover  { color: #cbd5e1; }
.nav-item.active {
  color: #fff;
  border-left-color: var(--orange);
}
.nav-icon   { font-size: 12px; width: 14px; text-align: center; flex-shrink: 0; }
.nav-sub    { padding-left: 22px; font-size: 10px; }
.nav-sub2   { padding-left: 32px; font-size: 9.5px; color: #475569; }
.nav-sub2:hover { color: #94a3b8; }
.nav-sub2.active { color: #fff; }
.nav-sub3   { padding-left: 44px; font-size: 9.5px; color: #334155; }
.nav-sub3:hover { color: #94a3b8; }
.nav-sub3.active { color: #e2e8f0; }

.nav-cat-toggle { display: flex; align-items: center; gap: 6px; }
.nav-toggle-arrow { font-size: 7px; transition: transform .15s; flex-shrink: 0; opacity: .4; }
.nav-cat-toggle.open .nav-toggle-arrow { transform: rotate(90deg); opacity: .8; }

.nav-sub-group { overflow: hidden; max-height: 0; transition: max-height .2s ease; }
.nav-sub-group.open { max-height: 2000px; }

.sidebar-footer {
  padding: 8px 14px;
  font-size: 9.5px;
  color: #334155;
  border-top: 1px solid rgba(255,255,255,.04);
  text-align: center;
  flex-shrink: 0;
}

/* ── MAIN ─────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: var(--bg);
}
.main::-webkit-scrollbar { width: 4px; }
.main::-webkit-scrollbar-thumb { background: var(--gray-2); }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-2);
  flex-wrap: wrap;
  gap: 10px;
}
.page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .8px;
  text-transform: uppercase;
}
.page-title span { font-weight: 400; color: var(--gray-3); font-size: 11px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 4px;
  padding: 14px 18px;
  margin-bottom: 12px;
  border: 1px solid var(--gray-2);
}
.detail-form {
  background: var(--white);
  border-radius: 4px;
  padding: 18px 22px;
  margin-bottom: 12px;
  border: 1px solid var(--gray-2);
}
.card-title {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--gray-4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-2);
}

/* ── DASHBOARD SECTION TILES ──────────────────────────────── */
.section-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.section-tile {
  background: var(--white);
  border-radius: 4px;
  padding: 18px 16px;
  cursor: pointer;
  border: 1px solid var(--gray-2);
  border-left: 3px solid var(--gray-2);
  transition: border-color .12s;
  text-align: left;
}
.section-tile:hover { border-left-color: var(--orange); }
.section-tile.blue:hover   { border-left-color: #3b82f6; }
.section-tile.orange:hover { border-left-color: var(--orange); }
.section-tile.green:hover  { border-left-color: #22c55e; }
.section-tile.navy:hover   { border-left-color: var(--navy); }
.section-tile-icon  { font-size: 20px; margin-bottom: 8px; }
.section-tile-title { font-size: 10.5px; font-weight: 400; color: var(--navy); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
.section-tile-desc  { font-size: 9.5px; color: var(--gray-3); }

/* ── STATS GRID ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: 4px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--gray-2);
  transition: border-color .12s;
}
.stat-card:hover { border-color: var(--orange); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--navy); }
.stat-label { font-size: 9px; font-weight: 400; color: var(--gray-3); letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; }
.stat-card.green .stat-value { color: #16a34a; }
.stat-card.red   .stat-value { color: #dc2626; }
.stat-card.orange .stat-value { color: var(--orange); }

/* ── RANKING TABLES ───────────────────────────────────────── */
.ranking-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media(max-width:900px){ .ranking-grid { grid-template-columns: 1fr; } }

/* ── TOOLBAR ──────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  padding: 7px 11px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: 11px;
  flex: 1;
  min-width: 180px;
  background: var(--white);
  text-transform: uppercase;
}
.search-input:focus { outline: none; border-color: var(--navy); }
.filter-select {
  padding: 7px 11px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: 11px;
  background: var(--white);
  cursor: pointer;
  text-transform: uppercase;
}

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  background: #f1f5f9;
  color: var(--navy);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid var(--gray-2);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
th:hover { background: #e8eef5; }
.sort-arrow { color: #94a3b8; font-size: 9px; margin-left: 4px; }
th.sort-asc .sort-arrow, th.sort-desc .sort-arrow { color: var(--orange); }

td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gray-2);
  vertical-align: middle;
  color: var(--text);
}
tr:hover td { background: #f8fafc; }
td.strong { font-weight: 400; color: var(--text); }
.text-muted { color: var(--gray-3); }
[data-theme="dark"] td              { color: var(--text); border-color: #334155; }
[data-theme="dark"] tr:hover td    { background: #334155 !important; }
[data-theme="dark"] .text-muted    { color: var(--gray-4); }

/* ── ROW COLORS ───────────────────────────────────────────── */
tr.row-green td:first-child { border-left: 3px solid #22c55e; }
tr.row-red td:first-child   { border-left: 3px solid #ef4444; }

/* ── CHECKBOX COL ─────────────────────────────────────────── */
td.chk-col, th.chk-col { width: 36px; text-align: center; }
input[type=checkbox] { cursor: pointer; width: 15px; height: 15px; accent-color: var(--orange); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 13px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  text-transform: uppercase;
}
.btn-primary  { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover  { background: #0f2940; }
.btn-success  { background: transparent; color: #16a34a; border-color: #bbf7d0; }
.btn-success:hover  { background: #f0fdf4; }
.btn-ghost    { background: transparent; color: var(--gray-4); border-color: var(--gray-2); }
.btn-ghost:hover    { color: var(--navy); border-color: var(--navy); }
.btn-danger   { background: transparent; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover   { background: #fee2e2; }
.btn-orange   { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-orange:hover   { background: #c94408; }
.btn-navy     { background: var(--navy); color: #fff; }
.btn-navy:hover     { background: #0f2940; }
.btn-sm { padding: 4px 8px; font-size: 10px; border-radius: 5px; }

/* ── BOUTON RETOUR ROND ────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--gray-2);
  background: var(--white);
  color: var(--navy);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .12s, color .12s;
  line-height: 1;
}
.btn-back:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .4px;
  white-space: nowrap;
  text-transform: uppercase;
}
.badge-green  { background: transparent; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-red    { background: transparent; color: #dc2626; border: 1px solid #fecaca; }
.badge-orange { background: transparent; color: var(--orange); border: 1px solid #fed7aa; }
.badge-navy   { background: transparent; color: var(--navy); border: 1px solid #bfdbfe; }
.badge-gray   { background: transparent; color: var(--gray-4); border: 1px solid var(--gray-2); }

/* ── FORM ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 10px; font-weight: 400; color: var(--navy); letter-spacing: .5px; text-transform: uppercase; }
.required { color: var(--orange); }
.form-control {
  padding: 7px 10px;
  border: 1px solid var(--gray-2);
  border-radius: 6px;
  font-size: 11px;
  background: var(--white);
  transition: border-color .15s;
  width: 100%;
  text-transform: uppercase;
}
.form-control:focus { outline: none; border-color: var(--navy); }
textarea.form-control { resize: vertical; min-height: 70px; }

.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 9px;
  font-weight: 400;
  color: var(--orange);
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gray-2);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

/* ── DROP ZONE ────────────────────────────────────────────── */
.drop-zone {
  border: 1px dashed var(--gray-2);
  border-radius: 3px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  background: var(--gray-1);
  color: var(--gray-3);
  font-size: 11px;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--orange);
  background: rgba(232,85,10,.04);
  color: var(--orange);
}
.drop-zone .drop-icon { font-size: 20px; margin-bottom: 4px; }
.drop-zone .drop-filename { color: var(--navy); font-size: 11px; margin-top: 4px; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: 4px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--gray-2);
}
.modal.modal-lg { max-width: 820px; }
.modal.modal-xl { max-width: 1280px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-2);
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-header h2 { font-size: 13px; color: var(--navy); font-weight: 400; text-transform: uppercase; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-3); padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-1); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-2);
  background: var(--gray-1);
  position: sticky; bottom: 0;
}

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 20px;
  background: var(--navy); color: #fff;
  padding: 8px 14px; border-radius: 3px;
  font-size: 10.5px; font-weight: 400;
  z-index: 2000;
  transition: opacity .3s;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }

/* ── BATCH BAR ────────────────────────────────────────────── */
.batch-bar {
  position: fixed;
  bottom: 0; left: var(--sidebar-w); right: 0;
  background: var(--navy);
  padding: 8px 20px;
  display: flex; align-items: center; gap: 10px;
  z-index: 500;
  border-top: 1px solid rgba(255,255,255,.08);
}
.batch-bar.hidden { display: none; }
.batch-bar span { color: #e2e8f0; font-size: 11px; font-weight: 400; flex: 1; }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-2); margin-bottom: 16px; }
.tab {
  padding: 9px 18px; cursor: pointer; font-size: 11px; font-weight: 400;
  color: var(--gray-3); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s; text-transform: uppercase;
}
.tab:hover  { color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--orange); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DETAIL GRID ──────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-row { display: contents; }
.detail-label { font-size: 9.5px; font-weight: 400; color: var(--gray-3); text-transform: uppercase; letter-spacing: .5px; padding: 6px 12px; border-bottom: 1px solid var(--gray-1); }
.detail-value { font-size: 11px; color: var(--text); padding: 6px 12px; border-bottom: 1px solid var(--gray-1); }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-3); }
.empty-icon  { font-size: 36px; margin-bottom: 10px; }

/* ── AVIS TABLE ───────────────────────────────────────────── */
.avis-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.avis-table th, .avis-table td { border: 1px solid var(--gray-2); padding: 5px 8px; }
.avis-table th { background: #f1f5f9; font-size: 9.5px; font-weight: 400; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }

/* ── CHECKBOX GRID ────────────────────────────────────────── */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 11px; cursor: pointer; }
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.radio-item { display: flex; align-items: center; gap: 5px; font-size: 11px; cursor: pointer; }

/* ── MISC ─────────────────────────────────────────────────── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.ft-link { color: var(--orange); text-decoration: none; font-size: 11px; }
.ft-link:hover { text-decoration: underline; }
code { font-size: 11px; background: #f0f4f8; padding: 1px 5px; border-radius: 4px; font-family: monospace; }

/* ── DB BADGE ─────────────────────────────────────────────── */
#db-badge { flex-shrink: 0; padding-right: 4px; }

/* ═══════════════════════════════════════════════════════════
   AUTHENTIFICATION — ÉCRAN DE CONNEXION
   ═══════════════════════════════════════════════════════════ */

/* ── Écran login (pleine page) ──────────────────────────────── */
.login-screen {
  position: fixed; inset: 0;
  background: #0a1628;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  background-image: radial-gradient(ellipse at 50% 20%, #1a3a5c22 0%, transparent 60%);
}
.login-box {
  width: 360px;
  background: #1e293b;
  border: 1px solid #1e293b;
  border-radius: 4px;
  padding: 36px 32px 28px;
}
.login-logo {
  display: flex; justify-content: center; margin-bottom: 28px;
}
.login-logo img { height: 40px; width: auto; }
.login-title {
  text-align: center;
  font-size: 10px; font-weight: 400; letter-spacing: 2px;
  color: #64748b; text-transform: uppercase; margin-bottom: 28px;
}
.login-group { margin-bottom: 16px; }
.login-label {
  display: block; font-size: 10px; font-weight: 400;
  color: #64748b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}
.login-input {
  width: 100%; padding: 10px 14px;
  background: #0f172a; border: 1px solid #334155; border-radius: 8px;
  color: #e2e8f0; font-size: 14px; outline: none;
  transition: border-color .15s;
}
.login-input:focus { border-color: var(--orange); }
.login-input::placeholder { color: #475569; }
.login-btn {
  width: 100%; padding: 11px;
  background: var(--orange); border: none; border-radius: 8px;
  color: #fff; font-size: 12px; font-weight: 400; letter-spacing: 1px;
  cursor: pointer; margin-top: 8px; text-transform: uppercase;
  transition: background .15s, transform .1s;
}
.login-btn:hover { background: #c4460a; }
.login-btn:active { transform: scale(.98); }
.login-error {
  margin-top: 12px; padding: 10px 14px;
  background: #3b1414; border: 1px solid #7f1d1d; border-radius: 8px;
  color: #f87171; font-size: 12px; text-align: center; display: none;
}
.login-forgot {
  display: block; text-align: center; margin-top: 16px;
  font-size: 12px; color: #64748b; cursor: pointer; text-decoration: none;
}
.login-forgot:hover { color: #94a3b8; }

/* ── Badge de validation dans la topbar ─────────────────────── */
.validation-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--orange); border-radius: 9px;
  font-size: 10px; font-weight: 400; color: #fff;
  margin-left: 4px; vertical-align: middle;
}

/* ── Panel validations ──────────────────────────────────────── */
.validation-card {
  background: var(--card-bg); border: 1px solid var(--gray-2);
  border-radius: 4px; padding: 14px; margin-bottom: 8px;
}
.validation-card.approved { border-left: 4px solid #22c55e; }
.validation-card.rejected { border-left: 4px solid #ef4444; }
.validation-card.pending  { border-left: 4px solid var(--orange); }
.validation-meta {
  font-size: 11px; color: var(--gray-4); margin-bottom: 8px;
  display: flex; gap: 12px; flex-wrap: wrap;
}
.validation-label { font-size: 11px; font-weight: 400; margin-bottom: 6px; }
.validation-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Gestion utilisateurs ───────────────────────────────────── */
.user-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--card-bg);
  border: 1px solid var(--gray-2); border-radius: 10px; margin-bottom: 8px;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--orange));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 400; }
.user-role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 9.5px; font-weight: 400; letter-spacing: .5px; text-transform: uppercase;
}
.role-admin     { background: #1e3a5f; color: #93c5fd; }
.role-direction { background: #1e3a5f; color: #7dd3fc; }
.role-etudes    { background: #14532d; color: #86efac; }
.role-travaux   { background: #431407; color: #fb923c; }
.role-lecture   { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }
.user-inactive  { opacity: .5; }

/* ── Mot de passe reset screen ──────────────────────────────── */
.reset-screen { display: none; }
