/*
 * Settings page styles — shared by every app's /settings.
 * Loaded via main.css @import; symlinked into every app via SHARED_PATHS.
 *
 * Owns:
 *   .settings-xref-card       cross-reference card (deep-link to other app)
 *   .logo-section             central tenant-logo card (managed in xorizo)
 *
 * Per-app duplicates (airfact-custom.css, xorizo organization.css) were
 * removed in Phase 5d so this file is the single source.
 */

/* ── Cross-reference card ─────────────────────────────────────────────── */
.settings-xref-card {
    display: flex; align-items: center; gap: var(--space-4);
    padding: var(--space-4); border: 1px solid var(--border);
    border-radius: 8px; background: var(--color-surface-2);
    margin-bottom: var(--space-3);
}
.settings-xref-card__body { flex: 1; min-width: 0; }
.settings-xref-card__title { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.settings-xref-card__value { font-size: .95rem; color: var(--text-primary); margin-bottom: 4px; }
.settings-xref-card__desc  { font-size: .8rem;  color: var(--text-secondary); line-height: 1.4; }

/* ── Section separator — used between sections in settings tab views ─── */
.settings-sep {
    border: 0;
    border-top: 1px solid var(--border);
    margin: var(--space-6) 0;
}

/* ── Logo section (managed in xorizo) ─────────────────────────────────── */
.logo-section { display: flex; flex-direction: column; gap: var(--space-4); }
.logo-section--compact { flex-direction: row; align-items: center; gap: var(--space-3); }
.logo-preview { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.tenant-logo  { max-width: 100%; max-height: 120px; object-fit: contain; border-radius: 6px; }
.logo-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
    padding: var(--space-6); background: var(--color-surface-2);
    border: 2px dashed var(--border); border-radius: 8px;
    color: var(--text-secondary); text-align: center;
}
.logo-actions { display: flex; gap: var(--space-2); justify-content: center; }
.logo-recommendations h4 { font-size: .8rem; font-weight: 600; margin-bottom: .4rem; color: var(--text-secondary); }
.logo-recommendations ul { font-size: .8rem; color: var(--text-secondary); padding-left: 1.2rem; margin: 0; }
.logo-recommendations li { margin-bottom: .2rem; }

/* ── Sous-titre d'une section de réglages ─────────────────────────────────
 *
 * Le texte gris sous un `section_header()` : ce que la section décide, en une
 * phrase. Il était écrit à la main dans CHAQUE vue —
 * `<p class="text-secondary text-sm" style="margin:.2rem 0 var(--space-4)">` —
 * et mesuré le 14-09-2026 sur /settings : QUATRE marges différentes pour un
 * seul rôle (`--space-4` ×11, `--space-3` ×3, `0 0 --space-4`, `--space-5`).
 * Un rôle, une classe ; la valeur retenue est la majoritaire.
 *
 * ⚠ Elle porte AUSSI la couleur et la taille : `.text-secondary.text-sm` sur
 * chaque paragraphe, c'est trois classes pour dire « sous-titre » — et rien
 * n'empêchait d'en oublier une. Ici le rôle se nomme une fois.
 */
.settings-hint {
    margin: .2rem 0 var(--space-4);
    font-size: .875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
/* Un sous-titre qui précède IMMÉDIATEMENT une table respire un cran de moins :
   le cadre du tableau porte déjà son propre bord haut. */
.settings-hint--table { margin-bottom: var(--space-3); }

/* ── L'INTRO D'UN PANNEAU D'ONGLET ────────────────────────────────────────
 *
 * Pas un sous-titre de section : la phrase qui ouvre TOUT un onglet, avant le
 * premier bloc, et qui dit à quoi sert cette intégration. Elle respire un cran
 * de plus, parce que ce qui la suit est un bloc entier (une alerte, un cadre de
 * tableau, un formulaire), pas une rangée de champs.
 *
 * Mesuré sur `/integrations` le 15-09-2026 : les CINQ panneaux la rendaient à
 * la main, `<p class="text-secondary text-sm" style="margin:0 0 var(--space-5)">`
 * — la même valeur recopiée cinq fois, et trois classes pour dire « intro ».
 */
.settings-hint--panneau { margin: 0 0 var(--space-5); }

/* Le même rôle DANS une pile qui espace déjà (`.form-layout`, `.form`) : la
 * gouttière vient du conteneur, la note ne doit rien ajouter. Sans ce cran, le
 * seul recours était `style="margin:0"` — soit un quatrième endroit où la
 * valeur se décide. La règle du socle : le rôle se nomme, l'espacement se
 * choisit parmi des crans NOMMÉS, jamais en ligne. */
.settings-hint--nu { margin: 0; }

/* ==========================================================================
   LA NAVIGATION LATÉRALE DES PARAMÈTRES — `$shellNav = 'rail'` (2026-09-29)
   Balisage : App\Core\SettingsRail ; comportement : modules/settings-rail.js.
   Inerte tant qu'aucune page n'opte (toutes les règles sont sous .srail).

   ⚠ L'ENTRÉE ACTIVE PARLE LA LANGUE DE LA BARRE LATÉRALE DE LA PLATEFORME
   (navigation.css, `.sidebar-nav .active > a`) : fond --color-surface-2,
   texte --primary, ni bordure ni ombre. Décision Olivier du 29-09 sur la
   maquette (« la grosse border à gauche est moche »). Ne pas y remettre un
   liseré : deux marqueurs d'actif différents sur un même écran se lisent
   comme deux systèmes.
   ========================================================================== */
.srail {
  display: grid;
  grid-template-columns: 252px minmax(0, 880px);
  gap: var(--space-8);
  align-items: start;
}
.srail-nav {
  position: sticky;
  top: calc(var(--topbar-height, 80px) + var(--space-4));
  max-height: calc(100vh - var(--topbar-height, 80px) - var(--space-8));
  overflow-y: auto;
  padding-right: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.srail-search { position: relative; }
.srail-search > svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.srail-search-input {
  width: 100%; height: 36px; box-sizing: border-box;
  padding: 0 10px 0 32px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.875rem;
}
.srail-search-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.srail-results {
  position: absolute; left: 0; right: 0; top: 40px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: var(--z-popover); max-height: 360px; overflow-y: auto; padding: 4px;
}
.srail-hit {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; color: var(--text);
}
.srail-hit:hover, .srail-hit[aria-selected="true"] { background: var(--color-surface-2); }
.srail-hit strong { display: block; font-size: 0.875rem; font-weight: 600; }
.srail-hit small { color: var(--text-muted); font-size: 0.75rem; }
.srail-none { padding: 10px; color: var(--text-muted); font-size: 0.875rem; }

.srail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.srail-group { display: flex; flex-direction: column; }
.srail-group-label {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 10px 4px;
}
.srail-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius);
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.9rem; line-height: 1.25;
  transition: background var(--transition), color var(--transition);
}
.srail-link:hover,
.srail-link[aria-current="page"] { background: var(--color-surface-2); color: var(--primary); }
.srail-link[aria-current="page"] { font-weight: 600; }
.srail-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.srail-link-label { flex: 1; min-width: 0; }
.srail-count { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.srail-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--state-amber-dot); }
.srail-list--top .srail-link { font-weight: 600; color: var(--text); }
.srail-foot { border-top: 1px solid var(--border); padding-top: var(--space-3); font-size: 0.8125rem; color: var(--text-muted); }

