:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --ink: #1c2333;
  --muted: #61708f;
  --line: #d9e1ef;
  --primary: #3563f5;
  --primary-dark: #2c54d3;
  --success: #dcf4e7;
  --info: #e4ebff;
  --danger: #fde6eb;
  --warn: #fff3d5;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", "Inter", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar,
main {
  max-width: 1260px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  color: #1f2a42;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0.4px;
  line-height: 1.05;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(27, 38, 65, 0.06);
  min-width: 0;
  max-width: 100%;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.panel h3 {
  margin: 16px 0 8px;
  font-size: 15px;
  color: #2e3c62;
}

.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 10px;
  min-height: 34px;
}

.panel-section-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.panel-section-head-tools #stats {
  margin: 0;
}

.panel-section-head h3 {
  margin: 0;
  font-size: 15px;
  color: #2e3c62;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-load {
  padding: 20px 20px 18px;
}

.panel-load .panel-load-title {
  margin: 0 0 18px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #141b2d;
}

.panel-load-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  min-width: 0;
}

.panel-load-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel-load .drop-zone {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 268px;
  padding: 24px 20px 26px;
  border-radius: 12px;
  border-width: 1.5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 1px 3px rgba(27, 38, 65, 0.06);
}

.panel-load .drop-zone-inner {
  max-width: none;
  width: 100%;
}

.panel-load-files {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 16px 16px;
  background: linear-gradient(165deg, #fafbff 0%, #ffffff 52%);
  border: 1px solid #e2e8f3;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(27, 38, 65, 0.05);
}

.file-list-caption-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.file-list-caption {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #1e293b;
}

.file-list-caption-row .btn-clear-list {
  flex-shrink: 0;
}

.panel-load-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #e8ecf3;
}

.panel-load-footer #analyzeBtn {
  width: 100%;
  padding: 12px 20px;
  font-size: 0.9375rem;
  font-weight: 700;
  border-radius: 12px;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 2px rgba(27, 45, 95, 0.08);
}

.panel-load-footer #analyzeBtn:hover {
  box-shadow: 0 2px 8px rgba(44, 84, 211, 0.22);
}

@media (max-width: 900px) {
  .panel-load-grid {
    grid-template-columns: 1fr;
  }

  .panel-load-files #fileList {
    flex: none;
    min-height: 120px;
    max-height: 280px;
  }
}

.panel-section-head--results-head {
  margin: 0 0 10px;
  flex-wrap: nowrap;
  gap: 12px;
}

.panel-section-head--results-head h2 {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  font-size: 18px;
}

.panel-section-head--results-head .panel-section-head-tools {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

@media (max-width: 720px) {
  .panel-section-head--results-head {
    flex-wrap: wrap;
  }

  .panel-section-head--results-head .panel-section-head-tools {
    flex-basis: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
}

.results-separator {
  border: none;
  border-top: 1px solid var(--line);
  margin: 18px 0 0;
}

.results-separator + .panel-section-head {
  margin-top: 14px;
}

/* Dezente Toolbar-Buttons (gleiche Sprache wie Graph-Zoom ±) */
.panel-section-head--results-head .panel-section-head-tools button,
#matrixFullscreenBtn,
#graphFullscreenBtn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  transform: none;
  letter-spacing: 0.02em;
}

.panel-section-head--results-head .panel-section-head-tools button:hover,
#matrixFullscreenBtn:hover,
#graphFullscreenBtn:hover {
  background: #e8edf4;
  color: #475569;
  border-color: #cbd5e1;
  transform: none;
}

.panel-section-head--results-head .panel-section-head-tools button:focus-visible,
#matrixFullscreenBtn:focus-visible,
#graphFullscreenBtn:focus-visible {
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.28);
}

