/* =====================================================================
   SocialCRM — interface (d'après la maquette)
   ===================================================================== */
:root {
  --primary: #5B45E0;
  --primary-600: #4A35CC;
  --primary-soft: #EFECFF;
  --primary-border: #CFC7FB;
  --sidebar: #1F2455;
  --sidebar-2: #262B63;
  --sidebar-text: #DCDEF2;
  --bg: #F4F5FA;
  --card: #FFFFFF;
  --border: #E6E8F0;
  --border-2: #D9DCE7;
  --text: #191B2C;
  --muted: #6B7084;
  --green: #1F9D55; --green-bg: #E6F6EC;
  --red: #D93636;   --red-bg: #FDECEC;
  --orange: #D97706; --orange-bg: #FEF3E2;
  --blue: #2563EB;  --blue-bg: #E8F0FE;
  --gray-bg: #F0F1F5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 50, .04), 0 2px 8px rgba(20, 22, 50, .04);
  --shadow-lg: 0 12px 40px rgba(20, 22, 50, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
code { background: var(--gray-bg); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.muted-strong { color: var(--text); font-weight: 500; }
.d-block { display: block; }
.nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.inline { display: inline; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.error-text { color: var(--red); font-size: 13.5px; margin: 8px 0 0; }
.pad { padding: 12px 16px; margin: 0; }

/* ---------------------------------------------------------- Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: 0 0 240px; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 26px; letter-spacing: -.02em; padding: 2px 12px 22px; }
.brand-lg { font-size: 30px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a, .nav-help { display: flex; align-items: center; gap: 16px; padding: 13px 16px; border-radius: 10px; font-size: 17px; font-weight: 500; color: var(--sidebar-text); transition: background .15s; }
.nav a:hover, .nav-help:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: linear-gradient(90deg, #5B45E0, #6A55EA); color: #fff; box-shadow: 0 6px 18px rgba(91, 69, 224, .35); }
.nav-help.active { background: rgba(255, 255, 255, .1); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 66px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: var(--bg); position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 10px; font-size: 22px; flex: 1; min-width: 0; }
.crumb { color: var(--muted); }
.crumb:hover { color: var(--text); }
.crumb-sep { color: var(--muted); display: inline-flex; }
.crumb-current { font-weight: 800; color: var(--text); background: none; border: 0; font: inherit; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.content { padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.burger { display: none; }
.sidebar-backdrop { display: none; }

/* ---------------------------------------------------------- Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(91, 69, 224, .28); }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-soft { background: var(--primary-soft); color: var(--primary-600); border-color: var(--primary-border); }
.btn-soft:hover { background: #E4DFFF; }
.btn-outline { background: #fff; border-color: var(--border-2); color: var(--text); font-weight: 500; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: #fff; border-color: var(--border); color: var(--text); font-weight: 500; }
.btn-light:hover { background: var(--gray-bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #bf2a2a; }
.btn-ghost-danger { background: #fff; border-color: #F3C7C7; color: var(--red); font-weight: 500; }
.btn-ghost-danger:hover { background: var(--red-bg); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: var(--red-bg); }
.icon-btn.disabled { opacity: .35; cursor: not-allowed; }
.bell .dot { position: absolute; top: 6px; right: 7px; width: 10px; height: 10px; background: #D6249F; border: 2px solid var(--bg); border-radius: 50%; }
.link, .link-btn { color: var(--primary); font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; font-family: inherit; padding: 0; }
.link:hover, .link-btn:hover { text-decoration: underline; }
.link-plain { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; font: inherit; font-size: 16px; cursor: pointer; color: var(--text); padding: 0 4px; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; font: inherit; font-size: 17px; cursor: pointer; color: var(--text); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #D9C9FF, #B9A4FB); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }

/* ---------------------------------------------------------- Dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60; max-height: 70vh; overflow: auto; }
.topbar-right .dropdown-menu, .dropdown-right { left: auto; right: 0; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-menu > a, .dropdown-menu > button, .dropdown-menu form button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14.5px; color: var(--text); background: none; border: 0; cursor: pointer; text-align: left; }
.dropdown-menu > a:hover, .dropdown-menu > button:hover, .dropdown-menu form button:hover { background: var(--gray-bg); }
.dropdown-menu a.active { background: var(--primary-soft); color: var(--primary-600); }
.dropdown-menu .danger { color: var(--red); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-wide { width: 360px; }
.notif { display: flex !important; align-items: flex-start !important; gap: 10px; font-size: 13.5px !important; line-height: 1.4; }
.notif small { display: block; color: var(--muted); margin-top: 2px; }
.notif.unread { background: #FAF9FF; }
.notif-ic { flex: 0 0 auto; margin-top: 1px; }
.notif-erreur { color: var(--red); } .notif-succes { color: var(--green); } .notif-info { color: var(--primary); }
.emoji-menu { width: 272px; display: none; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.dropdown.open > .emoji-menu { display: grid; }
.emoji-menu button { font-size: 20px !important; padding: 5px !important; justify-content: center; }

/* ---------------------------------------------------------- Cartes */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card.narrow { max-width: 620px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head.wrap { flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2-1 > div { display: flex; flex-direction: column; gap: 20px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state h2 { color: var(--text); }

/* ---------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1.3; }
.badge-lg { font-size: 15px; padding: 5px 14px; font-weight: 500; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-violet { background: var(--primary-soft); color: var(--primary-600); }
.badge-gray { background: var(--gray-bg); color: var(--muted); }
.trend { font-size: 12.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--gray-bg); color: var(--muted); vertical-align: middle; }
.trend.up { background: var(--green-bg); color: var(--green); }
.trend.down { background: var(--red-bg); color: var(--red); }

/* ---------------------------------------------------------- Alertes */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 12px; font-size: 14.5px; line-height: 1.5; border: 1px solid; }
.alert span { flex: 1; }
.alert svg { flex: 0 0 auto; margin-top: 2px; }
.alert-success { background: var(--green-bg); border-color: #BFE7CD; color: #146C3B; }
.alert-error { background: var(--red-bg); border-color: #F5C2C2; color: #9B1C1C; }
.alert-info { background: var(--blue-bg); border-color: #C7D8FB; color: #1E3A8A; }
.alert-x { background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; padding: 0; }

/* ---------------------------------------------------------- Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=time], input[type=number], textarea, select {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--text); background: #fff; border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 13px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 69, 224, .15); }
input[type=color] { width: 100%; height: 44px; border: 1px solid var(--border-2); border-radius: 10px; padding: 4px; background: #fff; }
input[type=file] { font-size: 14px; font-weight: 400; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.check { flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 500 !important; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.select-wrap { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; height: 44px; padding-left: 12px; gap: 8px; }
.select-wrap select { border: 0; box-shadow: none !important; appearance: none; -webkit-appearance: none; padding: 0 36px 0 0; height: 100%; background: transparent; cursor: pointer; font-size: 15.5px; }
.select-wrap > svg:last-child { position: absolute; right: 10px; pointer-events: none; color: var(--text); }
.select-wrap > svg:first-child { flex: 0 0 auto; }
.select-wrap.sm { height: 38px; }
.select-wrap.sm select { font-size: 14px; }
.form .select-wrap { width: 100%; }
.form .select-wrap select { width: 100%; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 10px; padding: 0 12px; height: 38px; background: #fff; color: var(--muted); }
.search input { border: 0; padding: 0; height: 100%; box-shadow: none !important; width: 180px; font-size: 14px; }
.dropzone { border: 2px dashed var(--primary-border); border-radius: 12px; padding: 26px; text-align: center; align-items: center !important; cursor: pointer; color: var(--primary); background: #FBFAFF; }
.dropzone input { margin-top: 8px; }
.switch { width: 44px; height: 24px; border-radius: 20px; background: #D5D8E2; border: 0; position: relative; cursor: pointer; padding: 0; transition: background .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: #22B35E; }
.switch.on span { left: 23px; }

/* ---------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 600; font-size: 14px; padding: 11px 14px; background: #F6F7FB; color: var(--text); }
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.empty-row { text-align: center; color: var(--muted); padding: 34px !important; }
.pub-cell { display: flex; align-items: center; gap: 18px; }
.pub-text { font-size: 15px; }
.thumb { width: 76px; height: 46px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; background: var(--gray-bg); color: var(--muted); overflow: hidden; position: relative; }
.thumb-video video { width: 100%; height: 100%; object-fit: cover; }
.thumb-video svg { position: absolute; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.net-icons { display: inline-flex; gap: 8px; align-items: center; }
.net-ic { position: relative; display: inline-flex; }
.net-ic.st-en_attente, .net-ic.st-supprime { opacity: .45; }
.net-err { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); color: #fff; font-size: 10px; font-style: normal; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.actions { display: flex; justify-content: flex-end; gap: 6px; }
.actions .icon-btn { color: #5C6075; }
.actions .icon-btn.danger { color: var(--red); }
.proj-chip { font-size: 13px; font-weight: 600; background: var(--gray-bg); padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pagination a { min-width: 36px; height: 36px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: 14px; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------------------------------------------------- En-tête projet */
.project-logo { border-radius: 12px; object-fit: cover; flex: 0 0 auto; background: #1F2455; }
.project-logo-text { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; letter-spacing: .02em; }
.project-head { display: flex; align-items: center; gap: 24px; padding: 18px 22px; flex-wrap: wrap; }
.project-head .project-logo { border-radius: 14px; }
.ph-title { display: flex; align-items: center; gap: 22px; flex: 1; min-width: 220px; flex-wrap: wrap; }
.ph-title h1 { font-size: 32px; }
.ph-networks { display: flex; align-items: center; gap: 18px; font-size: 17px; }
.ph-net { position: relative; display: inline-flex; transition: transform .15s; }
.ph-net:hover { transform: translateY(-2px); }
.ph-net.off { opacity: .35; filter: grayscale(1); }
.ph-check { position: absolute; right: -5px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: #22B35E; color: #fff; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 800; }
.ph-net.off .ph-check { background: #9CA0B3; }
.ph-net.warn .ph-check { background: var(--orange); }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; margin-top: -4px; padding-bottom: 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 12px; padding: 13px 26px; font-size: 18px; color: var(--text); border-radius: 10px 10px 0 0; white-space: nowrap; position: relative; }
.tab:hover { background: rgba(91, 69, 224, .05); }
.tab.active { background: var(--primary); color: #fff; border-radius: 10px; padding: 11px 38px; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 3px; background: var(--primary); border-radius: 3px; }

/* ---------------------------------------------------------- Compositeur */
.composer-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); gap: 18px; }
.composer-grid .publish-bar { grid-column: 1 / -1; }
.composer .card-head { margin-bottom: 14px; }
.composer-body { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; }
.composer-right { border-left: 1px solid var(--border); padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.composer-right h3 { font-size: 17px; margin-bottom: 4px; }
.editor { position: relative; border: 1px solid var(--border-2); border-radius: 10px; background: #fff; }
.editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 69, 224, .12); }
.editor textarea { border: 0 !important; box-shadow: none !important; min-height: 128px; padding: 14px 16px 30px; font-size: 16px; resize: vertical; }
.counter { position: absolute; right: 12px; bottom: 9px; font-size: 13.5px; color: var(--muted); }
.counter.over { color: var(--red); font-weight: 700; }
.toolbar { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border: 1px solid var(--border-2); border-radius: 9px; background: #fff; font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; color: var(--text); }
.tool:hover { border-color: var(--primary); color: var(--primary); }
.tool-ic { width: 40px; padding: 0; justify-content: center; }
.media-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.media-tile { position: relative; width: 150px; height: 90px; border-radius: 8px; overflow: hidden; background: var(--gray-bg); }
.media-tile.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%235B45E0' stroke-width='5' stroke-dasharray='90 40'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center no-repeat; }
.media-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .thumb-video, .media-tile .thumb-empty { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.media-tile video { width: 100%; height: 100%; object-fit: cover; }
.media-x { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%; background: #2B2D3E; color: #fff; border: 2px solid #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.media-add { width: 140px; height: 90px; border: 1.5px dashed #B8BCCB; border-radius: 8px; background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit; font-size: 15px; color: var(--text); }
.media-add:hover { border-color: var(--primary); color: var(--primary); }
.net-check { display: flex; align-items: center; gap: 12px; padding: 7px 0; cursor: pointer; font-size: 17px; }
.net-check input { position: absolute; opacity: 0; pointer-events: none; }
.net-check .box { width: 24px; height: 24px; border-radius: 5px; border: 1.5px solid #B8BCCB; display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: 0 0 auto; transition: all .15s; background: #fff; }
.net-check input:checked + .box { background: var(--primary); border-color: var(--primary); color: #fff; }
.net-check input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(91, 69, 224, .25); }
.net-check.disabled { cursor: default; }
.net-check.disabled > svg, .net-check.disabled .box { opacity: .4; }
.net-name { line-height: 1.25; }
.net-name small { font-size: 12px; }
.connect-link { font-size: 12.5px; color: var(--primary); font-weight: 600; display: block; }

.preview-head { margin-bottom: 14px; }
.preview-nav { display: flex; align-items: center; gap: 6px; }
.select-net { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-2); border-radius: 10px; height: 42px; padding: 0 12px; min-width: 165px; }
.select-net select { border: 0; appearance: none; -webkit-appearance: none; padding: 0 22px 0 0; background: transparent; font-size: 16px; box-shadow: none !important; cursor: pointer; }
.select-net > svg { position: absolute; right: 10px; pointer-events: none; }
.select-net #previewIcon { display: inline-flex; }
.preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.pv-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: #1F2455; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.pv-name { font-weight: 700; font-size: 15px; display: block; }
.pv-meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.pv-more { margin-left: auto; color: var(--muted); }
.pv-text { padding: 0 14px 12px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.pv-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.pv-text .tag { color: #1D4ED8; }
.pv-media { position: relative; background: #F1F2F6; }
.pv-media img, .pv-media video { width: 100%; display: block; max-height: 340px; object-fit: cover; }
.pv-media .pv-count { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 10px; }
.pv-empty-media { height: 170px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; flex-direction: column; gap: 6px; }
.pv-actions { display: flex; justify-content: space-around; padding: 10px; border-top: 1px solid var(--border); color: #5C6075; font-size: 14px; }
.pv-actions span { display: inline-flex; align-items: center; gap: 7px; }
.pv-ig .pv-media img, .pv-ig .pv-media video { aspect-ratio: 1/1; max-height: none; }
.pv-ig .pv-actions { justify-content: flex-start; gap: 16px; border: 0; padding: 10px 14px 4px; }
.pv-ig .pv-text { padding-top: 4px; }
.pv-tt { background: #111; color: #fff; position: relative; aspect-ratio: 9/14; max-height: 470px; margin: 0 auto; width: 100%; }
.pv-tt .pv-media { position: absolute; inset: 0; background: #222; }
.pv-tt .pv-media img, .pv-tt .pv-media video { height: 100%; max-height: none; }
.pv-tt-over { position: absolute; left: 0; right: 54px; bottom: 0; padding: 14px; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-size: 14px; }
.pv-tt-over .pv-text { padding: 4px 0 0; font-size: 14px; }
.pv-tt-side { position: absolute; right: 8px; bottom: 70px; display: flex; flex-direction: column; gap: 18px; align-items: center; font-size: 11px; }
.pv-tt-side span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pv-warn { padding: 10px 14px; font-size: 13px; background: var(--orange-bg); color: #8A4B05; display: flex; gap: 8px; align-items: center; }
.pv-tt .pv-warn { position: absolute; top: 0; left: 0; right: 0; z-index: 2; }

.publish-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; flex-wrap: wrap; }
.pb-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pb-left input[type=date] { width: 160px; height: 44px; }
.pb-left input[type=time] { width: 110px; height: 44px; }
.pb-left.is-now input[type=date], .pb-left.is-now input[type=time] { opacity: .6; }
.pb-right { display: flex; gap: 14px; flex-wrap: wrap; }
.pb-right .btn { height: 46px; font-size: 16px; padding: 0 24px; }
#publishBtn { min-width: 236px; }

/* ---------------------------------------------------------- Médiathèque */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; max-height: 60vh; overflow: auto; }
.library-grid.small { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); margin-top: 14px; }
.lib-item { border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; text-align: left; }
.lib-item:hover { border-color: var(--primary); }
.lib-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: var(--gray-bg); position: relative; overflow: hidden; }
.lib-img video { width: 100%; height: 100%; object-fit: cover; }
.lib-item small { font-size: 12px; color: var(--muted); }
.media-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.folders { display: flex; flex-direction: column; gap: 4px; }
.folders h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 6px; }
.folders h3:not(:first-child) { margin-top: 18px; }
.folders > a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 14.5px; }
.folders > a span { margin-left: auto; font-size: 12.5px; }
.folders > a:hover { background: var(--gray-bg); }
.folders > a.active { background: var(--primary-soft); color: var(--primary-600); font-weight: 600; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.media-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.mc-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: flex; align-items: center; justify-content: center; background: var(--gray-bg); position: relative; }
.mc-img video { width: 100%; height: 100%; object-fit: cover; }
.mc-body { padding: 10px 12px 4px; font-size: 14px; }
.mc-body small { display: block; font-size: 12px; margin-top: 2px; }
.mc-actions { display: flex; align-items: center; gap: 4px; padding: 6px 8px 10px 12px; }
.mc-move { display: flex; flex: 1; gap: 2px; }
.mc-move input { height: 32px; padding: 4px 8px; font-size: 13px; }

/* ---------------------------------------------------------- Calendrier */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h3 { font-size: 20px; min-width: 170px; text-align: center; }
.cal-legend { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal-dow { background: #F6F7FB; padding: 10px; font-size: 13px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #FAFAFC; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-num { font-size: 13px; font-weight: 600; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-ev { display: flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 6px; border-radius: 6px; overflow: hidden; white-space: nowrap; }
.cal-ev span { overflow: hidden; text-overflow: ellipsis; }
.ev-violet { background: var(--primary-soft); color: var(--primary-600); }
.ev-green { background: var(--green-bg); color: #146C3B; }
.ev-gray { background: var(--gray-bg); color: var(--muted); }
.ev-red { background: var(--red-bg); color: var(--red); }
.ev-orange { background: var(--orange-bg); color: var(--orange); }
.ev-blue { background: var(--blue-bg); color: var(--blue); }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 4px; }

/* ---------------------------------------------------------- KPI / stats */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.kpi strong { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.kpi span:not(.trend) { font-size: 13.5px; color: var(--muted); }
.kpi-ic { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ic-violet { background: var(--primary-soft); color: var(--primary); }
.ic-blue { background: var(--blue-bg); color: var(--blue); }
.ic-orange { background: var(--orange-bg); color: var(--orange); }
.ic-green { background: var(--green-bg); color: var(--green); }
.chart-box { height: 210px; }
.sparkline { width: 100%; height: 100%; display: block; }
.mini-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.mini-stats span { font-size: 12.5px; color: var(--muted); display: block; }
.mini-stats strong { font-size: 18px; }
.stats-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stats-actions { display: flex; gap: 8px; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg a.active { background: var(--primary); color: #fff; }
.net-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.net-stat { padding: 18px; }
.net-stat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.net-stat-head strong { font-size: 22px; display: block; }
.net-stat-head span { font-size: 13px; }
.net-stat dl { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.net-stat dl div { display: flex; justify-content: space-between; font-size: 14px; }
.net-stat dt { color: var(--muted); }
.net-stat dd { margin: 0; font-weight: 600; }
.upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upcoming a { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: 10px; }
.upcoming a:hover { background: var(--gray-bg); }
.up-date { width: 48px; height: 50px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-600); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11.5px; flex: 0 0 auto; }
.up-date b { font-size: 18px; line-height: 1; }
.up-body { flex: 1; min-width: 0; }
.up-body strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.up-body small { color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------- Projets */
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-row { display: flex; align-items: center; gap: 22px; padding: 16px 20px; flex-wrap: wrap; }
.project-row-main { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 260px; }
.project-row-main strong { font-size: 17px; display: block; }
.project-row-main small { font-size: 13px; }
.project-row-nets { display: flex; gap: 8px; }
.net-state.off { opacity: .25; filter: grayscale(1); }
.project-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.project-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.project-tile:hover { border-color: var(--primary-border); background: #FCFBFF; }
.project-tile > span:nth-child(2) { flex: 1; min-width: 0; }
.project-tile strong { display: block; }
.project-tile small { color: var(--muted); font-size: 13px; }
.h-with-logo { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------- Connexions */
.connect-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.connect-card { border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.connect-card.is-on { border-color: #BFE7CD; background: #FBFEFC; }
.cc-head { display: flex; align-items: center; gap: 14px; }
.cc-head strong { font-size: 18px; display: block; margin-bottom: 4px; }
.cc-head .badge { margin-right: 4px; }
.connect-card p { margin: 0; font-size: 14px; }
.cc-account { display: flex; align-items: center; gap: 10px; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.cc-account img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.cc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; align-items: center; }
.pick-account { flex-direction: row !important; align-items: center; gap: 14px !important; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.pick-account:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pick-account img { width: 40px; height: 40px; border-radius: 50%; }
.pick-account input { accent-color: var(--primary); width: 18px; height: 18px; }

/* ---------------------------------------------------------- Équipe / divers */
.member { display: flex; align-items: center; gap: 12px; }
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.member-list li { display: flex; align-items: center; gap: 12px; }
.member-list li > span:nth-child(2) { flex: 1; min-width: 0; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.security-list { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--green); }
.security-list li { display: flex; align-items: center; gap: 8px; }
.tpl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tpl-list li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tpl-list li > div { flex: 1; min-width: 0; }
.target-list { display: flex; flex-direction: column; gap: 14px; }
.target { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.target-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.target-head .link { margin-left: auto; }
.target-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 12px 0 8px; }
.target-stats span { display: block; font-size: 12px; color: var(--muted); }
.target-stats strong { font-size: 17px; }
.pub-content { font-size: 15.5px; line-height: 1.6; white-space: normal; word-break: break-word; }
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.step { position: relative; padding-top: 26px; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.step p { font-size: 14px; margin: 6px 0 0; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p, .faq details ul { color: #3C4053; line-height: 1.6; font-size: 14.5px; }
.faq h2 { margin-bottom: 6px; }

/* ---------------------------------------------------------- Modales / toasts */
.modal { position: fixed; inset: 0; background: rgba(20, 22, 50, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto; }
.modal-box.modal-lg { max-width: 860px; }
.modal-box h3 { font-size: 19px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.remote-opt { margin-top: 12px; font-size: 14px !important; display: flex; }
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: #1F2455; color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 360px; animation: tin .2s ease-out; }
.toast.error { background: var(--red); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ---------------------------------------------------------- Authentification */
.auth-body { background: linear-gradient(135deg, #1F2455 0%, #2E2A78 55%, #5B45E0 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; max-width: 1180px; margin: 0 auto; padding: 30px; gap: 50px; }
.auth-side { color: #E4E3FA; }
.auth-side .brand { padding-left: 0; }
.auth-side h2 { color: #fff; font-size: 40px; line-height: 1.15; font-weight: 800; margin: 20px 0 16px; }
.auth-side p { font-size: 17px; line-height: 1.6; max-width: 470px; opacity: .85; }
.auth-networks { display: flex; gap: 14px; margin-top: 28px; }
.auth-card { background: #fff; border-radius: 20px; padding: 36px; box-shadow: 0 30px 80px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { font-size: 28px; }
.auth-card > p { margin: 0 0 8px; }
.auth-switch { text-align: center; color: var(--muted); margin: 10px 0 0; }
.auth-switch a { color: var(--primary); font-weight: 600; }

/* ---------------------------------------------------------- Pages publiques (légal) */
.public-body { background: var(--bg); }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; background: linear-gradient(90deg, var(--sidebar), var(--sidebar-2)); flex-wrap: wrap; }
.public-top .brand { padding: 0; font-size: 22px; }
.public-top nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.public-top nav a:not(.btn) { color: var(--sidebar-text); font-size: 14.5px; }
.public-top nav a:not(.btn):hover { color: #fff; }
.legal { max-width: 860px; margin: 32px auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 48px; line-height: 1.7; font-size: 15.5px; color: #2A2D40; }
.legal h1 { font-size: 32px; margin-bottom: 4px; }
.legal h2 { font-size: 20px; margin: 30px 0 8px; color: var(--text); }
.legal h3 { font-size: 16px; margin: 18px 0 4px; }
.legal a { color: var(--primary); text-decoration: underline; }
.legal ul, .legal ol { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal-table { margin: 10px 0; }
.legal-table td { font-size: 14.5px; }
.public-foot { text-align: center; color: var(--muted); font-size: 13.5px; padding: 10px 16px 30px; }
.public-foot a { color: inherit; text-decoration: underline; }
.auth-body .public-foot { color: rgba(255, 255, 255, .7); margin-top: -40px; }
.danger-zone { border-color: #F3C7C7; }
.danger-zone h2 { color: var(--red); }

/* ---------------------------------------------------------- Responsive */
@media (max-width: 1360px) {
  .composer-grid { grid-template-columns: 1fr; }
  .preview-card .preview { max-width: 480px; }
  .net-stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-2-1, .grid-2 { grid-template-columns: 1fr; }
  .tab { padding: 11px 16px; font-size: 16px; }
  .tab.active { padding: 10px 22px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .burger { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .crumbs { font-size: 17px; }
  .crumbs .crumb, .crumbs .crumb-sep { display: none; }
  .user-name { display: none; }
  .content { padding: 16px 14px 30px; }
  .composer-body { grid-template-columns: 1fr; }
  .composer-right { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }
  .connect-grid { grid-template-columns: 1fr; }
  .media-layout { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; gap: 20px; }
  .auth-side h2 { font-size: 28px; }
  .auth-side p { display: none; }
  .mini-stats { grid-template-columns: repeat(3, 1fr); }
  .target-stats { grid-template-columns: repeat(3, 1fr); }
  .ph-title h1 { font-size: 24px; }
  .project-head .project-logo { width: 64px !important; height: 64px !important; }
  .dropdown-wide { width: 300px; }
}
@media (max-width: 600px) {
  .net-stats, .kpis, .steps { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .publish-bar, .pb-right { flex-direction: column; align-items: stretch; }
  .pb-right .btn, #publishBtn { width: 100%; min-width: 0; }
  .calendar { font-size: 11px; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-ev span { display: none; }
  .search input { width: 120px; }
  .legal { margin: 0; border-radius: 0; padding: 24px 18px; }
  .public-top { padding: 12px 16px; }
}
