/*
 * Arbotech Field Operations App
 * Incident Investigation Report v1
 */

.incident-investigation-screen {
  position: fixed;
  inset: 0;
  z-index: 3900;
  display: none;
  overflow-y: auto;
  background: #eef2f5;
}

.incident-investigation-screen.open {
  display: block;
}

#incidentInvestigationRoot {
  padding: 18px;
}

.incident-investigation-document {
  width: min(980px, 100%);
  margin: 0 auto 42px;
  padding: 26px;
  box-sizing: border-box;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

.incident-investigation-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 3px solid #1f5132;
  text-align: center;
}

.incident-investigation-header h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.incident-investigation-header h2 {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.incident-investigation-section label > span,
.incident-investigation-signature-details span {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.incident-investigation-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}

.incident-investigation-section h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.incident-investigation-two-column,
.incident-investigation-when-grid,
.incident-investigation-approval-grid {
  display: grid;
  gap: 14px;
}

.incident-investigation-two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.incident-investigation-when-grid {
  grid-template-columns: 180px 160px minmax(0, 1fr);
}

.incident-investigation-approval-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.incident-investigation-section label,
.incident-investigation-signature-card label,
.incident-investigation-comment-label {
  display: grid;
  gap: 7px;
}

.incident-investigation-wide {
  display: grid;
  gap: 7px;
}

.incident-investigation-document input,
.incident-investigation-document textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
}

.incident-investigation-document textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.incident-investigation-document input[readonly],
.incident-investigation-document textarea[readonly] {
  background: #f8fafc;
  color: #111827;
}

.incident-investigation-approval-note {
  margin: 0 0 14px;
  color: #475569;
  line-height: 1.45;
}

.incident-investigation-signature-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #aebdc5;
  border-radius: 11px;
  background: #f8fafc;
}

.incident-investigation-signature-card h4 {
  margin: 0;
  color: #1f5132;
}

.incident-investigation-signature-pad-wrap {
  position: relative;
}

.incident-investigation-signature-canvas {
  display: block;
  width: 100%;
  height: 175px;
  border: 2px solid #64748b;
  border-radius: 9px;
  background: #ffffff;
  touch-action: none;
}

.incident-investigation-signature-line {
  position: absolute;
  right: 18px;
  bottom: 25px;
  left: 18px;
  border-bottom: 1px solid #64748b;
  pointer-events: none;
}

.incident-investigation-clear-signature,
.incident-investigation-actions button {
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.incident-investigation-clear-signature {
  justify-self: start;
  background: #e2e8f0;
  color: #1e293b;
}

.incident-investigation-primary-button {
  background: #1f5132;
  color: #ffffff;
}

.incident-investigation-secondary-button {
  background: #dbe4df;
  color: #173c22;
}

.incident-investigation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.incident-investigation-save-indicator {
  margin-right: auto;
  color: #475569;
  font-size: 0.9rem;
}

.incident-investigation-completion-message {
  min-height: 1.4em;
  margin-top: 14px;
  color: #1f5132;
  font-weight: 700;
}

.incident-investigation-completion-message.error {
  color: #991b1b;
}

.incident-investigation-completed-signature
.private-form-signature-image-wrap {
  min-height: 130px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
}

.incident-investigation-signature-details {
  display: grid;
  gap: 9px;
}

.incident-investigation-signature-details > div {
  display: grid;
  gap: 3px;
}

.incident-investigation-hash-row code {
  overflow-wrap: anywhere;
  font-size: 0.72rem;
}

.incident-investigation-signature-missing {
  color: #991b1b;
  font-weight: 700;
}

.incident-investigation-hidden-username {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.incident-investigation-available-row {
  display: block;
}

.available-form-row .incident-investigation-available-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.incident-investigation-recent-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.incident-investigation-recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.incident-investigation-recent-item > span:first-child {
  display: grid;
  gap: 2px;
}

.incident-investigation-status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 800;
}

.incident-investigation-status-pill.completed {
  background: #dcfce7;
  color: #166534;
}

@media (max-width: 760px) {
  #incidentInvestigationRoot {
    padding: 9px;
  }

  .incident-investigation-document {
    padding: 16px;
  }

  .incident-investigation-two-column,
  .incident-investigation-when-grid,
  .incident-investigation-approval-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  /*
   * style.css contains the Daily Tailboard print rules at the global level.
   * Those rules hide every top-level screen except #tailboardScreen and have
   * greater specificity than the previous Incident Report print selectors.
   *
   * Scope these overrides to the Incident Report print body class and target
   * the screen IDs directly so the report wins the print cascade.
   */
  body.printing-incident-investigation
  > * {
    display: none !important;
  }

  body.printing-incident-investigation
  #tailboardScreen {
    display: none !important;
  }

  body.printing-incident-investigation
  #incidentInvestigationScreen {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  body.printing-incident-investigation
  #incidentInvestigationScreen
  .tailboard-screen-topbar,
  body.printing-incident-investigation
  .incident-investigation-actions {
    display: none !important;
  }

  body.printing-incident-investigation
  #incidentInvestigationRoot {
    display: block !important;
    padding: 0 !important;
  }

  body.printing-incident-investigation
  .incident-investigation-document {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  body.printing-incident-investigation
  .incident-investigation-header,
  body.printing-incident-investigation
  .incident-investigation-section,
  body.printing-incident-investigation
  .incident-investigation-signature-card,
  body.printing-incident-investigation
  .incident-investigation-signature-details,
  body.printing-incident-investigation
  .private-form-signature-image-wrap {
    visibility: visible !important;
  }

  body.printing-incident-investigation
  .incident-investigation-section,
  body.printing-incident-investigation
  .incident-investigation-signature-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-incident-investigation
  .incident-investigation-document textarea {
    min-height: 88px;
    overflow: visible;
    resize: none;
  }

  body.printing-incident-investigation
  input,
  body.printing-incident-investigation
  textarea {
    color: #111827 !important;
    background: #ffffff !important;
    -webkit-text-fill-color: #111827 !important;
  }

  body.printing-incident-investigation
  .private-form-signature-image {
    display: block !important;
    visibility: visible !important;
    max-height: 130px !important;
  }
}
