:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-bg: #eff6ff;
  --ok: #10b981;
  --err: #ef4444;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

header {
  background: var(--text);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
.badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  font-size: 12px;
}
.badge.ok { background: var(--ok); }
.badge.err { background: var(--err); }

nav#tabs {
  display: flex;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 4px;
}
nav#tabs button {
  background: none;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
nav#tabs button:hover { color: var(--text); }
nav#tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 24px;
}

.tab { display: none; }
.tab.active { display: block; }
.tab h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
.hint { color: var(--muted); margin: 0 0 16px; font-size: 13px; }

form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 12px;
}
form label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
input[type=text], input[type=number], input:not([type]), select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
input[type=file] { font-size: 13px; }
button {
  padding: 7px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
button:hover { filter: brightness(1.1); }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: white; color: var(--text); border: 1px solid var(--border); }

details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
}
details > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}
details[open] > summary { border-bottom: 1px solid var(--border); }
details > form { margin: 0; border: none; border-radius: 0; }

.search-opts {
  display: none;
  background: var(--accent-bg);
  border-color: #bfdbfe;
}
.search-opts.show { display: flex; }

.output {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  max-height: 600px;
  overflow: auto;
}
.output:empty::before { content: "결과 영역"; color: var(--muted); }
.output .ok { color: var(--ok); font-weight: 600; }
.output .err { color: var(--err); font-weight: 600; }
.output .warn { color: var(--warn); }

table {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  border-collapse: collapse;
  margin-top: 8px;
}
table th, table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table th { background: #f8fafc; font-weight: 600; color: var(--muted); }
table tr:last-child td { border-bottom: none; }

/* Graph */
.graph-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
}
.graph-controls .legend { font-size: 12px; color: var(--muted); margin-left: auto; }
.graph-controls .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin: 0 4px 0 8px;
  vertical-align: middle;
}
#cy {
  height: 600px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
}
#cy-detail {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  min-height: 60px;
}
#cy-detail:empty::before { content: "노드를 클릭하면 상세가 표시됩니다."; color: var(--muted); }
.meta { font-size: 12px; color: var(--muted); }

/* metrics dashboard */
.metric-card {
  display: inline-block;
  padding: 12px 16px;
  margin: 4px 8px 4px 0;
  background: var(--accent-bg);
  border-radius: 6px;
  border: 1px solid #bfdbfe;
}
.metric-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.metric-card .value { font-size: 20px; font-weight: 600; color: var(--accent); }
.metric-bar {
  display: inline-block;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
  vertical-align: middle;
}
