/* Calendrier social — piste A « planning mural » */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.page { max-width: 1480px; margin: 0 auto; padding: 28px 32px 48px; }

/* ——— Navigation entre vues ——— */
.views-nav { display: flex; gap: 18px; justify-content: flex-end; font-size: 12px; margin-bottom: 8px; }
.views-nav a { color: var(--muted); text-decoration: none; padding: 2px 0; border-bottom: 1px solid transparent; }
.views-nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--ink); }
.views-nav button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; }

/* ——— En-tête ——— */
.masthead {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px;
  padding-bottom: 14px; border-bottom: 3px solid var(--ink);
}
.kicker { margin: 0 0 10px; font-size: 13px; color: var(--muted); letter-spacing: 0.01em; }
.month-title {
  margin: 0;
  font-family: var(--font-display);
  font-stretch: 68%;
  font-variation-settings: 'wdth' 68;
  font-weight: 850;
  font-size: clamp(56px, 8.4vw, 104px);
  line-height: 0.84;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.month-title .year { color: var(--muted); font-weight: 500; }
.stats { display: flex; gap: 30px; margin: 0; padding: 0; list-style: none; }
.stat { text-align: right; }
.stat b {
  display: block; font-family: var(--font-display); font-stretch: 75%;
  font-variation-settings: 'wdth' 75; font-weight: 750; font-size: 44px; line-height: 0.9;
}
.stat span { font-size: 12px; color: var(--muted); }
.stat.is-published b { color: var(--st-publie); }
.stat.is-pending b { color: var(--accent); }

/* ——— Barre d’outils ——— */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 14px 0 16px; }
.month-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.month-tabs button {
  border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: 2px;
  padding: 5px 10px; font-family: var(--font-display); font-weight: 600; font-size: 13px;
  text-transform: capitalize;
}
.month-tabs button[aria-current='true'] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.month-tabs .arrow { padding: 5px 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: 999px;
  padding: 4px 11px 4px 9px; font-size: 12px; font-weight: 500;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--type-none)); }
.chip[aria-pressed='true'] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip.is-off { color: var(--muted); }
.chip.is-off .dot { opacity: 0.35; }
.validate-btn {
  margin-left: auto; border: 0; border-radius: 2px; background: var(--accent); color: var(--on-accent);
  padding: 8px 14px; font-weight: 600; font-size: 13px;
}
.validate-btn[aria-pressed='true'] { box-shadow: inset 0 0 0 2px var(--ink); }
.validate-btn:disabled { background: var(--rule); color: var(--muted); cursor: default; }

