/* ==================================================================
   Portail Judiciaire Inter-Services — écrans ajoutés
   Connexion Discord · choix du service · transmissions · mandats
   d'arrêt · journal d'activité · thème par service.
===================================================================*/

:root {
  /* Couleur du service actif, injectée au moment de la connexion. */
  --service-color: #1b3a6b;
}

/* ------------------------------------------------------------------
   Écran de chargement
-------------------------------------------------------------------*/

.boot-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f4f5f8;
  padding: 24px;
}

.boot-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 32px 40px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 6px 22px rgba(15, 30, 60, 0.08);
}

.boot-card .rf-flag {
  margin: 0 auto 16px;
}

.boot-card strong {
  display: block;
  font-size: 17px;
  color: var(--gn-dark);
  margin-bottom: 8px;
}

.boot-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------
   Connexion Discord
-------------------------------------------------------------------*/

.auth-intro {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #4a5061;
}

.auth-error {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-left: 4px solid var(--danger);
  background: #fbeaea;
  color: #8a2222;
  font-size: 13px;
  line-height: 1.5;
}

.discord-login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 18px;
  border: none;
  border-radius: 4px;
  background: #5865f2;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.discord-login-btn:hover {
  background: #4752c4;
}

.discord-mark {
  width: 26px;
  height: 20px;
  flex: none;
}

.auth-services-note {
  margin-top: 22px;
}

.auth-services-note p {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-services {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-services li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fc;
  font-size: 13px;
  color: #2b4a75;
}

.auth-procedure {
  margin-top: 22px;
}

/* ------------------------------------------------------------------
   Choix du service
-------------------------------------------------------------------*/

.service-page {
  min-height: 100vh;
  background: #f4f5f8;
  padding: 40px 24px 32px;
}

.service-page-header {
  max-width: 1080px;
  margin: 0 auto 28px;
  text-align: center;
}

.service-page-header .rf-flag {
  margin: 0 auto 14px;
}

.service-page-header h1 {
  margin: 0 0 8px;
  font-size: 26px;
  color: var(--gn-dark);
}

.service-page-header p {
  margin: 0 auto;
  max-width: 620px;
  font-size: 14px;
  line-height: 1.6;
  color: #4a5061;
}

.service-identity {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: left;
}

.service-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8ecf3;
}

.service-identity strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.service-identity span {
  font-size: 12px;
  color: var(--muted);
}

.service-cards {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.service-card {
  --service-color: #1b3a6b;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--service-color);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 3px 12px rgba(15, 30, 60, 0.05);
}

.service-card.empty {
  grid-column: 1 / -1;
  border-top-color: var(--warning);
  text-align: center;
}

.service-card header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service-card-logo {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  background: #f4f6fa;
  border-radius: 6px;
  overflow: hidden;
}

.service-card-logo img {
  max-width: 32px;
  max-height: 32px;
  object-fit: contain;
}

.service-card header strong {
  display: block;
  font-size: 15px;
  color: var(--service-color);
}

.service-card header span {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.service-card-badge {
  margin-left: auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--service-color);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.service-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-bottom: 7px;
  border-bottom: 1px dashed #e6e9ef;
}

.service-card-row span {
  color: var(--muted);
}

.service-card-row strong {
  text-align: right;
}

.service-card-hint {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #6a7080;
}

.service-card footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-card footer .btn,
.service-card footer .admin-button {
  flex: 1;
}

.service-card-waiting {
  flex: 1;
  text-align: center;
  padding: 10px;
  border: 1px dashed var(--warning);
  border-radius: 4px;
  color: #8a6413;
  font-size: 13px;
  font-weight: 700;
}

.service-page-footer {
  max-width: 1080px;
  margin: 28px auto 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Statuts d'habilitation */
.status-pill.approved {
  color: #23724b;
  background: #e5f5ed;
}

.status-pill.rejected,
.status-pill.revoked {
  color: #9a3d3d;
  background: #f9e5e5;
}

/* ------------------------------------------------------------------
   Bandeau et barre latérale : identité du service
-------------------------------------------------------------------*/

.portal-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.portal-brand-text strong {
  font-size: 14px;
}

.portal-brand-text span {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
}

.avatar.avatar-photo {
  background-size: cover;
  background-position: center;
}

.patron-tag {
  color: var(--service-color);
  font-weight: 700;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.admin-grid.single {
  grid-template-columns: 1fr;
}

.access-explainer {
  margin-bottom: 20px;
}

.membership-edit-card {
  margin-top: 20px;
}

.pj-pill.service-pill {
  border-color: var(--service-color);
  color: var(--service-color);
  font-weight: 700;
}

/* ------------------------------------------------------------------
   Transmissions au tribunal
-------------------------------------------------------------------*/

.transmission-group,
.warrant-group {
  margin-bottom: 26px;
}

.transmission-group > h2,
.warrant-group > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--gn-dark);
}

.group-count {
  padding: 2px 9px;
  border-radius: 999px;
  background: #e9edf4;
  color: #43536e;
  font-size: 12px;
  font-weight: 700;
}

.transmission-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--service-color);
  border-radius: 5px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.transmission-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.transmission-card header strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.transmission-card header span {
  font-size: 12px;
  color: var(--muted);
}

