/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --terracotta: #8B4A30;
  --terracotta-dark: #6B3520;
  --vert-foret: #2A3828;
  --creme: #FAF5EF;
  --brun-fonce: #2C1A10;
  --brun-muted: #5C4038;
  --blanc: #FFFFFF;
  --bordure: #C8B5A8;
  --confirmer-bg: #FFF8E1;
  --confirmer-border: #F59E0B;
  --confirmer-text: #7C5E00;
  --focus-ring: #005FCC;
}

html { font-size: 18px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--brun-fonce);
  background: var(--blanc);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== FOCUS VISIBLE (accessibilité) ===== */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--focus-ring);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  z-index: 9999;
  border-radius: 0 0 4px 0;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ===== HEADER ===== */
.site-header {
  background: var(--vert-foret);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex: 1;
}

.header-logo img {
  height: 44px;
  width: auto;
}

.header-title {
  color: #FFFFFF;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.header-back {
  color: #E8DDD8;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.header-back:hover, .header-back:focus-visible {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ===== MAIN LAYOUT ===== */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ===== SECTION SHOW/HIDE ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== SEARCH SCREEN ===== */
.search-header {
  text-align: center;
  margin-bottom: 2rem;
}

.search-header h1 {
  font-size: 1.75rem;
  color: var(--brun-fonce);
  margin-bottom: 0.5rem;
}

.search-header p {
  color: var(--brun-muted);
  font-size: 1rem;
}

.search-box-wrapper {
  position: relative;
  max-width: 540px;
  margin: 0 auto 2.5rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brun-muted);
  pointer-events: none;
  width: 20px;
  height: 20px;
}

#search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 3rem;
  font-size: 1rem;
  border: 2px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
  color: var(--brun-fonce);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search-input:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(139,74,48,0.2);
  outline: none;
}
#search-input::placeholder { color: #9E8880; }

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brun-muted);
  padding: 0.25rem;
  display: none;
  border-radius: 50%;
}
.search-clear.visible { display: flex; align-items: center; justify-content: center; }

