/* JDEtips brand theme — purple (#4F2575), Inter, rounded. Sourced from dev.jdetips.com */
:root {
  --bg: #f7f5fb;
  --panel: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b7280;
  --line: #e7e1f0;
  --accent: #4f2575;
  --accent-dark: #351a52;
  --accent-soft: #f5f1fa;
  --ok: #16a34a;
  --udc: #be185d;
  --th-bg: #f3eeff;
  --row-alt: #faf8fd;
  --code-bg: #f0eaf9;
  --chip: #fbe8f1;
  --chip-date: #e7f6ee;
  --chip-nd: #eef0f2;
  --radius: 1rem;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mono: "Cascadia Code", "Consolas", "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #150f1f;
  --panel: #1e1830;
  --ink: #ece7f7;
  --muted: #a99fc0;
  --line: #322a45;
  --accent: #c4a7f0;
  --accent-dark: #a78bdb;
  --accent-soft: #2a2040;
  --ok: #46c088;
  --udc: #f472b6;
  --th-bg: #251d3a;
  --row-alt: #1b1530;
  --code-bg: #271f3c;
  --chip: #3a2440;
  --chip-date: #16302a;
  --chip-nd: #262b34;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 1.1rem; margin: 0; letter-spacing: 0.02em; }

/* Embed mode (inside the jdetips.com iframe): hide the app's own top bar so the
   surrounding page provides the menu/footer chrome. */
.embed header { display: none; }
.app-version { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.03em; }

/* JDEtips brand wordmark */
.brand { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.brand-mark { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; }
.brand-jde { color: var(--ink); }
.brand-tips { color: var(--accent); }
.brand-inspector { color: var(--ink); font-weight: 600; opacity: 0.85; }
.brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  padding-left: 0.6rem;
  margin-left: 0.2rem;
  border-left: 1px solid var(--line);
  letter-spacing: 0.02em;
}
@media (max-width: 640px) { .brand-sub { display: none; } }
.conn { font: 0.8rem/1.4 var(--mono); color: var(--muted); }

/* Licensing / entitlement */
.lic-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.lic-badge.ok { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line); }
.lic-badge.bad { color: #b42318; background: #fee4e2; border: 1px solid #fecdca; }
.lic-banner {
  background: #fee4e2;
  color: #7a271a;
  border-bottom: 1px solid #fecdca;
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

nav {
  display: flex;
  gap: 0.25rem;
  padding: 0 1.2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
nav button {
  border: none;
  background: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
nav button:hover { color: var(--ink); }
nav button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 0.8rem 1.2rem; }
.tab { display: none; }
.tab.active { display: block; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.controls label { font-size: 0.85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.4rem; }
input, select, textarea, button {
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: var(--panel);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-radius: 0.6rem;
  cursor: pointer;
  font-weight: 600;
  transition: filter var(--transition), transform var(--transition);
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--panel); color: var(--accent); }

textarea#sql {
  width: 100%;
  min-height: 8rem;
  font: 0.9rem/1.5 var(--mono);
  resize: vertical;
  margin-bottom: 0.9rem;
}

.split { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; align-items: start; }
.tablelist, .detail, .result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 4rem;
}
.tablelist { max-height: 70vh; overflow: auto; }
.tablelist .row {
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font: 0.85rem var(--mono);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.tablelist .row:hover { background: var(--accent-soft); }
.tablelist .row .rc { color: var(--muted); font-size: 0.78rem; }
.detail { padding: 0.9rem; overflow: auto; }
tr.hasgloss { cursor: help; }
tr.hasgloss:hover td { background: var(--accent-soft); }
.detail h2 { margin: 0 0 0.2rem; font-size: 1rem; font-family: var(--mono); }
.detail .sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.8rem; }

.hint { color: var(--muted); font-size: 0.85rem; }

/* sample-data notice on the Browse tab */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.6rem;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.9rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink);
}
.notice-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.notice code { background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 4px; font: 0.82rem var(--mono); }
.result.big { font: 1.1rem var(--mono); }

table.grid {
  border-collapse: collapse;
  width: 100%;
  font: 0.82rem/1.4 var(--mono);
}
table.grid th, table.grid td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.5rem;
  text-align: left;
  white-space: nowrap;
}
table.grid th { background: var(--th-bg); position: sticky; top: 0; }
table.grid tr:nth-child(even) td { background: var(--row-alt); }
.result { overflow: auto; max-height: 72vh; }

