/* ==========================================================================
   SankiPost : styles (sans framework). Mode clair / sombre, responsive.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #e1e5eb;
  --border-strong: #cbd2db;
  --text: #121722;
  --muted: #5b6474;
  --faint: #8a93a3;
  --primary: #0f766e;
  --primary-hover: #0c625b;
  --primary-soft: #e3f3f1;
  --primary-text: #ffffff;
  --accent: #e28a07;
  --danger: #d12b2b;
  --danger-soft: #fdeaea;
  --warn: #a35a00;
  --warn-soft: #fff3df;
  --ok: #137a3d;
  --ok-soft: #e4f5ea;
  --info: #1f4fd1;
  --info-soft: #e7eeff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.22);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --sidebar-w: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --c-facebook: #1877f2;
  --c-instagram: #d62976;
  --c-linkedin: #0a66c2;
  --c-x: #111111;
  --c-tiktok: #161823;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1018;
  --surface: #131a25;
  --surface-2: #1a2230;
  --surface-3: #232d3d;
  --border: #253043;
  --border-strong: #34425a;
  --text: #e8edf5;
  --muted: #a3adbd;
  --faint: #758097;
  --primary: #2bb3a6;
  --primary-hover: #3fc6b9;
  --primary-soft: #11302d;
  --primary-text: #04201d;
  --accent: #f5a524;
  --danger: #f06363;
  --danger-soft: #3a1717;
  --warn: #f0b04f;
  --warn-soft: #3a2a10;
  --ok: #4cc77d;
  --ok-soft: #12301f;
  --info: #7aa2ff;
  --info-soft: #172446;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  --c-x: #e7e9ea;
  --c-tiktok: #e9e9ef;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1018;
    --surface: #131a25;
    --surface-2: #1a2230;
    --surface-3: #232d3d;
    --border: #253043;
    --border-strong: #34425a;
    --text: #e8edf5;
    --muted: #a3adbd;
    --faint: #758097;
    --primary: #2bb3a6;
    --primary-hover: #3fc6b9;
    --primary-soft: #11302d;
    --primary-text: #04201d;
    --accent: #f5a524;
    --danger: #f06363;
    --danger-soft: #3a1717;
    --warn: #f0b04f;
    --warn-soft: #3a2a10;
    --ok: #4cc77d;
    --ok-soft: #12301f;
    --info: #7aa2ff;
    --info-soft: #172446;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
    --c-x: #e7e9ea;
    --c-tiktok: #e9e9ef;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.6em; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.76rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 14px; }

/* ---------- Sélecteur de langue ---------- */
.lang-switch button { padding: 5px 10px; font-size: 0.8rem; letter-spacing: 0.03em; }
.lang-holder { display: flex; justify-content: flex-end; margin-bottom: 12px; }
@media (max-width: 560px) { .topbar .lang-switch button { padding: 4px 7px; } }

