@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #eef1f5;
  --surface: #ffffff;
  --sunk: #e3e8ef;
  --ink: #1b2330;
  --ink-2: #4b5567;
  --ink-3: #7a8496;
  --line: #d6dce5;
  --magenta: #c8104f;
  --magenta-ink: #ffffff;
  --cyan: #0b7590;
  --yellow: #f2c200;
  --green: #2c7a4b;
  --amber: #9a5600;
  --red: #b42318;
  --fb: #1877f2; --ig: #c13584; --li: #0a66c2; --gg: #1e8e3e;
  --radius-s: 6px; --radius: 10px; --radius-l: 16px;
  --shadow: 0 1px 2px rgba(27, 35, 48, .06), 0 4px 16px rgba(27, 35, 48, .06);
  --font: "Bricolage", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161d; --surface: #1a2029; --sunk: #232a35; --ink: #e9edf3; --ink-2: #b4bdca; --ink-3: #8790a0;
    --line: #2d3542; --magenta: #ff4f8b; --magenta-ink: #1a0610; --cyan: #4cc3df; --green: #5cc78a; --amber: #f0a64a; --red: #ff7a6b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--cyan); }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- squelette ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--surface) 235px, var(--line) 235px, var(--line) 236px, transparent 236px); }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; padding: 0 6px; }
