/* Big dictionnaire : ce que le kit BigTime ne fournit pas (tableaux, listes, mise en page), habillé avec ses tokens.
   Règles de la charte : capitales pour les titres et les actions, rouge réservé aux gros caractères et aux filets,
   angles droits sauf champs (3 px) et étiquettes, espacements en multiples de 5 px, un état porte toujours un mot.
   Écart assumé : la zone de travail prend toute la largeur, le tableau des colonnes ne tient pas dans 1 140 px. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-sans); font-size: 15px; line-height: 21px; color: var(--ink); background: var(--surface); }
[hidden] { display: none !important; }
.accent { color: var(--brand); }
.muet { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); font-size: 13px; }
.petit { font-size: 12px; line-height: 18px; }

/* --- En-tête --- */
.entete { position: sticky; top: 0; z-index: 5; background: var(--surface); }
.marque { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--ink); }
.marque-titre { font-size: 16px; line-height: 16px; text-transform: uppercase; white-space: nowrap; }
.marque-titre b { font-size: 24px; font-weight: 700; }
.compte { display: flex; align-items: center; gap: var(--space-3); white-space: nowrap; }
.bandeau { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-4);
           border-bottom: 1px solid var(--border); background: var(--surface-sunken); font-size: 14px; line-height: 21px; min-height: 45px; }
.bandeau .alerte { color: var(--danger); font-weight: 700; }
.bandeau .pousse { margin-left: auto; }

/* --- Mise en page --- */
#app { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 140px); }
#app.plein { grid-template-columns: 1fr; }
.volet { border-right: 1px solid var(--border); overflow: auto; }
.volet-outils { position: sticky; top: 0; z-index: 1; padding: var(--space-2); background: var(--surface); border-bottom: 1px solid var(--border); }
.detail { overflow: auto; padding: var(--space-4) var(--space-5) var(--space-8); }
.vide { padding: var(--space-6); text-align: center; color: var(--ink-muted); }

/* --- Listes du volet --- */
.rang { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); width: 100%; padding: var(--space-2);
        border: 0; border-bottom: 1px solid var(--border); border-left: 4px solid transparent; background: transparent;
        font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rang:hover { background: var(--surface-sunken); }
.rang:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rang[aria-current="true"] { border-left-color: var(--brand); background: var(--surface-sunken); }
.rang b { font-family: var(--font-mono); font-size: 13px; }
.rang .libelle { flex: 1 1 100%; font-size: 12px; line-height: 18px; color: var(--ink-muted); }

/* --- Titres et sections --- */
.titre { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-1); }
.titre .nom { font-family: var(--font-mono); font-size: 24px; line-height: 32px; font-weight: 700; }
.section { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-5) 0 var(--space-2);
           font-size: 16px; line-height: 22px; font-weight: 700; text-transform: uppercase; }
.section img { height: 16px; width: auto; }
.avis { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); margin: var(--space-2) 0;
        border-left: 4px solid var(--border-strong); background: var(--surface-sunken); }
.avis--danger { border-left-color: var(--danger); background: var(--danger-surface); color: var(--danger); }
.avis--info { border-left-color: var(--info); background: var(--info-surface); color: var(--info); }

/* --- Cartes et lignes de saisie --- */
.bt-card { margin-bottom: var(--space-2); }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ligne .bt-label { flex: none; min-width: 115px; }
.puce { font-family: var(--font-mono); font-size: 12px; padding: 0 var(--space-1); border: 1px solid var(--border); background: var(--surface-sunken); }
a.puce { color: var(--ink); text-decoration: none; }
a.puce:hover { border-color: var(--brand); }
.l-100 { max-width: 100px; } .l-130 { max-width: 130px; } .l-160 { max-width: 160px; } .l-220 { max-width: 220px; }
.l-420 { max-width: 420px; } .l-600 { max-width: 600px; } .l-700 { max-width: 700px; }
textarea.bt-input { min-height: 40px; resize: vertical; }
td .bt-input { padding: 5px 10px; }
td .bt-input + .bt-input { margin-top: var(--space-1); }
select.bt-input { padding-right: var(--space-2); }
select.etat { width: auto; padding: 5px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-2) 0; }
.filtres label { display: inline-flex; align-items: center; gap: var(--space-1); }
.filtres input[type="checkbox"] { accent-color: var(--brand); width: 15px; height: 15px; }

