/* Page client ProofLivo (validation d'un visuel). Système visuel commun au site : tokens, Manrope, statuts.
   Servi en fichier (CSP style-src 'self'), sans dépendance. Toutes les règles sont portées par `.pp` (le body de la
   vraie page, un conteneur dans la démo du site) pour cohabiter avec site.css. Voir documentation/site/design-system.md. */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/site/fonts/manrope-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/site/fonts/manrope-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

.pp {
  --bg: #F8FAFB; --surface: #FFFFFF; --ink: #0F172A; --ink-2: #475569;
  --primary: #087F8C; --primary-hover: #066670; --accent: #087F8C;
  --blue-light: #E6F5F4; --teal-light: #E6F5F4; --border: #E2E8F0; --border-strong: #CBD5E1;
  --ok: #15803D; --ok-bg: #DCFCE7; --wait: #B45309; --wait-bg: #FEF3C7; --err: #B91C1C; --err-bg: #FEE2E2;
  --stage: #EEF2F6;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --r: 10px; --r-lg: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --focus: 0 0 0 3px #fff, 0 0 0 6px var(--primary);
  --bar-h: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.pp { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); }
body { margin: 0; }
.pp h1, .pp h2, .pp h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
.pp h1 { font-size: 1.35rem; font-weight: 700; }
.pp h2 { font-size: 1.1rem; font-weight: 700; }
.pp h3 { font-size: .95rem; font-weight: 700; }
.pp p { margin: 0; }
.pp a { color: var(--primary); text-underline-offset: 3px; }
.pp a:hover { color: var(--primary-hover); }
.pp :focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.pp button { font: inherit; }
.pp .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barre : atelier, commande, langue */
.pp .bar { position: sticky; top: 0; z-index: 20; min-height: var(--bar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.pp .bar .who { display: flex; flex-direction: column; min-width: 0; }
.pp .bar .shop { font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp .bar .order { color: var(--ink-2); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp .bar form { margin: 0; display: flex; gap: 4px; }
.pp .bar form button { background: none; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; font-size: .85rem; font-weight: 600; color: var(--ink-2); cursor: pointer; min-height: 36px; }
.pp .bar form button[aria-pressed='true'] { border-color: var(--ink); color: var(--ink); background: var(--blue-light); }

/* Statuts : libellé et forme, jamais la couleur seule */
.pp .status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--stage); color: var(--ink-2); }
.pp .status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pp .status.wait { background: var(--wait-bg); color: var(--wait); }
.pp .status.fix { background: var(--err-bg); color: var(--err); }
.pp .status.ok { background: var(--ok-bg); color: var(--ok); }
.pp .status.ok::before { width: 10px; height: 6px; border-radius: 0; background: none; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-2px); }

/* Messages */
.pp .notice { border-radius: var(--r); padding: 12px 14px; border: 1px solid; font-size: .95rem; display: flex; gap: 10px; align-items: flex-start; }
.pp .notice.ok { color: var(--ok); background: var(--ok-bg); border-color: #BFE3C9; }
.pp .notice.wait { color: var(--wait); background: var(--wait-bg); border-color: #F3D9A6; }
.pp .notice.err { color: var(--err); background: var(--err-bg); border-color: #F1B8B3; }
.pp .notice strong { font-weight: 700; }
.pp .field-error { color: var(--err); font-size: .9rem; margin-top: 6px; font-weight: 600; }

/* Mise en page : une section par travail, visuel à gauche, panneau à droite */
.pp > main { max-width: 1480px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.pp .top { display: grid; gap: 10px; }
.pp .items-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.pp .items-nav a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: .9rem; font-weight: 600; min-height: 36px; }
.pp .review { display: grid; gap: 16px; }
@media (min-width: 1024px) {
  /* Grand écran : la page est un écran d'application, à la façon d'une application vidéo. Rien ne défile au niveau
     de la page : barre, titre et pied sont fixes ; chaque travail occupe un écran entier dans .reviews, qui s'arrête
     sur chacun (scroll-snap) ; dans le panneau, l'en-tête et la décision sont fixes et seule la zone des faits et
     des échanges défile. Ces règles visent le body de la vraie page ; la démo du site reste un bloc dans la page. */
  html:has(> body.pp) { height: 100%; overflow: hidden; }
  body.pp { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.pp > main { flex: 1 1 auto; min-height: 0; width: 100%; padding: 0 24px; display: flex; flex-direction: column; gap: 0; }
  body.pp .top { flex: none; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 14px 0 12px; }
  body.pp .top > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; }
  body.pp .top h1 { font-size: 1.2rem; }
  body.pp .top .help { margin: 0; font-size: .9rem; }
  body.pp .top .notice { flex-basis: 100%; }
  body.pp .reviews { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none; container-type: size; }
  body.pp .reviews::-webkit-scrollbar { display: none; }
  /* Hauteur en unités de conteneur (cqh) : une longueur, pas un pourcentage, pour que le visuel et le panneau en dessous puissent résoudre leurs 100 %. */
  body.pp .review { height: 100cqh; container-type: size; grid-template-rows: minmax(0, 1fr); scroll-snap-align: start; scroll-snap-stop: always; padding-bottom: 16px; }
  body.pp .viewer, body.pp .panel { height: calc(100cqh - 16px); min-height: 0; }
  body.pp > footer { flex: none; padding: 6px 16px 10px; }
  /* Décision compacte pour laisser la place aux échanges, même sur un écran de 768 px de haut. */
  body.pp .panel { padding: 16px; gap: 10px; }
  body.pp .panel-head .help { font-size: .85rem; }
  body.pp .decision { gap: 8px; padding-bottom: 12px; }
  body.pp .decision label.lbl { display: inline; margin-right: 6px; }
  body.pp .decision .hint { display: inline; font-size: .8rem; line-height: 1.35; }
  body.pp .decision textarea { margin-top: 6px; }
  body.pp .decision textarea { min-height: 56px; }
  body.pp .confirm { font-size: .9rem; }
  body.pp .decision .btn { min-height: 44px; }
  .pp .review { grid-template-columns: minmax(0, 1fr) clamp(360px, 32vw, 440px); align-items: stretch; }
  .pp .viewer { height: 100%; min-height: 0; }
  .pp .panel { height: 100%; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
  .pp .panel-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-right: 4px; }
}
@media (min-width: 1024px) and (prefers-reduced-motion: no-preference) { body.pp .reviews { scroll-behavior: smooth; } }

/* Visuel */
.pp .viewer { display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; height: min(62vh, 560px); min-height: 320px; }
.pp .viewer:fullscreen { height: 100vh; border: 0; border-radius: 0; }
.pp .viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); min-height: 48px; }
.pp .viewer-bar .file { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: .85rem; color: var(--ink-2); }
.pp .viewer-bar .file .v { font-weight: 800; color: var(--primary-hover); background: var(--blue-light); border-radius: 6px; padding: 2px 8px; font-size: .8rem; white-space: nowrap; }
.pp .viewer-bar .file .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp .tools { display: flex; gap: 4px; flex: none; }
.pp .tools button, .pp .tools a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 8px; cursor: pointer; text-decoration: none; font-size: .85rem; font-weight: 700; }
.pp .tools button:hover, .pp .tools a:hover { border-color: var(--border-strong); background: var(--bg); }
.pp .tools svg { width: 18px; height: 18px; }
.pp .tools .zoom-level { min-width: 52px; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; justify-content: center; display: inline-flex; align-items: center; font-size: .8rem; }
/* Piste unique explicite : avec une piste `auto`, le `max-height: 100%` de l'image se résoudrait contre sa propre hauteur. */
.pp .stage { position: relative; overflow: auto; background: var(--stage); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); place-items: center; -webkit-overflow-scrolling: touch; }
.pp .stage.is-zoomed { place-items: start; cursor: grab; }
.pp .stage.is-zoomed.is-panning { cursor: grabbing; }
.pp .stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; margin: auto; background: #fff; }
.pp .stage.is-zoomed img { max-width: none; max-height: none; }
.pp .stage.is-loading img { opacity: 0; }
.pp .stage.is-error img { display: none; }
.pp .stage-msg { position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 24px; color: var(--ink-2); font-size: .95rem; }
.pp .stage.is-loading .stage-msg.loading { display: grid; }
.pp .stage.is-error .stage-msg.error { display: grid; }
.pp .stage-msg .box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; max-width: 360px; display: grid; gap: 10px; }
.pp .stage-msg .box strong { color: var(--ink); }
.pp .spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 900ms linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.pp .pdf-stage { display: grid; place-items: center; padding: 24px; text-align: center; gap: 12px; color: var(--ink-2); }
.pp .pdf-stage svg { width: 48px; height: 48px; color: var(--ink-2); }