.logo svg { flex: none; }
.brandpick { position: relative; }
.brandpick select { width: 100%; appearance: none; background: var(--sunk); border: 1px solid transparent; border-radius: var(--radius); padding: 10px 34px 10px 12px; font-weight: 600; cursor: pointer; }
.brandpick::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav .count { margin-left: auto; background: var(--yellow); color: #1b2330; font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 99px; }
.rail .foot { margin-top: auto; font-size: 13px; color: var(--ink-3); display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.rail .foot button { background: none; border: 0; padding: 0; color: var(--ink-2); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

main { padding: 28px clamp(16px, 3vw, 40px) 80px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1 { font-size: clamp(26px, 3.2vw, 34px); line-height: 1.1; letter-spacing: -.02em; font-weight: 700; margin: 0; }
h2 { font-size: 19px; letter-spacing: -.01em; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 650; }
.lede { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- éléments ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; }
.panel + .panel { margin-top: 16px; }
.grid2 > .panel, .grid3 > .panel, .grid2 > div > .panel { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 9px 15px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--magenta); border-color: var(--magenta); color: var(--magenta-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunk); }
.btn.danger { color: var(--red); }
.btn.big { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.f .hint { font-weight: 400; color: var(--ink-3); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=datetime-local], input[type=number], textarea, select.in {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 11px; font-weight: 400;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 22%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg { display: inline-flex; background: var(--sunk); border-radius: var(--radius); padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.net { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.net i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.net.facebook i { background: var(--fb); } .net.instagram i { background: var(--ig); } .net.linkedin i { background: var(--li); } .net.google i { background: var(--gg); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.status.brouillon { color: var(--ink-2); }
.status.valide, .status.programme { color: var(--cyan); }
.status.publication { color: var(--cyan); border-style: dashed; }
.status.publie { color: var(--green); }
.status.echec { color: var(--red); }
.status.a_verifier { color: var(--amber); }

.notice { border-radius: var(--radius); padding: 12px 14px; background: var(--sunk); border-left: 3px solid var(--ink-3); }
.notice.warn { border-left-color: var(--amber); }
.notice.bad { border-left-color: var(--red); }
.notice.good { border-left-color: var(--green); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty p { margin: 6px auto 16px; max-width: 46ch; }

/* ---------- accueil ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.kpi b { display: block; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.kpi span { color: var(--ink-2); font-size: 14px; }
.kpi.hot { border-color: var(--yellow); box-shadow: inset 0 -3px 0 var(--yellow); }
.kpi.alert b { color: var(--red); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--sunk); }
.checklist li .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; display: grid; place-items: center; }
.checklist li.done .tick { background: var(--green); border-color: var(--green); }
.checklist li.done .tick::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.checklist li.done .txt { color: var(--ink-3); text-decoration: line-through; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--sunk); flex: none; }
.list .txt { min-width: 0; flex: 1; }
.list .txt p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- créer : brief + planche ---------- */
.create { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.brief { position: sticky; top: 20px; }
.brief .panel { display: flex; flex-direction: column; gap: 18px; }
.brief fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.brief legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--surface); cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.tile small { color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.tile[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.counter { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.counter button { border: 0; background: var(--sunk); width: 34px; height: 36px; cursor: pointer; font-size: 18px; }
.counter output { min-width: 40px; text-align: center; font-weight: 700; }

.planche { display: flex; flex-direction: column; gap: 22px; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; }
.idea > header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.idea > header h3 { margin: 0; }
.idea .body { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; }

/* le visuel, présenté comme une épreuve avec traits de coupe */
.proof { position: relative; padding: 12px; align-self: start; }
.proof::before, .proof::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--ink-3), var(--ink-3)) 0 6px / 8px 1px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) 6px 0 / 1px 8px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) 100% 6px / 8px 1px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) calc(100% - 6px) 0 / 1px 8px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) 0 calc(100% - 6px) / 8px 1px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) 6px 100% / 1px 8px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) 100% calc(100% - 6px) / 8px 1px no-repeat,
    linear-gradient(var(--ink-3), var(--ink-3)) calc(100% - 6px) 100% / 1px 8px no-repeat; }
.proof::after { background: none; }
.proof .frame { aspect-ratio: 1; background: var(--sunk); border-radius: 4px; overflow: hidden; display: grid; place-items: center; position: relative; }
.proof .frame.v { aspect-ratio: 9 / 16; }
.proof .frame img, .proof .frame video { width: 100%; height: 100%; object-fit: cover; }
.proof .cmyk { display: flex; gap: 3px; margin-top: 8px; }
.proof .cmyk i { width: 10px; height: 10px; }
.proof .cmyk i:nth-child(1) { background: #00a3c4; } .proof .cmyk i:nth-child(2) { background: #d4145a; } .proof .cmyk i:nth-child(3) { background: #f2c200; } .proof .cmyk i:nth-child(4) { background: #1b2330; }
.proof .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wait { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; text-align: center; padding: 12px; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--magenta); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

.versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }
.post { border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.post .top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.post .top .who { font-weight: 600; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post textarea { border: 0; border-radius: 0; min-height: 150px; padding: 12px; background: transparent; }
.post textarea:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--cyan) 40%, transparent); }
.post .meta { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.post .meta input { width: auto; padding: 4px 6px; font-size: 13px; }
.post .bar { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.post .err { margin: 0 12px 10px; font-size: 13px; color: var(--red); }
.post .readonly { padding: 12px; white-space: pre-wrap; font-size: 14px; max-height: 220px; overflow: auto; }
.post.locked { background: color-mix(in srgb, var(--sunk) 40%, var(--surface)); }

.gen-steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.gen-steps li { display: flex; align-items: center; gap: 10px; color: var(--ink-3); }
.gen-steps li.on { color: var(--ink); font-weight: 600; }
.gen-steps li.ok { color: var(--green); }
.gen-steps li .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }

/* ---------- calendrier ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.day.today { border-color: var(--magenta); }
.day .d { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; }
.day .d b { color: var(--ink); font-size: 18px; }
.calpost { border: 0; text-align: left; background: var(--sunk); border-radius: 8px; padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--ink-3); font-size: 12px; }
.calpost.programme, .calpost.valide { border-left-color: var(--cyan); }
.calpost.publie { border-left-color: var(--green); }
.calpost.echec { border-left-color: var(--red); }
.calpost.a_verifier { border-left-color: var(--amber); }
.calpost .t { font-weight: 600; color: var(--ink); }
.calpost .x { color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- publications, comptes, visuels ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--magenta); }
.netcard { display: flex; flex-direction: column; gap: 12px; }
.netcard .acc { display: flex; align-items: center; gap: 6px 10px; padding: 8px 10px; background: var(--sunk); border-radius: var(--radius-s); flex-wrap: wrap; }
.netcard .acc .n { flex: 1 1 calc(100% - 30px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lib figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lib figure .frame { aspect-ratio: 1; background: var(--sunk); display: grid; place-items: center; }
.lib figure img, .lib figure video { width: 100%; height: 100%; object-fit: cover; }
.lib figcaption { padding: 8px 10px; font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; justify-content: space-between; }

/* ---------- tiroir / modale ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 20, 28, .45); display: flex; justify-content: flex-end; z-index: 40; }
.drawer { background: var(--paper); width: min(560px, 100%); height: 100%; overflow: auto; padding: 22px; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.modal-wrap { align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-l); width: min(480px, 100%); padding: 22px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
#toast div { background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow); max-width: 90vw; }
#toast div.bad { background: var(--red); color: #fff; }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 26px; }

/* ---------- mobile ---------- */
@media (max-width: 1020px) {
  .create { grid-template-columns: 1fr; }
  .brief { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal { grid-template-columns: minmax(0, 1fr); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: 0; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; z-index: 30; border-right: 0; border-bottom: 1px solid var(--line); gap: 10px; }
  .rail .logo span, .rail .foot { display: none; }
  .brandpick { flex: 1; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; flex-direction: row; background: var(--surface); border-top: 1px solid var(--line); padding: 6px; justify-content: space-around; z-index: 30; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; }
  .nav a .lbl-long, .nav a.extra { display: none; }
  .nav .count { position: absolute; margin: -4px 0 0 14px; font-size: 10px; }
  main { padding: 18px 16px 90px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .shell { background: none; }
  .idea .body { grid-template-columns: 1fr; }
  .proof { max-width: 260px; }
}