/* Filtres par catégorie */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.filter-btn {
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--bordure);
  border-radius: 999px;
  background: var(--blanc);
  color: var(--brun-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.filter-btn:hover { border-color: var(--terracotta); color: var(--terracotta); }
.filter-btn.active {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fff;
}

/* Grille de cartes */
.results-count {
  color: var(--brun-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ===== CARTE D'AIDE ===== */
.card {
  background: var(--blanc);
  border: 1.5px solid var(--bordure);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.2s, transform 0.1s;
}
.card:hover {
  box-shadow: 0 4px 18px rgba(44,26,16,0.12);
  transform: translateY(-2px);
}

.card-category {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brun-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-category-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.cat-autonomie .card-category-icon { background: #EDF7F0; }
.cat-revenu     .card-category-icon { background: #EEF2FB; }
.cat-domicile   .card-category-icon { background: #FEF3E7; }
.cat-travaux    .card-category-icon { background: #F0F7EE; }
.cat-securite   .card-category-icon { background: #FDF2F8; }
.cat-repas      .card-category-icon { background: #FFF8E1; }
.cat-ehpad      .card-category-icon { background: #E8F0F8; }

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brun-fonce);
  line-height: 1.3;
}

.card-desc {
  color: var(--brun-muted);
  font-size: 0.95rem;
  flex: 1;
  line-height: 1.55;
}

.card-montant {
  font-size: 0.85rem;
  color: var(--terracotta);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.card-btn {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  align-self: flex-start;
}
.card-btn:hover, .card-btn:focus-visible { background: var(--terracotta-dark); }

/* Pas de résultats */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--brun-muted);
  display: none;
}
.no-results.visible { display: block; }
.no-results p { font-size: 1.05rem; margin-bottom: 0.5rem; }

/* ===== VUE DETAIL ===== */
.detail-nav {
  margin-bottom: 1.5rem;
}

.btn-retour {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 2px solid var(--bordure);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brun-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-retour:hover, .btn-retour:focus-visible {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.detail-header {
  background: var(--creme);
  border-radius: 14px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  border: 1.5px solid var(--bordure);
}

.detail-category {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brun-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.detail-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--brun-fonce);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.detail-subtitle {
  color: var(--brun-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Sections du détail */
.detail-section {
  margin-bottom: 2rem;
}

.detail-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brun-fonce);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--bordure);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section p {
  color: var(--brun-muted);
  margin-bottom: 0.75rem;
  line-height: 1.65;
}

.detail-section ul, .detail-section ol {
  padding-left: 1.5rem;
  color: var(--brun-muted);
}

.detail-section li {
  margin-bottom: 0.5rem;
  line-height: 1.55;
}

.detail-section strong { color: var(--brun-fonce); }

/* Tableaux */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1.5px solid var(--bordure);
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead th {
  background: var(--vert-foret);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

tbody tr:nth-child(even) { background: var(--creme); }

tbody td {
  padding: 0.7rem 1rem;
  color: var(--brun-fonce);
  border-top: 1px solid var(--bordure);
  vertical-align: top;
}

/* Étapes numérotées */
.steps-list {
  counter-reset: steps;
  list-style: none;
  padding: 0;
}

.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: flex-start;
}

.steps-list li::before {
  content: counter(steps);
  background: var(--terracotta);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.steps-list li span { padding-top: 0.25rem; color: var(--brun-muted); line-height: 1.55; }

/* Documents checklist */
.docs-list {
  list-style: none;
  padding: 0;
}

.docs-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bordure);
  color: var(--brun-muted);
  font-size: 0.95rem;
}
.docs-list li:last-child { border-bottom: none; }
.docs-list li::before {
  content: "☐";
  font-size: 1.1rem;
  color: var(--terracotta);
  flex-shrink: 0;
  margin-top: -1px;
}

/* Badge à confirmer */
.badge-confirmer {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--confirmer-bg);
  color: var(--confirmer-text);
  border: 1px solid var(--confirmer-border);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Alerte importante */
.alerte {
  background: #FFF3CD;
  border-left: 4px solid #E6A817;
  border-radius: 0 8px 8px 0;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #5A3E00;
}
.alerte strong { color: #3D2900; }

/* Organismes */
.orga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.orga-card {
  background: var(--creme);
  border: 1.5px solid var(--bordure);
  border-radius: 10px;
  padding: 1rem;
}

.orga-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brun-fonce);
  margin-bottom: 0.25rem;
}

.orga-card a {
  color: var(--terracotta);
  font-size: 0.85rem;
  word-break: break-all;
}

.orga-card .tel {
  font-weight: 700;
  color: var(--vert-foret);
  font-size: 1rem;
}

/* Sources */
.sources-section {
  background: var(--creme);
  border: 1.5px solid var(--bordure);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.sources-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brun-fonce);
  margin-bottom: 0.75rem;
}

.sources-list {
  list-style: none;
  padding: 0;
}

.sources-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--bordure);
  font-size: 0.85rem;
}
.sources-list li:last-child { border-bottom: none; }

.sources-list a {
  color: var(--terracotta);
  word-break: break-all;
}

.sources-list .source-date {
  color: var(--brun-muted);
  font-size: 0.78rem;
  margin-left: 0.5rem;
}

/* Mention légale */
.mention-legale {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #F5F0F0;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--brun-muted);
  border-left: 3px solid var(--bordure);
}

.verified-date {
  font-size: 0.82rem;
  color: var(--brun-muted);
  margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
footer {
  background: var(--creme);
  border-top: 1.5px solid var(--bordure);
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--brun-muted);
}

footer a {
  color: var(--terracotta);   /* ≈ 6:1 sur --creme (#FAF5EF) — conforme WCAG AA */
  text-decoration: underline;
}
footer a:hover,
footer a:focus-visible {
  color: var(--terracotta-dark);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  html { font-size: 17px; }

  .site-header { padding: 0.6rem 1rem; }
  .header-title { font-size: 1rem; }
  .header-back { font-size: 0.8rem; padding: 0.3rem 0.55rem; }

  .search-header h1 { font-size: 1.4rem; }

  .cards-grid { grid-template-columns: 1fr; }

  .detail-title { font-size: 1.35rem; }

  .orga-grid { grid-template-columns: 1fr; }

  thead th, tbody td { padding: 0.55rem 0.75rem; font-size: 0.88rem; }
}

/* ===== PRINT ===== */
@media print {
  .site-header, .detail-nav, .card-btn { display: none; }
  .view.active { display: block !important; }
}

/* ===== ACCESSIBILITE — TEXTE RESERVE AUX LECTEURS D'ECRAN =====
   Remplace l'attribut style inline sur le label de recherche.
   Conforme WCAG 1.3.1 — conserve le contenu pour les AT.        */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ===== NO-RESULTS — DEUXIEME PARAGRAPHE (suggestion) =====
   Remplace style="font-size:0.9rem" inline.                 */
.no-results p + p { font-size: 0.9rem; }

/* ===== FOOTER — ESPACEMENTS INTER-PARAGRAPHES =====
   Remplace les attributs style="margin-top:..." inline.    */
footer[role="contentinfo"] p + p   { margin-top: 0.3rem; }
footer[role="contentinfo"] p + p + p { margin-top: 0.5rem; }

/* ===== ONGLETS DE NAVIGATION ===== */
.app-tabs {
  display: flex;
  border-bottom: 2.5px solid var(--bordure);
  background: var(--blanc);
  position: sticky;
  top: 62px; /* sous le header sticky */
  z-index: 90;
  box-shadow: 0 2px 6px rgba(44,26,16,0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-tab-btn {
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2.5px;
  background: none;
  color: var(--brun-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.15s, border-bottom-color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}

.app-tab-btn.active {
  color: var(--terracotta);
  border-bottom-color: var(--terracotta);
}

.app-tab-btn:hover:not(.active) {
  color: var(--brun-fonce);
  border-bottom-color: var(--bordure);
}

/* ===== VUE ORGANISMES ===== */
.orga-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.orga-header h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--brun-fonce);
  margin-bottom: 0.5rem;
}

.orga-header p {
  color: var(--brun-muted);
  font-size: 0.9rem;
}

/* Notice EHPAD */
.orga-ehpad-notice {
  background: #E8F2FA;
  border: 1.5px solid #9BBCD5;
  border-left: 5px solid #3A7FC1;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.orga-ehpad-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.orga-ehpad-notice h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #1A3A5C;
  margin-bottom: 0.35rem;
  border: none;
  padding: 0;
}

.orga-ehpad-notice p {
  font-size: 0.88rem;
  color: #2A4A6C;
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.orga-ehpad-notice a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #1A5A9C;
  font-weight: 700;
  font-size: 0.88rem;
  word-break: break-all;
}
.orga-ehpad-notice a:hover { color: #0D3D70; }

/* Formulaire */
.orga-form {
  max-width: 580px;
  margin: 0 auto 2rem;
  background: var(--creme);
  border: 1.5px solid var(--bordure);
  border-radius: 14px;
  padding: 1.75rem;
}

.orga-form-field {
  margin-bottom: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.orga-form-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brun-fonce);
}

.orga-form-input {
  padding: 0.85rem 1.1rem;
  font-size: 1.1rem;
  border: 2.5px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
  color: var(--brun-fonce);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.orga-form-input:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(139,74,48,0.18);
  outline: none;
}

.orga-form-hint {
  font-size: 0.82rem;
  color: var(--brun-muted);
  line-height: 1.4;
}

/* Erreur de formulaire (validation) */
.orga-form-err {
  background: #FFF0F0;
  border: 1.5px solid #D9534F;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #7B1F1F;
  font-size: 0.95rem;
  font-weight: 600;
  display: none;
  margin-bottom: 1rem;
}
.orga-form-err.visible { display: block; }

/* Bouton soumission */
.orga-submit {
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s;
  font-family: inherit;
}
.orga-submit:hover, .orga-submit:focus-visible { background: var(--terracotta-dark); }
.orga-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Zone de statut */
.orga-status-zone {
  max-width: 580px;
  margin: 0 auto 1.5rem;
}

.orga-loading {
  text-align: center;
  padding: 2.5rem 1rem;
  display: none;
}
.orga-loading.visible { display: block; }

.orga-spinner {
  display: inline-block;
  width: 44px;
  height: 44px;
  border: 5px solid var(--bordure);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: orgaSpin 0.85s linear infinite;
}

@keyframes orgaSpin { to { transform: rotate(360deg); } }

.orga-spinner-label {
  display: block;
  margin-top: 1rem;
  color: var(--brun-muted);
  font-size: 0.95rem;
}

.orga-msg {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.55;
  display: none;
}
.orga-msg.visible { display: block; }
.orga-msg.error {
  background: #FFF0F0;
  border: 1.5px solid #D9534F;
  color: #7B1F1F;
}
.orga-msg.info {
  background: var(--creme);
  border: 1.5px solid var(--bordure);
  color: var(--brun-muted);
}

/* Compteur */
.orga-count {
  max-width: 580px;
  margin: 0 auto 0.75rem;
  font-size: 0.9rem;
  color: var(--brun-muted);
}

/* Liste résultats */
.orga-list {
  max-width: 700px;
  margin: 0 auto;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.orga-card {
  background: var(--blanc);
  border: 1.5px solid var(--bordure);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  transition: box-shadow 0.15s;
}
.orga-card:hover { box-shadow: 0 3px 14px rgba(44,26,16,0.1); }

.orga-card-type {
  display: inline-block;
  background: var(--creme);
  border: 1px solid var(--bordure);
  border-radius: 5px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brun-muted);
  margin-bottom: 0.5rem;
}

.orga-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brun-fonce);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.orga-card-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  color: var(--brun-muted);
}

.orga-card-row-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  margin-top: 1px;
}

.orga-card-tel a {
  color: var(--vert-foret);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.orga-card-tel a:hover { text-decoration: underline; }

.orga-card-site a {
  color: var(--terracotta);
  word-break: break-all;
  font-weight: 600;
}

.orga-card-hours {
  margin-top: 0.75rem;
  border-top: 1px solid var(--bordure);
  padding-top: 0.65rem;
}

.orga-card-hours summary {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brun-fonce);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
}
.orga-card-hours summary::-webkit-details-marker { display: none; }

.orga-card-hours-content {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--brun-muted);
  white-space: pre-line;
  line-height: 1.65;
  padding-left: 0.25rem;
}

/* ===== SECTIONS ORGANISMES (FINESS + DILA) ===== */

/* Carte-section : encadre chaque sous-section (FINESS / DILA) */
.orga-section-card {
  border: 1.5px solid var(--bordure);
  border-radius: 16px;
  padding: 1.75rem 1.75rem 1.25rem;
  margin-bottom: 0;
  background: var(--blanc);
}

/* Titre de section */
.orga-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brun-fonce);
  margin-bottom: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  border-bottom: 2px solid var(--bordure);
  padding-bottom: 0.75rem;
}

