/* zauth — le portail d'accès. Même famille visuelle que ztesting : sobre, chaud,
   sans effet. Un portail d'authentification doit inspirer le calme, pas la mode. */

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --muted: #6f6f6a;
  --line: #e3e3de;
  --accent: #5b4636;
  --ok: #2f7d4f;
  --ko: #b3261e;
  --warn: #b26a00;
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

/* ---------- Barre du haut ----------
   Elle vient de `zgateau-suite.css` : la MÊME barre dans les six applications.
   Ne rien redéfinir ici — c'est le seul endroit du parc où la forme est commune. */

.wrap { max-width: 1080px; margin: 0 auto; padding: 1.8rem 1.4rem 4rem; }
h1 { font-size: 1.5rem; font-weight: 600; margin: .2rem 0 .5rem; }
h2 { font-size: 1.08rem; font-weight: 600; margin: 2rem 0 .8rem; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 1.4rem; }
/* La phrase qui évite d'attendre un e-mail qui n'arrivera pas : elle doit se
   lire AVANT le champ, pas se fondre dans le reste du texte. */
.sub.note-mail {
  background: #fdf6ec; border: 1px solid #eadfc9; border-left: 3px solid #b9987f;
  border-radius: 6px; padding: .6rem .8rem; color: #6b5a44;
}
.foot { color: var(--muted); font-size: .8rem; text-align: center; padding: 2rem 1rem 3rem; }

/* ---------- Écrans d'avant l'entrée ---------- */
.authbody { background: var(--ink); }
.authwrap { max-width: 430px; margin: 0 auto; padding: 3.5rem 1.2rem; }
.authcard { background: var(--panel); border-radius: 10px; padding: 1.8rem 1.7rem 2rem; }
.authbrand { font-weight: 600; letter-spacing: .04em; color: var(--accent); margin-bottom: 1.4rem; }
.authbrand span { color: var(--muted); font-weight: 400; margin-left: .35rem; font-size: .85em; }
.authcard h1 { font-size: 1.3rem; margin-top: 0; }
.authcard label { display: block; font-size: .78rem; color: var(--muted); margin: .9rem 0 .25rem; }
.authcard input { width: 100%; }
.help { color: #9a958c; font-size: .82rem; margin: 1.3rem 0 0; }
.authfoot { color: #8a857c; font-size: .78rem; text-align: center; margin-top: 1.4rem; }

/* ---------- Champs et boutons ---------- */
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: inherit; padding: .42rem .55rem; border: 1px solid var(--line);
  border-radius: 5px; background: #fff; color: var(--ink);
}
button, .btn {
  font: inherit; font-weight: 500; padding: .42rem .9rem; border-radius: 5px;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); }
