/* GoScale — charte bleu nuit + jaune. Mobile d'abord. */
:root {
  --bg: #f4f5f9; --surface: #ffffff; --fg: #141a2e; --muted: #5b6382; --line: #dde1ec;
  --nuit: #16213f; --jaune: #f2b705; --jaune-encre: #6e5100; --jaune-doux: #fff4cc;
  --ok: #1f7a4d; --ok-doux: #e3f4ea; --alerte: #a35a00; --alerte-doux: #fdeedb; --rouge: #b3261e; --rouge-doux: #fbe4e2;
  --rayon: 14px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1122; --surface: #151c33; --fg: #e8ebf5; --muted: #9aa3c0; --line: #283152;
    --nuit: #0a0f1f; --jaune: #f5c431; --jaune-encre: #f5c431; --jaune-doux: #2c2714;
    --ok: #6fd29c; --ok-doux: #14301f; --alerte: #f0a85a; --alerte-doux: #33240f; --rouge: #ff8a80; --rouge-doux: #3a1715;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
.barre {
  position: sticky; top: 0; z-index: 5; background: var(--nuit); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.marque { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--jaune); color: #16213f; display: grid; place-items: center; font-weight: 800; }
.lien-discret { background: none; border: 0; color: #cfd5ea; font: inherit; font-size: .9rem; cursor: pointer; padding: 8px; }
.page { max-width: 960px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
p { margin: 0; }
.sous { color: var(--muted); font-size: .92rem; }
.chargement { color: var(--muted); }
a { color: inherit; }
.retour { color: var(--muted); text-decoration: none; font-size: .92rem; }

/* Carrés */
.carres { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.carre {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--rayon); padding: 16px;
  display: flex; flex-direction: column; gap: 8px; min-height: 128px; text-decoration: none; color: inherit;
}
.carre:hover, .carre:focus-visible { border-color: var(--jaune); }
.carre .titre { font-weight: 700; }
.carre .chiffre { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--nuit); }
@media (prefers-color-scheme: dark) { .carre .chiffre { color: var(--jaune); } }
.carre .detail { color: var(--muted); font-size: .85rem; margin-top: auto; }
.carre.bientot { opacity: .55; border-style: dashed; pointer-events: none; }
.carre.alerte { border-color: var(--jaune); background: var(--jaune-doux); }

/* Cartes et listes */
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--rayon); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.carte.faite { opacity: .65; }
.ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pastille { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.p-chaud { background: var(--rouge-doux); color: var(--rouge); }
.p-tiede { background: var(--alerte-doux); color: var(--alerte); }
.p-ok { background: var(--ok-doux); color: var(--ok); }
.p-jaune { background: var(--jaune-doux); color: var(--jaune-encre); }
.citation { border-left: 3px solid var(--line); padding-left: 10px; color: var(--muted); font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }

/* Onglets */
.onglets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.onglet { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: .9rem; cursor: pointer; }
.onglet[aria-selected="true"] { background: var(--nuit); color: #fff; border-color: var(--nuit); }

/* Formulaires */
label { font-size: .88rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.case { flex-direction: row; align-items: center; gap: 8px; color: var(--fg); }
.case input { width: auto; }
.boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 11px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg); min-height: 44px; }
.btn-principal { background: var(--jaune); border-color: var(--jaune); color: #16213f; }
.btn-danger { color: var(--rouge); }
.btn:disabled { opacity: .5; cursor: default; }
.message { font-size: .9rem; padding: 10px 12px; border-radius: 10px; }
.message.erreur { background: var(--rouge-doux); color: var(--rouge); }
.message.ok { background: var(--ok-doux); color: var(--ok); }
.connexion { max-width: 420px; margin: 8vh auto 0; width: 100%; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: .95rem; word-break: break-all; background: var(--bg); padding: 10px; border-radius: 8px; user-select: all; }

/* Tableau BCE */
.tableau { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--rayon); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 640px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { .carre, .btn { transition: border-color .15s, background .15s; } }
