:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1c2330; --muted: #6b7587; --line: #dfe3ea; --accent: #2563eb; --accent-ink: #fff;
  --hover: #eef2f9; --sel: #dbe8ff; --hit: #fff3bf; --err: #c62828; --ok: #1b7f45;
  --k: #7b3fa0; --s: #1b7f45; --n: #b45309; --b: #0b6fb0; --z: #8a8f9a;
  --add: #d9f5e1; --del: #fde0df; --chg: #fff0c2; --mov: #dfe7ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1a1e26; --ink: #e4e8ef; --muted: #8b95a7; --line: #2b313c; --accent: #5b8def; --accent-ink: #0b1220;
    --hover: #232937; --sel: #243a66; --hit: #514510; --err: #ff6b6b; --ok: #4cc77f;
    --k: #c58af0; --s: #6fd39b; --n: #f2a65a; --b: #6bb8f0; --z: #8a8f9a;
    --add: #17402a; --del: #4a2224; --chg: #4a3d12; --mov: #26345e;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
.mono, pre, textarea.code { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pad { padding: 4px 8px; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.logo { display: inline-block; background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 1px 6px; font-family: var(--mono); margin-right: 6px; }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 10px; padding: 10px; }
.input, .views { min-height: 0; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.editor { flex: 1; min-height: 0; display: flex; }
textarea.code { flex: 1; width: 100%; resize: none; border: 0; outline: 0; padding: 10px 12px; background: transparent; color: var(--ink); font-size: 12.5px; line-height: 18px; tab-size: 2; white-space: pre; overflow: auto; }
textarea.code.bad { box-shadow: inset 3px 0 0 var(--err); }
textarea.short { flex: none; height: 140px; border-top: 1px solid var(--line); }
textarea.tall { height: 100%; border-right: 1px solid var(--line); }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.urlbar { display: flex; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.urlbar input { flex: 1; }
input[type=text], input[type=search], input[type=url], select, textarea { font: inherit; }
input[type=text], input[type=search], input[type=url], select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-width: 0; }
input.bad { border-color: var(--err); }
input:focus, select:focus, button:focus-visible, .tree:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chk { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; white-space: nowrap; }
button { font: inherit; color: inherit; cursor: pointer; }
.mini { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font-size: 13px; text-decoration: none; }
.mini:hover { background: var(--hover); }
.mini.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; font-family: var(--mono); font-size: 12.5px; }
.status { padding: 6px 12px; font-size: 13px; color: var(--muted); min-height: 30px; border-top: 1px solid var(--line); }
.views > .panels > .panel > .status { border-top: 0; border-bottom: 1px solid var(--line); }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }

.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 14px; color: var(--muted); font-weight: 500; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.panels { flex: 1; min-height: 0; position: relative; }
.panel { position: absolute; inset: 0; display: none; flex-direction: column; overflow: auto; }
.panel.active { display: flex; }
.panel > * { flex-shrink: 0; }
.empty { margin: auto; color: var(--muted); padding: 40px; text-align: center; }

.crumbs { display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-bottom: 1px solid var(--line); font-size: 13px; overflow-x: auto; white-space: nowrap; min-height: 34px; }
.crumb { background: none; border: 0; padding: 1px 4px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
.crumb:hover { background: var(--hover); }
.sep { color: var(--muted); }

.vl { flex: 1; min-height: 0; overflow: auto; position: relative; }
.vl-spacer { position: relative; min-width: 100%; }
.vl-inner { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.tree { font-family: var(--mono); font-size: 12.5px; outline: none; }
.row { height: 24px; display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: default; }
.row:hover { background: var(--hover); }
.row.hit { background: var(--hit); }
.row.sel { background: var(--sel); }
.caret { width: 14px; text-align: center; color: var(--muted); cursor: pointer; user-select: none; flex: none; }
.caret.none { visibility: hidden; }
.key { color: var(--k); }
.key.root { color: var(--muted); }
.colon { color: var(--muted); margin-left: -4px; }
.val { overflow: hidden; text-overflow: ellipsis; }
.val.dim { color: var(--muted); }
.v-string { color: var(--s); } .v-number { color: var(--n); } .v-boolean { color: var(--b); } .v-null { color: var(--z); font-style: italic; }
.mark { background: #ffd54f; color: #000; border-radius: 2px; }
.badge { font-size: 10.5px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); font-family: system-ui, sans-serif; line-height: 16px; flex: none; }
.b-string { color: var(--s); } .b-number { color: var(--n); } .b-boolean { color: var(--b); } .b-null { color: var(--z); } .b-object { color: var(--k); } .b-array { color: var(--accent); }

.thead-wrap { overflow: hidden; border-bottom: 1px solid var(--line); background: var(--panel); }
.thead, .trow { display: flex; }
.tcell { flex: none; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 24px; height: 24px; border-right: 1px solid var(--line); font-size: 12.5px; }
.th { background: var(--hover); border: 0; border-right: 1px solid var(--line); font-weight: 600; text-align: left; }
.table .trow { border-bottom: 1px solid var(--line); cursor: pointer; font-family: var(--mono); }
.table .trow:hover { background: var(--hover); }
.tcell.idx { color: var(--muted); text-align: right; }
.t-number { color: var(--n); text-align: right; } .t-string { color: var(--s); } .t-boolean { color: var(--b); } .t-null { color: var(--z); } .t-object, .t-array { color: var(--muted); }

pre.raw { margin: 0; padding: 10px 14px; overflow: auto; flex: 1; font-size: 12.5px; line-height: 18px; tab-size: 2; }
pre.raw.small { flex: none; max-height: 220px; background: var(--hover); border-radius: 6px; margin: 0; padding: 6px 10px; line-height: 16px; font-size: 12px; }
.hk { color: var(--k); } .hs { color: var(--s); } .hn { color: var(--n); } .hb { color: var(--b); } .hz { color: var(--z); font-style: italic; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 10px; align-items: center; border-bottom: 1px solid var(--line); }
.chip { font-family: var(--mono); font-size: 12px; background: var(--hover); border: 1px solid var(--line); border-radius: 12px; padding: 1px 9px; }
.results { padding: 8px 10px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.result-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 2px; }

.split { display: flex; flex: 1; min-height: 0; }
.split > * { flex: 1; min-width: 0; }
.split.fixed { flex: none; }
.stack { display: flex; flex-direction: column; }
.stack > textarea { height: 150px; flex: none; border-bottom: 1px solid var(--line); }
.errors { overflow: auto; padding: 6px 10px; }
.error { display: grid; grid-template-columns: minmax(80px, 30%) 120px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kw { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); min-height: 160px; max-height: 46vh; overflow: auto; flex: none; }
.side { min-width: 0; border-right: 1px solid var(--line); }
.side:last-child { border-right: 0; }
.side-title { position: sticky; top: 0; background: var(--panel); font-weight: 600; padding: 3px 10px; border-bottom: 1px solid var(--line); z-index: 1; font-size: 12px; }
.side-body { font-family: var(--mono); font-size: 12px; overflow-x: auto; }
.dl { white-space: pre; line-height: 18px; padding: 0 10px; display: flex; }
.dl .ind { flex: none; }
.dl.added { background: var(--add); } .dl.removed { background: var(--del); } .dl.changed { background: var(--chg); } .dl.moved { background: var(--mov); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 6px 14px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.drop { position: fixed; inset: 0; background: rgba(37, 99, 235, .85); color: #fff; display: grid; place-items: center; font-size: 22px; z-index: 10; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 240px 1fr; }
  body { height: auto; min-height: 100%; }
  .views { min-height: 70vh; }
}
