.triage-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 0;
  padding: 12px;
  gap: 12px;
}

.triage-shell.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  height: 100vh;
  background: #f8fafc;
  padding: 16px;
}

body.triage-fullscreen-active {
  overflow: hidden;
}

.triage-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.triage-view-tabs {
  display: flex;
  gap: 8px;
}

.triage-view-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.triage-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.triage-stat {
  display: flex;
  flex-direction: column;
  min-width: 64px;
}

.triage-stat-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.triage-stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.triage-progress-wrap {
  min-width: 180px;
  flex: 1;
}

.triage-progress-label {
  font-size: 12px;
  color: #475569;
  margin-bottom: 4px;
}

.triage-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.triage-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.triage-header-actions {
  margin-left: auto;
}

.triage-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.triage-columns {
  display: flex;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.triage-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-height: 0;
}

.triage-column.is-collapsed {
  flex: 0 0 42px;
  min-width: 42px;
}

.triage-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.triage-column.is-collapsed .triage-column-header {
  flex-direction: column;
  justify-content: flex-start;
  padding: 10px 6px;
  height: 100%;
  border-bottom: none;
}

.triage-column-toggle {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

.triage-column-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-column.is-collapsed .triage-column-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 12px;
  margin-top: 8px;
}

.triage-column-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px;
}

.triage-column.is-collapsed .triage-column-body {
  display: none;
}

.triage-header-left {
  margin-right: auto;
}

.triage-obs-visits {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.triage-obs-list-host {
  margin-top: 8px;
}

.triage-obs-list-row.is-merged {
  opacity: 0.65;
}

.triage-merged-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.triage-element-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.triage-element-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.triage-element-edit {
  flex-shrink: 0;
}

.triage-element-block {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.triage-element-block.is-dragging {
  opacity: 0.55;
}

.triage-element-block.is-drop-target {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.triage-drag-handle {
  border: none;
  background: #f1f5f9;
  border-radius: 4px;
  cursor: grab;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  padding: 4px 2px;
}

.triage-drag-handle:active {
  cursor: grabbing;
}

.triage-element-content {
  min-width: 0;
}

.triage-element-remove {
  align-self: start;
}

.triage-inline-status {
  margin-left: 8px;
  font: inherit;
  font-size: 12px;
}

.triage-preview-summary {
  margin-bottom: 12px;
}

.triage-preview-summary-text {
  font-size: 14px;
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.triage-preview-summary-text p {
  margin: 0 0 0.5rem;
}

.triage-preview-summary-text p:last-child {
  margin-bottom: 0;
}

.triage-preview-summary-text h2,
.triage-preview-summary-text h3,
.rich-text-editor .ql-editor h2,
.rich-text-editor .ql-editor h3 {
  margin: 0.85rem 0 0.45rem;
  line-height: 1.3;
}

.triage-preview-summary-text h2:first-child,
.triage-preview-summary-text h3:first-child,
.rich-text-editor .ql-editor h2:first-child,
.rich-text-editor .ql-editor h3:first-child {
  margin-top: 0;
}

.triage-preview-summary-text ul,
.triage-preview-summary-text ol {
  margin: 0.35rem 0 0.5rem 1.25rem;
  padding: 0;
}

.triage-preview-summary-text li {
  margin-bottom: 0.25rem;
}

.triage-preview-manual {
  margin-bottom: 12px;
}

.triage-preview-manual h2,
.triage-preview-manual h3,
.triage-preview-manual h4 {
  margin: 0 0 8px;
}

.triage-preview-text {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.triage-matrix-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  width: min(960px, 94vw);
  max-height: 88vh;
}

.triage-matrix-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.triage-matrix-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.triage-matrix-dialog-header h3 {
  margin: 0;
  font-size: 16px;
}

.triage-matrix-dialog-body {
  padding: 12px 16px;
  max-height: calc(88vh - 56px);
  overflow: auto;
}

.triage-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.triage-panel h3,
.triage-panel h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}

.triage-panel-body {
  padding: 10px 12px;
  overflow: auto;
  flex: 1;
}

.triage-panel-matrix {
  height: 100%;
}

.triage-report-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
}

.triage-report-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.triage-report-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.triage-report-pane-panel {
  flex: 1;
  min-height: 0;
}

.triage-report-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  height: 100%;
  min-height: 480px;
}

.triage-visits-panel {
  min-height: 0;
}

.triage-doc-panel {
  min-height: 0;
}

.triage-visit-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 13px;
}

