/* Designsystem des Portals: dunkel, ruhig, abgestimmt auf die Grafana-Dashboards. */
:root {
  --bg: #0c0e13; --bg2: #10131a; --surface: #151922; --raised: #1b202b; --hover: #222836;
  --border: #262c38; --border2: #323a4a;
  --text: #e7e9ef; --text2: #b9bfcc; --muted: #868fa3;
  --accent: #4f8ff7; --accent2: #3b76d9; --accent-soft: rgba(79, 143, 247, .12);
  /* Kategorien (feste Reihenfolge, auch in Grafana) */
  --c-metrics: #3987e5; --c-logs: #199e70; --c-tracking: #d95926; --c-query: #9085e9; --c-access: #d55181;
  --c-yellow: #c98500;
  /* Status */
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;
  --radius: 10px; --radius-s: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--raised); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; color: var(--text2); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 650; }
h2 { font-size: 19px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 620; }
p { margin: 0 0 10px; color: var(--text2); }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 650; color: var(--muted); }

/* ------------------------------------------------------------------ Buttons & Formulare */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-s);
  background: var(--raised); color: var(--text); border: 1px solid var(--border2); font: 600 13px var(--sans);
  cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); border-color: #3c465a; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }
input[type=text], input[type=password] { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-s);
  background: var(--bg2); color: var(--text); border: 1px solid var(--border2); font: 14px var(--sans); outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--text2); font-weight: 600; }

/* ------------------------------------------------------------------ Auth-Seiten */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); }
.auth-art { position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(79,143,247,.18), transparent 60%),
              radial-gradient(800px 500px at 90% 90%, rgba(144,133,233,.14), transparent 60%), var(--bg2);
  border-right: 1px solid var(--border); }
