/* SPIC - Charte : couleur de base #334830, surlignages gris */
:root {
  --spic: #334830;
  --spic-dark: #26361f;
  --spic-light: #e6ece4;
  --spic-mid: #8da585;
  --gris-1: #f4f4f4;
  --gris-2: #e9e9e9;
  --gris-3: #d4d4d4;
  --texte: #222;
  --texte-2: #666;
  --rouge: #a33a2f;
  --vert-ok: #2f7a3c;
  --orange: #b7791f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Nunito", "Segoe UI", Arial, Helvetica, sans-serif; font-size: 14px; color: var(--texte); background: #f1f5ef url(fond.svg) center / cover fixed no-repeat; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--spic); }

/* Barre haute */
.topbar { background: linear-gradient(90deg, var(--spic-dark) 0%, var(--spic) 55%, #4f6a4a 100%); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 54px; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; letter-spacing: .5px; }
.brand .logo { display: inline-flex; width: 30px; height: 30px; border-radius: 6px; background: #fff; color: var(--spic); align-items: center; justify-content: center; font-weight: 800; }
.brand .version { font-size: 11px; background: rgba(255,255,255,.18); padding: 2px 7px; border-radius: 10px; margin-left: 4px; font-weight: 500; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { color: #fff; text-decoration: none; padding: 8px 11px; border-radius: 6px; opacity: .85; white-space: nowrap; font-size: 13.5px; }
.mainnav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.mainnav a.active { background: var(--spic-dark); opacity: 1; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.userbox .role { background: rgba(255,255,255,.18); padding: 2px 8px; border-radius: 10px; font-size: 11px; }

.content { flex: 1; padding: 22px 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.footer { color: var(--texte-2); font-size: 12px; text-align: center; padding: 12px; border-top: 1px solid rgba(51,72,48,.12); background: rgba(255,255,255,.6); }

/* Titres / barre d'actions */
.pagehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.pagehead h1 { font-size: 20px; margin: 0; color: var(--spic); font-weight: 600; }
.pagehead .actions { display: flex; gap: 8px; align-items: center; }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--spic); background: linear-gradient(90deg, var(--spic-dark), var(--spic) 60%, #5d7a58); color: #fff; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--spic-dark); border-color: var(--spic-dark); box-shadow: 0 4px 12px rgba(51,72,48,.25); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; background-image: none; border-color: rgba(255,255,255,.5); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.btn-secondary { background: #fff; background-image: none; color: var(--spic); border-color: var(--gris-3); }
.btn-secondary:hover { background: var(--gris-1); border-color: var(--gris-3); }
.btn-danger { background: #fff; background-image: none; color: var(--rouge); border-color: var(--gris-3); }
.btn-danger:hover { background: #fbeeec; border-color: var(--rouge); }

/* Cartes */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: rgba(255,255,255,.78); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.7); border-radius: 10px; box-shadow: 0 6px 24px rgba(51,72,48,.10); padding: 16px 18px; }
.card .label { color: var(--texte-2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.card .value { font-size: 30px; font-weight: 600; color: var(--spic); margin-top: 4px; }
.card .sub { color: var(--texte-2); font-size: 12px; margin-top: 2px; }
.panel { background: rgba(255,255,255,.82); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.7); border-radius: 10px; box-shadow: 0 6px 24px rgba(51,72,48,.10); padding: 16px 18px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; color: var(--spic); font-weight: 600; }

/* Tableaux */
table.grid { width: 100%; border-collapse: collapse; background: rgba(255,255,255,.9); box-shadow: 0 6px 24px rgba(51,72,48,.08); border: 1px solid var(--gris-2); border-radius: 8px; overflow: hidden; }
table.grid th { background: var(--spic-light); color: var(--spic-dark); text-align: left; padding: 9px 10px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--gris-3); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--gris-2); vertical-align: middle; }
table.grid tbody tr:hover { background: var(--gris-1); }          /* survol gris */
table.grid tbody tr.selected { background: var(--gris-2); }       /* sélection grise */
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.actions { white-space: nowrap; text-align: right; }
table.grid .empty { text-align: center; color: var(--texte-2); padding: 24px; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--texte-2); }

/* Pastilles */
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--gris-3); }
.pastille.ok { background: var(--vert-ok); }
.pastille.off { background: var(--gris-3); }
.pastille.warn { background: var(--orange); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; background: var(--gris-2); color: var(--texte); }
.badge.admin { background: var(--spic-light); color: var(--spic-dark); }

/* Formulaires */
.form { background: rgba(255,255,255,.86); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.7); border-radius: 10px; box-shadow: 0 6px 24px rgba(51,72,48,.10); padding: 18px 20px; max-width: 860px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 12px; }
.form label { display: block; font-size: 12px; color: var(--texte-2); margin-bottom: 4px; }
.form label .req { color: var(--rouge); }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form select, .form textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--gris-3); border-radius: 5px; font-size: 13.5px; font-family: inherit; background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--spic); box-shadow: 0 0 0 2px var(--spic-light); }
.form .check { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.form .buttons { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gris-2); }
.form .hint { font-size: 12px; color: var(--texte-2); margin-top: 3px; }

