/*
 * Identite reprise de l application mobile : le bleu Nimrwili y est la couleur
 * de marque, et la console parlait jusqu ici une autre langue visuelle (sable
 * et vert). Un administrateur passe de l une a l autre ; les deux doivent se
 * reconnaitre.
 *
 * Deux familles de couleurs, volontairement separees :
 *   --brand-*   l identite, pour la navigation, les liens, les actions
 *   --ok/warn/bad  le sens, pour les statuts — un statut "reussi" reste vert
 *                  meme si la marque est bleue
 */
:root {
  --brand: #1e56a0;
  --brand-dark: #17447e;
  --brand-darker: #123762;
  --brand-soft: #eaf0f8;
  --accent: #f2a03d;

  --sand: #f4f6f9;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e4e8ee;

  --green: #157f5c;
  --green-soft: #e4f2ec;
  --amber: #92610f;
  --amber-soft: #fbf0dc;
  --red: #a12f22;
  --red-soft: #fae7e3;
  --blue: var(--brand);
  --blue-soft: var(--brand-soft);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--sand);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--brand);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- connexion */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

/*
 * Le logo porte le nom du produit : il remplace le titre texte plutot que de
 * le doubler. L attribut alt garde le nom lisible si l image ne charge pas.
 */
.login-logo {
  display: block;
  width: 168px;
  max-width: 100%;
  height: auto;
  margin: 0 0 6px;
}

.login-card p.sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------------- layout */

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/*
 * Barre laterale sombre, comme l en-tete de l application. Elle separe
 * nettement la navigation du contenu, ce qu une colonne blanche sur fond clair
 * ne faisait qu a la faveur d un filet de 1px.
 */
.sidebar {
  background: var(--brand-dark);
  color: #dbe5f2;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
}

/*
 * Plaque blanche derriere le logo.
 *
 * Le logo est noir et bleu sur fond transparent : pose directement sur le bleu
 * de la barre laterale, son texte serait illisible. La plaque lui rend le fond
 * clair pour lequel il a ete dessine, sans le retoucher ni en fabriquer une
 * seconde version.
 */
.brand-mark {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
}

.brand span {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fb6d4;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #dbe5f2;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* L onglet courant est plein, pas seulement teinte : il doit se voir d un
   coup d oeil depuis l autre bout de l ecran. */
.nav a.active {
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
}

.nav .count {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--accent);
  color: #3d2a08;
  border-radius: 10px;
  padding: 1px 7px;
  font-weight: 700;
}

.nav a.active .count {
  background: var(--accent);
}

.session {
  padding: 14px 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 12px;
  font-size: 12.5px;
  color: #9fb6d4;
}

.session b {
  display: block;
  color: #fff;
  font-size: 13px;
}

.main {
  padding: 24px 28px 64px;
  overflow-x: hidden;
}

/*
 * Barre superieure et voile du tiroir : telephones seulement, definis dans le
 * media query de fin de fichier. Un point d accroche ici garde la section
 * "layout" complete ; en voici le seul style qui vaille sur grand ecran.
 */
