:root {
  --bg: #0f1420;
  --surface: #161d2e;
  --surface-2: #1d2639;
  --border: #2a3550;
  --text: #dbe4f5;
  --muted: #8b98b5;
  --accent: #4f8cff;
  --danger: #ff6b6b;
  --ok: #4cd964;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.5rem; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.brand h1 { font-size: 1.05rem; }

.session-box { display: flex; align-items: center; gap: 0.75rem; }
.badge {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.login-view {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: min(22rem, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-card h2 { margin-bottom: 0.2rem; }

.muted { color: var(--muted); font-size: 0.85rem; }

label { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-size: 0.95rem;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }

.error-text { color: var(--danger); font-size: 0.85rem; }

.app-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  padding: 0.75rem 1rem;
  gap: 0.6rem;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar-item { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.toolbar-label { font-size: 0.8rem; margin: 0; }
.toolbar-search input { width: 16rem; }
.stats { margin-left: auto; font-size: 0.8rem; }

.graph-container {
  flex: 1;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
}

.detail-panel {
  position: absolute;
  right: 1rem;
  top: 4rem;
  width: min(24rem, calc(100% - 2rem));
  max-height: calc(100% - 8rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 10;
}
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.detail-body { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; font-size: 0.85rem; }
.detail-body dt { color: var(--muted); }
.detail-body dd { margin: 0; word-break: break-word; }
.detail-body .section { grid-column: 1 / -1; color: var(--accent); font-size: 0.8rem; margin-top: 0.5rem; }

.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.kind-compute { background: #4f8cff; }
.kind-platform { background: #9b6dff; }
.kind-workload { background: #2ec27e; }
.kind-artifact { background: #e8a23c; }
.kind-ingress { background: #ff6b9d; }
.kind-endpoint { background: #3ddbd9; }
.kind-service { background: #ff9f43; }
.kind-other { background: #8b98b5; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  clip: rect(0 0 0 0);
  overflow: hidden;
}
