:root {
  --bg: #f4f6f9; --card: #fff; --text: #17202a; --muted: #6b7684; --line: #e2e6ec;
  --accent: #1f6feb; --accent-2: #e8f0fe; --ok: #1a7f37; --warn: #b35900; --bad: #c62828;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --card: #171b22; --text: #e6e9ee; --muted: #8b95a3; --line: #2a303a; --accent: #4c8dff; --accent-2: #1b2638; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--card); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { background: none; border: 0; font-size: 22px; padding: 4px 8px; color: var(--text); cursor: pointer; }
main { max-width: 900px; margin: 0 auto; padding: 12px 16px 100px; }
.hidden { display: none !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
h2 { font-size: 16px; margin: 0 0 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
button.btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--accent); color: #fff; cursor: pointer; }
button.btn.sec { background: var(--accent-2); color: var(--accent); }
button.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
button.btn.small { padding: 7px 11px; font-size: 14px; border-radius: 10px; }
button.btn:disabled { opacity: .5; }
.full { width: 100%; }
.stack > * + * { margin-top: 8px; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 50%; font-size: 30px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 20px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; cursor: pointer; }
.item img, .item .ph { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--muted); }
.item .p { margin-left: auto; font-weight: 700; white-space: nowrap; }
.min { min-width: 0; flex: 1; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--accent-2); color: var(--accent); font-weight: 600; }
.badge.a_valider { background: #fff4e5; color: var(--warn); }
.badge.vendu { background: #e6f4ea; color: var(--ok); }
@media (prefers-color-scheme: dark) { .badge.a_valider { background: #3a2a12; } .badge.vendu { background: #13301c; } }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; cursor: pointer; }
.thumb .cov { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: var(--accent); color: #fff; border-radius: 8px; padding: 1px 6px; }
.thumb .l { position: absolute; left: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.addph { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; padding: 6px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: -4px 0 4px; }
.gallery img { height: 240px; border-radius: 12px; scroll-snap-align: start; flex: none; max-width: 85vw; object-fit: cover; background: var(--line); }
.price { font-size: 30px; font-weight: 800; }
.muted { color: var(--muted); font-size: 14px; }
.conf { font-size: 13px; font-weight: 600; }
.conf.haute { color: var(--ok); } .conf.moyenne { color: var(--warn); } .conf.faible { color: var(--bad); }
.src { font-size: 14px; padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.src a { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.copybox { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; margin: 4px 0 8px; }
.copyrow { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 22px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90vw; font-size: 14px; }
.spinner { width: 44px; height: 44px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }
.warn { background: #fff4e5; color: #6b3a00; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .warn { background: #3a2a12; color: #ffd8a8; } }
ul.tight { margin: 4px 0; padding-left: 20px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); margin: 6px 0; }
.check input { width: auto; }
