:root {
  --bg: #0b1020;
  --card: #121a33;
  --text: #e7eaf3;
  --muted: #a9b0c3;
  --border: rgba(255, 255, 255, 0.08);
  --likely: #1f8a4c;
  --possible: #b08900;
  --unlikely: #6b7280;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.header h1 { margin: 0 0 8px; font-size: 28px; }
.muted { color: var(--muted); margin: 6px 0; }
.subline { margin: 4px 0 0; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.link { color: #b8d1ff; text-decoration: none; }
.link:hover { text-decoration: underline; }

.card {
  background: rgba(18, 26, 51, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
  backdrop-filter: blur(6px);
}
.card.error { border-color: rgba(185, 28, 28, 0.5); }

.form .field { margin-bottom: 12px; }
.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--muted); }
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
}
button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }

.actions { margin-top: 8px; }

.code {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.table th { text-align: left; color: var(--muted); font-weight: 600; }
.table-compact th, .table-compact td { padding: 8px 6px; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-likely { background: rgba(31, 138, 76, 0.25); color: #b9f6cf; border-color: rgba(31, 138, 76, 0.4); }
.badge-possible { background: rgba(176, 137, 0, 0.25); color: #ffe08a; border-color: rgba(176, 137, 0, 0.4); }
.badge-unlikely { background: rgba(107, 114, 128, 0.25); color: #e5e7eb; border-color: rgba(107, 114, 128, 0.35); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.box {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  padding: 12px;
  min-width: 0;
}
.box-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.box-sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-bottom: 10px;
}
.box-body { min-width: 0; overflow-wrap: anywhere; }
.box-entity .box-title { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.value { white-space: pre-wrap; overflow-wrap: anywhere; }

.kv { display: flex; flex-direction: column; gap: 8px; }
.kv-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-k { color: var(--muted); overflow-wrap: anywhere; }
.kv-v { overflow-wrap: anywhere; min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-item { min-width: 0; }

.more { border: 1px dashed var(--border); border-radius: 12px; padding: 10px; background: rgba(0,0,0,0.10); }
.more-summary { cursor: pointer; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  align-items: start;
}
.layout.layout-single { grid-template-columns: 1fr; }
.layout-side { position: sticky; top: 16px; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .layout-side { position: static; }
}

/* Render page helpers (shared UI) */
.title { margin: 0 0 6px; font-size: 26px; }
.subtitle { color: var(--muted); margin-bottom: 12px; }
.topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.topic {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
}
.alert {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
}
.group { margin: 14px 0 10px; font-size: 15px; color: var(--text); }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { min-width: 0; overflow-wrap: anywhere; }

.ext-links { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #b8d1ff;
  text-decoration: none;
  line-height: 1;
}
.ext-link:hover { text-decoration: underline; }
.ext-index { font-size: 1em; }
.ext-icon { width: 1em; height: 1em; }

.topics-strip { padding: 12px 16px; }
.topics-strip-title { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.group-title {
  margin: 14px 0 10px;
  font-size: 15px;
  color: var(--text);
}

.prop-table th { width: 220px; }
.obj-table th, .obj-table td { font-size: 13px; }

.side-card h2 { margin-top: 0; }
.side-links { margin: 0; padding-left: 18px; }
.side-links li { margin: 6px 0; }