.court-pill {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.court-pill.none {
  background: #eef0f4;
  color: #5c6478;
}

.court-pill.transmitted {
  background: #e7f0fb;
  color: #1f5590;
}

.court-pill.under_review {
  background: #fff4d9;
  color: #8a6413;
}

.court-pill.accepted {
  background: #e5f5ed;
  color: #23724b;
}

.court-pill.returned {
  background: #f9e5e5;
  color: #9a3d3d;
}

.transmission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: #5c6478;
  margin-bottom: 10px;
}

.transmission-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f6f8fb;
  border-left: 3px solid #c8d3e2;
  font-size: 13px;
  line-height: 1.5;
}

.transmission-note.court {
  border-left-color: var(--warning);
  background: #fffaf0;
}

.transmission-note span {
  font-weight: 700;
  color: #43536e;
}

.transmission-actions,
.warrant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ------------------------------------------------------------------
   Mandats d'arrêt
-------------------------------------------------------------------*/

.warrant-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 22px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.warrant-toolbar h2 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--gn-dark);
}

.warrant-toolbar p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.warrant-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid #8d1f2e;
  border-radius: 5px;
  padding: 18px;
  margin-bottom: 14px;
}

.warrant-card.status-executed {
  border-left-color: var(--success);
}

.warrant-card.status-cancelled,
.warrant-card.status-expired {
  border-left-color: var(--muted);
  opacity: 0.85;
}

.warrant-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edeff4;
  margin-bottom: 14px;
}

.warrant-card header strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #8d1f2e;
}

.warrant-card header span {
  font-size: 12px;
  color: var(--muted);
}

.warrant-pill {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.warrant-pill.active {
  background: #fbe6e6;
  color: #8d1f2e;
}

.warrant-pill.executed {
  background: #e5f5ed;
  color: #23724b;
}

.warrant-pill.cancelled,
.warrant-pill.expired {
  background: #eef0f4;
  color: #5c6478;
}

.warrant-subject {
  margin-bottom: 14px;
}

.warrant-subject span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.warrant-subject strong {
  font-size: 18px;
  color: var(--text);
}

.warrant-subject small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.warrant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
  margin-bottom: 14px;
}

.warrant-grid > div span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.warrant-grid > div strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.warrant-motivation {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f6f8fb;
  border-left: 3px solid #c8d3e2;
  font-size: 13px;
  line-height: 1.55;
}

.warrant-motivation span {
  font-weight: 700;
  color: #43536e;
}

.warrant-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #5c6478;
}

.warrant-form .pj-form-block {
  margin-bottom: 22px;
}

/* ------------------------------------------------------------------
   Accès restreint à une procédure
-------------------------------------------------------------------*/

.pj-pill.access-restricted-pill {
  background: #fbe6e6;
  color: #8d1f2e;
  font-weight: 700;
}

.access-form h2 small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.access-rule-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.access-rule-toggle input,
.access-member input {
  width: auto;
}

.access-rule-body {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 3px solid #c8d3e2;
}

.access-rule-body.hidden,
.access-member.hidden {
  display: none !important;
}

.access-rule-members > span {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  font-weight: 600;
}

.access-member-list {
  max-height: 240px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.access-member {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid #edeff4;
  font-size: 13px;
  cursor: pointer;
}

.access-member:last-child {
  border-bottom: 0;
}

.access-member small {
  display: block;
  color: var(--muted);
}

.access-rule-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.warrant-form-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.warrant-procedure-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.warrant-procedure-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: #fbe6e6;
  color: #8d1f2e;
  font-size: 12px;
  font-weight: 700;
}

