/* =====================================================================
   EasyCertif — Thème « ERP Material Design »
   ---------------------------------------------------------------------
   Chargé EN DERNIER (après site, erp-chrome, theme-dark, elevation) : il
   réaligne toute l'application sur une grammaire Material sobre et
   administrative — barre d'application pleine, tiroir de navigation
   latéral, surfaces à angles de 4 px, élévations Material, Roboto,
   boutons en capitales, champs « outlined », tableaux de données denses.

   Les couleurs passent par des jetons --md-* redéfinis en sombre : une
   seule règle sert les deux thèmes. Les règles qui doivent primer sur
   theme-dark.css sont préfixées par :root (même spécificité que
   [data-theme="dark"], et ce fichier vient après).
   ===================================================================== */

:root {
  --et-font: "Roboto", "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --md-mono: "Roboto Mono", ui-monospace, Consolas, monospace;

  --md-primary: #1565c0;
  --md-primary-dark: #0d47a1;
  --md-primary-rgb: 21, 101, 192;
  --md-on-primary: #fff;
  --md-accent: #e8792a;
  --md-success: #2e7d32;
  --md-error: #c62828;

  --md-appbar: #0d47a1;
  --md-bg: #f3f4f6;
  --md-surface: #fff;
  --md-surface-2: #f7f8fa;
  --md-hover: rgba(0, 0, 0, 0.04);
  --md-selected: rgba(var(--md-primary-rgb), 0.1);
  --md-divider: rgba(0, 0, 0, 0.12);
  --md-outline: rgba(0, 0, 0, 0.23);
  --md-text: rgba(0, 0, 0, 0.87);
  --md-text-2: rgba(0, 0, 0, 0.6);
  --md-text-3: rgba(0, 0, 0, 0.42);
  --md-link: var(--md-primary);

  --md-e1: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
  --md-e2: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
  --md-e4: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
  --md-e8: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
  --md-e16: 0 8px 10px -5px rgba(0, 0, 0, 0.2), 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12);
  --md-e24: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12);

  --md-radius: 4px;
  --md-ease: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --md-appbar-h: 56px;
  --md-drawer-w: 256px;
  --md-drawer-rail: 64px;
}

[data-theme="dark"] {
  --md-primary: #64a5f0;
  --md-primary-dark: #4a8fe0;
  --md-primary-rgb: 100, 165, 240;
  --md-on-primary: #0b1a33;
  --md-success: #66bb6a;
  --md-error: #ef5350;

  --md-appbar: #162238;
  --md-bg: #10151f;
  --md-surface: #182030;
  --md-surface-2: #1d2638;
  --md-hover: rgba(255, 255, 255, 0.05);
  --md-selected: rgba(var(--md-primary-rgb), 0.16);
  --md-divider: rgba(255, 255, 255, 0.12);
  --md-outline: rgba(255, 255, 255, 0.24);
  --md-text: rgba(255, 255, 255, 0.9);
  --md-text-2: rgba(255, 255, 255, 0.64);
  --md-text-3: rgba(255, 255, 255, 0.44);

  --md-e1: 0 1px 3px rgba(0, 0, 0, 0.5);
  --md-e2: 0 2px 4px rgba(0, 0, 0, 0.5);
  --md-e4: 0 3px 8px rgba(0, 0, 0, 0.55);
  --md-e8: 0 6px 16px rgba(0, 0, 0, 0.6);
  --md-e16: 0 10px 28px rgba(0, 0, 0, 0.65);
  --md-e24: 0 16px 44px rgba(0, 0, 0, 0.7);
}

/* ---- Base ---- */

:root body {
  font-family: var(--et-font);
  background: var(--md-bg);
  color: var(--md-text);
  letter-spacing: 0.01em;
  margin-bottom: 0;
}

:root a { color: var(--md-link); }

h1, h2, h3, h4, h5, h6 { font-weight: 500; letter-spacing: 0; }

/* =====================================================================
   Barre d'application
   ===================================================================== */

:root .app-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--md-appbar-h);
  flex: 0 0 var(--md-appbar-h);
  padding: 0 12px 0 8px;
  gap: 10px;
  background: var(--md-appbar);
  color: #fff;
  box-shadow: var(--md-e4);
}

.md-icon-btn,
:root .app-header .btn-theme-toggle {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background var(--md-ease);
}

.md-icon-btn:hover,
:root .app-header .btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.md-icon-btn:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
}

.app-header .app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

/* Logo panoramique (≈ 3,7:1) : la pastille s'adapte à sa largeur. */
:root .app-header .brand-logo-chip {
  height: 40px;
  padding: 4px 10px;
  border-radius: var(--md-radius);
  box-shadow: none;
  display: flex;
  align-items: center;
}

:root .app-header .brand-logo-chip img { max-width: 200px; }

@media (max-width: 767px) {
  :root .app-header .brand-logo-chip { height: 34px; }
  :root .app-header .brand-logo-chip img { max-width: 120px; }
}

:root .app-header .brand-badge {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: var(--md-radius);
  box-shadow: none;
}

:root .app-header .brand-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #fff;
}

