:root {
  --bg: #f3f7ff;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #5f6b85;
  --line: #d9e4f4;
  --accent: #0ea5e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 580px at 8% -20%, #dbeafe 0%, transparent 60%), var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 247, 255, 0.9);
  backdrop-filter: blur(8px);
}

.back-btn {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 14px;
}

.title-wrap h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
}

.title-wrap p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.view-nav {
  display: flex;
  gap: 8px;
}

.view-link {
  text-decoration: none;
  color: #37517c;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.view-link.active {
  border-color: #8bd5ff;
  color: #0c4a6e;
  background: #e0f2fe;
}

.layout {
  width: calc(100% - 18px);
  margin: 10px auto 16px;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 320px;
  gap: 12px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(30, 64, 175, 0.08);
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

label span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #516487;
  font-weight: 800;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.seg {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-weight: 700;
  padding: 9px 10px;
  cursor: pointer;
}

.seg.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f8fbff;
}

.stat .k {
  font-size: 12px;
  color: #5d7397;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
}

.stat .v {
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}

.table-wrap {
  max-height: calc(100vh - 250px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  background: #f1f7ff;
  z-index: 1;
  text-align: left;
  font-size: 12px;
  color: #49648d;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

tbody td {
  border-bottom: 1px solid #edf2fb;
  padding: 9px 10px;
  font-size: 14px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr.active {
  background: #e0f2fe;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  font-weight: 700;
}

.domain-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.domain-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fbfdff;
}

.domain-card h3 {
  margin: 0;
  font-size: 15px;
}

.domain-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.domain-list button {
  width: 100%;
  text-align: left;
  border: 1px solid #e8eef8;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  padding: 7px 8px;
  cursor: pointer;
}

.domain-list button:hover {
  background: #f4faff;
}

.hidden {
  display: none !important;
}

.inspector-empty {
  margin-top: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
}

.node-name {
  margin: 0;
  font-size: 20px;
}

.node-axiom {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.detail-row {
  margin-bottom: 10px;
}

.detail-label {
  font-size: 12px;
  color: #516487;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  margin-bottom: 5px;
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jump-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #355070;
  font-size: 12px;
  padding: 4px 8px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 1300px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .table-wrap,
  .domain-cards {
    max-height: 60vh;
  }
}