.warrant-procedure-chip em {
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.warrant-procedure-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.warrant-procedure-list {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.warrant-procedure-option {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #edeff4;
  font-size: 13px;
  cursor: pointer;
}

.warrant-procedure-option:last-child {
  border-bottom: 0;
}

.warrant-procedure-option.hidden {
  display: none !important;
}

.warrant-procedure-option input {
  width: auto;
  margin-top: 3px;
}

.warrant-procedure-option small {
  display: block;
  color: var(--muted);
}

.warrant-subject-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.warrant-subject-choices.hidden {
  display: none;
}

.warrant-subject-choice small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: 0.8;
}

/* ------------------------------------------------------------------
   Journal d'activité
-------------------------------------------------------------------*/

.audit-table-wrap {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th,
.audit-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #edeff4;
  white-space: nowrap;
}

.audit-table th {
  background: #f6f8fb;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5c6478;
}

.audit-table tbody tr:last-child td {
  border-bottom: none;
}

.audit-detail {
  white-space: normal;
  color: #5c6478;
}

/* ------------------------------------------------------------------
   Adaptations mobiles
-------------------------------------------------------------------*/

@media (max-width: 760px) {
  .service-page {
    padding: 24px 14px;
  }

  .transmission-card header,
  .warrant-card header {
    flex-direction: column;
  }

  .warrant-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ------------------------------------------------------------------
   Liste blanche : administration complète du portail
-------------------------------------------------------------------*/

.super-admin-banner {
  margin: 12px 0;
  padding: 9px 12px;
  border-left: 4px solid #8d1f2e;
  background: #fbe6e6;
  color: #8d1f2e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

/* ------------------------------------------------------------------
   Transmissions inter-services
-------------------------------------------------------------------*/

.share-group {
  margin-bottom: 26px;
}

.share-group > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--gn-dark);
}

.share-hint {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.share-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--service-color);
  border-radius: 5px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.share-card.status-declined,
.share-card.status-revoked {
  border-left-color: var(--muted);
  opacity: 0.85;
}

.share-card.status-accepted {
  border-left-color: var(--success);
}

.share-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.share-card header strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.share-card header span {
  font-size: 12px;
  color: var(--muted);
}

.share-pill {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.share-pill.pending {
  background: #fff4d9;
  color: #8a6413;
}

.share-pill.accepted {
  background: #e5f5ed;
  color: #23724b;
}

.share-pill.declined,
.share-pill.revoked {
  background: #eef0f4;
  color: #5c6478;
}

.share-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: #5c6478;
  margin-bottom: 10px;
}

.share-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f6f8fb;
  border-left: 3px solid #c8d3e2;
  font-size: 13px;
  line-height: 1.5;
}

.share-note.declined {
  border-left-color: var(--danger);
  background: #fdf4f4;
}

.share-note span {
  font-weight: 700;
  color: #43536e;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pj-pill.share-in-pill {
  border-color: #8a6413;
  color: #8a6413;
  font-weight: 700;
}

.pj-pill.share-out-pill {
  border-color: #23724b;
  color: #23724b;
  font-weight: 700;
}

@media (max-width: 760px) {
  .share-card header {
    flex-direction: column;
  }
}

/* ------------------------------------------------------------------
   ALERTE MANDAT D'ARRÊT
   Elle doit se voir avant toute autre chose : rouge, en tête de
   formulaire, impossible à confondre avec une aide de saisie.
-------------------------------------------------------------------*/

.warrant-alert {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #fdecec;
  border: 2px solid #c1121f;
  border-left-width: 6px;
  color: #7d0a12;
}

.warrant-alert-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 15px;
}

.warrant-alert-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c1121f;
  color: #ffffff;
  font-weight: 900;
}

.warrant-alert-list {
  margin: 0;
  padding-left: 34px;
  font-size: 13px;
  line-height: 1.55;
}

.warrant-alert-list li + li {
  margin-top: 8px;
}

.warrant-alert-foot {
  margin: 10px 0 0 34px;
  font-size: 12px;
  font-style: italic;
}

/* ------------------------------------------------------------------
   CHAMPS AUTOMATIQUES ET OBLIGATOIRES
-------------------------------------------------------------------*/

.field-required {
  color: #c1121f;
  font-weight: 700;
}

.document-builder-fields label.field-auto input,
input.field-auto {
  background: #f2f4f7;
  color: #45526b;
  cursor: default;
}

/* Valeur reprise du registre commun : signalée sans être criarde. */
.field-from-registry {
  background: #eef7f1 !important;
  box-shadow: inset 0 0 0 1px #9fc9b0;
}

/* Acte renvoyé au rédacteur : à corriger puis à resoumettre. */
.pj-pill.rejected-label {
  border-color: #c9302c;
  background: #fdecea;
  color: #96201d;
  font-weight: 700;
}