.orga-section-title-icon {
  font-size: 1.15rem;
}

.orga-section-subtitle {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--brun-muted);
  letter-spacing: 0.02em;
  /* Forcer le texte a passer sous le titre si besoin */
  width: 100%;
  margin-top: -0.2rem;
}

.orga-section-intro {
  font-size: 0.88rem;
  color: var(--brun-muted);
  margin-bottom: 1.25rem;
}

/* Separateur visuel entre les deux sections */
.orga-section-divider {
  height: 0;
  border: none;
  border-top: 2px dashed var(--bordure);
  margin: 1.75rem 0;
}

/* ===== BADGES TYPE DANS LES CARTES FINESS ===== */

.finess-type-badge { font-size: 0.7rem; }

/* Couleurs des badges (texte + fond = double signal) */
.finess-type--500 {
  background: #FDECEA;
  border-color: #E8A5A0;
  color: #7B1F1F;  /* contraste > 4.5:1 sur #FDECEA */
}
.finess-type--202 {
  background: #EBF8EF;
  border-color: #9DD5AF;
  color: #1A5C30;  /* contraste > 4.5:1 sur #EBF8EF */
}
/* ===== NUMERO FINESS DANS LES CARTES ===== */

.finess-num {
  font-size: 0.82rem;
  color: var(--brun-muted);
  font-family: monospace;
  letter-spacing: 0.04em;
}
.finess-num-row { margin-top: 0.2rem; }

