:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d9dee6;
  --text: #1c2430;
  --muted: #5d6b7c;
  --accent: #1f5f8b;
  --accent-soft: #e3eef7;
  --danger: #b4232c;
  --danger-soft: #fbe6e7;
  --warn: #8a5a00;
  --warn-soft: #fff1d6;
  --ok: #1e6b3a;
  --ok-soft: #e1f3e7;
  --info-soft: #e6ecf5;
  --kind-element: #7c3aed;
  --kind-complex: #1f5f8b;
  --kind-simple: #0f766e;
  --kind-codelist: #b45309;
  --kind-model: #6d28d9;
  --kind-file: #475569;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c;
    --surface: #1a2029;
    --surface-2: #222a35;
    --border: #2f3947;
    --text: #e6eaf0;
    --muted: #9aa7b8;
    --accent: #7fb3dc;
    --accent-soft: #1f2f3f;
    --danger: #ff8a8f;
    --danger-soft: #3a1f22;
    --warn: #f3c468;
    --warn-soft: #3a2f16;
    --ok: #7fd49a;
    --ok-soft: #1d3326;
    --info-soft: #23303f;
    --kind-element: #c4a6ff;
    --kind-complex: #8fc1e8;
    --kind-simple: #7fd3c9;
    --kind-codelist: #f0b36b;
    --kind-model: #c2a4ff;
    --kind-file: #aab6c6;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --surface: #1a2029; --surface-2: #222a35; --border: #2f3947; --text: #e6eaf0; --muted: #9aa7b8;
  --accent: #7fb3dc; --accent-soft: #1f2f3f; --danger: #ff8a8f; --danger-soft: #3a1f22; --warn: #f3c468;
  --warn-soft: #3a2f16; --ok: #7fd49a; --ok-soft: #1d3326; --info-soft: #23303f; --kind-element: #c4a6ff;
  --kind-complex: #8fc1e8; --kind-simple: #7fd3c9; --kind-codelist: #f0b36b; --kind-model: #c2a4ff;
  --kind-file: #aab6c6; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
