:root {
  --bg: #0b1020;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #8aa4ff;
  --danger: #f87171;
  --warn: #fbbf24;
  --ok: #4ade80;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background:
  radial-gradient(circle at top left, rgba(138, 164, 255, 0.11), transparent 30%),
  radial-gradient(circle at top right, rgba(255,255,255,0.05), transparent 22%),
  var(--bg);
  color: var(--text);
}
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: 120ms ease;
}
button:hover { background: rgba(255,255,255,0.08); transform: translateY(-1px); }
button.primary { background: rgba(138,164,255,0.18); border-color: rgba(138,164,255,0.34); }
button.ghost { background: transparent; }
button.danger { border-color: rgba(248,113,113,0.3); color: #fecaca; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
#app { max-width: 1600px; margin: 0 auto; padding: 0 24px 40px; }
.header {
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px);
  background: rgba(11,16,32,0.82); border-bottom: 1px solid var(--border); margin: 0 -24px; padding: 0 24px;
}
.header-inner, .toolbar, .hero, .grid, .repo-meta, .footer-note, .inline-actions { display: flex; gap: 12px; }
.header-inner { min-height: 76px; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 16px; display: grid; place-items: center;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--accent); font-weight: 700;
}
.brand h1 { margin: 0; font-size: 15px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
main { padding-top: 24px; display: grid; gap: 20px; }
.hero {
  justify-content: space-between; align-items: flex-start; padding: 24px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(138,164,255,0.12), rgba(255,255,255,0.03)); border: 1px solid var(--border);
}
.hero h2 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 0; max-width: 760px; color: var(--muted); line-height: 1.55; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; width: min(520px, 100%); }
.kpi { border: 1px solid var(--border); background: rgba(255,255,255,0.03); padding: 14px; border-radius: 18px; }
.kpi strong { display: block; font-size: 20px; }
.kpi span { color: var(--muted); font-size: 12px; }
.toolbar { flex-wrap: wrap; }
.grid { align-items: start; }
.grid-3 { display: grid; grid-template-columns: 320px minmax(0,1fr) 360px; gap: 20px; }
.stack { display: grid; gap: 20px; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 22px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.panel-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 14px; font-weight: 700; }
.panel-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 16px 18px; display: grid; gap: 14px; }
.muted { color: var(--muted); }
.badge, .status {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px;
}
.badge { background: rgba(255,255,255,0.04); }
.status.valid { color: #bbf7d0; border-color: rgba(74,222,128,0.24); }
.status.warning, .status.incomplete { color: #fde68a; border-color: rgba(251,191,36,0.24); }
.status.blocked { color: #fecaca; border-color: rgba(248,113,113,0.26); }
.list { display: grid; gap: 10px; }
.list-item {
  padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: rgba(255,255,255,0.03);
  transition: 120ms ease;
}
.list-item:hover { background: rgba(255,255,255,0.05); }
.list-item.active { border-color: rgba(138,164,255,0.38); background: rgba(138,164,255,0.10); }
.list-item h4, .list-item p { margin: 0; }
.list-item p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.label { display: grid; gap: 6px; }
.label span { font-size: 12px; color: var(--muted); }
.graph-canvas {
  position: relative; min-height: 320px; border-radius: 18px; border: 1px dashed rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.03)); overflow: hidden;
}
.graph-node {
  position: absolute; min-width: 180px; max-width: 220px; padding: 12px; border-radius: 16px; border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92); box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
.graph-node.selected { border-color: rgba(138,164,255,0.44); box-shadow: 0 0 0 1px rgba(138,164,255,0.18), 0 10px 24px rgba(0,0,0,0.24); }
.graph-node small { color: var(--muted); display: block; margin-top: 6px; }
.graph-edge { font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); }
.issue { padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); }
.issue.error { border-color: rgba(248,113,113,0.28); color: #fecaca; background: rgba(248,113,113,0.07); }
.issue.warning { border-color: rgba(251,191,36,0.26); color: #fde68a; background: rgba(251,191,36,0.06); }
.trace-step {
  padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,0.03);
}
.trace-step.active { border-color: rgba(138,164,255,0.36); background: rgba(138,164,255,0.10); }
pre {
  margin: 0; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: rgba(2,6,23,0.7);
  overflow: auto; max-height: 520px; white-space: pre-wrap; word-break: break-word;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab.active { background: rgba(138,164,255,0.16); border-color: rgba(138,164,255,0.34); }
.empty { color: var(--muted); font-size: 14px; padding: 14px; border: 1px dashed rgba(255,255,255,0.12); border-radius: 16px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-note { justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.small { font-size: 12px; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 2px 0; }
@media (max-width: 1260px) {
  .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(120px, 1fr)); width: 100%; }
}
@media (max-width: 760px) {
  #app { padding: 0 14px 24px; }
  .header { margin: 0 -14px; padding: 0 14px; }
  .hero, .header-inner { flex-direction: column; align-items: stretch; }
  .two-col, .three-col { grid-template-columns: 1fr; }
}