.drop-zone {
  border: 1.5px dashed #8ea7ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f9ff 0%, #f0f4ff 100%);
  color: #2e406a;
  text-align: center;
  padding: 20px 16px 22px;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.drop-zone-inner {
  max-width: 520px;
  margin: 0 auto;
}

.drop-zone-lead {
  margin: 0 0 6px;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.drop-zone-or {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8b9bb8;
}

.drop-zone-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.drop-zone-hint {
  margin: 0;
  max-width: 44em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.drop-zone-hint code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #d3def0;
}

.drop-zone p {
  margin: 4px 0;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: #ecf2ff;
  box-shadow: inset 0 0 0 1px rgba(58, 99, 255, 0.15);
}

.drop-zone:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(58, 99, 255, 0.22);
}

/* Upload-Buttons als festen Bestandteil der Fläche */
.drop-zone .upload-label {
  background: #ffffff;
  border: 1px solid #c5d8f5;
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 1px 2px rgba(27, 45, 95, 0.06);
  font-size: 13px;
  color: #2d4a7c;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.drop-zone .upload-label:hover {
  background: #fbfcff;
  border-color: #9eb8ea;
  box-shadow: 0 2px 6px rgba(45, 74, 124, 0.1);
}

.drop-zone .upload-label:active {
  transform: translateY(1px);
}

.row {
  margin: 10px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.row-analyze {
  align-items: center;
  margin-top: 14px;
  gap: 12px;
}

.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid #c8d5f4;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  color: #32476f;
  font-weight: 600;
}

.upload-label:hover {
  background: #edf3ff;
}

.upload-label input {
  display: none;
}

label {
  font-size: 13px;
  color: var(--muted);
}

select,
button {
  border-radius: 10px;
  border: 1px solid #c7d3ee;
  padding: 8px 10px;
  font-size: 13px;
}

select {
  background: #ffffff;
  color: #2c3b62;
}

button {
  cursor: pointer;
  background: var(--primary);
  border-color: #2749c7;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: none;
  transform: translateY(0);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(58, 99, 255, 0.24);
}

button.btn-clear-list {
  background: #fff5f7;
  color: #9b2f48;
  border: 1px solid #f0ccd4;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
}

button.btn-clear-list:hover {
  background: #ffe9ee;
  border-color: #f2b8c3;
  color: #8a2840;
  transform: none;
}

button.btn-clear-list:focus-visible {
  box-shadow: 0 0 0 3px rgba(200, 90, 110, 0.2);
}

button.btn-fullscreen {
  flex-shrink: 0;
}

.panel-section-head--graph {
  align-items: center;
}

.panel-section-head-graph-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}

.graph-toolbar-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.panel-section-head--graph #graphMode {
  height: 26px;
  min-width: 9.5rem;
  padding: 0 26px 0 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 26px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  box-sizing: border-box;
  cursor: pointer;
}

.panel-section-head--graph #graphMode:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.panel-section-head--graph #graphMode:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.28);
}

.graph-zoom-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.panel-section-head--graph #zoomInBtn,
.panel-section-head--graph #zoomOutBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  min-width: 28px;
  min-height: 26px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  transform: none;
  box-sizing: border-box;
}

.panel-section-head--graph #zoomInBtn:hover,
.panel-section-head--graph #zoomOutBtn:hover {
  background: #e8edf4;
  color: #475569;
  border-color: #cbd5e1;
  transform: none;
}

.panel-section-head--graph #zoomInBtn:focus-visible,
.panel-section-head--graph #zoomOutBtn:focus-visible {
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.28);
}

#fileList {
  max-height: 150px;
  overflow: auto;
  border: 1px solid #e0e7f5;
  border-radius: 10px;
  background: #fdfefe;
  padding: 10px 14px;
}

.panel-load-files #fileList {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
  margin: 0;
  background: #ffffff;
  border: 1px solid #e2e9f3;
  box-shadow: inset 0 1px 2px rgba(27, 38, 65, 0.03);
}

#fileList li + li {
  margin-top: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file-btn {
  background: #ffe9ee;
  border: 1px solid #f2b8c3;
  color: #9b2f48;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  min-width: auto;
}

.remove-file-btn:hover {
  background: #ffdce5;
}

#stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #3a4d77;
  background: #eef3ff;
  border: 1px solid #d5e1fc;
}

#stats.stats-plain {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

#matrixContainer {
  max-height: 390px;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  border: 1px solid #d8e1f3;
  border-radius: 10px;
  background: var(--surface);
}

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

th,
td {
  border: 1px solid #e2e8f6;
  padding: 7px 8px;
  text-align: left;
}

.matrix-th-action {
  cursor: default;
  user-select: none;
  white-space: nowrap;
}

.matrix-th-filter-placeholder {
  background: #f5f8ff;
}

#matrixContainer td.cell-herkunft-btn {
  white-space: nowrap;
  vertical-align: middle;
  width: 1%;
  padding: 4px 6px;
}

.btn-herkunft {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #b8c6eb;
  background: #eef3ff;
  color: #2b4388;
  cursor: pointer;
}

.btn-herkunft:hover {
  background: #dfe8ff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-dialog {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid #d8e1f3;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  max-width: min(720px, calc(100vw - 48px));
  width: 100%;
  min-width: 0;
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
}

.modal-dialog--provenance {
  max-width: min(860px, calc(100vw - 48px));
  max-height: min(88vh, 680px);
}

.modal-dialog--source {
  max-width: min(920px, calc(100vw - 48px));
  max-height: min(90vh, 720px);
}