/* Chips du bandeau : société et pays, au gabarit Material (32 px, pilule). */
:root .app-header .header-chip {
  height: 32px;
  padding: 0 12px;
  gap: 8px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  box-shadow: none;
  transition: background var(--md-ease);
}

:root .app-header .header-chip:hover,
:root .app-header .header-chip.active {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.app-header .header-chip-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root .app-header .header-sep {
  height: 24px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.2);
}

.app-header .app-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

:root .app-header .user-avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  background: var(--md-accent);
  color: #fff;
  font-weight: 500;
  font-size: 13px;
}

:root .app-header .user-name { font-size: 13.5px; font-weight: 500; }
:root .app-header .user-office { font-size: 11.5px; color: rgba(255, 255, 255, 0.7); }

/* =====================================================================
   Corps : tiroir de navigation + contenu
   ===================================================================== */

:root .app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-drawer {
  position: sticky;
  top: var(--md-appbar-h);
  height: calc(100vh - var(--md-appbar-h));
  width: var(--md-drawer-w);
  flex: 0 0 var(--md-drawer-w);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--md-surface);
  border-right: 1px solid var(--md-divider);
  padding: 8px 0 12px;
  display: flex;
  flex-direction: column;
  z-index: 1020;
  transition: width var(--md-ease), flex-basis var(--md-ease), transform var(--md-ease);
}

.drawer-section {
  padding: 14px 24px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--md-text-3);
  white-space: nowrap;
}

.drawer-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 44px;
  margin: 1px 8px;
  padding: 0 12px 0 14px;
  border-radius: var(--md-radius);
  color: var(--md-text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--md-ease), color var(--md-ease);
}

:root .drawer-item { color: var(--md-text-2); text-decoration: none; }

.drawer-item svg { flex: 0 0 20px; }

.drawer-item .drawer-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--md-text);
}

:root .drawer-item:hover {
  background: var(--md-hover);
  color: var(--md-text);
}

:root .drawer-item.active {
  background: var(--md-selected);
  color: var(--md-primary);
}

:root .drawer-item.active .drawer-label { color: var(--md-primary); font-weight: 700; }

/* Indicateur d'élément actif : barre verticale à gauche, lecture « administrative ». */
.drawer-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--md-primary);
}

.drawer-item:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: -2px;
}

.drawer-item .nav-badge {
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--md-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.drawer-divider {
  height: 1px;
  margin: 8px 0;
  background: var(--md-divider);
}

.drawer-foot {
  margin-top: auto;
  padding: 16px 24px 4px;
  font-size: 11.5px;
  color: var(--md-text-3);
  white-space: nowrap;
}

.drawer-scrim { display: none; }

/* Tiroir replié en rail d'icônes (grand écran). */
.drawer-collapsed .app-drawer {
  width: var(--md-drawer-rail);
  flex-basis: var(--md-drawer-rail);
}

.drawer-collapsed .drawer-item {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.drawer-collapsed .drawer-label,
.drawer-collapsed .drawer-section,
.drawer-collapsed .drawer-foot { display: none; }

.drawer-collapsed .drawer-item .nav-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9.5px;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

:root .app-main {
  flex: 1;
  padding: 24px 28px 28px;
}

/* Spécificité renforcée : le CSS isolé du layout (.footer[b-…]) le positionnait
   en absolu sur toute la largeur de la page, tiroir compris. */
:root .site-footer.footer,
:root .site-footer {
  position: static;
  width: auto;
  line-height: normal;
  white-space: normal;
  padding: 14px 0;
  font-size: 12px;
  background: transparent;
  border-top: 1px solid var(--md-divider);
  color: var(--md-text-3);
}

:root .site-footer .container-fluid { padding-left: 28px !important; padding-right: 28px !important; }
:root .site-footer a { color: var(--md-text-2); }

/* Petit écran : le tiroir passe en surimpression (modal drawer). */
@media (max-width: 1023px) {
  .app-drawer {
    position: fixed;
    left: 0;
    top: var(--md-appbar-h);
    bottom: 0;
    height: auto;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .drawer-collapsed .app-drawer { width: var(--md-drawer-w); flex-basis: var(--md-drawer-w); }
  .drawer-collapsed .drawer-item { justify-content: flex-start; padding: 0 12px 0 14px; gap: 20px; }
  .drawer-collapsed .drawer-label { display: block; }
  .drawer-collapsed .drawer-section, .drawer-collapsed .drawer-foot { display: block; }
  .drawer-collapsed .drawer-item .nav-badge { position: static; }

  .drawer-open .app-drawer {
    transform: translateX(0);
    box-shadow: var(--md-e16);
  }

  .drawer-scrim {
    display: block;
    position: fixed;
    inset: var(--md-appbar-h) 0 0 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 1010;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--md-ease);
  }

  .drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }

  :root .app-main { padding: 16px; }
  .app-header .app-user-text { display: none; }
}

@media (max-width: 767px) {
  .app-header .header-chip-text,
  .app-header .header-sep { display: none; }
  :root .app-header .brand-title { display: none; }
}

/* =====================================================================
   En-têtes de page
   ===================================================================== */

:root .page-header,
:root .dashboard-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--md-divider);
}

