:root {
  --border: #dfe3ea;
  --muted: #6b7280;
  --ink: #1a1a2e;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a2e;
  background: #f4f5f7;
}
header {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
}
header h1 { margin: 0; font-size: 20px; }
header .sub { font-weight: 400; font-size: 13px; color: #9a9ab0; }
main {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  padding: 16px 20px;
  align-items: start;
}
aside {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
aside h2 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: #666; }
#model-list { list-style: none; margin: 0 0 12px; padding: 0; }
#model-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #1a1a2e;
  text-decoration: none;
  margin-bottom: 2px;
}
#model-list a:hover { background: #eef0f4; }
#model-list a.active { background: #1a1a2e; color: #fff; }
#model-list small { opacity: .6; }
button {
  background: #1a1a2e;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
button:hover { background: #2d2d4d; }
button.ghost { background: #e8eaf0; color: #1a1a2e; }
button.ghost:hover { background: #dcdfe8; }
button.ghost.on { background: #4f46e5; color: #fff; }
button.ghost.on:hover { background: #4338ca; }
button.ghost.danger { color: #b3261e; }
#viewer, #editor {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  min-height: 400px;
}
#viewer-empty, .empty { color: #888; }
.tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tab { background: #e8eaf0; color: #1a1a2e; }
.tab.active { background: #1a1a2e; color: #fff; }
.tabs .spacer { flex: 1; }
#raw { margin-top: 12px; }
#raw-code {
  background: #1a1a2e;
  color: #d5d8e8;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
  font-size: 12px;
  text-align: left;
}
#editor { grid-column: 2; }
#editor h2 { margin: 0 0 6px; }
.hint { color: #666; font-size: 13px; margin: 0 0 10px; }
#editor-json {
  width: 100%;
  height: 420px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
}
.row { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.status { color: #b3261e; font-size: 13px; }

/* --- Architecture Landscape --- */
.graph-view, .arch-view { height: 660px; }
.arch-toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap;
}
.arch-search { position: relative; }
.arch-toolbar input[type=search] {
  border: 1px solid #d7dbe4; border-radius: 8px; padding: 8px 12px; font-size: 13px; width: 320px;
  background: #fff; color: #1e293b;
}
.arch-toolbar input[type=search]:focus { outline: 2px solid #4f46e533; border-color: #4f46e5; }
.arch-results {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 320px; z-index: 30;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.12);
  overflow: hidden;
}
.arch-result {
  display: flex; gap: 8px; align-items: baseline; padding: 8px 12px; cursor: pointer; font-size: 13px; color: #1e293b;
}
.arch-result:hover, .arch-result.first { background: #f1f5f9; }
.arch-result span { color: #94a3b8; font-size: 11.5px; }
.arch-toolbar select {
  border: 1px solid #d7dbe4; border-radius: 8px; padding: 8px 8px; font-size: 12.5px; background: #fff; color: #475569;
}
.arch-toolbar .ghost { padding: 8px 12px; font-size: 12.5px; }
.arch-wrap { position: relative; width: 100%; height: 100%; background: #fbfcfe; border: 1px solid #eef0f5; border-radius: 12px; overflow: hidden; }
.arch-flow-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 21;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px);
  background: #fffbeb; border: 1px solid #f59e0b55; border-radius: 999px; padding: 6px 8px 6px 14px;
  font-size: 12.5px; color: #78350f; box-shadow: 0 4px 14px rgba(120,53,15,.12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.arch-flow-banner b { color: #92400e; }
.arch-flow-banner button.ghost { flex-shrink: 0; padding: 3px 10px; font-size: 11.5px; border-radius: 999px; background: #fff; }
.edge.flow-hot { filter: drop-shadow(0 0 3px #f59e0b88); }
.arch-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.arch-svg:active { cursor: grabbing; }
.plate-box { fill: #f7f9fc; stroke: #e6eaf1; stroke-width: 1.2; }
.plate-virtual { stroke-dasharray: 5 5; fill: transparent; }
.plate-label { font-size: 11.5px; font-weight: 700; fill: #94a3b8; letter-spacing: .12em; }
.plate-count { font-size: 10.5px; fill: #b6bfce; }
.chip-box { fill: #ffffff; stroke: #d8dce6; stroke-width: 1.5; filter: drop-shadow(0 1px 2px rgba(23,32,60,.06)); transition: stroke .12s; }
g.chip:hover .chip-box { stroke: #4f46e5; }
.chip-name { font-size: 13px; font-weight: 650; fill: #1a1a2e; letter-spacing: .05em; }
.chip-count { font-size: 11.5px; fill: #6b7280; }
.arch-back {
  position: absolute; top: 14px; left: 14px; z-index: 6;
  padding: 8px 14px; font-size: 12.5px; background: #fff; border: 1px solid #cdd3e0;
  border-radius: 999px; color: #1a1a2e; box-shadow: 0 2px 8px rgba(23,32,60,.12); cursor: pointer;
}
.arch-back:hover { border-color: #4f46e5; color: #4f46e5; }
.edge { fill: none; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 14; cursor: pointer; }
.edge-label {
  font-size: 10.5px; fill: #64748b; paint-order: stroke; stroke: #fbfcfe; stroke-width: 3.5px; stroke-linejoin: round;
  pointer-events: none;
}
.edge-label.agg { font-size: 11px; font-weight: 700; fill: #334155; }
.edge-badge .badge-bg { fill: #fff; stroke: #d7dbe4; stroke-width: 1; opacity: .95; }
.edge-badge.expandable .badge-bg { fill: #eef2ff; stroke: #a5b4fc; }
.edge-badge.expandable:hover .badge-bg { fill: #e0e7ff; stroke: #818cf8; }
.edge-label.agg.expandable { fill: #4338ca; }
.fan-handle .fh-bg { fill: #eef2ff; stroke: #a5b4fc; stroke-width: 1; opacity: .95; }
.fan-handle:hover .fh-bg { fill: #e0e7ff; stroke: #818cf8; }
.fan-handle.on .fh-bg { fill: #6366f1; stroke: #4f46e5; }
.fan-handle .fh-t { font-size: 9px; font-weight: 700; fill: #4338ca; pointer-events: none; }
.fan-handle.on .fh-t { fill: #fff; }
.node-box { fill: #fff; stroke: #d7dbe4; stroke-width: 1.2; filter: drop-shadow(0 1px 2px rgba(15,23,42,.05)); }
.node-box.muted { fill: #f1f5f9; }
.node-box.dashed { stroke-dasharray: 5 4; }
.node-name { font-size: 12.5px; font-weight: 600; fill: #1e293b; }
.node-box.muted + .node-chip ~ .node-name, g.node .node-box.muted { }
.node-sub { font-size: 10.5px; fill: #94a3b8; }
.node-chip-t { font-size: 11px; }
.node-focus { fill: none; stroke: #4f46e5; stroke-width: 2; opacity: .85; }
.arch-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.arch-zoom button {
  width: 34px; height: 34px; border: 1px solid #e2e8f0; background: #fff; color: #475569; border-radius: 8px;
  font-size: 17px; cursor: pointer; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.arch-zoom button:hover { background: #f1f5f9; }
.arch-panel {
  position: absolute; top: 10px; left: 10px; width: 300px; max-height: calc(100% - 20px); overflow: auto;
  background: rgba(255,255,255,.98); border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 6px 20px rgba(15,23,42,.10); font-size: 13px; z-index: 20;
}
.arch-panel h3 { margin: 4px 0 8px; font-size: 16px; color: #0f172a; }
.pl-back {
  background: none; border: 0; color: #4f46e5; font-size: 12px; padding: 0; cursor: pointer; font-weight: 600;
}
.pl-x {
  position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 18px; line-height: 1;
  color: #94a3b8; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.pl-x:hover { color: #475569; background: #f1f5f9; }
.pl-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.pl-chip {
  font-size: 11px; border: 1px solid #e2e8f0; border-radius: 20px; padding: 1px 8px; color: #475569; background: #f8fafc;
}
.pl-chip.pl-status-warn { border-color: #f59e0b; color: #92400e; background: #fffbeb; }
.pl-chip.pl-status-down { border-color: #dc2626; color: #b91c1c; background: #fef2f2; }
.pl-chip.pl-lc-deprecated, .pl-chip.pl-lc-legacy { border-color: #cbd5e1; color: #64748b; }
.pl-chip.pl-lc-experimental { border-color: #a5b4fc; color: #4338ca; background: #eef2ff; }
.pl-desc { margin: 6px 0 0; color: #475569; font-size: 12.5px; line-height: 1.45; }
.pl-sec { margin: 12px 0 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; }
.pl-line { padding: 4px 0; border-bottom: 1px dashed #eef1f5; display: flex; justify-content: space-between; gap: 8px; }
.pl-jump {
  background: none; border: 0; padding: 0; font-size: 12.5px; color: #1e293b; cursor: pointer;
  text-decoration: underline; text-decoration-color: #cbd5e1; font-weight: 500;
}
.pl-jump:hover { color: #4f46e5; }
.pl-detail { color: #94a3b8; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-none { color: #b6bfce; font-size: 12px; }
.pl-row { display: block; }
.pl-left { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.pl-fan {
  background: none; border: 0; color: #a5b4fc; cursor: pointer; font-size: 11px; padding: 0 1px; line-height: 1;
}
.pl-fan:hover { color: #4f46e5; }
.pl-fan-body {
  margin: 4px 0 8px 2px; padding: 8px 10px; background: #f8fafc; border: 1px solid #eef1f5; border-radius: 8px;
}
.pl-fan-title { font-weight: 600; font-size: 12px; margin-bottom: 4px; word-break: break-word; }
.pl-fan-row {
  display: block; width: 100%; text-align: left; background: none; border: 0; font-size: 12px; color: #1e293b;
  cursor: pointer; padding: 3px 5px; border-radius: 5px; word-break: break-word;
}
.pl-fan-row:hover { background: #eef2ff; color: #4338ca; }
.pl-fan-row.static { cursor: default; }
.ep-pop {
  position: fixed; z-index: 60; width: 262px; max-height: 340px; overflow: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.16);
  padding: 10px 12px; font-size: 12.5px; color: #1e293b;
}
.ep-x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: #94a3b8; font-size: 15px; cursor: pointer; }
.ep-x:hover { color: #475569; }
.ep-title { font-weight: 600; margin-bottom: 4px; padding-right: 16px; word-break: break-word; }
.ep-h { margin: 8px 0 3px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.ep-list { display: flex; flex-direction: column; gap: 1px; }
.ep-row {
  background: none; border: 0; text-align: left; font-size: 12px; color: #1e293b; cursor: pointer;
  padding: 3px 6px; border-radius: 6px; word-break: break-word;
}
.ep-row:hover { background: #eef2ff; color: #4338ca; }
.ep-row.static { cursor: default; }
.ep-row-static { padding: 3px 6px; border-radius: 6px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.ep-row-static:hover { background: #f1f5f9; }
.ep-detail { color: #94a3b8; font-size: 11px; }
.ep-none { color: #b6bfce; font-size: 12px; padding: 2px 6px; }
.fan-count {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 8px;
  background: #eef2ff; color: #6366f1; font-size: 10.5px; font-weight: 600; line-height: 16px;
  vertical-align: 1px; word-break: normal;
}
.pl-drill { margin-top: 6px; border-top: 1px solid #eef1f5; padding-top: 8px; text-align: center; }
.pl-drill svg { max-width: 100%; }
.arch-panel button.pl-drill-open, .arch-panel button.pl-drill-close {
  width: 100%; margin-top: 12px; background: #eef2ff; color: #4338ca; font-size: 12.5px; padding: 8px; border-radius: 8px;
}
.arch-inspector {
  position: absolute; bottom: 10px; right: 10px; width: 270px; max-height: calc(100% - 20px); overflow: auto;
  background: rgba(255,255,255,.98); border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 6px 20px rgba(15,23,42,.10); font-size: 13px; z-index: 20;
}
.ins-x {
  position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 16px; color: #94a3b8; cursor: pointer;
}
.ins-flow { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin-bottom: 8px; }
.ins-node {
  text-align: left; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-weight: 600; color: #0f172a; cursor: pointer;
}
.ins-node:hover { border-color: #4f46e5; color: #4f46e5; }
.ins-arrow { text-align: center; font-size: 13px; line-height: 1.3; }
.ins-mid {
  text-align: center; font-size: 11px; color: #64748b; background: #f1f5f9; border-radius: 6px;
  padding: 3px 6px; margin: 1px 0;
}
.ins-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ins-table td { padding: 3px 0; border-bottom: 1px dashed #eef1f5; }
.ins-table td:first-child { color: #94a3b8; width: 86px; }
.ins-desc { color: #475569; font-size: 12px; margin: 8px 0 0; line-height: 1.45; }
.arch-legend {
  position: absolute; bottom: 10px; left: 10px; background: rgba(255,255,255,.92);
  border: 1px solid #eef0f5; border-radius: 8px; padding: 7px 10px; font-size: 11px; color: #64748b; z-index: 15;
}
.arch-legend div { display: flex; align-items: center; gap: 10px; margin: 2px 0; flex-wrap: wrap; }
.arch-legend .lg-n { display: inline-flex; align-items: center; gap: 4px; }
.arch-legend .lg-n i {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 4px; font-size: 9px; font-style: normal;
}
.arch-legend .lg-e { display: inline-flex; align-items: center; gap: 5px; }
.arch-legend .lg-e i { display: inline-block; width: 22px; }
@media (max-width: 900px) {
  .graph-view, .arch-view { height: 500px; }
  .arch-panel { width: 230px; font-size: 12px; }
  .arch-inspector { width: 220px; }
  .arch-toolbar input[type=search] { width: 200px; }
}

/* auth: login, bruger-chip, deling */
.login-wrap { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; min-height: calc(100vh - 110px); grid-column: 1 / -1; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px 32px; width: 340px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.login-card h2 { margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.login-card input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; }
.login-card button { margin-top: 4px; }
.user-chip { font-size: 13px; font-weight: 600; color: var(--ink); background: #eef1f7; border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px; }
.vis-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.vis-private { background: #eef1f7; color: var(--muted); }
.vis-team { background: #e0f2fe; color: #0369a1; }
.vis-company { background: #dcfce7; color: #15803d; }
a .owner { color: var(--muted); }
.sharing { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.sharing select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.team-opt { margin-right: 10px; font-weight: 500; }
button:disabled { opacity: .45; cursor: not-allowed; }
.login-wrap[hidden] { display: none; }
#app-root { display: contents; }
#app-root[hidden] { display: none; }
.login-tagline { margin: 0; font-size: 13px; color: #6b7280; text-align: center; max-width: 420px; }

/* API-nøgler */
.keys-h { margin-top: 22px; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 6px 2px; border-bottom: 1px dashed var(--border); }
.key-row .ghost { padding: 2px 8px; font-size: 13px; }
#key-create { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
#key-create input, #key-create select { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.key-plaintext { display: block; background: #101425; color: #dbe2f0; padding: 10px 12px; border-radius: 9px; font-size: 12px; word-break: break-all; margin: 8px 0; }
.pill { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.pill.read { background: #e0f2fe; color: #0369a1; }
.pill.write { background: #fef3c7; color: #92400e; }
