/* Interfaces de validation Siib — thème sombre, tokens du brief (section 5.6) */

:root {
  --primary: #F5B301;
  --primary-hover: #FFD04A;
  --dark: #1A1E21;
  --light: #F4F4F5;
  --bg: var(--dark);
  --panel: #22272B;
  --border: #384047;
  --text: var(--light);
  --text-2: #AAB0B5;
  --ok: #27C46B;      /* validé */
  --ko: #E4484D;      /* refusé */
  --edit: #E8A33D;    /* édité */
  --pending: #4E8FE8; /* en attente */
  --radius: 6px;
  font-size: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
}
button:hover { border-color: #3a3a3a; background: #1d1d1d; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--dark); font-weight: 700; }
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger-ghost { color: var(--ko); }
button.warn-ghost { color: var(--edit); }

input[type="text"], select {
  font: inherit;
  color: var(--text);
  background: #101010;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
}
input[type="text"]:focus, select:focus { outline: none; border-color: var(--pending); }

kbd {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #1c1c1c;
  font: 11px/1.5 inherit;
  color: var(--text-2);
}

/* ---------- écrans ---------- */

.screen { display: flex; flex-direction: column; height: calc(100vh - 43px); }

/* Accueil */
#screen-home { overflow-y: auto; background: var(--dark); }
.home-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid #222623;
  background: rgba(13, 15, 14, 0.94);
  backdrop-filter: blur(14px);
}
.home-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.home-brand { color: var(--text); text-decoration: none; }
.home-brand-mark { width: 18px; height: 18px; border: 2px solid var(--primary); border-radius: 4px; transform: rotate(6deg); }
.member-nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }
.home-topbar:has(.member-nav) { flex-shrink: 0; gap: 20px; }
.member-nav a { padding: 7px 10px; color: var(--text-2); text-decoration: none; border-radius: var(--radius); font-size: 12px; }
.member-nav a:hover { color: var(--text); background: var(--panel); }
.member-nav a[aria-current="page"] { color: var(--primary); background: var(--panel); }
.member-nav :is(a, button):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 760px) {
  .home-topbar:has(.member-nav) { flex-wrap: wrap; gap: 12px; }
  .member-nav { width: 100%; justify-content: flex-start; margin-left: 0; }
}
.operator-field { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; }
.operator-field input { width: 150px; }
.home-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 32px; }
.home-intro { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.home-intro .eyebrow { margin-bottom: 7px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
#screen-home h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 720; line-height: 1.05; letter-spacing: -0.035em; }
#screen-home .sub { margin-top: 9px; color: var(--text-2); font-size: 15px; }

.upload-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(320px, 1.2fr);
  align-items: center;
  gap: 28px;
  padding: 22px;
  border: 1px solid #2a302c;
  border-radius: 16px;
  background: linear-gradient(135deg, #171b18, #131514);
}
.upload-heading { display: flex; align-items: center; gap: 14px; }
.upload-symbol { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--dark); background: var(--primary); font-size: 25px; font-weight: 600; }
.upload-heading h2 { font-size: 16px; }
.upload-heading p { margin-top: 3px; color: var(--text-2); font-size: 12px; }
.upload-row { display: flex; gap: 10px; min-width: 0; }
.file-picker {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  overflow: hidden;
  border: 1px solid #343a36;
  border-radius: 9px;
  background: #0f1110;
  color: #c9cdca;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-picker:hover { border-color: #4b534e; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-message { grid-column: 2; min-height: 18px; margin-top: -20px; color: var(--text-2); font-size: 12px; }

.home-section { margin-top: 34px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-heading h2 { font-size: 14px; font-weight: 650; }
.card-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #262a27;
  border-radius: 13px;
  background: #141715;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
.card:hover { border-color: #414842; transform: translateY(-1px); }
.card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #090a09; }
.card-body { display: flex; align-items: center; gap: 12px; padding: 13px; }
.card-copy { min-width: 0; flex: 1; }
.card h3 { overflow: hidden; font-size: 13px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.card .badge { margin-top: 4px; color: var(--text-2); font-size: 11px; }
.card-open { flex: none; }

.session-list, .job-list { display: flex; flex-direction: column; gap: 8px; }
.session-item, .job-card { border: 1px solid #262a27; border-radius: 11px; background: #141715; }
.session-item { display: flex; align-items: center; gap: 14px; padding: 11px 13px; font-size: 13px; }
.session-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-card { padding: 13px 14px; }
.job-card.ready { border-color: rgba(39, 196, 107, 0.28); }
.job-card.incompatible { border-color: rgba(228, 72, 77, 0.5); }
.job-header { display: flex; align-items: flex-start; gap: 12px; }
.job-header .grow { flex: 1; min-width: 0; }
.job-header h3 { overflow: hidden; font-size: 13px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.job-header p { margin-top: 2px; font-size: 11px; }
.job-status { flex: none; padding: 3px 8px; border-radius: 999px; background: #222623; font-size: 10px; font-weight: 700; }
.job-status.ready { color: var(--ok); }
.job-status.failed, .job-status.incompatible { color: #ff8b8f; }
.job-status.processing { color: #75aaf0; }
.job-status.queued { color: var(--text-2); }
.job-progress { height: 3px; margin-top: 11px; overflow: hidden; border-radius: 999px; background: #292d2a; }
.job-progress span { display: block; height: 100%; background: var(--pending); }
.job-card.ready .job-progress span { background: var(--ok); }
.job-card.failed .job-progress span, .job-card.incompatible .job-progress span { background: var(--ko); }
.job-progress-label { margin-top: 5px; color: #727873; font-size: 10px; }
.job-health { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: #a9d9b8; font-size: 11px; }
.job-health.warning { color: #e7c48f; }
.job-health .health-issue { display: none; }
.job-error { margin-top: 9px; color: #ff9ca0; font-size: 11px; }
.job-actions { margin-top: 10px; }
.job-open { padding: 5px 10px; font-size: 11px; }
.incompatible-notice { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid #312526; font-size: 12px; }
.incompatible-notice .muted { grid-column: 1; font-size: 11px; }
.incompatible-notice button { grid-column: 2; grid-row: 1 / span 2; }
.home-tools { display: flex; align-items: center; gap: 16px; margin-top: 44px; padding: 18px 0; border-top: 1px solid #222623; color: #656b67; font-size: 11px; }
.home-tools a, .link-button { padding: 0; border: 0; background: none; color: #858b87; text-decoration: none; font-size: 11px; }
.home-tools a:hover, .link-button:hover { border: 0; background: none; color: var(--text); }
.site-credit {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  min-height: 43px;
  padding: 5px 14px;
  border-top: 1px solid #222623;
  background: #0d0f0e;
}
.site-credit a { display: block; padding-left: 9px; border-left: 2px solid var(--primary); color: var(--text-2); text-decoration: none; }
.site-credit span, .site-credit strong { display: block; white-space: nowrap; }
.site-credit span { font-size: 9px; letter-spacing: 0.035em; }
.site-credit strong { margin-top: 1px; color: var(--light); font-size: 10px; font-weight: 650; }
.site-credit a:hover span, .site-credit a:hover strong { color: var(--primary); }

.dashboard-page, .flow-page, .search-area-page, .campaign-page, .annotation-page, .replay-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.dashboard-page > main, .flow-page > main, .search-area-page > main, .campaign-page > main, .replay-page > #player-holder { flex: 1; }

@media (max-width: 760px) {
  .home-topbar { padding: 10px 16px; }
  .operator-field span { display: none; }
  .operator-field input { width: 125px; }
  .home-shell { width: min(100% - 28px, 1120px); padding-top: 30px; }
  .upload-panel { grid-template-columns: 1fr; gap: 18px; }
  .upload-message { grid-column: 1; margin-top: -10px; }
  .card-row { grid-template-columns: 1fr; }
  .session-item { flex-wrap: wrap; }
  .session-item .muted { order: 3; width: 100%; }
}

@media (max-width: 500px) {
  .upload-row { flex-direction: column; }
  .upload-row button { width: 100%; }
  .incompatible-notice { grid-template-columns: 1fr; }
  .incompatible-notice button { grid-column: 1; grid-row: auto; margin-top: 8px; }
  .home-tools { flex-wrap: wrap; }
  .site-credit { padding-right: 10px; padding-left: 10px; }
}

/* ---------- dashboard plans ---------- */

.dashboard-page, .flow-page { min-height: 100%; background: var(--dark); }
.dashboard-shell { padding-top: 42px; }
.dashboard-intro { align-items: center; }
.primary-link, .secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 620;
}
.primary-link { color: var(--dark); background: var(--primary); }
.primary-link:hover { background: var(--primary-hover); }
.secondary-link { border: 1px solid var(--border); background: var(--panel); }
.page-message { margin-bottom: 18px; padding: 11px 13px; border: 1px solid rgba(232, 163, 61, 0.35); border-radius: 9px; color: #edc98e; background: rgba(232, 163, 61, 0.08); }
.admin-badge { padding: 5px 9px; border: 1px solid rgba(245, 179, 1, 0.38); border-radius: 999px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.admin-reprocessing-shell { width: min(920px, calc(100% - 32px)); }
.admin-reprocessing-card { padding: 28px; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.admin-plan-picker { display: grid; flex: 0 1 390px; gap: 6px; color: var(--text-2); font-size: 11px; }
.admin-plan-picker select { width: 100%; }
.admin-reprocessing-card .page-message { margin: 22px 0 0; }
.admin-plan-summary { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 1px; margin-top: 24px; overflow: hidden; border: 1px solid #2b302c; border-radius: 10px; background: #2b302c; }
.admin-plan-summary > div { min-width: 0; padding: 12px 14px; background: #101210; }
.admin-plan-summary span, .admin-plan-summary strong { display: block; }
.admin-plan-summary span { margin-bottom: 4px; color: #767d78; font-size: 9px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.admin-plan-summary strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-stage-list { margin-top: 22px; overflow: hidden; border: 1px solid #2b302c; border-radius: 11px; }
.admin-stage-row { display: grid; grid-template-columns: 8px minmax(240px, 1fr) 130px 110px; align-items: center; gap: 14px; min-height: 66px; padding: 10px 12px; border-bottom: 1px solid #252a26; background: #111412; }
.admin-stage-row:last-child { border-bottom: 0; }
.admin-stage-row:hover { background: #161a17; }
.admin-stage-status { width: 7px; height: 7px; border-radius: 2px; background: var(--ok); }
.admin-stage-copy { min-width: 0; }
.admin-stage-copy strong { display: block; font-size: 12px; }
.admin-stage-copy p { margin-top: 3px; color: #858c87; font-size: 10px; }
.admin-stage-consequence { color: #777e79; font-size: 10px; text-align: right; }
.admin-stage-row button { padding: 6px 9px; border-color: #4a514b; background: transparent; font-size: 10px; }
.admin-stage-row button:hover { border-color: var(--primary); color: var(--primary); background: rgba(245, 179, 1, 0.06); }
.plan-list-section { margin-top: 30px; }
.plan-list-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.plan-list-toolbar h2 { font-size: 13px; font-weight: 620; color: var(--text-2); }
.plan-list-controls { display: flex; align-items: center; gap: 10px; }
.plan-search-field input { width: 220px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: #101010; font: inherit; font-size: 12px; }
.plan-search-field input:focus { outline: none; border-color: var(--pending); }
.plan-search-field input::placeholder { color: #6f7571; }
.sort-field { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 11px; }
.sort-field select { min-width: 145px; padding: 6px 9px; font-size: 12px; }
.plan-table { overflow: visible; border: 1px solid #282d29; border-radius: 12px; background: #131614; }
.plan-table-head, .plan-line { display: grid; grid-template-columns: minmax(250px, 1.8fr) minmax(112px, 0.65fr) minmax(125px, 0.7fr) minmax(105px, 0.6fr) minmax(220px, 1fr) 154px; align-items: center; gap: 16px; }
.plan-table-head { padding: 9px 14px; border-bottom: 1px solid #282d29; color: #747a76; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.plan-line { position: relative; min-height: 66px; padding: 9px 14px; border-bottom: 1px solid #222623; }
.plan-line:last-child { border-bottom: 0; }
.plan-line:hover { z-index: 4; background: #171a18; }
.plan-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.plan-hover-preview { position: fixed; right: max(130px, calc((100vw - 1120px) / 2 + 112px)); top: 50%; z-index: 30; width: min(590px, calc(100vw - 190px)); padding: 9px; visibility: hidden; border: 1px solid #4a524c; border-radius: 11px; background: #0c0e0d; box-shadow: 0 22px 70px rgba(0, 0, 0, 0.58); opacity: 0; pointer-events: none; transform: translateY(-50%) scale(0.985); transition: opacity 100ms ease, transform 100ms ease; }
.plan-hover-preview img { display: block; width: 100%; max-height: min(68vh, 440px); border-radius: 6px; object-fit: contain; background: #fff; }
.plan-line.has-preview:hover .plan-hover-preview { visibility: visible; opacity: 1; transform: translateY(-50%) scale(1); }
.plan-name { min-width: 0; }
.plan-name strong { display: block; overflow: hidden; font-size: 13px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.plan-name small { display: block; margin-top: 3px; color: #777e79; font-size: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 999px; background: #202421; color: #b9bfbb; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 2px; background: #777; }
.status-pill.ready, .status-pill.validated { color: #7ce3a6; background: rgba(39, 196, 107, 0.1); }
.status-pill.ready .status-dot, .status-pill.validated .status-dot { background: var(--ok); }
.status-pill.processing { color: #89b6f0; background: rgba(78, 143, 232, 0.1); }
.status-pill.processing .status-dot { background: var(--pending); animation: status-pulse 1.4s ease-in-out infinite; }
.status-pill.resume { color: #f0c47e; background: rgba(232, 163, 61, 0.1); }
.status-pill.resume .status-dot { background: var(--edit); }
.status-pill.area { color: #f0c47e; background: rgba(232, 163, 61, 0.1); }
.status-pill.area .status-dot { background: var(--edit); }
.status-pill.error, .status-pill.incompatible { color: #ff9296; background: rgba(228, 72, 77, 0.1); }
.status-pill.error .status-dot, .status-pill.incompatible .status-dot { background: var(--ko); }
.plan-date { color: #858b87; font-size: 11px; }
.plan-owner { overflow: hidden; color: #aeb3af; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.plan-line-action { position: relative; z-index: 40; display: flex; justify-content: flex-end; gap: 6px; text-align: right; }
.plan-line-action a { display: inline-flex; padding: 6px 10px; border: 1px solid var(--primary); border-radius: 7px; color: var(--dark); background: var(--primary); text-decoration: none; font-size: 11px; font-weight: 700; }
.plan-line-action a:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.plan-feedback-button { padding: 6px 8px; border-color: #414741; background: transparent; color: #b5bbb7; font-size: 11px; }
.plan-feedback-button:hover { border-color: #737b75; color: var(--text); }
.plan-list-empty, .plan-list-error { padding: 44px 18px; color: var(--text-2); text-align: center; }
.plan-list-empty p { margin: 5px 0 18px; }
@keyframes status-pulse { 50% { opacity: 0.35; } }

/* ---------- retour opérateur ---------- */

.feedback-dialog {
  position: fixed; inset: 0; margin: auto;
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid #3b413c; border-radius: 14px;
  color: var(--text); background: #171a18;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.7);
}
.feedback-dialog::backdrop { background: rgba(4, 6, 5, 0.72); backdrop-filter: blur(3px); }
.feedback-form { display: grid; gap: 9px; padding: 20px; }
.feedback-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 5px; }
.feedback-heading h2 { font-size: 19px; }
.feedback-heading p { margin-top: 3px; color: var(--text-2); font-size: 11px; }
.feedback-close { min-width: 34px; padding: 2px 8px; border: 0; color: var(--text-2); background: transparent; font-size: 24px; line-height: 1; }
.feedback-form label { margin-top: 5px; color: #aeb4af; font-size: 11px; font-weight: 650; }
.feedback-form select, .feedback-form textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #3b413c; border-radius: 8px;
  color: var(--text); background: #0f1110; font: inherit;
}
.feedback-form textarea { resize: vertical; min-height: 110px; }
.feedback-form select:focus, .feedback-form textarea:focus { outline: 2px solid rgba(245, 179, 1, 0.35); border-color: var(--primary); }
.feedback-error { margin: 2px 0 0; color: #ff9296; font-size: 11px; }
.feedback-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.feedback-actions button { padding: 8px 13px; }
.feedback-cancel { border-color: #414741; background: transparent; }
.feedback-submit { border-color: var(--primary); color: var(--dark); background: var(--primary); font-weight: 700; }
.feedback-submit:hover { background: var(--primary-hover); }

/* ---------- écrans de parcours ---------- */

.flow-shell { width: min(680px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0; }
.page-back { display: inline-flex; margin-bottom: 20px; color: #959b97; text-decoration: none; font-size: 12px; }
.page-back:hover { color: var(--text); }
.flow-card { padding: 34px; border: 1px solid #292e2a; border-radius: 16px; background: #141715; }
.flow-card .eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.flow-card h1 { font-size: 27px; letter-spacing: -0.025em; }
.flow-subtitle { margin-top: 8px; color: var(--text-2); }
.flow-help { margin-top: 18px; color: #858b87; font-size: 12px; }
.large-file-picker { display: flex; align-items: center; gap: 14px; margin-top: 28px; padding: 18px; border: 1px dashed #475049; border-radius: 12px; background: #101210; cursor: pointer; }
.large-file-picker:hover { border-color: var(--primary); }
.large-file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.large-file-picker strong, .large-file-picker small { display: block; }
.large-file-picker small { margin-top: 3px; color: var(--text-2); font-size: 11px; }
.large-file-icon { display: grid; place-items: center; width: 44px; height: 50px; border-radius: 7px; color: #98a09a; background: #252a26; font-size: 9px; font-weight: 800; }
.form-error { margin-top: 15px; color: #ff999d; font-size: 12px; }
.flow-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.check-loader { width: 30px; height: 30px; margin-bottom: 24px; border: 3px solid #313632; border-top-color: var(--primary); border-radius: 50%; animation: loader-spin 0.8s linear infinite; }
.result-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 22px; border-radius: 50%; font-size: 26px; }
.result-icon.error { color: #ff969a; background: rgba(228, 72, 77, 0.12); }
.large-progress { height: 6px; margin-top: 28px; overflow: hidden; border-radius: 999px; background: #292d2a; }
.large-progress span { display: block; width: 0; height: 100%; background: var(--primary); transition: width 180ms ease; }
@keyframes loader-spin { to { transform: rotate(360deg); } }

.processing-shell { width: min(1040px, calc(100% - 32px)); }
.processing-card { position: relative; overflow: hidden; }
.processing-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.processing-header > div:first-child { min-width: 0; }
.processing-card h1 { margin-top: 14px; }
.processing-filename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.processing-actions { flex: none; margin-top: 0; }
.processing-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr); gap: 38px; margin-top: 24px; }
.processing-summary { min-width: 0; }
.processing-timeline { min-width: 0; padding-left: 30px; border-left: 1px solid #292e2a; }
.processing-timeline h2 { color: #b8beba; font-size: 12px; font-weight: 650; }
.processing-animation { position: relative; display: grid; place-items: center; width: 96px; height: 96px; margin: 8px auto 22px; }
.processing-animation::before, .processing-animation::after { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--pending); content: ""; animation: processing-orbit 2.2s linear infinite; }
.processing-animation::after { animation-delay: -1.1s; }
.processing-plan-scan { position: relative; width: 58px; height: 70px; overflow: hidden; border: 1px solid #58615b; border-radius: 7px; background-color: #1a1e1b; background-image: linear-gradient(rgba(117, 130, 120, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(117, 130, 120, 0.16) 1px, transparent 1px); background-size: 11px 11px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28); }
.processing-plan-scan::before { position: absolute; inset: 8px; border: 1px solid rgba(137, 182, 240, 0.24); border-radius: 3px; content: ""; }
.processing-plan-scan span { position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 999px; background: #89b6f0; box-shadow: 0 0 12px rgba(78, 143, 232, 0.9); animation: processing-scan 1.7s ease-in-out infinite; }
.processing-current { min-height: 66px; padding: 15px 16px; border: 1px solid #2b302c; border-radius: 10px; background: #101310; }
.processing-current strong { display: block; font-size: 14px; }
.processing-current p { margin-top: 5px; color: #929994; font-size: 12px; }
.processing-progress-meta { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; color: #858b87; font-size: 11px; }
.processing-progress { position: relative; margin-top: 8px; }
.processing-progress span { position: relative; overflow: hidden; background: var(--pending); transition: width 300ms ease; }
.processing-progress span::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent); content: ""; transform: translateX(-100%); animation: processing-shimmer 1.8s ease-in-out infinite; }
.processing-progress.is-active::after { position: absolute; top: 0; bottom: 0; width: 70px; background: linear-gradient(90deg, transparent, rgba(137, 182, 240, 0.28), transparent); content: ""; animation: processing-track 2.2s ease-in-out infinite; }
.processing-steps { display: grid; gap: 5px; margin-top: 12px; list-style: none; }
.processing-step { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 32px; padding: 4px 7px; border-radius: 7px; color: #6f7671; font-size: 11px; }
.processing-step-marker { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #353b37; border-radius: 50%; color: #707772; font-size: 9px; font-weight: 750; }
.processing-step-state { color: #626863; font-size: 10px; }
.processing-step.completed { color: #9ca49e; }
.processing-step.completed .processing-step-marker { border-color: rgba(39, 196, 107, 0.34); color: #7ce3a6; background: rgba(39, 196, 107, 0.09); }
.processing-step.processing { color: #e6e9e7; background: rgba(78, 143, 232, 0.08); }
.processing-step.processing .processing-step-marker { border-color: rgba(78, 143, 232, 0.5); color: #a8cbf7; background: rgba(78, 143, 232, 0.13); animation: status-pulse 1.4s ease-in-out infinite; }
.processing-step.processing .processing-step-state { color: #89b6f0; }
.processing-step.failed { color: #ff999d; background: rgba(228, 72, 77, 0.07); }
.processing-step.failed .processing-step-marker { border-color: rgba(228, 72, 77, 0.42); color: #ff999d; }
.processing-animation.complete::before, .processing-animation.complete::after, .processing-animation.complete .processing-plan-scan span, .processing-animation.failed::before, .processing-animation.failed::after, .processing-animation.failed .processing-plan-scan span { animation: none; }
.processing-animation.complete .processing-plan-scan { border-color: rgba(39, 196, 107, 0.5); box-shadow: 0 0 24px rgba(39, 196, 107, 0.12); }
.processing-animation.complete .processing-plan-scan::after { position: absolute; inset: 0; display: grid; place-items: center; color: #7ce3a6; background: rgba(10, 24, 16, 0.74); content: "✓"; font-size: 26px; }
.processing-animation.failed .processing-plan-scan { border-color: rgba(228, 72, 77, 0.5); }
.processing-animation.failed .processing-plan-scan::after { position: absolute; inset: 0; display: grid; place-items: center; color: #ff999d; background: rgba(30, 10, 11, 0.74); content: "!"; font-size: 24px; font-weight: 750; }
@keyframes processing-orbit { from { transform: rotate(0deg) translateX(46px) rotate(0deg); } to { transform: rotate(360deg) translateX(46px) rotate(-360deg); } }
@keyframes processing-scan { 0%, 100% { top: 10px; opacity: 0.55; } 50% { top: 57px; opacity: 1; } }
@keyframes processing-shimmer { 0%, 20% { transform: translateX(-100%); } 75%, 100% { transform: translateX(100%); } }
@keyframes processing-track { 0% { left: -70px; } 100% { left: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .processing-animation::before, .processing-animation::after, .processing-plan-scan span, .processing-progress span::after, .processing-progress.is-active::after, .processing-step.processing .processing-step-marker { animation: none; }
}

@media (max-width: 760px) {
  .processing-header { align-items: stretch; flex-direction: column; gap: 16px; }
  .processing-actions { justify-content: stretch; }
  .processing-actions .primary-link, .processing-actions .secondary-link { width: 100%; }
  .processing-layout { grid-template-columns: 1fr; gap: 26px; }
  .processing-timeline { padding-top: 24px; padding-left: 0; border-top: 1px solid #292e2a; border-left: 0; }
}

/* ---------- choix de la zone recherchable ---------- */

.search-area-page { min-height: 100%; background: var(--dark); }
.search-area-shell { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 34px; }
.search-area-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.search-area-heading .eyebrow { margin-bottom: 6px; color: var(--primary); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.search-area-heading h1 { font-size: 25px; letter-spacing: -0.025em; }
.search-area-heading p:last-child { max-width: 520px; color: var(--text-2); font-size: 12px; }
.search-area-panel { overflow: hidden; border: 1px solid #292e2a; border-radius: 14px; background: #141715; }
.search-area-viewer { display: flex; align-items: center; justify-content: center; min-height: 430px; padding: 14px; overflow: hidden; background: #090b0a; touch-action: none; }
.search-area-canvas { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; user-select: none; }
.search-area-canvas img { display: block; max-width: 100%; max-height: calc(100vh - 300px); object-fit: contain; pointer-events: none; }
.search-area-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.search-area-overlay .outside { fill: rgba(4, 6, 5, 0.62); fill-rule: evenodd; }
.search-area-overlay .region { fill: rgba(245, 179, 1, 0.08); stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; }
.search-area-overlay .draft { fill: rgba(245, 179, 1, 0.12); stroke-dasharray: 7 5; }
.search-area-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 64px; padding: 12px 14px; border-top: 1px solid #292e2a; }
.area-scales { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
.area-scales label { display: flex; align-items: center; gap: 6px; }
.area-scales input { width: 7rem; padding: 8px; border: 1px solid #777; border-radius: 6px; background: #f4f4f5; color: #1a1e21; }
.area-scales input:focus { outline: 2px solid #f5b301; outline-offset: 2px; }
.search-area-toolbar p { flex: 1; color: #aeb4b0; font-size: 12px; }
.search-area-error { padding: 48px 24px; color: #ff999d; text-align: center; }

@media (max-width: 700px) {
  .search-area-heading { align-items: flex-start; flex-direction: column; }
  .search-area-viewer { min-height: 300px; padding: 8px; }
  .search-area-toolbar { align-items: stretch; flex-direction: column; }
  .search-area-toolbar p { width: 100%; }
  .search-area-toolbar button { width: 100%; }
}

@media (max-width: 760px) {
  .admin-heading { align-items: stretch; flex-direction: column; }
  .admin-plan-picker { flex-basis: auto; }
  .admin-plan-summary { grid-template-columns: 1fr; }
  .admin-stage-row { grid-template-columns: 8px 1fr auto; }
  .admin-stage-consequence { display: none; }
  .admin-stage-row button { grid-column: 3; grid-row: 1; }
  .plan-list-toolbar { align-items: flex-start; gap: 12px; }
  .plan-list-controls { align-items: stretch; flex-direction: column; }
  .plan-search-field input { width: 100%; }
  .plan-table-head { display: none; }
  .plan-line { grid-template-columns: 1fr auto; gap: 8px 14px; padding: 13px; }
  .plan-line > :nth-child(2) { grid-column: 1; }
  .plan-owner, .plan-date { display: none; }
  .plan-line-action { grid-column: 2; grid-row: 1 / span 2; }
  .plan-hover-preview { display: none; }
}

@media (max-width: 500px) {
  .dashboard-intro { align-items: flex-start; gap: 18px; }
  .dashboard-intro .primary-link { flex: none; }
  .sort-field span { display: none; }
  .flow-card { padding: 24px 20px; }
}

/* ---------- app ---------- */

#screen-app { overflow: hidden; }

header.appbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: none;
  z-index: 30;
}
/* le titre cède la place aux contrôles : plafonné et tronqué, il ne provoque
   jamais à lui seul le passage de la barre à la ligne */
.appbar .title {
  font-weight: 600; font-size: 13px;
  min-width: 0; max-width: 180px; flex-shrink: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.appbar > button, .appbar select { flex: none; }
.appbar .spacer { flex: 1; }
.appbar .counts { display: flex; gap: 8px; font-size: 13px; align-items: center; }
.count-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.progressbar { width: 110px; height: 5px; background: #222; border-radius: 3px; overflow: hidden; display: flex; }
.progressbar .seg { height: 100%; }

.icon-btn { font-size: 15px; padding: 4px 6px; line-height: 1.2; }
/* état actif nettement lisible : un simple changement de bordure passait inaperçu
   pendant le travail sur le plan (on croyait le mode focus actif alors qu'il ne l'était pas) */
.icon-btn.active {
  border-color: var(--pending);
  background: var(--pending);
  color: #08111c;
}
/* groupe d'icônes : collées entre elles, séparées du reste */
.icon-group { display: flex; gap: 3px; }

main.workspace { flex: 1; position: relative; display: flex; min-height: 0; }

.osd-wrap { position: relative; flex: 1; min-width: 0; background: #000; }
/* OSD force position:relative en inline : dimensionner explicitement, pas via inset */
.osd { width: 100%; height: 100%; background: #000; }

/* couche d'overlays de détection : le "monde" est transformé d'un bloc à chaque
   frame ; les tailles écran constantes passent par les variables --bw et --fs
   recalées en fin d'animation. */
.det-layer { position: absolute; inset: 0; overflow: clip; pointer-events: none; z-index: 10; }
.galettes-overlay { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.galettes-overlay polygon { fill: #ad42e622; stroke: #ad42e6; stroke-width: 3; pointer-events: visiblePainted; cursor: pointer; }
.galettes-overlay polygon:focus { stroke: #1a1e21; outline: none; }
.galettes-overlay ellipse { fill: none; stroke: #00a676; stroke-width: 2; }
.galettes-overlay ellipse.galette-auxiliary { stroke: #f5b301; }
.galettes-info { position: absolute; right: 16px; top: 16px; z-index: 40; max-width: 360px; padding: 16px; border: 2px solid #f5b301; border-radius: 12px; background: #1a1e21; color: #f4f4f5; }
.det-world {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  transform-origin: 0 0;
  will-change: transform;
  --bw: 2px;
  --fs: 11px;
}
.det-box {
  position: absolute;
  border: var(--bw) solid var(--pending);
  pointer-events: auto;
  cursor: pointer;
}
.det-box.circular-footprint { border-radius: 50%; }
.det-box.current {
  box-shadow: 0 0 0 var(--bw) rgba(255,255,255,0.95), 0 0 calc(var(--bw) * 7) var(--bw) rgba(255,255,255,0.35);
  z-index: 5;
}
.det-box.dup-candidate {
  outline: var(--bw) dashed #fff;
  outline-offset: calc(var(--bw) * 1.5);
}
/* mode focus : tout ce qui n'est pas la boîte courante passe en gris et en
   opacité réduite ; la courante ressort avec une bordure doublée ; les
   candidates au doublon restent en clair */
.det-world.focus-mode .det-box:not(.current):not(.dup-candidate) {
  filter: grayscale(1) opacity(0.4);
}
.det-world.focus-mode .det-box.current {
  border-width: calc(var(--bw) * 2);
}
.det-pill {
  position: absolute;
  left: 100%; top: 0;
  transform: translate(25%, -30%);
  display: flex; flex-direction: column; align-items: flex-start;
  pointer-events: none;
  line-height: 1.1;
  font-size: var(--fs);
}
.det-pill .score {
  font-size: 1em; font-weight: 700;
  padding: 0.09em 0.45em; border-radius: 0.64em;
  font-variant-numeric: tabular-nums;
}
.det-pill .did {
  font-size: 0.82em; color: #cfcfcf;
  text-shadow: 0 0 0.27em #000, 0 0 0.18em #000;
  margin-top: 0.09em;
}

/* cartouches textuels (parcours de liaison) : magenta comme sur l'aperçu du
   pipeline, visibles uniquement pendant le mode liaison */
.cart-box {
  position: absolute;
  border: var(--bw) dashed #E44FD7;
  background: rgba(228, 79, 215, 0.10);
  pointer-events: auto;
  cursor: pointer;
  display: none;
  z-index: 4;
}
.det-world.cartouches-on .cart-box { display: block; }
/* cartouche relié ou proposé pour la boîte courante : visible même hors du
   panneau de liaison, afin que le parcours normal montre la preuve complète */
.cart-box.linked {
  display: block;
  border-style: solid;
  border-color: var(--pair-color, #E44FD7);
  background: var(--pair-bg, rgba(228, 79, 215, 0.10));
}
.cart-box:hover { background: rgba(228, 79, 215, 0.28); }
.cart-box.selected {
  border-style: solid;
  border-color: var(--pair-color, #E44FD7);
  background: var(--pair-bg, rgba(228, 79, 215, 0.10));
  box-shadow: 0 0 0 var(--bw) var(--pair-color, #E44FD7), 0 0 calc(var(--bw) * 7) var(--bw) var(--pair-color, #E44FD7);
}
/* candidat proposé par le pipeline pour l'empreinte courante (trait vectoriel relevé) */
.cart-box.proposed {
  display: block;
  border-style: dashed;
  border-color: var(--pair-color, #E44FD7);
  background: var(--pair-bg, rgba(228, 79, 215, 0.14));
}
/* cartouche tracé par l'opérateur : cyan, pour le distinguer des détections du modèle */
.cart-box.manual {
  border-color: #35C7D6;
  background: rgba(53, 199, 214, 0.14);
}
.cart-box.manual.selected {
  border-color: var(--pair-color, #35C7D6);
  background: var(--pair-bg, rgba(53, 199, 214, 0.14));
  box-shadow: 0 0 0 var(--bw) var(--pair-color, #35C7D6), 0 0 calc(var(--bw) * 7) var(--bw) var(--pair-color, #35C7D6);
}
/* cartouche refusé : conservé à l'écran comme dans l'export, mais barré visuellement */
.cart-box.refused {
  border-color: var(--rejected, #E4484D);
  background: rgba(228, 72, 77, 0.10);
  opacity: 0.55;
}

/* ligne de sélection du panneau de liaison */
.liaison-sel { font-size: 13px; margin: 4px 0 8px; }
.liaison-sel:not(.muted) { color: #E44FD7; font-weight: 600; }
.liaison-evidence { font-size: 11.5px; margin: -4px 0 9px; }

/* polyligne de preuve : le trait de rappel réellement présent sur le plan, relevé par
   le pipeline. Elle se superpose au trait noir — aucune ligne n'est fabriquée entre
   deux centres de boîtes. */
.link-svg {
  position: absolute; left: 0; top: 0;
  width: 1px; height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 5;
}
.link-svg polyline {
  fill: none;
  stroke: var(--pair-color, #E44FD7);
  stroke-width: calc(var(--bw) * 1.5);
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 calc(var(--bw) * 2) rgba(228, 79, 215, 0.7));
}
.link-svg.proposed polyline {
  stroke-dasharray: calc(var(--bw) * 4) calc(var(--bw) * 3);
}

/* Repère actif : l'empreinte, sa preuve vectorielle et son cartouche pulsent
   ensemble. Seul le halo varie ; les géométries restent strictement immobiles. */
.det-box.current {
  animation: active-footprint-pulse 1.8s ease-in-out infinite;
}
.cart-box.linked, .cart-box.selected, .cart-box.proposed {
  animation: active-cartouche-pulse 1.8s ease-in-out infinite;
}
.link-svg polyline {
  animation: active-link-pulse 1.8s ease-in-out infinite;
}
@keyframes active-footprint-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 var(--bw) rgba(255, 255, 255, 0.95),
      0 0 calc(var(--bw) * 5) var(--bw) var(--pair-color, #fff);
  }
  50% {
    box-shadow:
      0 0 0 calc(var(--bw) * 1.6) rgba(255, 255, 255, 1),
      0 0 calc(var(--bw) * 13) calc(var(--bw) * 3) var(--pair-color, #fff);
  }
}
.det-box.native-polygon {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none;
  animation: none;
  pointer-events: none;
}
.det-polygon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.det-polygon polygon {
  fill: var(--pair-color);
  fill-opacity: 0.08;
  stroke: var(--pair-color);
  stroke-width: var(--bw);
  pointer-events: visiblePainted;
}
.native-polygon .det-pill { pointer-events: auto; }
.native-polygon.current .det-polygon polygon {
  stroke-width: calc(var(--bw) * 2);
  animation: active-polygon-pulse 1.8s ease-in-out infinite;
}
.native-polygon.dup-candidate .det-polygon polygon {
  stroke-dasharray: calc(var(--bw) * 4) calc(var(--bw) * 2);
}
@keyframes active-polygon-pulse {
  0%, 100% { fill-opacity: 0.08; }
  50% { fill-opacity: 0.24; }
}
@media (prefers-reduced-motion: reduce) {
  .native-polygon.current .det-polygon polygon { animation: none; }
}
@keyframes active-cartouche-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 var(--bw) rgba(255, 255, 255, 0.8),
      0 0 calc(var(--bw) * 5) var(--bw) var(--pair-color, #E44FD7);
  }
  50% {
    box-shadow:
      0 0 0 calc(var(--bw) * 1.5) rgba(255, 255, 255, 1),
      0 0 calc(var(--bw) * 13) calc(var(--bw) * 3) var(--pair-color, #E44FD7);
  }
}
@keyframes active-link-pulse {
  0%, 100% {
    stroke-width: calc(var(--bw) * 1.5);
    filter: drop-shadow(0 0 calc(var(--bw) * 2) var(--pair-color, #E44FD7));
  }
  50% {
    stroke-width: calc(var(--bw) * 2.4);
    filter: drop-shadow(0 0 calc(var(--bw) * 6) var(--pair-color, #E44FD7));
  }
}
@media (prefers-reduced-motion: reduce) {
  .det-box.current, .cart-box.linked, .cart-box.selected, .cart-box.proposed, .link-svg polyline {
    animation: none;
  }
}

/* pendant le tour de liaison : vignette suspendue (le trait de rappel peut mener loin) */
body.liaison-active .focus-vignette { display: none; }
body.proof-active .focus-vignette { display: none; }

/* vignettage de focus (variantes A et C) : assombrit la périphérie pour guider
   le regard vers la boîte courante, toujours centrée par goToDetection */
.focus-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 15; /* au-dessus des overlays de détection, sous les panneaux */
  background: radial-gradient(circle farthest-corner at 50% 50%,
    rgba(0,0,0,0) 0%, rgba(0,0,0,0) 10%, rgba(0,0,0,0.65) 100%);
}

/* rectangle de zone (outil Z) : reste affiché pendant le choix de l'action */
.zone-rect {
  position: absolute;
  border: var(--bw) dashed #4E8FE8;
  background: rgba(78, 143, 232, 0.08);
  pointer-events: none;
  z-index: 3;
}
.zone-rect.ocr-zone {
  border-color: var(--edit);
  background: rgba(232, 163, 61, 0.13);
  box-shadow: 0 0 0 calc(var(--bw) * 2) rgba(10, 10, 10, 0.52);
}

.thickness-zones { pointer-events: none; }
.thickness-zone {
  border-color: var(--zone-color);
  background: color-mix(in srgb, var(--zone-color) 12%, transparent);
}
.thickness-zone span {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  font-size: var(--fs);
  line-height: 1.5;
  padding: 0 .4em;
  color: #1a1e21;
  background: var(--zone-color);
}
.thickness-mode .vd-card,
.thickness-mode .cart-box { visibility: hidden !important; }

/* rectangle de tracé (ajout manuel), en coordonnées écran */
.rubber-band {
  position: absolute; left: 0; top: 0;
  border: 2px dashed #fff;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

/* poignées d'édition (taille écran gérée en JS via l'échelle monde) */
.handle {
  position: absolute;
  background: #fff; border: 1px solid #000; border-radius: 15%;
  pointer-events: auto; z-index: 6;
}
.handle.rotate {
  border-radius: 50%;
  background: #7fb34d;
  cursor: grab;
}
.handle.rotate:active { cursor: grabbing; }

/* bandeau supérieur des raccourcis */
/* toujours visible en entier : la liste passe à la ligne au lieu de déborder
   hors de l'écran quand la fenêtre est étroite */
.shortcuts {
  flex: none;
  display: flex; flex-wrap: wrap; gap: 3px 10px;
  align-items: center; justify-content: center;
  padding: 5px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2);
  z-index: 30;
}
.shortcuts span { white-space: nowrap; }

/* ---------- panneaux flottants (raison, édition, doublon) ---------- */

.float-panel {
  position: absolute;
  left: 50%; bottom: 86px;
  transform: translateX(-50%);
  background: rgba(22,22,22,0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 40;
  min-width: 420px;
  max-width: 640px;
}
.float-panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin-bottom: 9px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }
.chip {
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #1c1c1c;
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { border-color: #4a4a4a; }
.chip.selected { border-color: var(--pending); color: var(--pending); }
.float-panel .free-row { display: flex; gap: 8px; }
.float-panel input[type="text"] { flex: 1; }
.float-panel .hint { font-size: 11px; color: var(--text-2); margin-top: 8px; }
.edit-grid { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
/* propositions de cote lues sur le plan : rien n'est écrit sans un clic */
.cote-props { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 10px; }
.cote-props .hint { margin-top: 0; }
.cote-props .chip { font-variant-numeric: tabular-nums; }
.cote-read-panel {
  width: min(680px, calc(100% - 28px));
}
.cote-read-panel:focus { outline: 2px solid var(--edit); outline-offset: 2px; }
.cote-ocr-meta {
  color: var(--text-2);
  font-size: 12px;
  margin-bottom: 8px;
}
.cote-raw {
  max-height: 74px;
  overflow: auto;
  padding: 7px 9px;
  margin-bottom: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #101010;
  font: 12px/1.35 ui-monospace, "SFMono-Regular", monospace;
  white-space: pre-wrap;
}
.cote-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}
.cote-choice {
  font-variant-numeric: tabular-nums;
}
.cote-choice.selected {
  border-color: var(--edit);
  color: var(--edit);
  box-shadow: inset 0 0 0 1px var(--edit);
}
.cote-confirm-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
}
.cote-confirm-row label {
  color: var(--text-2);
  font-size: 12px;
}
.cote-keyboard-help {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
}
.edit-grid label { font-size: 12px; color: var(--text-2); }
.panel-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* voile de pause */
#pause-veil {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.82);
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
#pause-veil .big { font-size: 26px; font-weight: 650; }

/* toast */
#toast {
  position: fixed; left: 50%; top: 92px; transform: translateX(-50%);
  background: #202020; border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px; z-index: 120; font-size: 13px;
}

/* ---------- Variante A ---------- */

.va-info {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(10,10,10,0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 18px;
  z-index: 20;
  font-size: 15px;
}
.va-info .label { font-size: 20px; font-weight: 700; }
.va-info .score-pill { font-size: 16px; font-weight: 700; padding: 2px 10px; border-radius: 9px; }
.va-actions {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 10px; z-index: 20;
}
.va-actions button { font-size: 15px; padding: 12px 22px; }
.va-actions .btn-validate { background: var(--ok); border-color: var(--ok); color: #04160b; font-weight: 700; font-size: 17px; padding: 12px 34px; }
.va-actions .btn-validate:hover { background: #2fd67a; }
.minimap-wrap {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: #000;
}
.minimap-wrap canvas { display: block; cursor: crosshair; touch-action: none; }
body.minimap-hidden .minimap-wrap { display: none; }

/* ---------- Interface : fiche d'info horizontale, flottante sur le plan ---------- */

.vd-card {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  z-index: 24;
  width: min(1040px, calc(100% - 36px));
  min-width: 0;
  background: rgba(22,22,22,0.94);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px 8px;
  cursor: default;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.vd-mainline {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr) minmax(0, 0.85fr);
  align-items: center;
  gap: 18px;
}
.vd-row1 { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.vd-scores { margin-left: auto; display: flex; gap: 10px; }
.vd-score { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.vd-score .k { font-size: 9px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.vd-score-pill { font-size: 14px; font-weight: 700; padding: 1px 9px; border-radius: 8px; }
/* paires légende/valeur : chaque texte de la fiche dit ce qu'il est */
.vd-kv .k {
  font-size: 9px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 1px;
}
.vd-kv .v { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.vd-kv .v.big { font-size: 19px; font-weight: 700; }
.vd-edit-value {
  display: block; width: 100%; min-width: 42px; padding: 2px 5px;
  margin: -2px -5px; text-align: left; color: inherit;
  background: transparent; border: 1px solid transparent; border-radius: 5px;
}
.vd-edit-value:hover, .vd-edit-value:focus-visible {
  border-color: #f5b301; background: rgba(245,179,1,0.1); outline: none;
}
.vd-kv-editable .k::after { content: " · modifier"; opacity: 0; }
.vd-kv-editable:hover .k::after, .vd-kv-editable:focus-within .k::after { opacity: 0.8; }
.vd-inline-input {
  width: min(150px, 100%); min-width: 64px; padding: 3px 6px;
  color: var(--text); background: var(--bg); border: 1px solid #f5b301;
  border-radius: 5px; font: inherit; font-weight: 600;
}
.vd-inline-input.big { font-size: 19px; font-weight: 700; }
.vd-inline-select { width: min(220px, 100%); cursor: pointer; }
.vd-inline-input.invalid { border-color: var(--ko); }
.vd-dims {
  display: flex; justify-content: space-around; gap: 18px;
  min-width: 0; padding-left: 18px;
  border-left: 1px solid var(--border);
}
.vd-refrow {
  display: flex; justify-content: space-between; align-items: end; gap: 20px;
  min-width: 0; padding-left: 18px;
  border-left: 1px solid var(--border);
}
/* état de la liaison au cartouche : scores de preuve et d'OCR toujours distincts */
.vd-liaison {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin-top: 7px; padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.vd-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; align-items: center; margin-top: 6px; }

@media (max-width: 1050px) {
  .vd-card { width: calc(100% - 20px); }
  .vd-mainline { gap: 10px; }
  .vd-dims, .vd-refrow { padding-left: 10px; }
  .vd-dims { gap: 10px; }
  .vd-kv .v.big { font-size: 17px; }
}

/* panneau note + input épaisseur de l'outil zone */
.note-input {
  width: 100%; resize: vertical; min-height: 70px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px; font: inherit; margin: 6px 0;
}
.ep-input { width: 80px; }

/* ---------- Variante B ---------- */

.vb-bar {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
  background: rgba(22,22,22,0.82);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  z-index: 20;
}
.vb-bar .det-meta { display: flex; align-items: center; gap: 10px; margin-right: 8px; font-size: 14px; }
.vb-bar .score-pill { font-weight: 700; padding: 1px 8px; border-radius: 8px; font-size: 13px; }

/* badge d'incertitude (vue devis : appariement large, position estimée) */
.badge-warn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--edit);
  color: var(--edit);
  white-space: nowrap;
}

/* ---------- Variante C ---------- */

.vc-list-pane {
  width: 360px; flex: none;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-height: 0;
}
.vc-filters {
  padding: 10px; display: flex; flex-wrap: wrap; gap: 6px;
  border-bottom: 1px solid var(--border);
}
.vc-filters select { font-size: 12px; padding: 4px 6px; }
.vc-bulk { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; font-size: 12px; }
.vc-scroll { flex: 1; overflow-y: auto; position: relative; }
.vc-spacer { position: relative; width: 100%; }
.vc-row {
  position: absolute; left: 0; width: 100%; height: 56px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 10px;
  border-bottom: 1px solid #1e1e1e;
  cursor: pointer; user-select: none;
}
.vc-row:hover { background: #1b1b1b; }
.vc-row.current { background: #20242b; box-shadow: inset 3px 0 0 var(--pending); }
.vc-row.selected { background: #1d2733; }
.vc-row img { width: 44px; height: 44px; border-radius: 4px; background: #000; flex: none; }
.vc-row .meta { flex: 1; min-width: 0; }
.vc-row .meta .l1 { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.vc-row .meta .l2 { font-size: 11px; color: var(--text-2); }
.vc-row .score-pill { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 7px; }
.vc-row .status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.vc-actions {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 20;
  background: rgba(22,22,22,0.85);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}

/* ---------- stats & comparatif ---------- */

.stats-wrap { max-width: 980px; margin: 0 auto; padding: 40px 24px; overflow-y: auto; }
.stats-wrap h1 { font-size: 20px; margin-bottom: 18px; }
.stats-cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px; min-width: 150px;
}
.stat-card .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-card .k { font-size: 12px; color: var(--text-2); }
table.data {
  border-collapse: collapse; width: 100%; margin-bottom: 26px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  border: 1px solid var(--border); padding: 7px 11px; text-align: right;
}
table.data th { background: #191919; font-weight: 600; }
table.data td:first-child, table.data th:first-child { text-align: left; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 30px; }
.devis-warning, .devis-ready {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.devis-warning { color: #FFD38A; background: rgba(232, 163, 61, 0.10); }
.devis-ready { color: #7BE0A5; background: rgba(39, 196, 107, 0.10); }
.devis-help { margin-bottom: 18px; }
/* Server-confirmed saves and per-plan activity. */
.plan-history { margin: auto; width: min(560px, calc(100vw - 40px)); max-height: 80vh; overflow: auto; padding: 24px; color: #f4f4f5; background: #1a1e21; border: 1px solid #f5b301; border-radius: 16px; }
.plan-history::backdrop { background: #0009; }
.plan-history header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.plan-history h2 { margin: 0; font-size: 20px; }
.plan-history .muted { font-size: 12px; color: #bfc2c5; }
.plan-history ol { list-style: none; padding: 0 0 0 14px; margin: 24px 0 0 6px; border-left: 2px solid #f5b301; }
.plan-history li { position: relative; display: grid; gap: 4px; padding: 0 0 22px 12px; }
.plan-history li::before { content: ""; position: absolute; width: 8px; height: 8px; left: -19px; top: 5px; border-radius: 50%; background: #f5b301; }
.plan-history li span { font-size: 13px; color: #cdd0d2; }
.plan-activity-cell { display: grid; gap: 5px; font-size: 11px; overflow-wrap: anywhere; }
.plan-activity-cell small { opacity: .65; }
#admin-plan-activity { margin: 18px 0; font-size: 13px; justify-items: start; }
#server-save-status { font-size: 11px; }
#server-save-status[data-state="saved"] { color: #8edca0; }
#server-save-status[data-state="error"] { color: #ffb1a6; border-color: #ffb1a6; }
.large-file-picker.is-dragging {
  outline: 3px solid #f5b301;
  background: #fff6d9;
}
.chip:focus-visible {
  outline: 3px solid #f5b301;
  outline-offset: 3px;
}
