/* Contenus Archipel — mobile d'abord (390 px), utilisable sur ordinateur. */
:root {
  --cream: #FFF8EC;
  --navy: #0F2832;
  --navy-soft: #4A5D66;
  --sand: #F3E2B8;
  --white: #FFFFFF;
  --teal: #11778E;
  --teal-soft: #D6EEF1;
  --yellow: #FFC53D;
  --yellow-soft: #FFEDBF;
  --coral: #F26B4F;
  --coral-soft: #FDE3DA;
  --coral-text: #A3341C;
  --line: 1.5px solid var(--navy);
  --shadow: 3px 3px 0 var(--navy);
  --radius: 14px;
  --tabbar: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--navy);
  font: 400 16px/1.45 'Albert Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3, .title { font-family: 'Fredoka', 'Albert Sans', sans-serif; font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
a { color: var(--teal); }
p { margin: 0 0 8px; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { font-size: 16px; } /* pas de zoom iOS */
.muted { color: var(--navy-soft); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- structure ---------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(var(--tabbar) + var(--safe-bottom) + 24px);
}
.page.with-actions { padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 96px); }
.page.chat-page { padding-bottom: calc(var(--safe-bottom) + 170px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.topbar h1 { flex: 1; }
.back {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
  margin-left: -10px; color: var(--navy); text-decoration: none; border-radius: 12px;
}
.back svg { width: 24px; height: 24px; }
.stack > * + * { margin-top: 14px; }

/* ---------- barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  background: var(--cream); border-top: var(--line);
  padding-bottom: var(--safe-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 720px; }
.tabbar a {
  flex: 1; min-height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; font-weight: 600; color: var(--navy-soft); text-decoration: none;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--teal); }
.tabbar a.active svg { stroke-width: 2.4; }

/* ---------- cartes ---------- */
.card {
  background: var(--white); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px;
}
.card.sand { background: var(--sand); }
.card.flat { box-shadow: none; }
.card h2 { margin-bottom: 10px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: var(--line); border-radius: 12px; box-shadow: var(--shadow);
  background: var(--white); color: var(--navy); font-weight: 700; font-size: 16px; text-decoration: none;
  cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--teal); color: var(--white); }
.btn.yellow { background: var(--yellow); }
.btn.refuse { background: var(--coral-soft); color: var(--coral-text); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }
.linkbtn { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--teal); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* ---------- formulaires ---------- */
label.field { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 12px; border: var(--line); border-radius: 12px; background: var(--white);
}
.input:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
textarea.input { resize: none; line-height: 1.4; }
.form-row { display: flex; gap: 10px; align-items: stretch; }
.form-row .input { flex: 1; min-width: 0; }
.check {
  display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer;
}
.check input { width: 22px; height: 22px; accent-color: var(--teal); flex: none; }

/* ---------- pastilles ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: var(--line); border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--white);
}
.pill svg { width: 14px; height: 14px; }
.pill.pending { background: var(--yellow); }
.pill.approved { background: var(--teal-soft); color: var(--navy); }
.pill.scheduled { background: var(--sand); }
.pill.published { background: var(--teal); color: var(--white); }
.pill.failed { background: var(--coral-soft); color: var(--coral-text); }
.pill.refused { background: #E6E3DC; color: var(--navy-soft); }
.pill.embargo { background: var(--navy); color: var(--cream); }
.pill.type { background: var(--cream); }
.tag { font-size: 13px; font-weight: 700; color: var(--navy-soft); }

/* ---------- indicateur Mac ---------- */
.mac { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 6px 11px; border: var(--line); border-radius: 999px; background: var(--white); white-space: nowrap; }
.mac .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); border: 1.5px solid var(--navy); }
.mac.on .dot { background: #34B37A; }

/* ---------- filtres ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: var(--line); border-radius: 999px;
  background: var(--white); color: var(--navy); font-weight: 700; font-size: 15px; text-decoration: none;
}
.filters a.active { background: var(--navy); color: var(--cream); }
.filters .count { margin-left: 6px; font-weight: 600; opacity: .7; }

/* ---------- liste des propositions ---------- */
.plist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 700px) { .plist { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pcard { display: flex; gap: 12px; padding: 12px; color: inherit; text-decoration: none; }
.pcard:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }
.thumb {
  flex: none; width: 84px; height: 105px; border: var(--line); border-radius: 10px; overflow: hidden; background: var(--sand);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; right: 4px; bottom: 4px; background: var(--navy); color: var(--cream); border-radius: 6px; padding: 1px 5px; font-size: 11px; font-weight: 700;
}
.thumb svg { width: 30px; height: 30px; color: var(--navy-soft); }
.pbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.pmeta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.phook { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pfoot { display: flex; align-items: center; gap: 12px; margin-top: auto; font-size: 13px; color: var(--navy-soft); font-weight: 600; }
.pfoot span { display: inline-flex; align-items: center; gap: 4px; }
.pfoot svg { width: 16px; height: 16px; }

.empty { text-align: center; padding: 32px 16px; }
.empty svg { width: 56px; height: 56px; margin: 0 auto 10px; color: var(--teal); }

/* ---------- détail : aperçu ---------- */
.preview { border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: var(--navy); }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; background: var(--navy); aspect-ratio: 4 / 5; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: contain; }
.reel-player { width: 100%; max-height: 72vh; aspect-ratio: 9 / 16; background: #000; }
.dots { display: flex; justify-content: center; gap: 7px; padding: 10px 0 2px; }
.dots span { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--navy); background: var(--white); }
.dots span.on { background: var(--navy); }
.slide-count { text-align: center; font-size: 13px; font-weight: 600; color: var(--navy-soft); }
.purged { aspect-ratio: 4 / 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--cream); padding: 20px; text-align: center; }