:root .page-header .title,
:root .dashboard-header .title {
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--md-text);
}

:root .page-header .subtitle,
:root .dashboard-header .subtitle {
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--md-text-2);
}

/* =====================================================================
   Surfaces : cartes, panneaux, tuiles KPI
   ===================================================================== */

:root .erp-card,
:root .dash-panel,
:root .sources-card,
:root .kpi-card {
  background: var(--md-surface);
  border: none;
  border-radius: var(--md-radius);
  box-shadow: var(--md-e1);
  transform: none;
}

:root .erp-card:hover,
:root .dash-panel:hover,
:root .sources-card:hover {
  box-shadow: var(--md-e1);
  transform: none;
}

:root .kpi-card:hover {
  box-shadow: var(--md-e4);
  transform: none;
}

:root .dash-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-divider);
  background: var(--md-surface);
}

:root .dash-panel-title,
:root .sources-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--md-text);
}

:root .dash-panel-foot {
  border-top: 1px solid var(--md-divider);
  color: var(--md-primary);
  font-weight: 500;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

:root .dash-panel-foot:hover { background: var(--md-hover); }

/* ---- KPI ---- */

:root .kpi-grid { gap: 16px; margin-bottom: 20px; }

:root .kpi-card::before { width: 4px; }

:root .kpi-ico {
  border-radius: var(--md-radius);
}

:root .kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: normal;
  color: var(--md-text-2);
}

:root .kpi-value {
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--md-text);
}

:root .kpi-value.kpi-value-text { font-size: 18px; font-weight: 500; }
:root .kpi-unit { font-weight: 400; color: var(--md-text-2); }
:root .kpi-amount { font-weight: 500; color: var(--md-text); }
:root .kpi-sub { color: var(--md-text-2); }

:root .kpi-chip {
  border-radius: var(--md-radius);
  font-weight: 500;
  letter-spacing: 0.06em;
}

/* =====================================================================
   Tableaux de données
   ===================================================================== */

:root .erp-table th,
:root .dash-table th {
  height: 44px;
  padding: 0 16px;
  vertical-align: middle;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-text-2);
  background: var(--md-surface-2);
  border-bottom: 1px solid var(--md-divider);
}

:root .erp-table td,
:root .dash-table td {
  height: 48px;
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--md-text);
  border-bottom: 1px solid var(--md-divider);
  background: transparent;
}

:root .erp-table:not(.erp-table-plain) tr:hover td,
:root .dash-table tr:hover td {
  background: var(--md-hover);
}

/* Références et montants : chiffres à chasse fixe, colonnes alignées. */
:root .erp-table td.num,
:root .dash-table td.num {
  font-family: var(--md-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--md-text);
}

:root .erp-table td.montant,
:root .dash-table td.text-end,
:root .erp-table td.text-end {
  font-weight: 500;
  color: var(--md-text);
  font-variant-numeric: tabular-nums;
}

/* Tableaux Bootstrap éventuels : même rendu que les tableaux ERP. */
:root .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--md-text);
  --bs-table-border-color: var(--md-divider);
  --bs-table-hover-bg: var(--md-hover);
  font-size: 13.5px;
}

:root .table > thead th {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-text-2);
  background: var(--md-surface-2);
}

/* ---- Libellés de statut ---- */

.badge-pill {
  border-radius: var(--md-radius);
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

:root .empty-row { color: var(--md-text-2); }

:root .pager {
  padding: 8px 16px;
  border-top: 1px solid var(--md-divider);
  color: var(--md-text-2);
  font-size: 12.5px;
}

/* =====================================================================
   Boutons Material
   ===================================================================== */

:root .btn,
:root .btn-incorporer,
:root .btn-soft,
:root .pager .btn-page {
  --btn-h: 36px;
  min-height: var(--btn-h);
  border-radius: var(--md-radius);
  font-family: var(--et-font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: none;
  filter: none;
}

:root .btn-sm,
:root .btn-group-sm > .btn,
:root .pager .btn-page {
  --btn-h: 32px;
  font-size: 12px;
  padding: 4px 12px;
}

:root .btn-link { text-transform: none; letter-spacing: 0.01em; }

/* Contenu (contained) — action principale. */
:root .btn-incorporer,
:root .btn-primary,
:root .erp-card .btn-primary,
:root .toolbar .btn-primary {
  background: var(--md-primary);
  border: none;
  color: var(--md-on-primary);
  box-shadow: var(--md-e2);
}

:root .btn-incorporer:hover,
:root .btn-primary:hover,
:root .btn-primary:focus {
  background: var(--md-primary-dark);
  color: var(--md-on-primary);
  box-shadow: var(--md-e4);
  transform: none;
  filter: none;
}

:root .btn-incorporer:active,
:root .btn-primary:active {
  box-shadow: var(--md-e8);
  transform: none;
}

:root .btn-incorporer { --btn-h: 42px; }

/* Contouré (outlined) — actions secondaires. */
:root .btn-soft,
:root .pager .btn-page,
:root .btn-outline-secondary,
:root .btn-outline-primary {
  background: transparent;
  border: 1px solid var(--md-outline);
  color: var(--md-primary);
  box-shadow: none;
}

:root .btn-soft:hover,
:root .pager .btn-page:not(:disabled):not(.disabled):hover,
:root .btn-outline-secondary:hover,
:root .btn-outline-primary:hover {
  background: rgba(var(--md-primary-rgb), 0.06);
  border-color: var(--md-primary);
  color: var(--md-primary);
  box-shadow: none;
  transform: none;
}

:root .btn-outline-success {
  background: transparent;
  border: 1px solid var(--md-success);
  color: var(--md-success);
  box-shadow: none;
}

:root .btn-outline-success:hover:not(:disabled) {
  background: var(--md-success);
  border-color: var(--md-success);
  color: #fff;
  box-shadow: var(--md-e2);
}

:root .btn-success { background: var(--md-success); border-color: var(--md-success); box-shadow: var(--md-e2); }
:root .btn-danger { background: var(--md-error); border-color: var(--md-error); box-shadow: var(--md-e2); }

:root .btn:disabled,
:root .btn-incorporer:disabled,
:root .btn-soft:disabled {
  opacity: 0.38;
  box-shadow: none;
}

:root .btn:focus-visible,
:root .btn-incorporer:focus-visible,
:root .btn-soft:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--md-primary-rgb), 0.35);
}

