:root {
  --paper: #f3f5f2;
  --surface: #ffffff;
  --ink: #17263a;
  --muted: #5e6b7c;
  --line: #d6ddd8;
  --live: #1f7a5c;
  --live-soft: #e2f1ea;
  --soon: #b0620f;
  --soon-soft: #fbeedd;
  --wait: #7a8494;
  --wait-soft: #eceef1;
  --focus: #2f6fd6;
  --danger: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121a24; --surface: #1a2431; --ink: #e8edf2; --muted: #9aa7b6; --line: #2c3a4b;
    --live: #5cc79f; --live-soft: #173529; --soon: #f0a34d; --soon-soft: #3a2a16;
    --wait: #9aa4b2; --wait-soft: #232e3b; --focus: #7aa7f0; --danger: #f08a82;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121a24; --surface: #1a2431; --ink: #e8edf2; --muted: #9aa7b6; --line: #2c3a4b;
  --live: #5cc79f; --live-soft: #173529; --soon: #f0a34d; --soon-soft: #3a2a16;
  --wait: #9aa4b2; --wait-soft: #232e3b; --focus: #7aa7f0; --danger: #f08a82;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.5;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* En-tête + frise des publications */
.top { padding: 56px 0 28px; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 800; line-height: .95; letter-spacing: -.03em; margin: 0 0 14px; }
.lede { max-width: 56ch; color: var(--muted); margin: 0 0 8px; font-size: 1.1rem; }


/* Vignettes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.grid { padding-bottom: 40px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.chip { font: inherit; font-size: .92rem; font-weight: 600; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .7; }

.hint { color: var(--muted); font-size: .9rem; margin: -8px 0 12px; }
.theme-list { list-style: none; margin: 0 0 12px; padding: 0; }
.theme-list li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.theme-list input { flex: 1; min-width: 0; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.theme-list .nb { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.btn:disabled { opacity: .35; cursor: default; }
.add-theme input { flex: 1; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 22px 18px; color: inherit; text-decoration: none; min-height: 220px;
  border-top: 6px solid var(--wait);
}
.tile.disponible { border-top-color: var(--live); }
.tile.prevu { border-top-color: var(--soon); }
a.tile { cursor: pointer; transition: transform .15s ease, border-color .15s ease; }
a.tile:hover { transform: translateY(-3px); border-color: var(--live); border-top-color: var(--live); }
.tile .ico { font-size: 2.4rem; line-height: 1; }
.tile h3 + p { margin-top: 0; }
.tile h3 { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.tile p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; }
.tile.attente .ico, .tile.attente h3 { opacity: .55; }

.status { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.disponible { color: var(--live); background: var(--live-soft); }
.status.prevu { color: var(--soon); background: var(--soon-soft); }
.status.attente { color: var(--wait); background: var(--wait-soft); }
.open { font-weight: 600; color: var(--live); font-size: .95rem; }

/* Gestion */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; padding: 12px 16px; border: 1px dashed var(--ink); border-radius: 12px; }
.toolbar strong { margin-right: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; font-size: .8rem; color: var(--muted); }
.stats b { display: block; font-size: 1.2rem; color: var(--ink); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; }
.spark i { flex: 1; background: var(--live); opacity: .75; border-radius: 1px; min-height: 1px; }
.admin-row { display: flex; gap: 6px; }
.admin-row .spacer { display: none; }

.btn { font: inherit; font-size: .9rem; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .8rem; }
.linkbtn { font: inherit; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }
.foot { padding: 20px 20px 40px; font-size: .85rem; }
.empty { color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 24px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 20, 30, .45); }
dialog h2 { margin: 0 0 16px; font-size: 1.35rem; }
dialog label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 12px; }
dialog input, dialog select, dialog textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 1rem; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.row { display: flex; gap: 12px; }
.grow { flex: 1; }
.icon-field { width: 80px; }
.icon-field input { text-align: center; font-size: 1.4rem; padding: 4px; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.spacer { flex: 1; }
.err { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: 0; }

@media (max-width: 560px) {
  .top { padding-top: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* Case « publier automatiquement » */
dialog label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; flex-wrap: wrap; }
dialog label.check input { display: inline-block; width: auto; margin: 3px 0 0; padding: 0; accent-color: currentColor; }
dialog label.check small { flex-basis: 100%; padding-left: 24px; font-weight: 400; opacity: .7; }