/* --- Tableaux --- */
.grille { width: 100%; border-collapse: collapse; border: 1px solid var(--border); }
.grille th { position: sticky; top: 0; z-index: 1; padding: var(--space-2); text-align: left; background: var(--surface);
             border-bottom: 2px solid var(--border-strong); font-size: 12px; line-height: 12px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); }
.grille td { padding: var(--space-2); border-bottom: 1px solid var(--border); vertical-align: top; }
.grille tr.e-pre td:first-child { box-shadow: inset 4px 0 0 var(--warning); }
.grille tr.e-ok td:first-child { box-shadow: inset 4px 0 0 var(--success); }
.grille tr.e-cor td:first-child { box-shadow: inset 4px 0 0 var(--info); }
.c-110 { width: 110px; } .c-120 { width: 120px; } .c-150 { width: 150px; } .c-170 { width: 170px; } .c-200 { width: 200px; }
.c-220 { width: 220px; } .c-260 { width: 260px; }
/* Le tableau des colonnes : les notes et les pièges, ce qu'on saisit, prennent la place. */
.grille-colonnes { table-layout: fixed; min-width: 1000px; }
.p-10 { width: 10%; } .p-13 { width: 13%; } .p-16 { width: 16%; } .p-17 { width: 17%; } .p-22 { width: 22%; }
.grille-colonnes td { overflow-wrap: anywhere; }
.grille-colonnes textarea.bt-input { min-height: 65px; }
.colonne-nom { font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.avant { color: var(--ink-muted); text-decoration: line-through; }
.fleche { color: var(--ink-muted); padding: 0 var(--space-1); }

/* --- Formulaire d'ajout d'une relation --- */
details > summary { cursor: pointer; margin-top: var(--space-2); font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); }
.ajout { display: grid; grid-template-columns: 1fr 1fr 120px; gap: var(--space-2); align-items: start; margin-top: var(--space-2); }
.ajout textarea { grid-column: 1 / span 2; }
.ajout .large { grid-column: 1 / -1; }

/* --- Actions --- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin: var(--space-4) 0; }
.bt-btn--sm.serre { font-size: 12px; padding-top: var(--space-1); padding-bottom: var(--space-1); }
.bt-btn--solid.bt-btn--sm { padding: var(--space-2) var(--space-4); }

/* --- Message en bas d'écran --- */
#message { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: 9; max-width: 60vw; padding: var(--space-2) var(--space-3);
           background: var(--surface-invert); color: var(--ink-invert); box-shadow: var(--shadow-panel); font-size: 14px; opacity: 0; pointer-events: none;
           transition: opacity 200ms linear; }
#message.visible { opacity: 1; }
#message.erreur { border-left: 4px solid var(--brand); }

/* --- Page de connexion --- */
.page-connexion { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.connexion { width: 100%; max-width: 460px; padding: var(--space-6) var(--space-4); }
.connexion-logo { display: block; margin-bottom: var(--space-6); }
.connexion-titre { margin: 0 0 var(--space-3); }
.connexion-form { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-5); margin-top: var(--space-5); }
.connexion-form .bt-field { width: 100%; }

@media (max-width: 1100px) {
  .bt-nav { height: auto; flex-wrap: wrap; padding: var(--space-2) var(--space-4); gap: var(--space-2) var(--space-4); }
  #app { height: auto; grid-template-columns: 1fr; }
  .volet { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--border); }
}