/* Actions de ligne : boutons-icônes ronds. */
:root .btn-action-ok,
:root .btn-action-danger {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  transform: none;
}

:root .btn-action-ok { background: rgba(46, 125, 50, 0.1); color: var(--md-success); }
:root .btn-action-danger { background: rgba(198, 40, 40, 0.1); color: var(--md-error); }

:root .btn-action-ok:hover { background: var(--md-success); color: #fff; box-shadow: var(--md-e2); transform: none; }
:root .btn-action-danger:hover { background: var(--md-error); color: #fff; box-shadow: var(--md-e2); transform: none; }

/* Groupe de choix (périodes) : bouton-bascule segmenté Material. */
:root .preset-group {
  gap: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius);
  overflow: hidden;
}

:root .preset-group .preset-btn {
  border-radius: 0;
  padding: 0 14px;
  height: 34px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-text-2);
  background: transparent;
}

/* Les filtres peuvent être des liens (Import PDF) : même rendu que les boutons. */
:root a.preset-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

:root .preset-group .preset-btn + .preset-btn { border-left: 1px solid var(--md-divider); }
:root .preset-group .preset-btn:hover { background: var(--md-hover); }

:root .preset-group .preset-btn.active {
  background: var(--md-selected);
  color: var(--md-primary);
  font-weight: 500;
  box-shadow: none;
}

/* =====================================================================
   Champs de saisie « outlined »
   ===================================================================== */

:root .form-control,
:root .form-select {
  min-height: 40px;
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius);
  background-color: var(--md-surface);
  color: var(--md-text);
  font-size: 14px;
  box-shadow: none;
  transition: border-color var(--md-ease), box-shadow var(--md-ease);
}

:root .form-control-sm,
:root .form-select-sm { min-height: 32px; font-size: 13px; }

:root .form-control:hover:not(:focus):not(:disabled),
:root .form-select:hover:not(:focus):not(:disabled) { border-color: var(--md-text-2); }

:root .form-control:focus,
:root .form-select:focus {
  border-color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-primary);
  background-color: var(--md-surface);
  color: var(--md-text);
}

:root .form-control::placeholder { color: var(--md-text-3); }

:root .form-control:disabled,
:root .form-control[readonly] { background-color: var(--md-surface-2); }

:root .form-label,
:root label.form-label {
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--md-text-2);
}

:root .form-text { color: var(--md-text-3); font-size: 12px; }

:root .form-check-input {
  border-color: var(--md-outline);
  border-width: 2px;
}

:root .form-check-input:checked {
  background-color: var(--md-primary);
  border-color: var(--md-primary);
}

:root .form-check-input:focus { box-shadow: 0 0 0 4px rgba(var(--md-primary-rgb), 0.18); }

:root .input-group-text {
  border-color: var(--md-outline);
  background: var(--md-surface-2);
  color: var(--md-text-2);
}

:root .search-box {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius);
  background: var(--md-surface);
  transition: border-color var(--md-ease), box-shadow var(--md-ease);
}

:root .search-box:focus-within {
  border-color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-primary);
}

:root .search-box input { color: var(--md-text); font-size: 14px; }
:root .search-box svg { color: var(--md-text-2); }

:root .toolbar { gap: 12px; margin-bottom: 16px; }

:root .selection-banner {
  border: none;
  border-left: 4px solid var(--md-accent);
  border-radius: var(--md-radius);
  background: rgba(232, 121, 42, 0.1);
  color: var(--md-text);
}

/* =====================================================================
   Dialogues, alertes, onglets
   ===================================================================== */

:root .modal-content {
  border: none;
  border-radius: var(--md-radius);
  background: var(--md-surface);
  color: var(--md-text);
  box-shadow: var(--md-e24);
}

:root .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--md-divider);
}

:root .modal-title { font-size: 18px; font-weight: 500; color: var(--md-text); }
:root .modal-body { padding: 20px 24px; }

