.field-help {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.ingredient-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 10px;
}

.ingredient-toolbar strong {
  color: var(--danger);
}

.ingredient-toolbar strong.valid {
  color: #087443;
}

.ingredient-row {
  margin-top: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px;
}

.search-tools input[type="search"] {
  width: min(280px, 26vw);
  padding: 9px 11px;
}

.archive-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
}

.archive-toggle input {
  width: auto;
}

tr.archived {
  opacity: .62;
  background: #f4f4f4;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-action.archive {
  background: #fff0f0;
  color: var(--danger);
}

.action-menu-cell {
  width: 1%;
  vertical-align: top;
}

.action-menu {
  min-width: 10.5rem;
}

.action-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid #b9c8c0;
  border-radius: 9px;
  background: #fff;
  color: var(--green);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 750;
  list-style: none;
  user-select: none;
}

.action-menu-toggle::-webkit-details-marker {
  display: none;
}

.action-menu-toggle::after {
  content: "▾";
  font-size: .85rem;
  transition: transform .15s ease;
}

.action-menu[open] .action-menu-toggle::after {
  transform: rotate(180deg);
}

.action-menu-toggle:hover {
  background: var(--mint);
}

.action-menu-toggle:focus-visible {
  outline: 3px solid #66aa8c55;
  outline-offset: 2px;
}

.action-menu-list,
.action-menu-list.table-actions {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 24px #173b2c1c;
}

.action-menu-list .table-action {
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .topbar {
    flex-wrap: wrap;
  }

  .ingredient-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-tools {
    order: 3;
    width: 100%;
    margin: 8px 0 0;
  }

  .search-tools input[type="search"] {
    width: 100%;
  }
}

.alert-panel {
  margin-bottom: 18px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.alert-panel h3 {
  margin: 0 0 10px;
  font-size: .84rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.alert-panel .alert-empty {
  color: #087443;
  font-weight: 700;
  font-size: .9rem;
}

.alert-group {
  margin-bottom: 12px;
}

.alert-group:last-child {
  margin-bottom: 0;
}

.alert-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  padding: 7px 10px;
  margin-bottom: 5px;
  border-radius: 8px;
  font-size: .84rem;
  border-left: 4px solid var(--line);
  background: #f7f9f8;
}

.alert-item strong {
  color: var(--ink);
}

.alert-item .alert-detail {
  color: var(--muted);
}

.alert-item.danger {
  border-left-color: var(--danger);
  background: #fff5f5;
}

.alert-item.warning {
  border-left-color: #b8860b;
  background: #fffaf0;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
}
.inline-field input[type="date"] {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}

#finance-center-select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  color: #334155;
}

