/* Editor Tab
Scope: editor tab layout, tree drawer, find UI, editor stage, syntax tokens, collapsed view, and editor context menu. */

#panel-editor { padding: 0; overflow: hidden; }
#panel-editor .EditorCompact-Cx { position: relative; height: 100%; min-height: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); background: var(--bg); overflow: hidden; }
#panel-editor .EditorIconbar-Dx { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 5px; border-right: 1px solid var(--border2); background: #08090d; z-index: 5; }
#panel-editor .EditorIcon-Eo { width: 30px; height: 30px; min-width: 30px; min-height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border2); border-radius: 6px; background: var(--bg2); color: var(--text2); font-size: 15px; line-height: 1; }
#panel-editor .EditorIcon-Eo.primary { margin-top: auto; color: var(--accent); border-color: var(--project-accent-border, var(--accent)); }
#panel-editor .EditorTreeDrawer-Dx { position: absolute; top: 0; bottom: 0; left: 42px; width: min(340px, 42vw); transform: translateX(-105%); transition: transform .18s ease; z-index: 4; background: rgba(11,13,19,.98); border-right: 1px solid var(--project-accent-border, var(--border2)); box-shadow: 16px 0 34px rgba(0,0,0,.38); }
#panel-editor.tree-open .EditorTreeDrawer-Dx { transform: translateX(0); }
#panel-editor #editor-sidebar { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 9px; gap: 8px; margin: 0; border: 0; border-radius: 0; background: transparent; overflow: hidden; text-transform: none; letter-spacing: normal; }
#panel-editor #editor-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; border: 0; background: transparent; color: var(--text3); letter-spacing: 3px; text-transform: uppercase; font-size: 11px; }
#panel-editor #editor-tree { min-height: 0; overflow: auto; padding: 7px; border: 1px solid var(--project-accent-border, var(--border2)); border-radius: 8px; background: linear-gradient(180deg, #11141d, #0d1017); font-size: 13px; }
#panel-editor #editor-find-results { min-height: 0; overflow: hidden; padding: 7px; border: 1px solid var(--project-accent-border, var(--border2)); border-radius: 8px; background: linear-gradient(180deg, #11141d, #0d1017); font-size: 12px; }
#panel-editor #editor-find-results[hidden] { display: none; }
.editor-find-results-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text2); padding: 2px 2px 7px; border-bottom: 1px solid var(--border); margin-bottom: 7px; }
.editor-find-results-head button { width: 22px; height: 22px; border: 1px solid var(--border2); border-radius: var(--radius); color: var(--text2); background: rgba(255,255,255,.04); }
.editor-find-results-list { max-height: calc(100vh - 330px); overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.editor-find-result-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 6px; align-items: start; padding: 5px 6px; border: 1px solid transparent; border-radius: var(--radius); background: rgba(255,255,255,.025); color: var(--text2); text-align: left; }
.editor-find-result-row:hover { border-color: var(--project-accent-border, var(--border2)); color: var(--text); }
.editor-find-result-line { color: var(--text3); font-family: var(--font-mono); text-align: right; }
.editor-find-result-quote { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-mono); }
.editor-find-result-empty { color: var(--text3); padding: 6px; }
#panel-editor .editor-tree-node { display: block; }
#panel-editor .editor-tree-row { display: grid; grid-template-columns: 12px 14px minmax(0, 1fr); gap: 4px; align-items: center; min-width: 0; padding: 3px 6px; border-radius: 6px; color: var(--text2); letter-spacing: 1px; cursor: pointer; }
#panel-editor .editor-tree-row:hover, #panel-editor .editor-tree-row.active { background: color-mix(in srgb, var(--project-accent-primary, rgba(224,92,53,.8)) 12%, transparent); color: var(--text); }
#panel-editor .editor-tree-children { margin-left: 9px; }
#panel-editor .editor-tree-node.collapsed > .editor-tree-children { display: none; }
#panel-editor .editor-tree-caret { width: 10px; color: var(--text3); flex-shrink: 0; font-size: 10px; }
#panel-editor .editor-tree-type { width: 14px; color: var(--text3); flex-shrink: 0; text-align: center; font-size: 12px; }
#panel-editor .editor-tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#panel-editor .EditorMain-Dx, #panel-editor #editor-main { position: relative; min-width: 0; min-height: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 10px 12px 12px; gap: 10px; }
#panel-editor #editor-head { display: grid; grid-template-columns: minmax(0, 1fr) 170px auto auto; gap: 8px; align-items: center; min-height: 34px; margin: 0; padding: 10px 12px; border: 1px solid var(--project-accent-border, var(--border)); border-radius: var(--radius); background: var(--bg2); }
#panel-editor #editor-file-meta { min-width: 0; }
#panel-editor #editor-file-path { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#panel-editor #editor-file-status { font-size: 12px; color: var(--text3); margin-top: 2px; }
#panel-editor #editor-section-select { min-width: 0; background: var(--bg2); border: 1px solid var(--project-accent-border, var(--border2)); color: var(--text2); border-radius: var(--radius); padding: 4px 6px; font-family: var(--font-ui); }
#panel-editor #editor-findbar { position: fixed; left: 8px; bottom: 76px; width: calc(360px - 16px); max-height: min(430px, 44vh); display: grid; grid-template-columns: 1fr; gap: 7px; align-items: stretch; padding: 9px; margin: 0; border: 1px solid var(--project-accent-border, rgba(105,86,52,.55)); border-radius: var(--radius); background: rgba(20,20,30,.96); box-shadow: 0 0 0 1px color-mix(in srgb, var(--project-accent-primary, rgba(224,92,53,.8)) 6%, transparent), 0 8px 22px rgba(0,0,0,.34); backdrop-filter: blur(6px); z-index: 9000; color: #b9bcc8; font-family: var(--font-ui); }
#panel-editor #editor-findbar[hidden] { display: none !important; }
#panel-editor #editor-findbar .field-input { min-height: 30px; background: rgba(20,20,29,.78); border: 1px solid rgba(86,86,108,.52); color: #f0f1f6; font-family: var(--font-ui); font-size: 13px; }
#panel-editor #editor-findbar .field-input::placeholder { color: #8d90a0; }
#panel-editor #editor-find-next-btn, #panel-editor #editor-find-all-btn, #panel-editor #editor-replace-next-btn, #panel-editor #editor-replace-all-btn { min-width: 0; min-height: 30px; padding: 6px 10px; white-space: nowrap; border: 1px solid rgba(86,86,108,.52); border-radius: var(--radius); background: rgba(255,255,255,.03); color: #b9bcc8; font-family: var(--font-ui); font-size: 13px; letter-spacing: .08em; text-align: center; }
#panel-editor #editor-find-next-btn:hover, #panel-editor #editor-find-all-btn:hover, #panel-editor #editor-replace-next-btn:hover, #panel-editor #editor-replace-all-btn:hover { background: rgba(255,255,255,.06); color: #f0c040; border-color: rgba(105,86,52,.72); }