:root .modal-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--md-divider);
  gap: 8px;
}

:root .modal-backdrop.show { opacity: 0.4; }

:root .alert {
  border: none;
  border-left: 4px solid currentColor;
  border-radius: var(--md-radius);
  font-size: 13.5px;
  box-shadow: var(--md-e1);
}

:root .card {
  border: none;
  border-radius: var(--md-radius);
  background: var(--md-surface);
  box-shadow: var(--md-e1);
}

:root .card-header {
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-divider);
  font-weight: 500;
}

:root .nav-tabs {
  border-bottom: 1px solid var(--md-divider);
  gap: 0;
}

:root .nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-text-2);
  background: transparent;
}

:root .nav-tabs .nav-link:hover { color: var(--md-text); background: var(--md-hover); }

:root .nav-tabs .nav-link.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
  background: transparent;
}

:root .dropdown-menu {
  border: none;
  border-radius: var(--md-radius);
  background: var(--md-surface);
  box-shadow: var(--md-e8);
  padding: 8px 0;
}

:root .dropdown-item { padding: 8px 16px; font-size: 14px; color: var(--md-text); }
:root .dropdown-item:hover { background: var(--md-hover); }

/* Notifications temps réel : « snackbar » Material. */
:root #rt-toasts .rt-toast {
  background: #2f3640;
  border: none;
  border-left: 4px solid #66bb6a;
  border-radius: var(--md-radius);
  box-shadow: var(--md-e8);
}

:root #rt-toasts .rt-toast-icon { background: rgba(102, 187, 106, 0.22); color: #81c784; }
:root #rt-toasts .rt-toast-title { color: #fff; font-weight: 500; }
:root #rt-toasts .rt-toast-text { color: rgba(255, 255, 255, 0.76); }
:root #rt-toasts .rt-toast-close { color: rgba(255, 255, 255, 0.7); }

/* =====================================================================
   Page de connexion
   ===================================================================== */

:root body.login-body {
  font-family: var(--et-font);
  background: var(--md-bg);
}

:root body.login-body::before { display: none; }

:root .login-wrapper {
  border: none;
  border-radius: var(--md-radius);
  box-shadow: var(--md-e8);
  background: var(--md-surface);
  overflow: hidden;
}

:root .login-brand {
  background: var(--md-appbar);
  border-radius: 0;
}

:root .login-brand::before { display: none; }

:root .login-logo-card,
:root .login-logo,
:root .login-points .ico,
:root .login-brand-badge {
  border-radius: var(--md-radius);
  box-shadow: none;
}

/* Logo panoramique : la plaque occupe toute la largeur du panneau de marque. */
:root .login-logo-card {
  width: 100%;
  padding: 14px 16px;
}

:root .login-logo-card img { max-width: none; }

:root .login-card { background: var(--md-surface); }

:root .login-card h2 {
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--md-text);
}

:root .login-card .login-subtitle { color: var(--md-text-2); }

:root .login-card .form-label {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--md-text-2);
}

:root .login-card .form-control {
  height: 44px;
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius);
  background: var(--md-surface);
  color: var(--md-text);
  box-shadow: none;
}

:root .login-card .form-control:focus {
  border-color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-primary);
  background: var(--md-surface);
}

:root .login-input:focus-within > .ico { color: var(--md-primary); }

:root .btn-login {
  height: 44px;
  border: none;
  border-radius: var(--md-radius);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--md-e2);
  transform: none;
}

:root .btn-login:hover {
  background: var(--md-primary-dark);
  box-shadow: var(--md-e4);
  transform: none;
  filter: none;
}

:root .btn-login-theme {
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  background: transparent;
  color: var(--md-text-2);
}

:root .btn-login-theme:hover { background: var(--md-hover); color: var(--md-text); }

:root .login-card .form-check-input:checked { background-color: var(--md-primary); border-color: var(--md-primary); }

:root .login-card .alert { box-shadow: none; }

/* ---- Impression ---- */
@media print {
  .app-drawer, .drawer-scrim, .app-header, .site-footer { display: none !important; }
  :root body { background: #fff; color: #000; }
  :root .erp-card, :root .dash-panel, :root .kpi-card, :root .card { box-shadow: none; border: 1px solid #ccc; }
}

/* =====================================================================
   Plateforme fiscale : fiches par pays
   ===================================================================== */

.pf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1199px) { .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) { .pf-grid { grid-template-columns: 1fr; } }

.pf-card { display: flex; flex-direction: column; }

:root .pf-card.pf-active { box-shadow: var(--md-e4), inset 0 3px 0 var(--md-accent); }

.pf-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--md-divider);
}

.pf-code {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--md-radius);
  background: var(--md-appbar);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.pf-ident { flex: 1; min-width: 0; }
.pf-pays { font-size: 16px; font-weight: 500; color: var(--md-text); }
.pf-authority { font-size: 12.5px; color: var(--md-text-2); }

.pf-flag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--md-radius);
  background: var(--md-accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pf-fields {
  margin: 0;
  padding: 14px 16px 4px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: center;
  flex: 1;
}

.pf-fields dt {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-text-2);
}

