/* ============================================================
   Ortho Primum — Feuille de style partagée
   Utilisée par : landing.html, login.html, base.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

/* ── VARIABLES ── */
:root {
  --blue:          #185FA5;
  --blue-light:    #E6F1FB;
  --blue-mid:      #378ADD;
  --blue-dark:     #0f4a82;
  --green-light:   #46beaa;
  --green-dark:    #298f81;
  --ink:           #1a1f2e;
  --ink-soft:      #4a5168;
  --ink-muted:     #8a90a2;
  --surface:       #f7f8fc;
  --white:         #ffffff;
  --border:        rgba(24,95,165,0.12);
  --border-hover:  rgba(24,95,165,0.30);
  --border-grille: rgba(24,95,165,0.09);   /* cadrillage tableau (lignes + colonnes), un peu plus clair que --border */
  --chrome-bg:     #d6e4f0;   /* sidebar + topbar : bleu-gris */
  --page-bg:       #f0f4f8;   /* fond des pages */
  --success-bg:    #EAF3DE;
  --success-text:  #3B6D11;
  --error-bg:      #FEE2E2;
  --error-border:  #FECACA;
  --error-text:    #991B1B;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-pill:   100px;
  /* ── Couleurs data-viz KPI ── */
  --kpi-mar:       #2563eb;
  --kpi-iade:      #0891b2;
  --kpi-mar-iade:  #059669;
  --kpi-soft1:     #6366f1;
  --kpi-tandem:    #f59e0b;
  --kpi-soft4a:    #8b5cf6;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── BASE ── */
body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
}

/* ── TYPOGRAPHIE ── */
.font-serif { font-family: 'DM Serif Display', serif; font-weight: 400; }
.op-ortho   { color: var(--green-light); font-weight: 700; }
.op-primum  { color: var(--green-dark);  font-weight: 700; }

/* ── BOUTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.15s;
  border: 1.5px solid transparent;
}
.btn-primary  { background: var(--blue);  color: var(--white); border-color: var(--blue); }
.btn-primary:hover  { background: var(--blue-dark); border-color: var(--blue-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--blue); background: var(--blue-light); }
.btn-google   { background: var(--white); color: #374151; border-color: #D1D5DB; width: 100%; }
.btn-google:hover  { background: #F9FAFB; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.btn-google:active { background: #F3F4F6; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
}
.badge-blue { background: var(--blue-light); color: var(--blue); border: 1px solid rgba(24,95,165,0.15); }
.badge-blue::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--blue-mid); flex-shrink: 0; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-muted   { background: #f1efe8; color: #888780; }

/* ── ALERTES ── */
.alert { width: 100%; border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13px; line-height: 1.5; }
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error-border); color: var(--error-text); }
.alert-success { background: var(--success-bg); border: 1px solid #C0DD97; color: var(--success-text); }
.alert-title   { font-weight: 700; margin-bottom: 4px; }

/* ── DIVIDER ── */
.divider { width: 100%; height: 1px; background: #E5E7EB; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-fade-up { animation: fadeUp 0.7s ease forwards; opacity: 0; }
.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }
.anim-delay-5 { animation-delay: 0.55s; }

/* ── SCROLLBARS ── */
/* Chrome / Safari / Edge */
::-webkit-scrollbar              { width: 14px; height: 14px; }
::-webkit-scrollbar-track        { background: var(--surface); border-radius: 8px; }
::-webkit-scrollbar-thumb        { background: #c1c6d4; border-radius: 8px; border: 3px solid var(--surface); }
::-webkit-scrollbar-thumb:hover  { background: #8a90a2; }
::-webkit-scrollbar-corner       { background: var(--surface); }
/* Firefox */
* { scrollbar-width: auto; scrollbar-color: #c1c6d4 var(--surface); }

/* Ghost sticky scrollbar (créé par JS) — hauteur cohérente */
._sticky-scroll-ghost { height: 10px !important; }

/* ── DARK MODE ── */
[data-theme="dark"] {
  --blue:          #4fa3e0;
  --blue-light:    #1a2d42;
  --blue-mid:      #5aaee8;
  --blue-dark:     #6da8c8;
  --green-light:   #46beaa;
  --green-dark:    #5ecebe;
  --ink:           #c8cdd8;
  --ink-soft:      #8e97b0;
  --ink-muted:     #5e6880;
  --surface:       #1e2232;
  --white:         #252a3a;
  --border:        rgba(255,255,255,0.08);
  --border-hover:  rgba(255,255,255,0.20);
  --border-grille: rgba(255,255,255,0.06);   /* cadrillage tableau (lignes + colonnes), un peu plus clair que --border */
  --chrome-bg:     #151b2e;   /* sidebar + topbar dark : bleu très sombre */
  --page-bg:       #1a1f30;   /* fond pages dark */
  --success-bg:    #1a2e10;
  --success-text:  #7dcc4a;
  --error-bg:      #2e1010;
  --error-border:  #5a1f1f;
  --error-text:    #d08080;
  /* ── Couleurs data-viz KPI (dark) ── */
  --kpi-mar:       #60a5fa;
  --kpi-iade:      #22d3ee;
  --kpi-mar-iade:  #34d399;
  --kpi-soft1:     #818cf8;
  --kpi-tandem:    #c49a3c;
  --kpi-soft4a:    #8b7cc8;
}

[data-theme="dark"] body {
  background: #161925;
  color: var(--ink);
}

/* Bouton dark-mode toggle */
.op-sb-darkmode {
  width: 22px; height: 22px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  background: none; border: none; cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.op-sb-darkmode:hover { background: var(--blue-light); color: var(--blue); }

.op-dark-icon-wrap {
  position: relative;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
}
.op-dark-moon,
.op-dark-sun {
  position: absolute;
  width: 14px; height: 14px;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

/* État light : lune visible, soleil caché */
.op-dark-moon { opacity: 1; transform: rotate(0deg) scale(1); }
.op-dark-sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }

/* État dark : soleil visible, lune cachée */
[data-theme="dark"] .op-dark-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="dark"] .op-dark-sun  { opacity: 1; transform: rotate(0deg) scale(1); }

/* Transition globale douce sur les couleurs lors du changement de thème */
body, .op-sidebar, .op-topbar, .op-main, .op-card,
.op-sb-item, .op-sb-section, .op-sb-footer, .op-sb-logo,
main, section, header, aside, nav, footer,
table, thead, tbody, tr, th, td,
input, select, textarea, button {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.15s ease;
}

/* ── DARK MODE — surcharges valeurs en dur ── */

/* En-têtes de tableau */
[data-theme="dark"] .op-table th {
  background: #1a1f2e;
  color: var(--ink-muted);
}
[data-theme="dark"] .op-table tr:hover td {
  background: #1e2438;
}

/* Bouton danger hover */
[data-theme="dark"] .op-sb-logout:hover { background: rgba(220,38,38,0.2); }
[data-theme="dark"] .op-btn-danger { color: #d08080; border-color: rgba(208,128,128,0.35); background: transparent; }
[data-theme="dark"] .op-btn-danger:hover { background: rgba(180,60,60,0.15); border-color: #d08080; }

/* Statuts badges */
[data-theme="dark"] .op-status-en_vigueur,
[data-theme="dark"] .op-status-publie         { background: #14372a; color: #7abf9e; }
[data-theme="dark"] .op-status-brouillon      { background: #252b3a; color: #94a3b8; }
[data-theme="dark"] .op-status-en_vigueur_a_reviser { background: #3a2a10; color: #c49a3c; }
[data-theme="dark"] .op-status-planification_impossible { background: #3a1010; color: #d08080; }
[data-theme="dark"] .op-status-realise        { background: #252520; color: #9ca3af; }
[data-theme="dark"] .db-status-vide           { background: #3a1010; color: #d08080; }
[data-theme="dark"] .db-status-brouillon      { background: #3a2a10; color: #c49a3c; }

/* Flashes */
[data-theme="dark"] .op-flash-warning { background: #3a2a10; border-color: #78450a; color: #c49a3c; }

/* Messages bande */
[data-theme="dark"] .op-msg-jaune { background: #3a2a10; border-color: #78450a; color: #c49a3c; }

/* Modale confirm — header palette light */
#op-confirm-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
}
#op-confirm-header[data-variant="warning"] { background: #FFF7ED; border-color: #FED7AA; }
#op-confirm-header[data-variant="danger"]  { background: #FEF2F2; border-color: #FECACA; }
#op-confirm-header[data-variant="info"]    { background: #EFF6FF; border-color: #BFDBFE; }
#op-confirm-header:not([data-variant])     { background: #F0F7FF; border-color: #BFDBFE; }

#op-confirm-icon[data-variant="warning"] { background: #FDBA74; }
#op-confirm-icon[data-variant="danger"]  { background: #FCA5A5; }
#op-confirm-icon[data-variant="info"]    { background: #93C5FD; }
#op-confirm-icon:not([data-variant])     { background: #93C5FD; }

#op-confirm-header[data-variant="warning"] #op-confirm-title { color: #9A3412; }
#op-confirm-header[data-variant="danger"]  #op-confirm-title { color: #991B1B; }
#op-confirm-header[data-variant="info"]    #op-confirm-title { color: #1E40AF; }
#op-confirm-header:not([data-variant])     #op-confirm-title { color: #1E40AF; }

/* Modale confirm — header palette dark */
[data-theme="dark"] #op-confirm-box { background: #1e2232; }
[data-theme="dark"] #op-confirm-header[data-variant="warning"] { background: #3a2a10 !important; border-color: #78450a !important; }
[data-theme="dark"] #op-confirm-header[data-variant="danger"]  { background: #3a1010 !important; border-color: #7f1d1d !important; }
[data-theme="dark"] #op-confirm-header[data-variant="info"]    { background: #1a2d42 !important; border-color: #1e40af !important; }
[data-theme="dark"] #op-confirm-header                         { background: #1a2d42 !important; border-color: #1e3a5f !important; }
[data-theme="dark"] #op-confirm-header[data-variant="warning"] #op-confirm-title { color: #c49a3c; }
[data-theme="dark"] #op-confirm-header[data-variant="danger"]  #op-confirm-title { color: #b07070; }
[data-theme="dark"] #op-confirm-header[data-variant="info"]    #op-confirm-title { color: #7aabcc; }
[data-theme="dark"] #op-confirm-icon[data-variant="warning"] { background: #78450a; }
[data-theme="dark"] #op-confirm-icon[data-variant="danger"]  { background: #7f1d1d; }
[data-theme="dark"] #op-confirm-icon[data-variant="info"]    { background: #1e3a8a; }

/* Modale génération planning — dark mode */
[data-theme="dark"] #gen-box          { background: #1e2232 !important; }
[data-theme="dark"] #gen-title        { color: #e2e8f0 !important; }
[data-theme="dark"] .gen-step-label   { color: #e2e8f0 !important; }
[data-theme="dark"] .gen-step.waiting .gen-step-label  { color: #64748b !important; }
[data-theme="dark"] .gen-step.waiting .gen-step-icon   { background: #2a3147 !important; color: #64748b !important; }
[data-theme="dark"] .gen-step.active  { background: #1a2d42 !important; }
[data-theme="dark"] .gen-step.done    { background: #14372a !important; }
[data-theme="dark"] .gen-step.error   { background: #3a1010 !important; }
[data-theme="dark"] .gen-jour         { background: #252b3a !important; }
[data-theme="dark"] .gen-jour-nom     { color: #e2e8f0 !important; }
[data-theme="dark"] .gen-jour-lignes  { color: #94a3b8 !important; }
[data-theme="dark"] #gen-log          { background: #141824 !important; color: #94a3b8 !important; border-color: rgba(24,95,165,.2) !important; }
[data-theme="dark"] #gen-objectif     { background: #252b3a !important; color: #cbd5e1 !important; border-color: rgba(24,95,165,.15) !important; }
[data-theme="dark"] #gen-status       { color: #64748b !important; }
/* Statuts CP-SAT demi-journées */
[data-theme="dark"] .statut-optimal   { background: #14372a !important; color: #7abf9e !important; }
[data-theme="dark"] .statut-feasible  { background: #3a2a10 !important; color: #c49a3c !important; }
[data-theme="dark"] .statut-infeasible { background: #3a1010 !important; color: #b07070 !important; }
[data-theme="dark"] .statut-encours   { background: #1a2d42 !important; color: #6da8c8 !important; }
[data-theme="dark"] .gen-row-encours  { background: #1a2d42 !important; }
[data-theme="dark"] .gen-row-feasible { background: #3a2a10 !important; }
[data-theme="dark"] .gen-row-infeasible { background: #3a1010 !important; }
[data-theme="dark"] .gen-diag         { color: #b07070 !important; }
[data-theme="dark"] .gen-label-optimal  { color: #7abf9e !important; }
[data-theme="dark"] .gen-label-feasible { color: #c49a3c !important; }
[data-theme="dark"] .gen-label-infeasible { color: #b07070 !important; }

/* ── Tableau KPI — colonnes colorées (light) ───────────────────────────── */
.kpi-grp-r { background:#eff6ff; color:#1d4ed8; border-left:2px solid #bfdbfe; }
.kpi-grp-h { background:#fefce8; color:#854d0e; border-left:2px solid #fde68a; }
.kpi-grp-s { background:#f5f3ff; color:#5b21b6; border-left:2px solid #ddd6fe; }
.kpi-grp-v { background:#fff7ed; color:#c2410c; border-left:2px solid #fed7aa; }
.kpi-col-r { background:#fafbff; }
.kpi-col-h { background:#fefdf0; }
.kpi-col-s { background:#fdfcff; }
.kpi-col-v { background:#fffaf5; }
.kpi-sep   { border-left:2px solid var(--border); }
.kpi-cumul { padding:3px 8px; font-size:11px; font-weight:600; background:var(--surface); }
.kpi-cumul.kpi-col-r { background:#eff6ff; }
.kpi-cumul.kpi-col-h { background:#fefce8; }
.kpi-cumul.kpi-col-s { background:#f5f3ff; }
.kpi-cumul.kpi-col-v { background:#fff7ed; }
.kpi-row-hover { background:#f0f9ff; }
.kpi-np-warn { color:#b45309; }
.kpi-np-info { color:#0369a1; }
.statut-derog { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }

/* KPI dark */
[data-theme="dark"] .kpi-grp-r { background:#1a2840; color:#7aabcc; border-left-color:#1e3a5f; }
[data-theme="dark"] .kpi-grp-h { background:#2a2010; color:#c49a3c; border-left-color:#78450a; }
[data-theme="dark"] .kpi-grp-s { background:#1e1a30; color:#9e8fd4; border-left-color:#4c1d95; }
[data-theme="dark"] .kpi-grp-v { background:#2a1a0a; color:#e07040; border-left-color:#7c3212; }
[data-theme="dark"] .kpi-col-r { background:#1a2232; }
[data-theme="dark"] .kpi-col-h { background:#1e1c10; }
[data-theme="dark"] .kpi-col-s { background:#1a1a28; }
[data-theme="dark"] .kpi-col-v { background:#1e1408; }
[data-theme="dark"] .kpi-cumul.kpi-col-r { background:#1a2840; }
[data-theme="dark"] .kpi-cumul.kpi-col-h { background:#2a2010; }
[data-theme="dark"] .kpi-cumul.kpi-col-s { background:#1e1a30; }
[data-theme="dark"] .kpi-cumul.kpi-col-v { background:#2a1a0a; }
[data-theme="dark"] .kpi-row-hover { background:#1a2d42; }
[data-theme="dark"] .kpi-np-warn { color:#c49a3c; }
[data-theme="dark"] .kpi-np-info { color:#6da8c8; }
[data-theme="dark"] .statut-derog { background:#2a1a0a; color:#e07040; border-color:#7c3212; }

/* ── Contrôles — banners et lignes (light) ─────────────────────────────── */
.ctrl-banner     { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:6px; font-size:12px; margin-bottom:8px; }
.ctrl-banner-ok  { background:#f0fdf4; border-left:3px solid #22c55e; color:#15803d; }
.ctrl-banner-err { background:#fff5f5; border-left:3px solid #ef4444; color:#991b1b; }
.ctrl-banner-warn{ background:#fffbeb; border-left:3px solid #f59e0b; color:#92400e; }
.ctrl-row        { display:flex; align-items:flex-start; gap:8px; padding:4px 8px; border-radius:6px; margin-bottom:3px; cursor:default; }
.ctrl-row-ok     { background:#f0fdf4; border-left:3px solid #22c55e; align-items:center; }
.ctrl-row-err    { background:#fff5f5; border-left:3px solid #ef4444; cursor:pointer; }
.ctrl-row-warn   { background:#fffbeb; border-left:3px solid #f59e0b; cursor:pointer; }

/* Contrôles dark */
[data-theme="dark"] .ctrl-banner-ok  { background:#14372a; border-left-color:#22c55e; color:#7abf9e; }
[data-theme="dark"] .ctrl-banner-err { background:#3a1010; border-left-color:#ef4444; color:#b07070; }
[data-theme="dark"] .ctrl-banner-warn{ background:#3a2a10; border-left-color:#f59e0b; color:#c49a3c; }
[data-theme="dark"] .ctrl-row-ok     { background:#14372a; }
[data-theme="dark"] .ctrl-row-err    { background:#3a1010; }
[data-theme="dark"] .ctrl-row-warn   { background:#3a2a10; }

/* ── Tooltip cellule planning ───────────────────────────────────────────── */
.tt-binome-absent { color:#d97706; }
.tt-binome-ok     { color:#16a34a; }
.tt-binome-ko     { color:#dc2626; }
[data-theme="dark"] .tt-binome-absent { color:#c49a3c; }
[data-theme="dark"] .tt-binome-ok     { color:#7abf9e; }
[data-theme="dark"] .tt-binome-ko     { color:#b07070; }
/* ═══════════════════════════════════════════════════════════════════════════
   CLASSES SÉMANTIQUES GÉNÉRIQUES — dark mode ready
   Ajoutées S328 pour éliminer les couleurs hardcodées dans les templates.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Bannières / alertes inline ─────────────────────────────────────────── */
/* Usage : <div class="op-alert op-alert-success"> … </div>               */
.op-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.op-alert-success { background: #EAF3DE; border: 1px solid #C0DD97; color: #3B6D11; }
.op-alert-warning { background: #FAEEDA; border: 1px solid #FAC775; color: #854F0B; }
.op-alert-info    { background: #E6F1FB; border: 1px solid #B5D4F4; color: #185FA5; }
.op-alert-danger  { background: #FCEBEB; border: 1px solid #f7c1c1; color: #A32D2D; }

[data-theme="dark"] .op-alert-success { background: #14372a; border-color: #1d5c34; color: #7abf9e; }
[data-theme="dark"] .op-alert-warning { background: #3a2a10; border-color: #78450a; color: #c49a3c; }
[data-theme="dark"] .op-alert-info    { background: #1a2840; border-color: #1e3a5f; color: #7aabcc; }
[data-theme="dark"] .op-alert-danger  { background: #3a1010; border-color: #5a1a1a; color: #b07070; }

/* ── Blocs modale danger / warning (dans les modales de confirmation) ───── */
.op-modal-danger {
  padding: 14px 16px; background: #FCEBEB; border-radius: 8px;
  border: 1px solid #f7c1c1; margin-bottom: 8px;
}
.op-modal-warning {
  padding: 14px 16px; background: #FAEEDA; border-radius: 8px;
  border: 1px solid #f5c6a0; margin-bottom: 8px;
}
.op-modal-danger p, .op-modal-danger strong  { color: #A32D2D; }
.op-modal-danger li                          { color: #791F1F; }
.op-modal-danger small                       { color: #9a6b2e; }
.op-modal-warning p, .op-modal-warning strong{ color: #854F0B; }
.op-modal-warning li                         { color: #633806; }
.op-modal-warning small                      { color: #9a6b2e; }

[data-theme="dark"] .op-modal-danger  { background: #3a1010; border-color: #5a1a1a; }
[data-theme="dark"] .op-modal-danger p, [data-theme="dark"] .op-modal-danger strong { color: #b07070; }
[data-theme="dark"] .op-modal-danger li { color: #b07070; }
[data-theme="dark"] .op-modal-warning { background: #3a2a10; border-color: #78450a; }
[data-theme="dark"] .op-modal-warning p, [data-theme="dark"] .op-modal-warning strong { color: #c49a3c; }
[data-theme="dark"] .op-modal-warning li { color: #fde68a; }
[data-theme="dark"] .op-modal-warning small { color: #c49a3c; }
[data-theme="dark"] .op-modal-danger small  { color: #b07070; }

/* ── Badges spécialité ──────────────────────────────────────────────────── */
.op-badge-thoracique  { background: #E6F1FB; color: #185FA5; }
.op-badge-pediatrique { background: #E1F5EE; color: #0F6E56; }

[data-theme="dark"] .op-badge-thoracique  { background: #1a2840; color: #7aabcc; }
[data-theme="dark"] .op-badge-pediatrique { background: #14372a; color: #7abf9e; }

/* ── Badge rôle (individuel.html légende) ───────────────────────────────── */
.op-badge-role-mar   { background: #dbeafe; color: #1e40af; }
.op-badge-role-iade  { background: #dcfce7; color: #065f46; }
.op-badge-role-chir  { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .op-badge-role-mar  { background: #1a2840; color: #7aabcc; }
[data-theme="dark"] .op-badge-role-iade { background: #14372a; color: #7abf9e; }
[data-theme="dark"] .op-badge-role-chir { background: #3a1010; color: #b07070; }

/* ── Badges présence (légende individuel + cellules) ───────────────────── */
.op-presence-ok    { background: #D4EDDA; color: #155724; }
.op-presence-abs   { background: #F8D7DA; color: #721c24; }
.op-presence-cpa    { background: #dbeafe; color: #1e40af; font-weight: 600; }
.op-presence-compta { background: #fff7ed; color: #c2410c; font-weight: 600; }
.op-presence-decl  { background: #E2E3E5; color: #383d41; text-decoration: line-through; }
.op-presence-excep { background: #FEF3C7; color: #856404; }

[data-theme="dark"] .op-presence-ok    { background: #1a2e22; color: #86c9a0; }
[data-theme="dark"] .op-presence-abs   { background: #251a1a; color: #b07070; }
[data-theme="dark"] .op-presence-cpa    { background: #1a2030; color: #7ea8d4; }
[data-theme="dark"] .op-presence-compta { background: #251e15; color: #c49060; }
[data-theme="dark"] .op-presence-decl  { background: #22252e; color: #7a8090; text-decoration: line-through; }
[data-theme="dark"] .op-presence-excep { background: #28221a; color: #c4a050; }

/* ── Cellules tableau individuel (fond de td) ───────────────────────────── */
.op-cell-abs   { background: #F3F4F6; }
.op-cell-excep { background: #FFFBEB; }
.op-cell-ok    { background: #F0FDF4; }

[data-theme="dark"] .op-cell-abs   { background: #1e2232; }
[data-theme="dark"] .op-cell-excep { background: #1e1c10; }
[data-theme="dark"] .op-cell-ok    { background: #142a1e; }

/* ── Textes colorés simples ─────────────────────────────────────────────── */
.op-text-warning  { color: #854F0B; }
.op-text-danger   { color: #991B1B; }
.op-text-muted    { color: #6b7280; }
.op-text-disabled { color: #854F0B; font-size: 11px; }

[data-theme="dark"] .op-text-warning  { color: #c49a3c; }
[data-theme="dark"] .op-text-danger   { color: #b07070; }
[data-theme="dark"] .op-text-muted    { color: #64748b; }
[data-theme="dark"] .op-text-disabled { color: #c49a3c; }

/* ── Couleur texte required (*) ─────────────────────────────────────────── */
.op-required { color: #E24B4A; }
[data-theme="dark"] .op-required { color: #b07070; }

/* ── Élément inactif badge ──────────────────────────────────────────────── */
.op-badge-inactif { background: #FEE2E2; color: #991B1B; font-size: 10px; padding: 1px 5px; border-radius: 3px; }
[data-theme="dark"] .op-badge-inactif { background: #3a1010; color: #b07070; }

/* ── Planning index — lignes colorées ───────────────────────────────────── */
.op-row-rem      { background: #FFFBEB; }
.op-row-brouillon{ background: #FFFBF0; }
.op-row-ok       { background: #F0F9F0; }
.op-row-warn     { background: #FEF3C7; }

[data-theme="dark"] .op-row-rem       { background: #1e1c10; }
[data-theme="dark"] .op-row-brouillon { background: #1a1a10; }
[data-theme="dark"] .op-row-ok        { background: #142a1e; }
[data-theme="dark"] .op-row-warn      { background: #3a2a10; }

/* ── Impact macro (calendrier) ──────────────────────────────────────────── */
.op-impact-warning { color: #854F0B; font-size: 13px; }
[data-theme="dark"] .op-impact-warning { color: #c49a3c; }

/* ── Solde NP coloré (mar/index, mar/view) ──────────────────────────────── */
/* Géré via Jinja conditionnel → pas de classe unique possible ; on laisse var(--blue) et on ajoute juste */
.op-solde-neg { color: #991B1B; }
[data-theme="dark"] .op-solde-neg { color: #b07070; }

/* ── Badges rôle utilisateur ─────────────────────────────────────────────── */
.op-badge-role-admin    { background: #FEF9C3; color: #854D0E; font-weight: 600; }
.op-badge-role-acces-mar{ background: #FEF9C3; color: #854D0E; }
.op-badge-role-chef-bloc{ background: #FEE2B6; color: #7C3600; font-weight: 600; }
.op-badge-role-lecture  { background: #EDE9FE; color: #5B21B6; }
.op-badge-role-secretaire{ background: #F0FDF4; color: #166534; }

[data-theme="dark"] .op-badge-role-admin     { background: #3a2a00; color: #c49a3c; }
[data-theme="dark"] .op-badge-role-acces-mar { background: #3a2a00; color: #c49a3c; }
[data-theme="dark"] .op-badge-role-chef-bloc { background: #3a1800; color: #c07838; }
[data-theme="dark"] .op-badge-role-lecture   { background: #2a1a42; color: #9e8fd4; }
[data-theme="dark"] .op-badge-role-secretaire{ background: #122a1e; color: #7abf9e; }

/* ── Badge erreur toggle utilisateur (fond ligne rouge) ─────────────────── */
.op-row-error { background: #FEF2F2; }
[data-theme="dark"] .op-row-error { background: #2a1010; }

/* ── Badges action log ───────────────────────────────────────────────────── */
.op-badge-log-create { background: #EAF3DE; color: #3B6D11; }
.op-badge-log-delete { background: #FEE2E2; color: #991B1B; }
.op-badge-log-toggle { background: #FAEEDA; color: #854F0B; }
.op-badge-log-update { background: var(--blue-light); color: var(--blue); }

[data-theme="dark"] .op-badge-log-create { background: #14372a; color: #7abf9e; }
[data-theme="dark"] .op-badge-log-delete { background: #3a1010; color: #b07070; }
[data-theme="dark"] .op-badge-log-toggle { background: #3a2a10; color: #c49a3c; }
[data-theme="dark"] .op-badge-log-update { background: #1a2840; color: #7aabcc; }

/* Log diff — avant/après ─────────────────────────────────────────────────── */
.op-log-before { color: #991B1B; }
.op-log-after  { color: #3B6D11; font-weight: 500; }
[data-theme="dark"] .op-log-before { color: #b07070; }
[data-theme="dark"] .op-log-after  { color: #7abf9e; }

/* ── Badges message ──────────────────────────────────────────────────────── */
.op-badge-msg-acquittement { background: #F3E8FF; color: #6B21A8; }
.op-badge-msg-jaune        { background: #FAEEDA; color: #854F0B; }

[data-theme="dark"] .op-badge-msg-acquittement { background: #2a1240; color: #d8b4fe; }
[data-theme="dark"] .op-badge-msg-jaune        { background: #3a2a10; color: #c49a3c; }

/* ── Cellule hors-cycle (planning individuel) ────────────────────────────── */
.op-cell-hors-cycle { background: #FEF2F2 !important; }
[data-theme="dark"] .op-cell-hors-cycle { background: #2a1010 !important; }

/* ── Section IADE (présence/calendrier) ──────────────────────────────────── */
.op-section-iade { background: #E1F5EE; color: #0F6E56; border-radius: 12px 12px 0 0; }
[data-theme="dark"] .op-section-iade { background: #0f2a20; color: #7abf9e; }

/* ── Section planning (calendrier) ───────────────────────────────────────── */
.op-section-planning { background: var(--success-bg); border-radius: 12px 12px 0 0; }
[data-theme="dark"] .op-section-planning { background: #14372a; }

/* ── Alerte warning amber (absence_form) ─────────────────────────────────── */
.op-alert-amber {
  background: #fff8e1; border: 1px solid #f9a825; color: #5d4037;
  padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 20px;
}
.op-alert-amber-note { margin-top: 6px; font-size: 12px; color: #795548; }
[data-theme="dark"] .op-alert-amber       { background: #3a2a10; border-color: #78450a; color: #c49a3c; }
[data-theme="dark"] .op-alert-amber-note  { color: #c49a3c; }

/* ── Zone inactive (fond rouge) ─────────────────────────────────────────── */
.op-zone-inactive { background: #FEE2E2; }
[data-theme="dark"] .op-zone-inactive { background: #2a1010; }

/* ── Maintenance warning badge ───────────────────────────────────────────── */
.op-maintenance-warn {
  background: #FAEEDA; border: 1px solid #FAC775; color: #854F0B;
}
[data-theme="dark"] .op-maintenance-warn { background: #3a2a10; border-color: #78450a; color: #c49a3c; }

.op-maintenance-warn-icon { background: #FAEEDA; color: #854F0B; }
.op-maintenance-ok-icon   { background: var(--success-bg); color: var(--success-text); }
[data-theme="dark"] .op-maintenance-warn-icon { background: #3a2a10; color: #c49a3c; }
[data-theme="dark"] .op-maintenance-ok-icon   { background: var(--success-bg); color: var(--success-text); }

/* ── Bouton danger (outline) ────────────────────────────────────────────── */
.op-btn-danger-outline  { color: #DC2626; border-color: #DC2626; }
[data-theme="dark"] .op-btn-danger-outline  { color: #d08080; border-color: #d08080; }
.op-btn-warning-outline { color: #d97706; border-color: #d97706; }
[data-theme="dark"] .op-btn-warning-outline { color: #c49060; border-color: #c49060; }

/* ── Icône / texte warning dans index chirurgien ─────────────────────────── */
.op-text-access-disabled { color: #854F0B; font-size: 11px; }
[data-theme="dark"] .op-text-access-disabled { color: #c49a3c; }

/* ── Couleur admin seul (mar/form) ───────────────────────────────────────── */
.op-admin-seul {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #FEF9C3;
  border-radius: 8px; border: 1px solid #FDE68A;
}
.op-admin-seul span { font-size: 12px; color: #854D0E; }
[data-theme="dark"] .op-admin-seul       { background: #3a2a00; border-color: #78450a; }
[data-theme="dark"] .op-admin-seul span  { color: #c49a3c; }

/* ── Solde NP négatif (mar/solde) ────────────────────────────────────────── */
.op-solde-neg-large { color: #991B1B; }
[data-theme="dark"] .op-solde-neg-large { color: #b07070; }

/* ── Cycle — carré légende et couleurs cellules ──────────────────────────── */
.op-cycle-bloc   { background: #d4edda; border: 1px solid #c3e6cb; }
.op-cycle-cpa    { background: #dbeafe; border: 1px solid #bfdbfe; }
.op-cycle-compta { background: #fff7ed; border: 1px solid #fed7aa; }
.op-cycle-absent { background: #f8d7da; border: 1px solid #f5c6cb; }
[data-theme="dark"] .op-cycle-bloc   { background: #14372a; border-color: #1a5c3a; }
[data-theme="dark"] .op-cycle-cpa    { background: #1a2840; border-color: #1e3a5f; }
[data-theme="dark"] .op-cycle-compta { background: #2a1500; border-color: #7c2d12; }
[data-theme="dark"] .op-cycle-absent { background: #3a1010; border-color: #5a1a1a; }

/* Pill interactive cycle (button) */
.op-cycle-pill[data-etat="bloc"]   { background: #d4edda; }
.op-cycle-pill[data-etat="cpa"]    { background: #dbeafe; }
.op-cycle-pill[data-etat="absent"] { background: #f8d7da; }
[data-theme="dark"] .op-cycle-pill[data-etat="bloc"]   { background: #14372a; color: #7abf9e; }
[data-theme="dark"] .op-cycle-pill[data-etat="cpa"]    { background: #1a2840; color: #7aabcc; }
[data-theme="dark"] .op-cycle-pill[data-etat="absent"] { background: #3a1010; color: #b07070; }

/* ── Messages suivi — pastille couleur ───────────────────────────────────── */
.op-msg-dot-vert   { background: #5fa832; }
.op-msg-dot-jaune  { background: #e89c0e; }
.op-msg-dot-rouge  { background: #dc2626; }
[data-theme="dark"] .op-msg-dot-vert   { background: #7abf9e; }
[data-theme="dark"] .op-msg-dot-jaune  { background: #c49a3c; }
[data-theme="dark"] .op-msg-dot-rouge  { background: #b07070; }

/* ── Planning individuel — badges collègues ──────────────────────────────── */
.ind-badge-mar  { background: #FEF9C3; color: #854D0E; }
.ind-badge-iade { background: #DBEAFE; color: #1E40AF; }
.ind-badge-chir { background: #FAEEDA; color: #854F0B; }
[data-theme="dark"] .ind-badge-mar  { background: #3a2a00; color: #c49a3c; }
[data-theme="dark"] .ind-badge-iade { background: #1a2840; color: #7aabcc; }
[data-theme="dark"] .ind-badge-chir { background: #3a2a10; color: #c49a3c; }

/* ── Planning charger — badge parité programme type ─────────────────────── */
.op-parite-paire   { background: var(--blue-light); border: 1px solid #B5D4F4; color: #185FA5; }
.op-parite-impaire { background: #F0FDF4; border: 1px solid #C0DD97; color: #3B6D11; }
[data-theme="dark"] .op-parite-paire   { background: #1a2840; border-color: #1e3a5f; color: #7aabcc; }
[data-theme="dark"] .op-parite-impaire { background: #0f2a1e; border-color: #14532d; color: #7abf9e; }

/* ── Planning programme_detail — badges et diff ──────────────────────────── */
.pg-badge-mar  { background: #FEF9C3; color: #854D0E; }
.pg-badge-iade { background: #DBEAFE; color: #1E40AF; }
[data-theme="dark"] .pg-badge-mar  { background: #3a2a00; color: #c49a3c; }
[data-theme="dark"] .pg-badge-iade { background: #1a2840; color: #7aabcc; }

/* diff programme type */
.op-diff-ok   { color: #16A34A; font-weight: 500; }
.op-diff-ajout { color: #16A34A; font-weight: 500; }
.op-diff-modif { color: #D97706; font-weight: 500; }
.op-diff-suppr { color: #DC2626; font-weight: 500; }
.op-diff-arrow { color: #F97316; font-size: 10px; }
[data-theme="dark"] .op-diff-ok     { color: #7abf9e; }
[data-theme="dark"] .op-diff-ajout  { color: #7abf9e; }
[data-theme="dark"] .op-diff-modif  { color: #c49a3c; }
[data-theme="dark"] .op-diff-suppr  { color: #b07070; }
[data-theme="dark"] .op-diff-arrow  { color: #c07838; }

/* légende diff programme type */
.op-legende-ajout { display:inline-block;width:10px;height:10px;background:#F0FDF4;border:1px solid #22C55E;border-radius:2px;margin-right:3px;vertical-align:-1px; }
.op-legende-modif { display:inline-block;width:10px;height:10px;background:#FFF7ED;border:1px solid #F97316;border-radius:2px;margin-right:3px;margin-left:8px;vertical-align:-1px; }
.op-legende-suppr { display:inline-block;width:10px;height:10px;background:#FEF2F2;border:1px solid #EF4444;border-radius:2px;margin-right:3px;margin-left:8px;vertical-align:-1px; }
[data-theme="dark"] .op-legende-ajout { background:#0f2a1e; border-color:#14532d; }
[data-theme="dark"] .op-legende-modif { background:#2a1a00; border-color:#92400e; }
[data-theme="dark"] .op-legende-suppr { background:#2a1010; border-color:#7f1d1d; }

/* badge inactif (chirurgien/salle) */
.op-badge-inactif { background:#FEE2E2; color:#991B1B; font-size:10px; padding:1px 5px; border-radius:3px; margin-left:4px; }
[data-theme="dark"] .op-badge-inactif { background:#3a1010; color:#b07070; }

/* bouton texte danger */
.op-btn-danger-text { color: #dc2626; }
[data-theme="dark"] .op-btn-danger-text { color: #b07070; }

/* flash ok/warn (JS dynamique) */
.op-flash-ok   { background:#EAF3DE; color:#3B6D11; border:1px solid #C0DD97; }
.op-flash-warn { background:#FAEEDA; color:#854F0B; border:1px solid #FAC775; }
[data-theme="dark"] .op-flash-ok   { background:#0f2a1e; color:#7abf9e; border-color:#14532d; }
[data-theme="dark"] .op-flash-warn { background:#3a2a10; color:#c49a3c; border-color:#78450a; }

/* ── Planning detail — blocs dispo (MAR/CPA/IADE) ───────────────────────── */
.dispo-mar  { background: #f0f7ff; }
.dispo-cpa    { background: #faf5ff; border-color: #ede9fe !important; }
.dispo-compta { background: #fff7ed; border-color: #fed7aa !important; }
.dispo-iade   { background: #f0fdf4; border-color: #d1fae5 !important; }
.dispo-title-cpa    { color: #6d28d9; }
.dispo-title-compta { color: #c2410c; }
.dispo-title-iade   { color: #065f46; }
[data-theme="dark"] .dispo-mar  { background: #181e2a !important; border-color: #252d40 !important; }
[data-theme="dark"] .dispo-cpa    { background: #1a1828 !important; border-color: #2a2445 !important; }
[data-theme="dark"] .dispo-compta { background: #201a14 !important; border-color: #352a1e !important; }
[data-theme="dark"] .dispo-iade   { background: #161e1a !important; border-color: #202e24 !important; }
[data-theme="dark"] .dispo-title { color: var(--ink-muted); }
[data-theme="dark"] .dispo-title-cpa    { color: #8b7cc8; }
[data-theme="dark"] .dispo-title-compta { color: #c49060; }
[data-theme="dark"] .dispo-title-iade   { color: #6aaa88; }

/* bouton marquer-réalisé */
.op-btn-realise { border-color: #6366f1 !important; color: #4338ca !important; }
[data-theme="dark"] .op-btn-realise { border-color: #818cf8 !important; color: #a5b4fc !important; }

/* btnSave ajustement */
.op-btn-adj-ok   { background: #16a34a !important; color: #fff !important; border-color: #16a34a !important; }
.op-btn-adj-warn { background: #d97706 !important; color: #fff !important; border-color: #d97706 !important; }
[data-theme="dark"] .op-btn-adj-ok   { background: #14532d !important; color: #7abf9e !important; border-color: #166534 !important; }
[data-theme="dark"] .op-btn-adj-warn { background: #451a03 !important; color: #c49a3c !important; border-color: #78350f !important; }

/* adjFeedback */
.op-feedback-ok  { background: #f0fdf4; border-color: #86efac; color: #166534; }
.op-feedback-err { background: #fef2f2; border-color: #b07070; color: #991b1b; }
[data-theme="dark"] .op-feedback-ok  { background: #0f2a1e; border-color: #14532d; color: #7abf9e; }
[data-theme="dark"] .op-feedback-err { background: #2a1010; border-color: #7f1d1d; color: #b07070; }

/* ctrl-badge (onglet Contrôles) */
.op-ctrl-badge-hard { background: #fee2e2; color: #991b1b; }
.op-ctrl-badge-soft { background: #fef9c3; color: #92400e; }
.op-ctrl-badge-ok   { background: #dcfce7; color: #15803d; }
[data-theme="dark"] .op-ctrl-badge-hard { background: #3a1010; color: #b07070; }
[data-theme="dark"] .op-ctrl-badge-soft { background: #3a2a00; color: #c49a3c; }
[data-theme="dark"] .op-ctrl-badge-ok   { background: #0f2a1e; color: #7abf9e; }

/* bandeau info bleu */
.op-info-blue { padding: 10px 14px; background: #dbeafe; border: 1px solid #7aabcc; border-radius: 8px; color: #1e40af; }
[data-theme="dark"] .op-info-blue { background: #1a2840; border-color: #1e3a5f; color: #7aabcc; }

/* légende diff liseré rouge (planning_detail) */
.op-legende-diff-rouge { display:inline-block; width:14px; height:14px; border-radius:3px; border:2px solid var(--error-text,#ef4444); vertical-align:-2px; }