/* --- UI1 : tableau de bord de pilotage --- */
.overview-alerts-panel .panel-heading { align-items: center; }
.alerts-total { font-size: 0.85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.alerts-total.ok { color: var(--green); background: var(--mint); }
.alerts-total.warn { color: #92400e; background: #fdf1e0; }
.alert-chip-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 2px; }
.alert-chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: transform 0.1s ease, box-shadow 0.1s ease; }
.alert-chip strong { font-size: 1rem; }
.alert-chip.ok strong { color: var(--green); }
.alert-chip.warn { border-color: #f0c692; background: #fdf6ec; }
.alert-chip.warn strong { color: #b45309; }
.alert-chip:hover, .alert-chip:focus-visible { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(23, 35, 30, 0.12); }
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; margin: 14px 0; }
.domain-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease; }
.domain-card:hover, .domain-card:focus-visible { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 6px 16px rgba(21, 91, 66, 0.14); }
.domain-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.domain-value { font-size: 1.45rem; color: var(--green-2); }
.domain-sub { font-size: 0.82rem; color: var(--muted); }
.domain-sub.warn { color: #b45309; font-weight: 600; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; align-items: baseline; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.activity-list li:last-child { border-bottom: none; }
.activity-date { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.activity-tag { flex: 0 0 auto; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--green); background: var(--mint); border-radius: 6px; padding: 2px 8px; }
.activity-tag.warn { color: #92400e; background: #fdf1e0; }
.activity-text { min-width: 0; }
@media (prefers-reduced-motion: reduce) { .alert-chip, .domain-card { transition: none; } .alert-chip:hover, .domain-card:hover { transform: none; } }

/* --- UI2 : identité visuelle --- */
#splash-screen { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: #060907; opacity: 1; transition: opacity 0.6s ease; }
#splash-screen img { width: min(66vw, 390px); border-radius: 20px; box-shadow: 0 0 90px rgba(74, 176, 79, 0.22); animation: splash-in 0.9s ease both; }
#splash-screen.splash-hidden { opacity: 0; pointer-events: none; }
@keyframes splash-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.login-layout { background: radial-gradient(circle at 22% 12%, rgba(74, 176, 79, 0.16), transparent 46%), #0a0e0c; }
.login-logo { display: block; width: 100%; max-width: 265px; margin: 0 auto 18px; border-radius: 14px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: block; }
@media (prefers-reduced-motion: reduce) {
  #splash-screen, #splash-screen.splash-hidden { transition: none; }
  #splash-screen img { animation: none; }
}

/* --- UI3 : panneaux repliables et affichage progressif --- */
.panel.collapsible .panel-heading h2 { margin: 0; }
.panel-toggle { display: inline-flex; align-items: center; gap: 9px; background: none; border: none; padding: 2px 0; font: inherit; font-weight: 700; color: var(--ink); }
.panel-toggle:hover .panel-chevron, .panel-toggle:focus-visible .panel-chevron { background: var(--green); }
.panel-chevron { width: 20px; height: 20px; border-radius: 6px; background: var(--green-2); position: relative; transition: transform 0.15s ease; flex: 0 0 auto; }
.panel-chevron::after { content: ""; position: absolute; left: 6px; top: 4px; width: 6px; height: 6px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }
.panel-collapsed .panel-chevron { transform: rotate(-90deg); }
.panel-count { font-size: 0.78rem; font-weight: 700; color: var(--green); background: var(--mint); border-radius: 999px; padding: 2px 9px; min-width: 18px; text-align: center; }
.panel-collapsed > *:not(.panel-heading) { display: none; }
.panel-collapsed .panel-heading { margin-bottom: 0; }
.show-more { display: block; width: 100%; margin-top: 10px; padding: 9px; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg); color: var(--green-2); font-weight: 600; }
.show-more:hover, .show-more:focus-visible { border-color: var(--green); background: #eef6f1; }
@media (prefers-reduced-motion: reduce) { .panel-chevron { transition: none; } }

/* --- UI4 : barres de sous-modules --- */
.submodule-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.submodule-link { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.87rem; font-weight: 600; transition: border-color 0.1s ease, box-shadow 0.1s ease; }
.submodule-link:hover, .submodule-link:focus-visible { border-color: var(--green); box-shadow: 0 2px 8px rgba(21, 91, 66, 0.14); }
@media (prefers-reduced-motion: reduce) { .submodule-link { transition: none; } }

/* --- F6 : trésorerie --- */
.treasury-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.treasury-card { display: flex; flex-direction: column; gap: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; }
.treasury-card.total { background: var(--mint); border-color: #bfe3cf; }
.treasury-card .domain-sub.warn { color: #92400e; font-weight: 600; }

/* --- L1b : pagination des tables --- */
.table-pager { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pager-info { font-weight: 600; color: #33574a; margin-right: auto; }
.pager-button { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 6px 12px; cursor: pointer; font: inherit; }
.pager-button:disabled { opacity: .45; cursor: default; }
.table-pager .pager-size { width: auto; max-width: 140px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; font: inherit; background: var(--bg); }

/* --- L2b : administration des utilisateurs --- */
.provisional-box { background: #f2f7f2; border: 1px dashed #4f7d55; border-radius: 8px; padding: 0.9rem 1.1rem; text-align: center; }
.provisional-box output { font-family: "Consolas", "Menlo", monospace; font-size: 1.25rem; letter-spacing: 0.12em; user-select: all; }
.warn-text { color: var(--warning); }
#provisional-dialog { max-width: 30rem; }
#password-view .danger-link { margin-top: 0.75rem; }

/* --- L4a : sidebar en 4 sections --- */
.nav-section-label { margin: 20px 8px 6px; padding: 0; color: var(--chrome-text-muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nav-section-label:first-child { margin-top: 4px; }

/* --- L4b : champ de recherche serveur (search-select) --- */
.search-select-wrap { position: relative; }
.search-select-input { width: 100%; }
.search-select-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(20,40,30,0.12); max-height: 220px; overflow: auto; z-index: 5; }
.search-select-option { padding: 9px 12px; font-size: .88rem; color: var(--ink); cursor: pointer; border-bottom: 1px solid #eef2ef; }
.search-select-option:last-child { border-bottom: 0; }
.search-select-option:hover, .search-select-option.active { background: var(--mint); }
.search-select-empty { padding: 12px; font-size: .82rem; color: var(--muted); }
.search-select-selected { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--mint); border-radius: 9px; }
.search-select-selected span { flex: 1; font-size: .88rem; color: var(--green); font-weight: 700; }
.search-select-selected .icon-button { font-size: 1.15rem; padding: 2px 6px; color: var(--green); }

/* --- L4c : fiche bovin --- */
.detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 22px; }
#animal-detail-back { margin-bottom: 16px; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.detail-header h1 { margin: 0 0 4px; }
.detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.detail-metric { background: var(--mint); border-radius: 11px; padding: 14px 16px; }
.detail-metric span { display: block; font-size: .78rem; color: var(--muted); }
.detail-metric strong { display: block; margin-top: 6px; font-size: 1.25rem; color: var(--ink); }
.detail-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-tab { padding: 7px 14px; border-radius: 8px; background: transparent; color: var(--muted); font-size: .85rem; font-weight: 700; }
.detail-tab.active { background: var(--mint); color: var(--green); }
#animal-detail-tab-action { margin-bottom: 10px; }
@media(max-width:700px){.detail-metrics{grid-template-columns:1fr 1fr}}

/* --- L4d : formulaires par étapes --- */
.dialog-step-indicator { margin: 10px 0 0; font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--green); }
.field.step-hidden { display: none; }

/* --- L4e : centre de notifications persistant --- */
.notif-bell-wrap { position: relative; }
#notif-bell { position: relative; font-size: 1.2rem; }
.notif-badge { position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.notif-panel { position: fixed; top: 60px; right: 12px; width: min(360px, calc(100vw - 24px)); max-height: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 16px 40px rgba(20,40,30,0.18); overflow: hidden; z-index: 45; display: flex; flex-direction: column; }
.notif-panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-panel-heading h3 { margin: 0; font-size: .92rem; }
.notif-panel-heading button { padding: 5px 9px; font-size: .76rem; }
#notif-list { overflow: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid #eef2ef; font-size: .84rem; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.error { background: #fff6f6; }
.notif-item time { display: block; margin-top: 3px; color: var(--muted); font-size: .74rem; }
.notif-empty { padding: 20px 14px; text-align: center; color: var(--muted); font-size: .84rem; }

/* --- L5c : indicateur de connexion perdue --- */
.connectivity-banner { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; background: var(--warning-bg); color: var(--warning); font-size: .84rem; font-weight: 700; text-align: center; border-bottom: 1px solid #f0ddb0; }

/* --- L5e : mobile/responsive --- */
.panel-heading, .table-actions, .page-heading > div:last-child { flex-wrap: wrap; }

/* Bouton hamburger : masque par defaut, visible seulement en dessous de 900px (cf. sidebar) */
.mobile-menu-toggle { display: none; font-size: 1.15rem; color: var(--chrome-text); }

/* Voile derriere le menu en tiroir */
.sidebar-scrim { position: fixed; inset: 0; background: rgba(20,35,28,0.35); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.sidebar-scrim.visible { opacity: 1; pointer-events: auto; }

@media(max-width:900px){
  .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; max-width: 82vw; background: var(--chrome-2); overflow-y: auto; overflow-x: hidden; z-index: 40; box-shadow: 4px 0 18px rgba(20,35,28,0.18); padding: 18px 14px; transform: translateX(-100%); transition: transform .2s ease; display: block; border-right: 1px solid var(--chrome-2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .nav-item { width: auto; white-space: normal; margin: 0 0 2px; display: flex; }
  .sidebar .nav-section-label { margin: 20px 8px 6px; }
  .sidebar .nav-section-label:first-child { margin-top: 4px; }
}

/* --- Menu latéral en accordéon (rubriques repliables) --- */
.nav-section-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; background: transparent; border: 0; margin: 18px 0 2px; padding: 8px; color: var(--chrome-text-muted); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.nav-section-toggle:first-of-type { margin-top: 6px; }
.nav-section-toggle:hover { color: var(--chrome-text); }
.nav-section-chevron { transition: transform .15s ease; font-size: .95rem; }
.nav-section-toggle[aria-expanded="true"] .nav-section-chevron { transform: rotate(90deg); }
.nav-section-group[hidden] { display: none; }

/* --- Analytics : tendances 12 mois --- */
.trends-grid { display: grid; grid-template-columns: repeat(2, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.trend-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 18px; }
.trend-card h3 { margin: 0 0 4px; font-size: 1rem; }
.trend-card .trend-latest { font-size: 1.3rem; font-weight: 800; margin-bottom: 10px; }
.trend-card svg { width: 100%; height: 120px; display: block; }
.trend-card .trend-empty { color: var(--muted); padding: 30px 0; text-align: center; }
@media(max-width:700px){.trends-grid{grid-template-columns:1fr}}

/* --- Module Documentaire (LOT 6) --- */
.documents-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
#documents-module-select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