.pf-fields dd { margin: 0; font-size: 13.5px; color: var(--md-text); text-align: right; }

.pf-fields .pf-endpoint {
  font-family: var(--md-mono);
  font-size: 12px;
  color: var(--md-primary);
  word-break: break-all;
}

.pf-actions { padding: 14px 16px 16px; }

.pf-active-note {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--md-radius);
  background: rgba(46, 125, 50, 0.1);
  color: var(--md-success);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* =====================================================================
   Import de factures PDF
   ===================================================================== */

.import-drop { padding: 16px; }

.import-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 20px;
  border: 2px dashed var(--md-outline);
  border-radius: var(--md-radius);
  background: var(--md-surface-2);
  color: var(--md-text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--md-ease), background var(--md-ease), color var(--md-ease);
}

.import-zone:hover,
.import-zone.dragging {
  border-color: var(--md-primary);
  background: var(--md-selected);
  color: var(--md-primary);
}

#fichiers:focus-visible + .import-drop-actions,
.import-zone:focus-within { outline: 2px solid var(--md-primary); outline-offset: 2px; }

.import-zone-title { font-size: 15px; font-weight: 500; color: var(--md-text); }
.import-zone-sub { font-size: 12.5px; color: var(--md-text-2); }
.import-zone-files { font-size: 13px; font-weight: 500; color: var(--md-primary); min-height: 1.2em; }

.import-drop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.import-file { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 280px; }
.import-file svg { flex: 0 0 18px; color: var(--md-error); }
.import-file .min-w-0 { min-width: 0; }

.import-file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-file-meta { font-size: 11.5px; color: var(--md-text-2); }

:root .erp-table td.import-obs {
  max-width: 320px;
  font-size: 12.5px;
  color: var(--md-text-2);
}

/* ---- Relecture : PDF à gauche, formulaire à droite ---- */

.relecture-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}

.relecture-pdf {
  position: sticky;
  top: calc(var(--md-appbar-h) + 16px);
  height: calc(100vh - var(--md-appbar-h) - 32px);
  min-height: 480px;
}

.relecture-pdf iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--md-surface-2);
}

.relecture-form fieldset { min-width: 0; }

.relecture-section { padding: 16px; margin-bottom: 16px; }

.relecture-title {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-primary);
}

:root .relecture-lignes td { padding: 6px 8px; height: auto; }
:root .relecture-lignes th { padding: 0 8px; }
.relecture-lignes td:first-child, .relecture-lignes th:first-child { padding-left: 16px; }
.relecture-lignes input[type="number"] { min-width: 84px; }

.relecture-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--md-radius);
  background: var(--md-surface);
  box-shadow: var(--md-e8);
}

@media (max-width: 1199px) {
  .relecture-grid { grid-template-columns: 1fr; }
  .relecture-pdf { position: static; height: 70vh; }
}

/* =====================================================================
   Studio de factures
   ===================================================================== */

.studio-creation { padding: 16px; margin-bottom: 20px; }

.studio-type { margin-bottom: 24px; }
.studio-type-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.studio-type-title { font-size: 16px; font-weight: 500; color: var(--md-text); }
.studio-type-sub { font-size: 13px; color: var(--md-text-2); }

.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.studio-card { display: flex; flex-direction: column; }
:root .studio-card.est-actif { box-shadow: var(--md-e2), inset 0 3px 0 var(--md-success); }
.studio-card-body { padding: 16px; flex: 1; }
:root .studio-card-name { font-size: 15px; font-weight: 500; color: var(--md-text); text-decoration: none; }
:root .studio-card-name:hover { color: var(--md-primary); }
.studio-card-meta { margin-top: 6px; font-size: 12px; color: var(--md-text-2); }

.studio-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--md-divider);
}

/* ---- Éditeur ---- */

:root .studio-head { margin-bottom: 16px; }
:root .studio-fil { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; }

:root .studio-nom {
  margin: 4px 0 2px;
  padding: 2px 8px;
  min-height: 38px;
  max-width: 560px;
  font-size: 22px;
  border-color: transparent;
  background: transparent;
}

:root .studio-nom:hover:not(:focus) { border-color: var(--md-outline); }

.studio {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.1fr) minmax(360px, 1.5fr);
  gap: 16px;
  align-items: start;
}

.studio-volet {
  position: sticky;
  top: calc(var(--md-appbar-h) + 16px);
  max-height: calc(100vh - var(--md-appbar-h) - 32px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.studio-volet-tete {
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-divider);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-primary);
}

.studio-arbre, .studio-inspecteur-corps { overflow-y: auto; padding: 8px 0; flex: 1; }
.studio-inspecteur-corps { padding: 8px 16px 16px; }

.studio-liste { list-style: none; margin: 0; padding: 0; }

.studio-noeud {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 4px 8px 4px 10px;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--md-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.studio-noeud:hover { background: var(--md-hover); }
.studio-noeud.est-choisi { background: var(--md-selected); border-left-color: var(--md-primary); }
.studio-noeud:focus-visible { outline: 2px solid var(--md-primary); outline-offset: -2px; }

.studio-noeud-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.studio-noeud-detail { font-weight: 400; color: var(--md-text-2); }
.studio-cadenas { margin-right: 4px; font-size: 11px; }

.studio-noeud-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--md-ease); }
.studio-noeud:hover .studio-noeud-actions,
.studio-noeud.est-choisi .studio-noeud-actions,
.studio-noeud:focus-within .studio-noeud-actions { opacity: 1; }