/* ---------- Cases « Publier sur » ---------- */
.platform-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; min-width: 0;
  transition: border-color 0.15s, background 0.15s;
}
.pick:hover { border-color: var(--border-strong); }
.pick.checked { border-color: var(--primary); background: var(--primary-soft); }
.pick.disabled { cursor: default; background: var(--surface-2); }
.pick.disabled .pf { opacity: 0.45; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); flex: none; }
.pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pick-name { font-weight: 700; font-size: 0.88rem; }
.pick-count { font-size: 0.74rem; color: var(--muted); }
a.pick-count { color: var(--primary); text-decoration: underline; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 0.93rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1b1300; }
.btn-accent:hover { filter: brightness(1.05); background: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 4px 11px; font-size: 0.84rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite; display: inline-block; flex: none;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: 0.88rem; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.textarea-sm { min-height: 80px; }
.hint { font-size: 0.8rem; color: var(--muted); }
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 48px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.pwd-toggle:hover { color: var(--text); background: var(--surface-2); }
.pwd-toggle[aria-pressed="true"] { color: var(--primary); }
.pwd-toggle svg { width: 20px; height: 20px; }
.pwd-toggle[disabled] { opacity: 0.5; cursor: not-allowed; }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 0.92rem; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.check.disabled { opacity: 0.55; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ---------- Mise en page de l'application ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; transition: transform 0.2s ease;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; padding: 4px 8px 18px; letter-spacing: -0.01em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #14b8a6 60%, var(--accent));
  color: #fff; font-weight: 800; font-size: 1.05rem;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: 0.93rem;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav-count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px;
  background: var(--accent); color: #1b1300; font-size: 0.75rem; font-weight: 700; text-align: center;
}
.nav-count:empty { display: none; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.user-email { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.2rem; font-weight: 750; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar .select { min-height: 38px; width: auto; max-width: 210px; padding: 6px 10px; }
#menu-btn { display: none; }
.view { padding: 24px 28px 60px; max-width: 1320px; width: 100%; }
.backdrop { position: fixed; inset: 0; background: rgba(5, 10, 20, 0.45); z-index: 35; display: none; }
.global-banner-inner { padding: 14px 28px 0; max-width: 1320px; }
.global-banner-inner .banner { margin-bottom: 0; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .backdrop, .backdrop.show { display: block; }
  .main-wrap { margin-left: 0; }
  #menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .view { padding: 16px 16px 80px; }
  .global-banner-inner { padding: 12px 16px 0; }
  .topbar .select { max-width: 130px; }
}

/* ---------- Cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 700; margin: 6px 0 8px; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 0.9rem;
  border: 1px solid transparent; margin-bottom: 14px;
}
.banner-info { background: var(--info-soft); color: var(--info); }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-error { background: var(--danger-soft); color: var(--danger); }
.banner-ok { background: var(--ok-soft); color: var(--ok); }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Badges et pastilles ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px; font-size: 0.76rem; font-weight: 700;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.plain::before { display: none; }
.st-draft { background: var(--surface-3); color: var(--muted); }
.st-scheduled, .st-pending { background: var(--info-soft); color: var(--info); }
.st-publishing, .st-processing { background: var(--warn-soft); color: var(--warn); }
.st-published, .st-active { background: var(--ok-soft); color: var(--ok); }
.st-partially_published, .st-expiring { background: #fff1d6; color: #a15c00; }
:root[data-theme="dark"] .st-partially_published, :root[data-theme="dark"] .st-expiring { background: #3b2b0c; color: #f3b44a; }
.st-failed, .st-expired, .st-error, .st-revoked { background: var(--danger-soft); color: var(--danger); }
.st-cancelled { background: var(--surface-3); color: var(--faint); }

.pf {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 6px;
  color: #fff; font-size: 0.66rem; font-weight: 800; letter-spacing: -0.02em;
}
.pf-lg { width: 40px; height: 40px; border-radius: 11px; font-size: 0.95rem; }
.pf-facebook { background: var(--c-facebook); }
.pf-instagram { background: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5); }
.pf-linkedin { background: var(--c-linkedin); }
.pf-x { background: #111; }
.pf-tiktok { background: #111; box-shadow: inset -2px 0 0 #fe2c55, inset 2px 0 0 #25f4ee; }
.pf-youtube { background: #ff0033; }
:root[data-theme="dark"] .pf-x, :root[data-theme="dark"] .pf-tiktok { background: #2a2f3a; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--muted);
}
.avatar-sm { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .pf { position: absolute; right: -5px; bottom: -4px; width: 17px; height: 17px; font-size: 0.55rem; border-radius: 5px; border: 2px solid var(--surface); }

.target-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 3px; border-radius: 99px; font-size: 0.8rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2);
}
.target-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.target-pill.st-published .dot { background: var(--ok); }
.target-pill.st-failed .dot { background: var(--danger); }
.target-pill.st-processing .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.target-pill.st-pending .dot { background: var(--info); }
.target-pill.st-cancelled .dot { background: var(--faint); }
.target-pill { color: var(--text); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Connexion ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; padding: 48px;
  background: radial-gradient(1200px 600px at 10% 10%, #14b8a6 0%, transparent 55%), radial-gradient(900px 500px at 90% 90%, #f59e0b 0%, transparent 55%), #0b3b37;
  color: #f2fffd; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero h1 { font-size: 2.3rem; letter-spacing: -0.02em; max-width: 520px; }
.auth-hero p { color: #d1f5ef; max-width: 480px; font-size: 1.05rem; }
.auth-hero .pf-row { display: flex; gap: 10px; margin-top: 22px; }
.auth-hero .logo { color: #fff; padding-left: 0; }
.auth-main { display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card .card { padding: 26px; }
.tabs-inline { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; margin-bottom: 18px; }
.tabs-inline button {
  flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px;
  font-weight: 650; color: var(--muted); cursor: pointer;
}
.tabs-inline button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px; min-height: 0; }
  .auth-hero h1 { font-size: 1.6rem; }
  .auth-hero .hero-extra { display: none; }
}

/* ---------- Éditeur ---------- */
.compose-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.compose-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) {
  .compose-grid { grid-template-columns: 1fr; }
  .compose-side { position: static; }
}
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.account-check {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface); transition: border-color 0.15s, background 0.15s; min-width: 0;
}
.account-check:hover { border-color: var(--border-strong); }
.account-check.checked { border-color: var(--primary); background: var(--primary-soft); }
.account-check.disabled { opacity: 0.55; cursor: not-allowed; }
.account-check input { position: absolute; opacity: 0; pointer-events: none; }
.account-check .name { font-weight: 650; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-check .meta { font-size: 0.76rem; color: var(--muted); }
.account-check .tick {
  margin-left: auto; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong);
  display: grid; place-items: center; flex: none; color: transparent; font-size: 0.8rem; font-weight: 900;
}
.account-check.checked .tick { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; scrollbar-width: thin; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  border: 0; background: transparent; padding: 9px 12px; margin-bottom: -1px;
  border-bottom: 2.5px solid transparent; color: var(--muted); font-weight: 650; font-size: 0.88rem; cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .pf { width: 18px; height: 18px; font-size: 0.55rem; border-radius: 5px; }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.counters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.counter {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px;
  border-radius: 99px; background: var(--surface-2); font-size: 0.8rem; font-weight: 650; font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.counter .pf { width: 18px; height: 18px; font-size: 0.55rem; border-radius: 5px; }
.counter.warn { background: var(--warn-soft); color: var(--warn); }
.counter.over { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 26px 16px;
  text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone strong { display: block; font-size: 1rem; margin-bottom: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.media-item {
  position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-3); aspect-ratio: 1 / 1;
}
.media-item.dragging { opacity: 0.4; }
.media-item.over { outline: 2.5px solid var(--primary); }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; }
.media-item .order {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; border-radius: 6px; padding: 0 5px;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.75rem; font-weight: 800; display: grid; place-items: center;
}
.media-item .kind {
  position: absolute; right: 6px; top: 6px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.7rem; font-weight: 700;
}
.media-item .tools {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 4px;
  padding: 6px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
.media-item .tools button {
  width: 28px; height: 28px; border-radius: 7px; border: 0; background: rgba(255, 255, 255, 0.92); color: #111;
  cursor: pointer; font-weight: 800; font-size: 0.85rem; display: grid; place-items: center;
}
.media-item .tools button:hover { background: #fff; }
.media-item .tools button.del { color: #c81e1e; }
.media-item .info { position: absolute; left: 6px; bottom: 40px; color: #fff; font-size: 0.68rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.upload-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.upload-row:last-child { border-bottom: 0; }
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; flex: 1; min-width: 80px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.2s; border-radius: inherit; }
.progress.error > span { background: var(--danger); }

.opt-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface); }
.opt-block + .opt-block { margin-top: 10px; }
.opt-block h4 { display: flex; align-items: center; gap: 8px; font-size: 0.93rem; margin-bottom: 10px; }
.tt-creator { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tt-consent { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.85rem; }

.validation-list { display: flex; flex-direction: column; gap: 10px; }
.validation-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.validation-item .head { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 0.9rem; }
.validation-item ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.85rem; }
.validation-item li.err { color: var(--danger); }
.validation-item li.warn { color: var(--warn); }
.validation-item li.info { color: var(--muted); }
.validation-item .ok { margin-left: auto; color: var(--ok); font-size: 0.8rem; font-weight: 700; }
.validation-item .ko { margin-left: auto; color: var(--danger); font-size: 0.8rem; font-weight: 700; }

.actions-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions-bar .grow { flex: 1; }
.schedule-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
@media (max-width: 560px) { .schedule-row { grid-template-columns: 1fr; } }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Aperçus ---------- */
.preview-frame { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.pv-head .who { font-weight: 700; font-size: 0.9rem; line-height: 1.2; }
.pv-head .when { font-size: 0.75rem; color: var(--muted); }
.pv-text { padding: 0 14px 12px; white-space: pre-wrap; word-wrap: break-word; font-size: 0.92rem; }
.pv-text .more { color: var(--muted); font-weight: 600; }
.pv-text .tag { color: var(--info); }
.pv-media { display: grid; gap: 2px; background: var(--surface-3); }
.pv-media.n2 { grid-template-columns: 1fr 1fr; }
.pv-media.n3, .pv-media.n4 { grid-template-columns: 1fr 1fr; }
.pv-media img, .pv-media video { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; }
.pv-media.n1 img, .pv-media.n1 video { aspect-ratio: auto; max-height: 420px; object-fit: contain; background: #000; }
.pv-media .more-count { display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: #fff; font-weight: 800; font-size: 1.4rem; }
.pv-bar { display: flex; justify-content: space-around; padding: 9px 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.pv-ig .pv-media { aspect-ratio: 4 / 5; display: block; position: relative; }
.pv-ig .pv-media img, .pv-ig .pv-media video { aspect-ratio: auto; height: 100%; object-fit: cover; max-height: none; background: #000; }
.pv-ig .dots { display: flex; gap: 4px; justify-content: center; padding: 8px 0 0; }
.pv-ig .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.pv-ig .dots span:first-child { background: var(--info); }
.pv-tt { background: #000; color: #fff; aspect-ratio: 9 / 16; max-height: 560px; position: relative; margin: 0 auto; width: 100%; max-width: 320px; border-radius: var(--radius); overflow: hidden; }
.pv-tt img, .pv-tt video { width: 100%; height: 100%; object-fit: cover; }
.pv-tt .overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 54px 16px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); font-size: 0.85rem; white-space: pre-wrap; }
.pv-tt .overlay strong { display: block; margin-bottom: 4px; }
.pv-tt .rail { position: absolute; right: 10px; bottom: 90px; display: flex; flex-direction: column; gap: 14px; font-size: 0.7rem; text-align: center; }
.pv-tt .rail span { display: block; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.pv-tt .empty-tt { position: absolute; inset: 0; display: grid; place-items: center; color: #aaa; font-size: 0.9rem; text-align: center; padding: 20px; }
.pv-yt-player { aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; color: #aaa; font-size: 0.9rem; }
.pv-yt-player video { width: 100%; height: 100%; object-fit: contain; }
.pv-yt-meta { display: flex; gap: 10px; padding: 12px 14px 6px; align-items: flex-start; }
.pv-yt-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; overflow-wrap: anywhere; }
.pv-yt .when { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.pv-thread { display: flex; flex-direction: column; }
.pv-thread .tw { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.pv-thread .tw:first-child { border-top: 0; }
.pv-thread .tw .pv-text { padding: 0; }
.pv-thread .tw .pv-media { border-radius: 14px; overflow: hidden; margin-top: 8px; }

/* ---------- Listes de publications ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 99px;
  padding: 6px 13px; font-size: 0.85rem; font-weight: 650; cursor: pointer; color: var(--muted);
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.post-card .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-card .date { font-weight: 700; font-size: 0.92rem; }
.post-card .text { margin: 10px 0; white-space: pre-wrap; word-wrap: break-word; color: var(--text); font-size: 0.92rem; max-height: 4.8em; overflow: hidden; position: relative; }
.post-card .thumbs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.post-card .thumbs img, .post-card .thumbs video { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.post-card .targets { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.target-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.86rem; }
.target-row .name { font-weight: 650; }
.target-row .err { flex-basis: 100%; color: var(--danger); font-size: 0.82rem; }
.target-row .note { flex-basis: 100%; color: var(--warn); font-size: 0.82rem; }
.target-row .actions { margin-left: auto; display: flex; gap: 6px; }
.post-card .foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.logs { margin-top: 10px; border-radius: var(--radius-sm); background: var(--surface-2); padding: 10px 12px; font-size: 0.8rem; max-height: 320px; overflow: auto; }
.log-line { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); align-items: baseline; }
.log-line:last-child { border-bottom: 0; }
.log-line .lv { font-weight: 800; font-size: 0.7rem; text-transform: uppercase; }
.log-line .lv.info { color: var(--info); }
.log-line .lv.warn { color: var(--warn); }
.log-line .lv.error { color: var(--danger); }
.log-line time { color: var(--faint); font-family: var(--mono); font-size: 0.75rem; }

/* ---------- Calendrier ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar h2 { font-size: 1.15rem; text-transform: capitalize; min-width: 200px; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 650; color: var(--muted); cursor: pointer; font-size: 0.86rem; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
.cal-dow { background: var(--surface-2); padding: 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; }
.cal-cell { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: var(--bg); }
.cal-cell.out .num { color: var(--faint); }
.cal-cell .num { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.cal-cell.today .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--primary-text); }
.cal-ev {
  display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 6px; font-size: 0.74rem; font-weight: 600;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-left: 3px solid currentColor; cursor: pointer; min-width: 0;
}
.cal-ev .t { font-variant-numeric: tabular-nums; flex: none; }
.cal-ev .pf { width: 15px; height: 15px; font-size: 0.5rem; border-radius: 4px; }
.cal-ev .s { overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cal-more { font-size: 0.72rem; color: var(--muted); font-weight: 700; padding-left: 4px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.cal-week .col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 300px; display: flex; flex-direction: column; }
.cal-week .col .head { padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 0.85rem; text-transform: capitalize; }
.cal-week .col.today .head { color: var(--primary); }
.cal-week .col .body { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; cursor: pointer; }
.cal-week .cal-ev { white-space: normal; flex-direction: column; align-items: flex-start; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 760px) {
  .cal-cell { min-height: 70px; padding: 4px; }
  .cal-ev .s { display: none; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-week .col { min-height: 0; }
}

/* ---------- Comptes / marques ---------- */
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.platform-card { display: flex; flex-direction: column; gap: 12px; }
.platform-card .head { display: flex; align-items: center; gap: 12px; }
.platform-card .head h3 { font-size: 1.05rem; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); flex-wrap: wrap; }
.acc-row .info { flex: 1; min-width: 140px; }
.acc-row .name { font-weight: 650; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; }
.acc-row .sub { font-size: 0.76rem; color: var(--muted); }
.acc-row .err { flex-basis: 100%; font-size: 0.8rem; color: var(--danger); }
.acc-row .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand-row:last-child { border-bottom: 0; }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; color: var(--muted); flex: none; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
.table-wrap { overflow-x: auto; }
table.limits { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.limits th, table.limits td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.limits th { color: var(--muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- États vides, chargement ---------- */
.empty { text-align: center; padding: 46px 18px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.empty .ico svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 1.05rem; }
.empty p { max-width: 420px; margin: 0 auto 14px; font-size: 0.92rem; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px; color: var(--muted); }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; height: 110px; }
.skeleton + .skeleton { margin-top: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; max-width: min(400px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 0.9rem; animation: toast-in 0.2s ease; border-left: 4px solid var(--info);
}
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--accent); }
.toast .msg { flex: 1; }
.toast button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 560px) { .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; } }

/* ---------- Fenêtres modales ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(5, 10, 20, 0.5); display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 1.05rem; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Page de retour OAuth ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.center-card { width: 100%; max-width: 520px; text-align: center; }
.center-card .big-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; font-size: 1.8rem; font-weight: 800; }
.big-ico.ok { background: var(--ok-soft); color: var(--ok); }
.big-ico.ko { background: var(--danger-soft); color: var(--danger); }
.big-ico.wait { background: var(--info-soft); color: var(--info); }
.select-list { display: flex; flex-direction: column; gap: 8px; text-align: left; margin: 16px 0; }
