/* ============================================================================
   Comm — cockpit studio de contenu Dentego
   Design system. Identité : "console éditoriale clinique" — bleu Dentego,
   métadonnées en monospace, rail de pipeline comme motif signature.
   ============================================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Charte officielle Dentego : bleu primaire + corail (accent chaud) + surfaces cliniques.
     Réfs : docs/brand-charte.md (valeurs PANTONE exactes). */
  --ink:        #0A2540;   /* texte principal, navy profond */
  --ink-soft:   #3B5273;
  --muted:      #6B7C96;
  --dentego:    #005FA0;   /* bleu primaire — PANTONE 2384C (logotype, plateformes pro) */
  --dentego-deep:#00436F;  /* bleu foncé — hover/texte AA sur clair */
  --dentego-tint:#E1EDF7;
  --dentego-bright:#0091FF;/* bleu vif — le « = » du logo, PANTONE 2192C */

  /* Corail Dentego — accent chaud (charte, PANTONE 2345C) */
  --accent:      #FF7864;  /* corail — accent de marque, statuts chauds */
  --accent-deep: #B23A28;  /* corail foncé — texte/hover AA sur clair */
  --accent-tint: #FFE7E1;

  /* Secondaires charte (disponibles ; jamais utilisés pour les statuts) */
  --cyan:  #00D2FF;  /* PANTONE 311C  */
  --teal:  #00DCB4;  /* PANTONE 3385C */
  --beige: #E6BE6E;  /* PANTONE 7508C */

  --bg:         #EAF1FA;   /* fond cockpit, bleuté clinique */
  --surface:    #FFFFFF;
  --surface-2:  #F5F9FE;
  --line:       #D5E1F1;
  --line-soft:  #E7EEF7;

  /* Couleurs de campagne (4) — distinctes, jeu catégoriel */
  --c-patient:      #005FA0;  /* Dentego patient  — bleu primaire */
  --c-recrutement:  #FF7864;  /* recrutement      — corail (charte) */
  --c-linkedin:     #6C4CE0;  /* corporate        — violet */
  --c-livre:        #D6336C;  /* livre de Laura   — framboise */

  /* Sémantique statut / pipeline — vivid (marque) + ink (texte AA sur clair).
     Jeu catégoriel : gris → bleu → magenta → corail → indigo → vert. Sans teal. */
  --st-idee:     #64748B;  --st-idee-ink:     #475569;
  --st-script:   #2E6BE6;  --st-script-ink:   #1D53C4;
  --st-visuel:   #C026D3;  --st-visuel-ink:   #A21CAF;
  --st-avalider: #FF7864;  --st-avalider-ink: #B23A28;
  --st-planifie: #4F46E5;  --st-planifie-ink: #4338CA;
  --st-publie:   #16A34A;  --st-publie-ink:   #15803D;
  --st-archive:  #94A3B8;  --st-archive-ink:  #64748B;

  /* Plateformes (pastilles) */
  --pf-instagram: #D62976;
  --pf-tiktok:    #111827;
  --pf-facebook:  #1466D6;
  --pf-linkedin:  #0A66C2;

  --ok:    #16A34A;
  --warn:  #C77714;
  --danger:#D64550;

  --radius:   14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(10,37,64,.06), 0 1px 3px rgba(10,37,64,.05);
  --shadow-2: 0 6px 20px rgba(10,37,64,.10), 0 2px 6px rgba(10,37,64,.06);
  --shadow-3: 0 18px 50px rgba(10,37,64,.22);

  /* Campton = police de marque (commerciale → pas d'@font-face externe/CSP) ;
     Century Gothic = repli charte ; puis fallbacks géométriques. Voir docs/ux-cockpit.md. */
  --sans: "Campton", "Century Gothic", "Futura", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, "Consolas", monospace;

  --topbar-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:#EAF1FB; --ink-soft:#B7C6DD; --muted:#8195B0;
    --bg:#0A1626; --surface:#101F35; --surface-2:#152845;
    --line:#20355A; --line-soft:#1A2C4B; --dentego-tint:#0E2A47;
    --accent-tint:#3A211B; --accent-deep:#FF9C8C;
    --shadow-1:0 1px 2px rgba(0,0,0,.4);
    --shadow-2:0 8px 24px rgba(0,0,0,.5);
    --shadow-3:0 20px 60px rgba(0,0,0,.6);
    /* Textes de statut lisibles sur badges teintés en sombre */
    --st-idee-ink:#94A3B8; --st-script-ink:#7FA8F5; --st-visuel-ink:#E77BEA;
    --st-avalider-ink:#FF9C8C; --st-planifie-ink:#A5A0F0; --st-publie-ink:#5CD08A;
    --st-archive-ink:#94A3B8;
    --pf-tiktok:#E5E7EB;
  }
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { height: 100%; color-scheme: light dark; }
body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
h1,h2,h3,h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
button { font-family: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Lien d'évitement clavier */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--dentego); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-weight: 650; transition: top .15s;
}
.skip-link:focus { top: 12px; }
a { color: var(--dentego); }
[hidden] { display: none !important; }

