/* Cotio – interface (charte graphique V1.0, octobre 2026) */
@font-face { font-family: "Manrope"; src: url("fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --petrole: #174C50; --turquoise: #267C80; --graphite: #23282B; --mineral: #F4F6F4;
  --n0: #FFFFFF; --n50: #F4F6F4; --n100: #E8EDEC; --n200: #D0D9D8; --n300: #ACB9B9; --n400: #78868A;
  --n500: #576367; --n600: #3D494D; --n700: #23282B; --n900: #11191C;

  --fond: var(--n50); --surface: var(--n0); --surface-2: var(--n50); --surface-sel: #E3ECEB;
  --texte: var(--n700); --texte-2: var(--n500); --bord: var(--n100); --bord-champ: var(--n400);
  --action: var(--petrole); --action-texte: #FFFFFF; --action-survol: #0F3A3D; --accent: var(--turquoise);
  --succes: #206444; --alerte: #805200; --erreur: #A32E32; --info: #245B9B;
  --papier: #FFFFFF; --focus: var(--turquoise);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: var(--n900); --surface: var(--n700); --surface-2: #1A2225; --surface-sel: #2E3F42;
    --texte: var(--n50); --texte-2: var(--n300); --bord: #313A3E; --bord-champ: #8E9CA0;
    --action: #3B9A9E; --action-texte: #0B1416; --action-survol: #56B1B5; --accent: #6FC0C3;
    --succes: #A1D7B2; --alerte: #F2C66D; --erreur: #FFB1B3; --info: #A9C9F5;
  }
}
:root[data-theme="sombre"] {
  --fond: var(--n900); --surface: var(--n700); --surface-2: #1A2225; --surface-sel: #2E3F42;
  --texte: var(--n50); --texte-2: var(--n300); --bord: #313A3E; --bord-champ: #8E9CA0;
  --action: #3B9A9E; --action-texte: #0B1416; --action-survol: #56B1B5; --accent: #6FC0C3;
  --succes: #A1D7B2; --alerte: #F2C66D; --erreur: #FFB1B3; --info: #A9C9F5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond); color: var(--texte);
  font: 400 14px/22px "IBM Plex Sans", system-ui, sans-serif; letter-spacing: 0;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
h1, h2, h3 { font-family: "Manrope", sans-serif; font-weight: 650; margin: 0; }
h2 { font-size: 18px; line-height: 24px; letter-spacing: -0.01em; }
h3 { font-size: 15px; line-height: 22px; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- en-tête */
.entete {
  height: 64px; display: flex; align-items: center; gap: 32px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--bord);
}
.entete .logo { height: 28px; color: var(--petrole); display: block; }
:root[data-theme="sombre"] .entete .logo { color: var(--mineral); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .entete .logo { color: var(--mineral); } }
.nav { display: flex; gap: 8px; }
.nav button {
  background: none; border: 0; padding: 8px 12px; border-radius: 4px; cursor: pointer; color: var(--texte-2);
  font-size: 15px;
}
.nav button[aria-current="page"] { color: var(--texte); font-weight: 600; }
.nav button:hover { background: var(--surface-2); }
.entete .droite { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--texte-2); }
.pastille { display: inline-flex; align-items: center; gap: 8px; }
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--succes); }
.btn-icone {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 4px;
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--texte-2);
}
.btn-icone:hover { background: var(--surface-2); color: var(--texte); }
.btn-icone[aria-pressed="true"] { background: var(--surface-sel); color: var(--texte); border-color: var(--bord); }
.btn-icone svg { width: 20px; height: 20px; }

/* ---------- mise en page */
.page { display: none; height: calc(100% - 64px); }
.page.active { display: grid; }
#page-fichiers { grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 16px; padding: 16px; }
.panneau {
  background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 24px;
  display: flex; flex-direction: column; min-height: 0;
}
.panneau > h2 { margin-bottom: 16px; }

