:root {
  --navy: #1A2B44;
  --gold: #B8894A;
  --gold-soft: #F4EDE3;
  --grey: #6B6B6B;
  --line: #E3E1DC;
  --bg: #FAFAF8;
  --card: #FFFFFF;
  --danger: #A33A2B;
  --ok: #2F6B4F;
  --font: Futura, "Futura PT", "Century Gothic", "Avenir Next", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--navy); font-family: var(--font); font-size: 14px; }
a { color: var(--navy); }
.topbar { display: flex; align-items: center; gap: 28px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { letter-spacing: .32em; font-weight: 700; font-size: 12px; text-decoration: none; }
.brand span { color: var(--gold); }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a { text-decoration: none; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); padding: 4px 0; border-bottom: 2px solid transparent; }
.topbar nav a.on, .topbar nav a:hover { color: var(--navy); border-color: var(--gold); }
.topbar form { margin: 0; }
.user { color: var(--grey); font-size: 12px; }
main { padding: 28px; max-width: 1400px; margin: 0 auto; }
main.wide { max-width: none; padding: 0; }
h1 { font-size: 22px; letter-spacing: .06em; margin: 0 0 6px; }
h2 { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); margin: 28px 0 12px; font-weight: 700; }
.muted { color: var(--grey); }
.small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #FCFBF8; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--navy); background: var(--navy); color: #fff; padding: 7px 14px; border-radius: 4px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #24395A; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--gold-soft); }
.btn.gold { background: var(--gold); border-color: var(--gold); }
.btn.gold:hover { background: #A67A40; }
.btn.danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=search], select, input[type=file] { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--navy); }
input[type=text]:focus, select:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
label { font-size: 12px; color: var(--grey); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.flash { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 14px; margin-bottom: 18px; border-radius: 3px; }
.tag { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #EEF0F4; color: var(--navy); margin: 1px 2px 1px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; user-select: none; background: #fff; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.login { max-width: 360px; margin: 12vh auto; }
.login h1 { margin-bottom: 18px; }
.login input { width: 100%; }

/* --------- planches de vignettes */
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.vign { background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; position: relative; }
.vign img { width: 100%; aspect-ratio: 4/3; object-fit: contain; display: block; background: #F3F2EE; }
.vign .num { position: absolute; top: 6px; left: 6px; background: rgba(26,43,68,.85); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 3px; }
.vign .meta { padding: 7px 9px; font-size: 11px; color: var(--grey); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.vign.off img { opacity: .25; filter: grayscale(1); }
.vign.off .meta { text-decoration: line-through; }
.vign .tags { padding: 0 9px 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.vign .tags .chip { font-size: 10px; padding: 1px 6px; }
.noimg { width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: #F3F2EE; color: var(--grey); font-size: 11px; text-align: center; padding: 8px; }

/* --------- composeur */
.composer { display: grid; grid-template-columns: 230px 1fr 400px; height: calc(100vh - 53px); }
.pages { border-right: 1px solid var(--line); background: #fff; overflow: auto; padding: 14px 12px; }
.pages .pg { border: 1px solid var(--line); border-radius: 4px; padding: 8px 9px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.pages .pg.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.pages .pg .t { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.pages .pg .mini { display: grid; gap: 2px; margin-top: 6px; height: 46px; }
.pages .pg .mini div { background: #EFEDE8 center/cover no-repeat; }
.pages .pg .warn { color: var(--danger); font-size: 11px; }
.stage { overflow: auto; padding: 22px 26px; }
.stagebar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.stagebar input.title { flex: 1; min-width: 220px; font-size: 15px; }
.paper { background: #fff; box-shadow: 0 2px 14px rgba(26,43,68,.12); position: relative; width: 100%; aspect-ratio: 14400 / 8100; container-type: inline-size; }
.paper .hd { position: absolute; left: 5%; right: 5%; top: 4.3%; border-bottom: 1px solid var(--navy); padding-bottom: .9cqw; display: flex; justify-content: space-between; }
.paper .hd b { font-size: .75cqw; letter-spacing: .4em; }
.paper .hd span { font-size: .7cqw; letter-spacing: .3em; color: var(--grey); }
.paper .lc { position: absolute; left: 5%; top: 17.2%; width: 26.39%; }
.paper .lc .no { font-size: 3.9cqw; color: var(--gold); line-height: 1; font-weight: 300; }
.paper .lc .sub { font-size: .9cqw; font-weight: 700; letter-spacing: .2em; margin-top: .3cqw; }
.paper .lc .rule { border-bottom: 1.5px solid var(--navy); margin: 3.4cqw 0 1.2cqw; }
.paper .lc .ttl { font-size: .62cqw; font-weight: 700; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; margin-bottom: .3cqw; }
.paper .lc .lg { font-size: .78cqw; font-style: italic; color: var(--grey); font-family: Cambria, Georgia, serif; line-height: 1.45; }
.paper .grid { position: absolute; left: 33.89%; top: 17.2%; width: 61.11%; aspect-ratio: 8800 / 4968; }
.slot { position: absolute; background: #F1EFEA; overflow: hidden; cursor: pointer; outline-offset: -2px; }
.slot.sel { outline: 3px solid var(--gold); }
.slot.drop { outline: 3px dashed var(--navy); }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: grab; user-select: none; -webkit-user-drag: none; }
.slot img.moving { cursor: grabbing; }
.slot .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #A9A49A; font-size: 1cqw; text-align: center; padding: 4px; }
.slot .badge { position: absolute; left: 4px; top: 4px; font-size: 10px; background: rgba(255,255,255,.9); padding: 1px 5px; border-radius: 2px; color: var(--navy); }
.slot .lowres { position: absolute; right: 4px; bottom: 4px; font-size: 10px; background: var(--danger); color: #fff; padding: 1px 5px; border-radius: 2px; }
.slot .x { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--navy); cursor: pointer; display: none; font-size: 13px; line-height: 20px; padding: 0; }
.slot:hover .x { display: block; }
.paper .ft { position: absolute; left: 5%; right: 5%; bottom: 13%; border-top: 1px solid #ccc; }
.hint { margin-top: 12px; font-size: 12px; color: var(--grey); }
.legends-edit { margin-top: 14px; }
.legends-edit textarea { width: 100%; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: 4px; min-height: 92px; }
.picker { border-left: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.picker .filters { padding: 12px; border-bottom: 1px solid var(--line); }
.picker .filters .row { margin-bottom: 8px; }
.picker .list { flex: 1; overflow: auto; padding: 10px 12px 30px; }
.picker .group { margin-bottom: 14px; }
.picker .group h4 { font-size: 11px; margin: 0 0 6px; color: var(--navy); font-weight: 600; letter-spacing: .04em; }
.picker .thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.picker .thumbs .th { position: relative; cursor: pointer; }
.picker .thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 2px; }
.picker .thumbs .th.used img { opacity: .35; }
.picker .thumbs .th .o { position: absolute; bottom: 2px; right: 2px; font-size: 9px; background: rgba(255,255,255,.88); padding: 0 4px; border-radius: 2px; }
.picker .thumbs .th .n { position: absolute; top: 2px; left: 2px; font-size: 9px; background: rgba(26,43,68,.8); color: #fff; padding: 0 4px; border-radius: 2px; }
.savestate { font-size: 12px; color: var(--grey); }
.modal { position: fixed; inset: 0; background: rgba(26,43,68,.35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal .card { width: min(620px, 92vw); max-height: 80vh; overflow: auto; }
.report li { margin: 4px 0; }
.ok { color: var(--ok); }
.ko { color: var(--danger); }
.synclog { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: #F6F5F1; padding: 10px; border-radius: 4px; max-height: 220px; overflow: auto; white-space: pre-wrap; }

/* --------- formulaire de proposition */
.form-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 53px); }
.form-nav { border-right: 1px solid var(--line); background: #fff; padding: 16px 14px; position: sticky; top: 53px; height: calc(100vh - 53px); overflow: auto; }
.form-nav .namefield { width: 100%; font-weight: 600; font-size: 15px; }
.form-nav nav a { display: block; text-decoration: none; padding: 6px 4px; font-size: 13px; color: var(--grey); border-left: 2px solid transparent; padding-left: 8px; }
.form-nav nav a:hover { color: var(--navy); border-color: var(--gold); }
.form-nav .checks { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.form-main { padding: 24px 32px 80px; max-width: 1080px; }
.fcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 22px 20px; margin-bottom: 18px; scroll-margin-top: 70px; }
.fcard h2 { margin-top: 18px; }
.fcard h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); margin: 20px 0 8px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.fgrid .span2 { grid-column: span 2; }
.fgrid label, .fcard > div > label { display: block; margin-bottom: 3px; }
.fgrid input[type=text], .fgrid input[type=date], .fgrid select, .fgrid textarea, .fcard textarea { width: 100%; }
textarea { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--navy); resize: vertical; }
input[type=date] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--navy); }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--navy); }
.ftable input[type=text] { padding: 4px 6px; }
.ftable td.num, .ftable th.num { text-align: right; white-space: nowrap; }
.ftable.calc td { font-size: 12px; padding: 5px 8px; }
.ftable.calc tr.sub td { font-weight: 600; background: #F6F5F1; }
.ftable.calc tr.tot td { font-weight: 700; background: var(--gold); color: #fff; }
.member { display: grid; grid-template-columns: 26px 200px 1fr 34px; gap: 8px; align-items: start; margin-bottom: 8px; }
.member textarea { width: 100%; }
.warn-box { color: var(--danger); font-size: 12px; margin: 6px 0; }
.totalline { margin-top: 10px; font-size: 14px; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.types label.type { border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; cursor: pointer; display: block; color: var(--navy); font-size: 13px; }
.types label.type input { margin-right: 6px; }
.types label.type.disabled { opacity: .5; cursor: default; }
.types label.type:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }

.dropzone { border: 1.5px dashed var(--line); border-radius: 6px; padding: 14px 16px; margin: 14px 0 6px; background: #FCFBF8; }
.dropzone.over { border-color: var(--gold); background: var(--gold-soft); }
.linklike { color: var(--navy); text-decoration: underline; cursor: pointer; font-size: inherit; }

details.assist { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; background: #FCFBF8; }
details.assist summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--navy); }
#pa-pieces td { padding: 4px 6px; }
#pa-pieces input[type=text] { padding: 4px 6px; }