.modal-source-wrap {
  flex: 1 1 auto;
  overflow: auto;
  margin: 0 18px 12px;
  min-height: 120px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  background: #0b1220;
}

.modal-source-pre {
  margin: 0;
  padding: 8px 10px 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  font-size: 12px;
  line-height: 1.28;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
  color: #cbd5e1;
}

.modal-source-pre .src-line {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  line-height: 1.28;
}

.modal-source-pre .src-gutter {
  flex: 0 0 auto;
  min-width: 2.75em;
  text-align: right;
  color: #475569;
  user-select: none;
  border-right: 1px solid #1e293b;
  padding-right: 8px;
  white-space: pre;
}

.modal-source-pre .src-code {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-source-pre .src-kw {
  color: #7dd3fc;
  font-weight: 500;
}

.modal-source-pre .src-str {
  color: #86efac;
}

.modal-source-pre .src-num {
  color: #fcd34d;
}

#matrixContainer td.cell-source-lines {
  white-space: nowrap;
  vertical-align: middle;
  padding: 4px 6px;
}

.btn-source-lines {
  font: inherit;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #c5d3ef;
  background: #f5f8ff;
  color: #1e3a5f;
  cursor: pointer;
  text-decoration: none;
}

.btn-source-lines:hover {
  background: #e8efff;
  border-color: #9eb6e8;
}

.modal-dialog h2 {
  margin: 0;
  padding: 14px 18px;
  font-size: 15px;
  border-bottom: 1px solid #e8eefa;
  flex: 0 0 auto;
}

.modal-meta {
  margin: 0;
  padding: 10px 18px 0;
  font-size: 12px;
  color: #5a6785;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.modal-where-box {
  margin: 12px 18px 0;
  padding: 10px 12px;
  background: #f4f7ff;
  border: 1px solid #d5e1fc;
  border-radius: 8px;
  flex: 0 0 auto;
}

.modal-where-label {
  font-size: 11px;
  font-weight: 600;
  color: #3d4a63;
  margin-bottom: 6px;
}

.modal-where-pre {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #243352;
}

.modal-paths-wrap {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px 18px 14px;
  min-height: 100px;
}

.modal-paths-where-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
  background: #f0f6ff;
  border: 1px solid #c9d8f5;
  border-radius: 8px;
}

.modal-paths-where-note code {
  font-size: 11px;
  background: #e2ebfb;
  padding: 1px 4px;
  border-radius: 4px;
}

.modal-paths-lead {
  margin: 0 0 10px;
  font-size: 12px;
  color: #3d4a63;
}

.prov-modal-graph {
  margin: 0 0 16px;
  padding: 12px 14px 14px;
  border: 1px solid #d5e1fc;
  border-radius: 10px;
  background: linear-gradient(165deg, #f8faff 0%, #ffffff 100%);
}

.prov-modal-graph-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 6px;
}

.prov-modal-graph-svg-wrap {
  line-height: 0;
  border-radius: 8px;
  background: #fbfcff;
  border: 1px solid #e2e8f5;
  overflow: hidden;
}

