/* VaultX editor shell (owned by the editor workstream). Uses design tokens from app.css; every token has a dark fallback. */

/* ---------- overlay layer contract (find highlights, current line, bookmarks) ---------- */
.editor-surface{position:relative;flex:1;min-width:0;display:flex}
.editor-surface>textarea.code-text{position:relative;z-index:1}
.editor-layers{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:0;font-variant-ligatures:none}

/* ---------- viewer dialog as an editor workspace ---------- */
#viewer.viewer-editor{width:min(1680px,calc(100% - 24px));height:calc(100% - 24px);max-width:none;max-height:none;padding:0;overflow:hidden;border-radius:var(--radius,12px)}
#viewer.viewer-editor.viewer-maximized{width:100%;height:100%;border:0;border-radius:0}
#viewer.viewer-editor #viewer-content{display:flex;flex-direction:column;height:100%;min-height:0}

.editor-header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:8px 10px 8px 16px;border-bottom:1px solid var(--line,#2b3039);background:var(--surface,#181b20);flex-shrink:0}
.editor-header .viewer-title{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.editor-header .file-type-icon{flex:none}
.editor-title-text{min-width:0;display:flex;flex-direction:column;gap:1px}
.editor-header .viewer-title h2{margin:0;font-size:14px;font-weight:600;line-height:1.3;color:var(--text,#f0f2f6);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.editor-header .editor-meta{font-size:12px;line-height:1.3;color:var(--muted,#949eae);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.editor-header .viewer-actions{display:flex;align-items:center;gap:4px;flex:none}
.editor-header .viewer-actions .button{min-height:32px;height:32px;padding:0 12px;gap:6px;font-size:13px;border-radius:var(--radius-sm,8px)}
.editor-header .viewer-actions .button .icon{width:16px;height:16px}
.editor-header .viewer-actions .icon-button{width:32px;height:32px;border-radius:var(--radius-sm,8px)}
.editor-header .viewer-actions .icon-button .icon{width:18px;height:18px}
.editor-header .viewer-actions .editor-save-button{margin-right:4px}

.editor-save-chip,.editor-statusbar .sb-state{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;flex:none}
.editor-save-chip{height:22px;padding:0 9px;border-radius:999px;font-size:12px;font-weight:500;color:var(--muted,#949eae);background:var(--surface2,#1e2229);border:1px solid var(--line,#2b3039)}
.editor-save-chip::before,.editor-statusbar .sb-state::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor;flex:none}
.editor-save-chip[data-state=saved],.editor-statusbar .sb-state[data-state=saved]{color:var(--green,#79c5a6)}
.editor-save-chip[data-state=saved]{background:var(--success-soft,#1b2f28);border-color:transparent}
.editor-save-chip[data-state=dirty],.editor-statusbar .sb-state[data-state=dirty]{color:var(--amber,#e8b04f)}
.editor-save-chip[data-state=dirty]{background:var(--warning-soft,#33291a);border-color:transparent}
.editor-save-chip[data-state=saving],.editor-statusbar .sb-state[data-state=saving]{color:var(--accent,#5d96ff)}
.editor-save-chip[data-state=saving]{background:var(--accent-soft,#1c2d4c);border-color:transparent}
.editor-save-chip[data-state=readonly],.editor-statusbar .sb-state[data-state=readonly]{color:var(--muted,#949eae)}

/* ---------- editor body ---------- */
.viewer-body.has-text-editor{--editor-font-size:14px;--editor-line-height:24px;--editor-tab-size:4;position:relative;display:flex;flex-direction:column;flex:1;min-height:0;padding:0;overflow:hidden;background:var(--editor-bg,#111419);color:var(--text,#f0f2f6);font-family:var(--font-ui,"Segoe UI",system-ui,sans-serif)}
.has-text-editor>.extraction-notice{flex-shrink:0}

/* menu bar */
.has-text-editor .editor-menubar{display:flex;align-items:center;gap:1px;height:30px;padding:0 6px;background:var(--surface,#181b20);border-bottom:1px solid var(--line-soft,#242932);flex-shrink:0;user-select:none}
.editor-menubar .em-item{display:inline-flex;align-items:center;height:24px;padding:0 9px;border-radius:var(--radius-xs,6px);background:transparent;color:var(--text,#f0f2f6);font-size:13px;line-height:24px;white-space:nowrap}
.editor-menubar .em-item:hover{background:var(--hover,#ffffff0f)}
.editor-menubar .em-item[aria-expanded=true]{background:var(--active,#ffffff1a)}
.editor-menubar .em-item:focus-visible{outline:2px solid var(--focus-ring,#5d96ff);outline-offset:-2px}
.editor-menubar.show-accelerators .em-acc{text-decoration:underline;text-underline-offset:2px}
.editor-menubar .em-all{display:none;gap:6px}
.editor-menubar .em-all .icon{width:16px;height:16px}

/* icon toolbar */
/* height grows with a classic horizontal scrollbar instead of clipping the buttons */
.has-text-editor .editor-iconbar{display:flex;align-items:center;gap:2px;height:auto;min-height:38px;padding:2px 6px;background:var(--surface,#181b20);border-bottom:1px solid var(--line,#2b3039);overflow-x:auto;overflow-y:hidden;flex-shrink:0;scrollbar-width:thin;scrollbar-color:var(--line,#2b3039) transparent}
.editor-iconbar .tb-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;padding:0;border-radius:var(--radius-xs,6px);background:transparent;color:var(--muted,#949eae);transition:background-color .12s,color .12s}
.editor-iconbar .tb-btn .icon{width:18px;height:18px}
.editor-iconbar .tb-btn:hover:not(:disabled){background:var(--hover,#ffffff0f);color:var(--text,#f0f2f6)}
.editor-iconbar .tb-btn:active:not(:disabled){background:var(--active,#ffffff1a)}
.editor-iconbar .tb-btn[aria-pressed=true]{background:var(--accent-soft,#1c2d4c);color:var(--accent,#5d96ff)}
.editor-iconbar .tb-btn:disabled,.editor-iconbar .seg-btn:disabled{opacity:.35;cursor:default}
.editor-iconbar .tb-glyph span{font:700 11.5px/1 var(--font-mono,Consolas,monospace);letter-spacing:.02em}
.editor-iconbar .tb-sep{flex:none;width:1px;height:20px;margin:0 5px;background:var(--line,#2b3039)}
.editor-iconbar .tb-columns{display:flex;align-items:center;gap:6px;flex:none;margin-left:2px}
.editor-iconbar .tb-label{font-size:12px;color:var(--muted,#949eae)}
.editor-iconbar .tb-segment{display:flex;align-items:center;gap:1px;height:28px;padding:2px;border-radius:var(--radius-xs,6px);background:var(--surface2,#1e2229);border:1px solid var(--line,#2b3039)}
.editor-iconbar .seg-btn{min-width:26px;height:22px;padding:0 7px;border-radius:4px;background:transparent;color:var(--muted,#949eae);font:700 12px/22px var(--font-mono,Consolas,monospace)}
.editor-iconbar .seg-btn.seg-text{font:500 12px/22px var(--font-ui,"Segoe UI",sans-serif)}
.editor-iconbar .seg-btn:hover{background:var(--hover,#ffffff0f);color:var(--text,#f0f2f6)}
.editor-iconbar .seg-btn[aria-pressed=true]{background:var(--accent-strong,#397cf6);color:var(--accent-text,#fff)}
.editor-iconbar .tb-columns .tb-btn{width:24px}
.editor-iconbar .tb-columns .tb-btn .icon{width:16px;height:16px}
.editor-iconbar .tb-flex{flex:1 0 8px}
.editor-iconbar button:focus-visible{outline:2px solid var(--focus-ring,#5d96ff);outline-offset:-2px}

/* text area + gutter */
.has-text-editor .numbered-editor{position:relative;display:flex;flex:1;min-height:0;overflow:hidden;background:var(--editor-bg,#111419)}
.has-text-editor .line-gutter{flex:none;width:calc(var(--gutter-digits,2) * 1ch + 30px);overflow:hidden;background:var(--editor-gutter,#14171d);border-right:1px solid var(--line-soft,#242932);user-select:none;font-family:var(--font-mono,Consolas,monospace);font-size:calc(var(--editor-font-size) * .86)}
.has-text-editor .numbered-editor.no-gutter .line-gutter{display:none}
.has-text-editor .line-track{position:relative}
.has-text-editor .line-track button{position:absolute;left:0;right:0;width:100%;padding:0 12px 0 14px;border-radius:0;background:transparent;color:var(--editor-gutter-text,#5d6675);text-align:right;font:inherit;line-height:var(--editor-line-height);font-variant-numeric:tabular-nums;cursor:pointer}
.has-text-editor .line-track button:hover{color:var(--text,#f0f2f6);background:var(--hover,#ffffff0a)}
.has-text-editor .line-track button.current-line{color:var(--editor-text,#d7dde8);background:transparent}
.has-text-editor .line-track button.bookmarked::before{content:"";position:absolute;left:4px;top:50%;width:4px;height:min(14px,calc(var(--editor-line-height) - 6px));transform:translateY(-50%);border-radius:2px;background:var(--bookmark,#f2b84b)}
.has-text-editor .line-track button:focus-visible{outline:2px solid var(--focus-ring,#5d96ff);outline-offset:-2px}
.has-text-editor .editor-surface{background:var(--editor-bg,#111419)}
.viewer-body.has-text-editor textarea.code-text{flex:1;display:block;width:0;min-width:0;height:100%;margin:0;padding:12px;border:0;border-radius:0;outline:0;resize:none;box-shadow:none;background:transparent;color:var(--editor-text,#d7dde8);caret-color:var(--editor-text,#d7dde8);font-family:var(--font-mono,"Cascadia Mono",Consolas,monospace);font-size:var(--editor-font-size);line-height:var(--editor-line-height);font-weight:400;font-variant-ligatures:none;letter-spacing:0;tab-size:var(--editor-tab-size);white-space:pre;overflow:auto;overflow-wrap:normal;scrollbar-color:var(--line,#2b3039) transparent}
.viewer-body.has-text-editor textarea.code-text.wrapped{white-space:pre-wrap;overflow-wrap:break-word;word-break:normal}
.viewer-body.has-text-editor textarea.code-text::selection{background:var(--editor-selection,#2f4f86)}
.viewer-body.has-text-editor textarea.code-text:focus-visible{outline:0}
.has-text-editor .line-measure{position:absolute;left:0;top:0;visibility:hidden;pointer-events:none;padding:0 12px;font-family:var(--font-mono,"Cascadia Mono",Consolas,monospace);font-size:var(--editor-font-size);line-height:var(--editor-line-height);font-variant-ligatures:none;tab-size:var(--editor-tab-size);white-space:pre-wrap;overflow-wrap:break-word;word-break:normal;z-index:-1}
.has-text-editor .line-measure>div{min-height:var(--editor-line-height)}
.editor-line-layer{position:absolute;inset:0;pointer-events:none}
.editor-line-layer>div{position:absolute;left:0}
.editor-line-layer .editor-current-line{background:var(--editor-line,#ffffff0a)}
.editor-line-layer .editor-bookmark-band{background:color-mix(in srgb,var(--bookmark,#f2b84b) 9%,transparent);box-shadow:inset 3px 0 0 var(--bookmark,#f2b84b)}

/* status bar */
.has-text-editor .editor-statusbar{order:10;display:flex;align-items:center;gap:1px;height:28px;padding:0 6px 0 10px;background:var(--surface,#181b20);border-top:1px solid var(--line,#2b3039);color:var(--muted,#949eae);font-size:12px;line-height:1;white-space:nowrap;overflow:hidden;flex-shrink:0;user-select:none}
.editor-statusbar .sb-state{padding-right:8px}
.editor-statusbar .sb-mode{padding:2px 7px;border-radius:4px;background:var(--accent-soft,#1c2d4c);color:var(--accent,#5d96ff);font-weight:500;flex:none}
.editor-statusbar .sb-message{min-width:0;margin-left:8px;overflow:hidden;text-overflow:ellipsis;color:var(--text,#f0f2f6)}
.editor-statusbar .sb-message.error{color:var(--red,#f18e94)}
.editor-statusbar .sb-flex{flex:1 1 8px;min-width:8px}
.editor-statusbar .sb-item{display:inline-flex;align-items:center;flex:none;height:22px;padding:0 7px;border-radius:4px;background:transparent;color:inherit;font:inherit;font-variant-numeric:tabular-nums}
.editor-statusbar .sb-code{letter-spacing:.01em}
.editor-statusbar .sb-sel{color:var(--accent,#5d96ff)}
.editor-statusbar button.sb-item:hover{background:var(--hover,#ffffff0f);color:var(--text,#f0f2f6)}
.editor-statusbar button.sb-item:focus-visible{outline:2px solid var(--focus-ring,#5d96ff);outline-offset:-2px}

/* ---------- menus (menu bar dropdowns, context menus, status bar menus) ---------- */
.editor-context-menu{position:fixed;z-index:400;width:max-content;min-width:200px;max-width:calc(100vw - 16px);max-height:calc(100svh - 16px);overflow:auto;padding:4px;background:var(--popover,var(--surface2,#1e2229));border:1px solid var(--line,#2b3039);border-radius:10px;box-shadow:var(--shadow-lg,0 18px 48px #0009);color:var(--text,#f0f2f6);font-family:var(--font-ui,"Segoe UI",system-ui,sans-serif);overscroll-behavior:contain}
.editor-context-menu.editor-dropdown{min-width:248px}
.editor-context-menu:focus{outline:0}
.editor-context-menu button{display:flex;align-items:center;gap:8px;width:100%;min-height:30px;padding:0 10px 0 6px;border-radius:var(--radius-xs,6px);background:transparent;color:var(--text,#f0f2f6);font-size:13px;line-height:1.2;text-align:left;white-space:nowrap}
.editor-context-menu button:hover:not(:disabled){background:var(--hover,#ffffff0f)}
.editor-context-menu button:focus{background:var(--active,#ffffff14);outline:0}
.editor-context-menu button:focus-visible{box-shadow:inset 0 0 0 1px var(--focus-ring,#5d96ff)}
.editor-context-menu button.danger:hover:not(:disabled),.editor-context-menu button.danger:focus{background:var(--danger-soft,#f18e9424)}
.editor-context-menu button:disabled{opacity:.4;cursor:default}
.editor-context-menu button.danger{color:var(--red,#f18e94)}
.editor-menu-check{display:inline-flex;align-items:center;justify-content:center;flex:none;width:16px;height:16px;color:var(--accent,#5d96ff)}
.editor-menu-check .icon{width:14px;height:14px;stroke-width:2.4}
.editor-context-menu [role=menuitemradio] .editor-menu-check .icon{width:14px;height:14px;fill:currentColor;stroke-width:1}
.editor-menu-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
.editor-menu-key{margin-left:28px;color:var(--muted,#949eae);font-size:12px;font-variant-numeric:tabular-nums}
.editor-menu-more{margin-left:16px;color:var(--muted,#949eae);font-size:15px}
.editor-menu-heading{padding:8px 10px 3px 30px;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--text-soft,#737d8e);user-select:none}
.editor-context-menu .editor-menu-divider{height:1px;margin:4px -4px;border:0;background:var(--line,#2b3039)}
@media (prefers-reduced-motion:no-preference){.editor-context-menu:not([hidden]){animation:editor-pop .12s ease-out}}
@keyframes editor-pop{from{opacity:0;transform:translateY(-3px)}}

/* ---------- inline prompt (Go to line, prefix/suffix) ---------- */
.editor-prompt{position:absolute;left:50%;top:10px;z-index:45;width:min(460px,calc(100% - 24px));padding:12px 14px;transform:translateX(-50%);background:var(--surface2,#1e2229);border:1px solid var(--line,#2b3039);border-radius:var(--radius-sm,8px);box-shadow:var(--shadow-lg,0 18px 48px #0009);color:var(--text,#f0f2f6)}
.editor-prompt-title{margin-bottom:8px;font-size:13px;font-weight:600}
.editor-prompt-row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px}
.editor-prompt-field{display:flex;flex:1 1 150px;flex-direction:column;gap:4px;min-width:0;font-size:12px;color:var(--muted,#949eae)}
.editor-prompt-field input,.editor-prompt-field select{width:100%;height:32px;padding:0 10px;border:1px solid var(--line,#2b3039);border-radius:var(--radius-xs,6px);background:var(--bg,#101216);color:var(--text,#f0f2f6);font-family:var(--font-mono,Consolas,monospace);font-size:13px}
.editor-prompt-field select{padding:0 6px;font-family:var(--font-ui,inherit)}
.editor-prompt-field input:focus,.editor-prompt-field select:focus{border-color:var(--accent,#5d96ff);outline:2px solid var(--focus-ring,#5d96ff);outline-offset:-1px}
.editor-prompt-field.editor-prompt-check{flex:1 0 100%;flex-direction:row;align-items:center;gap:8px;color:var(--text,#f0f2f6)}
.editor-prompt-field.editor-prompt-check input{width:16px;height:16px;padding:0;accent-color:var(--accent,#5d96ff)}
.editor-prompt-field.editor-prompt-check.editor-prompt-inline{flex:0 1 auto;margin-right:10px}
.editor-prompt.editor-prompt-wide{width:min(560px,calc(100% - 24px))}
.editor-prompt-wide .editor-prompt-actions{flex:1 0 100%;justify-content:flex-end}
/* 120px: four text fields per row in the 560px prompt, two per row on a phone */
.editor-prompt-wide .editor-prompt-field:not(.editor-prompt-check){flex:1 1 120px}
.editor-prompt-actions{display:flex;gap:6px;margin-left:auto}
.editor-prompt-actions button{height:32px;padding:0 14px;border-radius:var(--radius-xs,6px);font-size:13px;font-weight:500}
.editor-prompt-submit{background:var(--accent-strong,#397cf6);color:var(--accent-text,#fff)}
.editor-prompt-submit:hover{filter:brightness(1.08)}
.editor-prompt-cancel{background:var(--surface3,#252a32);color:var(--text,#f0f2f6)}
.editor-prompt-cancel:hover{background:var(--active,#ffffff1a)}
.editor-prompt-message{margin-top:8px;font-size:12px;color:var(--muted,#949eae)}
.editor-prompt-message:empty{display:none}
.editor-prompt-message.error{color:var(--red,#f18e94)}

/* ---------- statistics + confirm dialogs ---------- */
.editor-stats,.editor-confirm{max-width:calc(100vw - 32px);border:1px solid var(--line,#2b3039);border-radius:14px;background:var(--surface,#181b20);color:var(--text,#f0f2f6);box-shadow:var(--shadow-lg,0 18px 48px #0009)}
.editor-stats::backdrop,.editor-confirm::backdrop{background:color-mix(in srgb,var(--bg,#101216) 55%,transparent)}
.editor-stats{width:460px;padding:0}
.editor-stats-head{display:flex;align-items:center;justify-content:space-between;padding:12px 10px 8px 20px}
.editor-stats-head h3{margin:0;font-size:16px;font-weight:600}
.editor-stats table{width:100%;border-collapse:collapse;font-size:13px}
.editor-stats th,.editor-stats td{padding:8px 20px;text-align:right;border-top:1px solid var(--line-soft,#242932);font-variant-numeric:tabular-nums;white-space:nowrap}
.editor-stats thead th{border-top:0;padding-top:4px;font-size:12px;font-weight:600;color:var(--muted,#949eae)}
.editor-stats tbody th{text-align:left;font-weight:400;color:var(--muted,#949eae);white-space:normal}
.editor-stats .stats-note{color:var(--muted,#949eae);font-size:12px}
.editor-stats-actions{display:flex;justify-content:flex-end;padding:12px 16px 16px;border-top:1px solid var(--line-soft,#242932)}
.editor-stats-actions .button{min-height:32px;height:32px;padding:0 16px;font-size:13px}
.editor-stats .visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.editor-confirm{width:380px;padding:22px}
.editor-confirm h3{margin:0 0 10px;font-size:17px;font-weight:600}
.editor-confirm p{margin:0;font-size:13px;line-height:1.6;color:var(--muted,#949eae)}
.editor-confirm>div{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
.editor-confirm button{height:34px;padding:0 14px;border-radius:var(--radius-sm,8px);background:var(--surface3,#252a32);color:var(--text,#f0f2f6);font-size:13px;font-weight:500}
.editor-confirm [data-confirm=delete]{background:var(--danger-soft,#3a2026);color:var(--red,#f18e94)}

/* ---------- column grid (columns.js) ---------- */
.has-text-editor .column-panel{display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden;background:var(--editor-bg,#111419)}
.has-text-editor .column-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
.has-text-editor .column-sheet{position:relative;min-width:100%;min-height:100%}
.has-text-editor .column-guides{position:absolute;inset:0;display:flex;pointer-events:none}
.has-text-editor .column-guides>span{flex:none;border-right:1px solid var(--line-soft,#242932)}
.has-text-editor .column-guides>span:first-child{background:var(--editor-gutter,#14171d)}
.has-text-editor .column-table{position:relative;border-collapse:separate;border-spacing:0;table-layout:fixed;font-family:var(--font-mono,Consolas,monospace);font-size:var(--editor-font-size);line-height:var(--editor-line-height)}
.has-text-editor .column-table th,.has-text-editor .column-table td{padding:0;min-width:0;border-right:1px solid var(--line-soft,#242932);border-bottom:1px solid var(--line-soft,#242932)}
.has-text-editor .column-table thead th{position:sticky;top:0;z-index:3;height:28px;background:var(--surface2,#1e2229);color:var(--muted,#949eae);font-weight:500;text-align:center;border-bottom:1px solid var(--line,#2b3039)}
.has-text-editor .column-table thead th:first-child{left:0;z-index:4}
.has-text-editor .column-table tbody th{position:sticky;left:0;z-index:2;background:var(--editor-gutter,#14171d)}
.has-text-editor .column-table tbody th button{display:block;width:100%;height:calc(var(--editor-line-height) + 2px);padding:0 8px;background:transparent;color:var(--editor-gutter-text,#5d6675);text-align:right;font:calc(var(--editor-font-size) * .86)/calc(var(--editor-line-height) + 2px) var(--font-mono,Consolas,monospace);font-variant-numeric:tabular-nums}
.has-text-editor .column-table td{position:relative;background:transparent}
.has-text-editor .column-table input.column-cell{display:block;width:100%;min-width:0;height:calc(var(--editor-line-height) + 2px);min-height:0;padding:0 6px;border:0;border-radius:0;background:transparent;color:var(--editor-text,#d7dde8);font:var(--editor-font-size)/calc(var(--editor-line-height) + 2px) var(--font-mono,Consolas,monospace);box-shadow:none;outline:none}
.has-text-editor .column-heading{display:block;width:100%;height:100%;padding:0;background:transparent;color:inherit;font:inherit;text-align:center}
.has-text-editor .column-table .column-current-row td{background:var(--editor-line,#ffffff0a)}
.has-text-editor .column-table .column-current-row th,.has-text-editor .column-table .column-current-header{background:var(--surface3,#252a32);color:var(--text,#f0f2f6)}
.has-text-editor .column-table .column-current-row th button{color:var(--text,#f0f2f6)}
.has-text-editor .column-table .column-row-selected td,.has-text-editor .column-table .column-row-selected th,.has-text-editor .column-table td.column-selected-cell,.has-text-editor .column-table .column-selected-header{background:var(--editor-selection,#2f4f86)}
.has-text-editor .column-table td.column-active-cell{background:var(--accent-soft,#1c2d4c);box-shadow:inset 0 0 0 2px var(--accent,#5d96ff)}
.has-text-editor .column-table td.column-active-cell input{color:var(--text,#f0f2f6);caret-color:var(--text,#f0f2f6)}
.has-text-editor .column-table td.column-active-cell::after{content:"";position:absolute;right:-2px;bottom:-2px;z-index:1;width:5px;height:5px;background:var(--accent,#5d96ff);pointer-events:none}
.has-text-editor .column-resize{position:absolute;inset:0 -4px 0 auto;z-index:1;width:9px;cursor:col-resize;touch-action:none}
.has-text-editor .column-resize:hover,.has-text-editor .column-resize:focus-visible{background:color-mix(in srgb,var(--accent,#5d96ff) 45%,transparent);outline:1px solid var(--accent,#5d96ff);outline-offset:-1px}
.has-text-editor .column-pagebar{display:flex;align-items:center;gap:6px;height:32px;padding:0 10px;border-top:1px solid var(--line,#2b3039);background:var(--surface,#181b20);color:var(--muted,#949eae);font-size:12px;flex-shrink:0}
.has-text-editor .column-pagebar>span{margin-right:auto}
.has-text-editor .column-pagebar>span.column-selection-status{margin-right:6px;color:var(--accent,#5d96ff)}
.has-text-editor .column-pagebar button{height:24px;padding:0 9px;border:1px solid var(--line,#2b3039);border-radius:var(--radius-xs,6px);background:var(--surface2,#1e2229);color:var(--text,#f0f2f6);font-size:12px}
.has-text-editor .column-pagebar button:hover:not(:disabled){background:var(--surface3,#252a32)}
.has-text-editor .column-pagebar button:disabled{cursor:default;opacity:.45}

/* ---------- phones and narrow windows ---------- */
@media (max-width:1100px){
  .editor-iconbar .tb-label{display:none}
  .editor-statusbar .sb-enc{display:none}
}
@media (max-width:800px){
  #viewer.viewer-editor,#viewer.viewer-editor.viewer-maximized{width:100%;height:100%;max-width:none;max-height:none;border:0;border-radius:0}
  .editor-header{min-height:48px;padding:6px 6px 6px 12px;gap:8px}
  .editor-header .file-type-icon{display:none}
  .editor-header .viewer-actions{gap:2px}
  .editor-header .viewer-actions .button{width:36px;padding:0;justify-content:center}
  .editor-header .viewer-actions .button span:last-child{display:none}
  .editor-header .viewer-actions .icon-button{width:34px;height:36px}
  .editor-menubar .em-item[data-menu]{display:none}
  .editor-menubar .em-item.em-all{display:inline-flex}
  .has-text-editor .editor-menubar{height:34px}
  .editor-menubar .em-all{height:28px}
  .has-text-editor .editor-iconbar{min-height:42px}
  .editor-iconbar .tb-btn{width:36px;height:36px}
  .editor-iconbar [data-cmd=maximize],.editor-iconbar .tb-flex{display:none}
  .editor-statusbar .sb-sel,.editor-statusbar .sb-chars,.editor-statusbar .sb-code,.editor-statusbar .sb-indent,.editor-statusbar .sb-eol,.editor-statusbar .sb-enc,.editor-statusbar .sb-zoom{display:none}
  /* no room in the status bar: command results and errors float above it (tap to dismiss) */
  .editor-statusbar .sb-message{position:absolute;left:8px;right:8px;bottom:36px;z-index:30;margin:0;padding:10px 12px;border:1px solid var(--line,#2b3039);border-radius:var(--radius-sm,8px);background:var(--surface3,#252a32);box-shadow:var(--shadow-lg,0 18px 48px #0009);color:var(--text,#f0f2f6);font-size:13px;line-height:1.4;white-space:normal;overflow-wrap:anywhere;cursor:pointer}
  .editor-statusbar .sb-message:empty{display:none}
  .editor-statusbar .sb-message.error{border-color:var(--red,#f18e94);box-shadow:inset 4px 0 0 var(--red,#f18e94),var(--shadow-lg,0 18px 48px #0009);color:var(--text,#f0f2f6)}
  .editor-context-menu button{min-height:38px;font-size:14px}
  .editor-prompt-field input,.editor-prompt-field select{font-size:16px}
  .has-text-editor .column-table input.column-cell{height:36px;line-height:36px}
  .has-text-editor .column-table tbody th button{height:36px;line-height:36px}
  .has-text-editor .column-pagebar{flex-wrap:wrap;height:auto;padding:5px 8px}
}
@media (max-width:530px){
  .editor-save-chip{width:22px;padding:0;justify-content:center;font-size:0}
  .editor-header .editor-meta{font-size:11px}
}
/* grid copy: flash on a copied cell, off-screen buffer for the clipboard fallback */
.has-text-editor .column-table input.column-cell.column-cell-copied{background:var(--success-soft,#1d3a2f);box-shadow:inset 0 0 0 2px var(--green,#79c5a6);transition:background .3s,box-shadow .3s}
.column-copy-buffer{position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0}
@media (hover:none){.has-text-editor .column-table input.column-cell{-webkit-touch-callout:none}}
/* grid select mode: cell cursor, no caret; edit mode: text cursor and caret */
.has-text-editor .column-table td input.column-cell:read-only{cursor:cell;caret-color:transparent}
.has-text-editor .column-table td input.column-cell.column-cell-editing{cursor:text;caret-color:var(--text,#f0f2f6)}
.has-text-editor .column-table td.column-editing{background:var(--editor-bg,#10151d);box-shadow:inset 0 0 0 2px var(--accent,#5d96ff)}
.has-text-editor .column-table td.column-editing::after{display:none}
/* phones, grid view: keep editor messages above the grid bar so Copy and Actions stay tappable */
@media (max-width:800px){.viewer-body.has-text-editor:has(.column-panel:not([hidden])) .editor-statusbar .sb-message{bottom:calc(36px + var(--grid-bar-height,44px))}}

/* ---------- split columns (a column shown as sub-columns 2.1, 2.2, ...) ---------- */
/* a dashed divider between the parts of one column, lighter than the solid group edges (same colour, half the ink).
   It is drawn once: by the full-height guide behind the rows (the cells leave theirs transparent, so two dash patterns
   never merge into a solid line on 1x screens) and by the header cell, which covers the guide. */
.has-text-editor .column-table td.column-sub-inner{border-right-color:transparent}
.has-text-editor .column-table th.column-sub-inner,.has-text-editor .column-guides>span.column-sub-inner{border-right-style:dashed;border-right-color:var(--line-soft,#242932)}
.has-text-editor .column-table thead th.column-sub{background-image:linear-gradient(var(--accent-soft,#1c2d4c),var(--accent-soft,#1c2d4c))}
.has-text-editor .column-split-chip{display:inline-block;min-width:16px;height:16px;margin-left:5px;padding:0 4px;border-radius:4px;background:var(--accent-soft,#1c2d4c);color:var(--accent,#5d96ff);font:700 12px/16px var(--font-mono,Consolas,monospace);text-align:center;vertical-align:1px}
.has-text-editor .column-pagebar button.column-split-on{border-color:var(--accent,#5d96ff);color:var(--accent,#5d96ff)}
.has-text-editor .column-pagebar .column-split-chip{height:15px;min-width:15px;margin-left:5px;font-size:11px;line-height:15px;vertical-align:0}
.has-text-editor .column-pagebar button[aria-expanded=true]{background:var(--surface3,#252a32)}
/* phones: the row count gets its own line. The selection count ("2 columns"; the word "selected" is hidden) and the
   buttons share the next one; buttons that do not fit wrap to a third line, so the count stays readable. */
@media (max-width:800px){
  .has-text-editor .column-pagebar>span:first-child{flex:1 0 100%}
  .has-text-editor .column-pagebar>span.column-selection-status{flex:0 1 auto;min-width:min(100%,9ch);margin-right:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .has-text-editor .column-pagebar>span.column-selection-status:empty{min-width:0}
  .has-text-editor .column-selection-word{display:none}
}