.pj-pill.incomplete-pill {
  border-color: #b3711a;
  background: #fff6e6;
  color: #8a5410;
  font-weight: 700;
  cursor: help;
}

/* ------------------------------------------------------------------
   MOTIFS D'INFRACTION — NATINF
-------------------------------------------------------------------*/

.offense-section {
  border-top: 2px solid var(--service-color);
}

.offense-list {
  margin: 0 0 16px;
}

.offense-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.offense-row {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--service-color);
}

.offense-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.offense-row-head strong {
  display: block;
  font-size: 14px;
}

.offense-row-head span {
  font-size: 12px;
  color: var(--muted);
}

.offense-row-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}

.offense-row-fields label.wide {
  grid-column: 1 / -1;
}

.offense-row-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.offense-row-fields input {
  padding: 7px 9px;
  border: 1px solid var(--line);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.offense-legal {
  margin: 10px 0 0;
  font-size: 12px;
  color: #5c6478;
}

/* Le sélecteur : arbre décisionnel, recherche, saisie libre. */
.offense-picker {
  border: 1px solid var(--line);
  background: #fbfcfd;
}

.offense-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.offense-tab {
  flex: 1;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.offense-tab:last-child {
  border-right: 0;
}

.offense-tab.active {
  background: #ffffff;
  color: var(--service-color);
  box-shadow: inset 0 -3px 0 var(--service-color);
}

.offense-pane {
  padding: 14px;
}

.offense-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.offense-crumb {
  padding: 3px 7px;
  background: none;
  border: 0;
  color: var(--service-color);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.offense-crumb.current {
  color: var(--text);
  cursor: default;
  text-decoration: none;
}

.offense-crumb-sep {
  color: var(--muted);
}

.offense-tree-list {
  display: grid;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}

.offense-branch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.offense-branch:hover {
  border-color: var(--service-color);
  background: #f6f9fc;
}

.offense-branch-arrow {
  color: var(--muted);
  font-size: 16px;
}

.offense-branch-offenses {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.offense-candidate {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.offense-candidate:hover {
  border-color: var(--success);
  background: #f3faf6;
}

.offense-candidate-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.offense-candidate-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.offense-candidate-legal {
  color: #5c6478;
  font-size: 11px;
  font-style: italic;
}

.offense-manual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.offense-manual-grid label.wide {
  grid-column: span 2;
}

/* ------------------------------------------------------------------
   PHOTOGRAPHIES
-------------------------------------------------------------------*/

.media-upload {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.media-item {
  position: relative;
  margin: 0;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--line);
}

.media-item img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.media-item figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  font-size: 12px;
}

.media-item figcaption small {
  color: var(--muted);
  font-size: 10.5px;
}

.media-item .media-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

/* ------------------------------------------------------------------
   MANDATS DE PERQUISITION
-------------------------------------------------------------------*/

.search-warrant-group {
  margin-bottom: 26px;
}

.search-warrant-group > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--gn-dark);
}

.search-warrant-card {
  margin: 0 0 12px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid #b3711a;
}

.search-warrant-card.status-granted {
  border-left-color: var(--success);
}

.search-warrant-card.status-refused,
.search-warrant-card.status-cancelled {
  border-left-color: var(--danger);
  opacity: 0.9;
}

.search-warrant-card.status-executed {
  border-left-color: var(--muted);
}

.search-warrant-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.search-warrant-card header strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.search-warrant-card header span {
  font-size: 12px;
  color: var(--muted);
}

.search-warrant-pill {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.search-warrant-pill.pending {
  background: #fff4d9;
  color: #8a6413;
}

.search-warrant-pill.granted {
  background: #e5f5ed;
  color: #23724b;
}

.search-warrant-pill.refused,
.search-warrant-pill.cancelled {
  background: #f9e5e5;
  color: #9a3d3d;
}

.search-warrant-pill.executed,
.search-warrant-pill.expired {
  background: #eef0f4;
  color: #5c6478;
}

.search-warrant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  margin-bottom: 12px;
}

.search-warrant-grid > div span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-warrant-grid > div strong {
  font-size: 13px;
}

.search-warrant-note {
  margin: 0 0 10px;
  padding: 9px 12px;
  background: #f6f8fb;
  border-left: 3px solid #c8d3e2;
  font-size: 13px;
  line-height: 1.5;
}

.search-warrant-note.decision {
  border-left-color: #b3711a;
  background: #fffaf0;
}

.search-warrant-note span {
  font-weight: 700;
  color: #43536e;
}

.search-warrant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #5c6478;
}

.search-warrant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ------------------------------------------------------------------
   RECHERCHE D'INDIVIDU
-------------------------------------------------------------------*/

.person-search {
  margin-bottom: 20px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.person-search label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.person-search input {
  padding: 11px 13px;
  border: 1px solid var(--line);
  font-size: 15px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.person-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.person-card {
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--service-color);
}

.person-card.wanted {
  border-left-color: #c1121f;
  background: #fffafa;
}

.person-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.person-card header strong {
  display: block;
  font-size: 15px;
}

.person-card header span {
  font-size: 12px;
  color: var(--muted);
}

.person-wanted-pill {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #c1121f;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #5c6478;
}

.person-file {
  margin-bottom: 22px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.person-file > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  color: var(--gn-dark);
}

.person-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 20px;
}

.person-procedures {
  display: grid;
  gap: 8px;
}

.person-procedure {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
}

.person-procedure.locked {
  background: #f7f8fa;
}

.person-procedure strong {
  display: block;
  font-size: 14px;
}

.person-procedure span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.person-procedure small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.person-procedure-locked {
  flex: none;
  padding: 5px 10px;
  background: #eef0f4;
  color: #5c6478;
  font-size: 11.5px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .offense-row-fields,
  .offense-manual-grid,
  .media-upload {
    grid-template-columns: 1fr;
  }

  .offense-manual-grid label.wide {
    grid-column: auto;
  }

  .person-procedure {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------------------------------------------
   P.V. D'INTERPELLATION

   Meme charte que le proces-verbal d'audition : c'est le meme type
   d'acte. Seul un lisere le distingue au premier coup d'oeil.
-------------------------------------------------------------------*/

.pvi-pv-sheet {
  border-top: 3px solid #6a3d9a;
}

.pvi-pv-sheet .audition-pv-title p {
  color: #6a3d9a;
}

.pvi-icon-circle {
  color: #6a3d9a;
}

/* Une seule categorie ouverte : le bandeau ne fait pas la parade. */
.module-strip-single {
  justify-content: flex-start;
}

.module-bubble.hidden {
  display: none;
}

/* ------------------------------------------------------------------
   ESPACE PREFECTURE

   Une saisine n'est pas une procedure judiciaire : la couleur la
   distingue des actes, et le fil de discussion se lit comme une
   correspondance, emetteur a gauche, prefecture a droite.
-------------------------------------------------------------------*/

.prefecture-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prefecture-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #d5d9e2;
  border-left: 4px solid #4a4f63;
  background: #fff;
}

.prefecture-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.prefecture-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: #5b6478;
  font-size: 12.5px;
}

.prefecture-card-actions {
  flex: 0 0 auto;
}

.prefecture-closing {
  margin: 10px 0 0;
  color: #8a5410;
  font-size: 12.5px;
}

.pj-pill.prefecture-urgent {
  border-color: #c9302c;
  background: #fdecea;
  color: #96201d;
  font-weight: 700;
}

.pj-pill.prefecture-status-received {
  border-color: #4a4f63;
  background: #eef0f5;
  color: #3a3f52;
}

.pj-pill.prefecture-status-in_progress {
  border-color: #b3711a;
  background: #fff6e6;
  color: #8a5410;
}

.pj-pill.prefecture-status-answered {
  border-color: #1e7a4d;
  background: #e8f5ee;
  color: #14603b;
}

.pj-pill.prefecture-status-closed {
  border-color: #8a8f9c;
  background: #f2f3f6;
  color: #5b6478;
}

.prefecture-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #5b6478;
}