/* ===== BADGES TYPE — NOUVEAUX CODES FINESS (domicile + USLD corrige) ===== */

/* USLD — code 362 (corrige : 295 etait AEMO/AED, non USLD) */
.finess-type--362 {
  background: #EAF4FB;
  border-color: #90C4DF;
  color: #1A4E6C;  /* contraste > 4.5:1 sur #EAF4FB */
}

/* SAA — Service Autonomie Aide (code 460, ex-SAAD, reforme 2023) */
.finess-type--460 {
  background: #FFF0E5;
  border-color: #D4894A;
  color: #7A3C00;  /* contraste 6.9:1 sur #FFF0E5 — WCAG AA */
}

/* SSIAD — Service de Soins Infirmiers A Domicile (code 354) */
.finess-type--354 {
  background: #F3EAFA;
  border-color: #A371D0;
  color: #4A1B7C;  /* contraste 9.5:1 sur #F3EAFA — WCAG AAA */
}

/* SAAS — Service Autonomie Aide et Soins (code 209) */
.finess-type--209 {
  background: #E5F6F5;
  border-color: #5BAAA5;
  color: #1B5752;  /* contraste 6.7:1 sur #E5F6F5 — WCAG AA */
}

/* ===== RECHERCHE UNIFIEE — Nouveaux tokens CSS (spec §8) ===== */