.tag { display: inline-block; padding: 0 0.35rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.tag.udc { color: var(--udc); background: var(--chip); cursor: pointer; }
.tag.date { color: var(--ok); background: var(--chip-date); }
.tag.notdeployed { color: var(--muted); background: var(--chip-nd); }

td.dcell { color: var(--ok); }
table.grid a { color: var(--accent); text-decoration: none; font-weight: 600; cursor: pointer; }
table.grid a:hover { text-decoration: underline; }

/* header help link */
header { position: relative; }
.help-link { margin-left: auto; background: var(--panel); color: var(--accent); border: 1px solid var(--line); }

/* welcome banner */
.welcome {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.welcome.show { display: flex; }
.welcome-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* sortable/filterable grid tools */
.gridtools { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.4rem; }
.gfilter { width: 16em; }
.gridscroll { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 8px; }
.gridscroll table.grid { border: none; }
table.grid th { cursor: pointer; user-select: none; }
table.grid th .uhdr { font-size: 0.65rem; color: var(--udc); background: var(--chip); padding: 0 0.25rem; border-radius: 3px; }
table.grid th.hasgloss { text-decoration: underline dotted; text-underline-offset: 3px; }
table.grid tr[data-i]:hover td { background: var(--accent-soft); cursor: pointer; }

/* UDC-decoded cells */
td.udccell { border-bottom: 1px dotted var(--udc); }
td.udccell .udcdesc { color: var(--udc); margin-left: 0.5rem; font-size: 0.78rem; opacity: 0.85; }

/* query examples + library */
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; }
.example { font-size: 0.8rem; padding: 0.25rem 0.55rem; }
.lib { display: flex; gap: 1.5rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.libcol { min-width: 220px; }
.libcol h4 { margin: 0 0 0.3rem; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.libcol ul { list-style: none; margin: 0; padding: 0; }
.libcol li { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0; font-size: 0.82rem; }
.lib-load { color: var(--accent); cursor: pointer; font: 0.8rem var(--mono); text-decoration: none; }
.lib-load:hover { text-decoration: underline; }
.lib-del { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 0.2rem; font-weight: 700; }
.lib-del:hover { color: #b42318; }

/* row-detail modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 34, 0.45);
  z-index: 50;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
}
.modal.show { display: flex; }
.modal-card { background: var(--panel); border-radius: 10px; width: min(640px, 96vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 600; }
.modal-body { overflow: auto; padding: 0.5rem 1rem 1rem; }
.iconbtn { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; }
table.rd { width: 100%; border-collapse: collapse; font: 0.85rem/1.4 var(--mono); }
table.rd td { border-bottom: 1px solid var(--line); padding: 0.3rem 0.5rem; vertical-align: top; }
table.rd .rd-col { color: var(--muted); white-space: nowrap; width: 42%; }
table.rd .rd-extra.udc { color: var(--udc); margin-left: 0.5rem; }

/* DD drill-down panel */
.ddpanel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 30px rgba(0,0,0,0.12);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.ddpanel.show { transform: translateX(0); }
.dd-head { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.dd-title { font: 600 0.95rem var(--mono); }
.dd-body { overflow: auto; padding: 0.8rem 1rem; }
table.ddgrid { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.ddgrid th { text-align: left; color: var(--muted); font-weight: 500; padding: 0.35rem 0.5rem; width: 45%; vertical-align: top; white-space: nowrap; }
table.ddgrid td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
.udclink { color: var(--udc); cursor: pointer; font-weight: 600; }
.udclink:hover { text-decoration: underline; }

/* Help tab */
.help { max-width: 1100px; line-height: 1.55; }
.help h2 { margin-top: 0; }
.help .lead { color: var(--muted); font-size: 0.95rem; }
.help h3 { margin: 1.4rem 0 0.5rem; font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.help dl { display: grid; grid-template-columns: 7rem 1fr; gap: 0.4rem 1rem; margin: 0; }
.help dt { font-weight: 700; color: var(--accent); }
.help dd { margin: 0; font-size: 0.9rem; }
.help .concepts { font-size: 0.9rem; padding-left: 1.1rem; }
.help .concepts li { margin-bottom: 0.35rem; }
.help code { background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 4px; font: 0.82rem var(--mono); }

/* Home / landing page — full width, compact */
.home { max-width: none; margin: 0; }
.hero {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 0 1.1rem;
}
.hero-mascot-wrap { flex-shrink: 0; }
.hero-mascot-wrap.no-mascot { display: none; }
.hero-mascot {
  width: clamp(96px, 12vw, 150px);
  height: auto;
  display: block;
  animation: float 5s ease-in-out infinite;
  filter: drop-shadow(0 12px 22px rgba(79, 37, 117, 0.26));
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero-text { text-align: left; max-width: 780px; }
.hero-mark { width: 34px; height: 34px; color: var(--accent); }
.hero h2 { font-size: 1.5rem; font-weight: 800; margin: 0.2rem 0 0.35rem; letter-spacing: -0.02em; }
.hero-sub { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: flex-start; margin-top: 0.8rem; }
.hero-actions button { padding: 0.4rem 0.9rem; font-size: 0.88rem; border-radius: 0.6rem; }

.why {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  margin: 0 0 0.9rem;
}
.why h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.why p { margin: 0 0 0.5rem; line-height: 1.5; font-size: 0.88rem; }
.why p:last-child { margin-bottom: 0; }

.section-title { text-align: left; font-size: 1rem; margin: 1rem 0 0.6rem; }

.feature-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
}
.fcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.fcard:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.fc-icon { font-size: 1.35rem; line-height: 1; }
.fcard h4 { margin: 0.4rem 0 0.25rem; font-size: 0.95rem; }
.fcard p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.fc-go { display: inline-block; margin-top: 0.5rem; color: var(--accent); font-size: 0.8rem; font-weight: 600; }

.intel {
  max-width: none;
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.55;
  font-size: 0.88rem;
  columns: 2;
  column-gap: 2.5rem;
}
.intel li { margin-bottom: 0.35rem; break-inside: avoid; }
.home .foot { text-align: center; color: var(--muted); font-size: 0.84rem; margin: 1.1rem 0 0.5rem; }

/* Connection settings form */
.conn-page { max-width: 760px; }
.conn-page h2 { margin: 0 0 0.3rem; }
.conn-page > .hint { margin-top: 0; }
.form-row { display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0; }
.form-row > label { font-weight: 600; font-size: 0.9rem; }
.engine-fields {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem 1.1rem;
  margin: 0 0 1rem;
  background: var(--panel);
}
.engine-fields legend { font-weight: 700; font-size: 0.85rem; color: var(--accent); padding: 0 0.4rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.7rem 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.form-grid label.chk { flex-direction: row; align-items: center; gap: 0.4rem; }
.form-grid input, .form-grid select { font-size: 0.9rem; }
.form-actions { display: flex; gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.form-actions button { padding: 0.5rem 1.2rem; }
.ok-msg { color: var(--ok); background: var(--chip-date); border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.7rem 0.9rem; font-size: 0.9rem; line-height: 1.5; }
.field-help { font-size: 0.74rem; line-height: 1.4; color: var(--muted); font-weight: 400; }
.field-help b { color: var(--accent); font-weight: 700; }
.schema-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cfg-lock {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.6rem;
  padding: 0.6rem 0.85rem;
  margin: 0.6rem 0 0.9rem;
  font-size: 0.86rem;
}
.conn-page.locked input,
.conn-page.locked select {
  background: var(--bg);
  color: var(--muted);
  cursor: not-allowed;
}
.conn-page.locked .form-actions { display: none; }

/* Mascot companion + knowledge bubble */
.companion {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  max-width: 320px;
  pointer-events: none;
}
.companion.hidden { display: none; }
.companion > * { pointer-events: auto; }
.companion-mascot {
  width: 252px;
  height: auto;
  cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(79, 37, 117, 0.3));
  animation: float 5s ease-in-out infinite;
}
.companion-mascot:hover { filter: drop-shadow(0 10px 20px rgba(79, 37, 117, 0.45)); }
.companion-bubble {
  position: relative;
  align-self: stretch;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.9rem;
  padding: 0.7rem 1.7rem 0.7rem 0.85rem;
  font-size: 0.84rem;
  line-height: 1.5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  animation: bubblePop 0.22s ease-out;
}
.companion-bubble.hidden { display: none; }
.companion-bubble::after {
  content: "";
  position: absolute;
  bottom: -7px;
  right: 30px;
  width: 13px;
  height: 13px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.companion-bubble b { color: var(--accent); }
.companion-close {
  position: absolute;
  top: 3px;
  right: 5px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.2rem;
}
.companion-close:hover { color: var(--ink); }
@keyframes bubblePop {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 680px) {
  .companion { max-width: 210px; right: 0.6rem; bottom: 0.6rem; }
  .companion-mascot { width: 168px; }
  .companion-bubble { font-size: 0.8rem; }
}

/* pagination + glossary */
.pager { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.6rem; font-size: 0.82rem; color: var(--muted); }
.pager button { background: var(--panel); color: var(--accent); border: 1px solid var(--line); padding: 0.25rem 0.6rem; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.dd-gloss { margin-top: 1rem; }
.dd-gloss h4 { margin: 0 0 0.3rem; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.dd-gloss p { margin: 0; font-size: 0.88rem; line-height: 1.5; white-space: pre-wrap; }

.count { color: var(--muted); font-size: 0.82rem; margin-top: 0.5rem; }
.err { color: #b42318; background: #fee4e2; border: 1px solid #fecdca; padding: 0.5rem 0.7rem; border-radius: 6px; font-size: 0.85rem; }

.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: #1f2430;
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===================== CNC console ===================== */
:root { --crit: #e5484d; --warn: #f2a516; --info: #4f2575;
  --sweep-crit: #d64550; --sweep-warn: #b7791f; --sweep-clean: #2f9e44; }
:root[data-theme="dark"] { --crit: #f47174; --warn: #f5b942; --info: #c4a7f0;
  --sweep-crit: #f0787c; --sweep-warn: #e2b23a; --sweep-clean: #4ac36b; }

/* --- Top bar: identity · last-sweep meta · run --------------------------- */
.cnc-top {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.8rem;
  padding: 0.2rem 0 0.9rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem;
}
.cnc-top-id { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; }
.cnc-logo { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.cnc-logo span { color: var(--accent); }
.cnc-env { font: 0.8rem var(--mono); color: var(--muted); }
.cnc-top-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.cnc-sweepmeta { font: 0.76rem var(--mono); color: var(--muted); }
.cnc-sweeping { color: var(--accent); }
.cnc-runbtn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 0.5rem 1rem; font-size: 0.86rem; font-weight: 600; cursor: pointer;
}
.cnc-runbtn:hover { background: var(--accent-dark); }
.cnc-runbtn:disabled { opacity: 0.55; cursor: default; }
:root[data-theme="dark"] .cnc-runbtn { color: #1a1030; }
.cnc-owlbtn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  width: 34px; height: 34px; padding: 0.15rem; cursor: pointer; line-height: 0; flex-shrink: 0;
}
.cnc-owlbtn img { width: 100%; height: 100%; object-fit: contain; }
.cnc-owlbtn:hover { border-color: var(--accent); background: var(--accent-soft); }
.cnc-sagebubble {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 0.7rem; padding: 0.6rem 0.85rem; font-size: 0.85rem; line-height: 1.5;
  margin: -0.4rem 0 1rem; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.07);
}
.cnc-sagebubble b { color: var(--accent); }

/* --- Attention stat band ------------------------------------------------- */
.cnc-statband { display: flex; flex-wrap: wrap; align-items: stretch; margin-bottom: 1.4rem; }
.cnc-statcell {
  flex: 1 1 150px; display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.2rem 1.4rem; border: none; border-left: 1px solid var(--line);
  background: none; text-align: left; cursor: default; color: inherit; font-family: inherit;
}
.cnc-statcell:first-child { border-left: none; padding-left: 0.15rem; }
.cnc-statcell.cnc-jump { cursor: pointer; }
.cnc-statcell.cnc-jump:hover .cnc-bignum { text-decoration: underline; text-underline-offset: 5px; }
.cnc-bignum { font-size: 2.7rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cnc-bigword { font-size: 2rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.cnc-statlabel { font: 0.68rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cnc-bignum.sev-crit, .cnc-bigword.sev-crit, .cnc-sev.sev-crit { color: var(--sweep-crit); }
.cnc-bignum.sev-warn, .cnc-bigword.sev-warn, .cnc-sev.sev-warn { color: var(--sweep-warn); }
.cnc-bignum.sev-clean, .cnc-bigword.sev-clean { color: var(--sweep-clean); }
.cnc-statnote { align-self: center; margin-left: auto; font: 0.7rem var(--mono); color: var(--muted); }

/* --- Overview body: category rail + attention panel ---------------------- */
.cnc-body { display: grid; grid-template-columns: 244px 1fr; gap: 1.6rem; align-items: start; }
.cnc-rail2 { display: flex; flex-direction: column; gap: 0.1rem; position: sticky; top: 0.5rem; }
.cnc-r2 {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
  background: none; border: none; border-radius: 8px; padding: 0.5rem 0.6rem;
  font-size: 0.88rem; color: var(--ink); cursor: pointer; font-family: inherit;
}
.cnc-r2:hover { background: var(--accent-soft); }
.cnc-r2.active { background: var(--accent-soft); font-weight: 600; }
.cnc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.dot-crit { background: var(--sweep-crit); }
.dot-warn { background: var(--sweep-warn); }
.dot-clean { background: var(--sweep-clean); }
.cnc-r2-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnc-r2-count { font: 0.74rem var(--mono); color: var(--muted); flex-shrink: 0; }
.cnc-r2-count.status-crit { color: var(--sweep-crit); }
.cnc-r2-count.status-warn { color: var(--sweep-warn); }
.cnc-liblink {
  margin-top: 0.7rem; padding: 0.65rem 0.6rem 0; background: none; border: none;
  border-top: 1px solid var(--line); text-align: left;
  color: var(--accent); font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.cnc-liblink:hover { text-decoration: underline; }

/* --- Attention panel: ranked findings ------------------------------------ */
.cnc-attn-head { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.cnc-attn-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.cnc-attn-sub { font: 0.75rem var(--mono); color: var(--muted); }
.cnc-findings { display: flex; flex-direction: column; gap: 0.7rem; }
.cnc-finding {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: 10px; padding: 0.9rem 1.05rem;
}
.cnc-finding.sev-crit { border-left-color: var(--sweep-crit); }
.cnc-finding.sev-warn { border-left-color: var(--sweep-warn); }
.cf-main { flex: 1 1 300px; min-width: 0; }
.cf-main h4 { margin: 0 0 0.25rem; font-size: 0.95rem; font-weight: 700; }
.cf-main p { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.cf-move { font-weight: 600; }
.cf-move.new, .cf-move.up { color: var(--sweep-crit); }
.cf-move.down { color: var(--sweep-clean); }
.cf-side { display: flex; align-items: center; gap: 0.9rem; flex-shrink: 0; }
.cf-tbl { font: 0.72rem var(--mono); color: var(--muted); background: var(--code-bg); border-radius: 5px; padding: 0.15rem 0.45rem; }
.cf-count { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cf-count b { font-size: 1.15rem; color: var(--ink); font-weight: 800; margin-right: 0.15rem; }
.cf-view {
  background: var(--panel); color: var(--accent); border: 1px solid var(--line);
  border-radius: 7px; padding: 0.4rem 0.8rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cf-view:hover { border-color: var(--accent); background: var(--accent-soft); }

/* clean category / first-run / sweeping / view-rows states */
.cnc-clean { text-align: center; padding: 2.6rem 1rem; color: var(--muted); }
.cnc-clean-badge {
  width: 44px; height: 44px; margin: 0 auto 0.7rem; border-radius: 50%;
  background: var(--chip-date); color: var(--sweep-clean); font-size: 1.4rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.cnc-clean h3 { margin: 0 0 0.3rem; color: var(--ink); font-size: 1rem; }
.cnc-clean p { margin: 0; font-size: 0.86rem; }
.cnc-firstrun { text-align: center; max-width: 520px; margin: 2.4rem auto; }
.cnc-firstrun-owl img { width: 96px; height: auto; filter: drop-shadow(0 10px 20px rgba(79, 37, 117, 0.25)); }
.cnc-firstrun h2 { margin: 0.6rem 0 0.4rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.cnc-firstrun p { margin: 0 auto 1rem; color: var(--muted); font-size: 0.92rem; line-height: 1.55; max-width: 440px; }
.cnc-firstrun-btn { font-size: 0.95rem; padding: 0.6rem 1.3rem; }
.cnc-inline-link { color: var(--accent); cursor: pointer; font-weight: 600; }
.cnc-inline-link:hover { text-decoration: underline; }
.cnc-sweepwait { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.cnc-sweepwait p { margin: 1rem auto 0; max-width: 380px; font-size: 0.9rem; }
.cnc-spinner {
  width: 34px; height: 34px; margin: 0 auto; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: cncspin 0.8s linear infinite;
}
@keyframes cncspin { to { transform: rotate(360deg); } }
.cnc-back { background: none; border: none; color: var(--accent); font-size: 0.84rem; font-weight: 600; cursor: pointer; padding: 0 0 0.6rem; font-family: inherit; }
.cnc-back:hover { text-decoration: underline; }
.cnc-rv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cnc-rv-head h3 { margin: 0 0 0.15rem; font-size: 1rem; }
.cnc-rv-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* library sub-view header */
.cnc-libhead { display: flex; align-items: baseline; gap: 0.9rem; margin-bottom: 1rem; }
.cnc-libhead h3 { margin: 0; font-size: 1.05rem; }

@media (max-width: 820px) {
  .cnc-body { grid-template-columns: 1fr; }
  .cnc-rail2 { position: static; flex-direction: row; flex-wrap: wrap; }
  .cnc-r2 { width: auto; flex: 0 0 auto; }
  .cnc-liblink { border-top: none; }
  .cnc-statcell { flex-basis: 44%; padding: 0.2rem 0.9rem; }
}

/* Console layout: category rail + main */
.cnc-console { display: grid; grid-template-columns: 216px 1fr; gap: 1rem; align-items: start; }
.cnc-rail {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: sticky;
  top: 0.5rem;
  max-height: 82vh;
  overflow: auto;
}
.cnc-rail-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 0.6rem;
  padding: 0.42rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.cnc-rail-item:hover { background: var(--accent-soft); }
.cnc-rail-item.active { background: var(--accent-soft); border-color: var(--line); color: var(--accent); font-weight: 700; }
.cri-icon { width: 1.2rem; text-align: center; flex-shrink: 0; }
.cri-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cri-count { color: var(--muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.cnc-rail-item.active .cri-count { color: var(--accent); }
.cnc-rail-alerts .cri-icon { filter: saturate(1.2); }
.cnc-rail-div { height: 1px; background: var(--line); margin: 0.35rem 0.2rem; }

/* Toolbar */
.cnc-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.cnc-search { flex: 1 1 280px; min-width: 220px; }
.cnc-sevfilter { display: flex; gap: 0.25rem; }
.cnc-sev-chip {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.cnc-sev-chip:hover { color: var(--ink); }
.cnc-sev-chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.cnc-count { color: var(--muted); font-size: 0.82rem; margin-left: auto; }

/* Card grid */
.cnc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 0.7rem; }
.cnc-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 10px;
  padding: 0.75rem 0.85rem 0.7rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.cnc-card.sev-crit { border-left-color: var(--crit); }
.cnc-card.sev-warn { border-left-color: var(--warn); }
.cnc-card.sev-info { border-left-color: var(--info); }
.cnc-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1); border-color: var(--accent); }
.cnc-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cnc-pin {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
  cursor: pointer;
}
.cnc-pin.on { color: var(--warn); }
.cnc-pin:hover { color: var(--accent); }
.cnc-card-head { display: flex; align-items: baseline; gap: 0.45rem; padding-right: 1.4rem; }
.cnc-card-icon { font-size: 1.05rem; flex-shrink: 0; }
.cnc-card-head h4 { margin: 0; font-size: 0.92rem; font-weight: 700; line-height: 1.3; }
.cnc-card-desc { margin: 0.4rem 0 0.55rem; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.cnc-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; font-size: 0.72rem; }
.cnc-sev { font-size: 0.72rem; }
.cnc-status { font-size: 0.72rem; font-weight: 600; }
.cnc-status.ready { color: var(--ok); }
.cnc-status.pending { color: var(--muted); }
.cnc-alert-flag { font-size: 0.72rem; }
.cnc-tables { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; margin-left: auto; }
.cnc-tbl {
  font: 0.68rem var(--mono);
  color: var(--muted);
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.02rem 0.3rem;
}
.cnc-tbl-more { color: var(--accent); }
.cnc-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 2rem 1rem; font-size: 0.9rem; }

/* Result panel */
.cnc-result { display: none; margin-bottom: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 0.95rem; }
.cnc-result.show { display: block; }
.cnc-run-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.cnc-run-title { display: flex; align-items: flex-start; gap: 0.55rem; }
.cnc-run-title h3 { margin: 0; font-size: 1rem; }
.cnc-run-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.cnc-run-actions .ghost { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.cnc-sql { margin: 0.3rem 0 0.6rem; }
.cnc-sql summary { cursor: pointer; color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.cnc-sql pre {
  margin: 0.4rem 0 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  font: 0.8rem/1.5 var(--mono);
  overflow: auto;
  white-space: pre-wrap;
}
.cnc-pending { display: flex; gap: 0.8rem; align-items: flex-start; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 0.9rem; }
.cnc-pending-owl { font-size: 1.6rem; line-height: 1; }
.cnc-pending-body { flex: 1; }
.cnc-pending-body p { margin: 0 0 0.5rem; font-size: 0.86rem; line-height: 1.5; }
.cnc-pending-body p:last-child { margin-bottom: 0; }
.cnc-pending-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.cnc-pending-lbl { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 0.3rem; }
.cnc-pending code { background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 4px; font: 0.78rem var(--mono); }

@media (max-width: 760px) {
  .cnc-console { grid-template-columns: 1fr; }
  .cnc-rail { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-height: none; padding-bottom: 0.3rem; }
  .cnc-rail-item { width: auto; flex-shrink: 0; }
  .cnc-rail-div { display: none; }
  .cnc-count { margin-left: 0; }
}

/* ===================== Relate ===================== */
.relate-intro h2 { margin: 0 0 0.2rem; font-size: 1.3rem; letter-spacing: -0.02em; }
.relate-intro p { margin: 0 0 0.9rem; max-width: 820px; }
.relate-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.relate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 0.95rem; }
.relate-card h3 { margin: 0 0 0.6rem; font-size: 0.98rem; }
.relate-card .controls { margin-bottom: 0.4rem; }
.relate-card select { min-width: 12em; }

.rel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.rel-head h2 { margin: 0 0 0.15rem; font-size: 1.05rem; font-family: var(--mono); }
.rel-links { font-family: "Inter", sans-serif; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.rel-empty { color: var(--muted); padding: 1.4rem; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.rel-sec { margin: 1.2rem 0 0.6rem; font-size: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.rel-sec .hint { font-weight: 400; }

/* schema map */
.rel-map { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; overflow-x: auto; }
.rel-svg { width: 100%; height: auto; max-height: 460px; display: block; }
.rel-edge { stroke: var(--line); stroke-width: 1.5; }
.rel-node { cursor: pointer; }
.rel-node rect { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; transition: fill 0.12s, stroke 0.12s; }
.rel-node:hover rect { stroke: var(--accent); fill: var(--accent-soft); }
.rel-node.fam rect { fill: var(--accent-soft); stroke: var(--accent); }
.rel-node.center rect { fill: var(--accent); stroke: var(--accent); }
.rel-nt { fill: var(--ink); font: 700 12px var(--mono); text-anchor: middle; }
.rel-node.center .rel-nt { fill: #fff; font-size: 13px; }
.rel-nk { fill: var(--muted); font: 9px "Inter", sans-serif; text-anchor: middle; }

/* families */
.rel-fams { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.7rem; }
.rel-fam { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; }
.rel-fam-h { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; font-size: 0.92rem; }
.rel-fam-m { display: flex; align-items: center; gap: 0.45rem; padding: 0.28rem 0.35rem; border-radius: 6px; cursor: pointer; }
.rel-fam-m:hover { background: var(--accent-soft); }
.rel-fam-m b { font-family: var(--mono); font-size: 0.84rem; }
.rel-fam-d { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-mini { background: var(--panel); color: var(--accent); border: 1px solid var(--line); border-radius: 5px; padding: 0.1rem 0.4rem; font-size: 0.72rem; flex-shrink: 0; }
.rel-role { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.05rem 0.35rem; border-radius: 4px; flex-shrink: 0; }
.rel-role.master { color: #7c3aed; background: var(--chip); }
.rel-role.header { color: var(--accent); background: var(--accent-soft); }
.rel-role.detail { color: var(--ok); background: var(--chip-date); }
.rel-role.ledger { color: #b45309; background: #fdf1de; }
.rel-role.related { color: var(--muted); background: var(--chip-nd); }
:root[data-theme="dark"] .rel-role.ledger { background: #35270f; }

/* shared keys / connectors */
.rel-conns { display: flex; flex-direction: column; gap: 0.4rem; }
.rel-conn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.6rem; }
.rel-conn summary { cursor: pointer; font-size: 0.9rem; }
.rel-conn summary code { background: var(--code-bg); padding: 0 0.3rem; border-radius: 4px; font: 0.78rem var(--mono); color: var(--udc); }
.rel-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.rel-tchip { display: inline-flex; align-items: center; gap: 0.15rem; font: 0.78rem var(--mono); background: var(--accent-soft); border: 1px solid var(--line); border-radius: 5px; padding: 0.12rem 0.4rem; cursor: pointer; }
.rel-tchip:hover { border-color: var(--accent); }
.rel-join { background: none; border: none; color: var(--accent); font-size: 0.82rem; padding: 0 0.1rem; cursor: pointer; line-height: 1; }
.rel-join:hover { transform: scale(1.2); }
.rel-more { align-self: center; }

/* where-used */
table.grid.rel-wu td { white-space: normal; }
.rel-wu .rel-cnt { text-align: right; font-variant-numeric: tabular-nums; }
.rel-bar { width: 120px; height: 8px; background: var(--code-bg); border-radius: 4px; overflow: hidden; }
.rel-bar span { display: block; height: 100%; background: var(--accent); }
.rel-view { padding: 0.2rem 0.5rem; font-size: 0.76rem; }
tr.rel-rowdetail { display: none; }
tr.rel-rowdetail.show { display: table-row; }
tr.rel-rowdetail td { background: var(--bg) !important; padding: 0.5rem; }
.rel-rowgrid .gridscroll { max-height: 40vh; }

/* ===================== Query Power ===================== */
.err-inline { color: #b42318; }
:root[data-theme="dark"] .err-inline { color: #f47174; }

/* Visual query builder */
.qb { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem; margin-bottom: 0.8rem; }
.qb-top { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.qb-top label { font-size: 0.82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.qb-close { margin-left: auto; }
.qb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.qb-panel h4 { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--accent); }
.qb-cols { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem; }
.qb-colhead { font-size: 0.8rem; margin-bottom: 0.3rem; }
.qb-colhead a { color: var(--accent); cursor: pointer; }
.qb-col { display: flex; align-items: baseline; gap: 0.4rem; padding: 0.12rem 0; font-size: 0.8rem; }
.qb-cn { font-family: var(--mono); }
.qb-frow, .qb-order { display: flex; gap: 0.35rem; margin-bottom: 0.35rem; align-items: center; }
.qb-frow select, .qb-frow input { font-size: 0.8rem; }
.qb-fcol { flex: 1; }
.qb-fdel { padding: 0.2rem 0.4rem; }
.qb-actions { display: flex; gap: 0.5rem; margin-top: 0.7rem; }
@media (max-width: 720px) { .qb-grid { grid-template-columns: 1fr; } }

/* Chart / pivot */
.viz-panel:empty { display: none; }
.viz-panel { margin: 0.8rem 0; }
.viz-tabs { display: flex; gap: 0.3rem; align-items: center; margin-bottom: 0.5rem; }
.viz-tab { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.viz-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.viz-close { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
.viz-controls { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 0.6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.7rem; }
.viz-controls label { font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.viz-canvas { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem; overflow-x: auto; }
.viz-svg { width: 100%; height: auto; max-height: 340px; display: block; }
.viz-svg .viz-axis { fill: var(--muted); font: 10px "Inter", sans-serif; }
.viz-svg .viz-line { stroke: var(--line); stroke-width: 1; }
.pivot-canvas table.grid th { background: var(--th-bg); }

/* Environment compare */
.cmp-panel { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.85rem; margin-bottom: 0.8rem; }
.cmp-headrow { margin-bottom: 0.5rem; }
.cmp-headrow code { background: var(--code-bg); padding: 0.05rem 0.3rem; border-radius: 4px; font: 0.8rem var(--mono); }
.cmp-schemas { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.cmp-chip { display: inline-flex; align-items: center; gap: 0.3rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.2rem 0.5rem; font: 0.8rem var(--mono); }
.cmp-summary { width: auto; margin-bottom: 0.8rem; }
.cmp-grids { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0.8rem; }
.cmp-col { min-width: 0; }
.cmp-col h4 { margin: 0 0 0.4rem; font-size: 0.9rem; font-family: var(--mono); }