.studio-outil {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-text-2);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.studio-outil:hover { background: var(--md-hover); color: var(--md-primary); }
.studio-outil.est-danger:hover { color: var(--md-error); }

.studio-ajout {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--md-divider);
}

.studio-ajout .form-select { flex: 1; min-width: 0; }

.studio-section { padding-top: 12px; }
.studio-section + .studio-section { margin-top: 8px; border-top: 1px solid var(--md-divider); }

.studio-section-titre {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-text-2);
}

.studio-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-content: start;
}

.studio-section-titre, .studio-section .est-large, .studio-aide { grid-column: 1 / -1; }

.studio-champ { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; color: var(--md-text-2); min-width: 0; }
.studio-champ > span { font-weight: 500; }

.studio-case {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--md-text);
  cursor: pointer;
}

.studio-case .form-check-input { margin: 0; }

.studio-couleur { display: flex; align-items: center; gap: 10px; }
:root .studio-couleur .form-control-color { width: 48px; min-height: 32px; height: 32px; padding: 2px; }

.studio-aide { font-size: 12px; color: var(--md-text-2); }

.studio-colonnes { display: flex; flex-direction: column; gap: 6px; }

.studio-colonne {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 70px auto auto;
  align-items: center;
  gap: 6px;
}

.studio-court { text-align: right; }

.studio-vignette { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

.studio-vignette img {
  max-width: 140px;
  max-height: 60px;
  padding: 4px;
  border: 1px solid var(--md-divider);
  border-radius: var(--md-radius);
  background: #fff;
}

.studio-etat { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--md-text-3); }

.studio-apercu-cadre { flex: 1; min-height: 0; padding: 12px; }

.studio-apercu-cadre iframe {
  width: 100%;
  height: calc(100vh - var(--md-appbar-h) - 150px);
  min-height: 420px;
  border: 0;
  border-radius: var(--md-radius);
  background: var(--md-surface-2);
}

@media (max-width: 1399px) {
  .studio { grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.1fr); }
  .studio-apercu { grid-column: 1 / -1; position: static; max-height: none; }
}

@media (max-width: 899px) {
  .studio { grid-template-columns: 1fr; }
  .studio-volet { position: static; max-height: none; }
}

/* =====================================================================
   Boîte de confirmation (wwwroot/js/confirmation.js) — remplace confirm()
   ===================================================================== */

.md-confirm {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: none;
  border-radius: var(--md-radius);
  background: var(--md-surface);
  color: var(--md-text);
  box-shadow: var(--md-e24);
}
.md-confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
.md-confirm[open] { animation: md-confirm-entree 0.16s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes md-confirm-entree { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.md-confirm-tete { display: flex; align-items: center; gap: 12px; padding: 20px 24px 8px; }
.md-confirm-ico {
  flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--md-selected); color: var(--md-primary);
}
.md-confirm.est-danger .md-confirm-ico { background: rgba(198, 40, 40, 0.12); color: var(--md-error); }
.md-confirm-titre { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.3; color: var(--md-text); }

.md-confirm-corps { padding: 4px 24px 16px 76px; font-size: 14px; line-height: 1.5; color: var(--md-text-2); }
.md-confirm-texte { margin: 0 0 8px; }
.md-confirm-liste { margin: 0 0 10px; padding-left: 18px; }
.md-confirm-liste li { margin-bottom: 2px; }
.md-confirm-avert {
  margin: 8px 0 0; padding: 10px 12px;
  border-left: 4px solid var(--md-accent); border-radius: var(--md-radius);
  background: rgba(232, 121, 42, 0.1); color: var(--md-text); font-size: 13px;
}

.md-confirm-pied {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--md-divider);
}

@media (max-width: 480px) {
  .md-confirm-corps { padding-left: 24px; }
  .md-confirm-pied .btn { flex: 1; }
}

/* =====================================================================
   Sources : cartes des connecteurs repliables, tableau des sources
   ===================================================================== */

.connecteurs-grille {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-bottom: 20px; align-items: start;
}
.connecteur-carte {
  display: flex; flex-direction: column;
  padding: 16px 18px;
  background: var(--md-surface);
  border: 1px solid var(--md-divider);
  border-radius: var(--md-radius);
  box-shadow: var(--md-e1);
}
.connecteur-tete { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.connecteur-corps { display: flex; flex-direction: column; flex: 1; margin-top: 14px; }
.connecteur-carte.is-replie .connecteur-corps { display: none; }

.connecteur-replier {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; background: transparent; color: var(--md-text-2);
  transition: background var(--md-ease), transform var(--md-ease);
}
.connecteur-replier:hover { background: var(--md-hover); color: var(--md-text); }
.connecteur-replier:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.connecteur-carte.is-replie .connecteur-replier { transform: rotate(-90deg); }

.sources-tete { display: flex; align-items: flex-end; justify-content: space-between; margin: 4px 0 10px; }
.sources-titre { font-size: 15px; font-weight: 500; color: var(--md-text); display: flex; align-items: center; gap: 8px; }
.sources-compte {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--md-selected); color: var(--md-primary); font-size: 12px; font-weight: 600;
}
.sources-note { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--md-text-2); }

