/* One document surface for SPL, EHS, DMT and the FAR guide. Camera controls
   retain their own full-screen layout in scan-label-workspace.css. */
.modal-backdrop > .modal.document-tool:not(.scan-label-workspace) {
  width:min(760px,100%); max-width:760px; max-height:calc(100dvh - 32px);
  background:var(--surface); color:var(--ink);
}
.document-tool:not(.scan-label-workspace) .modal-head {
  flex:none; display:flex; align-items:center; gap:12px; min-height:64px;
  padding:12px 18px; background:var(--primary-dark); color:#fff; border:0;
}
.document-tool .document-heading { flex:1; min-width:0; text-align:left; }
.document-tool:not(.scan-label-workspace) .modal-head h2 { margin:0; font-size:var(--ui-title-size); font-weight:var(--ui-title-weight); letter-spacing:-.025em; line-height:1.25; color:inherit; }
.modal-backdrop .document-tool:not(.scan-label-workspace) .modal-head button {
  flex:none; min-width:44px; min-height:44px; padding:8px 10px;
  border:1px solid #ffffff50; border-radius:8px; background:transparent; color:#fff;
  box-shadow:none; font-size:14px; white-space:nowrap;
}
@media (hover:hover) and (pointer:fine) { .modal-backdrop .document-tool:not(.scan-label-workspace) .modal-head button:hover { background:#ffffff18; color:#fff; transform:none; } }
.document-tool:not(.scan-label-workspace) .modal-body { min-height:0; overflow:auto; padding:18px; background:var(--surface); overscroll-behavior:contain; }
.document-tool .document-context { margin:0 0 18px; padding:0 0 16px; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; color:var(--ink-2); font-size:13px; line-height:1.5; }
.document-tool .document-section { margin:0 0 20px; padding:0; border:0; border-radius:0; background:transparent; }
.document-tool .document-section h3 { margin:0 0 14px; color:var(--ink); font-size:17px; line-height:1.3; }
.document-tool .document-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.document-tool .document-section-head h4 { margin:0; font-size:16px; }
.document-tool .document-section-head button { min-height:44px; }
.document-tool .form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; align-items:start; }
.document-tool:not(.scan-label-workspace) .field { min-width:0; gap:6px; color:var(--ink-2); font-size:13px; font-weight:600; text-transform:none; letter-spacing:0; }
.document-tool:not(.scan-label-workspace) :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
  box-sizing:border-box; width:100%; min-width:0; min-height:44px; padding:10px 11px;
  border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--ink);
  font:inherit; font-size:16px; box-shadow:none;
}
.document-tool input[readonly] { background:var(--surface-2); color:var(--ink-2); }
.document-tool [aria-invalid="true"] { border-color:var(--danger); }
.document-tool input::placeholder, .document-tool textarea::placeholder { color:var(--muted); opacity:1; }
.document-tool .document-note { margin:12px 0 0; color:var(--muted); font-size:12px; line-height:1.5; }
.document-tool .document-status { flex:0 0 100%; margin:0; color:var(--muted); font-size:12px; line-height:1.4; }
.document-tool .document-status:empty { display:none; }
.document-tool:not(.scan-label-workspace) .modal-foot { flex:none; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; padding:12px 18px; border-top:1px solid var(--line); background:var(--surface); }
.document-tool:not(.scan-label-workspace) .modal-foot button { min-width:0; min-height:var(--ui-action-height); padding:10px 16px; border-radius:var(--ui-control-radius); font-size:15px; }
.document-tool:not(.scan-label-workspace) .modal-foot [data-document-primary] { background:var(--primary-dark); color:#fff; border-color:var(--primary-dark); }
[data-document-tool][aria-busy="true"] .modal-foot [data-document-primary] { cursor:wait; opacity:.6; }

/* EHS keeps the three safety steps and its compact document proportions. */
.modal-backdrop > .modal.document-tool:is(.ehs-wizard,.dmt-wizard) { max-width:540px; height:min(850px,calc(100dvh - 32px)); }
.document-tool .ehs-header-back { order:-1; }
.document-tool .ehs-wizard-progress { margin:0 auto 20px; max-width:350px; }
.document-tool .ehs-wizard-progress li { font-size:12px; }
.document-tool .ehs-wizard-page h3 { font-size:22px; margin:0 0 16px; }
.document-tool .ehs-hazard-grid { grid-template-columns:1fr; gap:0; }
.document-tool .ehs-hazard-toggle { min-height:60px; padding:12px 0; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; font-size:14px; }
.document-tool .ehs-hazard-choice { flex:none; }
.document-tool .ehs-hazard-choice label { min-height:44px; gap:6px; }
.document-tool :is(.ehs-hazard-choice input,.ehs-declaration-note input) { width:21px; height:21px; accent-color:var(--primary-dark); }
.document-tool .ehs-signature-field { grid-column:1 / -1; }
.document-tool .ehs-signature-preview { min-height:56px; margin-top:8px; }
.document-tool .ehs-declaration-note { padding:16px 0 0; margin-top:16px; border:0; border-top:1px solid var(--line); font-size:14px; line-height:1.5; background:transparent; }
.document-tool .ehs-wizard-foot .spacer { display:none; }
.document-tool .ehs-wizard-foot button { flex:1 1 0; }
.document-tool .dmt-question-grid { margin:0; grid-template-columns:1fr; gap:0; }
.document-tool .dmt-question-grid label { min-height:48px; padding:12px 0; border:0; border-bottom:1px solid var(--line); border-radius:0; background:transparent; font-size:14px; }
body[data-theme="agilent-web-dark"] .document-tool .modal-head { background:#071722; border-bottom:1px solid var(--line); }

@media (max-width:768px) {
  .modal-backdrop:not(#confirmModal) > .modal.document-tool:not(.scan-label-workspace) { width:100%; max-width:none; height:100%; min-height:0; max-height:100%; border:0; border-radius:0; }
  .modal-backdrop:not(#confirmModal) > .modal.document-tool:not(.scan-label-workspace) > .modal-head { padding:calc(10px + env(safe-area-inset-top,0px)) 12px 10px; }
  .document-tool:not(.scan-label-workspace) .modal-head h2 { font-size:var(--ui-title-size); }
  .document-tool:not(.scan-label-workspace) .modal-head { gap:8px; }
  .modal-backdrop:not(#confirmModal) > .modal.document-tool:not(.scan-label-workspace) > .modal-body { padding:16px 12px; }
  .modal-backdrop:not(#confirmModal) > .modal.document-tool:not(.scan-label-workspace) > .modal-foot { padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px)); }
  .modal-backdrop:not(#confirmModal) > .modal.document-tool:not(.scan-label-workspace) > .modal-foot button { flex:1 1 0; }
  .document-tool .document-section { padding:0; }
}
@media (max-width:520px) {
  .document-tool .form-grid { grid-template-columns:1fr; }
  .document-tool .dmt-question-grid { grid-template-columns:1fr; }
}
@media (prefers-reduced-motion:no-preference) {
  .document-tool .ehs-wizard-page:not([hidden]) { animation:document-step-in .16s ease-out; }
  @keyframes document-step-in { from { opacity:.3; transform:translateY(5px); } to { opacity:1; transform:none; } }
}

.modal-backdrop .document-tool:not(.scan-label-workspace) .modal-head button[data-icon-close] { width:var(--ui-close-size); height:var(--ui-close-size); min-width:var(--ui-close-size); padding:0; border:0; border-radius:var(--ui-control-radius); background:transparent; color:#fff; font-size:27px; line-height:1; }