/* Focus visible — accessibilité clavier */
:focus-visible {
  outline: 3px solid var(--dentego);
  outline-offset: 2px;
  border-radius: 6px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.visually-hidden {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ============================================================================
   LOGIN
   ============================================================================ */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-brandside {
  position: relative;
  background:
    radial-gradient(120% 90% at 12% 8%, #1B78EE 0%, var(--dentego) 42%, var(--dentego-deep) 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-brandside::after {
  /* trame de "sourires" discrète en filigrane */
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at center, rgba(255,255,255,.10) 0 2px, transparent 2px);
  background-size: 26px 26px;
  opacity: .5;
  mask-image: linear-gradient(160deg, transparent 30%, #000 100%);
}
.login-brandside > * { position: relative; z-index: 1; }
.login-logo { display:flex; align-items:center; gap:14px; }
.login-logo img {
  width: 54px; height: 54px; border-radius: 14px; object-fit: cover;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.35);
}
.login-logo .wordmark { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.login-logo .wordmark small { display:block; font-size:11px; font-weight:600; opacity:.85; letter-spacing:.02em; }
.login-hero { position: relative; padding-right: 220px; }
.login-hero h1 { font-size: clamp(28px, 3vw, 42px); font-weight: 800; max-width: 14ch; }
.login-hero p { font-size: 17px; max-width: 34ch; opacity: .92; margin-top: 18px; }
.login-hero .mascot {
  position:absolute; right: 0; bottom: -6px; width: 200px; opacity:.98;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.35));
  border-radius: 22px; border: 3px solid rgba(255,255,255,.35);
}
.login-foot { font-family: var(--mono); font-size: 12px; opacity: .8; }

.login-formside {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; background: var(--surface);
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; }
.login-card .sub { color: var(--muted); margin: 8px 0 28px; }
.field { margin-bottom: 16px; }
.field label { display:block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); transition: border-color .15s, background .15s;
}
.field input:focus { border-color: var(--dentego); background: var(--surface); }
.field .hint { font-size:12px; color: var(--muted); margin-top: 6px; }
.login-error {
  background: #FDECEE; color: #97202B; border: 1px solid #F5C2C7;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px;
}
.demo-banner {
  display:flex; gap:10px; align-items:flex-start;
  background: var(--dentego-tint); border: 1px solid var(--line);
  color: var(--dentego-deep); padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 20px;
}

.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 18px; font-size: 15px; font-weight: 650; letter-spacing:-.01em;
  transition: transform .06s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--dentego); color: #fff; box-shadow: var(--shadow-1); }