button.ghost, .btn.ghost { background: #fff; color: var(--ink); }
button.small, .btn.small { padding: .18rem .5rem; font-size: .8rem; }
button.block, .btn.block { display: block; width: 100%; margin-top: 1.2rem; text-align: center; }
button:hover { opacity: .88; }
.bigcode { font-size: 1.35rem; letter-spacing: .28em; text-align: center; font-variant-numeric: tabular-nums; }

form.stack { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; }
form.stack label { font-size: .78rem; color: var(--muted); margin-top: .7rem; }
form.stack input, form.stack select { min-width: 280px; max-width: 100%; }
form.stack button { margin-top: 1rem; }
form.inline { display: inline-block; margin: 0 .25rem .25rem 0; }

/* ---------- Messages ---------- */
.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.flash.ok  { background: #e6f4ea; color: var(--ok); }
.flash.err { background: #fdeceb; color: var(--ko); }

/* ---------- Panneaux et tableaux ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 1.2rem; overflow: hidden; }
.panel .pad { padding: 1.1rem 1.2rem 1.3rem; }
.panel .pad hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.panel.alert { border-color: var(--accent); border-left: 4px solid var(--accent); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fbfbfa; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); }
.celldate { display: block; font-size: .7rem; color: var(--muted); margin-top: .1rem; }
tr.off td { opacity: .55; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.b-ok      { background: #e6f4ea; color: var(--ok); }
.b-ko      { background: #fdeceb; color: var(--ko); }
.b-attente { background: #fdf1e0; color: var(--warn); }
.b-off     { background: #eeeeeb; color: var(--muted); }
.b-admin   { background: #f0e9fa; color: #6b3fa0; }

/* ---------- La page d'accueil : mes applications (refonte du 09/10/2026) ----------
   Trois façons de trouver la bonne application, de la plus rapide à la plus
   lente : la recherche (taper « dev bo », Entrée), « Récemment », puis les
   thèmes. Le bandeau sombre prolonge la barre de la suite : c'est le seul écran
   du portail qui en a un, celui par où l'on passe vingt fois par jour.
   Les couleurs des tuiles sont celles du THÈME (une palette dessinée, pas vingt
   couleurs au hasard), sauf les environnements : leur couleur est celle de leur
   bandeau (recette verte, preprod rouge, dev bleu) — on doit les reconnaître
   sans lire. */
[hidden] { display: none !important; }

.home { --home-max: 1200px; --c: #5b4636; }
.hero {
  background:
    radial-gradient(900px 340px at 12% -10%, rgba(185, 152, 127, .30), transparent 70%),
    radial-gradient(700px 300px at 95% 0%, rgba(120, 80, 50, .25), transparent 70%),
    #1d1d1b;
  color: #f4eee6;
  padding: 2.4rem 1.4rem 2.1rem;
}
.hero-in, .home-body { max-width: var(--home-max); margin: 0 auto; }
.hero h1 {
  font: 500 2.1rem/1.15 ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: .005em; margin: 0 0 .35rem; color: #fbf6ef;
}
.hero-sub { margin: 0 0 1.3rem; color: #b9b0a4; font-size: .92rem; }

.finder { position: relative; max-width: 640px; }
.finder input[type=search] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 52px; padding: 0 3.2rem 0 3rem;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px;
  background: #fffdfa; color: var(--ink); font-size: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
.finder input[type=search]::placeholder { color: #9b958b; }
.finder input[type=search]:focus { outline: 3px solid rgba(185, 152, 127, .65); outline-offset: 1px; }
.finder input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
.finder-ic { position: absolute; left: 1rem; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: #8a7a68; pointer-events: none; }
.finder-k {
  position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
  font: 600 .78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: #8a857c;
  border: 1px solid #ddd6cb; border-bottom-width: 2px; border-radius: 6px; padding: .25rem .45rem; background: #f7f3ec;
}
.is-searching .finder-k { display: none; }
.finder-hint { margin: .55rem 0 0 .2rem; font-size: .82rem; color: #b9b0a4; }
.finder-hint b { color: #fbf6ef; font-weight: 600; }

.recent { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.25rem; }
.recent-h {
  display: inline-flex; align-items: center; gap: .35rem; margin-right: .25rem;
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #9b9184; font-weight: 600;
}
.recent-h .ic { width: 14px; height: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 38px;
  padding: .3rem .8rem .3rem .35rem; border-radius: 999px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
  color: #f4eee6; text-decoration: none; font-size: .86rem; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.chip:hover, .chip:focus-visible { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .26); outline: none; }
.chip-ic {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--c); color: #fff;
}
.chip-ic .ic { width: 15px; height: 15px; }
.chip-t { font-weight: 500; }
.chip-ago { color: #9b9184; font-size: .76rem; }

.home-body { padding: 1.8rem 1.4rem 3rem; }
.home-body > .panel { margin-bottom: 1.6rem; }

/* Un thème : un TITRE DE RAYON, pas une application. Il est posé sur le fond de la
   page, au-dessus de sa boîte blanche, en petites capitales de la couleur du thème,
   avec une icône nue — rien qui ressemble à la tuile qu'on clique. (Première
   version : icône en tuile et titre en gras dans la boîte, « on ne sait pas si
   Ventes & marketing est un titre ou une application » — Nicolas, 09/10/2026.) */
.theme-h { margin: 0 0 .65rem; padding: 0 .2rem; }
.theme-h h2 {
  display: flex; align-items: center; gap: .45rem; margin: 0;
  font-size: .76rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c) 88%, #000);
}
.theme-ic { width: 16px; height: 16px; flex: 0 0 auto; }
.theme-h p { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.theme--wide { margin-bottom: 2.2rem; }

/* Les environnements : de grandes cartes, deux boutons. */
.envs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.env {
  display: flex; flex-direction: column; gap: 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 1.1rem 1.1rem 1.1rem; position: relative; overflow: hidden;
  box-shadow: 0 1px 2px rgba(29, 29, 27, .04);
}
.env::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.env-top { display: flex; gap: .85rem; align-items: flex-start; }
.env-t h3 { margin: .05rem 0 .2rem; font-size: 1.12rem; font-weight: 650; }
.env-t p { margin: 0; font-size: .84rem; line-height: 1.42; color: var(--muted); }
.env-go { display: flex; gap: .55rem; margin-top: auto; }
.go {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 42px; padding: .45rem .8rem; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 9%, #fff); color: color-mix(in srgb, var(--c) 85%, #000);
  border: 1px solid color-mix(in srgb, var(--c) 22%, #fff);
  font-weight: 600; font-size: .9rem; text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.go:hover, .go:focus-visible, .go.is-target { background: var(--c); border-color: var(--c); color: #fff; outline: none; }
.go-ic { width: 15px; height: 15px; opacity: .75; }

/* Les tuiles d'icône. */
.tile {
  display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c);
}
.tile .ic { width: 21px; height: 21px; }
.tile--solid {
  width: 44px; height: 44px; border-radius: 12px; color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 80%, #000));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 30%, transparent);
}
.tile--solid .ic { width: 22px; height: 22px; }

/* Les autres thèmes : des panneaux côte à côte, une ligne par application. */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.8rem 1.1rem; align-items: start; }
.theme-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: .55rem .45rem .45rem; box-shadow: 0 1px 2px rgba(29, 29, 27, .04);
  position: relative; overflow: hidden;
}
.theme-box::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: color-mix(in srgb, var(--c) 55%, #fff); }
.theme-list { display: flex; flex-direction: column; gap: 2px; }
/* `.app` est cantonné à l'accueil : la matrice de Comptes & droits a aussi des
   cellules `th.app` / `td.app`, qu'un `display: flex` sortait du tableau (13/10/2026). */
.home .app {
  display: flex; align-items: center; gap: .8rem; padding: .55rem .5rem; border-radius: 11px;
  color: var(--ink); text-decoration: none; position: relative;
  transition: background .12s;
}
.home a.app:hover, .home a.app:focus-visible, .home a.app.is-target { background: color-mix(in srgb, var(--c) 8%, #fff); outline: none; }
.app-t { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.app-t b { font-size: .95rem; font-weight: 620; line-height: 1.3; }
.app-t i { font-style: normal; font-size: .8rem; color: var(--muted); line-height: 1.38; margin-top: .05rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-go { flex: 0 0 auto; width: 16px; height: 16px; color: var(--c); opacity: 0; transform: translate(-3px, 3px); transition: opacity .12s, transform .12s; }
.home a.app:hover .app-go, .home a.app:focus-visible .app-go, .home a.app.is-target .app-go { opacity: 1; transform: none; }
.home .app--multi { align-items: flex-start; }
.home .app--multi .tile { margin-top: .1rem; }
.subs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.pick {
  display: inline-flex; align-items: center; min-height: 30px; padding: .2rem .65rem; border-radius: 8px;
  background: color-mix(in srgb, var(--c) 8%, #fff); border: 1px solid color-mix(in srgb, var(--c) 20%, #fff);
  color: color-mix(in srgb, var(--c) 85%, #000); font-size: .8rem; font-weight: 600; text-decoration: none;
}
.pick:hover, .pick:focus-visible, .pick.is-target { background: var(--c); border-color: var(--c); color: #fff; outline: none; }

.nomatch { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .95rem; }

/* Téléphone : une colonne, des cibles au doigt, rien au survol seul. */
@media (max-width: 640px) {
  /* Sur un téléphone, la barre du portail passe sur trois lignes (130 px) : collée
     en haut, elle mangerait un sixième de l'écran pendant qu'on fait défiler les
     applications. Elle reste en haut de page, elle ne suit plus. Le portail seul :
     la feuille commune (zgateau-suite.css) n'est pas touchée. */
  .zg-bar { position: relative; }
  .hero { padding: 1.5rem 1rem 1.4rem; }
  .hero h1 { font-size: 1.65rem; }
  .hero-sub { font-size: .85rem; margin-bottom: 1rem; }
  .finder input[type=search] { height: 48px; font-size: 16px; padding-right: 1rem; }  /* 16 px : pas de zoom iOS */
  .finder-k { display: none; }
  .recent { gap: .4rem; margin-top: 1rem; }
  .recent-h { width: 100%; }
  .recent .chip:nth-of-type(n+5) { display: none; }   /* quatre suffisent au pouce */
  .chip-ago { display: none; }
  .chip { font-size: .82rem; }
  .home-body { padding: 1.3rem 1rem 2.4rem; }
  .envs { grid-template-columns: 1fr; gap: .9rem; }
  .themes { grid-template-columns: 1fr; gap: 1.7rem; }
  .theme--wide { margin-bottom: 1.7rem; }
  .go { min-height: 46px; }
  .home .app { padding: .6rem .5rem; }
  .app-t i { -webkit-line-clamp: 1; }
  .env { gap: .85rem; padding: 1rem; }
  .env-t p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .theme-box { padding: .35rem; }
  .app-go { opacity: .55; transform: none; }
  .pick { min-height: 36px; padding: .3rem .8rem; }
}

/* ---------- La matrice des droits ---------- */
.matrix th.app { text-align: center; border-left: 1px solid var(--line); min-width: 132px; }
.matrix td.app { text-align: center; border-left: 1px solid var(--line); }
.matrix td.app select { min-width: 118px; font-size: .84rem; padding: .2rem .3rem; }
.matrix tbody tr:hover td { background: #fbfaf8; }
/* « vu le 2026-09-14 » se coupait au tiret quand les applications se multiplient :
   la colonne État finissait sur trois lignes et chaque personne prenait 80 px. */
.matrix .celldate { white-space: nowrap; }

/* Volets figés, comme dans un tableur : l'en-tête reste en vue quand on descend,
   la colonne des personnes quand on va vers la droite — sinon, à la dixième
   application, on ne sait plus à qui ni à quoi appartient la case qu'on modifie.
   Le tableau défile DANS son cadre (.matrixwrap) : `position: sticky` se cale sur
   l'ancêtre qui défile, et un cadre en overflow-x:auto défile aussi en y — il lui
   faut donc une hauteur, sans quoi l'en-tête ne se figerait jamais (la page
   défile, pas le cadre). La hauteur laisse la barre, le titre et le bouton
   « Enregistrer » à l'écran.
   ⚠️ border-collapse:collapse et sticky font mauvais ménage (les bordures ne
   suivent pas la cellule) : la matrice passe en `separate` avec un espacement nul,
   ce qui dessine exactement les mêmes traits. */
.matrixwrap { max-height: max(360px, calc(100vh - 11rem)); overflow: auto; }
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix thead th { position: sticky; top: 0; z-index: 2; }
.matrix th:first-child, .matrix td:first-child {
  position: sticky; left: 0; z-index: 1; background: var(--panel);
  border-right: 1px solid var(--line); white-space: nowrap;
}
.matrix thead th:first-child { z-index: 3; background: #fbfbfa; }
/* Un compte suspendu s'estompe. Mais l'opacité s'appliquerait aussi au fond de la
   cellule figée, et ce qui glisse dessous transparaîtrait : on estompe le contenu. */
.matrix tr.off td { opacity: 1; }
.matrix tr.off td > * { opacity: .55; }
/* L'ombre qui dit « ceci ne bouge pas » — seulement une fois que le tableau a
   glissé dessous (classes posées par le script d'admin.php), sinon rien. Un
   pseudo-élément par cellule : les bandes se touchent et forment un seul liseré,
   là où des box-shadow juxtaposés feraient des festons. */
.matrixwrap.is-scrolled-y .matrix thead th::after,
.matrixwrap.is-scrolled-x .matrix th:first-child::before,
.matrixwrap.is-scrolled-x .matrix td:first-child::before {
  content: ""; position: absolute; pointer-events: none;
}
.matrixwrap.is-scrolled-y .matrix thead th::after {
  left: 0; right: 0; bottom: -7px; height: 6px;
  background: linear-gradient(rgba(0,0,0,.09), rgba(0,0,0,0));
}
.matrixwrap.is-scrolled-x .matrix th:first-child::before,
.matrixwrap.is-scrolled-x .matrix td:first-child::before {
  top: 0; bottom: 0; right: -7px; width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,.09), rgba(0,0,0,0));
}

/* ---------- Ce qui ne s'affiche qu'une fois ---------- */
.codelist { list-style: none; padding: 0; margin: .6rem 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .4rem; }
.codelist li { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95rem;
  background: #faf8f5; border: 1px solid var(--line); border-radius: 5px; padding: .3rem .5rem; text-align: center; }
code.secret { font-size: 1rem; letter-spacing: .06em; background: #faf8f5; border: 1px solid var(--line);
  border-radius: 5px; padding: .25rem .5rem; display: inline-block; }
code.breakall { word-break: break-all; letter-spacing: 0; font-size: .82rem; }
.qr { background: #fff; padding: .6rem; display: inline-block; border: 1px solid var(--line); border-radius: 8px; }
.qr svg { display: block; width: 190px; height: 190px; }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem; }

/* ---------- La pastille des demandes en attente ----------
   Elle vit dans la barre du haut, sur « Comptes & droits », et sur l'accueil.
   C'est le canal qui ne tombe jamais : il ne dépend ni du réseau, ni d'un
   relais de courrier — seulement de la base qu'on est déjà en train de lire. */
.zg-dot {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  margin-left: .45rem; padding: 0 5px; border-radius: 999px;
  background: #93382c; color: #fff;
  font-size: 11px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
  vertical-align: 1px;
}
.zg-dot--big {
  min-width: 40px; height: 40px; margin: 0; font-size: 17px; border-radius: 12px;
}

/* Une case à cocher lisible dans un formulaire en colonne.
   ⚠️ form.stack impose une largeur minimale aux <input> : sans width:auto,
   la case pousse son libellé dans une colonne de 280 px. */
label.check { display: flex; align-items: center; gap: .55rem; font-size: .9rem;
  color: var(--muted); cursor: pointer; margin-top: 1rem; align-self: stretch; }
form.stack label.check input[type=checkbox] { min-width: 0; width: auto; margin: 0; flex: 0 0 auto; }

/* --- Les portées, sous le rôle, dans la matrice des accès ----------------- */
/* Discrètes par construction : la plupart des applications n'en déclarent pas,
   et celles qui en ont ne doivent pas pour autant doubler la hauteur du tableau. */
.matrix .portees { display: flex; flex-direction: column; gap: 1px; margin-top: 4px;
                   padding-top: 4px; border-top: 1px dashed var(--line, #d8d2c8); }
.matrix .portees label { display: flex; align-items: center; gap: 4px;
                         font-size: .72rem; line-height: 1.25; color: var(--muted, #6b6257);
                         white-space: nowrap; cursor: pointer; }
.matrix .portees input { margin: 0; transform: scale(.85); }
.matrix .portees label:hover { color: var(--ink, #2b2b2b); }
