/* Contenus partagés : tableaux, étapes et codes, filtres, textes bruts, jauges, états vides, annonces
   (décision 0030). */

/* Tableaux : des filets et de l'alignement, chiffres à droite */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-row);
  background: var(--color-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}

.table th {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-strong);
  color: var(--color-text-subtle);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 0.625rem var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

/* Quantités alignées à droite ; les dates restent à gauche, en chiffres tabulaires (.num). */
.table .end {
  text-align: right;
}

/* Téléphone : un tableau « table--stack » devient une fiche par ligne, la première cellule en titre, les autres en
   « intitulé : valeur » (data-label). L'en-tête reste là pour les lecteurs d'écran. */
@media (max-width: 40rem) {
  .table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table--stack,
  .table--stack tbody,
  .table--stack tr {
    display: block;
    width: 100%;
  }

  .table--stack tr {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
  }

  .table--stack tr:first-child {
    border-top: 0;
  }

  .table--stack td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
    padding: 2px 0;
    border: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .table--stack td::before {
    flex: none;
    color: var(--color-text-subtle);
    font-size: var(--text-sm);
    text-align: left;
    content: attr(data-label);
  }

  .table--stack td:first-child {
    justify-content: flex-start;
    margin-bottom: var(--space-1);
    font-weight: 500;
    text-align: left;
  }

  .table--stack td:first-child::before,
  .table--stack td:not([data-label])::before {
    content: none;
  }

  .table--stack td:not([data-label]) {
    justify-content: flex-start;
    padding-top: var(--space-2);
  }

  .table--stack td:empty {
    display: none;
  }
}

/* Étapes numérotées, codes et clés à recopier */
.steps {
  display: grid;
  gap: var(--space-5);
  margin: 0;
  padding-left: var(--space-5);
}

.steps > li {
  padding-left: var(--space-2);
}

.authenticator {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.qr {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  image-rendering: pixelated;
}

.key,
.codes code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--text-md);
  letter-spacing: 0.04em;
}

.codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.codes li {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  background: var(--color-surface-sunken);
}

/* Filtres d'une liste : champs côte à côte, qui passent à la ligne sur téléphone */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.filters .field {
  flex: 1 1 12rem;
}

.filters-actions {
  display: flex;
  gap: var(--space-2);
}

.filters-actions .btn {
  min-height: 2.5rem;
}

.nowrap {
  white-space: nowrap;
}

/* Liens vers les pages légales, présents sur toutes les mises en page */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
}

/* Texte brut tel que publié (bulletins météo) : chiffres tabulaires, coupé au besoin ; pas de troisième police */
.raw {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

/* Une annonce : une carte avec son titre, son texte, qui l'a publiée et quand */
.announcement {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-row);
  background: var(--color-surface);
}

.announcement-title { font-size: var(--text-base); }
.announcement-text { font-size: var(--text-md); }
.announcement-by { color: var(--color-text-subtle); font-size: var(--text-xs); }

/* Une liste vide garde son cadre et dit pourquoi */
.empty {
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-row);
  color: var(--color-text-muted);
  font-size: var(--text-md);
  list-style: none;
}

/* Jauge : une barre à sa vraie proportion, fine dans les listes, verte une fois le compte atteint */
.meter {
  --meter-fill: var(--color-data);
  width: 100%;
  height: 0.625rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-nav-active);
  overflow: hidden;
  appearance: none;
}

.meter--thin { height: 6px; }
.meter--done { --meter-fill: var(--color-ok); }

.meter::-webkit-progress-bar {
  border-radius: var(--radius-pill);
  background: var(--color-nav-active);
}

.meter::-webkit-progress-value {
  border-radius: var(--radius-pill);
  background: var(--meter-fill);
}

.meter::-moz-progress-bar {
  border-radius: var(--radius-pill);
  background: var(--meter-fill);
}

/* Sous-titre à l'intérieur d'un panneau */
.panel-subtitle {
  margin-top: var(--space-4);
  font-size: var(--text-base);
}

/* Aperçu d'une série */
.series {
  padding: var(--space-4);
  border-radius: var(--radius-panel);
  background: var(--color-surface-sunken);
}

.series-title {
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
}

.series-list {
  display: grid;
  gap: var(--space-1);
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

.series-list span {
  color: var(--color-ok);
}

.series-list strong {
  margin-right: var(--space-2);
  font-weight: 500;
}

.series-list .series-bad span {
  color: var(--color-bad);
}

/* Texte saisi par une personne : ses retours à la ligne sont gardés */
.text-block {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
