/* ---------- Base + Theme ---------- */
:root {
  --bg: #0b1220;          /* dark background */
  --bg-card: #0f172a;
  --text: #e5e7eb;        /* slate-200 */
  --muted: #94a3b8;       /* slate-400 */
  --border: #1f2a44;      /* slate-700 */
  --accent: #60a5fa;      /* blue-400 */
  --accent-contrast: #0b1220;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
:root.light {
  --bg: #f6f8fb;
  --bg-card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --shadow: 0 10px 24px rgba(2,6,23,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-card);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .2px; font-weight: 700; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  gap: 16px; padding: 16px; height: calc(100% - 54px);
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.controls { padding: 16px; overflow: auto; height: 100%; }
.card-title { margin: 0; font-size: 15px; font-weight: 700; }
.card-head { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--border); }

.section { padding: 16px 0; border-top: 1px solid var(--border); }
.section:first-of-type { border-top: 0; }
.section > h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .2px; }

label { display:block; font-size:12px; color: var(--muted); margin: 8px 0 6px; }
input, textarea {
  width: 100%; padding: 10px 12px; border:1px solid var(--border);
  border-radius: 10px; outline: none; background: transparent; color: var(--text);
}
input::placeholder, textarea::placeholder { color: #8ea2c5; }
textarea { resize: vertical; min-height: 110px; }

.row { display:flex; align-items:center; gap: 8px; margin-top: 10px; }

.btn {
  padding: 10px 12px; border-radius: 10px; border:1px solid var(--border);
  background: #1b2843; color: var(--text); cursor: pointer; transition: transform .06s ease, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn.ghost { background: transparent; }

/* ---------- Aligned, smooth controls ---------- */
.control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  user-select: none;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .06s ease;
  margin-top: 8px;
}
.control:hover { border-color: var(--accent); background: rgba(96,165,250,0.06); }
.control:active { transform: translateY(1px); }
.control > span { font-size: 13px; line-height: 1; color: var(--text); }

.control input[type="checkbox"],
.control input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Graph ---------- */
#graphCard { display:flex; flex-direction: column; }
#cy { flex: 1; height: calc(100vh - 54px - 32px - 48px); border-radius: 16px; }

.muted { color: var(--muted); font-size: 12px; }
.error { color: #fca5a5; }

.list { display:flex; flex-direction:column; gap:6px; max-height:140px; overflow:auto; }
.pill { display:inline-block; font-size:12px; background:#24314f; padding:2px 8px; border-radius:999px; margin-right:6px; }

.hint { font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  #cy { height: 60vh; }
}
