/* JSONL 浏览器 —— 应用区样式(源自单文件版 JSONL Lens;品牌与页脚外壳由 DevKit chrome 接管) */

:root {
  color-scheme: light;
  --line: #e7e9e7;
  --muted: #8b9290;
  --green: #438b73;
}
* { box-sizing: border-box; }
button, input { font: inherit; }
/* 工具页为满视口应用:页面本身不滚动,site header(共享 css/style.css 的 flex column body)+ .app 撑满剩余高度 */
body { min-width: 760px; height: 100vh; min-height: 0; overflow: hidden; background: #f6f7f6; color: #252b2a; }
button {
  color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 7px;
  min-height: 34px; padding: 0 11px; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: #f5f8f6; border-color: #cbd8d1; }
button:disabled { opacity: .4; cursor: default; }
.app { flex: 1; min-height: 0; display: grid; grid-template-rows: 60px minmax(0, 1fr) 27px; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line); }
.file-action { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.primary { color: #fff; background: #438b73; border-color: #438b73; }
.primary:hover:not(:disabled) { color: #fff; background: #347960; border-color: #347960; }
#fileName { max-width: 210px; overflow: hidden; color: #747d79; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.record-controls { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-wrap { position: relative; display: block; }
.search-wrap input { width: 100%; height: 35px; padding: 0 11px 0 31px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fbfcfb; color: #333; font-size: 12px; }
.search-wrap input:focus { border-color: #8eb7a6; box-shadow: 0 0 0 3px #438b7317; }
.search-icon { position: absolute; left: 11px; top: 9px; color: #929a96; font-size: 13px; pointer-events: none; }
.record-count { min-width: 72px; color: #707875; text-align: center; white-space: nowrap; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.icon-button { width: 35px; padding: 0; font-size: 17px; }
.workspace { display: grid; min-height: 0; grid-template-columns: 250px minmax(0, 1fr); gap: 8px; padding: 8px; }
.record-nav { min-width: 0; min-height: 0; display: grid; grid-template-rows: 43px 48px minmax(0, 1fr); overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 13px; border-bottom: 1px solid #eff0ef; }
.nav-heading strong { font-size: 12px; font-weight: 650; }
.nav-heading span { color: #98a09c; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.nav-search { padding: 7px 10px; border-bottom: 1px solid #f1f2f1; }
.nav-search .search-wrap input { height: 33px; font-size: 11px; }
.record-list { min-height: 0; overflow-y: auto; padding: 5px; scrollbar-color: #d9dedb transparent; scrollbar-width: thin; }
.record-item { width: 100%; display: block; min-height: 0; padding: 9px 9px 8px; margin: 1px 0; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.record-item:hover:not(:disabled) { background: #f5f8f6; }
.record-item[aria-current="true"] { background: #edf5f0; box-shadow: inset 2px 0 #438b73; }
.record-item-title { display: block; overflow: hidden; color: #3e4944; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.record-item[aria-current="true"] .record-item-title { color: #347960; }
.record-item-subtitle { display: block; overflow: hidden; margin-top: 4px; color: #929b96; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.record-item-line { float: right; margin-left: 7px; color: #adb4b0; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.nav-empty { padding: 18px 10px; color: #9aa19e; font-size: 11px; line-height: 1.6; text-align: center; }
.record-workspace { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.record-workspace.show-source { grid-template-columns: minmax(270px, 30%) minmax(0, 1fr); }
.source-panel { display: none; min-width: 0; min-height: 0; grid-template-rows: 36px minmax(0, 1fr); overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.show-source .source-panel { display: grid; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 13px; border-bottom: 1px solid #eff0ef; }
.panel-title { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.panel-title strong { font-size: 12px; font-weight: 650; }
.panel-title span { color: #9aa19e; font-size: 10px; }
.copy-button { min-height: 27px; padding: 0 8px; color: #626b67; font-size: 10px; }
.code-scroll { min-height: 0; overflow: auto; padding: 8px 0 20px; background: #fff; scrollbar-color: #d9dedb transparent; scrollbar-width: thin; }
.code-line { display: grid; grid-template-columns: 48px minmax(0, 1fr); min-height: 19px; padding-right: 14px; font: 11px/19px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.code-line[data-path] { cursor: pointer; }
.code-line[data-path]:hover { background: #f6f9f7; }
.code-line[data-path]:focus-visible { outline: 2px solid #75aa91; outline-offset: -2px; }
.code-line.sync-focus-line { background: #eaf5ee; }
.line-number { padding-right: 13px; color: #a7aeab; text-align: right; user-select: none; }
.code-text { min-width: 0; color: #515a56; }
.json-key { color: #8057a5; }
.json-string { color: #327b63; }
.json-number { color: #b16c35; }
.json-literal { color: #467eaa; }
.diagram-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 36px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.diagram-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid #eff0ef; }
.diagram-heading .panel-title { gap: 9px; }
.graph-meta { color: #8c9691; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.canvas-viewport {
  position: relative; min-height: 0; overflow: hidden; touch-action: none; cursor: grab;
  background-color: #fcfdfc;
  background-image: radial-gradient(#dfe5e1 .8px, transparent .8px);
  background-size: 14px 14px;
}
.canvas-viewport.is-panning { cursor: grabbing; }
.stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
.edges, .nodes { position: absolute; inset: 0; overflow: visible; }
.edges { z-index: 0; }
.edge { fill: none; stroke: #b9b9b9; stroke-width: 1.35; vector-effect: non-scaling-stroke; }
.edge-dot { fill: #a5a5a5; }
.nodes { z-index: 1; }
.diagram-node { position: absolute; width: max-content; min-width: 190px; max-width: 560px; overflow: visible; border: 1px solid #dfe5e1; border-radius: 6px; background: #fff; box-shadow: 0 2px 7px #273a3010; color: #34413b; }
.node-header { min-height: 28px; display: flex; align-items: center; padding: 5px 9px; border-radius: 5px 5px 0 0; background: var(--tone-bg); color: var(--tone-fg); font: 600 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.diagram-node[data-tone="1"] { --tone-bg: #e9e4f8; --tone-fg: #725a9e; }
.diagram-node[data-tone="2"] { --tone-bg: #dff0e7; --tone-fg: #54846a; }
.diagram-node[data-tone="3"] { --tone-bg: #e7edf8; --tone-fg: #617da5; }
.diagram-node[data-tone="4"] { --tone-bg: #f8e5dd; --tone-fg: #ac6f58; }
.diagram-node[data-tone="0"] { --tone-bg: #e7f0db; --tone-fg: #75864d; }
.node-row { position: relative; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px; align-items: start; min-height: 25px; padding: 4px 9px; border-top: 1px solid #eff1f0; }
.node-key { max-width: 220px; color: #397dd4; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.node-value { color: #57615c; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.node-value[data-type="string"] { color: #55615b; }
.node-value[data-type="boolean"], .node-value[data-type="null"], .node-value[data-type="number"] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.node-row.is-reference .node-value { color: #929b96; font: 9.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.node-row.is-reference::after { content: ""; position: absolute; z-index: 2; top: 50%; right: -3px; width: 6px; height: 6px; transform: translateY(-50%); border: 1px solid #b8c9c0; border-radius: 50%; background: #fff; }
.node-row.sync-focus-target { background: #eef7f1; box-shadow: inset 3px 0 #438b73; }
.node-header.sync-focus-target { outline: 2px solid #438b73; outline-offset: -2px; }
.diagram-node.sync-focus-card { box-shadow: 0 0 0 3px #438b7330, 0 4px 14px #26382f18; }
.empty-state { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 30px; color: #7a8580; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-inner { max-width: 360px; }
.empty-mark { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 13px; border: 1px solid #e3e9e5; border-radius: 11px; color: #548b76; background: #f7faf8; font: 15px ui-monospace, monospace; }
.empty-state h2 { margin: 0 0 7px; color: #424c47; font-size: 15px; font-weight: 600; }
.empty-state p { margin: 0; color: #8e9793; font-size: 11px; line-height: 1.7; }
.canvas-toolbar { position: absolute; z-index: 3; left: 50%; bottom: 17px; display: flex; align-items: center; gap: 5px; padding: 5px; transform: translateX(-50%); border: 1px solid #e4e8e5; border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: 0 4px 18px #26382f14; }
.canvas-toolbar button { width: 31px; min-height: 29px; padding: 0; border: 0; background: transparent; color: #56615b; font-size: 15px; }
.canvas-toolbar button:hover:not(:disabled) { background: #f1f5f2; }
.canvas-toolbar .fit-button { width: auto; padding: 0 9px; font-size: 10px; }
.zoom-label { min-width: 39px; color: #7d8782; text-align: center; font: 10px ui-monospace, monospace; }
.footer { display: flex; align-items: center; gap: 7px; padding: 0 17px; color: #909995; background: #fff; border-top: 1px solid var(--line); font-size: 9px; letter-spacing: .04em; }
.footer-dot { width: 6px; height: 6px; border-radius: 50%; background: #67a88b; }
.footer-right { margin-left: auto; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.footer-right a { color: inherit; }
.footer-right a:hover { color: #438b73; }
.drag-overlay { position: fixed; inset: 8px; z-index: 20; display: grid; place-items: center; border: 2px dashed #77a58f; border-radius: 16px; background: #f2f8f4ef; color: #3f8068; font-size: 18px; pointer-events: none; }
.drag-overlay[hidden] { display: none; }
.editor-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 26px; background: #26332de6; }
.editor-overlay[hidden] { display: none; }
.editor-dialog { width: min(860px, 100%); height: min(620px, 100%); display: grid; grid-template-rows: 44px minmax(0, 1fr) 46px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 22px 70px #26382f38; }
.editor-heading { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 15px; border-bottom: 1px solid #eff0ef; }
.editor-heading strong { font-size: 13px; font-weight: 650; }
.editor-heading span { margin-right: auto; color: #9aa19e; font-size: 10.5px; }
.editor-text { width: 100%; min-height: 0; padding: 12px 15px; border: 0; outline: none; resize: none; background: #fbfcfb; color: #333; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; scrollbar-color: #d9dedb transparent; scrollbar-width: thin; }
.editor-text:focus { background: #fff; }
.editor-actions { display: flex; align-items: center; gap: 8px; padding: 0 15px; border-top: 1px solid #eff0ef; }
.editor-stat { margin-right: auto; color: #707875; font: 10.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 1100px) {
  body { min-width: 0; }
  .workspace { grid-template-columns: 205px minmax(0, 1fr); }
  .record-workspace.show-source { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(190px, 40%) minmax(0, 1fr); }
  #fileName { max-width: 150px; }
}
@media (max-width: 700px) {
  .app { grid-template-rows: auto minmax(0, 1fr) 25px; }
  .topbar { min-height: 59px; padding: 8px 11px; flex-wrap: wrap; gap: 8px 12px; }
  .record-controls { margin-left: auto; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(165px, 28%) minmax(0, 1fr); padding: 7px; gap: 7px; }
  .record-nav { grid-template-rows: 34px 0 minmax(0, 1fr); }
  .nav-search { display: none; }
  .record-list { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 4px; }
  .record-item { width: 190px; min-width: 190px; align-self: stretch; }
  .record-workspace.show-source { grid-template-columns: 1fr; grid-template-rows: minmax(170px, 42%) minmax(0, 1fr); }
  .footer-right .footer-home { display: none; }
}