.appbar,
.scrim {
  display: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-head .hint {
  color: var(--muted);
  font-size: 13px;
}

/* -------------------------------------------------------------------- tuiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.tile .n {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tile .l {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.tile.alert .n {
  color: var(--amber);
}

/* -------------------------------------------------------------------- barres */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-width: 150px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

/* ------------------------------------------------------------------ boutons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.btn:hover:not(:disabled) {
  background: var(--sand);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.btn.danger {
  background: var(--red-soft);
  border-color: #e2c4bd;
  color: var(--red);
}

.btn.wide {
  width: 100%;
  justify-content: center;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ------------------------------------------------------------------ tableaux */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Alternance discrete : sur une table dense, elle guide l oeil d un bout a
   l autre d une ligne mieux qu un simple filet. */
tbody tr:nth-child(even) {
  background: #fcfdfe;
}

tbody tr:hover {
  background: var(--brand-soft);
}

td.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td .sub {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

/* Champ editable directement dans un tableau : il doit rester discret tant
   qu on ne le touche pas, sinon la grille devient illisible. */
.cell {
  width: 100%;
  min-width: 90px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.cell:hover {
  border-color: var(--line);
}

.cell:focus {
  background: var(--surface);
  border-color: var(--brand);
  outline: none;
}

.fee-block {
  margin-bottom: 32px;
}

.fee-block h3 {
  margin: 0;
  font-size: 16px;
}

.tier-new td {
  background: var(--brand-soft);
}

/* ------------------------------------------------------------ fiche detail */

/* Deux colonnes sur un ecran large, une seule des qu il se resserre : une
   fiche doit rester lisible sur la tablette d un moderateur. */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.field-row:last-child {
  border-bottom: none;
}

.field-label {
  color: var(--muted);
  font-size: 12.5px;
  flex-shrink: 0;
}

.field-value {
  text-align: right;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.description {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Les photos sont le premier element qu un moderateur regarde : elles doivent
   etre grandes, et cliquables vers l original. */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.gallery a {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.gallery img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.gallery .pill {
  position: absolute;
  top: 8px;
  left: 8px;
}

/* Documents de location : cadres de verification, pas galerie de l annonce. */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.doc {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* Un document absent doit se voir avant d approuver, pas passer pour un bug. */
.doc-missing {
  border-color: var(--red);
  border-style: dashed;
}

/* Idem pour un document present en base mais illisible : le cadre doit se
   distinguer d un cadre vide, jamais se confondre avec lui. */
.doc-unreadable {
  outline: 1px dashed var(--red);
  outline-offset: -3px;
}

.doc-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: var(--sand);
}

.doc-thumb img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
}

.doc-open {
  display: block;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  text-decoration: none;
}

.doc figcaption {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.panel textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
}

.panel textarea:focus {
  border-color: var(--brand);
  outline: none;
}

/* -------------------------------------------------------------------- pills */

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  background: var(--sand);
  color: var(--muted);
}

.pill.ok {
  background: var(--green-soft);
  color: var(--green);
}

.pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.bad {
  background: var(--red-soft);
  color: var(--red);
}

.pill.info {
  background: var(--blue-soft);
  color: var(--blue);
}

/* ----------------------------------------------------------------- moderation */

.queue {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
}

.card .thumbs {
  display: grid;
  gap: 6px;
}

.card .thumbs img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--sand);
}

.card .thumbs .more {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.card h3 {
  margin: 0 0 2px;
  font-size: 16px;
}

.card .meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.card .desc {
  white-space: pre-wrap;
  max-height: 8.4em;
  overflow-y: auto;
  border-left: 2px solid var(--line);
  padding-left: 10px;
  margin: 0 0 12px;
  color: #2c3833;
}

.card .specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.decision {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.decision textarea {
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
}

/* ------------------------------------------------------------------ divers */

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
}

.notice.error {
  background: var(--red-soft);
  color: var(--red);
}

.notice.ok {
  background: var(--green-soft);
  color: var(--green);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
  max-width: 340px;
}

.toast > div {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.toast > div.error {
  background: var(--red);
}

.loading {
  color: var(--muted);
  padding: 24px 0;
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    /*
     * align-content stretch (defaut) etire les pistes auto quand le contenu
     * est plus court que l ecran : la barre superieure grossissait alors d un
     * grand bandeau bleu vide. Les pistes restent a leur taille naturelle.
     */
    align-content: start;
  }

  /*
   * Barre superieure : marque, environnement et bouton du tiroir. Collee en
   * haut pendant le defilement, elle prend la place de la barre laterale.
   */
  .appbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--brand-dark);
    color: #dbe5f2;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .appbar-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 42px;
    block-size: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-sm);
    background: transparent;
    color: #fff;
  }

  /* Trois barres dessinees en CSS : aucun fichier d icone a charger. */
  .appbar-bars {
    position: relative;
    display: block;
    inline-size: 18px;
    block-size: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .appbar-bars::before,
  .appbar-bars::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    display: block;
    inline-size: 18px;
    block-size: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .appbar-bars::before {
    inset-block-start: -6px;
  }

  .appbar-bars::after {
    inset-block-end: -6px;
  }

  .appbar .brand-mark {
    inline-size: 88px;
    margin: 0;
    padding: 5px 7px;
  }

  .appbar-env {
    margin-inline-start: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9fb6d4;
  }

  /*
   * Tiroir : pleine hauteur, ancre au bord de debut de lecture. `translate`
   * le sort de l ecran ; le signe depend de la direction (en arabe le tiroir
   * se cache vers la droite), d ou une regle explicite plutot qu une
   * propriete logique.
   */
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: min(300px, 85vw);
    translate: -105% 0;
    transition: translate 220ms ease;
    z-index: 70;
    overflow: hidden;
    box-shadow: 0 10px 34px rgba(9, 20, 36, 0.4);
  }

  .sidebar.open {
    translate: 0 0;
  }

  [dir="rtl"] .sidebar {
    translate: 105% 0;
  }

  [dir="rtl"] .sidebar.open {
    translate: 0 0;
  }

  /* La navigation defile dans le tiroir ; la session reste epinglee en bas. */
  .sidebar .nav {
    min-height: 0;
    overflow-y: auto;
  }

  /* Voile sombre entre le contenu et le tiroir. */
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(9, 20, 36, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
  }

  .scrim.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Tiroir ouvert : le defilement de la page derriere est verrouille. */
  body.nav-locked {
    overflow: hidden;
  }

  .main {
    padding: 18px 16px 48px;
  }

  /* Titre et aide empiles : le contexte passe sous le titre. */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  /* Filtres empiles en pleine largeur, champs faciles a toucher. */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select {
    inline-size: 100%;
    min-inline-size: 0;
    min-height: 42px;
  }

  /*
   * Tables : le defilement horizontal reste (les grilles d administration sont
   * denses), mais il glisse et ses bords ombrages signalent le contenu cache.
   * Deux bandes claires epingles au contenu (attachment: local) couvrent les
   * ombres juste quand le bord correspondant du contenu est visible ; les
   * ombres, elles, restent collees au cadre (attachment: scroll).
   */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    background-image:
      linear-gradient(to right, var(--surface), var(--surface)),
      linear-gradient(to left, var(--surface), var(--surface)),
      linear-gradient(to right, rgba(9, 20, 36, 0.16), rgba(9, 20, 36, 0)),
      linear-gradient(to left, rgba(9, 20, 36, 0.16), rgba(9, 20, 36, 0));
    background-repeat: no-repeat;
    background-position: 0 0, 100% 0, 0 0, 100% 0;
    background-size: 28px 100%, 28px 100%, 28px 100%, 28px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Cibles tactiles confortables : navigation, boutons, boutons de page. */
  .nav a,
  .btn {
    min-height: 42px;
  }

  /* Notifications ancrees aux deux bords : lisibles sur petit ecran. */
  .toast {
    inset-inline: 12px;
    inset-block-end: 12px;
    max-width: none;
  }

  .pager {
    flex-wrap: wrap;
  }

  /* Une carte de moderation par ecran ; ses vignettes tiennent sur une ligne. */
  .card {
    grid-template-columns: 1fr;
  }

  .card .thumbs {
    grid-template-columns: repeat(3, 1fr);
    max-inline-size: 340px;
  }
}