/* Panneau */
.pp .panel { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.pp .panel-scroll { display: grid; gap: 12px; align-content: start; }
.pp .panel-head { display: grid; gap: 6px; }
.pp .panel-head .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pp .help { color: var(--ink-2); font-size: .95rem; }
.pp .facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: .95rem; }
.pp .facts dt { color: var(--ink-2); }
.pp .facts dd { margin: 0; overflow-wrap: anywhere; }
.pp .instructions { background: var(--teal-light); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 4px; }
.pp .instructions p { white-space: pre-wrap; }
.pp .change-note { background: var(--blue-light); border-radius: var(--r); padding: 10px 14px; font-size: .95rem; }
.pp .comments { display: grid; gap: 6px; }
.pp .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pp .feed li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; }
.pp .feed .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--primary); color: #fff; }
.pp .feed li.shop .avatar { background: var(--ink); }
.pp .feed .who { display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink-2); font-size: .8rem; margin-bottom: 3px; }
.pp .feed .who strong { color: var(--ink); }
.pp .feed .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; background: var(--bg); border-radius: 0 12px 12px 12px; padding: 8px 12px; }
.pp .feed li.customer .body { background: var(--blue-light); }

/* Décision */
.pp .decision { display: grid; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.pp .decision label.lbl { font-weight: 700; display: block; }
.pp .decision .hint { color: var(--ink-2); font-size: .88rem; }
.pp .decision textarea { width: 100%; min-height: 72px; font: inherit; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r); resize: vertical; }
.pp .decision textarea:focus-visible { border-color: var(--primary); }
.pp .decision textarea[aria-invalid='true'] { border-color: var(--err); }
.pp .confirm { display: flex; gap: 10px; align-items: flex-start; }
.pp .confirm input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.pp .confirm input[aria-invalid='true'] { outline: 2px solid var(--err); outline-offset: 2px; }
.pp .actions { display: grid; gap: 10px; }
@media (min-width: 540px) { .actions { grid-template-columns: 1fr 1fr; } }
.pp .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px; border-radius: var(--r); border: 1.5px solid transparent; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; transition: background-color 120ms ease, border-color 120ms ease; }
.pp .btn.approve { background: var(--ok); color: #fff; }
.pp .btn.approve:hover { background: #166534; }
.pp .btn.changes { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.pp .btn.changes:hover { background: var(--blue-light); }
.pp .btn.primary { background: var(--primary); color: #fff; }
.pp .btn.primary:hover { background: var(--primary-hover); }
.pp .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.pp .btn[disabled] { opacity: .6; cursor: progress; }
.pp .after { display: grid; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.pp .after .when { color: var(--ink-2); font-size: .9rem; }
.pp .trace { color: var(--ink-2); font-size: .78rem; line-height: 1.4; margin: 0; padding-top: 10px; border-top: 1px solid var(--border); }

/* États indisponibles */
.pp .unavailable { max-width: 560px; margin: 8vh auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; display: grid; gap: 12px; }
.pp .unavailable .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--blue-light); color: var(--primary); display: grid; place-items: center; }
.pp .unavailable .icon svg { width: 24px; height: 24px; }
.pp .unavailable .next { background: var(--bg); border-radius: var(--r); padding: 12px 14px; font-size: .95rem; }

.pp > footer { text-align: center; color: var(--ink-2); font-size: .8rem; padding: 20px 16px 28px; }
.pp > footer { color: inherit; }

@media (max-width: 1023px) {
  .pp .bar { padding: 8px 12px; }
  .pp > main { padding: 12px; }
  .pp .panel { padding: 14px; }
  /* Petit écran : le cadre prend la hauteur du visuel (jusqu'à 62 % de l'écran), sans bandes vides. */
  .pp .viewer { height: auto; min-height: 0; }
  .pp .stage { min-height: 160px; max-height: 62vh; }
  .pp .stage img { max-height: 62vh; }
  .pp .stage.is-zoomed { height: 62vh; }
}
@media (max-width: 639px) {
  /* Les boutons de zoom laissent la place au nom du fichier ; le pincement et l'ouverture du fichier restent. */
  .pp .tools [data-zoom], .pp .tools .zoom-level { display: none; }
  .pp .viewer-bar { padding-left: 10px; }
}
