:root {
  --bg: #fff; --fg: #1d1d1f; --muted: #6b6b70; --line: #dcdce0; --head: #f4f4f6;
  --accent: #2f6fdd; --error: #c62828; --null: #a0a0a8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #18181b; --fg: #e8e8ea; --muted: #9a9aa2; --line: #333338; --head: #222226;
          --accent: #6b9cff; --error: #ff6b6b; --null: #6b6b72; }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.4 system-ui, sans-serif; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }
.muted { color: var(--muted); }
main { flex: 1; display: flex; min-height: 0; }
aside { width: 260px; border-right: 1px solid var(--line); overflow: auto; padding: 8px 10px; font-size: 13px; }
.aside-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.schema { margin-top: 8px; font-weight: 600; color: var(--muted); }
.tbl { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--fg);
       padding: 2px 4px; cursor: pointer; border-radius: 4px; font: inherit; }
.tbl:hover { background: var(--head); }
.tbl .kind { color: var(--muted); font-size: 11px; }
section { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px 14px; gap: 8px; }
textarea { width: 100%; height: 30%; min-height: 120px; resize: vertical; font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace;
           padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
button, select, input { font: inherit; color: var(--fg); background: var(--head); border: 1px solid var(--line); border-radius: 5px; padding: 4px 10px; }
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#result { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; font: 12.5px/1.35 ui-monospace, Menlo, Consolas, monospace; }
th, td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 3px 8px; white-space: pre; max-width: 480px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
th { position: sticky; top: 0; background: var(--head); text-align: left; }
th small { display: block; font-weight: 400; color: var(--muted); }
td.num { text-align: right; }
td.null { color: var(--null); }
.error { color: var(--error); padding: 10px; white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; }
.note { padding: 10px; color: var(--muted); }
