/* ---------- Thème de l'outil ---------- */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --text: #15171c;
  --muted: #5d6573;
  --border: #e1e4e9;
  --border-strong: #cdd2d9;
  --accent: #0a66c2;
  --accent-hover: #004182;
  --accent-soft: #e8f1fb;
  --on-accent: #ffffff;
  --warn: #b25e00;
  --danger: #c4314b;
  --ok: #1f7a4d;
  --violet: #6d43c9;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 2px 6px rgb(16 24 40 / .06);
  --header-h: 60px;
  --ui-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --surface: #16191f;
    --surface-2: #1d2128;
    --text: #e7e9ed;
    --muted: #9aa3b1;
    --border: #282d36;
    --border-strong: #363c47;
    --accent: #4c9be8;
    --accent-hover: #74b3f0;
    --accent-soft: #15263a;
    --on-accent: #08111c;
    --warn: #f0a650;
    --danger: #f07087;
    --ok: #5cc98f;
    --violet: #b394f5;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #16191f;
  --surface-2: #1d2128;
  --text: #e7e9ed;
  --muted: #9aa3b1;
  --border: #282d36;
  --border-strong: #363c47;
  --accent: #4c9be8;
  --accent-hover: #74b3f0;
  --accent-soft: #15263a;
  --on-accent: #08111c;
  --warn: #f0a650;
  --danger: #f07087;
  --ok: #5cc98f;
  --violet: #b394f5;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--ui-font);
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
}
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.brand-mark .fill { fill: var(--accent); }
.brand-text h1 { margin: 0; font-size: 16px; line-height: 1.2; font-weight: 650; }
.brand-text p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Mise en page ---------- */
.panel-tabs { display: none; }
.layout { display: grid; }
.panel { min-width: 0; }