/* La section : une question, une page courte */
.srail-content { min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.srail-content > .tab-content.active { display: flex; flex-direction: column; gap: var(--space-5); }
.srail-back { display: none; }
.srail-head { display: flex; flex-direction: column; gap: 6px; }
.srail-eyebrow {
  margin: 0; font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.srail-title { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--text); outline: none; }
.srail-lede { margin: 0; color: var(--text-secondary); font-size: 0.95rem; max-width: 68ch; }
.srail-state {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 6px;
  padding: 12px 14px; border-radius: var(--radius); font-size: 0.9rem; line-height: 1.45;
}
.srail-state > svg { flex-shrink: 0; margin-top: 1px; }
.srail-state a { color: inherit; font-weight: 600; }
.srail-state--ok   { background: var(--state-green-bg); color: var(--state-green-fg); }
.srail-state--todo { background: var(--state-amber-bg); color: var(--state-amber-fg); }
.srail-state--info { background: var(--state-blue-bg);  color: var(--state-blue-fg); }
.srail-flash { animation: srailFlash 1.6s ease-out; border-radius: var(--radius); }
@keyframes srailFlash { 0% { box-shadow: 0 0 0 4px var(--state-amber-bg); } 100% { box-shadow: 0 0 0 0 transparent; } }
.srail-crumb:not(:empty)::before { content: "›"; margin: 0 var(--space-2); }
.srail-crumb { font-weight: 500; color: var(--text-muted); font-size: 1rem; }

/* La barre d'enregistrement : collée au bas de la colonne, n'existe que s'il y a
   quelque chose à enregistrer ([hidden] du socle). Surface blanche, boutons du
   socle — aucune couleur forcée. */
.srail-savebar {
  /* ⚠ --z-topbar, JAMAIS --z-float : une barre de PAGE passe sous tout ce qui
     s'ouvre par-dessus la page (le dialogue « Quitter sans enregistrer » lui-même
     était recouvert, bouton « Rester » inatteignable — vu par la sonde). */
  position: sticky; bottom: var(--space-5); z-index: var(--z-topbar);
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 12px 10px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.srail-savebar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--state-amber-dot); flex-shrink: 0; }
.srail-savebar-text { flex: 1; font-size: 0.9rem; font-weight: 600; }

