/* Back-office des sites : charte du CRM groupe (crm-groupe-mvp/DESIGN-CRM.md), outil quotidien sobre. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo/Archivo-latin.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo/Archivo-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF; }

:root {
  --bg: #0a0a0a; --card: #141414; --card-2: #1a1a1a; --line: #262626; --line-2: #333;
  --txt: #f4f4f2; --txt-strong: #fff; --muted: #a3a3a3;
  --brand: #ff4b1f; --cta: #d93a12; --cta-hover: #b4380f; --soft: #ffe9e1;
  --ok: #6fb88c; --bad: #c97f7f;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.5 "Archivo", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 0.55rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; color: var(--txt-strong); }
.brand-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--brand); }
.eyebrow { margin: 0; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.08em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 0; border-radius: 999px; padding: 0.55rem 1.05rem; cursor: pointer; text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: background 0.35s var(--ease), transform 0.35s var(--ease), color 0.35s var(--ease); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-hover); }
.btn-ghost { background: var(--card-2); color: var(--txt); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: #222; }
.btn:disabled { opacity: 0.5; cursor: wait; }

input, select, textarea { width: 100%; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 0.6rem 0.75rem; transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgb(255 75 31 / 0.18); }
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); }

/* Connexion */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(380px, 100%); display: grid; gap: 1rem; padding: 2rem; background: var(--card); border-radius: 20px; box-shadow: inset 0 0 0 1px var(--line); }
.login-card h1 { margin: 0.5rem 0 0; font-size: 2rem; font-weight: 800; font-stretch: 75%; text-transform: uppercase; line-height: 0.9; color: var(--txt-strong); }
.hint { margin: 0; color: var(--muted); font-size: 0.82rem; }
.err { margin: 0; color: var(--bad); font-size: 0.85rem; min-height: 1.2em; }

/* Application */
.app { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.top { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 0.85rem 1.25rem; background: rgb(10 10 10 / 0.88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.select { display: flex; align-items: center; gap: 0.5rem; }
.select select { width: auto; padding: 0.45rem 0.7rem; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 0.85rem; transition: background 0.3s var(--ease), color 0.3s var(--ease); }
.seg button[aria-checked="true"] { background: var(--txt-strong); color: var(--bg); }
.seg button[data-env="apercu"][aria-checked="true"] { background: var(--soft); color: #5a1a08; }
.who { color: var(--muted); font-size: 0.82rem; }

.cols { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.pages { position: sticky; top: 61px; align-self: start; height: calc(100dvh - 61px); overflow: auto; padding: 1rem; border-right: 1px solid var(--line); }
.pages ul { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 2px; }
.pages li button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 0 0.5rem; text-align: left; border: 0; background: transparent; padding: 0.55rem 0.7rem; border-radius: 10px; cursor: pointer; transition: background 0.25s var(--ease); }
.pages li button:hover { background: var(--card); }
.pages li button[aria-current="true"] { background: var(--card-2); box-shadow: inset 2px 0 0 var(--brand); }
.pg-name { font-weight: 600; font-size: 0.9rem; color: var(--txt-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-path { grid-column: 1; color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-n { grid-row: 1 / span 2; grid-column: 2; align-self: center; min-width: 1.5rem; text-align: center; border-radius: 999px; background: rgb(255 75 31 / 0.18); color: var(--soft); font-size: 0.75rem; font-weight: 700; padding: 0.05rem 0.45rem; }

.editor { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 5rem; max-width: 980px; }
.ed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }
.ed-head h2 { margin: 0.2rem 0 0; font-size: clamp(1.6rem, 1rem + 2vw, 2.4rem); font-weight: 800; font-stretch: 78%; text-transform: uppercase; line-height: 0.92; color: var(--txt-strong); }
.ed-actions { display: flex; gap: 0.6rem; align-items: center; }
.ed-actions input { width: 260px; }
.note { margin: 1rem 0 1.5rem; padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--card); color: var(--muted); font-size: 0.85rem; box-shadow: inset 0 0 0 1px var(--line); }

.fields { display: grid; gap: 0.75rem; }
.field { display: grid; gap: 0.6rem; padding: 1rem 1.1rem; background: var(--card); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.3s var(--ease); }
.field:focus-within { box-shadow: inset 0 0 0 1px var(--line-2), 0 20px 50px -30px rgb(0 0 0 / 0.8); }
.field.is-mod { box-shadow: inset 3px 0 0 var(--brand), inset 0 0 0 1px var(--line); }
.field header { display: flex; align-items: center; gap: 0.6rem; }
.f-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.badge { font-size: 0.72rem; border-radius: 999px; padding: 0.1rem 0.55rem; background: rgb(255 75 31 / 0.18); color: var(--soft); font-weight: 600; }
.orig { margin: 0; color: var(--muted); font-size: 0.8rem; }
.f-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.img-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem; align-items: start; }
.img-row > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--card-2); }
.img-ctl { display: grid; gap: 0.6rem; }
.empty { color: var(--muted); }

.img-dialog { width: min(1000px, 94vw); max-height: 86vh; padding: 0; border: 0; border-radius: 20px; background: var(--card); color: var(--txt); box-shadow: 0 40px 120px -20px rgb(0 0 0 / 0.9), inset 0 0 0 1px var(--line); }
.img-dialog::backdrop { background: rgb(0 0 0 / 0.7); }
.img-dlg-in { display: grid; gap: 0.9rem; padding: 1.25rem; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h3 { margin: 0; font-weight: 800; font-stretch: 80%; text-transform: uppercase; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; max-height: 62vh; overflow: auto; }
.img-grid button { display: grid; gap: 0.3rem; padding: 0.35rem; border: 0; border-radius: 12px; background: var(--card-2); cursor: pointer; text-align: left; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.img-grid button:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--brand); }
.img-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.img-grid span { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 30; transform: translate(-50%, 1rem); opacity: 0; padding: 0.7rem 1.1rem; border-radius: 999px; background: var(--txt-strong); color: var(--bg); font-weight: 600; font-size: 0.9rem; pointer-events: none; transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 820px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .pages { position: static; height: auto; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .img-row { grid-template-columns: minmax(0, 1fr); }
  .ed-actions, .ed-actions input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
