:root { --ink: #2b2b2b; --muted: #8a8a80; --line: #e2e2d8; --accent: #4a4a3c; --warn: #d9531e; }
* { box-sizing: border-box; }
body { margin: 0; padding: 24px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: #f7f7f3; }
body.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
/* En-tete fixe : logo toujours en haut a gauche, bouton de retour dessous. */
header { position: sticky; top: 0; z-index: 10; display: flex; align-items: flex-start; gap: 20px; margin: -24px -24px 20px; padding: 14px 24px 12px; background: #f7f7f3; border-bottom: 1px solid var(--line); }
header h1, header nav { line-height: 26px; }
header nav { margin-left: auto; }
.hleft { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.brand { display: block; line-height: 0; }
.brand img { height: 26px; width: auto; display: block; }
.back { display: inline-block; padding: 5px 11px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 13px; text-decoration: none; white-space: nowrap; }
.back:hover { background: #33332a; }
.loginLogo { display: block; width: 200px; max-width: 100%; height: auto; margin: 0 0 16px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
a { color: var(--accent); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
.narrow { width: 320px; }
label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password] { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; }
button { padding: 8px 14px; border: 0; border-radius: 5px; background: var(--accent); color: #fff; font-size: 14px; cursor: pointer; }
button.link { background: none; color: var(--warn); padding: 0; font-size: 12px; }
button.primary { background: var(--warn); font-size: 15px; padding: 12px 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs th { text-align: left; color: var(--muted); font-weight: normal; width: 15%; padding: 3px 0; }
.specs td { padding: 3px 0; width: 35%; }
.models th, .models td { border-top: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.models th { color: var(--muted); font-weight: normal; font-size: 12px; }
.pages { margin: 0 0 6px 16px; padding: 0; font-size: 12px; color: var(--muted); }
.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.addModel { margin-top: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; background: #eee; color: var(--muted); border-radius: 3px; padding: 2px 6px; vertical-align: middle; }
.message { background: #eef6ee; border: 1px solid #cde3cd; padding: 10px; border-radius: 6px; }
.error, .warnTxt { color: var(--warn); }
.generate { margin: 24px 0; text-align: center; }
label.row { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
label.row input { width: 160px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=text] { width: 280px; }
select { padding: 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; background: #fff; }
.orders th, .orders td { border-top: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.orders th { color: var(--muted); font-weight: normal; font-size: 12px; }
.orders tbody tr:hover { background: #fafaf6; }
.badge { display: inline-block; font-size: 12px; border-radius: 10px; padding: 2px 9px; margin-right: 4px; background: #eee; color: var(--ink); }
.badge.warn { background: #fbe6dc; color: #a23c12; }
.badge.ok { background: #e1f1e1; color: #2c6b2c; }
.badge.ko { background: #f6dcdc; color: #9a2a2a; }
.badge.info { background: #e3ebf5; color: #2c4d78; }

/* Vignettes des pages et envoi automatique */
.models td { vertical-align: top; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.thumbs figure { margin: 0; width: 300px; }
.thumbs img { display: block; width: 300px; max-height: 260px; object-fit: contain; background: #fafaf7; border: 1px solid var(--line); border-radius: 4px; }
.thumbs figcaption { font-size: 11px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.upload { display: block; margin: 0; }
.filebtn { display: inline-block; margin: 0; padding: 6px 12px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 13px; cursor: pointer; }
.filebtn input { display: none; }
.busyTxt { display: none; margin-left: 8px; }
.upload.busy .busyTxt { display: inline; }
.upload.busy .filebtn { opacity: .5; pointer-events: none; }
.btnlink { display: inline-block; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 5px; color: var(--accent); text-decoration: none; font-size: 14px; background: #fff; }
.btnlink:hover { background: #f0f0e8; }

/* Versions et historique */
.hist { margin-top: 6px; }
.hist summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.hist ul { list-style: none; margin: 6px 0 0; padding: 8px 10px; background: #fafaf7; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.hist li + li { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.thumbs.small { gap: 4px; margin: 4px 0 0; }
.thumbs.small img { width: 70px; height: 70px; }
.newversion { margin-bottom: 4px; }
.newversion input[type=number] { width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }

/* Selection des modeles a generer / previsualiser / envoyer */
.models th:first-child, .models td:first-child { width: 20px; padding-right: 0; }
.batSel { width: 16px; height: 16px; cursor: pointer; }
.selectAll { text-align: center; font-size: 13px; margin: 20px 0 0; }

/* Deconnexion : un formulaire (POST protege) presente comme un lien */
.logout { display: inline; margin: 0; }
.logout button { background: none; color: var(--accent); padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }

/* Connexion : case "rester connecte", cle d'acces, page Securite */
label.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 13px; color: var(--ink); }
label.check input { width: 16px; height: 16px; margin: 0; }
.primaryBtn { width: 100%; padding: 12px 14px; background: var(--accent); }
.sep { text-align: center; margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.sep span { background: #fff; padding: 0 8px; }
table.secu th, table.secu td { border-top: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: middle; }
table.secu th { color: var(--muted); font-weight: normal; font-size: 12px; }
table.secu form { margin: 0; }
.addPasskey { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); max-width: 360px; }
.addPasskey h3 { font-size: 14px; margin: 0 0 6px; }
.addPasskey input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; }
.revokeAll { margin-top: 10px; }
[hidden] { display: none !important; }

/* v3 : fichier d'execution (EXE) d'un modele, ecran Parametres */
.exe { margin: 4px 0; font-size: 0.9em; }
.exe form.inline { display: inline; margin-left: 6px; }
form.settings .specs th { width: 32%; vertical-align: top; padding-top: 8px; }
form.settings .specs td .muted { font-size: 0.85em; margin-top: 2px; }
