/* Planning com — interface */
:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --line: #E4E4E7;
  --line-strong: #D4D4D8;
  --ink: #18181B;
  --ink-2: #3F3F46;
  --muted: #52525B;
  --soft: #F4F4F5;
  --ok-bg: #ECFDF5; --ok-line: #A7F3D0; --ok: #065F46;
  --warn-bg: #FFFBEB; --warn-line: #FDE68A; --warn: #92400E;
  --err-bg: #FEF2F2; --err-line: #FECACA; --err: #991B1B;
  --ai-bg: #F5F3FF; --ai-line: #DDD6FE; --ai: #5B21B6;
  --radius: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 1; }
a { color: #1D4ED8; }
:focus-visible { outline: 2px solid #2563EB; outline-offset: 2px; }
.boot { padding: 48px; text-align: center; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #27272A; }
.btn.primary:disabled { background: var(--line); color: var(--muted); border-color: var(--line); }
.btn.ai { background: var(--ai); color: #fff; border-color: var(--ai); }
.btn.ai-ghost { color: var(--ai); border-color: #C4B5FD; }
.btn.ok { background: #166534; color: #fff; border-color: #166534; }
.btn.danger { color: var(--err); border-color: var(--err-line); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 48px; font-size: 15px; border-radius: 12px; width: 100%; white-space: normal; text-align: center; padding: 8px 16px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.icon { width: 16px; height: 16px; flex: none; }

/* Champs */
label.field, div.field {  display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=number], input[type=color], select, textarea {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; background: var(--surface); min-height: 40px; font-weight: 400; width: 100%;
}
input[type=color] { padding: 4px; width: 56px; }
textarea { resize: vertical; min-height: 96px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-height: 36px; }
.check input { width: 18px; height: 18px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field .pill { align-self: flex-start; }

/* Mise en page */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; margin-right: 4px; }
.nav { display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a[aria-current=page] { background: var(--soft); color: var(--ink); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; }
.spacer { flex: 1 1 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; color: var(--muted); }
.chip[aria-pressed=true] { color: var(--ink); border-color: var(--chip, var(--ink)); background: color-mix(in srgb, var(--chip, #18181B) 14%, white); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, #A1A1AA); flex: none; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 10px; }
.tabs button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; }
.tabs button:disabled { opacity: .55; }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }

.layout { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; max-width: 1640px; margin: 0 auto; align-items: flex-start; }
.main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side { flex: 1 1 360px; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h2, .card h3 { margin: 0; }
.card h2 { font-size: 15px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.title { font-family: var(--display); font-size: 24px; letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.section-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.pill.ok { background: #DCFCE7; color: #166534; }
.pill.warn { background: #FEF3C7; color: var(--warn); }
.pill.err { background: #FEE2E2; color: var(--err); }
.pill.ai { background: #EDE9FE; color: var(--ai); }
.pill.info { background: #DBEAFE; color: #1D4ED8; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.note.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); }
.note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.note.err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err); }
.note.info { background: var(--soft); color: var(--ink-2); }

/* Calendrier mois */
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-day { min-height: 108px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.cal-day.out { background: #FAFAFA; }
.cal-day.out .num { color: #71717A; }
.cal-day.today { border: 2px solid var(--ink); }
.num { font-size: 12px; font-weight: 600; }
.ev { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 6px; font-size: 11.5px; line-height: 1.3; background: color-mix(in srgb, var(--c) 18%, white); color: var(--ink); min-width: 0; }
.ev b, .ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.failed { outline: 2px solid #DC2626; }
.ev.manual { outline: 2px dashed var(--warn); }
.ev.free { background: var(--surface); border: 1px dashed var(--c); color: var(--muted); }
.more { font-size: 11px; font-weight: 600; color: var(--muted); }

/* Frise écrans */
.bands { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #FAFAF9; border: 1px solid var(--line); border-radius: 10px; }
.band-row { display: flex; align-items: center; gap: 12px; }
.band-label { flex: 0 0 140px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band-track { position: relative; flex: 1 1 auto; height: 28px; background: var(--soft); border-radius: 6px; min-width: 0; }
.band { position: absolute; top: 0; bottom: 0; border-radius: 6px; padding: 0 10px; display: flex; align-items: center; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--c) 22%, white); border: 0; color: var(--ink); text-align: left; }
.band.socle { background: #E4E4E7; color: var(--ink-2); }

/* Semaine / jour / agenda */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; min-width: 900px; }
.scroll-x { overflow-x: auto; }
.col-head { font-size: 13px; font-weight: 600; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.week .ev, .agenda .ev { font-size: 12.5px; padding: 8px; border-radius: 8px; }
.agenda { display: flex; flex-direction: column; gap: 14px; }
.agenda h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }

/* File à planifier */
.qitem { width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.qitem:hover { border-color: var(--line-strong); background: #FCFCFC; }
.qitem.locked { border-style: dashed; background: #FAFAFA; }
.thumb { flex: 0 0 44px; height: 54px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--c) 18%, white); overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.qbody { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.org-line { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }

/* Alertes */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warning { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--soft); color: var(--ink-2); }

/* Fiche */
.formats { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.fmt { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; }
.fmt-box { height: 72px; border-radius: 6px; border: 1px solid var(--line-strong); overflow: hidden; display: grid; place-items: center; background: var(--soft); position: relative; }
.fmt-box img, .fmt-box video { width: 100%; height: 100%; object-fit: cover; }
.fmt-box.missing { border-style: dashed; background: var(--surface); color: var(--muted); font-weight: 600; }
.drop { border: 1px dashed #A1A1AA; border-radius: 12px; padding: 14px; text-align: center; background: #FAFAF9; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop.over { background: #EFF6FF; border-color: #2563EB; }
.target { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.caption-box { padding: 12px; border-radius: 10px; background: #FAFAF9; border: 1px solid var(--line); white-space: pre-line; }
.caption-box.ai { background: var(--ai-bg); border-color: var(--ai-line); }
.slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-chips button[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chrono { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.history li { display: flex; gap: 10px; }
.history time { flex: 0 0 112px; color: var(--muted); }

/* Aperçu validation */
.preview { display: flex; justify-content: center; padding: 16px; background: var(--soft); border-radius: 12px; }
.preview-card { width: 340px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview-card img, .preview-card video { display: block; width: 100%; height: auto; }

/* Admin */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.slots-editor { display: flex; flex-direction: column; gap: 6px; }
.slots-editor .row select, .slots-editor .row input { width: auto; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { position: relative; width: 40px; height: 24px; border-radius: 999px; background: #D4D4D8; transition: background .15s; flex: none; }
.switch .slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .slider { background: #166534; }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid #2563EB; outline-offset: 2px; }

/* Fenêtre */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(24,24,27,.45); }
dialog form, dialog .dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Messages */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100vw - 32px)); pointer-events: none; }
#toast .t { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14px; }
#toast .t.err { background: #991B1B; }
#toast .t.ok { background: #166534; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 28px; gap: 16px; }

/* Barre du bas (téléphone) */
.bottom-nav { display: none; }

@media (max-width: 760px) {
  .top { padding: 10px 14px; }
  .top .nav, .top .tabs-desktop, .top .user-name { display: none; }
  .top .chips { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .top .chip { flex: none; min-height: 34px; }
  .layout { padding: 14px; gap: 14px; padding-bottom: 96px; }
  .side { flex-basis: 100%; }
  .band-label { flex-basis: 90px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; position: relative; }
  .bottom-nav a[aria-current=page] { color: var(--ink); }
  .bottom-nav .badge { position: absolute; top: 2px; right: calc(50% - 26px); }
  #toast { bottom: 96px; }
  .history time { flex-basis: 90px; }
}

/* Identifications et son (fiche publication) */
.mentions { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.mentions > summary { cursor: pointer; font-weight: 600; font-size: 14px; min-height: 28px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mentions > summary .sub { display: block; font-weight: 400; margin-top: 2px; }

/* Sélecteur de comptes (carnet) */
.picker { position: relative; display: flex; flex-direction: column; gap: 6px; }
.acct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.acct { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: #F3F2EF; border: 1px solid var(--line); font-size: 14px; max-width: 100%; }
.acct a { color: inherit; text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.acct a:hover { text-decoration: underline; }
.acct.unknown { background: #FFF8E6; border-color: #F2D48A; }
.acct.unknown .small { color: #8A5A00; }
.chip-btn { font-weight: 400; white-space: nowrap; flex: none; border: 0; background: transparent; font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 999px; cursor: pointer; color: inherit; min-height: 28px; }
.chip-btn:hover, .chip-btn:focus-visible { background: rgba(0,0,0,.08); }
.suggest { font-weight: 400; position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; padding: 4px; }
.suggest-item { font-weight: 400; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; min-height: 40px; }
.suggest-item:hover, .suggest-item:focus-visible { background: #F3F2EF; outline: none; }

/* Arrivées Canva */
.canva-item { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.canva-item-head { display: flex; gap: 12px; align-items: flex-start; }
.canva-thumb { flex: none; width: 64px; height: 64px; border-radius: 8px; background: var(--soft); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.canva-thumb img { width: 100%; height: 100%; object-fit: cover; }
.canva-title { overflow-wrap: anywhere; }
.canva-folders { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }

/* Diapositives de carrousel */
.slides { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.slide { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slide-media { position: relative; aspect-ratio: 4 / 5; border-radius: 8px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.slide-media img, .slide-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-num { position: absolute; top: 4px; left: 4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.slide-tools { display: flex; justify-content: space-between; gap: 2px; }
.slide-tools .btn { min-width: 30px; padding-inline: 6px; }
/* Couverture de vidéo */
.cover-pick { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.cover-video { flex: none; width: 96px; aspect-ratio: 9 / 16; border-radius: 8px; overflow: hidden; background: #000; }
.cover-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.small-drop { padding-block: 12px; }