#panel-editor #editor-findbar { left: 8px; right: auto; bottom: 76px; width: calc(360px - 16px); max-height: min(620px, 72vh); grid-template-columns: 1fr; gap: 9px; background: rgba(20,20,30,.72); }
#panel-editor #editor-findbar .EditorFindTitle-Dx { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #f0f1f6; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
#panel-editor .EditorFindSection-Dx { display: grid; gap: 7px; padding: 8px; border: 1px solid rgba(86,86,108,.42); border-radius: var(--radius); background: rgba(0,0,0,.22); }
#panel-editor .EditorFindSectionTitle-Eo { color: #f0c040; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
#panel-editor .EditorFindFields-Dx { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 7px; }
#panel-editor .EditorFindInlineOptions-Dx { display: flex; align-items: center; gap: 12px; color: #b9bcc8; font-size: 12px; }
#panel-editor .EditorFindButtons-Dx { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#panel-editor .EditorFindProjectButtons-Dx { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#panel-editor .EditorFindCount-Eo { min-height: 15px; color: #b9bcc8; font-size: 11px; line-height: 1.35; }
#panel-editor .EditorProjectScopeRows-Dx { display: grid; gap: 5px; }
#panel-editor .EditorProjectScopeRow-Dx { display: grid; grid-template-columns: 92px 104px minmax(0, 1fr); gap: 6px; align-items: center; }
#panel-editor #editor-find-results { max-height: min(270px, 34vh); overflow: hidden; padding: 7px; }
#panel-editor .editor-find-results-list { max-height: min(224px, 28vh); gap: 5px; padding-right: 4px; }
#panel-editor .editor-find-result-row { grid-template-columns: 22px 44px minmax(0, 1fr); gap: 7px; align-items: center; min-height: 28px; padding: 4px 6px; }
#panel-editor .editor-find-result-row.excluded { opacity: .42; text-decoration: line-through; }
#panel-editor .editor-find-result-exclude { width: 20px; height: 20px; border: 1px solid rgba(214,84,84,.55); border-radius: 4px; background: rgba(214,84,84,.12); color: #ff9da1; font-size: 12px; line-height: 1; }
#panel-editor .editor-find-file-break { margin: 4px 0 1px; padding: 2px 4px 3px; border: 0; color: #8ea3c5; font-family: var(--font-mono); font-size: 10px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#panel-editor .editor-find-gap-break { display: none; }
#panel-editor .editor-find-result-line { color: #85899a; font-family: var(--font-mono); font-size: 10px; text-align: right; }
#panel-editor .editor-find-result-quote { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 10px; line-height: 1.25; }
#panel-editor .editor-find-match-mark { background: rgba(240,192,64,.42); color: #fff; border-radius: 2px; padding: 0 1px; }
#panel-editor #editor-stage { position: relative; min-height: 0; height: auto; overflow: hidden; border: 1px solid var(--project-accent-border, var(--border2)); border-radius: 8px; background: #111116; }
#panel-editor #editor-highlight, #panel-editor #editor-textarea { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 14px; border: 0; background: transparent; font-family: var(--font-ui); font-size: 13px; line-height: 1.55; tab-size: 2; overflow: auto; white-space: pre; }
#panel-editor #editor-highlight { color: var(--text2); z-index: 1; pointer-events: none; }
#panel-editor #editor-highlight code { display: block; min-height: 100%; }
#panel-editor #editor-textarea { resize: none; caret-color: var(--accent2); color: transparent; -webkit-text-fill-color: transparent; z-index: 2; }
#panel-editor #editor-textarea::selection { background: color-mix(in srgb, var(--project-accent-primary, rgba(224,92,53,.8)) 35%, transparent); }
#panel-editor #editor-textarea:focus { outline: none; }
.tok-comment { color: var(--text3); }
.tok-string { color: var(--green); }
.tok-number { color: var(--yellow); }
.tok-keyword { color: var(--accent2); }
.tok-type { color: var(--blue); }
.tok-tag { color: var(--accent2); }
.tok-attr { color: var(--yellow); }
.tok-prop { color: var(--blue); }
.tok-punct { color: var(--text2); }