/* ---------- fichiers */
.depot {
  border: 1.5px dashed var(--bord-champ); border-radius: 8px; padding: 24px 16px; text-align: center;
  cursor: pointer; color: var(--texte); transition: background .15s;
}
.depot svg { width: 28px; height: 28px; color: var(--accent); }
.depot.survol { background: var(--surface-sel); border-color: var(--accent); }
.depot .sous { color: var(--texte-2); font-size: 13px; }
.depot .lien { color: var(--accent); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; }
.liste { list-style: none; margin: 16px -8px 0; padding: 0; overflow: auto; flex: 1; }
.liste li {
  padding: 12px; border-radius: 4px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  border: 1px solid transparent;
}
.liste li:hover { background: var(--surface-2); }
.liste li[aria-selected="true"] { background: var(--surface-sel); }
.liste .nom { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste .statut { grid-column: 1; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.liste .suppr { grid-row: 1 / span 2; grid-column: 2; align-self: center; opacity: 0; }
.liste li:hover .suppr, .liste li:focus-within .suppr { opacity: 1; }
.statut svg { width: 14px; height: 14px; flex: none; }
.s-pret { color: var(--succes); } .s-a_verifier { color: var(--alerte); } .s-erreur { color: var(--erreur); }
.s-en_cours, .s-a_generer { color: var(--texte-2); }
.confidentialite { color: var(--texte-2); font-size: 12px; line-height: 18px; margin-top: 12px; display: flex; gap: 6px; }
.confidentialite svg { width: 16px; height: 16px; flex: none; }

/* ---------- aperçu */
.apercu-tete { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.apercu-tete .meta { margin-left: auto; color: var(--texte-2); font-size: 13px; }
.onglets-feuilles { display: flex; gap: 4px; }
.onglets-feuilles button {
  border: 1px solid var(--bord); background: var(--surface); border-radius: 4px; padding: 2px 10px;
  font-size: 13px; cursor: pointer; color: var(--texte-2);
}
.onglets-feuilles button[aria-pressed="true"] { border-color: var(--accent); color: var(--texte); }
.outils { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.outils .sep { width: 1px; height: 24px; background: var(--bord); margin: 0 6px; }
.outils .aide-outil { margin-left: auto; color: var(--texte-2); font-size: 12px; }
.zone-plan {
  flex: 1; min-height: 0; position: relative; border: 1px solid var(--bord); border-radius: 4px;
  background: var(--surface-2); overflow: hidden; touch-action: none;
}
.zone-plan svg.plan { width: 100%; height: 100%; display: block; cursor: default; }
.zone-plan.mode-cote svg.plan, .zone-plan.mode-texte svg.plan { cursor: crosshair; }
.zone-plan.deplacement svg.plan { cursor: grabbing; }
.vide {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--texte-2);
  padding: 32px;
}
.vide h3 { color: var(--texte); margin-bottom: 4px; }
.attente { position: absolute; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.attente.visible { display: grid; }
.attente .boite { background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 16px 24px; display: flex; gap: 12px; align-items: center; }
.rouage { width: 18px; height: 18px; border: 2px solid var(--bord); border-top-color: var(--accent); border-radius: 50%; animation: tour 1s linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rouage { animation: none; } }

.pied-apercu { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.calques { display: flex; gap: 16px; }
.calques label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.calques input { accent-color: var(--action); width: 16px; height: 16px; }
.pied-apercu .boutons { margin-left: auto; display: flex; gap: 8px; }

.verifs { margin-top: 12px; display: grid; gap: 6px; max-height: 128px; overflow: auto; }
.message {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 4px;
  border: 1px solid var(--bord); background: var(--surface); font-size: 13px; line-height: 20px;
}
.message svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.message.alerte { border-color: color-mix(in srgb, var(--alerte) 45%, var(--bord)); }
.message.alerte svg { color: var(--alerte); }
.message.succes svg { color: var(--succes); } .message.erreur svg { color: var(--erreur); } .message.info svg { color: var(--info); }
.message .fermer { margin-left: auto; }

/* ---------- boutons et champs */
.btn {
  height: 40px; padding: 0 20px; border-radius: 4px; border: 1px solid var(--bord-champ); background: var(--surface);
  color: var(--texte); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); }
.btn.principal { background: var(--action); border-color: var(--action); color: var(--action-texte); }
.btn.principal:hover { background: var(--action-survol); border-color: var(--action-survol); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.plein { width: 100%; justify-content: center; }
.btn.danger { color: var(--erreur); }
.champ { display: grid; gap: 4px; margin-bottom: 12px; }
.champ label { color: var(--texte-2); font-size: 13px; line-height: 18px; }
.champ input, .champ select, .champ textarea {
  height: 40px; padding: 0 12px; border: 1px solid var(--bord-champ); border-radius: 4px; background: var(--surface);
  width: 100%;
}
.champ textarea { height: auto; min-height: 88px; padding: 8px 12px; resize: vertical; line-height: 20px; }
.champ .aide { color: var(--texte-2); font-size: 12px; line-height: 18px; }
.ligne-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.case { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; cursor: pointer; }
.case input { accent-color: var(--action); width: 18px; height: 18px; }
.defile { overflow: auto; flex: 1; margin: 0 -8px; padding: 0 8px; }
.bas-panneau { padding-top: 16px; border-top: 1px solid var(--bord); margin-top: 8px; display: grid; gap: 8px; }
.titre-section { font-size: 12px; text-transform: none; color: var(--texte-2); font-weight: 600; margin: 8px 0 8px; }

/* ---------- pages profils / licence */
#page-profils, #page-licence, #page-reglages { padding: 16px; grid-template-columns: 300px minmax(0, 860px); gap: 16px; }
.carte-licence { max-width: 640px; }
.carte-licence p { color: var(--texte-2); }

/* ---------- démarrage */
.demarrage {
  position: fixed; inset: 0; background: var(--fond); display: grid; place-items: center; z-index: 50;
  text-align: center;
}
.demarrage .logo { height: 44px; color: var(--petrole); }
.demarrage p { color: var(--texte-2); margin: 16px 0 0; }
.demarrage.cache { display: none; }

/* ---------- plan (SVG) */
svg.plan text { font-family: "IBM Plex Sans", sans-serif; fill: #000; }
svg.plan .papier { fill: var(--papier); stroke: var(--n300); stroke-width: .3; }
svg.plan .el { cursor: pointer; }
svg.plan .el:hover .halo, svg.plan .el.sel .halo { stroke: var(--turquoise); stroke-opacity: .35; }
svg.plan .el.sel .halo { stroke-opacity: .55; }
svg.plan .halo { fill: none; stroke: transparent; stroke-width: 3; }
svg.plan .accroche { fill: var(--turquoise); }
svg.plan .apercu-cote { stroke: var(--turquoise); }

.infobulle { position: fixed; pointer-events: none; background: var(--graphite); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; z-index: 60; display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- réglages entreprise */
.intro { color: var(--texte-2); margin: 0 0 16px; }
.intro .lien, .lien { color: var(--accent); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; font: inherit; }
.sections-reglages li { grid-template-columns: 24px 1fr auto; align-items: center; }
.sections-reglages li .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  border: 1px solid var(--bord-champ); color: var(--texte-2); }
.sections-reglages li .num.fait { background: var(--action); border-color: var(--action); color: var(--action-texte); }
.sections-reglages li .nom { grid-column: 2; }
.sections-reglages li .sous { grid-column: 2; font-size: 12px; color: var(--texte-2); line-height: 16px; }
.bandeau-assistant { border: 1px solid var(--bord); border-left: 3px solid var(--accent); border-radius: 4px; padding: 12px 16px;
  margin-bottom: 16px; background: var(--surface-2); display: grid; gap: 10px; }
.bandeau-assistant .etapes { display: flex; gap: 6px; }
.bandeau-assistant .etapes span { height: 4px; flex: 1; border-radius: 2px; background: var(--bord); }
.bandeau-assistant .etapes span.fait { background: var(--action); }
body.assistant .nav, body.assistant #page-reglages > section:first-child .bas-panneau { visibility: hidden; }
.groupe { border-top: 1px solid var(--bord); padding-top: 16px; margin-top: 8px; }
.groupe > h3 { margin-bottom: 4px; }
.groupe > p { color: var(--texte-2); margin: 0 0 12px; font-size: 13px; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; margin-bottom: 12px; }
.cases label, label.case { display: flex; gap: 8px; align-items: center; min-height: 32px; cursor: pointer; }
.cases input, label.case input { width: 18px; height: 18px; accent-color: var(--action); }
table.edit { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
table.edit th { text-align: left; font-weight: 400; font-size: 13px; color: var(--texte-2); padding: 0 6px 4px 0; }
table.edit td { padding: 0 6px 6px 0; vertical-align: middle; }
table.edit input, table.edit select { width: 100%; height: 36px; border: 1px solid var(--bord-champ); border-radius: 4px;
  background: var(--surface); padding: 0 10px; }
table.edit td.act { width: 40px; }
.logo-zone { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.logo-apercu { width: 180px; height: 72px; border: 1px dashed var(--bord-champ); border-radius: 4px; display: grid; place-items: center;
  background: #fff; color: var(--n500); font-size: 12px; overflow: hidden; }
.logo-apercu img { max-width: 168px; max-height: 64px; }
.apercu-cartouche { background: #fff; border: 1px solid var(--bord); border-radius: 4px; padding: 8px; margin: 4px 0 16px; }
.apercu-cartouche svg { width: 100%; height: auto; display: block; }
.choix-projection { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.choix-projection label { border: 1px solid var(--bord-champ); border-radius: 4px; padding: 10px 12px; display: grid; gap: 2px; cursor: pointer; }
.choix-projection label:has(input:checked) { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }
.choix-projection input { position: absolute; opacity: 0; }
.choix-projection small { color: var(--texte-2); }
.exemple { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--texte-2); }
.jetons { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.jetons button { font: 13px "IBM Plex Mono", monospace; border: 1px solid var(--bord); background: var(--surface-2); border-radius: 4px; padding: 2px 8px; cursor: pointer; }
.resume-reglages { margin-top: 12px; font-size: 13px; color: var(--texte-2); border-top: 1px solid var(--bord); padding-top: 12px; }
.apercu-cartouche .halo { display: none; }

/* ---------- licence */
.pastille-maj { border: 1px solid var(--accent); color: var(--accent); background: none; border-radius: 20px; padding: 4px 12px; font: 600 13px "IBM Plex Sans", sans-serif; cursor: pointer; }
.carte-etat { border: 1px solid var(--bord); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; display: grid; gap: 6px; }
.carte-etat .titre { font: 650 20px "Manrope", sans-serif; }
.carte-etat.ok { border-left: 3px solid var(--succes); } .carte-etat.ko { border-left: 3px solid var(--erreur); } .carte-etat.att { border-left: 3px solid var(--alerte); }
.carte-etat dl { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; }
.carte-etat dt { color: var(--texte-2); } .carte-etat dd { margin: 0; }
#page-licence { padding: 16px; grid-template-columns: minmax(0, 560px) minmax(0, 560px); gap: 16px; }

/* quantités, assemblages, lot */
.liste li { grid-template-columns: 1fr auto auto; }
.liste .nom { grid-column: 1; }
.liste .qte { grid-row: 1 / span 2; grid-column: 2; align-self: center; display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--texte-2); }
.liste .qte input { width: 56px !important; min-width: 0; height: auto !important; padding: 3px 6px; font: inherit; font-family: "IBM Plex Mono", ui-monospace, monospace; border: 1px solid var(--bord-champ); border-radius: 6px; background: var(--surface); color: var(--texte); }
.liste .suppr { grid-column: 3; }
.liste .statut { min-width: 0; }
.liste .statut .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.liste .statut svg { flex: none; }
.bas-panneau .lot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bas-panneau .lot .btn { height: auto; min-height: 40px; font-size: 12.5px; padding: 6px 6px; justify-content: center; gap: 6px; min-width: 0; white-space: normal; line-height: 1.2; text-align: center; }
.fiche-fab { margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 12px; font-size: 13px; }
.fiche-fab h3 { font-size: 14px; margin: 0 0 8px; }
.fiche-fab dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.fiche-fab dt { color: var(--texte-2); }
.fiche-fab dd { margin: 0; text-align: right; }
.fiche-fab .aide { color: var(--texte-2); margin: 8px 0 0; }

/* démonstration en ligne */
.bandeau-demo { background: var(--petrole); color: #fff; font-size: 13px; padding: 6px 16px; text-align: center; }
.message a.lien { color: inherit; font-weight: 600; }
