@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,650&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --ink: #14243a;
  --ink-soft: #55627a;
  --line: #ddd6cb;
  --sea: #1e5d78;
  --sea-soft: #e3eef2;
  --green: #1f8a4c;
  --green-soft: #e3f4ea;
  --red: #c33b2f;
  --red-soft: #fbe6e3;
  --orange: #d9822b;
  --orange-soft: #fdf0e1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 36, 58, .06), 0 6px 24px rgba(20, 36, 58, .07);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--sea); }

/* En-tête */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(244, 241, 236, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand h1 { margin: 0; font: 650 22px/1.1 var(--serif); letter-spacing: -.01em; }
.brand span { color: var(--ink-soft); font-size: 13px; }
.topbar .spacer { flex: 1; }
.who {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px;
}
.who b { font-weight: 600; }
.who button { border: 0; background: var(--sea-soft); color: var(--sea); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

main { padding: 24px clamp(16px, 4vw, 40px) 64px; max-width: 1400px; margin: 0 auto; }

/* Galerie */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; }
.toolbar .count { color: var(--ink-soft); margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  padding: 6px 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; flex: none;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20,36,58,.08), 0 12px 32px rgba(20,36,58,.12); }
.card a { color: inherit; text-decoration: none; }
.thumbwrap { position: relative; }
.card .thumb { display: block; aspect-ratio: 1; background: #e9e4dc; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .meta { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; flex: 1; }
.card .name { flex: 1; min-width: 0; font-weight: 500; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .comments { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
.solde-slot { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; align-items: center; }
.qty {
  display: inline-flex; align-items: center; height: 28px; padding: 0 9px; border-radius: 6px;
  background: rgba(20,36,58,.82); color: #fff; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.qty.none { background: rgba(20,36,58,.55); font-weight: 500; }
.legend .qty.sample { height: 22px; font-size: 12px; padding: 0 7px; box-shadow: none; }

/* Compteur de mon foyer : tuile carrée, en bas à gauche de la vignette */
.mybox {
  position: absolute; left: 8px; bottom: 8px;
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.94); color: var(--sea);
  border: 1.5px solid var(--sea); border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18); overflow: hidden;
}
.mybox.on { background: var(--sea); color: #fff; }
.mybox button {
  border: 0; background: transparent; color: inherit;
  width: 30px; height: 30px; font-size: 18px; line-height: 1; padding: 0;
}
.mybox button:hover:not(:disabled) { background: rgba(30,93,120,.14); }
.mybox.on button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.mybox button:disabled { opacity: .35; cursor: default; }
.mybox button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.mybox output { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }

/* Légende de la galerie */
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: -6px 0 18px; color: var(--ink-soft); font-size: 13px; }
.legend > span { display: inline-flex; align-items: center; gap: 8px; }
.legend .sample { position: static; box-shadow: none; }
.legend .solde.sample { height: 22px; min-width: 28px; font-size: 12px; padding: 0 8px; }
.legend .mybox.sample { background: var(--sea); color: #fff; padding: 2px 6px; }
.legend .mybox.sample output { font-size: 12px; min-width: 14px; }
.empty { text-align: center; color: var(--ink-soft); padding: 80px 0; }

/* Pastille de solde */
.solde {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 28px; padding: 0 10px; border-radius: 999px;
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.solde.pos { background: var(--green); border-color: var(--green); color: #fff; }
.solde.neg { background: var(--red); border-color: var(--red); color: #fff; }
.solde.none { color: var(--ink-soft); background: #f1ede6; }
.solde.big { height: 40px; min-width: 56px; font-size: 18px; padding: 0 16px; }

/* Page objet */
.objnav { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.objnav h2 { margin: 0 auto 0 8px; font: 600 26px/1.2 var(--serif); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 14px;
}
.btn:hover { border-color: #c6bdb0; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:disabled { opacity: .5; cursor: default; }
.btn.icon { padding: 8px 11px; }

.objgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

.viewer {
  position: relative; height: min(68vh, 760px); overflow: hidden;
  background: #1b2433; border-radius: var(--radius) var(--radius) 0 0;
  touch-action: none; user-select: none;
}
.viewer img {
  position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%;
  transform-origin: center center; will-change: transform; -webkit-user-drag: none;
}
.viewer.zoomable { cursor: zoom-in; }
.viewer.zoomed { cursor: grab; }
.viewer.dragging { cursor: grabbing; }
.zoombar {
  position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px;
  background: rgba(20,36,58,.75); padding: 4px; border-radius: 10px;
}
.zoombar button { border: 0; background: transparent; color: #fff; width: 34px; height: 34px; border-radius: 8px; font-size: 18px; }
.zoombar button:hover { background: rgba(255,255,255,.15); }
.zoombar .lvl { color: #fff; font-size: 12px; min-width: 44px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }

.strip { display: flex; gap: 8px; padding: 10px 12px; background: #1b2433; overflow-x: auto; }
.strip button { flex: none; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; opacity: .65; }
.strip button.on { border-color: #fff; opacity: 1; }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.totalrow {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px; border-top: 1px solid var(--line);
}
.totalrow .label { font-weight: 600; }
.totalrow .label small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 13px; }
.totalrow .spacer { flex: 1; }
.soldebox { display: flex; align-items: center; gap: 10px; }
.soldebox .label { text-align: right; }

/* Compteur */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { border: 0; background: transparent; width: 36px; height: 36px; font-size: 14px; color: var(--sea); }
.stepper button:hover:not(:disabled) { background: var(--sea-soft); }
.stepper button:disabled { color: #c3c9d2; cursor: default; }
.stepper output { min-width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.stepper.big button { width: 44px; height: 42px; font-size: 16px; }
.stepper.big output { min-width: 44px; font-size: 20px; }

.households { padding: 8px 0; }
.households h3 { margin: 0; padding: 12px 20px 8px; font: 600 13px/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.hh { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.hh + .hh { border-top: 1px solid #efeae3; }
.hh .n { flex: 1; font-weight: 500; }
.hh.vente { border-top: 1px dashed var(--line); }
.hh.vente .n { color: var(--ink-soft); font-style: italic; }
.hh.mine { background: var(--sea-soft); }
.hh.mine .n::after { content: ' · vous'; color: var(--sea); font-weight: 400; font-size: 13px; }
.hh.nonzero .n { color: var(--ink); }
.sumrow { display: flex; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.sumrow b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Commentaires */
.section { margin-top: 24px; padding: 20px; }
.section h3 { margin: 0 0 14px; font: 600 19px/1.2 var(--serif); }
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg { background: #f8f6f2; border: 1px solid #ece6dc; border-radius: 12px; padding: 10px 14px; }
.msg header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.msg header b { font-weight: 600; }
.msg header time { color: var(--ink-soft); font-size: 12px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.nomsg { color: var(--ink-soft); margin: 0 0 16px; }
textarea {
  width: 100%; min-height: 130px; resize: vertical;
  font: inherit; color: inherit; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
textarea:focus, input:focus { outline: 2px solid var(--sea); outline-offset: 1px; border-color: transparent; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--ink-soft); font-size: 13px; }

details.history { margin-top: 24px; padding: 14px 20px; }
details.history summary { cursor: pointer; font-weight: 600; }
details.history ul { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
details.history li { padding: 6px 0; border-top: 1px solid #efeae3; color: var(--ink-soft); }
details.history li b { color: var(--ink); font-weight: 500; }

/* Choix du nom */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(20,36,58,.55); padding: 16px; }
.modal .box { background: var(--surface); border-radius: 18px; padding: 28px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 6px; font: 600 24px/1.2 var(--serif); }
.modal p { margin: 0 0 20px; color: var(--ink-soft); }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.names button { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; text-align: left; font-weight: 500; }
.names button:hover { border-color: var(--sea); background: var(--sea-soft); }
.names button small { display: block; color: var(--ink-soft); font-weight: 400; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60;
  box-shadow: var(--shadow); font-size: 14px;
}

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { background: var(--surface); padding: 32px; border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 380px; }
.login h1 { margin: 0 0 4px; font: 650 28px/1.15 var(--serif); }
.login p { margin: 0 0 20px; color: var(--ink-soft); }
input[type="password"], input[type="search"], input[type="text"] {
  width: 100%; font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.login .btn { width: 100%; justify-content: center; margin-top: 12px; padding: 11px; }
.error { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 1.2em; }

/* Journal admin */
.logtable { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.logtable th, .logtable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #efeae3; vertical-align: top; }
.logtable th { position: sticky; top: 61px; background: #f8f6f2; font-weight: 600; }
.logtable td.ip { font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
.logtable td.ua { color: var(--ink-soft); max-width: 260px; }
.tablewrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .objgrid { grid-template-columns: 1fr; }
  .viewer { height: 56vh; }
  .brand span { display: none; }
}
@media (max-width: 520px) {
  .toolbar .count { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .mybox button { width: 34px; height: 34px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .objnav h2 { font-size: 20px; }
  .totalrow { padding: 14px; }
  .who { font-size: 13px; }
}

/* ---------- Photos à plusieurs objets (mode liste) ---------- */
.dots { display: inline-flex; gap: 5px; align-items: center; padding: 6px 8px; border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.ok { background: #fff; border: 2px solid var(--line); width: 12px; height: 12px; }
.dot.empty { background: #d9d3c9; }
.dots.big { padding: 8px 10px; }
.dots.big .dot { width: 16px; height: 16px; }
.legend .dots { box-shadow: none; padding: 0; background: none; }
.mybox.lotbox { cursor: pointer; padding: 0 10px; height: 30px; }
.mybox.lotbox button { display: none; }
.mybox.lotbox output { font-size: 13px; font-weight: 600; min-width: 0; }

.sidecol { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.modeline { padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--sea); text-decoration: underline; text-underline-offset: 2px; font-size: 13px; text-align: left; }
.lotside h3 { margin: 0; padding: 14px 20px 8px; font: 600 13px/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.lotstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 20px 16px; }
.lotstats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; background: #f8f6f2; }
.lotstats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.lotstats span { font-size: 12px; color: var(--ink-soft); line-height: 1.25; }
.lotstats .g b { color: var(--green); }
.lotstats .r b { color: var(--red); }

.lothead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lothead h3 { margin: 0; }
.lotsection .hint { margin: 6px 0 14px; color: var(--ink-soft); font-size: 14px; }
.tablescroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.lottable { border-collapse: collapse; width: 100%; font-size: 14px; }
.lottable th { font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 10px 6px; text-align: center; vertical-align: bottom; line-height: 1.2; background: #f8f6f2; border-bottom: 1px solid var(--line); min-width: 64px; }
.lottable th.lbl { text-align: left; padding-left: 12px; min-width: 200px; }
.lottable th.mine, .lottable td.mine { background: var(--sea-soft); }
.lottable th.mine { color: var(--sea); }
.lottable th.vente, .lottable td.vente { font-style: italic; border-left: 1px dashed var(--line); }
.lottable td { border-top: 1px solid #efeae3; padding: 0; text-align: center; }
.lottable tr:first-child td { border-top: 0; }
.lottable td.lbl { text-align: left; position: sticky; left: 0; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.lottable th.lbl { position: sticky; left: 0; z-index: 1; }
.lottable td.lbl input { width: 100%; border: 0; background: transparent; padding: 10px 12px; font: inherit; color: inherit; border-radius: 0; }
.lottable td.lbl input:hover { background: #f8f6f2; }
.lottable td.lbl input:focus { outline: 2px solid var(--sea); outline-offset: -2px; background: #fff; }
.lottable tr.free td.lbl { box-shadow: inset 4px 0 0 var(--green), 1px 0 0 var(--line); }
.lottable tr.double td { background: var(--red-soft); }
.lottable tr.double td.lbl { box-shadow: inset 4px 0 0 var(--red), 1px 0 0 var(--line); background: var(--red-soft); }
.lottable td.cb label { display: flex; align-items: center; justify-content: center; min-height: 42px; cursor: pointer; }
.lottable td.cb input { width: 20px; height: 20px; accent-color: var(--sea); cursor: pointer; }
.lottable tr.double td.cb input:checked { accent-color: var(--red); }
.lottable td.act { width: 1%; white-space: nowrap; padding: 0 6px; }
.lottable .del { border: 0; background: none; color: var(--ink-soft); font-size: 18px; padding: 4px 8px; border-radius: 6px; }
.lottable .del:hover { background: var(--red-soft); color: var(--red); }
.lottable .del.confirm { font-size: 12px; background: var(--red); color: #fff; }
.lotadd { display: flex; gap: 10px; margin-top: 14px; align-items: flex-start; }
.lotadd textarea { min-height: 44px; height: 44px; resize: vertical; flex: 1; }
@media (max-width: 520px) {
  .lottable th.lbl { min-width: 150px; }
  .lotstats { padding-inline: 14px; }
  .lotadd { flex-direction: column; align-items: stretch; }
}

.lottable td.lbl .lbltext { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; font: inherit; color: inherit; line-height: 1.3; cursor: text; }
.lottable td.lbl .lbltext:hover { background: #f8f6f2; }
.lottable td.lbl .lbltext:focus-visible { outline: 2px solid var(--sea); outline-offset: -2px; }
.topbar .brand { min-width: 0; }
.who { flex: none; }
@media (max-width: 520px) {
  .brand h1 { font-size: 18px; }
  .lottable th.lbl, .lottable td.lbl { min-width: 0; width: 46vw; max-width: 46vw; }
  .lottable th { min-width: 52px; font-size: 11px; }
}

/* ---------- Mariel : immédiatement ou plus tard ---------- */
.solde.later { background: var(--orange); border-color: var(--orange); color: #fff; }
.solde.unsure { box-shadow: 0 0 0 3px var(--orange-soft), 0 0 0 4.5px var(--orange); }
.hhwhen { border-top: 1px solid #efeae3; }
.hhwhen .hh { border-top: 0; }
.hh + .hhwhen, .hhwhen + .hh { border-top: 1px solid #efeae3; }
.whenrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 20px 12px; flex-wrap: wrap; }
.whenrow .q { font-size: 13px; color: var(--ink-soft); }
.hhwhen.missing { background: var(--orange-soft); }
.hhwhen.missing .whenrow .q { color: #8a4b0f; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 10px; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--sea); color: #fff; }
.seg button.l.on { background: var(--orange); }
.whenchoice { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.later { background: var(--orange); border-color: var(--orange); color: #fff; }
.legend .solde.later.sample { height: 22px; min-width: 28px; font-size: 12px; padding: 0 8px; }
.legend .solde.unsure.sample { height: 22px; min-width: 28px; font-size: 12px; padding: 0 8px; box-shadow: 0 0 0 2px var(--orange-soft), 0 0 0 3.5px var(--orange); }

/* ---------- Résumé des demandes, toujours visible sur la photo ---------- */
.peek {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-end;
  padding: 26px 8px 8px; padding-right: 96px;
  background: linear-gradient(to top, rgba(20,36,58,.82), rgba(20,36,58,.55) 60%, rgba(20,36,58,0));
}
.chipq {
  display: inline-flex; align-items: baseline; gap: 1px; white-space: nowrap;
  font-size: 11.5px; line-height: 1; padding: 4px 6px; border-radius: 5px;
  background: rgba(255,255,255,.94); color: var(--ink);
}
.chipq b { font-variant-numeric: tabular-nums; }
.chipq.later { background: var(--orange); color: #fff; }
.chipq.unsure { box-shadow: inset 0 0 0 1.5px var(--orange); }
.chipq.vente { font-style: italic; }
.solde-slot, .mybox { z-index: 2; }
.mybox { left: auto; right: 8px; }
@media (max-width: 520px) {
  .peek { padding-right: 84px; gap: 3px; }
  .chipq { font-size: 10.5px; padding: 3px 5px; }
  .mybox button { width: 28px; height: 30px; }
}

.legend .chipq.sample { font-size: 11px; }
@media (max-width: 520px) {
  .topbar { gap: 8px; }
  .topbar .spacer { display: none; }
  .brand { flex: 1 1 auto; }
  .brand h1 { font-size: 15px; line-height: 1.15; }
  .who { padding: 4px 4px 4px 10px; gap: 6px; }
  .who .lbl { display: none; }
  .who button { padding: 4px 8px; font-size: 12px; }
}
.topbar .toplink { text-decoration: none; color: var(--ink); }
.topbar .toplink.on { color: #fff; }

/* Étiquettes qui prend quoi : taille standard, empilées, nom à gauche, quantité à droite */
.peek { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-end; gap: 3px; padding: 30px 8px 8px; }
.chipq { width: 86px; justify-content: space-between; align-items: center; gap: 4px; padding: 4px 6px; font-size: 11.5px; box-sizing: border-box; }
.chipq .cn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipq b { flex: none; text-align: right; }
.legend .chipq.sample { width: 86px; display: inline-flex; }
@media (max-width: 520px) {
  .chipq { width: 74px; font-size: 10.5px; padding: 3px 5px; }
  .legend .chipq.sample { width: 74px; }
}

/* Compteurs des autres foyers : lecture seule */
.stepper.ro { border-style: dashed; background: #f8f6f2; min-width: 108px; justify-content: center; }
.stepper.ro output { color: var(--ink-soft); padding: 0 8px; line-height: 36px; }
.stepper.big.ro { min-width: 132px; }
.stepper.big.ro output { line-height: 42px; }
.hh.nonzero .stepper.ro output { color: var(--ink); }
.lottable td.cb input:disabled { cursor: not-allowed; opacity: .45; }
.lottable td.cb input:disabled:checked { opacity: .85; }
.lottable td.cb:has(input:disabled) label { cursor: not-allowed; }
.stepper button { font-size: 20px; font-weight: 500; line-height: 1; }
.stepper.big button { font-size: 22px; }

.histtable td.acc { white-space: nowrap; color: var(--ink-soft); }
.rsm-banner { padding: 8px max(16px, env(safe-area-inset-left, 0px)); text-align: center; font-size: 13px; background: var(--sea-soft); color: var(--sea); border-bottom: 1px solid var(--line); }
.rsm-banner.warn { background: #fff4d6; color: #5b4300; border-color: #ecd9a0; }

/* ---------- Ajouter un objet ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.addcard { border: 2px dashed #c6bdb0; background: transparent; box-shadow: none; min-height: 100%; aspect-ratio: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px 12px; color: var(--sea); }
.addcard:hover { background: var(--sea-soft); border-color: var(--sea); }
.addcard .plus { font-size: 48px; line-height: 1; font-weight: 300; }
.addcard .addlbl { font-weight: 600; color: var(--ink); }
.addcard .addsub { font-size: 12px; color: var(--ink-soft); }
.addbox { max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.addbox h2 { margin-bottom: 0; }
.addpick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 2px dashed #c6bdb0; border-radius: 12px; cursor: pointer; text-align: center; font-weight: 600; color: var(--sea); }
.addpick:hover, input:focus-visible + .addpick { border-color: var(--sea); background: var(--sea-soft); }
.addpick .plus { font-size: 28px; }
.addpick small { font-weight: 400; color: var(--ink-soft); }
.addpreviews { display: flex; flex-wrap: wrap; gap: 8px; }
.addpreviews:empty { display: none; }
.addthumb { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; }
.addthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.addthumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(20,36,58,.8); color: #fff; font-size: 15px; line-height: 1; padding: 0; }
.addfield { font-weight: 600; font-size: 14px; margin-bottom: -6px; }
.addrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 14px; }
.addcheck { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 14px; cursor: pointer; }
.addcheck input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--sea); }
.addcheck small { display: block; font-weight: 400; color: var(--ink-soft); }
.addstatus { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--ink-soft); }
.addactions { justify-content: flex-end; }
.removeline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; color: var(--ink-soft); font-size: 14px; }
.btn.danger { color: var(--red); border-color: #e8c4bf; }
.btn.danger.confirm { background: var(--red); color: #fff; border-color: var(--red); }

/* ---------- Recherche ---------- */
.searchbar { position: relative; margin-bottom: 16px; max-width: 520px; }
.searchbar input[type="search"] { padding-left: 38px; padding-right: 40px; height: 44px; font-size: 15px; }
.searchbar input[type="search"]::-webkit-search-cancel-button { display: none; }
.searchicon { position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--ink-soft); font-size: 20px; pointer-events: none; }
.searchclear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); font-size: 20px; line-height: 1; }
.searchclear:hover { background: #f1ede6; }
.card .name .hit { display: block; font-size: 12px; font-weight: 400; color: var(--sea); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .name:has(.hit) { -webkit-line-clamp: unset; display: block; }

/* ---------- Renommer un objet ---------- */
.titlewrap { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 8px; min-width: 0; flex: 1; }
.titlewrap h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.renamebtn { border: 1px solid transparent; background: transparent; color: var(--ink-soft); font-size: 18px; width: 34px; height: 34px; border-radius: 8px; flex: none; }
.renamebtn:hover { border-color: var(--line); background: var(--surface); color: var(--sea); }
.titlewrap input[type="text"] { flex: 1; min-width: 0; font: 600 20px/1.2 var(--serif); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 520px) { .objnav { flex-wrap: wrap; } .titlewrap { order: 5; flex-basis: 100%; margin: 6px 0 0; } }

.qty-slot { position: absolute; top: 10px; left: 10px; z-index: 2; }

/* ---------- Mode d'emploi ---------- */
.help { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.help summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; padding: 14px 18px; font: 600 18px/1.2 var(--serif); }
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: '▸'; font-size: 14px; color: var(--sea); transition: transform .15s; }
.help[open] summary::before { transform: rotate(90deg); }
.help summary small { font: 400 12px var(--sans); color: var(--ink-soft); }
.hbody { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 28px; padding: 0 18px 18px; }
.hstep { min-width: 0; }
.hstep:nth-child(2) { grid-row: span 2; }
.hstep h3 { margin: 0 0 6px; font: 600 14px/1.3 var(--sans); color: var(--ink); }
.hstep p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.5; max-width: 62ch; }
.hstep .hnote { margin-top: 10px; }
.hgrid { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hsample { position: relative; width: 150px; height: 150px; flex: none; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #c9b8a2, #8f7b66 55%, #5d4d40); }
.hsample::after { content: ''; position: absolute; inset: auto 0 0 0; height: 60%; background: linear-gradient(to top, rgba(20,36,58,.8), rgba(20,36,58,0)); }
.hsample > * { z-index: 1; }
.hsample .qty { position: absolute; top: 8px; left: 8px; height: 24px; font-size: 12px; padding: 0 7px; }
.hsample .solde { position: absolute; top: 8px; right: 8px; height: 24px; min-width: 30px; font-size: 12px; padding: 0 8px; }
.hsample .hpeople { position: absolute; left: 8px; bottom: 8px; z-index: 2; }
.hsample .chipq { width: 56px; font-size: 10.5px; padding: 3px 5px; }
.hsample .mybox { position: absolute; right: 8px; bottom: 8px; left: auto; z-index: 2; pointer-events: none; }
.hsample .mybox button { width: 20px; height: 24px; font-size: 14px; }
.hsample .mybox output { min-width: 14px; font-size: 12px; }
.hn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.hsample .hn { position: absolute; z-index: 3; box-shadow: 0 0 0 2px #fff; }
.hsample .h1 { top: 34px; left: 12px; }
.hsample .h2 { top: 34px; right: 12px; }
.hsample .h3 { bottom: 36px; left: 12px; }
.hsample .h4 { bottom: 36px; right: 12px; }
.hlist { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.hc { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.hc strong { font-weight: 600; margin-right: 4px; }
.hc span { color: var(--ink-soft); }
@media (max-width: 520px) { .hbody { padding: 0 14px 14px; } .help summary { padding: 12px 14px; } .hstep:nth-child(2) { grid-row: auto; } }