/*
 * Telephones etroits : une seule colonne sans plancher de largeur pour la
 * fiche detail, des grilles de photos plus serrees, deux tuiles par ligne.
 */
@media (max-width: 480px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .doc-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }

  .tile .n {
    font-size: 22px;
  }
}

/*
 * Tables en cartes sur telephone. La classe table-cards est posee sur le
 * .table-wrap par app.js : l en-tete disparait, chaque ligne devient une
 * carte et chaque cellule annonce son libelle (attribut data-label, meme cle
 * i18n que l en-tete qu elle remplace).
 */
@media (max-width: 640px) {
  .table-cards {
    overflow: visible;
    background-image: none;
    border: none;
    box-shadow: none;
  }

  .table-cards table {
    min-width: 0;
  }

  .table-cards thead {
    display: none;
  }

  .table-cards tbody {
    display: grid;
    gap: 10px;
  }

  .table-cards tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .table-cards tbody tr:nth-child(even),
  .table-cards tbody tr:hover {
    background: var(--surface);
  }

  .table-cards td {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  .table-cards td:last-child {
    border-bottom: none;
  }

  /* Libelle au-dessus de la valeur : pas de regroupement de contenu a deviner. */
  .table-cards td::before {
    content: attr(data-label);
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  /* Cellules sans libelle (vignette, boutons d action) : pas de pseudo-element. */
  .table-cards td:not([data-label])::before {
    content: none;
  }

  .table-cards td input.cell {
    width: 100%;
    min-width: 0;
    text-align: start;
  }
}

/* -------------------------------------------------------------------------- */
/* Publicites                                                                  */
/* -------------------------------------------------------------------------- */

/* Vignette au ratio du carrousel : l administrateur juge le cadrage depuis la
   liste, sans ouvrir la fiche. */
.ad-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
}

/* Poignee de glisser-deposer. Le curseur seul signale la prise : une ligne
   entiere saisissable ferait partir un reordonnancement au moindre clic. */
.ad-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  width: 24px;
  text-align: center;
}

