/* Espace FDR : s'appuie sur app.css (jetons, champs, boutons, pastilles). */

.admin-shell { width: min(100% - 2rem, 62rem); margin: 1.5rem auto 3rem; }
.who { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.who-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border: 1px solid var(--indigo-100); background: var(--indigo-50); color: var(--indigo-800); border-radius: 999px; font-weight: 650; font-size: .9375rem; }
.who-pill .ico { width: 1.1em; height: 1.1em; }

.admin-nav { background: var(--cream); border-bottom: 1px solid var(--line); }
.tabs { list-style: none; display: flex; gap: .25rem; margin: 0 auto; padding: .35rem 0; width: min(100% - 2rem, 62rem); overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: .4rem .9rem; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.tabs a:hover { background: var(--paper); color: var(--indigo-800); }
.tabs a[aria-current="page"] { background: var(--paper); color: var(--indigo-900); box-shadow: inset 0 -3px 0 var(--indigo-600); border-radius: var(--r-sm) var(--r-sm) 0 0; }

.toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.toolbar .field:first-child { grid-column: span 2; }
@media (max-width: 34rem) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
  .toolbar .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 40rem) {
  .app-header-inner { flex-wrap: wrap; }
  .brand-name { white-space: nowrap; }
  .who { flex: 1 1 100%; justify-content: space-between; }
}

.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.table th { text-align: left; font-size: .875rem; color: var(--ink-2); font-weight: 700; padding: .75rem 1rem; background: var(--cream-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--indigo-50); }
.table .sub { display: block; font-size: .875rem; color: var(--ink-3); overflow-wrap: anywhere; }
.table td.num { font-variant-numeric: tabular-nums; }
@media (min-width: 48.01rem) {
  .table td:first-child, .table td[data-label="Statut"], .table td[data-label="Paiement"], .table td[data-label="Soumis le"] { white-space: nowrap; }
  .table td[data-label="Demandeur"] { min-width: 14rem; }
}
.table a { font-weight: 650; }
@media (max-width: 48rem) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: .2rem 0; display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; }
  .table td::before { content: attr(data-label); color: var(--ink-3); font-size: .875rem; }
}

.tabs .tabs-fin { margin-left: auto; }
.tabs a .ico { width: 1.05em; height: 1.05em; margin-right: .35rem; }

/* Connexion */
.connexion { max-width: 34rem; }
.connexion .panel { margin-bottom: 1rem; }

/* En-tête de page avec actions */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.page-head .title { margin: 0; }

/* Cartes de synthèse : un clic filtre la liste */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat-card { display: grid; gap: .15rem; text-align: left; padding: .85rem 1rem; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); font: inherit; color: var(--ink); cursor: pointer; transition: border-color .15s, background-color .15s; }
.stat-card:hover { border-color: var(--indigo-500); }
.stat-card.is-on { border-color: var(--indigo-600); background: var(--indigo-50); }
.stat-n { font-size: 1.75rem; font-weight: 800; color: var(--indigo-900); line-height: 1.1; }
.stat-l { font-size: .9375rem; color: var(--ink-2); font-weight: 600; }

/* Fiche dossier */
.liens-dossier { margin: -.25rem 0 1.25rem; }
.liens-dossier a { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; font-weight: 650; }
.actions-panel h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--indigo-800); margin: 1.25rem 0 .5rem; }
.recap-person dd a { display: inline-flex; align-items: center; gap: .3rem; }
.recap-person dd a .ico { width: 1em; height: 1em; }

