:root {
  --bg: #0b0c0f; --panel: #14171d; --panel2: #181b22; --line: #262b35; --text: #e8eaf0; --muted: #9aa3b2;
  --accent: #2dd4bf; --accent-ink: #062b27; --danger: #f87171; --warn: #fbbf24; --ok: #34d399; --violet: #a78bfa;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, sans-serif; }
header { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.logo { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.sp { flex: 1; }
main { max-width: 1480px; margin: 0 auto; padding: 28px 24px 80px; }
h2 { margin: 0; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px;
  padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--text); }

.qbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px;
  background: rgba(45, 212, 191, .1); border-bottom: 1px solid var(--accent); color: var(--accent); }

/* Liste des lots */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead h2 { font-size: 28px; }
.sect { color: var(--warn); font-size: 13px; margin: 24px 0 10px; }
.sect.done { color: var(--muted); }
.lotrow { display: flex; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; cursor: pointer; }
.lotrow:hover { border-color: #3a4150; }
.lthumbs { display: flex; flex: none; min-width: 130px; }
.lthumbs img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #000; margin-left: -6px; }
.lthumbs img:first-child { margin-left: 0; }
.lmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lmeta strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lmeta span { color: var(--muted); font-size: 12px; }
.lbadges { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.lbadges .badge { margin-left: 0; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.x:hover { color: var(--danger); }
.empty { border: 2px dashed var(--line); border-radius: 14px; padding: 40px; text-align: center; color: var(--muted); }

.badge { font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ready { color: var(--ok); border-color: var(--ok); background: rgba(52, 211, 153, .08); }
.badge.tranche, .badge.error { color: var(--warn); border-color: var(--warn); background: rgba(251, 191, 36, .08); }
.badge.generating { color: var(--accent); border-color: var(--accent); }
.badge.published { color: var(--violet); border-color: var(--violet); }

/* Détail d'un lot */
.back { margin-bottom: 8px; }
.lothead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lothead h2 { font-size: 28px; }
.lotsub { margin: 6px 0 0; color: var(--muted); }
.lotsub .linkbtn { text-decoration: underline; }
.bar2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 22px 0 14px; }
.chips { display: flex; gap: 14px; align-items: center; }
.chip { font-weight: 600; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.vio { color: var(--violet); }
.chip em { font-style: normal; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; margin-left: 6px; color: var(--muted); font-weight: 400; }

.prog { margin: 0 0 14px; color: var(--accent); font-size: 13px; }
.prog .track { height: 4px; background: var(--line); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.prog .track i { display: block; height: 100%; background: var(--accent); }

.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 10px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab em { font-style: normal; font-size: 12px; background: var(--panel2); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }

/* Tableau des annonces */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { border-collapse: collapse; min-width: 1600px; width: 100%; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); padding: 12px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 10px; vertical-align: top; border-bottom: 1px solid var(--line); }
tr.grp td { background: var(--bg); font-weight: 700; padding: 14px 10px 8px; border-bottom: 0; }
tr.grp.ready td { color: var(--ok); } tr.grp.tranche td { color: var(--warn); } tr.grp.gen td { color: var(--accent); } tr.grp.pub td { color: var(--violet); }
tr.grp td em { font-style: normal; font-weight: 400; background: var(--panel2); border-radius: 6px; padding: 1px 7px; margin-left: 6px; color: var(--muted); }
.pcell { display: flex; gap: 6px; }
.pcell img.big { width: 92px; height: 112px; object-fit: cover; border-radius: 8px; background: #000; }
.pcell .smalls { display: flex; flex-direction: column; gap: 6px; }
.pcell .smalls img { width: 48px; height: 53px; object-fit: cover; border-radius: 6px; background: #000; }
td input, td textarea, td select, .grid input { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 8px; font: inherit; width: 100%; }
td textarea { min-height: 92px; resize: vertical; }
td textarea.title { min-height: 60px; font-weight: 600; }
td input.price { text-align: center; font-weight: 600; }
td .note { margin: 6px 0 0; color: var(--warn); font-size: 12px; }
td .err { margin: 6px 0 0; color: var(--danger); font-size: 12px; }
.acts { display: flex; flex-direction: column; gap: 6px; }

/* Groupes de photos */
.gcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.ghead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ghead span { color: var(--muted); }
.gphotos { display: flex; gap: 8px; flex-wrap: wrap; }
.gphotos figure { margin: 0; position: relative; }
.gphotos img { width: 96px; height: 110px; object-fit: cover; border-radius: 8px; background: #000; display: block; }
.gphotos figure button { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .7); color: #fff; border: 0;
  border-radius: 6px; padding: 2px 6px; font-size: 11px; cursor: pointer; }

.chk { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.chk input { width: auto; }
.mk { margin-top: 6px; font-size: 12px; color: var(--accent); line-height: 1.35; }
.mk span { color: var(--muted); }
.mk.err { color: var(--muted); }
.mk .linkbtn { color: var(--accent); text-decoration: underline; margin-left: 4px; }
.webnote { margin: -8px 0 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Dialogues */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: 460px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin: 0 0 12px; font-size: 17px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
dialog input, dialog textarea, dialog select { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; font: inherit; width: 100%; }
.hint { color: var(--muted); font-size: 12px; margin: -2px 0 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 50; }
/* Téléphone : le tableau devient une pile de cartes */
@media (max-width: 820px) {
  header { padding: 12px 14px; }
  main { padding: 16px 12px 90px; }
  .pagehead h2, .lothead h2 { font-size: 22px; }
  .pagehead .row, .lothead .row, .bar2 .row { width: 100%; }
  .pagehead .btn, .lothead .btn, .bar2 .btn { flex: 1 1 auto; }
  .lotrow { flex-wrap: wrap; gap: 10px; }
  .lbadges { flex-wrap: wrap; gap: 8px; width: 100%; }
  .lmeta { flex: 1 1 140px; }
  .tabs { gap: 18px; }
  .tablewrap { overflow: visible; border: 0; background: none; }
  table, tbody, tr, td { display: block; width: 100%; min-width: 0; }
  colgroup, thead { display: none; }
  tr.grp td { padding: 16px 2px 6px; }
  tr[data-id] { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
  td { border: 0; padding: 6px 0; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
  .pcell img.big { width: 120px; height: 140px; }
  .acts { flex-direction: row; flex-wrap: wrap; }
  .two { grid-template-columns: 1fr; }
  dialog { width: calc(100vw - 24px); max-height: 90vh; overflow: auto; }
  td input, td textarea, td select, dialog input, dialog textarea, dialog select { font-size: 16px; }
}

body.dropping::after { content: 'Dépose tes photos ou ton dossier ici'; position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--accent);
  background: rgba(11, 12, 15, .88); border: 3px dashed var(--accent); }

/* Choix des imports */
dialog.wide { width: 720px; max-width: calc(100vw - 24px); max-height: 92vh; overflow: auto; }
.stbar { align-items: center; margin-bottom: 10px; }
.stlist { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 12px; background: var(--bg); }
.stdir { margin-bottom: 10px; }
.stdir > .sthead { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 2px; position: sticky; top: 0; background: var(--bg); }
.stdir .sthead span { color: var(--muted); font-weight: 400; }
.stgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.stph { position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); cursor: pointer; background: #000; }
.stph img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .35; }
.stph.on { border-color: var(--accent); }
.stph.on img { opacity: 1; }
.stph i { position: absolute; top: 2px; right: 3px; font-style: normal; font-size: 12px; color: var(--accent); text-shadow: 0 0 3px #000; }
.stdir input[type=checkbox] { width: auto; }
.qrout { text-align: center; margin: 12px 0; }
.qrout canvas { width: 260px; height: 260px; max-width: 100%; image-rendering: pixelated; border-radius: 8px; background: #fff; }
.qrout input { font-size: 12px; margin-bottom: 8px; }
.pbinfo { color: var(--accent); }

/* Gestion des photos */
.gmanage { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; background: rgba(45, 212, 191, .08);
  border: 1px solid var(--accent); border-radius: 10px; position: sticky; top: 0; z-index: 5; }
.gmanage select { width: auto; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; font: inherit; }
.gcard.over { border-color: var(--accent); background: rgba(45, 212, 191, .06); }
.gphotos figure { cursor: grab; border: 2px solid transparent; border-radius: 10px; }
.gphotos figure.sel { border-color: var(--accent); }
.gphotos figure.cover::after { content: 'Couverture'; position: absolute; left: 4px; top: 4px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }
.gphotos figure.dragging { opacity: .4; }
.gphotos .ftools { position: absolute; left: 4px; bottom: 4px; right: 4px; display: flex; gap: 3px; justify-content: space-between; }
.gphotos .ftools button { position: static; padding: 2px 6px; font-size: 13px; }
.badge.stale { color: var(--warn); border-color: var(--warn); }

[hidden] { display: none !important; }

/* Modèle d'annonce */
dialog h3 { margin: 14px 0 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tchip { display: inline-flex; align-items: center; gap: 2px; background: var(--panel2); border: 1px solid var(--violet); color: var(--text);
  border-radius: 8px; padding: 2px 4px 2px 9px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.tchip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 5px; font-size: 14px; }
.tchip button:hover { color: var(--text); }
.tadd { background: transparent; border: 1px dashed var(--line); color: var(--muted); border-radius: 8px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.tadd:hover { color: var(--text); border-color: var(--muted); }
.prevout { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; color: var(--text); margin: 10px 0 0; max-height: 240px; overflow: auto; }
.prevout:empty { display: none; }

/* Éditeur d'annonce */
.edbody { max-height: 68vh; overflow: auto; padding-right: 4px; }
.edtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ephotos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ephotos figure { margin: 0; position: relative; cursor: grab; border: 2px solid transparent; border-radius: 10px; }
.ephotos figure.cover { border-color: var(--violet); }
.ephotos figure.dragging { opacity: .4; }
.ephotos img { width: 104px; height: 124px; object-fit: cover; border-radius: 8px; background: #000; display: block; }
.ephotos .ftools { position: absolute; left: 3px; right: 3px; bottom: 3px; display: flex; gap: 2px; justify-content: space-between; }
.ephotos .ftools button { background: rgba(0, 0, 0, .72); color: #fff; border: 0; border-radius: 6px; padding: 2px 6px; font-size: 13px; cursor: pointer; }
.cnt { float: right; color: var(--muted); }
#dlgEdit label { margin-bottom: 12px; }
#dlgEdit .row.end .sp { flex: 1; }

/* ===== Interface simplifiée (liste compacte) ===== */
main { max-width: 860px; padding-bottom: 120px; }
.topbtns { margin-bottom: 8px; }
.pagehead h2 { font-size: 30px; }
.lotrow { display: block; padding: 14px 16px; border-radius: 16px; background: var(--panel); }
.lotmain { display: flex; align-items: center; gap: 14px; }
.lotrow .chev { color: var(--muted); font-size: 24px; }
.lotrow .lbadges { margin-top: 10px; flex-wrap: wrap; gap: 10px; }
.lotrow .stat { color: var(--muted); }
.lotrow .x { margin-left: auto; font-size: 20px; }
.lthumbs { min-width: 110px; }
.lthumbs img { width: 52px; height: 52px; border-radius: 8px; }
.qcard { margin-top: 12px; }
.qrow { display: flex; justify-content: space-between; color: var(--accent); font-size: 15px; }
.mono { font-family: ui-monospace, monospace; }
.bar { height: 6px; background: var(--line); border-radius: 6px; margin: 8px 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar.solid { background: var(--ok); height: 3px; margin: 12px 0 6px; }
.qsub { color: var(--muted); font-size: 12px; }
.qsub b { color: var(--warn); font-weight: 600; }

.lothdr { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lothdr h2 { font-size: 24px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hicons { display: flex; gap: 6px; align-items: center; }
.iconbtn { background: transparent; color: var(--text); border: 0; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 8px; list-style: none; line-height: 1; }
.iconbtn:hover { background: var(--panel2); }
.menu { position: relative; }
.menu summary::-webkit-details-marker { display: none; }
.menubox { position: absolute; right: 0; top: 36px; z-index: 20; min-width: 250px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); display: flex; flex-direction: column; }
.menubox button { background: none; border: 0; color: var(--text); text-align: left; padding: 10px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
.menubox button:hover { background: var(--panel); }
.menubox .chk { padding: 8px 12px; margin: 0; }
.setbar { display: flex; justify-content: space-between; width: 100%; background: transparent; border: 0; color: var(--muted); padding: 10px 2px; font: inherit; cursor: pointer; text-align: left; }
.setbar:hover { color: var(--text); }

.sect { font-weight: 600; margin: 20px 0 8px; }
.sect.ready { color: var(--ok); } .sect.tranche { color: var(--warn); } .sect.gen { color: var(--accent); } .sect.pub { color: var(--violet); }
.llist { display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.lrow:hover { background: rgba(255, 255, 255, .025); }
.lth { position: relative; flex: none; }
.lth img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: #000; display: block; }
.lth .cnt { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.lmain { flex: 1; min-width: 0; }
.lt { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, .15); }
.lp { font-size: 18px; font-weight: 600; white-space: nowrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); margin-left: 4px; }
.tag.warn { color: var(--warn); border-color: var(--warn); } .tag.err { color: var(--danger); border-color: var(--danger); }
.tag.ok { color: var(--ok); border-color: var(--ok); } .tag.vio { color: var(--violet); border-color: var(--violet); } .tag.gen { color: var(--accent); border-color: var(--accent); }
.lotsub { margin: 0 0 4px; font-size: 12px; color: var(--muted); }

.cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(11, 12, 15, 0)); display: flex; justify-content: center; }
.cta .btn.big { width: 100%; max-width: 820px; padding: 16px; font-size: 16px; border-radius: 14px; background: var(--violet); color: #14102b; }
.cta .btn.big:disabled { opacity: .4; }
.tabs { margin-top: 4px; }
@media (max-width: 820px) {
  .lrow, .lrow td { display: flex; }
  .lrow { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 0; margin: 0; }
  .lotrow { display: block; }
}
.lthumbs { width: 130px; min-width: 130px; }
#toast { bottom: 96px; max-width: calc(100vw - 32px); }

.hstats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); margin: 6px 0 12px; }
.hstats b { color: var(--text); }
.lrow.nohover { cursor: default; }
.lrow.nohover:hover { background: none; }
[data-hfilter] { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 10px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.on[data-hfilter], [data-hfilter].on { color: var(--text); border-bottom-color: var(--accent); }