:root .sources-table .sources-nom { font-weight: 500; }
:root .sources-table .sources-adresse { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root .sources-table .sources-erreur { max-width: 260px; font-size: 12.5px; color: var(--md-error); }
:root .sources-table tr.is-inactive td { color: var(--md-text-3); }
.sources-actions { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

@media (max-width: 1023px) {
  .connecteurs-grille { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  /* Point d'accès, clé API : ils passent à la ligne plutôt que d'élargir la page. */
  .connecteur-corps [style*="white-space:nowrap"] { white-space: normal !important; overflow-wrap: anywhere; }
  .connecteur-corps [style*="grid-template-columns:auto 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
  .connecteur-corps [style*="text-align:right"] { text-align: left !important; }
}

/* =====================================================================
   Job automatique (Views/Jobs/Automatique.cshtml)
   ===================================================================== */

.job-bloc { margin-bottom: 16px; }
.job-bloc-tete {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-bottom: 1px solid var(--md-divider);
  font-size: 15px; font-weight: 500; color: var(--md-text);
}
.job-bloc-tete > svg { color: var(--md-primary); }
.job-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px; padding: 16px 20px 20px;
}
.job-champ { min-width: 0; }
.job-champ-large { grid-column: 1 / -1; }
.job-requis { color: var(--md-error); }
.job-aide { margin-top: 4px; font-size: 12px; color: var(--md-text-2); }
.job-valeur { min-height: 38px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--md-text); }
.job-case { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--md-text); cursor: pointer; }
.job-case input { width: 18px; height: 18px; accent-color: var(--md-primary); }
.job-secondes { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.job-secondes .form-control { width: 140px; }
.job-unite { font-size: 13px; color: var(--md-text-2); }

.job-radios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.job-radio {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; align-items: center;
  padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--md-outline); border-radius: var(--md-radius); background: var(--md-surface);
  transition: border-color var(--md-ease), background var(--md-ease);
}
.job-radio input { grid-row: 1 / span 2; width: 18px; height: 18px; accent-color: var(--md-primary); }
.job-radio-titre { font-size: 14px; font-weight: 500; color: var(--md-text); }
.job-radio-texte { font-size: 12.5px; color: var(--md-text-2); }
.job-radio:has(input:checked) { border-color: var(--md-primary); background: var(--md-selected); }
.job-radio:has(input:focus-visible) { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.job-avert {
  margin-top: 10px; padding: 10px 12px; font-size: 13px; color: var(--md-text);
  border-left: 4px solid var(--md-accent); border-radius: var(--md-radius); background: rgba(232, 121, 42, 0.1);
}
.job-maj { font-size: 12px; color: var(--md-text-3); text-align: right; }

/* Bandeau du job automatique en tête de « Jobs d'incorporation » */
.job-auto-bandeau {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--md-surface); border: 1px solid var(--md-divider); border-radius: var(--md-radius);
  box-shadow: var(--md-e1); font-size: 13.5px; color: var(--md-text);
}
.job-auto-bandeau .job-auto-ico {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--md-selected); color: var(--md-primary);
}
.job-auto-bandeau.is-arrete .job-auto-ico { background: var(--md-hover); color: var(--md-text-2); }
.job-auto-bandeau .job-auto-texte { flex: 1; min-width: 200px; }
.job-auto-bandeau .job-auto-sous { font-size: 12.5px; color: var(--md-text-2); }
.badge-auto { background: var(--md-selected); color: var(--md-primary); }

@media (max-width: 767px) {
  .job-form, .job-radios { grid-template-columns: 1fr; }
}

/* Les cartes des connecteurs gardent leurs styles en ligne d'origine (couleurs claires) :
   en thème sombre, on les ramène aux jetons du thème. */
[data-theme="dark"] .connecteur-carte [style*="color:#182652"] { color: var(--md-text) !important; }
[data-theme="dark"] .connecteur-carte [style*="color:#8892a6"],
[data-theme="dark"] .connecteur-carte [style*="color:#3d4763"] { color: var(--md-text-2) !important; }
[data-theme="dark"] .connecteur-carte [style*="background:#f8fafc"] { background: var(--md-surface-2) !important; border-color: var(--md-divider) !important; }
[data-theme="dark"] .connecteur-carte [style*="background:#f1f4fa"] { background: var(--md-selected) !important; }
[data-theme="dark"] .connecteur-carte [style*="background:#fff"] { background: var(--md-surface-2) !important; border-color: var(--md-outline) !important; }
[data-theme="dark"] .connecteur-carte [style*="background:#eaf0fb"] { background: var(--md-selected) !important; border-color: transparent !important; color: var(--md-primary) !important; }

:root .sources-table .sources-nom { min-width: 160px; }
:root .sources-table td:nth-child(2) { white-space: nowrap; }
