/* The lab's page, on top of the dashboard's stylesheet (pilotage.css, copied
   at build): same tokens, same frame, same sheets. Only what the dashboard
   does not have: buttons, fields, the marked text and the correction tool,
   after the components of the application (docs/design/DESIGN.md). */

:root { --primary-hover: #174a3e; --disabled: #eff1f0; --on-danger: #ffffff; --danger-hover: #8f2f22; }
@media (prefers-color-scheme: dark) {
  :root:not(:has(#th-light:checked)) { --primary-hover: #9ad7c1; --disabled: #222323; --on-danger: #1a0d0b; --danger-hover: #f6a69b; }
}
:root:has(#th-dark:checked) { --primary-hover: #9ad7c1; --disabled: #222323; --on-danger: #1a0d0b; --danger-hover: #f6a69b; }

/* Buttons: normal 32 px, weight 500, border 1, radius 6; 44 px to the touch */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--button-line); border-radius: 6px; background: var(--sheet); color: var(--ink);
  font: 500 13px/18px inherit; font-family: inherit; cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 1px 0 rgb(16 22 20 / .06), var(--shadow-sheet);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { border-color: var(--button-line-hover); background: var(--row-hover); }
.btn:active { transform: scale(.97); box-shadow: inset 0 1px 2px rgb(16 22 20 / .12); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 1px var(--focus), 0 0 0 4px color-mix(in srgb, var(--focus) 28%, transparent); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover { background: var(--row-hover); border-color: transparent; color: var(--ink); }
.btn:disabled { background: var(--disabled); border-color: transparent; box-shadow: none; color: var(--ink-3); cursor: not-allowed; transform: none; }
@media (pointer: coarse) { .btn { min-height: 44px; } }

/* Fields: visible label above, 32 px control */
.form { display: grid; gap: 12px; margin-top: 10px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); padding: 0; }
.field input:not([type="checkbox"]), .field select, .field textarea {
  width: 100%; min-height: 32px; padding: 6px 10px; border: 1px solid var(--button-line); border-radius: 6px;
  background: var(--sheet); color: var(--ink); font: inherit; box-shadow: var(--shadow-sheet);
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--button-line-hover); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 0; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}
.field input[type="file"] { padding: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt span { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--button-line);
  background: var(--sheet); color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer; }
.opt input:checked + span { background: var(--primary-tint); border-color: transparent; color: var(--primary); }
.opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--review-tint);
  border: 1px solid var(--review-line); font-size: 13px; font-weight: 500; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.actions .meta { flex: 1 1 200px; }

/* The marked text, as in the review of the application */
.doc { margin: 0; padding: 14px 16px; background: var(--ground); border: 1px solid var(--rule); border-radius: 8px;
  font: 15px/1.75 "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
mark { color: inherit; border-radius: 3px; padding: 1px 2px; cursor: pointer; }
mark.garde, .swatch.garde { background: var(--primary-tint); box-shadow: inset 0 -1.5px 0 var(--primary); }
mark.a-trancher, .swatch.a-trancher { background: var(--review-tint); box-shadow: inset 0 0 0 1px var(--review-line), inset 0 -1.5px 0 var(--review); }
mark:hover { filter: brightness(.97); }
mark:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.swatch { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend { margin-bottom: 10px; }

/* The correction screen: the text, and beside it what to settle and ask */
.correction { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; align-items: start; margin-top: 14px; }
.side { display: grid; gap: 14px; position: sticky; top: 16px; }
.texte-sheet > header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 8px; }
.sheet > header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.toolbar .btn-primary { margin-left: auto; }
.row .actions { justify-content: flex-end; }
.row strong { font-weight: 500; overflow-wrap: anywhere; }
#feuilles .row { grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; }
#desaccords .row { grid-template-columns: minmax(0, 1fr); gap: 6px; }

/* The tool on a passage: a floating sheet */
.outil { position: fixed; right: 24px; bottom: 24px; width: min(380px, calc(100vw - 32px)); z-index: 10; display: grid; gap: 10px;
  padding: 16px 18px; background: var(--sheet); border: 1px solid var(--sheet-line); border-radius: 10px; box-shadow: var(--shadow-float); }
.outil[hidden] { display: none; }
.valeur { margin: 0; font-weight: 500; font-size: 15px; overflow-wrap: anywhere; }

/* Talking with Claude */
.chat { display: grid; gap: 8px; margin: 10px 0; }
.chat:empty { display: none; }
.chat p { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--panel); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat p.moi { background: var(--primary-tint); justify-self: end; max-width: 90%; }

.figures dd { font-variant-numeric: tabular-nums; }
pre.doc[hidden] { display: none; }

@media (max-width: 900px) {
  .correction { grid-template-columns: 1fr; }
  .side { position: static; }
  .toolbar .btn-primary { margin-left: 0; }
  .outil { left: 16px; right: 16px; bottom: 16px; width: auto; }
  #feuilles .row { grid-template-columns: minmax(0, 1fr) auto; }
  #feuilles .row .ref { display: none; }
}
#desaccords .row .meta { text-align: left; margin-top: 2px; }
.sheet .actions + .field, .sheet .chat + .field { margin-top: 12px; }
.sheet .field + .actions { margin-top: 8px; }
.field.narrow { max-width: 260px; }
.sous-titre { font-size: 13px; font-weight: 500; margin: 6px 0 4px; display: flex; align-items: center; gap: 8px; }
.chips.categories { max-height: 180px; overflow-y: auto; padding: 2px; }
#commandes .row { grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; }
.field input[type="file"]::file-selector-button {
  margin-right: 10px; min-height: 28px; padding: 0 12px; border: 1px solid var(--button-line); border-radius: 6px;
  background: var(--sheet); color: var(--ink); font: 500 13px/18px "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.field input[type="file"]::file-selector-button:hover { border-color: var(--button-line-hover); background: var(--row-hover); }
#feuilles .row .actions { flex-wrap: nowrap; }
@media (max-width: 900px) {
  #feuilles .row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  #feuilles .row .actions { justify-content: space-between; }
}
details.plus { margin-top: 12px; }
details.plus > summary { font-size: 13px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 8px; min-height: 32px; }
details.plus > .rows, details.plus > .sheet { margin-top: 6px; }
#manques .row, #manques .row .meta { grid-template-columns: minmax(0, 1fr); grid-column: 1; text-align: left; }
#manques .row { gap: 4px; }
.manque-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
#manques .valeur { font-size: 14px; }
.nuits-table { min-width: 520px; }
.nuits-table td:first-child { white-space: nowrap; }
.delta { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.delta.mieux { color: var(--valid); }
.delta.moins { color: var(--danger); }
