/* MesKDO — feuille de style */
:root {
  --red: #b91c1c; --red-d: #991b1b; --red-l: #fef2f2;
  --green: #15803d; --green-l: #f0fdf4;
  --gold: #b45309; --gold-l: #fffbeb;
  --ink: #1c1917; --muted: #78716c; --line: #e7e5e4;
  --bg: #faf7f2; --card: #fff;
  --radius: 14px; --shadow: 0 1px 2px rgba(28,25,23,.06), 0 4px 14px rgba(28,25,23,.05);
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #f5f5f4; --muted: #a8a29e; --line: #3a3532; --bg: #171412; --card: #221e1b; --red-l: #3b1616; --green-l: #14291b; --gold-l: #33240f; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .7rem; }
.card h2:first-child, .card > h2 { margin-top: .2rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.right { text-align: right; }
.ok { color: var(--green); font-weight: 600; }
.danger { color: var(--red) !important; }
.break { word-break: break-all; }
.grow { flex: 1 1 200px; }

/* ---------- barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; padding-top: max(.55rem, env(safe-area-inset-top));
  background: var(--red); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.brand { display: flex; align-items: center; gap: .45rem; color: #fff; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: .2rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-link { position: relative; display: flex; align-items: center; gap: .35rem; padding: .4rem .65rem; border-radius: 10px; color: #fff; opacity: .9; white-space: nowrap; font-size: .92rem; }
.nav-link:hover { background: rgba(255,255,255,.14); text-decoration: none; opacity: 1; }
.nav-link.on { background: rgba(255,255,255,.22); opacity: 1; font-weight: 600; }
.badge { background: #fbbf24; color: #1c1917; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 0 .4rem; min-width: 1.2rem; text-align: center; }
@media (max-width: 760px) {
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .item-body { padding: .6rem; }
  .item-body h3 { font-size: .92rem; }
  .topbar { flex-wrap: wrap; gap: .3rem; }
  .mainnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); padding: .3rem .3rem max(.3rem, env(safe-area-inset-bottom)); justify-content: space-around; z-index: 30; }
  .nav-link { flex-direction: column; gap: 0; color: var(--ink); font-size: .68rem; padding: .25rem .35rem; }
  .nav-link .ico { font-size: 1.25rem; line-height: 1.2; }
  .nav-link.on { background: var(--red-l); color: var(--red); }
  .nav-link .badge { position: absolute; top: 0; right: 0; }
  body:not(.no-nav) .wrap { padding-bottom: 6rem; }
}

/* ---------- mise en page ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.narrow { max-width: 680px; margin-left: auto; margin-right: auto; }
.auth { max-width: 420px; margin: 2rem auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.actions, .row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row > label { flex: 1 1 140px; }
.row.between { justify-content: space-between; }
.wrap-actions { margin-top: .8rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.inline { display: inline; }
.crumb { margin: 0 0 .8rem; font-size: .92rem; }
.empty { text-align: center; padding: 2rem 1rem; }
.cards-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1rem; }
.mini-card { flex: 1 1 180px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--ink); box-shadow: var(--shadow); }
.mini-card.santa { background: var(--green-l); }
.big-n { display: block; font-size: 1.5rem; font-weight: 800; color: var(--red); }

/* ---------- formulaires ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--red); transform: scale(1.15); }
input[type=color] { padding: .15rem; height: 2.6rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
input.sm { padding: .35rem .5rem; font-size: .85rem; }
.w-sm { flex: 0 1 110px !important; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
legend { font-weight: 700; padding: 0 .3rem; }
.input-btn { display: flex; gap: .4rem; }
.input-btn input { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: 0; border-radius: 10px; padding: .62rem 1rem; font: inherit; font-weight: 600;
  background: var(--red); color: #fff; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--red-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-soft { background: var(--red-l); color: var(--red); }
.btn-soft:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn.big { padding: .9rem 1.4rem; font-size: 1.1rem; width: 100%; margin-top: 1rem; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.pill { flex-direction: row; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 99px; padding: .35rem .8rem; font-weight: 500; cursor: pointer; }
.prio-pick { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
.pill:has(input:checked) { background: var(--red-l); border-color: var(--red); color: var(--red); }
details.sub summary { cursor: pointer; color: var(--red); font-weight: 600; list-style: none; padding: .3rem 0; }
details.sub summary::-webkit-details-marker { display: none; }
details.sub[open] > summary { margin-bottom: .6rem; }
.inline-details { display: inline-block; margin-left: .4rem; }
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 110%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 240px; padding: .4rem; z-index: 10; }
.menu-pop button, .menu-pop a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .55rem .7rem; border-radius: 8px; font: inherit; color: var(--ink); cursor: pointer; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--bg); text-decoration: none; }

/* ---------- messages ---------- */
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1rem; background: var(--green-l); border: 1px solid #bbf7d0; }
.flash-err { background: var(--red-l); border-color: #fecaca; }
.flash-wait, .flash-info { background: var(--gold-l); border-color: #fde68a; }

/* ---------- avatars, étiquettes ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: #fff; font-weight: 700; font-size: .95rem; vertical-align: middle; flex: none; }
.avatar.sm { width: 1.8rem; height: 1.8rem; font-size: .75rem; }
.avatar.xs { width: 1.4rem; height: 1.4rem; font-size: .6rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag-hot { background: var(--red-l); color: var(--red); border-color: transparent; }
.tag-wait { background: var(--gold-l); color: var(--gold); border-color: transparent; }
.tag-no { background: var(--red-l); color: var(--red); border-color: transparent; }
.tag-ok { background: var(--green-l); color: var(--green); border-color: transparent; }
.tag-secret { background: #f3e8ff; color: #7e22ce; border-color: transparent; }
.prio { font-size: .75rem; font-weight: 700; }
.prio.p3 { color: var(--red); }
.prio.p1 { color: var(--muted); font-weight: 500; }

/* ---------- cartes de listes ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.list-card { display: flex; flex-direction: column; gap: .35rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s; min-height: 130px; }
.list-card:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--red); }
.list-card h3 { margin: .1rem 0; font-size: 1.1rem; }
.list-card.add { align-items: center; justify-content: center; border-style: dashed; color: var(--red); font-weight: 600; box-shadow: none; }
.lc-top, .lh-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.occ { font-size: .85rem; color: var(--muted); }
.lc-owner { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--ink); }
.lc-meta { margin-top: auto; font-size: .85rem; color: var(--muted); }
.list-head h1 { margin-top: .4rem; }
.desc { white-space: normal; }
.toolbar { margin: 0 0 1rem; }
.toolbar select { width: auto; }

/* ---------- cadeaux ---------- */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.item { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item.pending { border-style: dashed; }
.item.taken .item-img img { filter: grayscale(.7); opacity: .7; }
.item-img { display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; background: #fff; border-bottom: 1px solid var(--line); }
.item-img img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }
.noimg { font-size: 2.6rem; opacity: .35; }
.noimg.big { font-size: 5rem; }
.item-body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.item-body h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.item-body h3 a { color: var(--ink); }
.item-tags { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 0; }
.item-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; font-size: .88rem; color: var(--muted); }
.price { color: var(--ink); font-weight: 800; }
.price.big { font-size: 1.5rem; margin: .3rem 0 .6rem; }
.site { font-size: .8rem; }
.item-details { font-size: .85rem; }
.note-parent { font-size: .85rem; background: var(--gold-l); border-radius: 8px; padding: .3rem .5rem; }
.res { margin-top: auto; font-size: .85rem; border-radius: 8px; padding: .35rem .55rem; }
.res-free { background: var(--green-l); color: var(--green); font-weight: 600; }
.res-taken { background: var(--bg); color: var(--muted); }
.res-pool { background: #eff6ff; color: #1d4ed8; }
@media (prefers-color-scheme: dark) { .res-pool { background: #172033; color: #93c5fd; } .tag-secret { background: #2e1a40; color: #d8b4fe; } .item-img { background: #fff; } }
.bar { height: 6px; background: rgba(0,0,0,.08); border-radius: 99px; overflow: hidden; margin: .3rem 0 .15rem; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #22c55e); border-radius: 99px; }
.bar.big { height: 12px; }

/* ---------- fiche cadeau ---------- */
.detail { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 1.4rem; }
.detail-img { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; border: 1px solid var(--line); min-height: 220px; }
.detail-img img { max-height: 380px; object-fit: contain; padding: .8rem; }
@media (max-width: 640px) { .detail { grid-template-columns: 1fr; } }
.giver { border: 2px solid #c4b5fd; }
.giver h2 { margin-top: 0; }
.people { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem; }
.people li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .5rem .7rem; background: var(--bg); border-radius: 10px; }
.row-actions { display: flex; gap: .8rem; font-size: .88rem; }
.pool { background: #eff6ff; border-radius: 12px; padding: .8rem 1rem; margin-bottom: .8rem; }
@media (prefers-color-scheme: dark) { .pool { background: #172033; } }
.chat { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.msg { background: var(--bg); border-radius: 12px; padding: .55rem .8rem; margin: .5rem 0; max-width: 85%; }
.msg.me { background: var(--red-l); margin-left: auto; }
.msg-who { font-size: .78rem; font-weight: 600; }
.chat-form { margin-top: .6rem; }
.item-edit { display: flex; gap: 1rem; flex-wrap: wrap; }
.img-pick { flex: 0 0 160px; display: flex; flex-direction: column; gap: .4rem; }
.img-preview { width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.img-pick input[type=file] { font-size: .75rem; padding: .3rem; }

/* ---------- divers ---------- */
.received { display: flex; flex-direction: column; gap: .4rem; }
.rec-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; }
.buy-row { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.buy-row:last-child { border-bottom: 0; }
.buy-row.done strong { text-decoration: line-through; color: var(--muted); }
.checkbox-btn { background: none; border: 0; font-size: 1.4rem; cursor: pointer; padding: 0; }
.members { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.members li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.members li > a { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink); font-weight: 600; }
.link-row { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-top: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.link-row.off { opacity: .55; }
.notifs { display: flex; flex-direction: column; gap: .4rem; }
.notif { display: flex; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; color: var(--ink); }
.notif.unread { border-left: 4px solid var(--red); font-weight: 600; }
.notif:hover { text-decoration: none; border-color: var(--red); }
.approve-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.approve-img { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; }
.approve-img img { width: 100%; height: 100%; object-fit: contain; }
.approve-actions { display: flex; flex-direction: column; gap: .4rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.santa-card { text-align: center; }
.santa-card .members { align-items: center; }
.reveal { margin: 1.4rem 0; }
.reveal.on { animation: pop .5s ease; }
.reveal-name { font-size: 2rem; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .4rem 0 1rem; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.bookmarklet { cursor: grab; }

/* ---------- impression ---------- */
body.print { background: #fff; color: #000; max-width: 760px; margin: 2rem auto; padding: 0 1rem; }
.print-list li { margin-bottom: .7rem; }
@media print { .topbar, .mainnav, .foot { display: none; } }

.occ-quick { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.3rem 0 1.2rem; }
.occ-quick .pill { color: var(--ink); background: var(--card); font-size: .88rem; }
.occ-quick .pill:hover { border-color: var(--red); text-decoration: none; }