#editor-collapsed-view { position: absolute; inset: 0; overflow: auto; padding: 10px 0; background: var(--bg2); font-family: var(--font-ui); font-size: 13px; line-height: 1.45; }
#editor-stage.collapsed-mode #editor-highlight,
#editor-stage.collapsed-mode #editor-textarea { display: none; }
#editor-stage.collapsed-mode #editor-collapsed-view { display: block; }
.editor-collapsed-empty { padding: 12px; color: var(--text3); }
.editor-collapsed-item { display: grid; grid-template-columns: 56px 20px 1fr; align-items: center; gap: 8px; padding: 5px 12px; border-left: 2px solid transparent; color: var(--text2); cursor: pointer; user-select: none; }
.editor-collapsed-item:hover { background: rgba(255,255,255,0.04); }
.editor-collapsed-item.selected { background: color-mix(in srgb, var(--project-accent-primary, rgba(224,92,53,.8)) 16%, transparent); border-left-color: var(--project-accent-secondary, var(--accent)); color: var(--text); }
.editor-collapsed-line { color: var(--text3); text-align: right; }
.editor-collapsed-caret { color: var(--text3); text-align: center; }
.editor-collapsed-signature { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.editor-collapsed-source { grid-column: 1 / -1; margin: 6px 0 2px 84px; padding: 10px 12px; max-height: 42vh; overflow: auto; border: 1px solid var(--project-accent-border, var(--border2)); border-radius: var(--radius); background: #111116; color: var(--text2); font-family: var(--font-ui); font-size: 13px; line-height: 1.45; white-space: pre; }
#editor-context-menu { position: fixed; z-index: 5000; min-width: 168px; background: var(--bg1); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: 0 12px 28px rgba(0,0,0,0.38); padding: 4px; }
#editor-context-menu[hidden] { display: none; }
.editor-context-item { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: var(--radius); color: var(--text2); }
.editor-context-item:hover:not([disabled]) { background: var(--bg2); color: var(--text); }
.editor-context-item[disabled] { opacity: 0.4; cursor: default; }