tr.dragging {
  opacity: 0.45;
  background: var(--brand-soft);
}

.ad-form-preview {
  margin-top: 10px;
  max-width: 420px;
}

.ad-form-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
}

/* Apercu du carrousel : defilement horizontal, comme sur le telephone. */
.ad-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

.ad-preview-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.ad-preview-slide {
  flex: 0 0 auto;
  width: 320px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.ad-preview-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

/* Meme grammaire que l application : la pastille active s allonge au lieu de
   grossir, la rangee garde sa hauteur. */
.ad-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.ad-dot.on {
  width: 20px;
  background: var(--brand);
}

/* -------------------------------------------------------------------------- */
/* RTL (arabe)                                                                 */
/* -------------------------------------------------------------------------- */

/*
 * Mise en page inversee pour l arabe. La grille de .shell et les flex suivent
 * automatiquement la direction : la barre laterale passe a droite sans regle
 * supplementaire. Seuls les positionnements physiques et les alignements
 * demandent un correctif explicite.
 */
[dir="rtl"] {
  --sans: "Noto Naskh Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
}

[dir="rtl"] body {
  text-align: right;
}

/*
 * L arabe n a pas de majuscules, et l interlettrage casse la liaison des
 * lettres : les petits libelles monospace redeviennent du texte courant.
 */
[dir="rtl"] th,
[dir="rtl"] .field label,
[dir="rtl"] .tile .l,
[dir="rtl"] .panel h3,
[dir="rtl"] .brand span,
[dir="rtl"] .appbar-env,
[dir="rtl"] .pill {
  letter-spacing: normal;
  text-transform: none;
}

[dir="rtl"] th {
  text-align: right;
}

[dir="rtl"] .field-value {
  text-align: left;
}

[dir="rtl"] .gallery .pill {
  left: auto;
  right: 8px;
}

[dir="rtl"] .card .desc {
  border-left: none;
  border-right: 2px solid var(--line);
  padding-left: 0;
  padding-right: 10px;
}

[dir="rtl"] .toast {
  right: auto;
  left: 20px;
}

/*
 * Les chiffres restent latins et dans l ordre de lecture occidental, y compris
 * dans un shell arabe : telephones, codes PIN, montants et compteurs.
 */
[dir="rtl"] #login-phone,
[dir="rtl"] #login-password,
[dir="rtl"] #login-code,
[dir="rtl"] #login-new-password,
[dir="rtl"] input[inputmode="numeric"],
[dir="rtl"] .num {
  direction: ltr;
}
