:root {
  --bg: #f6f1e8;
  --paper: #fffdf9;
  --ink: #2b2622;
  --muted: #7a7169;
  --line: #e3dbcf;
  --gold: #c9973a;
  --gold-soft: #f4e6c8;
  --ok: #4d7f3f;
  --ok-soft: #e4efdc;
  --danger: #a33a2c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43,38,34,.06), 0 6px 18px rgba(43,38,34,.07);
  --font: "Georgia", "Iowan Old Style", "Palatino", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font); font-weight: 600; margin: 0; letter-spacing: .01em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- barre ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: rgba(246,241,232,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.top-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; max-width: 1200px; margin: 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.brand b { font-family: var(--font); font-size: 22px; }
.brand span { color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a, .nav button {
  background: none; border: 0; padding: 8px 10px; border-radius: 10px;
  text-decoration: none; color: var(--ink); font-size: 15px;
}
.nav a[aria-current="page"] { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.nav a:hover, .nav button:hover { background: rgba(43,38,34,.06); }
.me-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); font-size: 14px;
}
.dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- compteur ---------- */
.counter { max-width: 1200px; margin: 0 auto; padding: 0 16px 10px; }
.counter-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.counter-line .big { font-family: var(--font); font-size: 26px; }
.counter-line .big small { font-size: 16px; color: var(--muted); }
.counter-line .sub { color: var(--muted); font-size: 14px; }
.bar { height: 8px; background: var(--gold-soft); border-radius: 999px; overflow: hidden; margin-top: 6px; position: relative; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); border-radius: 999px; transition: width .4s; }
.bar i.pending { background: repeating-linear-gradient(135deg, #e0c98f 0 6px, #f4e6c8 6px 12px); }
.by-author { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.by-author span b { color: var(--ink); }

/* ---------- filtres ---------- */
.filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; max-width: 1200px; margin: 0 auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .7; margin-left: 4px; }
.toolbar { display: flex; gap: 8px; padding: 6px 16px 0; max-width: 1200px; margin: 0 auto; align-items: center; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 8px 10px; font-size: 15px;
}
.toolbar input { flex: 1; min-width: 0; }

/* ---------- grille ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
  padding: 12px 16px 96px; max-width: 1200px; margin: 0 auto;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; } }
.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; position: relative;
  transition: transform .12s;
}
.card:active { transform: scale(.985); }
.card.validated { outline: 2px solid var(--gold); outline-offset: -2px; }
.card .thumb { aspect-ratio: 1 / 1; background: #ece5d8; position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .glyph {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; color: #b9ad9b;
  font-family: var(--font);
}
.card .thumb .more { position: absolute; right: 8px; bottom: 8px; background: rgba(43,38,34,.75); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 999px; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-family: var(--font); font-size: 17px; line-height: 1.25; }
.card .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 4px; }
.thumbs { display: inline-flex; gap: 3px; align-items: center; }
.thumbs .t {
  width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px;
  border: 1.5px solid var(--line); color: #c7bfb2; background: #fff; font-weight: 700; font-style: normal;
}
.thumbs .t.on { color: #fff; border-color: transparent; }
.badge-ok { margin-left: auto; font-size: 12px; color: var(--ok); background: var(--ok-soft); padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.comments-n { font-size: 12px; color: var(--muted); }
.new { position: absolute; top: 8px; left: 8px; background: var(--gold); color: #2b2622; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.kind { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 600; color: var(--muted); }
.author { display: inline-flex; align-items: center; gap: 4px; }
.author .dot { width: 9px; height: 9px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 16px; font-size: 15px; }

/* ---------- bouton flottant ---------- */
.fab {
  position: fixed; right: 16px; bottom: 20px; z-index: 15;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 14px 20px;
  font-size: 16px; font-weight: 600; box-shadow: 0 8px 24px rgba(43,38,34,.3);
}
.fab:hover { background: #3d3630; }

/* ---------- dialogues ---------- */
dialog {
  border: 0; border-radius: 18px 18px 0 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%;
  max-height: 94vh; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(43,38,34,.45); }
@media (min-width: 720px) {
  dialog { margin: auto; border-radius: 18px; width: min(720px, 94vw); max-height: 90vh; }
}
.sheet { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--paper); z-index: 2;
}
.sheet-head h2 { font-size: 20px; flex: 1; min-width: 0; }
.sheet-body { padding: 16px 18px 24px; overflow: auto; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.x:hover { background: rgba(43,38,34,.06); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input[type=text], .field input[type=url], .field input[type=password], .field textarea, .field select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; background: #fff; width: 100%;
}
.field textarea { min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; background: #fff; cursor: pointer;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { font-weight: 700; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.drop {
  border: 1.5px dashed #cdbfa6; border-radius: 12px; padding: 14px; text-align: center; color: var(--muted); font-size: 14px; background: #fbf8f2;
}
.drop input { display: none; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.previews .pic { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ece5d8; }
.previews img { width: 100%; height: 100%; object-fit: cover; }
.field .caption-input, .caption-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 6px 2px; font-size: 14px; font-style: italic; margin-top: 4px;
}
.field .caption-input:focus, .caption-input:focus { outline: none; border-bottom-color: var(--ink); }
.previews button {
  position: absolute; top: 4px; right: 4px; background: rgba(43,38,34,.8); color: #fff; border: 0; border-radius: 50%; width: 22px; height: 22px; font-size: 13px; line-height: 1;
}
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 600;
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.msg { font-size: 14px; color: var(--danger); min-height: 1.2em; margin-top: 6px; }
.msg.ok { color: var(--ok); }

/* ---------- detail ---------- */
.gallery { display: grid; gap: 8px; margin-bottom: 14px; }
.gallery figure { margin: 0; }
.photo-by { font-size: 12px; color: var(--muted); display: flex; gap: 5px; align-items: center; padding: 6px 2px 0; }
.photo-by .dot { width: 9px; height: 9px; }
.gallery figcaption { font-size: 14px; font-style: italic; color: var(--muted); padding: 6px 2px 0; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; background: #ece5d8; position: relative; }
.gallery img { width: 100%; height: auto; }
.gallery .del { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.9); border: 0; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--danger); font-weight: 600; }
.gallery .cap { position: absolute; left: 8px; bottom: 8px; font-size: 11px; color: #fff; background: rgba(43,38,34,.6); padding: 2px 7px; border-radius: 999px; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.detail-body { white-space: pre-wrap; font-size: 16px; line-height: 1.55; margin-bottom: 12px; }
.detail-link { display: inline-block; margin-bottom: 14px; font-size: 15px; word-break: break-all; }
.vote-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--bg); margin: 8px 0 18px;
}
.vote-box .status { flex: 1; min-width: 160px; font-size: 14px; }
.vote-box .status b { color: var(--ok); }
.thumb-btn {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 18px; font-size: 16px; font-weight: 600;
  display: inline-flex; gap: 8px; align-items: center;
}
.thumb-btn[aria-pressed="true"] { background: var(--ok); color: #fff; border-color: var(--ok); }
.comments h3 { font-size: 17px; margin-bottom: 8px; }
.comment { padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.comment .dot { margin-top: 3px; }
.comment .who { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.comment .who b { color: var(--ink); }
.comment .txt { white-space: pre-wrap; font-size: 15px; word-break: break-word; }
.comment .txt a { color: var(--ink); text-decoration: underline; }
.comment .rm { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 12px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; resize: vertical; }
.owner-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); padding: 28px 24px; width: min(420px, 100%); }
.login-card h1 { font-size: 34px; text-align: center; }
.login-card h1 b { color: var(--gold); }
.login-card p { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 15px; }
.who-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.who-pick label { display: block; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 6px; cursor: pointer; font-weight: 600; }
.who-pick input { position: absolute; opacity: 0; pointer-events: none; }
.who-pick label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.who-pick .dot { display: block; margin: 0 auto 6px; width: 22px; height: 22px; }

/* ---------- plan ---------- */
.plan-wrap { overflow-x: auto; padding: 12px 16px 40px; }
.board { display: flex; gap: 14px; align-items: flex-start; min-height: 60vh; }
.col {
  flex: none; width: 272px; background: #efe8db; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 190px);
}
.col.inbox { background: #e9e2d5; border: 1.5px dashed #cdbfa6; }
.col-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px; cursor: grab; }
.col-head h3 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .n { font-size: 12px; color: var(--muted); background: #fff; border-radius: 999px; padding: 1px 8px; }
.col-head button { background: none; border: 0; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: 14px; }
.col-head button:hover { background: rgba(43,38,34,.08); color: var(--ink); }
.col-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; padding-bottom: 20px; flex: 1; }
.mini {
  background: var(--paper); border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; padding: 8px; cursor: grab;
  touch-action: none; user-select: none;
}
.mini.ghost { opacity: .35; }
.mini.drag { transform: rotate(1.5deg); box-shadow: 0 10px 24px rgba(43,38,34,.25); }
.mini.unvalidated { opacity: .6; border: 1px dashed #cdbfa6; }
.mini .num { font-family: var(--font); font-size: 15px; color: var(--gold); width: 24px; text-align: right; flex: none; }
.mini .pic { width: 44px; height: 44px; border-radius: 8px; background: #ece5d8; flex: none; overflow: hidden; display: grid; place-items: center; color: #b9ad9b; font-size: 20px; }
.mini .pic img { width: 100%; height: 100%; object-fit: cover; }
.mini .t { flex: 1; min-width: 0; }
.mini .t .title { font-size: 14px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini .t .sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 2px; white-space: nowrap; overflow: hidden; }
.mini .t .sub .thumbs { margin-left: auto; }
.add-col { flex: none; width: 240px; border: 1.5px dashed #cdbfa6; border-radius: 14px; background: none; padding: 16px; color: var(--muted); font-size: 15px; }
.plan-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px 0; max-width: none; font-size: 14px; color: var(--muted); }
.plan-tools label { display: inline-flex; gap: 6px; align-items: center; }
.save-state { margin-left: auto; font-size: 13px; color: var(--muted); }