/* ——— Grille ——— */
.grid { border: 1px solid var(--ink); background: var(--sheet); }
.grid-head, .grid-week { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.grid-head div {
  padding: 8px 10px; font-family: var(--font-display); font-weight: 650; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  border-bottom: 1px solid var(--ink); border-left: 1px solid var(--rule);
}
.grid-head div:first-child { border-left: 0; }
.grid-week + .grid-week { border-top: 1px solid var(--rule-strong); }
.week-no {
  padding: 10px 0; text-align: center; font-family: var(--font-display); font-stretch: 75%;
  font-variation-settings: 'wdth' 75; font-weight: 700; font-size: 13px; color: var(--muted);
}
.week-no small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 0.06em; }
.day {
  position: relative; min-height: 168px; padding: 8px 8px 10px; border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.day.is-weekend { background: var(--weekend); }
.day.is-outside { background: var(--outside); }
.day.is-outside .day-no { color: var(--outside-ink); }
.day.is-outside .card { opacity: 0.6; }
.day.is-drop, .tray.is-drop { background: var(--drop); outline: 2px dashed var(--accent); outline-offset: -3px; }
.day-head { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.day-no {
  font-family: var(--font-display); font-weight: 650; font-size: 17px; line-height: 1;
  padding: 3px 0; min-width: 24px;
}
.day.is-today .day-no { background: var(--accent); color: var(--on-accent); padding: 3px 6px; border-radius: 2px; }
.day-label { display: none; }
.add-btn {
  margin-left: auto; border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: 2px;
  padding: 1px 7px; font-size: 12px; color: var(--muted); opacity: 0;
}
.day:hover .add-btn, .day:focus-within .add-btn, .add-btn:focus-visible { opacity: 1; }
@media (hover: none) { .add-btn { opacity: 1; } }
.add-btn:hover { color: var(--ink); border-color: var(--ink); }
.events { display: flex; flex-wrap: wrap; gap: 4px; }
.event {
  background: var(--event-bg); color: var(--event-ink); border-radius: 2px;
  padding: 2px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.25;
  text-transform: uppercase;
}

/* ——— Carte ——— */
.card {
  position: relative; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 2px;
  overflow: hidden; transition: box-shadow 0.15s, opacity 0.15s, transform 0.15s;
}
.card:hover { box-shadow: 0 2px 10px rgba(22, 24, 29, 0.1); border-color: var(--muted); }
.card[draggable='true'] { cursor: grab; }
.card.is-dragging { opacity: 0.4; }
.card.is-pending { opacity: 0.7; }
.card.is-file-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-visual { display: block; width: 100%; height: 132px; object-fit: cover; background: var(--hatch); }
.card-novisual {
  height: 44px; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(-45deg, var(--hatch) 0 6px, transparent 6px 12px);
  color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--rule);
}
.card-body { padding: 7px 8px 8px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.type {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  color: var(--c, var(--type-none)); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.type::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.type span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status {
  flex: none; border-radius: 999px; padding: 1px 7px; font-size: 10.5px; font-weight: 600; white-space: nowrap;
  color: var(--st-other); background: var(--st-other-bg);
}
.card-title {
  margin: 0; font-size: 13px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-time { color: var(--muted); font-size: 11px; margin-top: 3px; }
.card-open {
  all: unset; display: block; cursor: inherit;
}
.card-open::after { content: ''; position: absolute; inset: 0; }
.card-open:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.card.s-kill .card-title { text-decoration: line-through; color: var(--muted); }
.card.s-kill .card-visual { filter: grayscale(1); opacity: 0.6; }

/* Couleurs des types et statuts */
.t-always-on { --c: var(--type-always-on); }
.t-ugc { --c: var(--type-ugc); }
.t-star-ac { --c: var(--type-star-ac); }
.t-event { --c: var(--type-event); }
.t-collab { --c: var(--type-collab); }
.t-playground { --c: var(--type-playground); }
.t-global { --c: var(--type-global); }
.s-publie .status, .status.s-publie { color: var(--st-publie); background: var(--st-publie-bg); }
.s-a-valider .status, .status.s-a-valider { color: var(--st-a-valider); background: var(--st-a-valider-bg); }
.s-lance .status, .status.s-lance { color: var(--st-lance); background: var(--st-lance-bg); }
.s-a-lancer .status, .status.s-a-lancer { color: var(--st-a-lancer); background: var(--st-a-lancer-bg); }
.s-a-programmer .status, .status.s-a-programmer { color: var(--st-a-programmer); background: var(--st-a-programmer-bg); }
.s-a-publier .status, .status.s-a-publier { color: var(--st-a-publier); background: var(--st-a-publier-bg); }
.s-programme .status, .status.s-programme { color: var(--st-programme); background: var(--st-programme-bg); }
.s-on-hold .status, .status.s-on-hold { color: var(--st-on-hold); background: var(--st-on-hold-bg); }
.s-kill .status, .status.s-kill { color: var(--st-kill); background: var(--st-kill-bg); text-decoration: line-through; }

/* Mise en évidence des contenus à valider */
.is-highlighting .card:not(.s-a-valider) { opacity: 0.28; }
.is-highlighting .card.s-a-valider { box-shadow: 0 0 0 2px var(--accent); }

/* ——— Bac « Sans date » ——— */
.tray { margin-top: 22px; border: 1px solid var(--ink); background: var(--sheet); padding: 12px 14px 16px; }
.tray-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.tray-head h2 {
  margin: 0; font-family: var(--font-display); font-stretch: 75%; font-variation-settings: 'wdth' 75;
  font-weight: 800; font-size: 22px; text-transform: uppercase;
}
.tray-head span { color: var(--muted); font-size: 12px; }
.tray-head .add-btn { opacity: 1; }
.tray-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.tray-empty { color: var(--muted); font-size: 13px; margin: 0; }

.help { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.footer { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.footer a { color: var(--muted); }
.footer .is-stale { color: var(--st-on-hold); }
.empty-view { padding: 60px 0; color: var(--muted); }

/* ——— Panneau d’édition ——— */
.drawer-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(440px, 100vw);
  background: var(--sheet); box-shadow: var(--shadow); display: flex; flex-direction: column;
  border-left: 1px solid var(--ink);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 20px 12px; border-bottom: 3px solid var(--ink);
}
.drawer-head h2 {
  margin: 0; font-family: var(--font-display); font-stretch: 75%; font-variation-settings: 'wdth' 75;
  font-weight: 800; font-size: 24px; text-transform: uppercase; line-height: 1;
}
.icon-btn { border: 1px solid var(--rule-strong); background: var(--sheet); border-radius: 2px; width: 32px; height: 32px; font-size: 18px; line-height: 1; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 5px; align-content: start; }
.field > span, .field legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0; }
.field input[type='text'], .field input[type='date'], .field input[type='url'], .field select, .field textarea {
  width: 100%; border: 1px solid var(--rule-strong); border-radius: 2px; background: var(--sheet);
  padding: 8px 10px; font-size: 14px;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--bg); color: var(--ink); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.visual-zone {
  border: 1px dashed var(--rule-strong); border-radius: 2px; padding: 10px; display: grid; gap: 8px;
  justify-items: start; background: var(--bg);
}
.visual-zone.is-drop { border-color: var(--accent); background: var(--drop); }
.visual-zone img, .visual-zone video { width: 100%; max-height: 240px; object-fit: contain; background: var(--hatch); border-radius: 2px; }
.visual-zone p { margin: 0; font-size: 12.5px; color: var(--muted); }
.visual-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--ink); background: var(--sheet); border-radius: 2px; padding: 7px 14px; font-weight: 500; font-size: 13px;
}
.btn-primary { background: var(--ink); color: var(--sheet); }
.btn-quiet { border-color: var(--rule-strong); }
.btn-danger { border-color: var(--st-on-hold); color: var(--st-on-hold); }
.btn-danger.is-armed { background: var(--st-on-hold); color: var(--sheet); }
.btn:disabled { opacity: 0.5; cursor: default; }
.drawer-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule);
}
.drawer-foot .spacer { flex: 1; }
.drawer-note { font-size: 12px; color: var(--muted); margin: 0; }