h3 { font-size: 13.5px; margin: 0 0 6px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }
input[type=text], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.field { margin-bottom: 10px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.check input { width: auto; }

.topbar {
  display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }
.brand::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: -1px; }
.topbar-standard select { width: auto; max-width: 320px; padding: 5px 8px; }
.topbar-search { flex: 1; max-width: 560px; margin-left: auto; position: relative; }
.topbar-search input { padding: 7px 10px 7px 32px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6b7c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center; }
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14); max-height: 420px; overflow: auto; z-index: 30;
}
.search-dropdown .item { display: block; padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-dropdown .item:last-child { border-bottom: 0; }
.search-dropdown .item:hover, .search-dropdown .item.active { background: var(--accent-soft); text-decoration: none; }
.search-dropdown .item .path { color: var(--muted); font-size: 12px; }
.search-dropdown .footer { padding: 6px 12px; font-size: 12px; color: var(--muted); }

.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.sidebar { border-right: 1px solid var(--border); background: var(--surface); padding: 14px 10px; position: sticky; top: 52px; height: calc(100vh - 52px); overflow: auto; }
.sidebar:empty { display: none; }
.layout:has(.sidebar:empty) { grid-template-columns: minmax(0, 1fr); }
.sidebar .group { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 10px 4px; }
.sidebar a { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; color: var(--text); }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar .std { padding: 4px 10px 8px; }
.sidebar .std .name { font-weight: 650; }
.sidebar .std .ver { color: var(--muted); font-size: 12.5px; }

.content { padding: 22px 28px 60px; max-width: 1180px; width: 100%; }
.page-header { margin-bottom: 18px; }
.page-header .sub { color: var(--muted); font-size: 13px; }
.page-header .id { margin-top: 4px; }
.kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.tight { padding: 0; overflow: clip; }
.card.tight > h2 { padding: 12px 16px 0; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile .num { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .lbl { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent;
  line-height: 1.6; white-space: nowrap; vertical-align: middle; letter-spacing: 0.01em;
}
.badge.kind { background: var(--surface-2); color: var(--muted); }
.badge.kind-Element { color: var(--kind-element); border-color: currentColor; background: transparent; }
.badge.kind-ComplexType { color: var(--kind-complex); border-color: currentColor; background: transparent; }
.badge.kind-SimpleType { color: var(--kind-simple); border-color: currentColor; background: transparent; }
.badge.kind-Codelist, .badge.kind-CodelistVersion { color: var(--kind-codelist); border-color: currentColor; background: transparent; }
.badge.kind-ModelClass, .badge.kind-ModelPackage { color: var(--kind-model); border-color: currentColor; background: transparent; }
.badge.kind-SchemaFile, .badge.kind-Property { color: var(--kind-file); border-color: currentColor; background: transparent; }
.badge.sev-ERROR { background: var(--danger-soft); color: var(--danger); }
.badge.sev-WARNING { background: var(--warn-soft); color: var(--warn); }
.badge.sev-INFO { background: var(--info-soft); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.soft { background: var(--accent-soft); color: var(--accent); }
.badge.muted { background: var(--surface-2); color: var(--muted); font-weight: 500; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 52px; z-index: 1; box-shadow: 0 1px 0 var(--border); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.highlight td { background: var(--warn-soft); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .doc { color: var(--muted); font-size: 12.5px; }
table.data td.wrap { word-break: break-word; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.doc-text p { margin: 0 0 8px; }
.doc-text ul { margin: 0 0 8px; padding-left: 20px; }
.doc-text p:last-child, .doc-text ul:last-child { margin-bottom: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; background: var(--surface); cursor: pointer; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.low > span { background: var(--warn); }
.cov { display: flex; align-items: center; gap: 10px; }
.cov .bar { flex: 1; }
.cov .pct { width: 56px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }

.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 1px dashed var(--border); margin-left: 9px; }
.tree li { margin: 0; }
.tree .row { display: flex; align-items: baseline; gap: 8px; padding: 3px 4px; border-radius: 4px; flex-wrap: wrap; }
.tree .row:hover { background: var(--surface-2); }
.tree .row.highlight { background: var(--warn-soft); }
.tree .toggle { width: 18px; height: 18px; border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 11px; line-height: 18px; text-align: center; flex: none; align-self: center; }
.tree .toggle.leaf { visibility: hidden; }
.tree .toggle::before { content: "▶"; display: inline-block; transition: transform 0.12s; }
.tree .toggle.open::before { transform: rotate(90deg); }
.tree .name { font-weight: 600; }
.tree .attr .name::before { content: "@"; color: var(--muted); font-weight: 400; }
.tree .card-text { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tree .type { font-family: var(--mono); font-size: 12px; }
.tree .inh { font-size: 11px; color: var(--muted); border: 1px dashed var(--border); border-radius: 4px; padding: 0 5px; }
.tree .pdoc { flex-basis: 100%; color: var(--muted); font-size: 12.5px; padding-left: 26px; }
.tree .leafinfo { padding: 2px 4px 6px 26px; color: var(--muted); font-size: 12.5px; }
.tree .leafinfo code { margin-right: 6px; }
.tree .group-row { color: var(--muted); font-size: 12.5px; }
.tree .group-label { font-style: italic; }
.tree .group-choice > ul { border-left: 2px solid var(--kind-element); }
.tree .group-all > ul { border-left: 2px solid var(--kind-simple); }

.usage-group { margin-bottom: 10px; }
.usage-group h3 { margin-bottom: 4px; }
.usage-group ul { margin: 0; padding-left: 18px; }
.usage-group li { margin: 1px 0; }
.pkg-tree ul { list-style: none; padding-left: 18px; margin: 0; }
.pkg-tree > ul { padding-left: 0; }
.pkg-tree li { padding: 1px 0; }
.pkg-tree .toggle { width: 16px; display: inline-block; color: var(--muted); font-size: 10px; cursor: pointer; }

.std-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 24px; }
.std-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.std-card .title { font-size: 16px; font-weight: 650; }
.std-card .meta { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.std-card .stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.std-card .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 12px; color: var(--muted); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.log { background: var(--surface-2); border-radius: 6px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }
.notice { background: var(--accent-soft); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.enum-table td.val { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span::after { content: " › "; }
.breadcrumb span:last-child::after { content: ""; }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.more { margin: 10px 0; }

/* Diagramme */
.diagram-wrap { overflow: auto; max-height: 720px; }
.diagram { display: block; max-width: none; font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.diagram .node rect { fill: var(--surface); stroke: var(--border); stroke-width: 1.2; }
.diagram .node .label { fill: var(--text); font-weight: 600; }
.diagram .node .sub { fill: var(--muted); font-size: 10.5px; }
.diagram .node.kind-package rect { fill: var(--accent-soft); stroke: var(--accent); }
.diagram .node.kind-external rect { stroke-dasharray: 4 3; }
.diagram .node.kind-ComplexType rect { stroke: var(--kind-complex); }
.diagram .node.kind-SimpleType rect { stroke: var(--kind-simple); }
.diagram .node.kind-Element rect { stroke: var(--kind-element); }
.diagram .node.kind-Codelist rect, .diagram .node.kind-CodelistVersion rect { stroke: var(--kind-codelist); }
.diagram .node.kind-ModelClass rect { stroke: var(--kind-model); }
.diagram .node.kind-more rect { stroke-dasharray: 3 3; } .diagram .node.kind-more .label { fill: var(--muted); font-weight: 400; }
.diagram .node.center rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.diagram .node.hot rect { stroke-width: 2.5; }
.diagram a { cursor: pointer; }
.diagram .edge { fill: none; stroke: var(--border); stroke-width: 1.4; }
.diagram .edge.back { stroke: var(--warn); stroke-dasharray: 5 4; }
.diagram .edge.derive { stroke: var(--muted); }
.diagram .edge.realize { stroke-dasharray: 2 3; }
.diagram .edge.hot { stroke: var(--accent); stroke-width: 2.4; }
.diagram .arrow { fill: var(--muted); }
.diagram .edge-label { fill: var(--muted); font-size: 10.5px; }
.legend { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.swatch { display: inline-block; width: 14px; height: 10px; border: 1px solid var(--border); border-radius: 3px; vertical-align: middle; }
.swatch.package { background: var(--accent-soft); border-color: var(--accent); }
.swatch.external { border-style: dashed; }
.swatch.back { border: 0; height: 0; border-top: 2px dashed var(--warn); }

/* Versionsvergleich */
.field-changes { margin: 0; padding-left: 16px; font-size: 12.5px; }
.field-changes li { margin: 2px 0; }
.field-changes .before { color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(180, 35, 44, 0.5); }
.field-changes .after { color: var(--ok); }
.field-changes .change-long { display: grid; gap: 4px; margin-top: 2px; }
.field-changes .change-long .before, .field-changes .change-long .after { text-decoration: none; padding: 4px 8px; border-radius: 4px; white-space: pre-wrap; }
.field-changes .change-long .before { background: var(--danger-soft); }
.field-changes .change-long .after { background: var(--ok-soft); }

/* Beispiel-XML */
pre.xml { background: var(--surface-2); border-radius: 6px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.45; overflow: auto; max-height: 560px; margin: 10px 0 0; white-space: pre; }

/* UML-Diagramm */
.uml-canvas { height: calc(100vh - 230px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; cursor: grab; position: relative; }
.uml-canvas.dragging { cursor: grabbing; }
.uml { display: block; user-select: none; }
.uml .box rect.frame { fill: var(--surface); stroke: var(--border); stroke-width: 1.2; }
.uml .box rect.head, .uml .box rect.head-fix { fill: var(--surface-2); }
.uml .box.focus rect.frame { stroke: var(--accent); stroke-width: 2; }
.uml .box.focus rect.head, .uml .box.focus rect.head-fix { fill: var(--accent-soft); }
.uml .box line.divider { stroke: var(--border); }
.uml .box text { font: 12px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: var(--text); }
.uml .box text.title { font-weight: 650; }
.uml .box a text.title:hover { fill: var(--accent); text-decoration: underline; }
.uml .box text.sub { font-size: 10px; fill: var(--muted); }
.uml .box text.row { font: 11.5px var(--mono); }
.uml .box text.codelist { fill: var(--kind-codelist); }
.uml .box text.group { fill: var(--muted); font-style: italic; }
.uml .box .row-bg { fill: transparent; }
.uml .box .row { cursor: pointer; }
.uml .box .row:hover .row-bg { fill: var(--accent-soft); }
.uml .box .row.linked text { fill: var(--accent); }
.uml .box .box-action { fill: var(--muted); font-size: 14px; }
.uml .box .box-action:hover { fill: var(--accent); }
.uml .edge { fill: none; stroke: var(--muted); stroke-width: 1.2; opacity: 0.85; }
.uml .edge.codelist { stroke: var(--kind-codelist); stroke-dasharray: 4 3; }
.uml .edge.hot { stroke: var(--accent); stroke-width: 2.2; opacity: 1; }
.uml .arrow-fill { fill: var(--muted); }
.uml .arrow-hollow { fill: var(--surface); stroke: var(--muted); stroke-width: 1; }
.uml .edge.hot + .arrow-fill { fill: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; }
  .sidebar .group, .sidebar .std { display: none; }
  .sidebar a { padding: 5px 10px; gap: 6px; }
  .content { padding: 16px 16px 40px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 8px; }
  .topbar-standard { display: none; }
  .topbar-search { max-width: none; }
  table.data th { position: static; }
}
