/* Bridge for the reused workbench modules (FMEA viewer, Vessel Particulars,
   programme builder, document library). They emit the original markup; these
   rules dress it in the AUNAV Maritime design system instead of the old sheet. */

/* Button modifiers used by the reused modules */
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.red { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.btn.small { min-height: 34px; padding: 0 var(--s3); font-size: var(--fs-micro); }
.btn.fill { width: 100%; }

/* Notices and status text */
.notice {
  display: block; padding: var(--s3) var(--s4); border-radius: var(--r-md);
  background: var(--warn-soft); border: 1px solid var(--warn-line);
  color: var(--ink-2); font-size: var(--fs-small); line-height: 1.55; margin: var(--s3) 0;
}
[role="alert"]:not(:empty) {
  display: block; color: var(--bad); font-size: var(--fs-small);
  white-space: pre-wrap; margin: var(--s3) 0;
}
.source-hash, .hash { font-family: var(--font-mono); font-size: var(--fs-micro); overflow-wrap: anywhere; }

/* Inline forms produced by the reused modules */
.dialog__body label,
.fmea-body label {
  display: block; margin: var(--s4) 0 0;
  font-size: var(--fs-micro); font-weight: 650; color: var(--ink-3);
}
.dialog__body label > input,
.dialog__body label > select,
.dialog__body label > textarea,
.fmea-body label > input,
.fmea-body label > select {
  display: block; width: 100%; margin-top: 6px;
  min-height: var(--touch); padding: 10px var(--s3);
  background: var(--field); color: var(--ink);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-md);
  font-weight: 400;
}
.dialog__body label > textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.dialog__body input[type="checkbox"],
.dialog__body label > input[type="checkbox"] {
  display: inline-block; width: 20px; height: 20px; min-height: 0;
  margin: 0 var(--s2) 0 0; accent-color: var(--accent); vertical-align: middle;
}
.dialog__body input[type="file"] { padding: var(--s2); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--s3); }
.form-grid label { margin-top: 0; }

.workbench-toolbar { display: flex; gap: var(--s2); flex-wrap: wrap; margin: var(--s4) 0; align-items: flex-end; }
.workbench-toolbar label { margin: 0; }
.modal-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--s5); }

.dialog__body fieldset {
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  margin: var(--s4) 0; padding: var(--s4);
}
.dialog__body legend { color: var(--accent); font-weight: 650; font-size: var(--fs-micro); padding: 0 6px; }

.dialog__body h3 { font-size: var(--fs-read); margin: var(--s5) 0 var(--s2); }
.dialog__body p { color: var(--ink-2); line-height: 1.6; margin: var(--s2) 0; }
.dialog__body ul { margin: var(--s3) 0; padding-left: var(--s5); color: var(--ink-2); line-height: 1.7; font-size: var(--fs-small); }
.dialog__body pre {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--sunken);
  padding: var(--s4); border-radius: var(--r-md); max-height: 280px; overflow: auto;
  font-family: var(--font-mono); font-size: var(--fs-micro);
}
.dialog__body details { border-top: 1px solid var(--hairline-soft); padding-top: var(--s2); margin: var(--s4) 0; }
.dialog__body summary { cursor: pointer; min-height: var(--touch); display: flex; align-items: center; color: var(--accent); font-weight: 600; }

.revision-item {
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--s4); margin: var(--s3) 0; overflow-wrap: anywhere; background: var(--raised);
}
.review-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.review-table th, .review-table td {
  text-align: left; vertical-align: top; padding: var(--s3);
  border: 1px solid var(--hairline); overflow-wrap: anywhere;
}
.review-table th { background: var(--raised); font-weight: 650; color: var(--ink-3); }

.context-details { display: grid; grid-template-columns: minmax(110px, .6fr) minmax(0, 1.4fr); gap: 8px var(--s4); font-size: var(--fs-small); margin: var(--s4) 0; }
.context-details dt { color: var(--ink-3); }
.context-details dd { margin: 0; overflow-wrap: anywhere; }

.import-diagnostics { overflow-wrap: anywhere; }
.import-diagnostics p { margin: var(--s3) 0; }

/* Legacy pill/tag/chip names reused inside workbench markup */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px var(--s3); border-radius: var(--r-pill);
  border: 1px solid var(--hairline); color: var(--ink-3);
  font-size: var(--fs-micro); font-weight: 600; white-space: nowrap;
}
.pill.good { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill.fail { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.tag.teal { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.tag.fail { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }

/* FMEA drawer, rendered outside the dialog by the reused viewer */
.fmea-drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 920;
  width: min(640px, 92vw); display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-3);
}
.fmea-drawer header {
  flex: none; display: flex; justify-content: space-between; gap: var(--s3);
  padding: var(--s4); border-bottom: 1px solid var(--hairline);
}
.fmea-drawer header strong { font-size: var(--fs-read); }
.fmea-drawer small { display: block; color: var(--ink-3); font-size: var(--fs-micro); margin-top: 5px; overflow-wrap: anywhere; }
.fmea-body { flex: 1; overflow: auto; padding: var(--s4); }
.fmea-body p { font-size: var(--fs-small); line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.fmea-body object, .fmea-body canvas { width: 100%; background: #fff; border-radius: var(--r-md); }
@media (max-width: 760px) { .fmea-drawer { width: 100%; } }

/* Report preview controls from report-preview.js */
.dialog__body iframe { border: 1px solid var(--hairline); border-radius: var(--r-md); background: #fff; }