/* ——— Message court ——— */
.toast-region { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.toast {
  background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 2px; font-size: 13px;
  box-shadow: var(--shadow); max-width: min(560px, calc(100vw - 32px));
}
.toast.is-error { background: var(--st-on-hold); color: #fff; }

/* ——— Mobile : liste par jour ——— */
@media (max-width: 759px) {
  .page { padding: 16px 16px 40px; }
  .masthead { grid-template-columns: 1fr; gap: 14px; }
  .stats { gap: 18px; justify-content: space-between; }
  .stat { text-align: left; }
  .stat b { font-size: 32px; }
  .validate-btn { margin-left: 0; }
  .grid { border: 0; background: none; }
  .grid-head { display: none; }
  .grid-week { display: block; }
  .grid-week + .grid-week { border-top: 0; }
  .week-no { text-align: left; padding: 16px 0 6px; border-bottom: 2px solid var(--ink); }
  .week-no small { display: inline; margin-right: 4px; }
  .day { border: 0; border-bottom: 1px solid var(--rule); background: var(--sheet); min-height: 0; padding: 10px 12px; }
  .day.is-weekend { background: var(--weekend); }
  .day.is-outside, .day.is-blank:not(.is-today) { display: none; }
  .day-label { display: inline; font-weight: 600; text-transform: capitalize; }
  .add-btn { opacity: 1; }
  .card { display: grid; grid-template-columns: 96px 1fr; }
  .card-visual { height: 100%; min-height: 96px; }
  .card-novisual { height: auto; min-height: 96px; border-bottom: 0; border-right: 1px solid var(--rule); padding: 6px; text-align: center; }
  .drawer { width: 100vw; border-left: 0; }
  .row-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ——— Connexion ——— */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
}
.login-box { width: min(380px, 100%); background: var(--sheet); border: 1px solid var(--ink); padding: 28px; }
.login-box h1 {
  margin: 0 0 4px; font-family: var(--font-display); font-stretch: 68%; font-variation-settings: 'wdth' 68;
  font-weight: 850; font-size: 46px; line-height: 0.9; text-transform: uppercase;
  padding-bottom: 10px; border-bottom: 3px solid var(--ink);
}
.login-box p { color: var(--muted); font-size: 13px; }
.login-box form { display: grid; gap: 12px; margin-top: 16px; }
.login-error { color: var(--st-on-hold); font-size: 13px; min-height: 1.2em; margin: 0; }

/* ——— Vue semaine ——— */
.week-no { text-decoration: none; color: var(--muted); }
a.week-no:hover { color: var(--ink); background: var(--bg); }
.month-link { font-size: 13px; margin-left: 10px; color: var(--muted); }
.week-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--ink); background: var(--sheet);
}
.wday {
  min-height: 460px; padding: 10px 8px 12px; border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.wday:first-child { border-left: 0; }
.wday.is-weekend { background: var(--weekend); }
.wday.is-drop { background: var(--drop); outline: 2px dashed var(--accent); outline-offset: -3px; }
.wday-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 6px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-strong); }
.wday-name {
  grid-column: 1; font-family: var(--font-display); font-weight: 650; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.wday-no {
  grid-column: 1; font-family: var(--font-display); font-stretch: 75%; font-variation-settings: 'wdth' 75;
  font-weight: 800; font-size: 34px; line-height: 0.95; justify-self: start;
}
.wday.is-today .wday-no { background: var(--accent); color: var(--on-accent); padding: 0 6px; border-radius: 2px; }
.wday-head .add-btn { grid-column: 2; grid-row: 1 / span 2; align-self: end; }
.wday:hover .add-btn, .wday:focus-within .add-btn { opacity: 1; }
.card.is-detailed .card-title { -webkit-line-clamp: 4; }
.card-note {
  margin: 5px 0 0; padding-top: 5px; border-top: 1px dashed var(--rule); color: var(--muted); font-size: 11.5px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}

@media (max-width: 759px) {
  .week-grid { display: block; border: 0; background: none; }
  .wday { min-height: 0; border: 0; border-bottom: 1px solid var(--rule); background: var(--sheet); padding: 12px; }
  .wday-head { grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px; }
  .wday-name { grid-column: 2; grid-row: 1; font-size: 13px; }
  .wday-no { grid-column: 1; grid-row: 1; font-size: 26px; }
  .wday-head .add-btn { grid-column: 3; grid-row: 1; opacity: 1; }
  .wday .card { display: grid; grid-template-columns: 96px 1fr; }
}
.month-tabs button.plain { text-transform: none; }
.week-range {
  display: block; margin-top: 10px; font-size: 0.34em; line-height: 1; font-weight: 600; color: var(--muted);
  font-stretch: 85%; font-variation-settings: 'wdth' 85; letter-spacing: 0;
}
.card.is-detailed .card-meta { flex-wrap: wrap; row-gap: 3px; }
.card.is-detailed .type { flex: 1 1 auto; }

/* ——— Partage ——— */
.share-dialog {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow);
}
.share-dialog::backdrop { background: var(--overlay); }
.share-dialog .drawer-body { padding-bottom: 20px; }
.share-text { margin: 0; font-size: 13.5px; }
.share-dialog input[readonly] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.share-types .filters { margin-top: 4px; }
.share-types .chip { cursor: pointer; }
.share-types .chip.is-checked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--bg); }
.share-types .chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-types .chip.is-checked::after { content: '✓'; font-size: 11px; margin-left: 2px; }

