/* =====================================================================
   RunMasdjid · Admin — feuille de style unique (sans framework), d'après la maquette
   docs/design/runmasdjid-admin-design. Pages : <body class="app">, chargées dans l'ordre
   /assets/common.css (police d'icônes), rm.css, /assets/site/theme.css (thème de la mosquée).
   1. Thème par défaut  2. Jetons fixes  3. Base  4. Composants  5. Pages
   6. Ordinateur (container query)
   ===================================================================== */

/* ---------- 1. THÈME : valeurs par défaut, remplacées par sites/<mosquée>/theme.css ---------- */
:root {
  --rm-primary: #265C54;            /* boutons, liens, icônes, sélection  */
  --rm-header-bg: #265C54;          /* fond de l'en-tête                   */
  /* --rm-header-fg: #FFFFFF;          facultatif : sinon noir/blanc auto   */
  --rm-logo: url("/assets/site/logo.png");  /* logo de la mosquée (même chemin partout) */
}

/* ---------- 2. JETONS FIXES + couleurs dérivées (contraste garanti) ---- */
.app {
  /* dérivées : repli simple pour les navigateurs anciens */
  --rm-accent: var(--rm-primary);
  --rm-hfg: var(--rm-header-fg, #FFFFFF);
  --rm-tint: #EEF3F1;

  --rm-bg: #F5F4EF;
  --rm-surface: #FFFFFF;
  --rm-ink: #16201D;
  --rm-muted: #4F5A56;          /* 7:1 sur blanc */
  --rm-line: #DEDCD3;
  --rm-line-strong: #7A8480;    /* bord des champs : 3.9:1 */
  --rm-danger: #B42318;   --rm-danger-tint: #FDECEA;
  --rm-success: #1D6B3A;  --rm-success-tint: #E4F2E8;
  --rm-warn: #8A4B00;     --rm-warn-tint: #FFF1DC;
  --rm-radius: 16px;
  --rm-font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@supports (color: oklch(from red l c h)) {
  .app {
    /* Couleur d'action : jamais plus claire que L=0.55 → texte blanc ≥ 4.5:1 */
    --rm-accent: oklch(from var(--rm-primary) min(l, 0.55) c h);
    /* Fond teinté très clair pour sélection / pastilles */
    --rm-tint: oklch(from var(--rm-primary) 0.95 min(c, 0.03) h);
    /* Texte d'en-tête : blanc si fond foncé, noir si fond clair (seuil L=0.57) */
    --rm-hfg: var(--rm-header-fg, oklch(from var(--rm-header-bg) clamp(0, (0.57 - l) * 1000, 1) 0 0));
  }
}

/* ---------- 3. BASE ---------- */
.app, .app * { box-sizing: border-box; }
.app {
  container: app / inline-size;
  position: relative;
  min-height: 100%;
  /* mosaïque de la mosquée et sa taille (theme.css), sur le fond clair de l'admin ; --background-color
     reste celui de l'écran */
  background-color: var(--rm-bg);
  background-image: var(--image-background, none);
  background-size: var(--background-size, auto);
  color: var(--rm-ink);
  font-family: var(--rm-font);
  font-size: 18px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
html:has(> body.app) { height: 100%; }
body.app { margin: 0; }
.hidden { display: none !important; }
.app h1, .app h2, .app h3, .app p { margin: 0; }
:where(.app) a { color: var(--rm-accent); }
:where(.app) :where(button, input, select, textarea) { font: inherit; color: inherit; }
/* Icône de la police RunMasdjid (ui.js icon()) : sa taille suit width/height */
.ic {
  width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center;
  font-family: "RunMasdjid"; font-style: normal; font-weight: normal; line-height: 1; font-size: var(--ic-size, 24px);
}
.ic-lg { width: 32px; height: 32px; --ic-size: 32px; }
.ic-xl { width: 40px; height: 40px; --ic-size: 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--rm-muted); }
.num { font-variant-numeric: tabular-nums; }

/* Focus visible : double anneau lisible sur n'importe quel fond */
.app :focus-visible, .app .is-focus {
  outline: 3px solid var(--rm-ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #FFFFFF;
}

/* ---------- 4. COMPOSANTS ---------- */

/* En-tête */
.hdr {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 8px;
  min-height: 64px; padding: 8px;
  background: var(--rm-header-bg); color: var(--rm-hfg);
}
.hdr-title { margin: 0; text-align: center; font-size: 19px; font-weight: 700; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-wrap: balance; }
.hdr-home { grid-template-columns: minmax(0, 1fr) 48px; padding: 12px 8px 12px 16px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-size: 20px; font-weight: 700; line-height: 1.15; }
.brand-sub { font-size: 15px; opacity: .9; }
.logo {
  width: 48px; height: 48px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  /* pastille blanche : les logos sont dessinés pour un fond clair, souvent de la couleur de l'en-tête */
  padding: 4px; background: #FFFFFF var(--rm-logo) center / contain no-repeat; background-origin: content-box;
  color: var(--rm-hfg);
}
.logo .ic { width: 28px; height: 28px; --ic-size: 28px; }

/* Bouton icône (en-tête, actions de ligne) */
.ibtn {
  width: 48px; height: 48px; display: inline-grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent; color: inherit; cursor: pointer; text-decoration: none;
}
.hdr-back .lbl { display: none; }
.hdr .ibtn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 12px; border: 2px solid transparent;
  font-size: 17px; font-weight: 700; line-height: 1.1; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--rm-accent); color: #FFFFFF; }
.btn-secondary { background: var(--rm-surface); color: var(--rm-accent); border-color: var(--rm-accent); }
.btn-danger { background: var(--rm-danger); color: #FFFFFF; }
.btn-danger-soft { background: var(--rm-surface); color: var(--rm-danger); border-color: var(--rm-danger); }
.btn-ghost { background: transparent; color: var(--rm-accent); padding: 0 12px; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 16px; }
.btn[disabled], .btn[aria-disabled="true"] { background: #E3E1D9; color: #5E6763; border-color: #E3E1D9; cursor: not-allowed; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; flex: none; }
.grow { flex: 1 1 auto; }
.cols2 { display: flex; flex-direction: column; gap: 22px; }
.toolbar { display: flex; flex-direction: column; gap: 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 16px; font-weight: 700; }
.input {
  width: 100%; min-height: 52px; padding: 0 14px;
  background: #FFFFFF; border: 2px solid var(--rm-line-strong); border-radius: 12px;
  font-size: 18px; color: var(--rm-ink);
}
textarea.input { min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.4; }
/* Safari ignore hauteur et bordure d'un select natif : flèche dessinée à la place. */
select.input {
  appearance: none; padding-right: 44px;
  background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316201D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 14px center / 20px no-repeat;
}
/* Safari iOS donne une largeur minimale aux champs date et heure : ils débordaient de .pair. */
@supports (-webkit-touch-callout: none) {
  input[type="date"].input, input[type="time"].input { -webkit-appearance: none; appearance: none; min-width: 0; }
}
.input:focus-visible { border-color: var(--rm-accent); }
.hint { font-size: 15px; color: var(--rm-muted); }
.field.is-error .input, .fieldset.is-error .input { border-color: var(--rm-danger); background-color: #FFFBFA; }
.err-msg { display: flex; align-items: flex-start; gap: 6px; font-size: 15px; font-weight: 700; color: var(--rm-danger); }
.err-msg:empty { display: none; }
.err-msg .ic { width: 20px; height: 20px; --ic-size: 20px; margin-top: 1px; }
.pair { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; }
.fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: 8px; font-size: 16px; font-weight: 700; }
.err-summary {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  background: var(--rm-danger-tint); border: 2px solid var(--rm-danger); border-radius: 12px;
  color: #7A1810; font-size: 16px; font-weight: 700;
}
.search { position: relative; }
.search .ic { position: absolute; left: 14px; top: 14px; color: var(--rm-muted); }
.search .input { padding-left: 46px; }

/* Case à cocher / option en ligne */
.check {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px;
  background: #FFFFFF; border: 2px solid var(--rm-line); border-radius: 12px; font-size: 17px; font-weight: 600;
}
.check input { width: 24px; height: 24px; accent-color: var(--rm-accent); margin: 0; }
.check.on, .check:has(input:checked) { border-color: var(--rm-accent); background: var(--rm-tint); }
.checks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* Compteur (durée) */
.stepper { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 8px; align-items: center; }
.stepper .btn { width: 52px; padding: 0; font-size: 26px; }
.stepper .input { text-align: center; font-weight: 700; }

/* Onglets / sélecteur segmenté */
.tabs { display: flex; gap: 4px; padding: 4px; background: #E7E5DC; border-radius: 14px; }
.tab {
  flex: 1 1 0; min-height: 48px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--rm-ink); font-size: 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--rm-surface); color: var(--rm-accent); box-shadow: 0 1px 3px rgba(22, 32, 29, .18); }

/* Carte */
.card { background: var(--rm-surface); border: 1px solid var(--rm-line); border-radius: var(--rm-radius); padding: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rm-line); }
.card-title { font-size: 18px; font-weight: 700; }

/* Titres de section */
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sec-title { font-size: 18px; font-weight: 700; }

/* Liste */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--rm-line); }
.row:first-child { border-top: 0; }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 18px; font-weight: 700; }
.row-sub { font-size: 15px; color: var(--rm-muted); }
.row-time { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.row-actions { display: flex; gap: 6px; flex: none; }
.row-link { color: inherit; text-decoration: none; }
.row .chev { color: var(--rm-muted); }
.row.is-new { background: var(--rm-success-tint); }

/* Pastilles de statut : icône + texte, jamais la couleur seule */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.pill .ic { width: 18px; height: 18px; --ic-size: 18px; }
.pill-off { background: var(--rm-danger-tint); color: #8C1D13; }
.pill-ok { background: var(--rm-success-tint); color: #145228; }
.pill-warn { background: var(--rm-warn-tint); color: #6E3B00; }
.pill-neutral { background: #ECEAE3; color: #3E4643; }
.pill-accent { background: var(--rm-tint); color: var(--rm-accent); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tuile de raccourci */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
  min-height: 116px; padding: 14px; border-radius: var(--rm-radius);
  background: var(--rm-surface); border: 1px solid var(--rm-line); color: var(--rm-ink); text-decoration: none;
  font-size: 17px; font-weight: 700; line-height: 1.2;
}
.tile-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--rm-tint); color: var(--rm-accent); }
.tile-ic .ic { width: 28px; height: 28px; --ic-size: 28px; }

/* Carte écran */
.screens { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.screen { display: flex; flex-direction: column; gap: 10px; }
.screen-top { display: flex; align-items: center; gap: 12px; }
.screen-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #ECEAE3; color: var(--rm-ink); flex: none; }
.screen-name { font-size: 18px; font-weight: 700; }
.screen-type { font-size: 15px; color: var(--rm-muted); }
.screen .btn-row .btn { flex: 1 1 0; }

/* Miniature d'affiche : <img class="thumb"> (ou bloc de texte si l'image manque) */
.thumb {
  position: relative; overflow: hidden; border-radius: 10px; flex: none;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
  aspect-ratio: 1 / 1; padding: 8px; text-align: center; line-height: 1.1;
  font-size: 11px; font-weight: 700; background: #E7E5DC; color: #3E4643;
}
img.thumb { display: block; padding: 0; object-fit: cover; background: #E7E5DC; }

/* Carte d'affiche programmée */
/* Téléphone : 2 affiches par ligne, carte compacte */
.posters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.poster { display: flex; flex-direction: column; gap: 8px; padding: 0; overflow: hidden; }
/* Affiche en grand, toute l'image visible, nom en bas sur l'image (comme la v2) */
.poster-img { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; padding: 0; border: 0; background: #E7E5DC; cursor: zoom-in; }
.poster-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.poster-name {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgba(10, 16, 14, .78)); color: #FFFFFF; text-align: left;
  font-size: 14px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere;
}
.poster-img .pills { position: absolute; top: 6px; left: 6px; right: 6px; }
.poster-img .pill { font-size: 12px; padding: 2px 8px 2px 6px; }
.poster-img .pill .ic { width: 14px; height: 14px; --ic-size: 14px; }
.poster .when { grid-template-columns: minmax(0, 1fr); margin: 0 8px; padding: 6px 8px; border-radius: 10px; background: var(--rm-bg); font-size: 13px; }
.poster .when dd { margin-bottom: 2px; }
.when { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px; font-size: 15px; }
.when dt { color: var(--rm-muted); }
.when dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.poster .btn-row, .poster > .note { padding: 0 8px 8px; }
.poster > .note { font-size: 14px; }
.poster .btn-row { justify-content: flex-end; }

/* Tuile d'archive */
.agrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.atile { display: flex; flex-direction: column; gap: 8px; padding: 8px; position: relative; }
.atile .thumb { width: 100%; }
.atile .btn { padding: 0 8px; }
.atile-name { font-size: 15px; font-weight: 700; line-height: 1.25; min-height: 38px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.atile .badge { position: absolute; top: 14px; left: 14px; }
.atile .sel { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; }
.atile .sel input { width: 24px; height: 24px; accent-color: var(--rm-accent); margin: 0; }
.atile.on { outline: 3px solid var(--rm-accent); outline-offset: -1px; }

/* Dossier */
.folders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.folder { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-decoration: none; color: var(--rm-ink); min-height: 120px; }
.folder .ic { width: 36px; height: 36px; --ic-size: 36px; color: var(--rm-accent); }
.folder-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.folder-meta { font-size: 14px; color: var(--rm-muted); }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 16px; font-weight: 700; }
.crumbs .ic { width: 18px; height: 18px; --ic-size: 18px; color: var(--rm-muted); }

/* Barre de progression */
.progress { height: 12px; border-radius: 999px; background: #E3E1D9; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--rm-accent); }
.upl { display: flex; flex-direction: column; gap: 8px; }
.upl-top { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; font-weight: 700; }
.upl-top .num { white-space: nowrap; }

/* Zone d'envoi de photo */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 140px; padding: 16px; border: 2px dashed var(--rm-line-strong); border-radius: 14px;
  background: #FFFFFF; color: var(--rm-accent); font-size: 17px; font-weight: 700; cursor: pointer;
}
.drop .hint { font-weight: 400; }
.drop .ic { width: 32px; height: 32px; --ic-size: 32px; }
.sr:focus-visible + .drop { outline: 3px solid var(--rm-ink); outline-offset: 2px; }
.picked { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 2px solid var(--rm-line); border-radius: 14px; background: #FFFFFF; }
.picked .thumb { width: 72px; }

/* Message de confirmation (toast) */
.toast {
  position: fixed; z-index: 20; left: 12px; right: 12px; top: 76px;
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px 10px 14px;
  border-radius: 14px; background: #14261F; color: #FFFFFF; font-size: 17px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(10, 20, 16, .28);
}
.toast-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #3FB86B; color: #0B2515; flex: none; }
.toast-ic .ic { width: 20px; height: 20px; --ic-size: 20px; }
.toast-danger .toast-ic { background: #FF8A7A; color: #3A0A04; }
.toast-busy .toast-ic { background: #FFFFFF; color: #14261F; }
.toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toast-text small { font-size: 15px; font-weight: 400; opacity: .85; }
.toast .btn-ghost { color: #BFE8CE; }
.toast.static { position: static; box-shadow: none; width: auto; }

/* Voile + panneau (formulaire) + fenêtre de confirmation */
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(12, 18, 16, .55); }
.sheet {
  position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-height: calc(100% - 24px); overflow-y: auto;
  display: flex; flex-direction: column; background: var(--rm-surface); border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 30px rgba(10, 20, 16, .2);
}
.sheet-body-fields { display: contents; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #C9C6BB; margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 16px; }
.sheet-title { font-size: 21px; font-weight: 700; }
.sheet-body { display: flex; flex-direction: column; gap: 18px; padding: 4px 16px 16px; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--rm-line); background: var(--rm-surface); }
.sheet.static, .dialog.static { position: relative; left: auto; right: auto; bottom: auto; top: auto; transform: none; box-shadow: 0 2px 10px rgba(10, 20, 16, .12); border: 1px solid var(--rm-line); z-index: 0; }
.sheet.static { border-radius: 22px; max-height: none; width: auto; }
.dialog.static { width: auto; }

.dialog {
  position: fixed; z-index: 11; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px; padding: 22px 18px 18px; border-radius: 22px;
  background: var(--rm-surface); text-align: center; box-shadow: 0 20px 50px rgba(10, 20, 16, .3);
}
.dialog-ic { width: 60px; height: 60px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--rm-danger-tint); color: var(--rm-danger); }
.dialog-ic .ic { width: 30px; height: 30px; --ic-size: 30px; }
.dialog-title { font-size: 21px; font-weight: 700; }
.dialog-text { font-size: 17px; color: var(--rm-muted); }
.dialog-obj { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--rm-bg); text-align: left; font-weight: 700; }
.dialog-obj .thumb { width: 56px; }

/* État vide */
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 20px; text-align: center; }
.empty-ic { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--rm-tint); color: var(--rm-accent); }
.empty-ic .ic { width: 36px; height: 36px; --ic-size: 36px; }
.empty-title { font-size: 20px; font-weight: 700; }
.empty-text { font-size: 17px; color: var(--rm-muted); max-width: 32ch; }

/* ---------- 5. PAGES ---------- */
.main { display: flex; flex-direction: column; gap: 22px; padding: 16px 16px 32px; max-width: 1180px; margin: 0 auto; }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; color: var(--rm-muted); }
.note .ic { width: 20px; height: 20px; --ic-size: 20px; margin-top: 2px; }
.state-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--rm-tint); color: var(--rm-ink); font-size: 16px; }
.state-line b { color: var(--rm-accent); }

/* Connexion */
.login { min-height: 100%; display: flex; flex-direction: column; }
.login-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 20px 36px; background: var(--rm-header-bg); color: var(--rm-hfg); text-align: center; }
.login-hero .logo { width: 72px; height: 72px; border-radius: 18px; }
.login-hero .logo .ic { width: 40px; height: 40px; --ic-size: 40px; }
.login-logo { display: block; max-width: 100%; height: 88px; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 700; }
.login-card { display: flex; flex-direction: column; gap: 18px; margin: -20px 16px 24px; padding: 22px 18px; }
.pw { position: relative; }
.pw .input { padding-right: 56px; }
.pw .ibtn { position: absolute; right: 2px; top: 2px; color: var(--rm-muted); }