.auth-art .grid { position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.auth-art > * { position: relative; }
.auth-art h1 { font-size: 34px; line-height: 1.15; max-width: 520px; }
.auth-art .lead { font-size: 15.5px; max-width: 520px; margin-top: 14px; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 640px; }
.pillar { background: rgba(21,25,34,.75); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; backdrop-filter: blur(6px); }
.pillar b { display: block; font-size: 13px; margin: 8px 0 4px; }
.pillar span { font-size: 12px; color: var(--muted); }
.pillar i { display: inline-block; width: 26px; height: 4px; border-radius: 2px; background: var(--c); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .btn.primary { height: 42px; justify-content: center; font-size: 14px; }
.error { background: rgba(208,59,59,.12); border: 1px solid rgba(208,59,59,.5); color: #ffb8b8; padding: 10px 12px; border-radius: var(--radius-s); margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; color: var(--text); }
.logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #8b6cf0); box-shadow: 0 4px 14px rgba(79,143,247,.35); }
.logo svg { width: 18px; height: 18px; }
.scope { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg2); }
.scope small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.scope input { margin-top: 3px; accent-color: var(--accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ------------------------------------------------------------------ App-Rahmen */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px;
  background: var(--bg2); border-right: 1px solid var(--border); }
.nav .brand { padding: 4px 10px 18px; }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--text2);
  font-weight: 560; text-decoration: none; }
.nav a.item svg { width: 17px; height: 17px; opacity: .8; }
.nav a.item:hover { background: var(--raised); color: var(--text); }
.nav a.item.active { background: var(--accent-soft); color: #cfe0ff; box-shadow: inset 2px 0 0 var(--accent); }
.nav .section { margin: 14px 10px 4px; }
.nav .foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 10px 0; display: grid; gap: 8px; font-size: 12.5px; }
.nav .foot .user { display: flex; align-items: center; gap: 8px; color: var(--text2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--raised); border: 1px solid var(--border2); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
main.content { min-width: 0; }
.page { padding: 30px 36px 60px; max-width: 1320px; }
.page.wide { max-width: none; padding: 0; height: 100vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; max-width: 760px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .nav { display: none; } .g2, .g3 { grid-template-columns: 1fr; } .page { padding: 20px 16px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.flat { background: var(--bg2); }
.card h3 + p, .card h2 + p { margin-top: 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 14px; }

/* ------------------------------------------------------------------ Übersicht */
.hero { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; padding: 30px 32px;
  background: radial-gradient(900px 400px at 0% 0%, rgba(79,143,247,.20), transparent 60%),
              radial-gradient(700px 400px at 100% 100%, rgba(144,133,233,.14), transparent 60%), var(--surface);
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.hero h1 { font-size: 30px; line-height: 1.2; }
.hero p.lead { font-size: 15px; margin-top: 10px; max-width: 620px; }
.hero .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero img { width: 100%; border-radius: 10px; border: 1px solid var(--border2); box-shadow: var(--shadow); cursor: zoom-in; }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } }
.kpi { display: grid; gap: 4px; }
.kpi .v { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--raised); border: 1px solid var(--border2); color: var(--text2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.15); }
.dot.bad { background: var(--crit); box-shadow: 0 0 0 3px rgba(208,59,59,.18); }
.dot.warn { background: var(--warn); }
.dot.run { background: var(--accent); box-shadow: 0 0 0 3px rgba(79,143,247,.2); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.pillar-card { border-top: 3px solid var(--c); }
.pillar-card .tag { color: var(--c); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.status-FINISHED { color: #67d667; } .status-FAILED { color: #ff8f8f; } .status-KILLED { color: var(--warn); } .status-RUNNING { color: var(--accent); }
.links a { margin-right: 10px; font-size: 12.5px; white-space: nowrap; }

/* ------------------------------------------------------------------ Dienste */
.svc { display: flex; flex-direction: column; gap: 12px; }
.svc-head { display: flex; align-items: center; gap: 12px; }
.svc-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.svc-icon svg { width: 20px; height: 20px; }
.svc .kind { font-size: 12px; color: var(--muted); }
.cred { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 6px 6px 6px 10px; }
.cred .k { font-size: 12px; color: var(--muted); }
.cred .v { font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border2); }
.icon-btn svg { width: 15px; height: 15px; }
.svc .url { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.svc .foot { margin-top: auto; display: flex; gap: 8px; }

/* ------------------------------------------------------------------ Architektur-Canvas */
.arch { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100vh; }
/* Architekturseite: Navigation als schmale Icon-Leiste, damit der Canvas Platz hat */
.app.compact { grid-template-columns: 64px minmax(0, 1fr); }
.app.compact .nav { padding: 18px 10px; align-items: center; }
.app.compact .nav .lbl { display: none; }
.app.compact .nav .brand { padding: 4px 0 18px; }
.app.compact .nav a.item { justify-content: center; padding: 10px; }
.app.compact .nav .foot { padding: 12px 0 0; justify-items: center; }
.canvas-wrap { position: relative; overflow: hidden; background: var(--bg);
  background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1px); background-size: 24px 24px; cursor: grab; }
.canvas-wrap.dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.world svg.edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke-width: 1.6; opacity: .38; transition: opacity .2s, stroke-width .2s; }
.edge.hl { opacity: 1; stroke-width: 2.4; stroke-dasharray: 7 7; animation: flow 1.1s linear infinite; }
.edge.dim { opacity: .07; }
@keyframes flow { to { stroke-dashoffset: -28; } }
.edge-label { font: 600 10.5px var(--sans); fill: var(--text2); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; opacity: 0; transition: opacity .2s; }
.edge-label.hl { opacity: 1; }
.lane { position: absolute; top: 0; border-radius: 14px; border: 1px dashed rgba(255,255,255,.07); background: rgba(255,255,255,.012); }
.lane span { position: absolute; top: -26px; left: 4px; font: 650 11px var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.node { position: absolute; width: 212px; min-height: 74px; padding: 11px 12px 11px 14px; border-radius: 12px; cursor: pointer; user-select: none;
  background: linear-gradient(180deg, #1a1f2a, #161a23); border: 1px solid var(--border2); box-shadow: 0 6px 20px rgba(0,0,0,.35);
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 11px; align-items: center; transition: border-color .15s, transform .15s, box-shadow .15s, opacity .2s; }
.node:hover { border-color: #46526a; transform: translateY(-1px); }
.node.sel { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent), 0 10px 28px rgba(0,0,0,.45); }
.node.dim { opacity: .35; }
.node .ni { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 38%, transparent); }
.node .ni svg { width: 19px; height: 19px; }
.node b { display: block; font-size: 13.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .st { position: absolute; top: 10px; right: 10px; }
.toolbar { position: absolute; left: 16px; top: 16px; right: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 5; pointer-events: none; }
.toolbar > * { pointer-events: auto; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; font: 600 12px var(--sans);
  background: rgba(21,25,34,.92); border: 1px solid var(--border2); color: var(--text2); cursor: pointer; backdrop-filter: blur(6px); }
.chip i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.chip.off { opacity: .45; } .chip.off i { background: var(--muted); }
.zoom { margin-left: auto; display: flex; gap: 4px; }
.zoom .icon-btn { background: rgba(21,25,34,.92); border-color: var(--border2); width: 30px; height: 30px; }
.side { border-left: 1px solid var(--border); background: var(--bg2); overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.side .head { display: flex; gap: 12px; align-items: center; }
.side .head .ni { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.side .head .ni svg { width: 22px; height: 22px; }
.side ul { margin: 0; padding-left: 18px; color: var(--text2); } .side li { margin: 3px 0; }
.flowlist { display: grid; gap: 6px; }
.flow { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 9px; align-items: start; font-size: 12.5px; color: var(--text2);
  padding: 7px 9px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.flow:hover { border-color: var(--border2); }
.flow i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-top: 4px; }
.flow b { color: var(--text); font-weight: 600; }
.thumb { width: 100%; border-radius: 8px; border: 1px solid var(--border2); cursor: zoom-in; display: block; }
.legend-grid { display: grid; gap: 8px; }
.legend-grid div { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text2); }
.legend-grid i { width: 22px; height: 3px; border-radius: 2px; background: var(--c); flex: none; }
@media (max-width: 1100px) { .arch { grid-template-columns: 1fr; height: auto; } .canvas-wrap { height: 70vh; } }

/* ------------------------------------------------------------------ Doku */
.prose p, .prose li { color: var(--text2); }
.prose ul { padding-left: 20px; margin: 6px 0 12px; }
.steps { display: grid; gap: 18px; counter-reset: step; }
.step { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; align-items: center; }
.step .num { counter-increment: step; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: #cfe0ff; font-weight: 700; font-size: 13px; margin-bottom: 10px; border: 1px solid rgba(79,143,247,.35); }
.step .num::before { content: counter(step); }
.step img { width: 100%; border-radius: 10px; border: 1px solid var(--border2); box-shadow: var(--shadow); cursor: zoom-in; display: block; }
.step .cmd { margin-top: 10px; }
@media (max-width: 1000px) { .step { grid-template-columns: 1fr; } }
pre.code { position: relative; background: #0a0c10; border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px 44px 12px 14px;
  font: 12.5px/1.6 var(--mono); color: #cdd3df; overflow-x: auto; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code .icon-btn { position: absolute; top: 6px; right: 6px; }
.timeline { display: flex; gap: 0; margin: 14px 0 4px; }
.timeline div { flex: var(--w); padding: 10px 12px; border: 1px solid var(--border); background: var(--bg2); font-size: 12.5px; color: var(--text2); }
.timeline div:first-child { border-radius: 8px 0 0 8px; } .timeline div:last-child { border-radius: 0 8px 8px 0; }
.timeline div + div { border-left: 0; }
.timeline b { display: block; color: var(--text); font-size: 13px; }
.timeline div { border-top: 3px solid var(--c); }
.callout { border: 1px solid rgba(250,178,25,.35); background: rgba(250,178,25,.07); border-radius: var(--radius-s); padding: 12px 14px; color: #f3d9a2; font-size: 13px; }
.callout.info { border-color: rgba(79,143,247,.35); background: var(--accent-soft); color: #c9dcff; }
.tool { border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg2); padding: 12px 14px; display: grid; gap: 6px; }
.tool .name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool .name code { color: var(--text); font-weight: 600; }
.tool p { margin: 0; font-size: 12.5px; }
.tool .params { font-size: 12px; color: var(--muted); }
.badge-r { color: #7fd0a8; border-color: rgba(25,158,112,.45); background: rgba(25,158,112,.10); }
.badge-w { color: #f4b28f; border-color: rgba(217,89,38,.45); background: rgba(217,89,38,.10); }
.lightbox { position: fixed; inset: 0; background: rgba(5,6,9,.86); display: none; place-items: center; z-index: 100; padding: 30px; cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; box-shadow: var(--shadow); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--raised);
  border: 1px solid var(--border2); padding: 9px 14px; border-radius: 8px; font-size: 13px; transition: all .2s; z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Reiter und Schrittfolgen (MCP-Anleitung) */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: -4px -4px 18px; padding: 0 4px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; background: transparent; color: var(--text2);
  font: 600 13.5px var(--sans); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: #cfe0ff; border-bottom-color: var(--accent); }
.tabpane { display: none; } .tabpane.active { display: block; }
.guide { display: grid; gap: 14px; counter-reset: step; }
.gstep { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--bg2); }
.gstep .num { counter-increment: step; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: #cfe0ff; border: 1px solid rgba(79,143,247,.35); }
.gstep .num::before { content: counter(step); }
.gstep h3 { margin-bottom: 4px; }
.gstep p { margin: 0; }
.gstep dd pre.code { margin: 0; }