/* ——— Paramètres ——— */
.settings-card {
  margin-top: 22px; max-width: 760px; border: 1px solid var(--ink); background: var(--sheet);
  padding: 18px 20px 20px; display: grid; gap: 14px;
}
.settings-card h2 {
  margin: 0; font-family: var(--font-display); font-stretch: 75%; font-variation-settings: 'wdth' 75;
  font-weight: 800; font-size: 24px; text-transform: uppercase; line-height: 1;
}
.settings-status { padding: 10px 12px; border-radius: 2px; font-size: 13.5px; border-left: 3px solid; }
.settings-status.is-ok { background: var(--st-publie-bg); border-color: var(--st-publie); }
.settings-status.is-local { background: var(--st-a-lancer-bg); border-color: var(--st-a-lancer); }
.settings-status.is-problem { background: var(--st-on-hold-bg); border-color: var(--st-on-hold); }
.settings-status p { margin: 6px 0 0; }
.settings-form { display: grid; gap: 10px; }
.settings-error { margin: 0; color: var(--st-on-hold); font-size: 13px; }
.settings-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
.settings-steps code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg);
  padding: 1px 5px; border: 1px solid var(--rule); border-radius: 2px; overflow-wrap: anywhere;
}
.btn-small { padding: 2px 8px; font-size: 12px; margin-left: 6px; }
