/* Étude 7G — même langage que la Bibliothèque et le logiciel 7G : bleu 7G, Lexend, surfaces douces, clair / sombre. */
@font-face { font-family: "Lexend"; src: url(/polices/lexend.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
:root {
  --bleu: #0C3D63; --bleu-2: #15507F;
  --bg: #EEF2F6; --surface: #FFFFFF; --surface2: #F4F7FA; --ink: #0E2233; --ink-soft: #43566A; --muted: #6B7D90;
  --line: #DDE4EC; --line-2: #C9D4DE; --accent: #0C3D63; --accent-doux: #DCE8F2;
  --vert: #1F8A55; --vert-doux: #DDF3E6; --rouge: #C23A3E; --rouge-doux: #FBE4E5; --orange: #B8741A; --orange-doux: #FBEFD9;
  --shadow: 0 1px 0 rgba(12,61,99,.04), 0 10px 24px -16px rgba(12,61,99,.30); --shadow-lg: 0 2px 6px rgba(12,61,99,.10), 0 30px 60px -28px rgba(12,61,99,.45);
  --r: 12px; --f: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0A1724; --surface: #112233; --surface2: #0E1D2C; --ink: #E6EEF5; --ink-soft: #B6C4D2; --muted: #8FA2B4;
  --line: #1E3347; --line-2: #27405A; --accent: #8DC0EA; --accent-doux: #16304A; --vert: #4CC486; --vert-doux: #123325;
  --rouge: #F07378; --rouge-doux: #3A1A1D; --orange: #E3A450; --orange-doux: #3A2A12;
  --shadow: 0 1px 0 rgba(0,0,0,.25), 0 12px 26px -16px rgba(0,0,0,.7); --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 30px 60px -28px rgba(0,0,0,.8);
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--f); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid #2E6DA4; outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); }
.btn.primaire { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn.primaire:hover { background: var(--bleu-2); }
.btn.discret { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn.discret:hover { background: var(--surface2); }
.btn.danger { color: var(--rouge); }
.btn.petit { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* Connexion */
.connexion { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 6px; }
.logo-grand img { width: 64px; height: 64px; }
.connexion .sous { color: var(--muted); margin: 0 0 14px; }
.carte-connexion { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.carte-connexion label, .champ { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; font-size: 14px; color: var(--ink); min-width: 0; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.erreur { color: var(--rouge); margin: 0; min-height: 1em; font-size: 13px; }
.aide { color: var(--muted); font-size: 12px; margin: 0; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.marque { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 600; font-size: 16px; }
.marque img { width: 30px; height: 30px; }
.marque small { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: 12px; }
.fil { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; min-width: 0; overflow: hidden; }
.fil a { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.fil a:hover { color: var(--accent); }
.fil .sep { opacity: .6; }
.espace { flex: 1; }
.recherche { width: 280px; }

main { padding: 22px; max-width: 1280px; margin: 0 auto; }
.titre-page { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.titre-page h1 { font-size: 22px; }
.titre-page .sous { color: var(--muted); font-size: 13px; margin-top: 3px; }
.titre-page .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.carte.lien { cursor: pointer; transition: border-color .15s, transform .15s; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.carte.lien:hover { border-color: var(--accent); transform: translateY(-1px); }
.carte .t { font-weight: 600; font-size: 15px; }
.carte .m { color: var(--muted); font-size: 12.5px; }
.carte.archive { opacity: .6; }
.vide { text-align: center; color: var(--muted); padding: 40px 10px; }
.pastille { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--accent-doux); color: var(--accent); }
.pastille.vert { background: var(--vert-doux); color: var(--vert); }
.pastille.orange { background: var(--orange-doux); color: var(--orange); }
.pastille.rouge { background: var(--rouge-doux); color: var(--rouge); }
.pastille.gris { background: var(--surface2); color: var(--muted); }

.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.onglets button { background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--ink-soft); font-weight: 500; }
.onglets button.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Plans */
.depot { border: 2px dashed var(--line-2); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); background: var(--surface2); margin-bottom: 16px; cursor: pointer; }
.depot.survol { border-color: var(--accent); background: var(--accent-doux); color: var(--accent); }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.plan-carte { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.plan-carte .vignette { aspect-ratio: 1.414; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; border-bottom: 1px solid var(--line); overflow: hidden; }
.plan-carte .vignette canvas { max-width: 100%; max-height: 100%; }
.plan-carte .infos { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.plan-carte .nom { font-weight: 600; font-size: 13.5px; word-break: break-word; }
.plan-carte .m { color: var(--muted); font-size: 12px; }
.plan-carte .outils { display: flex; gap: 4px; padding: 0 8px 8px; }

/* Tableaux */
table.t { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 10px; background: var(--surface2); border-bottom: 1px solid var(--line); }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: none; }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .fam td { background: var(--surface2); font-weight: 600; color: var(--accent); font-size: 12.5px; }
.picto { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; border: 1px solid var(--line); vertical-align: middle; }
.detail { color: var(--muted); font-size: 12.5px; }
.alerte { background: var(--orange-doux); color: var(--orange); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }

/* Devis */
.devis-entete { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.devis-lignes input, .devis-lignes textarea { width: 100%; }
.devis-lignes td { vertical-align: top; }
.devis-lignes tr.titre td { background: var(--surface2); }
.devis-lignes tr.titre input { font-weight: 600; color: var(--accent); }
.devis-lignes .qte { width: 80px; text-align: center; }
.devis-lignes .poignee { cursor: grab; color: var(--muted); user-select: none; padding-top: 14px; }
.devis-lignes tr.glisse { opacity: .4; }
.devis-lignes .auto { font-size: 11px; color: var(--muted); }
.barre-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }

/* Modale */
.modale { position: fixed; inset: 0; background: rgba(10,23,36,.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modale .boite { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modale h2 { font-size: 17px; }
.modale .pied { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow-lg); font-size: 13.5px; }
.chargement { color: var(--muted); padding: 30px; text-align: center; }

@media (max-width: 760px) { .recherche { display: none; } main { padding: 14px; } .entete { padding: 10px 14px; } }
