:root {
  --brand-blue: #0069b4;
  --brand-blue-dark: #004b82;
  --brand-yellow: #f3d600;
  --brand-sky: #8bc8e8;
  --brand-green: #76b947;
  --brand-green-soft: #eef7e9;
  --primary: var(--brand-blue);
  --primary-dark: var(--brand-blue-dark);
  --surface: #ffffff;
  --background: #f4f8f1;
  --border: #cfdee6;
  --text: #243746;
  --muted: #637786;
  --success: #4d8f38;
  --danger: #c62828;
  --info: var(--brand-blue);
  --radius: 14px;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--background); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, rgba(139,200,232,.34), transparent 38%), radial-gradient(circle at bottom right, rgba(243,214,0,.18), transparent 32%), linear-gradient(135deg,#ffffff,var(--brand-green-soft)); }
.login-card { width: min(440px,100%); padding: 34px; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 24px 60px rgba(15,23,42,.14); }
.login-card h1 { margin: 12px 0 4px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--brand-yellow); color: var(--brand-blue-dark); border: 2px solid var(--brand-blue); font-weight: 900; letter-spacing: .08em; }
.brand-mark.small { width: 44px; height: 44px; border-radius: 12px; font-size: .78rem; flex: 0 0 auto; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { font-weight: 700; font-size: .9rem; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,200,232,.32); }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: #fdecec; color: var(--danger); border: 1px solid #f5c2c2; }
.btn { border: 0; border-radius: 10px; padding: 10px 15px; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border: 0; border-bottom: 3px solid var(--brand-yellow); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary { background: #e8edf2; color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.app-header { min-height: 74px; position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.header-brand, .user-summary { display: flex; align-items: center; gap: 12px; }
.header-brand h1 { margin: 0; font-size: 1.08rem; color: var(--primary); }
.header-brand small, .user-summary small { display: block; margin-top: 2px; color: var(--muted); }
.user-summary { text-align: right; }
.app-nav { display: flex; gap: 6px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; position: sticky; top: 74px; z-index: 30; }
.nav-link { color: var(--muted); padding: 10px 14px; border-radius: 10px; font-weight: 750; white-space: nowrap; text-decoration: none; }
.nav-link.active { color: #fff; background: var(--primary); box-shadow: inset 0 -3px 0 var(--brand-yellow); }
.app-main { padding: 24px; max-width: 1600px; margin: 0 auto; }
.module-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.module-header h2 { margin: 0 0 6px; color: var(--primary); }
.module-header p { margin: 0; color: var(--muted); }
.module-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stats-grid { display: grid; grid-template-columns: repeat(5,minmax(150px,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 5px 16px rgba(15,23,42,.04); }
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--brand-blue), var(--brand-yellow)); }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 700; min-height: 34px; }
.stat-value { margin-top: 8px; font-size: 1.35rem; font-weight: 850; color: var(--primary); overflow-wrap: anywhere; }
.panel { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(15,23,42,.04); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 260px; }
.toolbar input, .toolbar select, .filters input, .filters select { border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px; background: #fff; }
.filters { display: grid; grid-template-columns: repeat(4,minmax(160px,1fr)); gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); background: #fafcfb; }
.filter-item { display: grid; gap: 5px; }
.filter-item label { font-size: .78rem; color: var(--muted); font-weight: 700; }
.table-wrap { overflow: auto; max-height: 62vh; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 900px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8eeeb; text-align: left; vertical-align: top; font-size: .88rem; }
th { position: sticky; top: 0; z-index: 3; background: #edf1f5; color: var(--primary-dark); font-size: .8rem; white-space: nowrap; }
th.sortable { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.actions-cell { white-space: nowrap; }
.small-action { border: 1px solid var(--border); background: #fff; padding: 6px 8px; border-radius: 7px; font-size: .78rem; }
.status-empty { text-align: center; padding: 40px !important; color: var(--muted); }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 13px 14px; }
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button { min-width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 8px; }
.pagination button.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.pagination button:disabled { opacity: .45; cursor: default; }
.muted { color: var(--muted); }
.loading-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.75); z-index: 20; border-radius: inherit; }
.spinner { width: 34px; height: 34px; border: 4px solid #dbe2e8; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; width: min(380px,calc(100vw - 36px)); }
.toast { padding: 13px 15px; border-radius: 11px; color: #fff; box-shadow: var(--shadow); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(15,23,42,.55); }
.modal { width: min(760px,100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.modal.modal-lg { width: min(1040px,100%); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); border-bottom: 0; justify-content: flex-end; }
.modal-header h3 { margin: 0; color: var(--primary); }
.modal-body { padding: 18px; }
.modal-close { width: 38px; height: 38px; border: 1px solid var(--border); background: #fff; border-radius: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1/-1; }
.summary-box { border: 1px solid var(--border); border-radius: 12px; padding: 13px; background: #f8fafc; }
.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.summary-item span { display: block; color: var(--muted); font-size: .76rem; }
.summary-item strong { display: block; margin-top: 3px; overflow-wrap: anywhere; }
.search-results { border: 1px solid var(--border); border-radius: 10px; max-height: 230px; overflow: auto; background: #fff; }
.search-result { width: 100%; border: 0; border-bottom: 1px solid #edf1ef; background: #fff; padding: 10px; text-align: left; }
.search-result:hover { background: #f0f4f7; }
.form-error { color: var(--danger); min-height: 1.2em; margin-top: 8px; }
@media (max-width: 1050px) { .stats-grid { grid-template-columns: repeat(3,minmax(150px,1fr)); } .filters { grid-template-columns: repeat(2,minmax(150px,1fr)); } }
@media (max-width: 720px) { .app-header { position: static; padding: 10px 14px; } .header-brand small, .user-summary > div { display: none; } .app-nav { position: static; padding: 8px 12px; } .app-main { padding: 14px; } .module-header { flex-direction: column; } .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .filters, .form-grid, .summary-grid { grid-template-columns: 1fr; } .form-grid .full { grid-column: auto; } }


/* Identité visuelle FID */
.brand-logo { display: block; object-fit: contain; }
.login-logo { width: min(300px, 100%); height: auto; max-height: 76px; object-position: left center; }
.header-logo { width: 180px; max-width: 28vw; height: 50px; object-position: left center; }
.app-header { border-top: 4px solid var(--brand-yellow); }
.app-nav { box-shadow: inset 0 -1px 0 rgba(0,105,180,.08); }
.module-header { border-left: 5px solid var(--brand-yellow); padding-left: 14px; }
.panel { border-top: 3px solid var(--brand-sky); }
@media (max-width: 720px) {
  .header-logo { width: 116px; max-width: 36vw; height: 42px; }
}

/* ======================================================================
   ÉVOLUTION VISUELLE FID — BLEU / JAUNE / VERT
   ====================================================================== */
:root {
  --brand-blue: #0057a8;
  --brand-blue-dark: #003e78;
  --brand-blue-soft: #eaf4fc;
  --brand-yellow: #f6d500;
  --brand-yellow-soft: #fff9cf;
  --brand-green: #2c9b4b;
  --brand-green-dark: #187436;
  --brand-green-soft: #eaf7ee;
  --brand-sky: #45c7e8;
  --background: #f2f7f4;
  --surface: #ffffff;
  --border: #cbdde6;
  --text: #19384f;
  --muted: #647b8c;
  --primary: var(--brand-blue);
  --primary-dark: var(--brand-blue-dark);
  --success: var(--brand-green);
  --info: var(--brand-blue);
  --radius: 16px;
  --shadow: 0 14px 38px rgba(0, 62, 120, .10);
  --shadow-soft: 0 7px 22px rgba(0, 62, 120, .07);
}

html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(circle at 8% 4%, rgba(69, 199, 232, .13), transparent 25rem),
    radial-gradient(circle at 92% 12%, rgba(246, 213, 0, .12), transparent 24rem),
    linear-gradient(180deg, #f9fcfb 0, var(--background) 420px, #f4f8f6 100%);
}

::selection { background: rgba(246, 213, 0, .55); color: var(--brand-blue-dark); }
:focus-visible { outline: 3px solid rgba(246, 213, 0, .72); outline-offset: 2px; }

/* Connexion */
.login-screen {
  background:
    linear-gradient(115deg, rgba(0, 87, 168, .96), rgba(0, 62, 120, .90)),
    radial-gradient(circle at 20% 20%, var(--brand-sky), transparent 35%),
    radial-gradient(circle at 80% 80%, var(--brand-green), transparent 32%);
}
.login-screen::before,
.login-screen::after {
  content: '';
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
}
.login-screen::before { width: 290px; height: 290px; left: -80px; bottom: -90px; background: rgba(246, 213, 0, .22); }
.login-screen::after { width: 210px; height: 210px; right: -55px; top: -50px; border: 26px solid rgba(44, 155, 75, .22); }
.login-card {
  width: min(520px, 100%);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  box-shadow: 0 32px 90px rgba(0, 25, 55, .34);
}
.login-brand-panel {
  padding: 25px 28px 20px;
  background: linear-gradient(135deg, #fff 0%, #f8fcff 63%, var(--brand-yellow-soft) 100%);
  border-bottom: 5px solid var(--brand-yellow);
}
.login-brand-panel h1 { margin: 18px 0 3px; color: var(--brand-blue-dark); font-size: 1.55rem; }
.login-brand-panel p { margin: 0; color: var(--muted); }
.login-form-heading { padding: 22px 28px 4px; }
.login-form-heading h2 { margin: 0 0 4px; color: var(--brand-blue-dark); }
.login-form-heading p { margin: 0; color: var(--muted); }
.login-card form { padding: 15px 28px 30px; }
.login-card .alert { margin: 12px 28px 0; }
.login-logo { width: min(430px, 100%); max-height: 105px; }

/* En-tête */
.app-header {
  min-height: 86px;
  padding: 9px 28px;
  border-top: 5px solid var(--brand-yellow);
  border-bottom: 1px solid rgba(0, 87, 168, .17);
  box-shadow: 0 5px 24px rgba(0, 62, 120, .07);
}
.app-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-blue) 0 42%, var(--brand-yellow) 42% 70%, var(--brand-green) 70% 100%);
  opacity: .75;
}
.header-logo { width: 235px; max-width: 31vw; height: 58px; }
.header-title { padding-left: 2px; }
.header-title h1 { font-size: 1.12rem; letter-spacing: .01em; }
.user-summary {
  padding: 8px 10px 8px 15px;
  border: 1px solid rgba(0, 87, 168, .13);
  border-radius: 14px;
  background: linear-gradient(135deg, #fff, #f6fbff);
}
.user-summary strong { color: var(--brand-blue-dark); }

/* Navigation */
.app-nav {
  top: 86px;
  gap: 8px;
  padding: 11px 28px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid rgba(0, 87, 168, .14);
  box-shadow: 0 6px 16px rgba(0, 62, 120, .05);
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid transparent;
  transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-link:hover {
  color: var(--brand-blue-dark);
  background: var(--brand-blue-soft);
  border-color: rgba(0, 87, 168, .14);
  transform: translateY(-1px);
}
.nav-link.active {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  border-color: var(--brand-blue-dark);
  box-shadow: inset 0 -4px 0 var(--brand-yellow), 0 6px 16px rgba(0, 87, 168, .18);
}
.nav-icon {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(0, 87, 168, .08);
  color: var(--brand-green-dark);
  font-size: .9rem;
  font-weight: 900;
}
.nav-link.active .nav-icon { background: var(--brand-yellow); color: var(--brand-blue-dark); }

/* Contenu */
.app-main { max-width: 1680px; padding: 28px; }
.module-header {
  position: relative;
  padding: 19px 20px 19px 24px;
  border: 1px solid rgba(0, 87, 168, .13);
  border-left: 0;
  border-radius: var(--radius);
  background: linear-gradient(110deg, #fff 0%, #f6fbff 67%, var(--brand-green-soft) 100%);
  box-shadow: var(--shadow-soft);
}
.module-header::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  border-radius: 16px 0 0 16px;
  background: linear-gradient(180deg, var(--brand-blue) 0 47%, var(--brand-yellow) 47% 70%, var(--brand-green) 70% 100%);
}
.module-header h2 { color: var(--brand-blue-dark); font-size: 1.48rem; }
.module-header p { max-width: 820px; }

/* Boutons */
.btn { min-height: 40px; border-radius: 11px; transition: transform .14s ease, box-shadow .14s ease, background .14s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  border: 1px solid var(--brand-blue-dark);
  border-bottom: 4px solid var(--brand-yellow);
  box-shadow: 0 7px 16px rgba(0, 87, 168, .20);
}
.btn-primary:hover { background: linear-gradient(135deg, #0868bd, var(--brand-blue)); }
.btn-outline { border-color: rgba(0, 87, 168, .25); color: var(--brand-blue-dark); }
.btn-outline:hover { background: var(--brand-blue-soft); border-color: var(--brand-blue); }
.btn-secondary { background: var(--brand-green-soft); color: var(--brand-green-dark); border: 1px solid rgba(44, 155, 75, .20); }
.small-action:hover { color: #fff; background: var(--brand-blue); border-color: var(--brand-blue); }

/* Statistiques */
.stats-grid { gap: 16px; }
.stat-card {
  min-height: 112px;
  border-color: rgba(0, 87, 168, .13);
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before { width: 6px; background: var(--brand-blue); }
.stat-card:nth-child(3n + 2)::before { background: var(--brand-yellow); }
.stat-card:nth-child(3n)::before { background: var(--brand-green); }
.stat-card:nth-child(3n + 2) .stat-value { color: #8a7300; }
.stat-card:nth-child(3n) .stat-value { color: var(--brand-green-dark); }
.stat-value { font-size: 1.48rem; }

/* Panneaux, outils et tableaux */
.panel {
  overflow: visible;
  border: 1px solid rgba(0, 87, 168, .13);
  border-top: 4px solid var(--brand-sky);
  box-shadow: var(--shadow-soft);
}
.toolbar {
  padding: 16px;
  background: linear-gradient(90deg, #fff, #f7fbfe);
}
.filters { background: linear-gradient(90deg, #f8fbfd, #f5faf5); }
.toolbar input,
.toolbar select,
.filters input,
.filters select,
.field input,
.field select,
.field textarea {
  min-height: 42px;
  border-color: #bfd5e1;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.toolbar input:focus,
.toolbar select:focus,
.filters input:focus,
.filters select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(69, 199, 232, .22);
  background: #fff;
}
.table-wrap { border-radius: 0 0 12px 12px; }
th {
  background: linear-gradient(180deg, #edf7fc, #e4f0f6);
  color: var(--brand-blue-dark);
  border-bottom: 2px solid rgba(0, 87, 168, .20);
}
tbody tr:nth-child(even) { background: rgba(234, 247, 238, .26); }
tbody tr:hover { background: var(--brand-yellow-soft); }
.table-footer { background: #fbfdfc; border-radius: 0 0 var(--radius) var(--radius); }
.pagination button.active { box-shadow: inset 0 -3px 0 var(--brand-yellow); }

/* Formulaires, résumés, combobox */
.summary-box {
  border: 1px solid rgba(44, 155, 75, .22);
  border-left: 5px solid var(--brand-green);
  background: linear-gradient(135deg, #fff, var(--brand-green-soft));
  box-shadow: 0 5px 16px rgba(44, 155, 75, .06);
}
.summary-item strong { color: var(--brand-blue-dark); }
.search-results {
  z-index: 25;
  border-color: rgba(0, 87, 168, .25);
  box-shadow: 0 16px 34px rgba(0, 62, 120, .16);
}
.search-result:hover,
.search-result.active,
.search-result[aria-selected="true"] { background: var(--brand-blue-soft); color: var(--brand-blue-dark); }
.field-help { color: var(--muted); line-height: 1.45; }

/* Modales */
.modal-backdrop { background: rgba(0, 35, 68, .64); backdrop-filter: blur(4px); }
.modal { border: 1px solid rgba(69, 199, 232, .35); box-shadow: 0 32px 90px rgba(0, 25, 55, .35); }
.modal-header {
  position: sticky;
  top: 0;
  z-index: 8;
  background: linear-gradient(110deg, #fff 0%, var(--brand-blue-soft) 72%, var(--brand-yellow-soft) 100%);
  border-bottom: 3px solid var(--brand-yellow);
}
.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 8;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
}
.modal-close:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* Notifications */
.toast { border-left: 5px solid rgba(255,255,255,.65); }
.toast.success { background: linear-gradient(135deg, var(--brand-green), var(--brand-green-dark)); }
.toast.info { background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark)); }

/* Scrollbars discrètes */
* { scrollbar-width: thin; scrollbar-color: #8eb8cb #eef4f6; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #eef4f6; }
*::-webkit-scrollbar-thumb { background: #8eb8cb; border: 2px solid #eef4f6; border-radius: 999px; }

@media (max-width: 900px) {
  .app-header { min-height: 76px; padding: 8px 16px; }
  .app-nav { top: 76px; padding: 9px 16px; }
  .header-logo { width: 170px; height: 48px; max-width: 38vw; }
  .header-title small { display: none; }
  .user-summary { border: 0; padding: 0; background: transparent; }
}

@media (max-width: 720px) {
  .app-main { padding: 14px; }
  .app-header { position: static; }
  .app-nav { position: static; }
  .header-logo { width: 135px; height: 43px; max-width: 44vw; }
  .header-title { display: none; }
  .user-summary > div { display: none; }
  .module-header { padding: 16px 16px 16px 21px; }
  .module-actions { width: 100%; justify-content: flex-start; }
  .module-actions .btn { flex: 1 1 150px; }
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 100px; padding: 14px; }
  .login-card { border-radius: 19px; }
  .login-brand-panel, .login-form-heading, .login-card form { padding-left: 20px; padding-right: 20px; }
}