.versions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.versions a {
  flex: none; min-width: 52px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  border: var(--line); border-radius: 10px; background: var(--white); color: var(--navy); text-decoration: none; font-weight: 700;
}
.versions a.on { background: var(--navy); color: var(--cream); }
.versions a .cur { font-size: 11px; font-weight: 600; margin-left: 5px; opacity: .8; }

.notice { border: var(--line); border-radius: 12px; padding: 10px 12px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.notice.embargo { background: var(--navy); color: var(--cream); }
.notice.warn { background: var(--yellow-soft); }
.notice.error { background: var(--coral-soft); color: var(--coral-text); }
.notice.ok { background: var(--teal-soft); }

.caption { white-space: pre-wrap; overflow-wrap: anywhere; }
.hashtags { color: var(--teal); font-weight: 600; overflow-wrap: anywhere; margin-top: 8px; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed rgba(15, 40, 50, .25); }
.checks li:first-child { border-top: 0; padding-top: 0; }
.checks .lvl { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 74px; height: 24px; border: var(--line); border-radius: 999px; font-size: 12px; font-weight: 700; }
.checks .lvl.ok { background: var(--teal-soft); }
.checks .lvl.warning { background: var(--yellow); }

.approvers { list-style: none; margin: 0; padding: 0; }
.approvers li { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-top: 1px dashed rgba(15, 40, 50, .25); }
.approvers li:first-child { border-top: 0; }
.approvers .state { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.approvers .state svg { width: 18px; height: 18px; }
.approvers .done { color: var(--teal); }
.approvers .wait { color: var(--navy-soft); }

.actions {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + var(--safe-bottom)); z-index: 25;
  background: var(--cream); border-top: var(--line); padding: 10px 16px;
}
.actions-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 12px; }
.actions .btn { flex: 1; }
.actions .btn.primary { flex: 1.6; }

.chatlink { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.chatlink svg { width: 26px; height: 26px; flex: none; color: var(--teal); }
.chatlink .chev { margin-left: auto; width: 20px; height: 20px; color: var(--navy); }

/* ---------- chat ---------- */
.msgs { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; display: flex; flex-direction: column; gap: 3px; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--navy-soft); padding: 0 4px; }
.msg .bubble { border: var(--line); border-radius: 14px; padding: 9px 12px; background: var(--white); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { background: var(--teal-soft); border-bottom-right-radius: 4px; }
.msg.other .bubble { border-bottom-left-radius: 4px; }
.msg.agent .bubble { background: var(--sand); border-bottom-left-radius: 4px; }
.vcard { display: flex; gap: 10px; align-items: center; margin-top: 6px; padding: 8px; border: var(--line); border-radius: 12px; box-shadow: var(--shadow); background: var(--white); color: inherit; text-decoration: none; min-height: 44px; }
.vcard .thumb { width: 52px; height: 65px; border-radius: 8px; }
.vcard b { font-family: 'Fredoka', sans-serif; font-weight: 600; }
.working { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border: var(--line); border-radius: 14px; background: var(--yellow-soft); font-weight: 600; font-size: 14px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--navy); border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--cream); border-top: var(--line);
  padding: 10px 16px calc(10px + var(--safe-bottom));
}
.composer-inner { max-width: 720px; margin: 0 auto; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px 4px; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; min-height: 44px; padding: 0 14px; border: var(--line); border-radius: 999px; background: var(--white); font-weight: 700; font-size: 14px; cursor: pointer; }
.quick button:active { background: var(--yellow); }
.composer .form-row textarea { min-height: 48px; max-height: 140px; }
.composer .btn { min-width: 48px; padding: 0 14px; }

/* ---------- planning ---------- */
.section-title { display: flex; align-items: center; gap: 8px; margin: 24px 0 10px; }
.section-title svg { width: 20px; height: 20px; }
.section-title .n { font-family: 'Albert Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--navy-soft); }
.rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px; color: inherit; text-decoration: none; }
.row .thumb { width: 56px; height: 70px; border-radius: 8px; }
.row .rbody { flex: 1; min-width: 0; }
.row .rhook { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rsub { font-size: 13px; color: var(--navy-soft); font-weight: 600; }
.row.locked { background: var(--sand); }
.row .err { font-size: 13px; color: var(--coral-text); font-weight: 600; margin-top: 3px; }
.ig-status { display: flex; align-items: center; gap: 10px; }
.ig-status .dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--navy); background: var(--coral); flex: none; }
.ig-status.on .dot { background: #34B37A; }

/* ---------- réglages ---------- */
.prod { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px dashed rgba(15, 40, 50, .25); }
.prod:first-of-type { border-top: 0; }
.prod .pname { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.prod .pname svg { width: 16px; height: 16px; }
.prod .sub { font-size: 13px; color: var(--navy-soft); font-weight: 600; }

/* ---------- toasts / flash ---------- */
.flash { margin-bottom: 14px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-bottom) + 90px); transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--cream); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- connexion ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: 24px 16px; }
.login .logo { width: 84px; height: 84px; border: var(--line); border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.login h1 { margin-bottom: 6px; }

@media (hover: hover) {
  .btn:hover { filter: brightness(1.04); }
  .pcard:hover, .row:hover { background: #FFFDF8; }
}