/* Où en est ce dossier : les étapes, de la demande reçue à la famille prévenue, puis la prochaine à faire */
.avancement { margin-bottom: 1.25rem; }
.avancement h2 { margin-bottom: .75rem; }
.etapes { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(8.5rem, 100%), 1fr)); gap: .5rem; }
.etapes li { display: flex; align-items: flex-start; gap: .45rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--cream); color: var(--ink-2); font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.etapes li.is-done { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.etapes li.is-current { background: var(--paper); border-color: var(--indigo-500); color: var(--indigo-900); box-shadow: inset 0 -3px 0 var(--indigo-600); }
.etapes .ico { flex: none; width: 1.15rem; height: 1.15rem; margin-top: .05rem; }
.etapes .pastille { flex: none; display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; margin-top: .05rem; border: 1.5px solid currentColor; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.avancement .callout { margin: 0; }

/* Parcours RPN : une étape par carte, la courante mise en avant */
.rpn { margin-bottom: 1.25rem; }
.rpn-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.rpn-steps > li { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); }
.rpn-steps > li.is-current { border-color: var(--indigo-500); background: var(--paper); box-shadow: inset 4px 0 0 var(--indigo-600); }
.rpn-steps > li.is-done { background: var(--ok-bg); border-color: var(--ok-line); }
.rpn-steps h3 { display: flex; align-items: center; gap: .45rem; font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--indigo-900); margin: 0 0 .5rem; }
.rpn-steps h3 .ico.ok { color: var(--ok); }
.rpn-steps p { margin: 0 0 .6rem; }
.rpn-steps details { margin: 0 0 .75rem; }
.rpn-steps summary { cursor: pointer; font-weight: 650; color: var(--indigo-700); min-height: 44px; display: flex; align-items: center; }
.rpn-steps.is-locked > li { padding: .7rem 1rem; }
.rpn-steps.is-locked h3 { margin: 0; color: var(--ink-2); font-weight: 650; }
.rpn-steps.is-locked h3 .ico { color: var(--ink-3); }
.consignes { margin: 0 0 .6rem; padding-left: 1.2rem; display: grid; gap: .3rem; }

/* Fiche du chef de famille pour RPN : une valeur par ligne, chacune avec son bouton « Copier » */
.fiche-rpn { width: 100%; border-collapse: collapse; margin: .25rem 0 .5rem; font-size: .9375rem; }
.fiche-rpn tr + tr { border-top: 1px solid var(--line); }
.fiche-rpn th { padding: .3rem .75rem .3rem 0; text-align: left; font-weight: 600; color: var(--ink-2); vertical-align: middle; }
.fiche-rpn td { padding: .3rem .5rem .3rem 0; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: break-word; vertical-align: middle; }
.fiche-rpn td:last-child { width: 1%; padding-right: 0; text-align: right; white-space: nowrap; }
@media (min-width: 34.01rem) { .fiche-rpn th { white-space: nowrap; } }
/* Téléphone : le libellé au-dessus, la valeur et son bouton dessous. */
@media (max-width: 34rem) {
  .fiche-rpn, .fiche-rpn tbody { display: block; }
  .fiche-rpn tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .5rem; padding: .4rem 0; }
  .fiche-rpn th { grid-column: 1 / -1; padding: 0; font-size: .8125rem; }
  .fiche-rpn td { padding: 0; }
  .fiche-rpn td:last-child { width: auto; }
}
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.inline-form .field { flex: 1 1 14rem; max-width: 20rem; }
.inline-form .err { flex: 1 1 100%; margin: 0; }

.ajout-admin { margin-top: 1.25rem; }
.journal-filtre { grid-template-columns: minmax(0, 1fr); }
.journal-filtre .field:first-child { grid-column: auto; }

.demo-tools { margin-top: 1.25rem; }
.crumb { margin: 0 0 .75rem; }
.dossier-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.dossier-head .title { margin-bottom: .2rem; font-variant-numeric: tabular-nums; }
.dossier-head .lead { margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.actions-panel { margin-bottom: 1.25rem; }
.decision { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; max-width: 36rem; }
.decision h3 { font-family: var(--font-body); font-size: 1.0625rem; font-weight: 700; color: var(--indigo-900); }
textarea.input { resize: vertical; min-height: 5.5rem; line-height: 1.45; }
.sig-img { max-height: 6rem; margin-top: .75rem; }
.plain { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.mail-body { margin: .75rem 0 0; padding-top: .75rem; border-top: 1px solid var(--line); white-space: pre-line; color: var(--ink-2); }
.mail .kv { margin: 0; }
.admin .shell { margin-top: 1.5rem; }