.prefecture-filter select {
  padding: 6px 10px;
  border: 1px solid #c9cedb;
  background: #fff;
}

/* --- La saisine ouverte ------------------------------------------- */

.prefecture-detail {
  border: 1px solid #d5d9e2;
  border-top: 3px solid #4a4f63;
  background: #fff;
  padding: 20px 22px;
}

.prefecture-detail > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e4e7ee;
}

.prefecture-detail > header h2 {
  margin: 4px 0 0;
  font-size: 19px;
}

.prefecture-detail-kicker {
  margin: 0;
  color: #5b6478;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prefecture-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 20px;
  margin: 16px 0 0;
}

.prefecture-detail-grid dt {
  color: #5b6478;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prefecture-detail-grid dd {
  margin: 3px 0 0;
  font-size: 13.5px;
}

/* --- Le fil --------------------------------------------------------- */

.prefecture-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid #e4e7ee;
}

.prefecture-message {
  max-width: 78%;
  padding: 12px 14px;
  border: 1px solid #d5d9e2;
  background: #f7f8fb;
}

.prefecture-message-prefecture {
  align-self: flex-end;
  border-color: #b9bfd0;
  background: #eef0f5;
}

.prefecture-message header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #5b6478;
}

.prefecture-message header strong {
  color: #1b2233;
  font-size: 12.5px;
}

