/* ============================================================
   SUJEE DESIGN — BACK OFFICE
   Direction « Atelier » (sombre, docket print), alignée sur le CRM
   (frontend/src/atelier-v2.css) : mêmes tokens, mêmes composants.
   ============================================================ */

@font-face {
  font-family: "Bricolage Grotesque Variable";
  src: url("/static-admin/fonts/bricolage.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono Variable";
  src: url("/static-admin/fonts/martian.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Archivo Variable";
  src: url("/static-admin/fonts/archivo.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #0a0a0b;
  --bg-soft: #0e0e10;
  --panel: #131316;
  --panel-2: #191920;
  --line: #242429;
  --line-soft: #1b1b20;
  --line-strong: #33333a;
  --ink: #f3efe7;
  --ink-2: #c9c3b8;
  --muted: #b3aca3;
  --dim: #9a9288;
  --accent: #ff4a17;
  --accent-soft: rgba(255, 74, 23, 0.12);
  --ok: #8bd8a6;
  --warn: #e7c268;
  --danger: #ff7a55;
  --font: "Archivo Variable", "Archivo", system-ui, -apple-system, sans-serif;
  --display: "Bricolage Grotesque Variable", "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "Martian Mono Variable", "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

::selection { background: var(--accent); color: #1a0700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }

body {
  background:
    radial-gradient(900px 500px at 78% -10%, rgba(255, 74, 23, 0.06), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 1px 5px;
}

/* ---------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  border-right: 1px solid var(--line-soft);
  padding: 22px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100dvh;
  background: linear-gradient(180deg, #0b0b0d 0%, #09090a 100%);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 2px;
  display: grid;
  place-items: center;
  position: relative;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.04em;
  background: var(--panel);
  color: var(--ink);
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--bg);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-txt strong, .brand-txt b { font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em; }
.brand-txt small, .brand-txt span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
}

.nav { padding: 0 12px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; min-height: 0; }
.nav-group { display: flex; flex-direction: column; }
.nav-h {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
  padding: 0 10px 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 2px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.nav-link .idx {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  width: 15px;
  letter-spacing: -0.02em;
  flex: none;
}
.nav-link .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link .cnt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 1px 6px;
  line-height: 1.4;
}
.nav-link:hover { background: var(--panel); color: var(--ink-2); }
.nav-link.is-active, .nav-link.on {
  background: linear-gradient(90deg, rgba(255, 74, 23, 0.13), rgba(255, 74, 23, 0) 92%);
  border-color: rgba(255, 74, 23, 0.22);
  color: var(--ink);
}
.nav-link.is-active .idx, .nav-link.on .idx { color: var(--accent); }
.nav-link.is-active .cnt, .nav-link.on .cnt { border-color: rgba(255, 74, 23, 0.3); color: #ffb59b; }

.side-foot {
  margin-top: auto;
  padding: 16px 22px 0;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.who { display: flex; align-items: center; gap: 10px; }
.who .ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #241a16;
  border: 1px solid #3a2a23;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #ffb59b;
  flex: none;
}
.who .meta { line-height: 1.3; min-width: 0; }
.who .meta b { display: block; font-size: 12.5px; font-weight: 600; }
.who .meta span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-transform: uppercase;
}
.site-link {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.45;
  transition: color 0.16s;
}
.site-link:hover { color: var(--accent); }
.site-link--edit {
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 74, 23, 0.32);
  border-radius: 2px;
  padding: 9px 10px;
  font-weight: 600;
  white-space: normal;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.site-link--edit:hover { background: rgba(255, 74, 23, 0.2); color: var(--ink); }

/* ---------------------------------------------------------- topbar */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(14px) saturate(1.2);
}
.topbar-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dim);
  text-transform: uppercase;
  display: flex;
  gap: 8px;
  align-items: center;
}
.topbar-title b { color: var(--ink-2); font-weight: 400; }
.topbar-title span { color: #3a3a41; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.burger {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: 2px;
  width: 34px;
  height: 34px;
  font-size: 15px;
  cursor: pointer;
}

/* ---------------------------------------------------------- page */
.page {
  padding: 26px 28px 64px;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page > * { min-width: 0; }

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.035em;
}
h2 { font-size: 13px; }
h3 { font-size: 13px; }

.preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 28px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffb59b;
  background: rgba(255, 74, 23, 0.1);
  border-bottom: 1px solid rgba(255, 74, 23, 0.25);
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.title-wrap { min-width: 0; }
.sub {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dot { width: 4px; height: 4px; border-radius: 50%; background: #3d3d45; display: inline-block; flex: none; }
.dotg { background: var(--ok); }
.doty { background: var(--warn); }
.dotr { background: var(--accent); }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------- figures */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 18px 22px 20px; border-right: 1px solid var(--line-soft); position: relative; min-width: 0; }
.stat:last-child { border-right: 0; }
.stat-k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  display: block;
}
.stat-v {
  font-family: var(--display);
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.045em;
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.stat-v-sm { font-size: 20px; letter-spacing: -0.03em; }
.stat-s { margin-top: 4px; font-size: 11.5px; color: var(--dim); display: block; }
a.stat:hover { background: rgba(255, 255, 255, 0.015); }

/* ---------------------------------------------------------- cards */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -18px -20px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #121215, #0f0f11);
  flex-wrap: wrap;
}
.card-head h2 { font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; color: var(--ink); }
.card-head p { margin: 0; }
.card-head .spacer { flex: 1; }
.card-head .muted, .card-head .small { font-size: 11.5px; }
.mini-title {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 10px;
}
.card .toolbar-info { align-items: center; flex-wrap: wrap; gap: 8px; }
.card .card-head { margin-bottom: 14px; }

.grid { display: grid; gap: 16px; }
.grid-top { align-items: start; }
.card-head--inner { margin: 20px -20px 12px; border-top: 1px solid var(--line-soft); }
.mono { font-family: var(--mono); font-size: 11px; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.plain li { position: relative; padding-left: 16px; }
.plain li::before { content: ''; position: absolute; left: 0; top: 8px; width: 5px; height: 1px; background: var(--accent); }
.plain-tight { gap: 6px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }

.page-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.16s, background 0.16s;
}
.page-card:hover { border-color: var(--line-strong); background: var(--panel-2); }
.page-card .card-head {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.page-card h2, .page-card h3 { font-family: var(--display); font-size: 17px; letter-spacing: -0.02em; }
.page-path {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 3px 7px;
  display: inline-block;
  flex: none;
}
.page-card .muted, .page-card .muted.small { color: var(--muted); }
.page-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.page-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------- boutons */
.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}
.btn:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11px; gap: 5px; }
.btn-accent, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0700;
  font-weight: 600;
}
.btn-accent:hover, .btn-primary:hover { background: #ff5f31; border-color: #ff5f31; color: #1a0700; }
.btn-accent:disabled, .btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; filter: saturate(0.4); }
.btn-accent:disabled:hover, .btn:disabled:hover { background: var(--accent); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); background: rgba(255, 255, 255, 0.04); }
.btn-line { background: transparent; border-color: var(--line); color: var(--ink-2); justify-content: flex-start; }
.btn-line:hover { border-color: rgba(255, 74, 23, 0.5); color: var(--ink); background: var(--accent-soft); }
.btn-danger { background: transparent; border-color: rgba(255, 74, 23, 0.32); color: #ffb59b; }
.btn-danger:hover { background: var(--accent-soft); border-color: rgba(255, 74, 23, 0.55); color: #ffd2c4; }
.link { color: var(--ink-2); font-size: 11.5px; border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; cursor: pointer; transition: color 0.16s, border-color 0.16s; }
.link:hover { color: var(--accent); border-color: rgba(255, 74, 23, 0.5); }

/* ---------------------------------------------------------- chips */
.chip, .badge, .pill, .tag, .statut {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: none;
}
.chip span { font-family: var(--mono); font-size: 9px; opacity: 0.75; }
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.is-active span { opacity: 0.65; }
.badge-nouveau { color: #ffb59b; border-color: rgba(255, 74, 23, 0.4); background: var(--accent-soft); }
.badge-en-cours { color: var(--warn); border-color: rgba(231, 194, 104, 0.35); background: rgba(231, 194, 104, 0.08); }
.badge-traite { color: var(--ok); border-color: rgba(139, 216, 166, 0.3); background: rgba(139, 216, 166, 0.07); }
.badge-qualifiee { color: #ffb59b; border-color: rgba(255, 74, 23, 0.45); background: var(--accent-soft); }
.badge-convertie { color: var(--ok); border-color: rgba(139, 216, 166, 0.3); background: rgba(139, 216, 166, 0.07); }
.badge-archivee { color: var(--dim); }
.demande-details { display: flex; flex-direction: column; gap: 9px; }
.demande-details > div { line-height: 1.5; }
.demande-details .note-k { display: block; margin-bottom: 2px; letter-spacing: 0.06em; }
.msg-ref { font-family: var(--mono); font-size: 10px; color: var(--dim); opacity: 0.75; }
.msg-meta .badge { margin-right: 2px; }
.tag { border-radius: 2px; text-transform: none; letter-spacing: 0.02em; font-size: 10px; color: var(--dim); }
.tag.acc { color: #ffb59b; border-color: rgba(255, 74, 23, 0.35); }

/* ---------------------------------------------------------- listes */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(255, 255, 255, 0.015); }
.list-tight .list-row { padding: 8px 0; }
.list-body { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.list-body strong, .list-body b { font-weight: 500; font-size: 13px; }
.list-body .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; margin-top: 2px; color: var(--dim); }
.avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  background: #241a16;
  color: #ffb59b;
  border: 1px solid #3a2a23;
}

/* ---------------------------------------------------------- formulaires */
.content-form { display: flex; flex-direction: column; gap: 16px; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.toolbar-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; line-height: 1.35; }
.toolbar-info b { font-size: 13px; font-weight: 600; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 16px; align-items: start; }
.toc { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; }
.toc-title {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 8px 10px;
}
.toc a {
  font-size: 12.5px;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 2px;
  border-left: 1px solid transparent;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.toc a:hover { background: var(--panel); color: var(--ink); border-left-color: var(--accent); }
.content-sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section-card .block { padding: 0; display: grid; gap: 14px; }
.section-card .block + .block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.form-card .btn { margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0 18px; }
.form-grid .full, .field.full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > span, .field > label, .field label > span:first-child {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.field .hint, .hint { font-style: normal; color: var(--dim); font-size: 11px; }
.hint a { color: var(--ink-2); border-bottom: 1px solid var(--line-strong); }

input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=url], input[type=number], input[type=date], input[type=search],
textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 9px 11px;
  transition: border-color 0.16s, background 0.16s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #6f6a63; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(255, 74, 23, 0.55);
  background: var(--panel-2);
  outline: none;
}
input[type=checkbox] { accent-color: var(--accent); width: auto; }
input[type=file] { display: none; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.inline-form { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.inline-form select { width: auto; min-width: 110px; padding: 5px 30px 5px 9px; font-size: 11.5px; }
.inline-form input[type=text] { flex: 1; min-width: 160px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { max-width: 300px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.rule, hr.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }

/* ---------------------------------------------------------- alertes */
.flash {
  padding: 10px 14px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flash-ok { border-color: rgba(139, 216, 166, 0.3); background: rgba(139, 216, 166, 0.07); color: var(--ok); }
.flash-error { border-color: rgba(255, 74, 23, 0.4); background: var(--accent-soft); color: #ffb59b; }
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(231, 194, 104, 0.07);
  border: 1px solid rgba(231, 194, 104, 0.3);
  border-radius: 2px;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--warn);
}
.alert b { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.alert span { color: var(--ink); opacity: 0.85; font-weight: 400; text-transform: none; letter-spacing: 0; }
.warn { color: var(--warn); }
.note {
  background: var(--panel);
  border-left: 2px solid var(--accent);
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.note-k {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
}
.note-banner {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 74, 23, 0.22);
  border-radius: 2px;
  padding: 12px 14px;
}
.note-banner b { color: var(--ink); }
.empty { color: var(--dim); font-size: 12.5px; margin: 0; padding: 26px 18px; text-align: center; border-style: dashed; }

/* ---------------------------------------------------------- scrollbars */
html { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #45454e; }

/* ---------------------------------------------------------- tableau de bord */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.ledger { border: 1px solid var(--line); border-radius: 2px; background: var(--bg-soft); overflow: hidden; }
.ledger-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #121215, #0f0f11);
  flex-wrap: wrap;
}
.ledger-head h2 { font-size: 12.5px; font-weight: 600; }
.ledger-head .count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.08em;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 1px 7px;
}
.ledger-head .spacer { flex: 1; }
.ledger table { width: 100%; border-collapse: collapse; }
.ledger thead th {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: left;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 400;
}
.ledger tbody td { padding: 11px 18px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr:hover { background: rgba(255, 255, 255, 0.015); }
.ledger .num { font-family: var(--mono); font-size: 9.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.row-set {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.row-set:last-child { border-bottom: 0; }
.row-set .k b { display: block; font-weight: 500; font-size: 12.5px; }
.row-set .k span { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; }
.row-set .val { font-family: var(--mono); font-size: 9.5px; color: var(--muted); white-space: nowrap; }

/* ---------------------------------------------------------- messages */
.msg-list { display: flex; flex-direction: column; gap: 14px; }
.msg { padding: 0; }
.msg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px 0; }
.msg-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.msg-id strong { font-size: 14px; font-weight: 600; }
.msg-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 9px; color: var(--dim); letter-spacing: 0.05em; }
.msg-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 18px 0; }
.msg-text { margin: 0; padding: 10px 18px; white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }
.msg-links { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding: 12px 18px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.012);
}

/* ---------------------------------------------------------- médias */
.upload { display: flex; flex-direction: column; gap: 14px; }
.upload .form-grid .field { margin-bottom: 0; }
.upload .toolbar-actions { justify-content: flex-start; }
.upload-drop {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  padding: 16px;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 8px, transparent 8px 16px);
}
.upload-drop:hover { border-color: rgba(255, 74, 23, 0.45); }
.upload-label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.upload-label strong { font-size: 13px; font-weight: 500; }
.upload-label:hover strong { color: var(--accent); }
.upload-name { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.media {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--panel); display: block; border-bottom: 1px solid var(--line-soft); }
.media-file {
  aspect-ratio: 4/3;
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg, #141417 0 10px, #101013 10px 20px);
  border-bottom: 1px solid var(--line-soft);
}
.media-file span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase; }
.media figcaption { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 0; }
.media figcaption strong { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media > .muted, .media figcaption .muted { font-family: var(--mono); font-size: 9px; }
.media-actions { display: flex; gap: 6px; padding: 10px 12px 12px; margin-top: auto; }

/* ---------------------------------------------------------- projets */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lib-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lib-thumb {
  aspect-ratio: 16 / 10;
  background: #101013 center / cover no-repeat;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
/* Les visuels de couverture ne doivent jamais imposer leur taille intrinsèque
   à la grille : sans ça une photo portrait écrase la carte et déborde. */
.lib-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fiche sans visuel : les initiales servent de placeholder, centrées. */
.lib-thumb i {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-family: var(--display);
  font-size: 34px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.lib-body { padding: 14px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.lib-body h3, .lib-body h2 { font-family: var(--display); font-size: 18px; letter-spacing: -0.025em; }
.lib-body p { font-size: 12px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 15px;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.012);
}
.lib-foot .spacer { flex: 1; }

.repeat { display: flex; flex-direction: column; gap: 10px; }
.repeat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 12px;
  background: var(--panel);
}
.repeat-row textarea { min-height: 62px; }
.repeat-row .r-del { align-self: center; }
.repeat-row .r-fields { display: grid; gap: 8px; }

.img-pick { display: flex; gap: 10px; align-items: flex-start; }
.img-pick img {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #101013;
  flex: none;
}
.img-pick .grow { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* ---------------------------------------------------------- auth */
.is-auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(255, 74, 23, 0.09), transparent 70%),
    var(--bg);
}
.auth { width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 22px; }
.auth-brand .brand-txt strong { font-size: 13.5px; }
.auth-brand .brand-txt span { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.auth-card {
  display: flex; flex-direction: column; padding: 28px 26px 24px;
  background: var(--panel-2);
  border-color: var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.auth-card h1 { font-size: 22px; letter-spacing: -0.03em; margin-bottom: 6px; }
.auth-card .field { margin-top: 18px; }
.auth-card .btn { width: 100%; margin-top: 14px; }
.auth-foot {
  margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--dim); word-break: break-all;
}
.auth-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-foot a:hover { color: var(--ink); }

/* ---------------------------------------------------------- utilitaires */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11.5px; }
.plain { margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.plain li { margin: 4px 0; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n + 2) { border-bottom: 1px solid var(--line-soft); }
  .content-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .toc-title { width: 100%; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    left: 0;
    top: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 40px 0 80px rgba(0, 0, 0, 0.5);
  }
  .side.is-open, body.nav-open .side { transform: none; }
  .burger { display: inline-grid; place-items: center; }
  .topbar { padding: 0 16px; gap: 12px; }
  .page { padding: 20px 16px 56px; }
  h1 { font-size: 30px; }
  .page-actions { margin-left: 0; width: 100%; }
  .msg-meta { margin-left: 0; width: 100%; }
  .filters input[type=search] { max-width: none; flex: 1; }
}

/* deux colonnes conservees jusqu'a 620px : a 768px les champs restent lisibles cote a cote */
@media (max-width: 620px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .grid-stats { grid-template-columns: minmax(0, 1fr); }
  .stat { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .stat:last-child { border-bottom: 0; }
  .page-card .card-head { flex-direction: column; align-items: flex-start; gap: 3px; }
  .page-actions .btn { flex: 1 1 0; }
  .card { padding: 16px 14px; }
  .card-head { margin: -16px -14px 14px; padding: 11px 14px; }
}

/* ------------------------------------------------- pages héritées */
.kicker {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.kicker .link { color: var(--ink-2); text-decoration: none; }
.kicker .link:hover { color: var(--ink); }

.page-list { padding: 2px 18px; }
.page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.page-list .page-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.page-row-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.page-row-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.page-row-title h2 {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: -0.02em;
}
.page-row-path { font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; color: var(--dim); }
.page-row-meta-muted {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--dim);
}
.page-row-meta-muted .page-row-path { font-size: 11px; }
.dot-sep { opacity: 0.45; }
.page-row-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-row .page-actions { margin-left: auto; }

.toolbar--sticky {
  position: sticky;
  top: 76px;
  z-index: 6;
  background: var(--panel-2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.content-form--read { max-width: 1000px; }
.form-foot { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.form-card .form-foot { justify-content: flex-end; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid--2 { grid-template-columns: minmax(0, 1fr); } }
.mono-num { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.list.counts { margin-top: 10px; border-top: 1px solid var(--line-soft); }

.empty-box {
  max-width: 560px;
  padding: 32px 26px;
  border-style: dashed;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.empty-title { font-family: var(--display); font-size: 17px; letter-spacing: -0.02em; }
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 2px;
  color: var(--dim); background: var(--panel);
}
.empty-box .muted { max-width: 380px; line-height: 1.55; }
.empty-box .btn { margin-top: 10px; }

.btn-block { width: 100%; justify-content: center; }

/* champs : contraste et largeur de lecture */
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=url], input[type=number], input[type=date], input[type=search],
textarea, select {
  background: #1c1c22;
  border-color: #31313a;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus,
input[type=tel]:focus, input[type=url]:focus, input[type=number]:focus,
input[type=date]:focus, input[type=search]:focus, textarea:focus, select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 74, 23, 0.14);
}
.content-sections .field { max-width: 680px; }
.content-sections .field.full { max-width: 100%; }
.content-sections .field > span { color: #b6aea3; }
.content-sections .card-head h2 { font-size: 17px; }

@media (max-width: 860px) {
  .page-row { align-items: flex-start; }
  .page-row .page-actions { margin-left: 0; width: 100%; }
  .toolbar--sticky { position: static; }
  .page-list { padding: 2px 14px; }
}


/* cartes de largeur egale + separation titre/sous-titre */
.grid--stretch { align-items: stretch; }
.grid--stretch > .card { display: flex; flex-direction: column; }
.card--split > .form-foot { margin-top: auto; }
.card-head h2 + .muted { margin-top: 4px; }
.list-row .mono-num { text-align: right; max-width: 60%; overflow-wrap: anywhere; }
.badge--off { color: var(--dim); border-color: var(--line); background: transparent; }
/* note inline dans une carte */
.note--inline { margin: 0 0 4px; }
.card > .note--inline { margin-top: 4px; }
.card > .form-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

/* actions en bas de formulaire long (contenu) */
.form-foot--end {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  justify-content: space-between;
  align-items: center;
}
.form-foot--end .toolbar-actions { margin-left: auto; }

/* mobile : cibles tactiles et lisibilite */
@media (max-width: 560px) {
  .btn-sm { height: 40px; padding: 0 13px; font-size: 12.5px; }
  .page-row .btn-sm, .page-actions .btn { min-height: 44px; }
  .burger { width: 42px; height: 42px; }
  textarea { resize: none; }
  .page-row-title h2 { font-size: 17px; }
  .page-row-meta-muted { font-size: 12px; color: var(--muted); }
  .page-row-meta-muted .page-row-path { font-size: 11.5px; }
  .toc a { padding: 9px 10px; font-size: 13px; }
  .form-foot--end { flex-direction: column; align-items: stretch; }
  .form-foot--end .toolbar-actions { margin-left: 0; flex-direction: column; }
  .form-foot--end .btn { width: 100%; justify-content: center; }
  .list-row .mono-num { max-width: 58%; font-size: 10.5px; }
  .auth-card { padding: 22px 18px; }
}

/* Bandeau explicatif (ex. /admin/projets : catalogue vs éditeur visuel) */
.note {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}
.note-k {
  color: var(--ink);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