/* Notice de provenance — alias de .finess-source-notice pour les nouvelles sections */
.rech-source-notice {
  max-width: 700px;
  margin: 1.25rem auto 0;
  padding: 0.65rem 1rem;
  background: var(--creme);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  font-size: 0.78rem;      /* 0.78rem * 18px base = ~14px */
  color: var(--brun-muted);  /* #5C4038 — contraste 9.35:1 sur #fff — WCAG AAA */
  line-height: 1.5;
}
.rech-source-notice a {
  color: var(--terracotta);   /* contraste 5.4:1 sur #fff — WCAG AA */
  font-weight: 600;
  text-decoration: underline;
}
.rech-source-notice a:hover { color: var(--terracotta-dark); }

/* Navigation rapide (§8.1) */
.rech-quicknav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem auto 1rem;
  max-width: 700px;
  padding: 0 1rem;
}

.rech-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  min-height: 44px;                        /* cible tactile WCAG 2.5.5 */
  border: 2px solid var(--vert-foret);
  border-radius: 24px;
  background: #fff;
  color: var(--vert-foret);               /* contraste ~10:1 sur #fff — WCAG AAA */
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.rech-cat-btn:hover,
.rech-cat-btn:focus-visible {
  background: var(--vert-foret);
  color: #fff;
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

.rech-cat-btn-count {
  font-size: 0.82rem;
  font-weight: 400;
  opacity: 0.8;
}

/* Bouton categorie en erreur (source indisponible) —
   couleur DOUBLÉE par le texte "(!) " (signal non-couleur seul — WCAG 1.4.1) */
.rech-cat-btn--error {
  border-color: #C0392B;
  color: #7B1F1F;          /* contraste 7.1:1 sur #fff — WCAG AAA */
}
.rech-cat-btn--error:hover,
.rech-cat-btn--error:focus-visible {
  background: #C0392B;
  color: #fff;
  outline-color: #7B1F1F;
}

/* Bouton pleine largeur sur tres petits ecrans */
@media (max-width: 360px) {
  .rech-cat-btn { width: 100%; justify-content: center; }
}

/* Sections de resultats (§8.2) */
.rech-section {
  max-width: 700px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

/* Champ + bouton cote a cote (§8.3) */
.rech-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.rech-form-row .orga-form-input {
  flex: 1 1 0;
  min-width: 0;
}

.rech-form-row .orga-submit {
  flex-shrink: 0;
  /* Conserver largeur auto (pas width:100% de .orga-submit) */
  width: auto;
}

/* Sur petits ecrans : empilement en colonne */
@media (max-width: 400px) {
  .rech-form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .rech-form-row .orga-submit {
    width: 100%;
  }
}

/* Bandeau avertissement partiel (§8.4)
   Bordure gauche orange DOUBLÉE par icone ⚠ dans le texte (WCAG 1.4.1) */
.rech-partial-warn {
  border-left: 4px solid #D4850A;
  background: #FFF8EC;
  color: #5C3B00;    /* contraste 8.9:1 sur #FFF8EC — WCAG AAA */
  white-space: pre-line;
  max-width: 700px;
  margin: 0 auto 1rem;
}

/* Placeholder dans section domicile */
.rech-placeholder {
  max-width: 700px;
  margin: 0 auto;
  white-space: pre-line;
}

/* Responsive onglets */
@media (max-width: 600px) {
  .app-tab-btn { font-size: 0.85rem; padding: 0.7rem 0.85rem; }
  .orga-form { padding: 1.25rem; }
  .orga-header h1 { font-size: 1.35rem; }
  .orga-section-card { padding: 1.25rem 1rem 1rem; }
}

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  .orga-spinner { animation: none; }
}

/* Impression */
@media print {
  .app-tabs { display: none; }
  #view-organismes { display: none; }
}

/* ===== CHARGEMENT INITIAL DES DONNEES ===== */
#data-loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #5C4038;
  font-size: 1rem;
}