.prefecture-message p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
}

.prefecture-reply {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e4e7ee;
}

.prefecture-reply textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c9cedb;
  font: inherit;
  resize: vertical;
}

.prefecture-closed-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px solid #c9cedb;
  background: #f2f3f6;
  color: #5b6478;
  font-size: 13px;
}

.prefecture-decision {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e4e7ee;
}

.prefecture-decision h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5b6478;
}

@media (max-width: 760px) {
  .prefecture-card {
    flex-direction: column;
  }

  .prefecture-message {
    max-width: 100%;
  }
}

/* ==================================================================
   V11 — PIECES JOINTES, FAVORIS NATINF, PROPOSITIONS D'IDENTITE
         ET CLASSEMENT DES ENQUETES
===================================================================*/

/* Texte reserve aux lecteurs d'ecran. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.small-action.danger {
  background: #fdeceb;
  color: #b3352f;
}

.small-action.danger:hover {
  background: #f9d9d7;
}

/* ------------------------------------------------------------------
   NUMERO DE PROCEDURE RESERVE

   Le numero est retenu par le portail des l'ouverture du
   formulaire : le champ le montre comme un acquis, et non comme une
   saisie qui reste a faire.
-------------------------------------------------------------------*/

.document-number-locked {
  background: #f1f4f9;
  color: #1b2233;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: default;
}

/* ------------------------------------------------------------------
   PROPOSITIONS D'IDENTITE PENDANT LA FRAPPE
-------------------------------------------------------------------*/

.identity-suggest-host {
  position: relative;
}

.identity-suggest {
  position: absolute;
  z-index: 40;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #c9cedb;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.identity-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #eef0f5;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.identity-suggest-item:last-child {
  border-bottom: 0;
}

.identity-suggest-item:hover,
.identity-suggest-item.active {
  background: #eef4fb;
}

.identity-suggest-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1b2233;
}

.identity-suggest-wanted {
  padding: 1px 6px;
  background: #fdeceb;
  border: 1px solid #e7b3af;
  color: #b3352f;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
}

.identity-suggest-meta {
  font-size: 11.5px;
  color: #5b6478;
}

/* ------------------------------------------------------------------
   FAVORIS NATINF
-------------------------------------------------------------------*/

.offense-candidate-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.offense-candidate-row .offense-candidate {
  flex: 1 1 auto;
  min-width: 0;
}

.offense-favorite-toggle {
  flex: 0 0 auto;
  width: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #a8adba;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.offense-favorite-toggle:hover {
  color: #d89b22;
  border-color: #d89b22;
}

.offense-favorite-toggle.is-favorite {
  color: #d89b22;
  border-color: #e2bd72;
  background: #fdf6e6;
}

.offense-row-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.offense-row-buttons .offense-favorite-toggle {
  width: 30px;
  padding: 4px 0;
  font-size: 15px;
}

/* ------------------------------------------------------------------
   MOTIFS RETENUS EN CONSULTATION

   Une procedure en retient souvent plusieurs : ils figurent tous,
   avec leur date et leur lieu de commission.
-------------------------------------------------------------------*/

.offences-plate {
  margin-top: 18px;
}

.offences-plate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.offences-plate-table th,
.offences-plate-table td {
  padding: 7px 9px;
  border: 1px solid #d7d9df;
  text-align: left;
  vertical-align: top;
}

.offences-plate-table thead th {
  background: #f2f4f8;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b6478;
}

.offences-plate-table td small {
  display: block;
  margin-top: 3px;
  color: #5b6478;
  font-size: 11px;
}

.gav-pv-side-offences {
  margin: 0;
  padding: 0;
  list-style: none;
}

.gav-pv-side-offences li {
  margin-bottom: 7px;
  padding-bottom: 6px;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.18);
  font-size: 11.5px;
  line-height: 1.35;
}

.gav-pv-side-offences li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.gav-pv-side-offences span {
  display: block;
  margin-top: 2px;
  opacity: 0.8;
  font-size: 10.5px;
}

/* ------------------------------------------------------------------
   CLASSEMENT DES ENQUETES
-------------------------------------------------------------------*/

.investigation-sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.investigation-sort-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b6478;
}