.btn--primary:hover { background: var(--dentego-deep); }
.btn--full { width: 100%; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--dentego); }
.btn--subtle { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn--subtle:hover { border-color: var(--dentego); }
.btn--accent { background: var(--accent); color: #45140C; box-shadow: var(--shadow-1); font-weight: 750; }
.btn--accent:hover { background: #F0654F; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn .spin { width:15px; height:15px; border:2px solid rgba(255,255,255,.5); border-top-color:#fff; border-radius:50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   COCKPIT SHELL
   ============================================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== Calage de la coquille transverse Atlas Shell (overlay Option A) =====
   La coquille préfixe au <body> son en-tête sobre (hauteur --a-h-h = 58px),
   sticky top:0, au-dessus de tout. On décale la chrome propre à Comm pour
   qu'elle vive SOUS cet en-tête (une seule chrome cohérente, pas de double).
   Actif uniquement quand la coquille est montée (body.atlas-on). */
body.atlas-on { --atlas-h: 58px; }
body.atlas-on .app-shell { min-height: calc(100vh - var(--atlas-h)); }
body.atlas-on .topbar { top: var(--atlas-h); }         /* sticky sous l'en-tête */
body.atlas-on .drawer { top: var(--atlas-h); height: calc(100vh - var(--atlas-h)); }
body.atlas-on .drawer-backdrop { top: var(--atlas-h); }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.mono, .chip-time, .cal-dayhead .wd, .statlist .s b, .camp-card .stats .total b { font-variant-numeric: tabular-nums; }
.brand { display:flex; align-items:center; gap: 11px; }
.brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1.5px solid var(--line); }
.brand .name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand .name small { display:block; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-weight:600; }

.tabs { display:flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; border:1px solid var(--line-soft); }
.tab {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 15px; border-radius: 8px; font-size: 14px; font-weight: 650;
  display:flex; align-items:center; gap:7px;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--dentego); box-shadow: var(--shadow-1); }
.tab:hover:not([aria-selected="true"]) { color: var(--ink); }

.topbar-spacer { flex: 1; }

.demo-pill {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing:.05em;
  background: #FFF3D6; color: #8A5A00; border: 1px solid #F2D89A;
  padding: 5px 10px; border-radius: 999px;
}
@media (prefers-color-scheme: dark){ .demo-pill{ background:#3a2f10; color:#f0cd6f; border-color:#5a4820; } }

.channels-chip {
  display:flex; align-items:center; gap:8px; padding: 6px 11px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--ink-soft); font-weight: 600;
}
.channels-chip .dots { display:flex; gap:3px; }
.channels-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot--on  { background: var(--ok); }
.dot--off { background: #C9D4E4; }
@media (prefers-color-scheme: dark){ .dot--off{ background:#3a4d70; } }

.usermenu { display:flex; align-items:center; gap:10px; }
.usermenu .who { text-align:right; line-height:1.25; }
.usermenu .who b { font-size: 13px; }
.usermenu .who small { display:block; font-size: 11px; color: var(--muted); }
.usermenu .av { width: 34px; height: 34px; border-radius: 50%; background: var(--dentego); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; }

.main { flex: 1; padding: 26px 22px 60px; max-width: 1420px; width: 100%; margin: 0 auto; }

.view-head { display:flex; align-items:flex-end; justify-content:space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: 27px; }
.view-head p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.view-head .actions { display:flex; gap:10px; }

/* Légende campagnes */
.legend { display:flex; gap: 16px; flex-wrap: wrap; align-items:center; margin-bottom: 18px; }
.legend .item { display:flex; align-items:center; gap:7px; font-size: 12.5px; color: var(--ink-soft); font-weight:600; }
.legend .swatch { width: 12px; height: 12px; border-radius: 4px; }

/* ============================================================================
   CALENDRIER ÉDITORIAL (hero / signature)
   ============================================================================ */
.cal-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.cal-scroll { overflow-x: auto; }
.cal-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(148px, 1fr); min-width: 900px; }
.cal-col { border-right: 1px solid var(--line-soft); min-height: 460px; display:flex; flex-direction:column; }
.cal-col:last-child { border-right: none; }
.cal-col.is-weekend { background: var(--surface-2); }
.cal-col.is-today .cal-dayhead { background: var(--dentego); color:#fff; }
.cal-col.is-today .cal-dayhead .wd,
.cal-col.is-today .cal-dayhead .dn { color:#fff; }

.cal-dayhead {
  position: sticky; top: 0; padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2); display:flex; align-items:baseline; gap: 8px; z-index: 1;
}
.cal-dayhead .wd { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cal-dayhead .dn { font-size: 17px; font-weight: 800; color: var(--ink); }
.cal-dayhead .mo { font-size: 11px; color: var(--muted); }

.cal-daybody { padding: 8px; display:flex; flex-direction:column; gap: 8px; flex:1; }

.chip {
  text-align:left; width:100%; border:none; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--chip, var(--dentego));
  padding: 8px 9px; box-shadow: var(--shadow-1);
  transition: transform .08s, box-shadow .15s, border-color .15s;
  display:flex; flex-direction:column; gap: 6px;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.chip .chip-time { font-family: var(--mono); font-size: 10.5px; color: var(--muted); font-weight: 600; }
.chip .chip-title { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.28; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.chip .chip-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

/* vignette du visuel IA sur la carte calendrier — hauteur fixe = pas de layout shift, densité préservée */
.chip-thumb {
  display:block; height: 64px; border-radius: 7px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line-soft);
}
.chip-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.unscheduled .chip .chip-thumb { height: 92px; }

.stbadge {
  display:inline-flex; align-items:center; gap:4px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing:.03em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 5px;
  background: color-mix(in srgb, var(--stc, var(--muted)) 14%, var(--surface));
  color: var(--stci, var(--stc, var(--muted)));
  border: 1px solid color-mix(in srgb, var(--stc, var(--muted)) 34%, transparent);
}
.stbadge::before {
  content:""; width:6px; height:6px; border-radius:50%;
  background: var(--stc, var(--muted)); flex:none;
}
/* statut « à valider » fusionné (⏳ dans le badge) : la pastille pulse pour signaler l'attente */
.stbadge--val::before { animation: valpulse 1.8s ease-in-out infinite; }
.fmt-tag { font-size: 10px; color: var(--muted); font-weight:600; text-transform: capitalize; }

/* Badge « en attente de validation » (statut a_valider) */
.valbadge {
  display:inline-flex; align-items:center; gap:4px;
  font-size: 9.5px; font-weight: 800; letter-spacing:.02em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--accent-tint); color: var(--accent-deep);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.valbadge .pulse {
  width:6px; height:6px; border-radius:50%; background: var(--accent); flex:none;
  animation: valpulse 1.8s ease-in-out infinite;
}
@keyframes valpulse { 0%,100%{ opacity:1; transform:scale(1);} 50%{ opacity:.45; transform:scale(.7);} }

/* Pastilles plateforme */
.pf-row { display:flex; gap:4px; flex-wrap:wrap; align-items:center; }
.pf-pill {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:19px; height:16px; padding:0 5px; border-radius:5px;
  font-size: 9px; font-weight: 800; letter-spacing:.02em; line-height:1;
  color:#fff; background: var(--pf, var(--muted));
}
.pf-pill[data-pf="tiktok"] { color: var(--surface); }

.mini-rail { display:flex; gap: 2px; margin-top: 2px; }
.mini-rail span { height: 3px; flex:1; border-radius: 2px; background: var(--line); }
.mini-rail span.on { background: var(--chip, var(--dentego)); }

/* posts non planifiés (scheduled_at null) — bac à idées */
.unscheduled { margin-top: 22px; }
.unscheduled h3 { font-size: 15px; display:flex; align-items:center; gap:8px; }
.unscheduled h3 .count { font-family:var(--mono); font-size:12px; color:var(--muted); }
.unscheduled .row { display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px; }
.unscheduled .chip { max-width: 240px; }

/* ============================================================================
   CAMPAGNES
   ============================================================================ */
.camp-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.camp-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); overflow: hidden; border-top: 4px solid var(--chip, var(--dentego));
}
.camp-card .head { padding: 18px 18px 12px; }
.camp-card .head .kicker { display:flex; align-items:center; gap:7px; }
.camp-card .head .kicker::before { content:""; width:9px; height:9px; border-radius:3px; background: var(--chip, var(--dentego)); flex:none; }
.camp-card .head .kicker .slug { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); font-weight: 700; letter-spacing:.02em; }
.camp-card h3 { font-size: 18px; margin-top: 8px; }
.camp-card .obj { color: var(--muted); font-size: 13px; margin-top: 6px; }
.camp-card .plats { display:flex; gap:6px; margin-top: 12px; flex-wrap:wrap; }
.plat-tag { font-size: 11px; font-weight:600; padding: 3px 9px; border-radius:999px; background: var(--surface-2); border:1px solid var(--line); color: var(--ink-soft); text-transform: capitalize; }

.camp-card .stats { padding: 4px 18px 18px; }
.camp-card .stats .total { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.camp-card .stats .total b { font-size: 22px; color: var(--ink); font-weight:800; }
/* barre empilée statut */
.stackbar { display:flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line-soft); margin-bottom: 12px; }
.stackbar span { display:block; border-radius: 2px; }
.statlist { display:flex; flex-wrap:wrap; gap: 6px 14px; }
.statlist .s { display:flex; align-items:center; gap:6px; font-size: 12px; color: var(--ink-soft); }
.statlist .s .sw { width: 9px; height: 9px; border-radius: 3px; }
.statlist .s b { color: var(--ink); font-family: var(--mono); }
.camp-card .foot { border-top: 1px solid var(--line-soft); padding: 12px 18px; background: var(--surface-2); }

/* ============================================================================
   DRAWER (détail post)
   ============================================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(10,25,45,.42);
  backdrop-filter: blur(2px); z-index: 60; opacity: 0; transition: opacity .2s;
}
.drawer-backdrop.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw);
  background: var(--surface); z-index: 61; box-shadow: var(--shadow-3);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  display:flex; flex-direction: column;
  border-left: 5px solid var(--chip, var(--dentego));
  overscroll-behavior: contain;
}
.drawer.open { transform: translateX(0); }

.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line-soft); }
.drawer-head .top { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.drawer-head .camptag { display:flex; align-items:center; gap:8px; font-family: var(--mono); font-size: 12px; font-weight:700; color: var(--ink-soft); }
.drawer-head .camptag .dot { width:9px; height:9px; border-radius:50%; background: var(--chip); }
.icon-btn { border:1px solid var(--line); background: var(--surface-2); width:34px; height:34px; border-radius: 9px; display:flex; align-items:center; justify-content:center; color: var(--muted); font-size:18px; }
.icon-btn:hover { color: var(--ink); border-color: var(--dentego); }
.drawer-title { font-size: 21px; margin-top: 12px; }
.drawer-sub { display:flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.drawer-sub .k { font-family: var(--mono); text-transform:uppercase; letter-spacing:.06em; font-size:10px; }
.drawer-sub .v { color: var(--ink-soft); font-weight:600; }

.drawer-body { flex:1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px 30px; }

/* aperçu du visuel IA en tête du drawer — object-fit contain = ratio réel respecté, hauteur bornée = pas de blow-up */
.drawer-media {
  margin: 0 0 22px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  min-height: 180px; max-height: 360px;
  display:flex; align-items:center; justify-content:center;
}
.drawer-media .drawer-img { width:100%; height:100%; max-height: 360px; object-fit: contain; display:block; }
.drawer-media--empty {
  flex-direction: column; gap: 8px; min-height: 130px;
  color: var(--muted); font-size: 13px; font-weight: 600;
  border-style: dashed;
}
.drawer-media--empty span[aria-hidden] { font-size: 26px; opacity: .5; }
.section { margin-bottom: 26px; }
.section > .lbl { display:flex; align-items:center; justify-content:space-between; margin-bottom: 10px; }
.section > .lbl h3 { font-size: 13px; text-transform: uppercase; letter-spacing:.06em; color: var(--ink-soft); font-weight: 700; }

/* pipeline stepper — SIGNATURE */
.pipeline { display:flex; align-items:stretch; gap:0; border:1px solid var(--line); border-radius: var(--radius-sm); overflow:hidden; background: var(--surface-2); }
.pstep {
  flex:1; border:none; background: transparent; padding: 10px 6px 9px;
  border-right: 1px solid var(--line-soft); position: relative;
  display:flex; flex-direction:column; align-items:center; gap:5px; min-width:0;
}
.pstep:last-child { border-right:none; }
.pstep .pdot { width: 16px; height:16px; border-radius:50%; border:2px solid var(--line); background: var(--surface); display:flex; align-items:center; justify-content:center; font-size:9px; color:#fff; }
.pstep .plabel { font-family: var(--mono); font-size: 9px; letter-spacing:.02em; text-transform:uppercase; color: var(--muted); font-weight:700; text-align:center; line-height:1.2; }
.pstep.done .pdot { background: var(--st-planifie); border-color: var(--st-planifie); }
.pstep.current .pdot { background: var(--dentego); border-color: var(--dentego); box-shadow: 0 0 0 4px var(--dentego-tint); }
.pstep.current { background: var(--surface); }
.pstep.current .plabel { color: var(--dentego); }
.pstep.done .plabel { color: var(--ink-soft); }
.pstep.clickable { cursor: pointer; }
.pstep.clickable:hover:not(.current) { background: var(--dentego-tint); }
.pipeline-actions { display:flex; gap:10px; margin-top: 12px; align-items:center; flex-wrap:wrap; }
.pipeline-actions .hint { font-size:12px; color:var(--muted); }

textarea.script {
  width:100%; min-height: 260px; resize: vertical; padding: 14px 15px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
  white-space: pre-wrap; tab-size: 2;
}
textarea.script:focus { border-color: var(--dentego); background: var(--surface); }
.script-actions { display:flex; gap:10px; margin-top: 10px; align-items:center; flex-wrap:wrap; }
.script-actions .dirty { font-size:12px; color: var(--warn); font-weight:600; }
.script-actions .saved { font-size:12px; color: var(--ok); font-weight:600; }

.gen-tools { display:grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.gen-tool {
  border:1px dashed var(--line); background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 12px; text-align:left; display:flex; flex-direction:column; gap:6px; position:relative;
}
.gen-tool .tt { font-size: 13px; font-weight: 700; display:flex; align-items:center; gap:7px; }
.gen-tool .desc { font-size: 11.5px; color: var(--muted); }
.gen-tool .lockrow { display:flex; align-items:center; gap:6px; margin-top:4px; font-size:11px; color: var(--warn); font-weight:600; }
.gen-tool.enabled { border-style: solid; border-color: var(--line); }
.gen-tool button { margin-top: 4px; }

.meta-grid { display:grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.meta-grid dt { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing:.05em; color: var(--muted); }
.meta-grid dd { margin: 0; color: var(--ink-soft); }
.callout {
  display:flex; gap:10px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: #FFF6E5; border:1px solid #F3D89B; color: #7A5410; font-size: 12.5px; margin-top: 10px;
}
@media (prefers-color-scheme: dark){ .callout{ background:#33280f; border-color:#5c4a1e; color:#f0cd7a; } }
.callout--val {
  background: var(--accent-tint);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-deep);
}

.chips-inline { display:flex; gap:6px; flex-wrap:wrap; }

/* ============================================================================
   TOASTS
   ============================================================================ */
.toast-stack { position: fixed; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 90; display:flex; flex-direction: column; gap: 10px; width: min(460px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: #fff; padding: 13px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3); font-size: 13.5px; display:flex; gap: 11px; align-items:flex-start;
  animation: toastin .25s cubic-bezier(.2,.8,.2,1);
}
.toast .tclose { margin-left:auto; background:none; border:none; color:rgba(255,255,255,.6); font-size:16px; padding:0 2px; }
.toast--info   { border-left: 4px solid var(--dentego); }
.toast--ok     { border-left: 4px solid var(--ok); }
.toast--warn   { border-left: 4px solid var(--warn); }
.toast--error  { border-left: 4px solid var(--danger); }
.toast .ti { font-size: 16px; line-height:1.3; }
.toast b { display:block; margin-bottom: 2px; }
@keyframes toastin { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }

/* Loader plein écran */
.splash { position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:16px; background: var(--bg); z-index: 100; }
.splash .spin { width: 34px; height:34px; border:3px solid var(--line); border-top-color: var(--dentego); border-radius:50%; animation: spin .8s linear infinite; }
.splash p { color: var(--muted); font-family: var(--mono); font-size: 13px; }

.empty { text-align:center; padding: 60px 20px; color: var(--muted); }

/* ============================================================================
   TOOLBAR CALENDRIER  (nav + bascule de vues)
   ============================================================================ */
.cal-head { align-items: center; }
.cal-toolbar { display:flex; align-items:center; gap: 12px; flex-wrap: wrap; }
.cal-nav { display:flex; align-items:center; gap: 6px; }
.icon-btn.nav-arrow { width: 34px; height: 34px; font-size: 20px; font-weight: 700; line-height: 1; }

.view-switch {
  display:flex; gap: 3px; background: var(--surface-2);
  padding: 3px; border-radius: 10px; border: 1px solid var(--line);
}
.vsw {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 650;
  transition: background .15s, color .15s, box-shadow .15s;
}
.vsw:hover:not([aria-selected="true"]) { color: var(--ink); }
.vsw[aria-selected="true"] { background: var(--surface); color: var(--dentego); box-shadow: var(--shadow-1); }

/* ============================================================================
   EMPTY-STATE — aucun réseau connecté (non bloquant)
   ============================================================================ */
.connect-banner {
  display:flex; align-items:center; gap: 16px; margin-bottom: 18px;
  padding: 14px 18px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--dentego-tint), var(--accent-tint));
  border: 1px solid var(--line);
}
.connect-banner .cb-mascot {
  width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none;
  border: 2px solid var(--surface); box-shadow: var(--shadow-1);
}
.connect-banner .cb-txt { flex: 1; min-width: 0; }
.connect-banner .cb-txt b { font-size: 14px; }
.connect-banner .cb-txt p { font-size: 12.5px; color: var(--ink-soft); margin: 3px 0 0; }
.connect-banner .cb-actions { display:flex; gap: 8px; flex-wrap: wrap; }
.connect-chip {
  display:inline-flex; align-items:center; gap:6px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650;
}
.connect-chip:hover { border-color: var(--dentego); background: var(--surface-2); }
.connect-chip .pf-pill { pointer-events: none; }

/* ============================================================================
   FILTRES  (campagne / plateforme / statut)
   ============================================================================ */
.filterbar {
  display:flex; align-items:flex-start; gap: 10px 22px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.fgroup { display:flex; align-items:center; gap: 8px; flex-wrap: wrap; }
.fgroup > .flabel {
  font-family: var(--mono); font-size: 10px; letter-spacing:.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-right: 2px;
}
.fchip {
  display:inline-flex; align-items:center; gap: 6px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.fchip .swatch { width: 10px; height: 10px; border-radius: 3px; flex:none; }
.fchip:hover { border-color: var(--dentego); }
.fchip[aria-pressed="true"] { background: var(--dentego-tint); border-color: var(--dentego); color: var(--dentego-deep); }
.fchip.is-dim { opacity: .5; }
.filter-reset {
  margin-left: auto; align-self: center;
  border:none; background:transparent; color: var(--dentego); font-weight: 650; font-size: 12.5px;
  padding: 5px 8px; border-radius: 7px;
}
.filter-reset:hover { background: var(--dentego-tint); }
.filter-reset[hidden] { display: none; }

/* empty result de la période filtrée */
.cal-empty { padding: 48px 24px; text-align:center; color: var(--muted); }
.cal-empty span[aria-hidden] { font-size: 34px; opacity: .5; display:block; margin-bottom: 8px; }
.cal-empty p { margin: 0 0 14px; font-size: 14px; }

/* ============================================================================
   VUE SEMAINE  (7 colonnes) — réutilise .cal-grid en 7 colonnes fixes
   ============================================================================ */
.cal-grid.is-week { grid-auto-columns: minmax(150px, 1fr); min-width: 980px; }

/* ============================================================================
   VUE MOIS  (grille 7 × N)
   ============================================================================ */
.cal-month { display:flex; flex-direction:column; min-width: 720px; }
.cal-month-dow {
  display:grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.cal-month-dow span {
  padding: 9px 10px; font-family: var(--mono); font-size: 10.5px; letter-spacing:.08em;
  text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: left;
}
.cal-month-grid { display:grid; grid-template-columns: repeat(7, 1fr); }
.mcell {
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  min-height: 118px; padding: 6px; display:flex; flex-direction:column; gap: 5px;
}
.mcell:nth-child(7n) { border-right: none; }
.mcell.is-out { background: var(--surface-2); }
.mcell.is-weekend:not(.is-out) { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.mcell .mdate { font-size: 12px; font-weight: 700; color: var(--ink-soft); align-self: flex-start; padding: 1px 2px; }
.mcell.is-out .mdate { color: var(--muted); font-weight: 600; }
.mcell.is-today .mdate {
  background: var(--dentego); color:#fff; border-radius: 6px; min-width: 20px; text-align:center;
}
.mchip {
  display:flex; align-items:center; gap: 5px; width:100%; text-align:left;
  border:none; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--chip, var(--dentego));
  border-radius: 6px; padding: 3px 5px; box-shadow: var(--shadow-1);
  transition: transform .08s, box-shadow .12s;
}
.mchip { overflow: hidden; }
.mchip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.mchip .mc-dot { width:7px; height:7px; border-radius:50%; background: var(--stc, var(--muted)); flex:none; }
/* miniature du visuel en vue mois — 20px, hauteur fixe = pas de layout shift */
.mchip .mc-thumb { width:20px; height:20px; border-radius:4px; overflow:hidden; flex:none; background: var(--surface-2); border:1px solid var(--line-soft); }
.mchip .mc-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.mchip .mc-t { flex:1; min-width:0; font-size: 11px; font-weight: 600; color: var(--ink); line-height:1.2; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchip .mc-flag { font-size: 10px; flex:none; }
.mcell .more { font-size: 10.5px; color: var(--muted); font-weight: 650; padding: 1px 4px; text-align:left; background:none; border:none; }
.mcell .more:hover { color: var(--dentego); }

/* ============================================================================
   VUE LISTE  (tableau trié par date)
   ============================================================================ */
.cal-list { overflow-x: auto; }
.ltable { width:100%; border-collapse: collapse; min-width: 720px; font-size: 13px; }
.ltable thead th {
  position: sticky; top: 0; z-index: 1; text-align:left;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 10px 14px; font-family: var(--mono); font-size: 10.5px; letter-spacing:.06em;
  text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap;
}
.ltable tbody tr {
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
  transition: background .1s; border-left: 4px solid var(--chip, var(--dentego));
}
.ltable tbody tr:hover { background: var(--dentego-tint); }
.ltable td { padding: 10px 14px; vertical-align: middle; }
.ltable .l-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.ltable .l-date .l-day { font-weight: 700; color: var(--ink); }
.ltable .l-date .l-time { font-family: var(--mono); font-size: 11px; color: var(--muted); display:block; }
.ltable .l-title { font-weight: 650; color: var(--ink); }
/* cellule Post : miniature du visuel + libellés — hauteur fixe = pas de layout shift */
.ltable .l-title-wrap { display:flex; align-items:center; gap: 11px; }
.ltable .l-thumb { width:40px; height:40px; border-radius:8px; overflow:hidden; flex:none; background: var(--surface-2); border:1px solid var(--line-soft); }
.ltable .l-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.ltable .l-thumb.is-empty { display:flex; align-items:center; justify-content:center; font-size: 16px; opacity:.5; }
.ltable .l-title-txt { min-width:0; }
.ltable .l-title .l-camp { display:block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.ltable .l-when-none { color: var(--muted); font-style: italic; }
.ltable .l-cell-meta { display:flex; align-items:center; gap: 8px; flex-wrap: wrap; }
.lsub { padding: 14px 14px 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing:.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* ============================================================================
   HOVER PREVIEW  (aperçu de post au survol)
   ============================================================================ */
.hovercard {
  position: fixed; z-index: 80; width: 264px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-3);
  overflow: hidden; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
  border-left: 4px solid var(--chip, var(--dentego));
}
.hovercard.show { opacity: 1; transform: translateY(0); }
.hovercard .hc-thumb { height: 120px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.hovercard .hc-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.hovercard .hc-thumb.is-empty { display:flex; align-items:center; justify-content:center; color: var(--muted); font-size: 22px; }
.hovercard .hc-body { padding: 10px 12px 12px; }
.hovercard .hc-top { display:flex; align-items:center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.hovercard .hc-title { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.hovercard .hc-line { margin-top: 6px; font-size: 12px; color: var(--ink-soft); line-height: 1.4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hovercard .hc-when { margin-top: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* ============================================================================
   COMPTEUR DE CARACTÈRES  (composer / script)
   ============================================================================ */
.charcount { display:flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cc-item {
  display:flex; align-items:center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px 4px 5px; font-size: 12px;
}
.cc-item .cc-num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink-soft); }
.cc-item .cc-max { color: var(--muted); font-size: 11px; }
.cc-item.is-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.cc-item.is-warn .cc-num { color: var(--warn); }
.cc-item.is-over { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.cc-item.is-over .cc-num { color: var(--danger); }
.cc-fold { font-size: 10px; color: var(--muted); }
.cc-note { flex-basis: 100%; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ============================================================================
   PUBLICATION — empty-state « compte non connecté » dans le drawer
   ============================================================================ */
.connect-card {
  display:flex; gap: 12px; align-items:center;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.connect-card .cc-mascot { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex:none; border: 2px solid var(--surface); }
.connect-card .cc-info { flex: 1; min-width: 0; }
.connect-card .cc-info b { font-size: 13px; }
.connect-card .cc-info p { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.connect-card .cc-btns { display:flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================================
   POP-JOUR  (« +N de plus » → liste de tous les posts du jour)
   ============================================================================ */
.day-popover {
  position: fixed; z-index: 85; width: 288px; max-width: calc(100vw - 24px);
  max-height: min(60vh, 420px); display:flex; flex-direction:column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-3); overflow: hidden;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.day-popover.show { opacity: 1; transform: translateY(0); }
.day-popover .dp-head {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2);
}
.day-popover .dp-head b { font-size: 12.5px; color: var(--ink); text-transform: capitalize; }
.day-popover .dp-head .dp-close { border:none; background:none; color: var(--muted); font-size:16px; padding:0 4px; line-height:1; }
.day-popover .dp-head .dp-close:hover { color: var(--ink); }
.day-popover .dp-list { overflow-y:auto; padding: 6px; display:flex; flex-direction:column; gap: 5px; }
.day-popover .dp-item {
  display:flex; align-items:center; gap: 9px; width:100%; text-align:left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  border-left: 3px solid var(--chip, var(--dentego)); padding: 6px 8px;
  transition: background .1s, border-color .1s;
}
.day-popover .dp-item:hover { background: var(--dentego-tint); }
.day-popover .dp-thumb { width:34px; height:34px; border-radius:6px; overflow:hidden; flex:none; background: var(--surface-2); border:1px solid var(--line-soft); }
.day-popover .dp-thumb img { width:100%; height:100%; object-fit: cover; display:block; }
.day-popover .dp-thumb.is-empty { display:flex; align-items:center; justify-content:center; font-size: 14px; opacity:.5; }
.day-popover .dp-t { min-width:0; display:flex; flex-direction:column; gap:3px; flex:1; }
.day-popover .dp-time { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 600; }
.day-popover .dp-title { font-size: 12px; font-weight: 650; color: var(--ink); line-height:1.25; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brandside { padding: 34px 30px; min-height: 220px; }
  .login-hero { padding-right: 140px; }
  .login-hero .mascot { width: 128px; right: 0; bottom: 0; }
  .gen-tools { grid-template-columns: 1fr; }
  .cal-head { align-items: flex-start; }
  .cal-toolbar { width: 100%; justify-content: space-between; }
  .connect-banner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .brand .name small { display:none; }
  .channels-chip .label-txt { display:none; }
  .tabs { order: 3; width:100%; }
  .tab { flex:1; justify-content:center; }
  .main { padding: 18px 14px 50px; }
  .drawer { width: 100vw; }
  .usermenu .who { display:none; }
  .cal-nav { flex: 1; }
  .view-switch { flex: 1; }
  .vsw { flex: 1; text-align: center; padding: 7px 8px; }
  .filter-reset { margin-left: 0; }
  .mcell { min-height: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
