/* NOVA Command Dashboard – dark operations cockpit */
.nd {
    --nd-bg: #0d1117;
    --nd-panel: #151b26;
    --nd-border: #253045;
    --nd-text: #dbe2f0;
    --nd-muted: #8a95ab;
    --nd-accent: #7c9cff;
    --nd-ok: #3ec7c2;
    --nd-warn: #ffb547;
    --nd-err: #ff5d73;
    --nd-scroll-thumb: #2e3a52;
    --nd-scroll-thumb-hover: var(--nd-accent);
    --nd-scroll-track: var(--nd-bg);
    color-scheme: dark;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(360px, 2fr) minmax(240px, 1fr);
    grid-template-rows: auto minmax(320px, 1fr) minmax(320px, auto);
    grid-template-areas:
        "header header header"
        "left graph right"
        "left console right";
    gap: 12px;
    padding: 12px;
    min-height: calc(100vh - 64px);
    background: var(--nd-bg);
    color: var(--nd-text);
    font-size: 14px;
}

.nd h1 { margin: 0; font-size: 1.25rem; }
.nd h2 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--nd-muted); }

.nd-header { grid-area: header; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.nd-title { display: flex; align-items: center; gap: 16px; }
.nd-logo { height: 36px; width: auto; flex: 0 0 auto; }
.nd-kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.nd-kpis div { background: var(--nd-panel); border: 1px solid var(--nd-border); border-radius: 8px; padding: 6px 12px; min-width: 96px; }
.nd-kpis dt { font-size: .7rem; color: var(--nd-muted); }
.nd-kpis dd { margin: 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.nd-panel { background: var(--nd-panel); border: 1px solid var(--nd-border); border-radius: 10px; padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.nd-left { grid-area: left; overflow: auto; }
.nd-right { grid-area: right; overflow: auto; }
.nd-graph-panel { grid-area: graph; gap: 8px; }
.nd-console { grid-area: console; gap: 8px; }

.nd-stage { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #1d2433; font-size: .8rem; }
.nd-stage .nd-dot { background: var(--nd-ok); }
.nd-stage-thinking .nd-dot, .nd-stage-callingtool .nd-dot, .nd-stage-connecting .nd-dot, .nd-stage-persisting .nd-dot { background: var(--nd-warn); animation: nd-pulse 1s infinite; }
.nd-stage-failed .nd-dot { background: var(--nd-err); }

.nd-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--nd-muted); }
.nd-state-online { background: var(--nd-ok); }
.nd-state-degraded { background: var(--nd-warn); }
.nd-state-offline { background: var(--nd-err); }

.nd ul, .nd ol { list-style: none; margin: 0; padding: 0; }
.nd-systems li, .nd-history li, .nd-events li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--nd-border); }
.nd-grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nd small, .nd-meta, .nd-muted { color: var(--nd-muted); font-size: .75rem; }
.nd-meta { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nd-selected { background: #1d2740; border-radius: 6px; }

.nd-search, .nd-compose textarea { width: 100%; box-sizing: border-box; background: #0f1520; color: var(--nd-text); border: 1px solid var(--nd-border); border-radius: 6px; padding: 6px 8px; font: inherit; }
.nd-search { margin-bottom: 8px; }
.nd-history { max-height: 40vh; overflow: auto; }
.nd button.nd-link { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: inherit; cursor: pointer; display: flex; flex-direction: column; padding: 0; font: inherit; }
.nd button.nd-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd button.nd-icon, .nd-confirm button { background: none; border: 1px solid var(--nd-border); color: var(--nd-muted); border-radius: 4px; cursor: pointer; padding: 2px 6px; }
.nd button.nd-danger { color: var(--nd-err); border-color: var(--nd-err); }
.nd-confirm { display: flex; gap: 4px; }
.nd-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.nd-section-head h2 { margin: 0; }
.nd-section-separated { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--nd-border); }
.nd button.nd-icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--nd-muted); cursor: pointer; }
.nd button.nd-icon-btn svg { width: 16px; height: 16px; }
.nd button.nd-icon-btn:hover:not(:disabled) { color: var(--nd-text); border-color: var(--nd-border); background: #1d2433; }
.nd button.nd-icon-btn:disabled { opacity: .5; cursor: default; }
.nd button.nd-spin svg { animation: nd-rotate 1s linear infinite; }
.nd-kpis dd small { color: var(--nd-muted); font-size: .7rem; }
@keyframes nd-rotate { to { transform: rotate(360deg); } }

.nova-graph { position: relative; flex: 1; min-height: 420px; border-radius: 8px; overflow: hidden; background: #070a12; box-shadow: inset 0 0 0 1px rgba(124,156,255,.18), inset 0 0 40px rgba(62,232,224,.06); }
.nova-graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.nova-graph-hint { position: absolute; bottom: 4px; left: 4px; margin: 0; color: var(--nd-muted); font-size: .75rem; }
.nd-selection { margin: 0; }

.nd-messages { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; }
.nd-msg { border-radius: 8px; padding: 8px 10px; background: #1b2231; max-width: 90%; }
.nd-msg p { margin: 4px 0; white-space: pre-wrap; }
.nd-msg-user { align-self: flex-end; background: #22305a; }
.nd-msg-error { border: 1px solid var(--nd-err); }
.nd-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.nd-markdown { line-height: 1.5; overflow-wrap: anywhere; }
.nd-markdown > :first-child { margin-top: 4px; }
.nd-markdown > :last-child { margin-bottom: 4px; }
.nd-markdown p { margin: 6px 0; white-space: normal; }
.nd-markdown h1, .nd-markdown h2, .nd-markdown h3, .nd-markdown h4 { margin: 10px 0 4px; font-size: 1rem; color: var(--nd-text); }
.nd-markdown h1 { font-size: 1.15rem; }
.nd-markdown ul, .nd-markdown ol { margin: 6px 0; padding-left: 20px; }
.nd-markdown li { margin: 2px 0; }
.nd-markdown a { color: var(--nd-accent); }
.nd-markdown code { padding: 1px 5px; border-radius: 4px; background: var(--nd-bg); font-size: .85em; }
.nd-markdown pre { margin: 8px 0; padding: 10px; border-radius: 6px; background: var(--nd-bg); overflow: auto; }
.nd-markdown pre code { padding: 0; background: none; }
.nd-markdown blockquote { margin: 8px 0; padding: 4px 10px; border-left: 3px solid var(--nd-accent); color: var(--nd-muted); }
.nd-markdown table { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: .85rem; }
.nd-markdown th, .nd-markdown td { padding: 4px 8px; border: 1px solid var(--nd-border); text-align: left; }
.nd-markdown th { background: var(--nd-bg); }
.nd-markdown hr { border: none; border-top: 1px solid var(--nd-border); }

.nd-msg-document { width: 100%; max-width: 100%; box-sizing: border-box; }
.nd-doc-inline { margin: 8px 0; }
.nd-doc-inline .nova-document { max-height: 70vh; }
.nd-doc-link { padding: 4px 10px; border: 1px solid var(--nd-border); border-radius: 6px; background: transparent; color: var(--nd-accent); font: inherit; font-size: .85rem; cursor: pointer; }
.nd-doc-link:hover { background: #22305a; }

.nd-events { max-height: 45vh; overflow: auto; }
.nd-events time { color: var(--nd-muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.nd-evt-toolstarted .nd-grow { color: var(--nd-warn); }
.nd-evt-toolcompleted .nd-grow, .nd-evt-response .nd-grow { color: var(--nd-ok); }
.nd-evt-toolfailed .nd-grow, .nd-evt-error .nd-grow, .nd-evt-warning .nd-grow { color: var(--nd-err); }

.nd-bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.nd-bars li { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.nd-bars span { width: 100%; min-height: 2px; background: var(--nd-accent); border-radius: 3px 3px 0 0; }

.nd-center { padding: 32px; text-align: center; }
.nd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@keyframes nd-pulse { 50% { opacity: .35; } }

/* Einheitlicher Scrollbalken für alle Dashboard-Komponenten */
.nd ::-webkit-scrollbar { width: 10px; height: 10px; }
.nd ::-webkit-scrollbar-track { background: var(--nd-scroll-track); border-radius: 5px; }
.nd ::-webkit-scrollbar-thumb { background: var(--nd-scroll-thumb); border: 2px solid var(--nd-scroll-track); border-radius: 5px; }
.nd ::-webkit-scrollbar-thumb:hover { background: var(--nd-scroll-thumb-hover); }
.nd ::-webkit-scrollbar-corner { background: transparent; }

@supports not selector(::-webkit-scrollbar) {
    .nd, .nd * { scrollbar-color: var(--nd-scroll-thumb) var(--nd-scroll-track); scrollbar-width: thin; }
}

@media (prefers-reduced-motion: reduce) {
    .nd-stage .nd-dot { animation: none !important; }
}

@media (max-width: 1100px) {
    .nd { grid-template-columns: 1fr; grid-template-areas: "header" "console" "graph" "left" "right"; }
}