.investigation-sort-bar select {
  min-width: 190px;
  padding: 7px 9px;
  border: 1px solid #c9cedb;
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.investigation-sort-count {
  margin-left: auto;
  padding-bottom: 8px;
  font-size: 12px;
  color: #5b6478;
}

.pj-pill.investigation-open {
  background: #eaf4ec;
  border: 1px solid #b7d9c1;
  color: #226b41;
}

.pj-pill.investigation-classified {
  background: #eef0f5;
  border: 1px solid #c3c8d6;
  color: #4a5166;
}

.pj-pill.investigation-state {
  background: #eef4fb;
  border: 1px solid #b9cfe8;
  color: #2b70ad;
}

.pj-pill.investigation-priority {
  background: #fdf1e3;
  border: 1px solid #e7c79b;
  color: #9b6212;
}

/* ------------------------------------------------------------------
   PIECES JOINTES D'UNE SAISINE DE PREFECTURE
-------------------------------------------------------------------*/

.pj-pill.prefecture-pieces {
  background: #eef4fb;
  border: 1px solid #b9cfe8;
  color: #2b70ad;
}

.prefecture-attach-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prefecture-attach-field > span {
  font-size: 12px;
  font-weight: 700;
  color: #1b2233;
}

.prefecture-pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prefecture-pending-file {
  padding: 4px 8px;
  background: #eef0f5;
  border: 1px solid #d5d9e2;
  font-size: 11.5px;
}

.prefecture-pieces-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e4e7ee;
}

.prefecture-pieces-head h3 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5b6478;
}

.prefecture-pieces-head .pj-hint {
  margin: 0 0 12px;
}

.prefecture-attach-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.prefecture-attach-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: #5b6478;
}

.prefecture-attach-caption input {
  padding: 8px 10px;
  border: 1px solid #c9cedb;
  font: inherit;
}

.prefecture-pieces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.prefecture-piece {
  position: relative;
  margin: 0;
  background: #ffffff;
  border: 1px solid var(--line);
}

.prefecture-piece-open {
  display: block;
  width: 100%;
  height: 132px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #f2f4f8;
  cursor: zoom-in;
}

.prefecture-piece-open img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
}

.prefecture-piece-kind {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5b6478;
}

.prefecture-piece-pdf .prefecture-piece-kind {
  background: #fdeceb;
  color: #b3352f;
}

.prefecture-piece-text .prefecture-piece-kind {
  background: #eef4fb;
  color: #2b70ad;
}

.prefecture-piece figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  font-size: 12px;
}

.prefecture-piece figcaption small {
  color: var(--muted);
  font-size: 10.5px;
}

.prefecture-piece-actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px;
}

.prefecture-pieces-empty {
  margin: 0;
  padding: 12px 14px;
  background: #f7f8fb;
  border: 1px dashed #d5d9e2;
  color: #5b6478;
  font-size: 13px;
}

/* ------------------------------------------------------------------
   VISIONNEUSE DE PIECE JOINTE

   La piece s'affiche dans le portail : l'API la sert en « inline »,
   il n'y a rien a telecharger pour savoir ce qu'elle contient.
-------------------------------------------------------------------*/

.attachment-preview {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(11, 16, 28, 0.78);
}

.attachment-preview-frame {
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  max-height: 100%;
  margin: 0;
  background: #ffffff;
  border: 1px solid #0b101c;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.attachment-preview-frame > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f8fb;
}

.attachment-preview-frame > header strong {
  display: block;
  font-size: 13.5px;
  color: #1b2233;
}

.attachment-preview-frame > header span {
  font-size: 11.5px;
  color: #5b6478;
}

.attachment-preview-controls {
  display: flex;
  gap: 6px;
}

.attachment-preview-body {
  flex: 1 1 auto;
  /* Une note de trois lignes n'ouvre pas une fenetre vide. */
  min-height: 180px;
  overflow: auto;
  padding: 14px 16px;
  background: #eef0f5;
}

.attachment-preview-body img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  margin: 0 auto;
  background: #ffffff;
}

.attachment-preview-body iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 420px;
  border: 0;
  background: #ffffff;
}

.attachment-preview-text {
  margin: 0;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .prefecture-attach-row {
    grid-template-columns: 1fr;
  }

  .investigation-sort-bar select {
    min-width: 0;
    width: 100%;
  }

  .investigation-sort-count {
    margin-left: 0;
  }

  .attachment-preview {
    padding: 10px;
  }
}

@media print {
  /* Ni la visionneuse ni les outils de tri ne font partie de l'acte. */
  .attachment-preview,
  .investigation-sort-bar,
  .identity-suggest {
    display: none !important;
  }
}