.triage-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.triage-matrix th,
.triage-matrix td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: center;
}

.triage-matrix td.count-cell {
  cursor: pointer;
}

.triage-matrix td.count-cell:hover {
  background: #f1f5f9;
}

.triage-drilldown {
  margin-top: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.triage-obs-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 13px;
}

.triage-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.triage-flow-hint {
  margin: 0 0 12px;
}

.triage-flow-obs-grid.hidden {
  display: none;
}

.triage-merge-existing-preview.hidden,
.triage-merge-category-hint.hidden,
.triage-merge-target-field.hidden {
  display: none;
}

.triage-merge-target-label {
  display: block;
  margin-bottom: 0.35rem;
}

.triage-merge-target:disabled {
  opacity: 1;
  color: #334155;
  background: #f8fafc;
  cursor: default;
}

.triage-merge-existing-card {
  border: 1px solid #86efac;
  background: #ecfdf5;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
}

.triage-merge-target {
  font: inherit;
  width: 100%;
}

.btn.linkish {
  background: none;
  border: none;
  color: #2563eb;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.triage-flow-section {
  margin-bottom: 16px;
}

.triage-flow-section h4 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font-size: 13px;
  color: #334155;
}

.triage-flow-obs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.triage-flow-obs,
.triage-flow-statement,
.triage-flow-chip {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  background: #fff;
}

.triage-flow-obs {
  background: #fffbeb;
  border-color: #fde68a;
}