/* Une section LISTE (`'largeur' => 'pleine'`) : la colonne remplit la page
   tant qu'elle est ouverte — le rail bascule `.active`, :has suit. */
@media (min-width: 901px) {
  .srail:has(> .srail-content > .tab-content.active[data-srail-pleine]) {
    grid-template-columns: 252px minmax(0, 1fr);
  }
}

/* ── Mobile : deux écrans, la liste PUIS la section ─────────────────────── */
@media (max-width: 900px) {
  .srail { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .srail-nav { position: static; max-height: none; overflow: visible; padding: 0; }
  .srail.srail--liste .srail-content { display: none; }
  .srail:not(.srail--liste) .srail-nav { display: none; }
  .srail-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.9rem; font-weight: 600; color: var(--primary); text-decoration: none;
  }
  .srail-group, .srail-list--top {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; background: var(--surface);
  }
  .srail-group-label { padding: 10px 12px 6px; background: var(--bg); }
  .srail-link { padding: 12px; border-radius: 0; font-size: 1rem; }
  .srail-list li + li .srail-link { border-top: 1px solid var(--gray-100); }
  .srail-link::after { content: "›"; color: var(--text-muted); font-size: 1.2rem; }
  .srail-crumb { display: none; }
  .srail-savebar-where { display: none; }
}

/* ── La liste de contrôle d'une page d'accueil de paramètres (« Vue d'ensemble »,
   airfact 29-09-2026) : une ligne = un état, UNE phrase, le lien qui règle. ── */
.srail-progress { display: flex; align-items: center; gap: var(--space-4); }
.srail-progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--gray-200); overflow: hidden; }
.srail-progress-bar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
.srail-progress-text { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.srail-check { list-style: none; margin: 0; padding: 0; }
.srail-check-item {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--gray-100);
}
.srail-check-item:first-child { border-top: 0; }
.srail-check-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.srail-check-ico--fait { background: var(--state-green-bg); color: var(--state-green-fg); }
.srail-check-ico--a_faire { background: var(--state-amber-bg); color: var(--state-amber-fg); }
.srail-check-ico--info,
.srail-check-ico--non_mesurable,
.srail-check-ico--facultatif { background: var(--gray-100); color: var(--text-muted); }
.srail-check-name { font-weight: 600; font-size: 0.925rem; color: var(--text); }
.srail-check-text { font-size: 0.875rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.45; }
.srail-check-go { font-size: 0.85rem; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; padding-top: 2px; }
.srail-check-go:hover { text-decoration: underline; }
.srail-check-item--a_faire .srail-check-go { color: var(--state-amber-fg); }
@media (max-width: 900px) {
  .srail-check-item { grid-template-columns: 24px minmax(0, 1fr); }
  .srail-check-go { grid-column: 2; }
}
.srail-progress-bloc { display: flex; flex-direction: column; gap: var(--space-3); }
/* Un lien DANS une phrase d'aide se voit : sans cela, « … se règlent dans
   Outils branchés › Pennylane » se lisait comme du texte (constaté au rail). */
.srail .settings-hint a, .srail .srail-lede a { color: var(--primary); font-weight: 600; }