/* ==================================================================
   DOSSIERS D'ENQUÊTE, TRIBUNAL, IDENTITÉS, PORTAIL EN JEU (2026-10)
===================================================================*/

/* --- Formulaire : préremplissage, questions / réponses ------------- */

.prefill-note {
  border-left: 4px solid var(--gn-blue);
}

.qa-builder {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
}

.qa-builder-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.qa-list {
  display: grid;
  gap: 10px;
}

.qa-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gn-blue);
  background: var(--sidebar);
}

.qa-row header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qa-row header strong {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gn-dark);
}

.qa-row label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.qa-builder > .pj-button {
  justify-self: start;
}

.natinf-attribution {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.natinf-attribution a,
.login-footer-data a {
  color: inherit;
  text-decoration: underline;
}

/* --- Consultation : dossier de rattachement ----------------------- */

.investigation-link-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 auto 14px;
  max-width: var(--doc-width, 820px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #5b36a3;
  background: var(--sidebar);
  font-size: 13px;
}

.investigation-link-banner > span {
  font-weight: 700;
  color: var(--text);
}

.investigation-link-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 5px 11px;
  border: 1px solid #d9d2ef;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.investigation-link-chip:hover {
  border-color: #5b36a3;
}

.investigation-link-chip strong {
  font-size: 13px;
}

.investigation-link-chip small {
  font-size: 11px;
  color: var(--muted);
}

button.investigation-link-pill {
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  border-color: #d9d2ef;
  color: #5b36a3;
}

button.investigation-link-pill:hover {
  border-color: #5b36a3;
}

/* --- Liste des dossiers : vues rapides ----------------------------- */

.investigation-quick-views {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.investigation-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sidebar);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.investigation-view-btn span {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--page);
  font-size: 11px;
  text-align: center;
}

.investigation-view-btn.active {
  border-color: var(--gn-blue);
  background: var(--gn-blue);
  color: #ffffff;
}

.investigation-view-btn.active span {
  background: rgba(255, 255, 255, 0.22);
}

/* --- Échanges avec le tribunal ------------------------------------- */

.court-thread {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.court-thread-panel {
  max-width: var(--doc-width, 820px);
  margin: 18px auto 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--sidebar);
}

.court-thread-panel > h3 {
  margin: 0;
  font-size: 15px;
}

.court-thread-panel .court-thread {
  border-top: 0;
  padding-top: 0;
}

.court-thread-messages {
  display: grid;
  gap: 8px;
}

.court-message {
  max-width: 88%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--page);
}

.court-message.from-court {
  justify-self: start;
  border-left: 4px solid #7a2e2e;
}

.court-message.from-service {
  justify-self: end;
  border-right: 4px solid var(--gn-blue);
}

.court-message header {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 4px;
  font-size: 12px;
}

.court-message header span {
  color: var(--muted);
}

.court-message p {
  margin: 0;
  font-size: 13px;
  white-space: pre-wrap;
}

.court-thread-form {
  display: grid;
  gap: 8px;
}

.court-thread-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.court-thread-form .pj-button {
  justify-self: end;
}

/* --- Fenêtre de dialogue ------------------------------------------- */

.pj-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 14, 24, 0.55);
}

.pj-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--sidebar);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.pj-dialog > header,
.pj-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
}

.pj-dialog > header {
  border-bottom: 1px solid var(--line);
}

.pj-dialog > header h2 {
  margin: 0;
  font-size: 17px;
}

.pj-dialog > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.pj-dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.pj-dialog-body {
  padding: 14px 18px;
}

/* Question posée par askConfirm / askText : ses retours à la ligne comptent. */
.pj-dialog-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.pj-dialog-field {
  display: grid;
  gap: 8px;
}

.pj-dialog-field input,
.pj-dialog-field textarea {
  width: 100%;
  box-sizing: border-box;
}

.pj-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pj-dialog-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.pj-dialog-grid .wide {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .pj-dialog-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Registre : identités rapprochées ------------------------------ */

.person-card.merged {
  border-left-color: var(--muted);
  opacity: 0.88;
}

.person-merged-note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.person-merged-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warning);
  background: var(--sidebar);
}

.person-merged-banner div {
  display: grid;
  gap: 3px;
}

.person-merged-banner span,
.person-merged-banner small {
  font-size: 12px;
  color: var(--muted);
}

/* --- Connexion depuis le jeu, mentions ------------------------------ */

.auth-ingame-notice {
  margin: 0 0 14px;
}

.auth-ingame-notice code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
}

.login-footer-data {
  display: block;
  margin-top: 6px;
  font-size: 12px;
}