/* Images : affiche agrandie */
.zoom { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; background: rgba(12, 18, 16, .85); cursor: zoom-out; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* Archives : tuiles, sélection pour suppression, dossiers RunImage */
.atile img.thumb { cursor: zoom-in; }
.atile .badge { position: absolute; top: 14px; left: 14px; }
.selbar {
  position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 12px 16px 16px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--rm-line);
}
.selbar .btn { width: 100%; max-width: 480px; }
body:has(.selbar:not(.hidden)) .main { padding-bottom: 104px; }
button.folder { font: inherit; text-align: left; cursor: pointer; }
.folder.parent { border-style: dashed; background: transparent; }
.folder-ic {
  position: relative; width: 44px; height: 44px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e9edf0' stroke='%239aa3aa' stroke-width='1.4' stroke-linejoin='round'%3E%3Cpath d='M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.folder-ic.private::after {
  content: ''; position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: #d98a14 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.parent .folder-ic {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b747c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 14 4 9 9 4'/%3E%3Cpath d='M20 20v-7a4 4 0 0 0-4-4H4'/%3E%3C/svg%3E");
}
.crumbs button { min-height: 44px; padding: 0 4px; border: 0; background: none; font: inherit; color: var(--rm-accent); cursor: pointer; text-decoration: underline; }
.crumbs button[disabled] { color: var(--rm-ink); text-decoration: none; cursor: default; }
.crumbs .sep { color: var(--rm-muted); }
.account { display: flex; align-items: center; gap: 12px; }
.account.stack { flex-direction: column; align-items: stretch; }
.account-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--rm-tint); color: var(--rm-accent); flex: none; }
.code-row { display: flex; gap: 10px; }
.code-row .input { max-width: 180px; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.row .thumb { width: 56px; cursor: zoom-in; }
.row-title.ellipsis { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-preview { display: flex; align-items: center; gap: 12px; }
.sheet-preview .thumb { width: 72px; }
.sheet-form { display: flex; flex-direction: column; gap: 18px; }
.sheet-sep { border: 0; border-top: 1px solid var(--rm-line); margin: 0; width: 100%; }
.status-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 16px; color: var(--rm-muted); }

/* Écran : commandes */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 88px; padding: 8px;
  border-radius: 14px; border: 2px solid var(--rm-line); background: #FFFFFF; font-size: 15px; font-weight: 700; color: var(--rm-ink); cursor: pointer;
}
.mode .ic { width: 28px; height: 28px; --ic-size: 28px; }
.mode.on { border-color: var(--rm-accent); background: var(--rm-tint); color: var(--rm-accent); }
.mode-on .ic { color: var(--rm-success); }
.mode-off .ic { color: var(--rm-danger); }