.editor { padding: 20px; background: var(--surface); }
.preview { padding: 16px 24px 48px; container-type: inline-size; }

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(380px, 430px) 1fr;
    height: calc(100dvh - var(--header-h));
  }
  .panel { overflow-y: auto; overscroll-behavior: contain; }
  .editor { border-right: 1px solid var(--border); }
}
@media (max-width: 1099px) {
  .panel-tabs {
    position: sticky; top: var(--header-h); z-index: 15;
    display: flex; gap: 4px; padding: 8px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .panel-tabs button {
    flex: 1; height: 36px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-weight: 600; cursor: pointer;
  }
  .panel-tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
  body[data-panel="editor"] #panel-preview,
  body[data-panel="preview"] #panel-editor { display: none; }
  .editor { max-width: 720px; width: 100%; margin: 0 auto; background: transparent; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .brand-text p, .hide-sm { display: none; }
  .top-actions { gap: 2px; }
  .top-actions .btn { padding: 0 10px; }
  .editor { padding: 16px; }
  .preview { padding: 12px 16px 40px; }
}
@media (max-width: 440px) {
  .brand-text { display: none; }
}

/* ---------- Éditeur ---------- */
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
@media (min-width: 1100px) {
  .block { border: 0; border-radius: 0; padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
  .block:last-child { border-bottom: 0; }
}
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.block h2 { margin: 0; font-size: 14px; font-weight: 650; }
details.block > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary::after {
  content: ""; width: 8px; height: 8px; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
details.block[open] > summary { margin-bottom: 12px; }
details.block[open] > summary::after { transform: rotate(-135deg); }

.counter { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.counter.warn { color: var(--warn); font-weight: 600; }
.counter.over { color: var(--danger); font-weight: 700; }

.fmt-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.fmt {
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 15px; line-height: 1;
}
.fmt:hover { background: var(--surface-2); border-color: var(--border-strong); }
.fmt-sep { width: 1px; margin: 4px 4px; background: var(--border); }
.tx { position: relative; font-family: Georgia, serif; }
.tx sub { font-size: 10px; font-family: var(--ui-font); }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 8px; }
.emoji-bar button {
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 17px; line-height: 1;
}
.emoji-bar button:hover { background: var(--surface-2); }

textarea {
  display: block; width: 100%; min-height: 320px; resize: vertical;
  padding: 14px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: 15px/1.5 var(--ui-font);
}
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); font-weight: 650; }
.chip.alert { color: var(--warn); border-color: currentColor; background: transparent; }

.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 10px; transition: background-color .15s, border-color .15s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-empty { margin: 6px 4px; font-size: 13px; color: var(--muted); text-align: center; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: rgb(0 0 0 / .65); color: #fff;
  cursor: pointer; font-size: 15px; line-height: 24px; padding: 0;
}

.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar-preview { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 20px; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-row .field { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- Zone d'aperçu ---------- */
.preview-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 18px;
}
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.seg button {
  height: 32px; padding: 0 14px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.seg.full { display: flex; width: 100%; margin-bottom: 12px; }
.seg.full button { flex: 1; padding: 0 8px; }
.preview-title { margin: 0; font-size: 14px; font-weight: 650; }

.stage { display: flex; gap: 28px; justify-content: center; align-items: flex-start; }
.device { margin: 0; min-width: 0; flex: 0 1 calc(var(--w) * 1px); }
@container (max-width: 760px) {
  .stage { flex-direction: column; align-items: center; }
  .stage .device { flex: none; width: min(100%, calc(var(--w) * 1px)); }
}
.device figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0 4px 10px; font-size: 12px; color: var(--muted);
}
.device figcaption strong { color: var(--text); font-size: 13px; }
.cap-info { text-align: right; }
.cap-info.alert { color: var(--warn); }
.scaler { position: relative; overflow: hidden; }
.scaler > * { transform-origin: top left; }

/* ---------- Rendu LinkedIn ---------- */
.li {
  --li-font: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, Cantarell, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", Helvetica, Arial, sans-serif;
  --li-page: #f4f2ee;
  --li-card: #ffffff;
  --li-text: rgb(0 0 0 / .9);
  --li-muted: rgb(0 0 0 / .6);
  --li-link: #0a66c2;
  --li-border: rgb(140 140 140 / .2);
  --li-divider: rgb(0 0 0 / .08);
  --li-search: #edf3f8;
  --li-ghost: #ebe8e3;
  --li-bezel: #121212;
  font-family: var(--li-font);
  color: var(--li-text);
}
.li[data-theme="dark"] {
  --li-page: #000000;
  --li-card: #1b1f23;
  --li-text: rgb(255 255 255 / .9);
  --li-muted: rgb(255 255 255 / .6);
  --li-link: #71b7fb;
  --li-border: rgb(255 255 255 / .12);
  --li-divider: rgb(255 255 255 / .12);
  --li-search: #38434f;
  --li-ghost: #2a2f34;
}

/* Téléphone */
.phone {
  width: 414px; padding: 12px; border-radius: 58px;
  background: #121212;
  box-shadow: inset 0 0 0 1.5px #3a3a3a, 0 24px 48px -24px rgb(0 0 0 / .5);
}
.phone-screen {
  position: relative; width: 390px; height: 800px; border-radius: 46px; overflow: hidden;
  display: flex; flex-direction: column; background: var(--li-page);
}
.ph-status {
  flex: none; height: 50px; padding: 14px 30px 0 34px;
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--li-card); font-size: 15px; font-weight: 600;
}
.ph-island { position: absolute; top: 11px; left: 50%; width: 112px; height: 32px; margin-left: -56px; border-radius: 20px; background: #000; }
.ph-status-icons { display: flex; gap: 6px; align-items: center; padding-top: 3px; }
.ph-status-icons svg { height: 12px; width: auto; fill: currentColor; }
.ph-appbar {
  flex: none; height: 50px; padding: 0 14px; display: flex; align-items: center; gap: 12px;
  background: var(--li-card); border-bottom: 1px solid var(--li-divider);
}
.ph-appbar .li-avatar { width: 32px; height: 32px; font-size: 12px; }
.ph-search {
  flex: 1; height: 34px; border-radius: 6px; background: var(--li-search);
  display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--li-muted); font-size: 14px;
}
.ph-search svg, .ph-appbar > svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ph-appbar > svg { width: 24px; height: 24px; color: var(--li-muted); }
.ph-feed { flex: 1; overflow-y: auto; scrollbar-width: none; padding-top: 8px; }
.ph-feed::-webkit-scrollbar { display: none; }
.ph-nav {
  flex: none; display: flex; justify-content: space-around; padding: 6px 4px 0; height: 84px;
  background: var(--li-card); border-top: 1px solid var(--li-divider);
}
.ph-nav span { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 70px; font-size: 10.5px; color: var(--li-muted); }
.ph-nav span.on { color: var(--li-text); }
.ph-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ph-home { position: absolute; bottom: 8px; left: 50%; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--li-text); opacity: .85; }

/* Ordinateur */
.desk { width: 603px; padding: 24px; border-radius: 12px; background: var(--li-page); }
.desk .li-card { border-radius: 8px; box-shadow: 0 0 0 1px var(--li-border); }

/* Squelettes de fil */
.ghost { background: var(--li-card); margin-top: 8px; padding: 14px 16px 18px; }
.desk .ghost { border-radius: 8px; box-shadow: 0 0 0 1px var(--li-border); }
.ghost i { display: block; height: 10px; border-radius: 5px; background: var(--li-ghost); margin-top: 10px; }
.ghost .g-head { display: flex; gap: 10px; align-items: center; }
.ghost .g-head::before { content: ""; width: 48px; height: 48px; border-radius: 50%; background: var(--li-ghost); flex: none; }
.ghost .g-head i { margin: 0; width: 40%; }

/* Carte du post */
.li-card { background: var(--li-card); color: var(--li-text); overflow: hidden; }
.li-head { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px 0; }
.li-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px;
}
.li-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.li-meta { flex: 1; min-width: 0; }
.li-name-row { font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-degree { font-weight: 400; color: var(--li-muted); }
.li-headline, .li-time { font-size: 12px; line-height: 16px; color: var(--li-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-time { display: flex; align-items: center; gap: 3px; }
.li-time svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.li-head-actions { display: flex; gap: 2px; color: var(--li-muted); margin-top: -2px; }
.li-head-actions svg { width: 24px; height: 24px; padding: 2px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.li-head-actions svg.dots { fill: currentColor; stroke: none; }
.li-body { padding: 0 16px; margin: 8px 0; }

/* Texte : mêmes mesures dans l'aperçu et dans le mesureur caché */
.li-text { font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: break-word; color: var(--li-text); }
.li-text[data-v="mobile"] { width: 358px; }
.li-text[data-v="desktop"] { width: 523px; }
.li-link { color: var(--li-link); font-weight: 600; }
.li-more { color: var(--li-muted); cursor: pointer; }
.li-more:hover { color: var(--li-link); text-decoration: underline; }
.li-placeholder { color: var(--li-muted); font-style: italic; }
.measure-root { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

/* Images */
.li-media:empty { display: none; }
.li-grid { display: grid; gap: 2px; }
.li-img { position: relative; overflow: hidden; background: var(--li-ghost); min-height: 0; }
.li-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.li-grid.one { display: block; }
.li-grid.one .li-img { height: 100%; }
.li-grid.two { grid-template-columns: 1fr 1fr; aspect-ratio: 1.6; }
.li-grid.many .li-main { aspect-ratio: 1.5; }
.li-thumbs { display: grid; gap: 2px; }
.li-thumbs.c2 { grid-template-columns: 1fr 1fr; }
.li-thumbs.c3 { grid-template-columns: 1fr 1fr 1fr; }
.li-thumbs .li-img { aspect-ratio: 1; }
.li-plus {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgb(0 0 0 / .55); color: #fff; font-size: 26px; font-weight: 600;
}

/* Réactions et actions */
.li-social { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12px; line-height: 16px; color: var(--li-muted); }
.li-social[hidden] { display: none; }
.li-reacts { display: flex; align-items: center; }
.li-reacts svg { width: 16px; height: 16px; margin-left: -4px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--li-card); }
.li-reacts svg:first-child { margin-left: 0; }
.li-reacts span { margin-left: 4px; }
.li-actions { display: flex; justify-content: space-between; margin: 0 12px; padding: 4px 0; border-top: 1px solid var(--li-divider); }
.li-act { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; padding: 10px 4px; font-size: 14px; font-weight: 600; color: var(--li-muted); border-radius: 4px; }
.li-act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.li-card[data-v="mobile"] .li-actions { margin: 0; padding: 2px 8px 4px; }
.li-card[data-v="mobile"] .li-act { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 12px; font-weight: 500; }
.li-card[data-v="mobile"] .li-act svg { width: 22px; height: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: calc(100vw - 32px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgb(0 0 0 / .2);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Navigation entre sections ---------- */
.top-nav { display: none; }
@media (min-width: 1100px) {
  .top-nav { display: flex; gap: 4px; margin: 0 auto 0 24px; }
}
.top-nav button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer;
}
.top-nav button:hover { color: var(--text); }
.top-nav button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.nav-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nav-count:empty { display: none; }
.panel-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

body[data-panel="library"] .layout { grid-template-columns: 1fr; }
body[data-panel="library"] #panel-editor,
body[data-panel="library"] #panel-preview,
body:not([data-panel="library"]) #panel-library { display: none; }

/* ---------- Enregistrement du post ---------- */
.save-state { font-size: 12px; color: var(--muted); text-align: right; }
.save-state.warn { color: var(--warn); font-weight: 600; }
.save-state.ok { color: var(--ok); font-weight: 600; }
.btn.wide { width: 100%; height: 40px; margin-top: 12px; }
.btn:disabled { opacity: .6; cursor: progress; }
.profile-hint { margin: 0 0 12px; }

/* ---------- Prochains posts ---------- */
.library { padding: 28px 28px 56px; }
.lib-inner { max-width: 1240px; margin: 0 auto; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.lib-title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; }
.lib-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.lib-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.lib-filters .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.lib-filters .seg button { white-space: nowrap; }
.seg .n { margin-left: 4px; opacity: .7; font-variant-numeric: tabular-nums; }
.lib-filters select {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
}
.lib-group h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 26px 0 12px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.lib-group h3 .n { font-weight: 600; opacity: .75; }
.lib-group.late h3 { color: var(--warn); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lib-empty {
  margin-top: 24px; padding: 48px 20px; text-align: center; color: var(--muted);
  border: 1.5px dashed var(--border-strong); border-radius: 14px;
}
.lib-empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
@media (max-width: 640px) {
  .library { padding: 18px 16px 40px; }
  .lib-grid { grid-template-columns: 1fr; }
  .lib-head .btn { width: 100%; }
}

.pcard {
  display: flex; flex-direction: column; min-width: 0;
  padding: 14px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
}
.pcard.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pcard-head { display: flex; align-items: center; gap: 10px; }
.mini-avatar {
  width: 36px; height: 36px; flex: none; overflow: hidden; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 650;
}
.mini-avatar.company, .li-avatar.company, .avatar-preview.company { border-radius: 8px; }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pcard-who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-date { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.pcard-date svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pcard-date.late { color: var(--warn); font-weight: 600; }
.status-pill {
  appearance: none; -webkit-appearance: none; flex: none;
  height: 26px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 12px; font-weight: 700;
  color: var(--s); background: color-mix(in srgb, var(--s) 14%, transparent);
}
.s-idee { --s: var(--violet); }
.s-brouillon { --s: var(--muted); }
.s-pret { --s: var(--ok); }
.s-publie { --s: var(--accent); }
.pcard-body { flex: 1; margin: 12px 0; cursor: pointer; }
.pcard-text {
  margin: 0; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden;
}
.pcard-text em { color: var(--muted); }
.pcard .li-link { color: var(--accent); }
.pcard-thumb { position: relative; margin-top: 10px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: var(--surface-2); }
.pcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard-thumb span {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgb(0 0 0 / .65); color: #fff; font-size: 12px; font-weight: 600;
}
.pcard-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.pcard-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