.prov-graph-pan-zoom-viewport {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  max-height: min(440px, 52vh);
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

.prov-graph-pan-zoom-viewport.prov-graph-pan-zoom--dragging {
  cursor: grabbing;
}

.prov-graph-pan-zoom-content {
  display: inline-block;
  transform-origin: 0 0;
  vertical-align: top;
}

.prov-graph-svg {
  display: block;
  height: auto;
}

.prov-graph-node-inner {
  box-sizing: border-box;
  margin: 0;
  padding: 4px 10px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 500;
  color: #1e3a5f;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

.provenance-path-ol {
  margin: 0;
  padding-left: 1.4rem;
}

.provenance-path-item {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: linear-gradient(95deg, #eef3ff 0%, #fbfdff 55%);
  border-left: 3px solid #5c7fd6;
  border-radius: 0 10px 10px 0;
  font-size: 12px;
  line-height: 1.55;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: #243352;
  word-break: break-word;
}

.modal-paths-empty {
  margin: 0;
  color: #8892a6;
  font-size: 12px;
}

.modal-dialog-footer {
  padding: 10px 14px;
  border-top: 1px solid #e8eefa;
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.btn-modal-close {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #b8c6eb;
  background: #eef3ff;
  color: #2b4388;
  cursor: pointer;
}

.btn-modal-close:hover {
  background: #dfe8ff;
}

.matrix-table {
  table-layout: auto;
}

/* Ein sticky thead hält Kopf- und Filterzeile ohne Lücke zusammen (kein festes top für Zeile 2). */
.matrix-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f5f8ff;
  box-shadow: 0 1px 0 rgba(27, 38, 65, 0.08);
}

.matrix-table thead tr.matrix-head-row th {
  position: static;
  top: auto;
  z-index: auto;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.matrix-table thead tr.matrix-head-row th:hover {
  background: #e8eeff;
}

.matrix-table thead tr.matrix-head-row th.matrix-th-action:hover {
  background: #f5f8ff;
}

.matrix-table thead tr.matrix-filter-row th {
  position: static;
  top: auto;
  z-index: auto;
  padding: 4px 6px;
  background: #f5f8ff;
  vertical-align: middle;
}

.matrix-table .matrix-col-filter {
  width: 100%;
  min-width: 52px;
  max-width: 140px;
  box-sizing: border-box;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #c7d3ee;
  background: #fff;
}

.matrix-sort-ind {
  font-size: 10px;
  opacity: 0.85;
}

#matrixContainer .matrix-table thead th:first-child {
  width: 2rem;
  max-width: 2.75rem;
  padding-left: 6px;
  padding-right: 6px;
  box-sizing: border-box;
}

#matrixContainer td.cell-index {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 1.75rem;
  max-width: 2.25rem;
  padding: 7px 4px;
  color: #5a6785;
  font-size: 11px;
  box-sizing: border-box;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f8ff;
  color: #30405f;
}

tbody tr:nth-child(even) {
  background: #f9fbff;
}

#matrixContainer .matrix-table tbody tr {
  transition: background-color 0.14s ease;
}

#matrixContainer .matrix-table tbody tr:hover {
  background: #eef3ff;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}

.status-final_in_output { background: var(--success); }
.status-intermediate_only { background: var(--info); }
.status-unused { background: var(--danger); }
.status-unknown { background: var(--warn); }

#graphContainer {
  border: 1px solid #d8e1f3;
  border-radius: 10px;
  min-height: 500px;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(55, 90, 180, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(0deg, rgba(55, 90, 180, 0.035) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface);
  user-select: none;
  -webkit-user-select: none;
}

#graphContainer svg text {
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.cy-graph {
  width: 100%;
  height: 540px;
  border-radius: 8px;
  background: transparent;
}

.cy-wrap {
  position: relative;
}

.graph-node-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 280px;
  max-width: 360px;
  border: 1px solid #d8e1f3;
  border-radius: 8px;
  background: rgba(248, 250, 255, 0.98);
  padding: 8px 10px;
  font-size: 12px;
  color: #3f4f72;
  max-height: min(420px, 70vh);
  overflow: auto;
  box-shadow: 0 8px 24px rgba(21, 33, 60, 0.18);
  display: none;
}

.graph-node-tooltip.visible {
  display: block;
}

.graph-node-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #2e3d62;
}

.tooltip-head {
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  margin: -4px -6px 4px;
  padding: 4px 6px;
  border-bottom: 1px dashed #d5ddf1;
}

.graph-tooltip-actions {
  margin: 0 0 8px;
}

.graph-node-tooltip ul li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.graph-node-tooltip .btn-graph-attr-prov {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 5px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.graph-node-tooltip .btn-graph-attr-prov:hover {
  background: #eef3ff;
}

.graph-node-tooltip .btn-graph-attr-prov code {
  font-size: 11px;
}

.graph-node-tooltip ul {
  margin: 6px 0 0;
  padding-left: 0;
}

.graph-node-tooltip code {
  background: #eef3ff;
  border: 1px solid #d3def8;
  border-radius: 4px;
  padding: 1px 4px;
}

.graph-tooltip-details {
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid #e2e8f5;
}

.graph-tooltip-details-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  color: #475569;
  list-style: none;
}

.graph-tooltip-details summary::-webkit-details-marker {
  display: none;
}

.graph-tooltip-details .graph-tooltip-meta {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.45;
  color: #475569;
}

.graph-tooltip-details .graph-tooltip-meta p {
  margin: 0 0 6px;
}

.graph-tooltip-details .graph-tooltip-meta strong {
  font-weight: 600;
  color: #334155;
}

.graph-node-tooltip .btn-graph-matrix-filter {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid #b8c6eb;
  background: #fff;
  color: #1e3a5f;
  cursor: pointer;
}

.graph-node-tooltip .btn-graph-matrix-filter:hover {
  background: #eef3ff;
  border-color: #94a8e8;
}

.fullscreen-active {
  width: 100vw !important;
  height: 100vh !important;
  max-height: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  background: #fff !important;
}

.hint {
  color: #6a7996;
  font-size: 12px;
}

@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