.triage-flow-group {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.triage-flow-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.triage-flow-chip {
  max-width: 260px;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.triage-flow-arrow {
  text-align: center;
  color: #64748b;
  font-size: 18px;
  margin: 6px 0;
}

.triage-flow-statement {
  background: #ecfdf5;
  border-color: #86efac;
}

.triage-flow-meta {
  font-size: 11px;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.triage-statements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.triage-statements-table th,
.triage-statements-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  vertical-align: top;
}

.triage-statements-table th {
  background: #f8fafc;
  text-align: left;
}

.triage-statement-inline {
  width: 100%;
  min-width: 220px;
  min-height: 72px;
  font: inherit;
}

.triage-title-page-preview {
  margin-bottom: 1rem;
}

.triage-title-page-block .final-report-revisions-table {
  font-size: 0.8rem;
}

.triage-title-page-block .final-report-revisions-table th,
.triage-title-page-block .final-report-revisions-table td {
  padding: 0.3rem 0.35rem;
}

.triage-doc-block + .triage-doc-block {
  margin-top: 16px;
}

.triage-summary-input {
  width: 100%;
  min-height: 90px;
  font: inherit;
}

.triage-summary-editor .md-split {
  grid-template-columns: 1fr;
  min-height: 10rem;
}

.triage-summary-editor .md-preview {
  display: none;
}

.triage-summary-editor .md-input {
  min-height: 10rem;
  resize: vertical;
}

.triage-doc-preview {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.triage-doc-element {
  margin-bottom: 12px;
}

.triage-doc-element h2,
.triage-doc-element h3 {
  margin: 0 0 8px;
}

.triage-doc-statement {
  border-left: 3px solid #22c55e;
  padding-left: 10px;
  margin: 0.65rem 0 1rem;
}

.triage-doc-statement-text {
  margin-top: 0.35rem;
  font-size: 14px;
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.triage-doc-statement-visits {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #64748b;
}

.triage-doc-statement-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-start;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.triage-doc-figure {
  margin: 0;
  flex: 0 1 calc(33.333% - 0.6rem);
  min-width: min(180px, 100%);
  max-width: 100%;
}

.triage-doc-figure img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.triage-doc-figure figcaption {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}

.triage-type-banner {
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  margin: 0.65rem 0 0.35rem;
  color: #fff;
}

.triage-type-banner--info { background: #1d4ed8; }
.triage-type-banner--best_practice { background: #15803d; }
.triage-type-banner--advisory { background: #a16207; }
.triage-type-banner--issue { background: #b91c1c; }
.triage-type-banner--__none__ { background: #64748b; }

.triage-category-banner-nested {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
}

.triage-preview-order {
  margin-bottom: 8px;
}

.triage-doc-manual {
  margin-bottom: 12px;
}

.triage-doc-outcomes .findings-category-banner:first-child {
  margin-top: 0;
}

.triage-toolbar .btn.small.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.triage-obs-by-category .findings-category-banner {
  margin-top: 12px;
}

.triage-obs-list-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

.triage-obs-row-actions {
  flex-shrink: 0;
  padding-top: 1px;
}

.triage-pull-outcome-btn {
  white-space: nowrap;
  font-size: 0.72rem;
  padding: 0.22rem 0.5rem;
}

.triage-obs-list-body {
  flex: 1;
  font-size: 13px;
}

.triage-obs-list-text {
  margin: 4px 0;
  white-space: pre-wrap;
}

.triage-severity-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  margin-bottom: 4px;
}

.triage-merge-dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  max-width: 720px;
  width: calc(100vw - 32px);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.triage-merge-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.triage-merge-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.triage-merge-form h3 {
  margin: 0;
}

.triage-merge-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.triage-merge-field select,
.triage-merge-text {
  font: inherit;
  width: 100%;
}

.triage-merge-text {
  min-height: 140px;
}

.triage-merge-sources {
  max-height: 160px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  background: #f8fafc;
}

.triage-merge-source {
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
}

.triage-merge-source:last-child {
  border-bottom: none;
}

.triage-merge-severity {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.triage-merge-severity .findings-severity-group {
  gap: 0.35rem;
}

.triage-merge-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.triage-merge-image-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
}

.triage-merge-image-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.triage-element-input {
  width: 100%;
  font: inherit;
  margin-bottom: 6px;
}

.triage-doc-element-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.triage-merge-category-hint {
  margin: -4px 0 0;
  font-size: 12px;
}

.triage-source-cat-chip {
  display: inline-block;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  margin: 0 4px 4px 0;
}

.triage-source-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  margin-right: 6px;
}

.triage-merge-source-meta,
.triage-obs-list-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.triage-obs-image-badge {
  display: inline-flex;
  align-items: center;
  color: #2563eb;
  flex-shrink: 0;
}

.triage-obs-author {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  margin-bottom: 2px;
}

.triage-selection-badge {
  font-weight: 600;
  color: #2563eb;
}

@media (max-width: 1100px) {
  .triage-report-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .triage-report-main {
    grid-template-rows: auto;
  }

  .triage-shell {
    height: auto;
  }
}

.final-report-visits-summary {
  margin: 1rem 0 1.25rem;
}

.final-report-visits-summary h2,
.final-report-visits-summary h4 {
  margin: 0 0 0.5rem;
}

.final-report-visits-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
}

.final-report-visits-line,
.final-report-visits-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #0f172a;
}

.final-report-visits-text {
  margin-top: 0.35rem;
}

.final-report-visits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.final-report-visits-table th,
.final-report-visits-table td {
  border: 1px solid #e2e8f0;
  padding: 0.45rem 0.55rem;
  vertical-align: top;
  text-align: left;
}

.final-report-visits-table th {
  background: #1e293b;
  color: #fff;
  font-weight: 600;
}

.final-report-visits-table td:last-child {
  white-space: normal;
}