/* Filtres */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { padding: 6px 9px; border: 1px solid var(--gris-3); border-radius: 5px; font-size: 13px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--spic); }

/* Flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: #eef6ef; border-color: #b7d8bb; color: var(--vert-ok); }
.flash-err { background: #fbeeec; border-color: #e6b8b2; color: var(--rouge); }
.flash-info { background: var(--spic-light); border-color: var(--spic-mid); color: var(--spic-dark); }

/* Connexion - carte « verre dépoli » sur fond décoratif */
body.login { justify-content: center; align-items: center; background: #f1f5ef url(fond.svg) center / cover no-repeat; }
.loginbox { position: relative; background: rgba(255,255,255,.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.75); width: 860px; max-width: 94vw; padding: 110px 0 120px; box-shadow: 0 20px 60px rgba(51,72,48,.22); }
.loginbox .inner { width: 440px; max-width: 86vw; margin: 0 auto; }
.loginbox h1 { font-size: 40px; letter-spacing: 1px; margin: 0 0 4px; color: var(--spic); font-weight: 800; text-transform: uppercase; }
.loginbox .subtitle { color: #6f7f6b; font-size: 15px; font-weight: 600; margin-bottom: 38px; }
.loginbox .version { display: inline-block; vertical-align: middle; font-size: 12px; background: var(--spic-light); color: var(--spic-dark); padding: 3px 9px; border-radius: 10px; margin-left: 10px; letter-spacing: 0; font-weight: 600; text-transform: none; }
.loginbox label { display: block; font-size: 13px; color: var(--texte); margin: 0 0 6px; }
.loginbox .field { position: relative; margin-bottom: 20px; }
.loginbox .field svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: none; stroke: #7a8a76; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.loginbox .field input { width: 100%; padding: 11px 12px 11px 40px; border: 1px solid #cfd8cc; border-radius: 6px; font-size: 14px; background: #fff; font-family: inherit; }
.loginbox .field input:focus { outline: none; border-color: var(--spic); box-shadow: 0 0 0 3px rgba(51,72,48,.14); }
.loginbox .remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: -4px 0 22px; }
.loginbox .remember input { width: 16px; height: 16px; accent-color: var(--spic); }
.loginbox .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; font-weight: 700; letter-spacing: .5px; border: 0; border-radius: 6px;
  background: linear-gradient(90deg, #26361f 0%, #334830 45%, #8da585 100%); box-shadow: 0 8px 20px rgba(51,72,48,.28); }
.loginbox .btn:hover { filter: brightness(1.08); }
.loginbox .flash { margin: 14px 0 0; }
/* Captcha (visuel, non câblé) */
.captcha { display: flex; align-items: center; justify-content: space-between; width: 300px; height: 64px; margin-top: 22px; padding: 0 14px; background: #fafafa; border: 1px solid #e0e0e0; border-radius: 3px; font-size: 14px; }
.captcha .ok { display: flex; align-items: center; gap: 10px; }
.captcha .ok .tick { width: 28px; height: 28px; border-radius: 50%; background: #2f7a3c; display: inline-flex; align-items: center; justify-content: center; }
.captcha .logo { font-size: 10px; letter-spacing: .5px; font-weight: 800; color: #555; text-align: right; line-height: 1.2; }
.captcha .logo small { display: block; font-weight: 400; font-size: 8px; text-decoration: underline; color: #777; }
.captcha .logo .cloud { width: 46px; height: 16px; display: block; margin-left: auto; background: linear-gradient(90deg,#f38020,#faad3f); border-radius: 10px 10px 2px 2px; }
/* Pied : mot de passe oublié + Microsoft (visuel) */
.loginbox .bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 26px; }
.loginbox .bottom a.forgot { color: var(--spic); font-size: 13.5px; }
.btn-ms { display: inline-flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #8c8c8c; color: #333; padding: 9px 14px; font-size: 14px; font-family: inherit; cursor: pointer; }
.btn-ms:hover { background: #f5f5f5; }
.btn-ms .ms { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 20px; height: 20px; }
.btn-ms .ms i { display: block; }
.btn-ms .ms i:nth-child(1){background:#f25022}.btn-ms .ms i:nth-child(2){background:#7fba00}.btn-ms .ms i:nth-child(3){background:#00a4ef}.btn-ms .ms i:nth-child(4){background:#ffb900}
.loginbox .foot { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: #7a8a76; font-size: 11.5px; }

/* ===== Éditeur de formules (v5) ===== */
.fe-overlay { position: fixed; inset: 0; background: rgba(38,54,31,.45); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.fe-overlay.fe-visible { display: flex; }
.fe-box { background: #fff; border-radius: 10px; width: 1180px; max-width: 100%; max-height: 94vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(0,0,0,.35); overflow: hidden; }
.fe-head { background: linear-gradient(90deg, var(--spic-dark), var(--spic)); color: #fff; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.fe-head .fe-champ { opacity: .85; font-weight: 400; margin-left: 6px; }
.fe-body { display: grid; grid-template-columns: 380px 1fr; gap: 0; overflow: hidden; flex: 1; }
.fe-gauche { padding: 14px 16px; border-right: 1px solid var(--gris-2); overflow-y: auto; background: #fafbf9; }
.fe-droite { padding: 14px 18px; overflow-y: auto; }
.fe-sect-titre { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--spic-dark); font-weight: 700; margin: 10px 0 6px; }
.fe-sect-titre:first-child { margin-top: 0; }
.fe-sect-titre .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.fe-chip { border: 1px solid var(--gris-3); background: #fff; border-radius: 6px; padding: 4px 8px; margin: 0 6px 6px 0; cursor: pointer; font-size: 12.5px; font-family: Consolas, Menlo, monospace; color: var(--texte); line-height: 1.3; text-align: left; }
.fe-chip:hover { background: var(--gris-1); border-color: var(--spic); }
.fe-chip-col { color: #1d5fa8; border-color: #c9dbf1; background: #f3f7fc; display: inline-flex; flex-direction: column; }
.fe-chip-col small { font-family: "Nunito", "Segoe UI", Arial, sans-serif; color: var(--texte-2); font-size: 10.5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fe-chip-fn { color: #6a3fa0; border-color: #ddd0ee; background: #f7f3fc; font-weight: 700; }
.fe-chip-op { min-width: 34px; text-align: center; color: var(--spic-dark); font-weight: 700; }
.fe-fam { margin-bottom: 6px; }
.fe-fam-titre { font-size: 11.5px; color: var(--texte-2); margin: 4px 0 4px; }
.fe-editeur { position: relative; border: 1px solid var(--gris-3); border-radius: 6px; overflow: hidden; background: #fff; }
.fe-editeur:focus-within { border-color: var(--spic); box-shadow: 0 0 0 3px rgba(51,72,48,.14); }
.fe-color, .fe-ta { margin: 0; padding: 10px 12px; font-family: Consolas, Menlo, monospace; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; width: 100%; box-sizing: border-box; min-height: 96px; }
.fe-color { position: absolute; inset: 0; pointer-events: none; color: var(--texte); overflow: hidden; }
.fe-ta { position: relative; background: transparent; color: transparent; caret-color: #000; border: 0; outline: none; resize: vertical; display: block; }
.fe-col { color: #1d5fa8; font-weight: 600; } .fe-str { color: #b7791f; } .fe-num { color: #2f7a3c; } .fe-fn { color: #6a3fa0; font-weight: 700; } .fe-op { color: var(--spic-dark); font-weight: 700; } .fe-par { color: #888; }
.fe-desc { font-size: 12.5px; min-height: 18px; margin: 6px 0 2px; }
.fe-statut { font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.fe-ok { color: var(--vert-ok); font-weight: 600; } .fe-ko { color: var(--rouge); font-weight: 600; }
.fe-si { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--spic-light); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.fe-si select, .fe-si input { padding: 5px 8px; border: 1px solid var(--gris-3); border-radius: 5px; font-size: 12.5px; font-family: inherit; }
.fe-si input { width: 150px; } .fe-si .fe-si-val { width: 130px; }
.fe-si span { font-weight: 600; color: var(--spic-dark); }
.fe-table { box-shadow: none; font-size: 12.5px; } .fe-table td, .fe-table th { padding: 5px 8px; }
.fe-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--gris-2); background: #fafbf9; font-size: 12px; }
.btn-fx { padding: 4px 9px; font-size: 12px; font-weight: 700; font-family: Georgia, serif; font-style: italic; }

/* Menu déroulant Administration */
.menu-grp { position: relative; display: flex; align-items: center; }
.menu-grp-btn { display: inline-block; }
.menu-grp-liste { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.22); padding: 6px; z-index: 100; }
.menu-grp:hover .menu-grp-liste { display: block; }
.menu-grp-liste a { display: block; color: var(--texte); padding: 8px 12px; border-radius: 6px; opacity: 1; font-size: 13.5px; }
.menu-grp-liste a:hover { background: var(--gris-1); }
.menu-grp-liste a.active { background: var(--spic-light); color: var(--spic-dark); font-weight: 600; }

/* ---- SPIC v1 ---- */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 12.5px; }
.pagination a { padding: 4px 9px; border: 1px solid var(--gris-3); border-radius: 5px; text-decoration: none; background: #fff; color: var(--spic); }
.pagination a:hover { background: var(--gris-1); }
.pagination a.active { background: var(--gris-2); font-weight: 700; }
.pagination .muted { margin-left: 8px; }
.tablewrap { overflow-x: auto; border-radius: 8px; }
.sect { font-size: 15px; color: var(--spic); margin: 18px 0 10px; font-weight: 600; }
.sect:first-child { margin-top: 0; }
.deux-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.ordre { width: 70px !important; text-align: right; }
.badge.type { background: var(--spic-light); color: var(--spic-dark); }
.depot-fichier { border: 2px dashed var(--spic-mid); border-radius: 10px; padding: 26px; text-align: center; background: rgba(255,255,255,.6); }
.depot-fichier.survol { background: var(--gris-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 13.5px; }
.kv dt { color: var(--texte-2); } .kv dd { margin: 0; }
table.liste-param td input[type=text] { min-width: 220px; }
table.liste-param td { padding: 6px 10px; }
.deux-col > * { min-width: 0; }

/* ---- SPIC v2 : éditeur de modèle ---- */
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--gris-3); margin: 0 0 16px; flex-wrap: wrap; }
.onglets a { padding: 8px 13px; text-decoration: none; color: var(--texte-2); border-radius: 6px 6px 0 0; font-size: 13.5px; }
.onglets a:hover { background: var(--gris-1); }
.onglets a.actif { background: var(--gris-2); color: var(--spic-dark); font-weight: 700; border-bottom: 2px solid var(--spic); }
.onglets a .n { font-size: 11px; background: var(--spic-light); color: var(--spic-dark); border-radius: 9px; padding: 1px 6px; margin-left: 5px; font-weight: 600; }
.past { display: inline-flex; align-items: center; gap: 5px; background: var(--spic-light); color: var(--spic-dark); border: 1px solid var(--spic-mid); border-radius: 12px; padding: 2px 9px; font-size: 12.5px; white-space: nowrap; cursor: grab; }
.past.txt { background: #fff; border-style: dashed; border-color: var(--gris-3); padding: 1px 6px; }
.past.txt input { border: 0 !important; outline: 0; padding: 0 !important; font-family: ui-monospace, Menlo, Consolas, monospace !important; font-size: 12.5px !important; width: auto !important; min-width: 12px; background: transparent !important; box-shadow: none !important; }
.past.type { background: #fff; border-color: var(--gris-3); color: var(--texte); cursor: default; }
.past.cible { background: var(--gris-2); }
.past i { font-style: normal; color: var(--texte-2); cursor: pointer; }
.past i:hover { color: var(--rouge); }
.zone { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; border: 1px solid var(--gris-3); border-radius: 5px; background: #fff; padding: 5px 7px; min-height: 34px; }
.zone .plus { margin-left: auto; width: auto !important; color: var(--spic); font-weight: 600; border: 1px solid var(--gris-3) !important; border-radius: 5px; padding: 2px 8px !important; background: var(--gris-1) !important; font-size: 12.5px !important; cursor: pointer; font-family: inherit; }
.zone .saisie-type { width: 190px !important; padding: 2px 6px !important; font-size: 12.5px !important; }
.apercu { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--texte-2); background: var(--gris-1); border-radius: 5px; padding: 4px 8px; margin-top: 5px; min-height: 8px; word-break: break-all; }
.apercu:empty { display: none; }
.bloc { border: 1px solid var(--gris-2); border-radius: 8px; background: rgba(255,255,255,.7); padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(51,72,48,.05); }
.bloc h3 { margin: 0 0 10px; font-size: 14px; color: var(--spic-dark); display: flex; align-items: center; gap: 10px; }
.bloc h3:last-child { margin-bottom: 0; }
.bloc h3 .act { margin-left: auto; display: flex; gap: 5px; }
.bloc h3 .nom-bloc { width: 260px !important; font-weight: 700; }
.bloc h3 .resume { font-weight: 400; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g2 { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 12px; align-items: center; font-size: 13px; }
.g2 > label { color: var(--texte-2); margin: 0; }
.duo { display: flex; gap: 8px; align-items: center; }
.duo select, .duo input[type=text] { width: auto !important; }
.coche { display: inline-flex !important; align-items: center; gap: 4px; margin: 0 8px 0 0 !important; font-size: 13px !important; color: var(--texte) !important; }
table.grid.cols td { padding: 5px 8px; }
table.grid.cols .ordre-btn button { border: 1px solid var(--gris-3); background: #fff; border-radius: 4px; cursor: pointer; color: var(--spic); padding: 1px 5px; font-size: 11px; }
table.grid.cols .ordre-btn button:hover { background: var(--gris-1); }
.statut { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; background: var(--gris-2); }
.statut.transforme { background: #eef6ef; color: var(--vert-ok); }
.statut.erreur { background: #fbeeec; color: var(--rouge); }
.zone select.plus { max-width: 130px; }
.past.txt input { box-sizing: content-box; }
table.grid td.num { white-space: nowrap; }
.leg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: middle; }

/* Fenêtres (boîtes de dialogue) : coins arrondis et ombre */
.dlg-fond { position: fixed; inset: 0; background: rgba(38,54,31,.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.dlg { background: #fff; border-radius: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.35), 0 4px 14px rgba(51,72,48,.25); padding: 24px 26px 20px; width: 100%; max-width: 420px; }
.dlg h2 { margin: 0 0 8px; font-size: 18px; color: var(--spic); font-weight: 700; }
.dlg p { margin: 0 0 12px; line-height: 1.5; font-size: 13.5px; }
.dlg-simu { background: var(--gris-1); border: 1px solid var(--gris-3); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; line-height: 1.45; margin-bottom: 14px; }
.dlg-code { width: 100%; box-sizing: border-box; text-align: center; font-size: 28px; letter-spacing: 10px; font-family: Consolas, Menlo, monospace; padding: 10px 6px; border: 1px solid var(--gris-3); border-radius: 8px; }
.dlg-code:focus { outline: none; border-color: var(--spic); box-shadow: 0 0 0 2px var(--spic-light); }
.dlg .flash { margin: 12px 0 0; }
.dlg-boutons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* Cases à cocher en liste (périmètre de marchands) */
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 14px; max-height: 320px; overflow: auto; border: 1px solid var(--gris-3); border-radius: 6px; padding: 10px 12px; background: #fff; }
.cases label { display: flex; align-items: center; gap: 7px; margin: 0; font-weight: 400; padding: 3px 5px; border-radius: 4px; cursor: pointer; }
.cases label:hover { background: var(--gris-1); }
.cases input { width: auto; }

/* v7 - Champs et règles */
.mq { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.mods { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 8px; }
.mods h3 { margin: 6px 8px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--texte-2); }
.mods a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--texte); font-size: 13.5px; }
.mods a:hover { background: var(--gris-1); } .mods a.actif { background: var(--gris-2); font-weight: 700; color: var(--spic-dark); }
.mods a .n { font-size: 11px; background: var(--spic-light); color: var(--spic-dark); border-radius: 9px; padding: 1px 7px; font-weight: 600; white-space: nowrap; }
.panel h2.entre { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.regle { font-size: 13.5px; line-height: 1.9; } .regle b { color: var(--spic-dark); }
.jet { display: inline-block; background: var(--spic-light); color: var(--spic-dark); border: 1px solid #8da585; border-radius: 12px; padding: 0 9px; font-size: 12.5px; font-weight: 600; line-height: 1.6; }
.val { display: inline-block; background: #fff; border: 1px dashed #9aa; border-radius: 12px; padding: 0 9px; font-family: Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.6; }
.val.frm { border-style: solid; border-color: var(--spic); background: #fff; color: var(--spic-dark); }
.impose { margin-top: 4px; font-size: 12px; color: var(--texte); background: var(--gris-1); border: 1px solid var(--gris-3); border-left: 3px solid var(--spic); border-radius: 6px; padding: 3px 8px; }
.dlg.large { max-width: 820px; padding: 24px 28px 22px; max-height: calc(100vh - 60px); overflow: auto; }
.dlg.large .plein { display: grid; gap: 10px; margin-bottom: 14px; }
.dlg.large .plein label, .dlg.large label.coche { font-size: 12.5px; color: var(--texte-2); }
.dlg.large .plein > div > label { display: block; margin-bottom: 3px; }
.dlg.large input[type=text], .dlg.large select, .dlg.large textarea { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--gris-3); border-radius: 6px; font: inherit; font-size: 13.5px; background: #fff; }
.dlg.large input.mono { font-family: Consolas, Menlo, monospace; font-size: 12.5px; }
.dlg.large input[readonly] { background: var(--gris-1); color: var(--texte-2); }
.dlg.large label.coche { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.dlg.large label.coche input[type=checkbox] { width: auto; }
.bloc-regle { display: grid; grid-template-columns: 62px 1fr; align-items: start; }
.bloc-regle .mot { font-weight: 800; color: var(--spic); font-size: 13px; text-transform: uppercase; padding-top: 9px; }
.bloc-regle .lignes:empty::before { content: "-"; color: var(--texte-2); display: block; padding: 8px 0; }
.ligne { display: grid; grid-template-columns: 58px 1fr 170px 1fr 22px; gap: 8px; align-items: center; margin-bottom: 8px; }
.ligne .x { color: #a33; text-align: center; font-weight: 700; text-decoration: none; font-size: 16px; }
.sous { margin: 0 0 2px 62px; }
.sep { border: 0; border-top: 1px solid var(--gris-2); margin: 12px 0; }
.essai { background: var(--gris-1); border: 1px solid var(--gris-3); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-top: 12px; line-height: 1.7; }
.essai select { width: auto !important; max-width: 340px; padding: 4px 8px !important; font-size: 12.5px !important; }
.aide-fonctions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 16px; font-size: 12px; background: var(--gris-1); border-radius: 8px; padding: 10px 12px; margin-top: 8px; color: var(--texte-2); max-height: 190px; overflow: auto; }
.aide-fonctions .mono { color: var(--spic-dark); font-size: 11.5px; }
/* v7 - morceau « formule » dans les zones à pastilles */
.past.frm { background: #fff; border: 1px solid var(--spic); color: var(--spic-dark); cursor: pointer; font-family: Consolas, Menlo, monospace; font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette { display: flex; flex-wrap: wrap; gap: 5px; max-height: 118px; overflow: auto; border: 1px solid var(--gris-2); border-radius: 8px; padding: 8px; background: var(--gris-1); }
.palette a { font-size: 12px; text-decoration: none; border-radius: 11px; padding: 1px 8px; background: var(--spic-light); color: var(--spic-dark); border: 1px solid #8da585; }
.palette a.fn { background: #fff; border: 1px solid var(--gris-3); color: var(--texte); font-family: Consolas, Menlo, monospace; font-size: 11.5px; }
.palette a:hover { background: var(--gris-2); }
.imp { border-bottom: 2px dotted var(--spic); cursor: help; }
/* v9 - jamais de double ascenseur : quand une fenêtre est ouverte, seule la fenêtre défile */
html:has(.dlg-fond), body:has(.dlg-fond) { overflow: hidden; }

/* Fiche marchand : comptes par devise (v11) */
.cpt-devises { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.cpt-badge { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; }
.cpt-retirer { border: 0; background: none; cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; color: inherit; }
.cpt-retirer:hover { color: var(--rouge); }
.cpt-tableau { border: 1px solid var(--gris-2); border-radius: 10px; overflow-x: auto; background: #fff; box-shadow: 0 1px 3px rgba(51, 72, 48, .08); }
.cpt-tableau table { width: 100%; border-collapse: collapse; }
.cpt-tableau th { padding: 8px 10px; text-align: left; background: #e9eee6; font-size: 12.5px; vertical-align: bottom; }
.cpt-tableau td { padding: 6px 10px; }
.cpt-tableau td input { width: 100%; min-width: 130px; }
.cpt-tableau .cpt-nature { width: 22%; font-weight: 600; }
.cpt-sous-titre { font-weight: 400; font-size: 11.5px; }

/* Journal : fenêtre des lignes d'un fichier refusé (v12). Un seul ascenseur : celui du tableau des lignes. */
.dlg.dlg-large { max-width: 1280px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-sizing: border-box; }
.dlg-entete { display: flex; align-items: flex-start; gap: 10px; }
.dlg-entete-texte { flex: 1; min-width: 0; }
.dlg-entete-texte p { margin-bottom: 6px; }
.dlg-fichier { font-size: 12.5px; overflow-wrap: anywhere; }
.dlg-totaux { margin-bottom: 10px; border: 1px solid var(--gris-2); border-radius: 8px; overflow-x: auto; flex-shrink: 0; }
.dlg-totaux table, .dlg-lignes table { font-size: 12px; margin: 0; }
.dlg-lignes { flex: 1; min-height: 120px; overflow: auto; border: 1px solid var(--gris-2); border-radius: 8px; }
.dlg-lignes thead th { position: sticky; top: 0; z-index: 1; background: #e9eee6; white-space: nowrap; }
.dlg-lignes td { white-space: nowrap; }
.dlg-pied { margin: 8px 0 0; font-size: 12px; }
.jrn-fichier { font-size: 12px; overflow-wrap: anywhere; min-width: 150px; }
.jrn-message { min-width: 340px; line-height: 1.4; }

/* Écran Comparer (v14) */
.cmp-depots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cmp-ok { color: var(--vert-ok); font-weight: 600; }
.cmp-forme { color: var(--orange); font-weight: 600; }
.cmp-ko { color: var(--rouge); font-weight: 600; }
.cmp-nom { font-size: 12px; overflow-wrap: anywhere; }
.cmp-liste { margin: 0 0 10px; padding-left: 18px; line-height: 1.7; }
.cmp-titre { font-size: 13.5px; margin: 14px 0 6px; color: var(--spic-dark); }
.cmp-table { font-size: 12.5px; }
.cmp-table td.mono { white-space: pre-wrap; overflow-wrap: anywhere; }
.cmp-table tr.cmp-debut td { border-top: 1px solid var(--gris-3); }
.cmp-table.cmp-large td.mono, .cmp-table.cmp-large th { white-space: nowrap; }