#data-error {
  display: none;
  background: #FFF0F0;
  border: 1.5px solid #D9534F;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  color: #7B1F1F;
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 580px;
  margin: 2rem auto;
}

/* ===== CHATBOT — WIDGET BOUTON ===== */
#chatbot-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
}

#chatbot-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #8B4A30;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(44,26,16,0.28);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1;
}
#chatbot-trigger:hover,
#chatbot-trigger:focus-visible {
  background: #6B3520;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(44,26,16,0.32);
}

/* ===== CHATBOT — PANNEAU ===== */
#chatbot-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 360px;
  max-height: 70vh;
  background: #fff;
  border-radius: 18px;
  border: 1.5px solid #C8B5A8;
  box-shadow: 0 8px 32px rgba(44,26,16,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Animation d'apparition */
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#chatbot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ===== EN-TETE DU PANNEAU ===== */
.chatbot-panel-header {
  background: #2A3828;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.chatbot-header-title {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
  line-height: 1.2;
}
.chatbot-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.chatbot-close-btn:hover,
.chatbot-close-btn:focus-visible {
  color: #fff;
}

/* ===== ZONE DE MESSAGES ===== */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

/* Bulles de conversation */
.chatbot-bubble {
  max-width: 85%;
  padding: 0.65rem 0.95rem;
  font-size: 0.92rem;
  line-height: 1.52;
  word-break: break-word;
}
.chatbot-bubble--agent {
  background: #FAF5EF;
  border: 1px solid #C8B5A8;
  border-radius: 18px 18px 18px 4px;
  align-self: flex-start;
  color: #2C1A10;
  animation: chatBubbleIn 0.2s ease-out both;
}
.chatbot-bubble--user {
  background: #8B4A30;
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  align-self: flex-end;
  animation: chatBubbleIn 0.2s ease-out both;
}

@keyframes chatBubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== CARTES D'AIDE DANS LE CHAT ===== */
.chatbot-aide-card {
  background: #FAF5EF;
  border: 1.5px solid #C8B5A8;
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-self: stretch;
  animation: chatBubbleIn 0.2s ease-out both;
}
.chatbot-aide-nom {
  font-size: 0.92rem;
  font-weight: 700;
  color: #2C1A10;
  display: block;
  line-height: 1.3;
}
.chatbot-aide-resume {
  font-size: 0.83rem;
  color: #5C4038;
  line-height: 1.45;
  margin: 0;
}
.chatbot-aide-detail {
  align-self: flex-start;
  background: none;
  border: none;
  color: #8B4A30;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.15rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  line-height: 1;
}
.chatbot-aide-detail:hover,
.chatbot-aide-detail:focus-visible {
  color: #6B3520;
}

/* ===== ZONE DE REPONSES RAPIDES ===== */
.chatbot-quick-replies {
  padding: 0.65rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  border-top: 1px solid #C8B5A8;
  flex-shrink: 0;
  background: #fff;
  min-height: 3rem;
  align-items: center;
}
.chatbot-reply-btn {
  padding: 0.42rem 0.85rem;
  border: 2px solid #8B4A30;
  border-radius: 999px;
  background: #fff;
  color: #8B4A30;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.2;
}
.chatbot-reply-btn:hover,
.chatbot-reply-btn:focus-visible {
  background: #8B4A30;
  color: #fff;
}

/* ===== OVERLAY MOBILE ===== */
#chatbot-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,26,16,0.45);
  z-index: 999;
}
#chatbot-overlay.visible { display: block; }

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 480px) {
  .chatbot-trigger-label { display: none; }
  #chatbot-trigger { padding: 0.85rem; border-radius: 50%; }

  #chatbot-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    width: 100%;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    z-index: 1001;
  }
}