/* Bandeau défilant (aperçu) */
.ticker { overflow: hidden; white-space: nowrap; padding: 12px 14px; border-radius: 10px; background: #111; color: #FFF; font-size: 17px; }

/* Mois hégiriens */
.today { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--rm-radius); background: var(--rm-accent); color: #FFFFFF; }
.today b { font-size: 22px; }
.seg29 { display: grid; grid-template-columns: repeat(2, 64px); gap: 4px; padding: 4px; background: #E7E5DC; border-radius: 12px; }
.seg29 .tab { min-height: 44px; font-size: 17px; }

/* Messages, bandeau, mois, membres, responsables */
.msgs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.msg-text { font-size: 19px; font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.msg .btn-row { justify-content: flex-end; }
.row-text { font-size: 17px; white-space: pre-line; overflow-wrap: anywhere; }
.row > .pill.num { min-width: 36px; justify-content: center; padding: 4px 8px; }
textarea.input.input-2l { min-height: 0; }
.narrow.sec { gap: 20px; }

/* Écran : action d'un horaire (radios) et planning */
.modes-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode:has(input:checked) { border-color: var(--rm-accent); background: var(--rm-tint); color: var(--rm-accent); }
.mode:has(input:focus-visible) { outline: 3px solid var(--rm-ink); outline-offset: 2px; }
.power-ic { display: grid; place-items: center; flex: none; }
.power-ic.state-on { color: var(--rm-success); }
.power-ic.state-off { color: var(--rm-danger); }

/* ---------- 6. ORDINATEUR (≥ 880 px de large) ---------- */
@container app (min-width: 880px) {
  .hdr { grid-template-columns: 160px minmax(0, 1fr) 160px; padding: 10px 24px; min-height: 72px; }
  .hdr-home { grid-template-columns: minmax(0, 1fr) 160px; }
  .hdr-right { justify-self: end; }
  .hdr-back .lbl { display: inline; }
  .hdr-back { justify-self: start; width: auto; padding: 0 14px 0 8px; gap: 6px; display: inline-flex; font-size: 17px; font-weight: 700; }
  .hdr-title { font-size: 24px; }
  .main { padding: 32px 40px 48px; gap: 32px; }
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
  .tile { min-height: 140px; padding: 18px; font-size: 18px; }
  .row-time { font-size: 28px; }
  .screens { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .posters { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
  .poster { gap: 12px; }
  .poster-img { aspect-ratio: 16 / 10; }
  .poster-name { padding: 22px 12px 10px; font-size: 16px; }
  .poster .when { grid-template-columns: auto minmax(0, 1fr); margin: 0 12px; padding: 10px 12px; font-size: 15px; }
  .poster .when dd { margin-bottom: 0; }
  .poster .btn-row, .poster > .note { padding: 0 12px 12px; }
  .agrid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .folders { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .narrow { max-width: 760px; width: 100%; margin: 0 auto; }
  .toolbar { flex-direction: row; justify-content: flex-start; }
  .toolbar .btn { width: auto; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 600px; max-height: calc(100% - 64px); border-radius: 22px; }
  .sheet-grip { display: none; }
  .sheet-foot { flex-direction: row-reverse; justify-content: flex-start; }
  .sheet-foot .btn { width: auto; min-width: 160px; }
  .dialog { left: 50%; right: auto; width: 460px; transform: translate(-50%, -50%); }
  .dialog .btn-stack { flex-direction: row-reverse; }
  .dialog .btn-stack .btn { flex: 1 1 0; }
  .toast { left: auto; right: 24px; top: 88px; width: 400px; }
  .login-card { width: 440px; margin: -28px auto 40px; }
  .modes { grid-template-columns: repeat(3, minmax(0, 180px)); }
  .modes-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .msgs { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .checks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
