:root {
  --ink: #1d1417; --ink-2: #4a3f43; --muted: #7b7075;
  --paper: #f6f3ef; --card: #ffffff; --line: #e5dfd8;
  --accent: #8c1c3a; --accent-2: #6e1530; --gold: #b98a3e;
  --ok: #1d7a46; --ok-bg: #e6f4ec; --warn: #a15c00; --warn-bg: #fdf0dc; --bad: #b3261e; --bad-bg: #fbe9e7;
  --radius: 10px; --shadow: 0 1px 2px rgba(29,20,23,.06), 0 4px 14px rgba(29,20,23,.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
code { background: #efe9e2; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
kbd { background: rgba(255,255,255,.2); border-radius: 4px; padding: 0 5px; font-size: 11px; margin-left: 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) { .grid2, .two-col { grid-template-columns: 1fr; } }

/* --- layout admin --- */
.topbar { background: var(--ink); color: #f4e9d8; display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 20; }
.topbar a { color: inherit; text-decoration: none; }
.brand { font-size: 19px; font-weight: 700; letter-spacing: .4px; }
.brand-mark { color: var(--gold); margin-right: 2px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; opacity: .8; }
.topbar nav a:hover, .topbar nav a.on { background: rgba(255,255,255,.1); opacity: 1; }
.who { font-size: 13px; opacity: .85; }
.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; }
.count { background: #e9e2da; color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; vertical-align: middle; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

/* --- boutons / formulaires --- */
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: .12s; }
.btn:hover { border-color: #cfc6bc; background: #faf8f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: #efc4be; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn.big { padding: 14px 24px; font-size: 16px; }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.link { color: var(--accent); text-decoration: underline; cursor: pointer; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, textarea, select { font: inherit; font-weight: 400; color: var(--ink); padding: 9px 11px; border: 1px solid #d6cdc3; border-radius: 8px; background: #fff; width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(140,28,58,.25); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
form.inline { display: inline; }
.search input { width: 220px; }

/* --- cartes projets --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.project-card { text-decoration: none; color: inherit; display: block; transition: .15s; }
.project-card:hover { transform: translateY(-2px); border-color: #d2c3b5; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-top h2 { margin: 0 0 6px; }
.stats { list-style: none; display: flex; gap: 14px; padding: 0; margin: 10px 0 6px; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.stats .warn { color: var(--warn); }
.meta { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: #ece6df; color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pill.sent { background: var(--warn-bg); color: var(--warn); }
.pill.completed { background: var(--ok-bg); color: var(--ok); }
.empty { background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); padding: 48px 20px; text-align: center; }

/* --- tableaux --- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 14px; background: #faf8f5; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid #f0ebe5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* --- modales --- */
dialog.modal { border: 0; border-radius: 14px; padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
dialog.modal.wide { width: min(620px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(29,20,23,.55); }
dialog.modal form { display: grid; gap: 12px; }
dialog.modal form[hidden] { display: none; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.checklist { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f0ebe5; font-weight: 400; color: var(--ink); cursor: pointer; }
.checklist label:hover { background: #faf8f5; }
.checklist small { color: var(--muted); margin-left: auto; }
.tabs.mini { margin-bottom: 14px; }

/* --- connexion --- */
body.login .container { max-width: 520px; padding-top: 60px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.login-card.wide { max-width: 640px; margin: 0 auto; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.checks { list-style: none; padding: 0; margin: 12px 0 18px; display: grid; gap: 4px; font-size: 14px; }
.checks .ok { color: var(--ok); } .checks .ko { color: var(--bad); }
body.login .topbar { display: none; }

/* --- page projet --- */
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { flex: 1 1 180px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.step b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #ece6df; color: var(--ink-2); font-size: 12px; flex: none; }
.step.done b { background: var(--ok); color: #fff; }
.step.now { border-color: var(--accent); color: var(--ink); } .step.now b { background: var(--accent); color: #fff; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.tabs button { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.on, .tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar.wrap { flex-wrap: wrap; }
.toolbar p { margin: 0; max-width: 640px; }

.actor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.actor-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: 72px 1fr; gap: 14px; box-shadow: var(--shadow); }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: #ece6df center/cover; display: grid; place-items: center; color: var(--muted); font-size: 24px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.actor-card h3 { margin: 0; }
.actor-card .mail { font-size: 13px; color: var(--muted); word-break: break-all; }
.actor-card .btns { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: #ece6df; color: var(--ink-2); margin: 3px 4px 0 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }

.dropzone { border: 2px dashed #cdbfb0; border-radius: 14px; background: #fbf9f6; padding: 34px 20px; text-align: center; transition: .15s; margin-bottom: 14px; }
.dropzone.over { border-color: var(--accent); background: #f9eef1; }
.dz-inner { display: grid; gap: 4px; color: var(--ink-2); } .dz-inner strong { font-size: 17px; color: var(--ink); }
.queue { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.queue .bar, .progress { height: 8px; background: #ece6df; border-radius: 99px; overflow: hidden; }
.queue .bar i, .progress .bar { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s; }
.queue ul { margin: 8px 0 0; padding: 0; list-style: none; max-height: 120px; overflow: auto; font-size: 13px; color: var(--muted); }
.queue li.err { color: var(--bad); }
.face-status { background: #f3ecf9; color: #4b2a74; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.filters button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pcard { position: relative; background: #fff; border-radius: 10px; overflow: hidden; border: 2px solid transparent; box-shadow: var(--shadow); cursor: pointer; }
.pcard img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #ddd; }
.pcard .tags { padding: 6px 8px; font-size: 12px; min-height: 38px; display: flex; flex-wrap: wrap; gap: 3px; align-content: flex-start; }
.pcard .tag { background: #ece6df; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.pcard .tag.s { border: 1px dashed var(--warn); background: var(--warn-bg); color: var(--warn); }
.pcard .tag.approved { background: var(--ok-bg); color: var(--ok); } .pcard .tag.refused { background: var(--bad-bg); color: var(--bad); }
.pcard .state { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--warn); color: #fff; }
.pcard.validated { border-color: var(--ok); } .pcard.validated .state { background: var(--ok); }
.pcard.excluded { opacity: .6; } .pcard.excluded .state { background: #6c6266; }
.pcard.auto .state { background: #3b6fb6; }
.pcard.processing::after { content: "Analyse des visages…"; position: absolute; inset: 0 0 38px 0; background: rgba(29,20,23,.5); color: #fff; display: grid; place-items: center; font-size: 13px; }
.send-table { margin-top: 10px; }
.callout { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.callout.ok { border-left-color: var(--ok); } .callout.warn { border-left-color: var(--gold); }

/* --- revue photo (plein écran) --- */
.review { position: fixed; inset: 0; z-index: 50; background: #120c0e; display: grid; grid-template-columns: 1fr 340px; color: #f4e9d8; }
.review[hidden] { display: none; }
.review-stage { position: relative; display: grid; place-items: center; padding: 16px; min-height: 0; overflow: hidden; }
.stage-img { position: relative; display: inline-block; max-width: 100%; max-height: 100%; line-height: 0; }
.stage-img img { max-width: calc(100vw - 340px - 32px); max-height: calc(100vh - 32px); display: block; user-select: none; }
#rv-boxes { position: absolute; inset: 0; }
.fbox { position: absolute; border: 2px solid #e8c26c; border-radius: 4px; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.fbox:hover, .fbox.sel { border-color: #fff; background: rgba(255,255,255,.12); }
.fbox.matched { border-color: #5fd08b; } .fbox.suggest { border-color: #f5a742; border-style: dashed; }
.fbox .lbl { position: absolute; left: -2px; top: 100%; margin-top: 3px; background: rgba(0,0,0,.78); color: #fff; font-size: 12px; line-height: 1.3; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.review .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 72px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 34px; cursor: pointer; border-radius: 8px; z-index: 2; }
.review .nav:hover { background: rgba(255,255,255,.22); } .review .nav.prev { left: 10px; } .review .nav.next { right: 10px; }
.review .close { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; font-size: 16px; z-index: 2; }
.review-side { background: #1d1417; padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid #33262b; }
.rv-title { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; word-break: break-all; }
.review-side .btn { background: #2b1f24; border-color: #3d2d33; color: #f4e9d8; } .review-side .btn:hover { background: #38282f; }
.review-side .btn.primary { background: var(--accent); border-color: var(--accent); } .review-side .btn.danger { color: #ff9a92; }
.review-side .muted { color: #a8979d; }
.chip-list { display: grid; gap: 6px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; border: 1px solid #3d2d33; background: #261b20; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.chip:hover { background: #33252b; }
.chip .nm { flex: 1; } .chip .kk { font-size: 11px; opacity: .6; }
.chip.on { background: #1d4a31; border-color: #3e9d68; }
.chip.suggest { border-style: dashed; border-color: #f5a742; background: #3a2c16; }
.chip .note { font-size: 11px; color: #f5a742; }
@media (max-width: 900px) { .review { grid-template-columns: 1fr; grid-template-rows: 1fr auto; } .review-side { max-height: 46vh; } .stage-img img { max-width: calc(100vw - 32px); max-height: 48vh; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 90vw; }
.toast.err { background: var(--bad); }
.toast[hidden] { display: none; }

/* --- espace comédien (sombre) --- */
body.actor-page { background: #140d10; color: #f4e9d8; }
.actor-top { padding: 16px 24px; font-size: 18px; font-weight: 700; letter-spacing: .4px; border-bottom: 1px solid #2c2025; }
.actor-main { max-width: 980px; margin: 0 auto; padding: 28px 18px 80px; }
.actor-intro h1 { font-size: 28px; }
.actor-intro p { max-width: 640px; } .actor-page .muted { color: #a8979d; }
.progress { background: #2c2025; margin-top: 18px; position: sticky; top: 0; z-index: 5; }
.progress-label { font-size: 14px; color: #c9b9bf; margin: 8px 0 18px; }
.actor-photos { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.actor-photos::-webkit-scrollbar { display: none; }
.actor-page [hidden] { display: none !important; }
.slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; min-width: 0; }
.slide.finish { display: grid; align-content: center; gap: 14px; margin-top: 0; max-width: none; min-height: 50vh; padding: 10px; }
.slider-nav { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 16px; position: sticky; bottom: 12px; }
.slider-nav #pos { min-width: 110px; text-align: center; font-weight: 600; color: #c9b9bf; }
.navbtn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid #3a2b31; background: #261b20; color: #f4e9d8; font-size: 28px; cursor: pointer; line-height: 1; }
.navbtn:hover:not(:disabled) { background: #38282f; } .navbtn:disabled { opacity: .3; cursor: default; }
.aphoto { background: #1e1519; border-radius: 14px; overflow: hidden; border: 2px solid #2c2025; transition: border-color .2s; }
.aphoto[data-decision=approved] { border-color: #3e9d68; } .aphoto[data-decision=refused] { border-color: #c4493f; }
.aphoto .zoom { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.aphoto img { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; }
.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.choice { appearance: none; border: 2px solid #3a2b31; background: #261b20; color: #f4e9d8; font: inherit; font-weight: 700; font-size: 17px; padding: 16px 10px; border-radius: 10px; cursor: pointer; }
.choice span { margin-right: 6px; }
.choice.yes:hover, .aphoto[data-decision=approved] .choice.yes { background: #1f6b43; border-color: #3e9d68; color: #fff; }
.choice.no:hover, .aphoto[data-decision=refused] .choice.no { background: #8e2e27; border-color: #c4493f; color: #fff; }
.finish { margin-top: 34px; display: grid; gap: 14px; max-width: 640px; }
.actor-page textarea { background: #1e1519; color: #f4e9d8; border-color: #3a2b31; }
.actor-page .btn.primary { background: var(--accent); }
.message-card { max-width: 520px; margin: 60px auto; text-align: center; background: #1e1519; border: 1px solid #2c2025; padding: 40px 28px; border-radius: 16px; }
/* Message de fin : fenêtre au premier plan, au-dessus de la page */
#thanks.message-card { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); margin: 0; z-index: 100; box-shadow: 0 0 0 100vmax rgba(0,0,0,.72), 0 24px 70px rgba(0,0,0,.6); }
#thanks.message-card[hidden] { display: none; }
.big-icon { width: 72px; height: 72px; border-radius: 50%; background: #1f6b43; display: grid; place-items: center; margin: 0 auto 18px; font-size: 34px; color: #fff; }
.big-icon.warn { background: #a15c00; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(0,0,0,.92); }
.lightbox img { position: absolute; inset: 0; margin: auto; max-width: 100vw; max-height: 100vh; }
.lightbox .close { position: fixed; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 18px; cursor: pointer; }
@media (max-width: 600px) { .container { padding: 18px 14px 60px; } .topbar { gap: 12px; padding: 0 14px; } .who { display: none; } .decide { padding: 10px; } }

.actor-page label { color: #c9b9bf; }
@media (max-width: 700px) {
  .actor-main { padding-top: 14px; }
  .actor-intro h1 { font-size: 22px; margin-bottom: 4px; }
  .actor-intro p { font-size: 14px; margin: 4px 0; }
  .actor-intro p.muted { display: none; }
  .aphoto img { max-height: 52vh; }
  .choice { padding: 14px 6px; font-size: 16px; }
}
.badge.type-actor { background: #e6eefb; color: #24508f; } .badge.type-producer { background: #f3e8fb; color: #6a2c91; }
.badge.type-direction { background: #fdf0dc; color: #a15c00; } .badge.type-other { background: #ece6df; color: var(--ink-2); }
select { width: 100%; }

/* Galerie des photos retenues (page comédien) */
.gallery-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gallery figure { margin: 0; background: #1e1519; border: 1px solid #2c2025; border-radius: 12px; overflow: hidden; }
.gallery .zoom { display: block; width: 100%; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; font-size: 13px; }
.gallery figcaption a { color: #f4e9d8; font-weight: 600; text-decoration: none; }
.gallery figcaption a:hover { text-decoration: underline; }