/* ===== IMPRESSION ===== */
@media print {
  #chatbot-widget,
  #chatbot-overlay { display: none !important; }
}

/* ===== MOUVEMENT REDUIT ===== */
@media (prefers-reduced-motion: reduce) {
  .chatbot-bubble,
  .chatbot-aide-card { animation: none; }
  #chatbot-panel,
  #chatbot-trigger { transition: none; }
}

/* ===== CHATBOT -- CHECKBOXES ===== */
.chatbot-checkbox-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
  width: 100%;
}

.chatbot-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1.5px solid #C8B5A8;
  background: #FFFFFF;
  font-size: 0.95rem;
  color: #2C1A10;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.chatbot-checkbox-label:hover {
  border-color: #8B4A30;
  background: #FAF5EF;
}

.chatbot-checkbox-label:has(input:checked) {
  border-color: #8B4A30;
  background: #FAF5EF;
  font-weight: 600;
}

.chatbot-checkbox {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #8B4A30;
  flex-shrink: 0;
  cursor: pointer;
}

.chatbot-confirm-btn {
  margin-top: 0.5rem;
  align-self: flex-start;
  background: #8B4A30 !important;
  color: #FFFFFF !important;
  font-weight: 700;
  border-radius: 999px;
}

.chatbot-confirm-btn:hover {
  background: #6E3822 !important;
}

/* ===== CHATBOT -- SAISIE LIBRE ===== */
.chatbot-saisie-form {
  display: flex;
  gap: 0.4rem;
  width: 100%;
}
.chatbot-saisie-input {
  flex: 1;
  border: 1.5px solid #C8B5A8;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  color: #2C1A10;
  font-family: inherit;
  background: #fff;
}
.chatbot-saisie-input:focus {
  outline: 2px solid #8B4A30;
  border-color: #8B4A30;
}
.chatbot-saisie-btn {
  background: #8B4A30;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  white-space: nowrap;
}
.chatbot-saisie-btn:hover { background: #6E3822; }
