/* ⭐ LaTeX Studio (2026-10-23) — loaded on demand with latex-studio.js */

#studentLatexView { padding: 0; }

/* ---------- projects list ---------- */
.lx-home { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.lx-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 70px 16px; color: var(--text-secondary); }
.lx-home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.lx-home-head h2 { margin: 0 0 4px; font-size: 22px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.lx-home-head h2 i { color: var(--brand-600); }
.lx-home-head p { margin: 0; color: var(--text-secondary); font-size: 14px; max-width: 620px; }
.lx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.lx-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  transition: border-color .15s, box-shadow .15s;
}
.lx-card:hover, .lx-card:focus-visible { border-color: var(--brand-300); box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.08)); outline: none; }
.lx-card-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: rgba(79,70,229,.1); color: var(--brand-600); font-size: 18px; }
.lx-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lx-card-main strong { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-card-main span { font-size: 12px; color: var(--text-secondary); }
.lx-card-main .ok { color: #059669; } .lx-card-main .bad { color: #d97706; }
.lx-card-acts { display: flex; gap: 2px; flex-shrink: 0; }
.lx-empty { text-align: center; padding: 60px 16px; color: var(--text-secondary); background: var(--bg-surface);
  border: 1px dashed var(--border-default); border-radius: var(--radius-lg, 16px); }
.lx-empty > i { font-size: 34px; color: var(--brand-600); margin-bottom: 10px; display: block; }
.lx-empty h3 { margin: 4px 0 6px; color: var(--text-primary); }
.lx-empty p { margin: 0 auto 16px; max-width: 460px; }

.lx-icon-btn { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary);
  display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.lx-icon-btn:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.lx-icon-btn.danger:hover { color: #dc2626; background: rgba(220,38,38,.08); }
.lx-icon-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }

/* ---------- dialogs ---------- */
.lx-dialog.wide { max-width: 760px; width: calc(100vw - 32px); }
.lx-dialog-body { margin: 8px 0 4px; }
.lx-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
.lx-field input, .lx-field select { padding: 10px 12px; border: 1px solid var(--border-default); border-radius: 8px;
  background: var(--bg-surface); color: var(--text-primary); font-size: 14px; }
.lx-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 52vh; overflow: auto; }
.lx-tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; text-align: left; cursor: pointer;
  background: var(--bg-surface-2); border: 1.5px solid var(--border-subtle); border-radius: 10px; color: var(--text-primary); }
.lx-tpl i { color: var(--brand-600); font-size: 18px; margin-bottom: 2px; }
.lx-tpl span { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.lx-tpl.on { border-color: var(--brand-500); background: rgba(79,70,229,.08); box-shadow: 0 0 0 1px var(--brand-500); }
.lx-tpl[hidden] { display: none; }
.lx-tpl strong { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.lx-tpl strong i { font-size: 13px; margin: 0; }
.lx-tpl strong em { font-style: normal; font-weight: 500; font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: rgba(227,160,8,.15); color: #b7791f; }
.lx-tpl-pic { width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: #fff; border: 1px solid var(--border-subtle);
  display: flex; align-items: flex-start; justify-content: center; margin-bottom: 6px; position: relative; }
.lx-tpl-pic > i { align-self: center; font-size: 30px !important; opacity: .25; }
.lx-tpl-pic.has > i { display: none; }
.lx-tpl-pic img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.lx-tpl-cats { margin: 0 0 10px; flex-wrap: wrap; }
.lx-tpls { max-height: 56vh; }
@media (max-width: 560px) {
  .lx-tpls { grid-template-columns: 1fr 1fr; gap: 6px; }
  .lx-tpl { padding: 8px; }
  .lx-tpl > span { display: none; }
  .lx-tpl strong { font-size: 12.5px; }
  .lx-tpl strong > i { display: none; }
  .lx-chips.lx-tpl-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .lx-tpl-cats .lx-chip { flex: none; }
}
.lx-log { max-height: 60vh; overflow: auto; font-size: 11.5px; line-height: 1.45; background: var(--bg-surface-2); padding: 12px;
  border-radius: 8px; white-space: pre-wrap; word-break: break-word; margin: 0; }
.lx-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.lx-keys td { padding: 7px 4px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.lx-keys kbd { font-family: inherit; font-size: 11px; padding: 2px 6px; border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-surface-2); }

/* ---------- editor shell ---------- */
.lx-ed { display: flex; flex-direction: column; min-height: 420px; background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle); overflow: hidden; }
.lx-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; min-height: 50px; }
.lx-grow { flex: 1; }
.lx-title { display: inline-flex; align-items: center; gap: 8px; max-width: 34vw; border: 0; background: none; cursor: pointer;
  font-weight: 700; font-size: 15px; color: var(--text-primary); padding: 6px 8px; border-radius: 8px; }
.lx-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-title i { font-size: 11px; color: var(--text-secondary); opacity: 0; transition: opacity .15s; }
.lx-title:hover { background: var(--bg-surface-2); } .lx-title:hover i { opacity: 1; }
.lx-save { font-size: 12px; color: var(--text-secondary); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.lx-save.dirty i { font-size: 7px; color: #d97706; } .lx-save.saved i { color: #059669; } .lx-save.error { color: #dc2626; }
.lx-compile { white-space: nowrap; }
.lx-issues-btn { border: 0; border-radius: 999px; padding: 5px 10px; font-weight: 700; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.lx-issues-btn.err { background: rgba(220,38,38,.12); color: #dc2626; }
.lx-issues-btn.warn { background: rgba(217,119,6,.12); color: #b45309; }
.lx-panes { display: none; gap: 2px; background: var(--bg-surface-2); padding: 3px; border-radius: 10px; }
.lx-panes button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.lx-panes button.on { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.lx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) minmax(0, 1fr); }
.lx-files { border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; min-height: 0; background: var(--bg-surface-2); }
.lx-files.drop { outline: 2px dashed var(--brand-500); outline-offset: -6px; }
.lx-files-bar { display: flex; align-items: center; gap: 0; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border-subtle); }
.lx-files-bar > span { flex: 1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); }
.lx-files-bar .lx-icon-btn { width: 30px; height: 30px; }
.lx-tree { flex: 1; overflow: auto; padding: 6px 4px; }
.lx-files-hint { font-size: 11.5px; color: var(--text-secondary); padding: 8px 12px; margin: 0; }
.lx-node { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px calc(8px + var(--d, 0) * 14px); border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--text-primary); position: relative; min-height: 30px; }
.lx-node:hover { background: var(--bg-surface); }
.lx-node.on { background: rgba(79,70,229,.12); color: var(--brand-700, #4338ca); font-weight: 600; }
.lx-node .lx-ico { width: 16px; text-align: center; color: var(--text-secondary); flex-shrink: 0; }
.lx-node.dir .lx-ico { color: #e3a008; }
.lx-chev { font-size: 9px; width: 10px; color: var(--text-secondary); transition: transform .15s; }
.lx-node.dir.open .lx-chev { transform: rotate(90deg); }
.lx-node.file { padding-left: calc(24px + var(--d, 0) * 14px); }
.lx-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-main { color: #e3a008; font-size: 12px; }
.lx-node-acts { display: none; gap: 0; }
.lx-node:hover .lx-node-acts, .lx-node:focus-within .lx-node-acts { display: inline-flex; }
.lx-node-acts button { border: 0; background: none; color: var(--text-secondary); width: 24px; height: 24px; border-radius: 5px; cursor: pointer; font-size: 11px; }
.lx-node-acts button:hover { background: var(--bg-surface-2); color: var(--text-primary); }

.lx-code { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border-subtle); }
.lx-code-bar { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12.5px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-cm { flex: 1; min-height: 0; position: relative; }
.lx-cm .CodeMirror { position: absolute; inset: 0; height: 100%; font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--lx-fs, 14px); line-height: 1.55; background: var(--bg-surface); color: var(--text-primary); }
.lx-cm .CodeMirror-gutters { background: var(--bg-surface-2); border-right: 1px solid var(--border-subtle); }
.lx-cm .CodeMirror-linenumber { color: var(--text-secondary); opacity: .7; }
.lx-cm .CodeMirror-cursor { border-left-color: var(--text-primary); }
.lx-cm .CodeMirror-activeline-background { background: rgba(79,70,229,.05); }
.lx-cm .CodeMirror-selected, .lx-cm .CodeMirror-focused .CodeMirror-selected { background: rgba(79,70,229,.18); }
.lx-cm .lx-err-line { background: rgba(220,38,38,.12); }
.lx-cm .cm-s-lx .cm-tag, .lx-cm .cm-tag { color: #4f46e5; }
.lx-cm .cm-keyword { color: #7c3aed; }
.lx-cm .cm-atom { color: #b45309; }
.lx-cm .cm-builtin { color: #0f766e; }
.lx-cm .cm-bracket { color: #64748b; }
.lx-cm .cm-comment { color: #94a3b8; font-style: italic; }
.lx-cm .cm-string, .lx-cm .cm-string-2 { color: #059669; }
.lx-cm .cm-number { color: #c2410c; }
.lx-cm .cm-error { color: #dc2626; background: none; }
.lx-cm .CodeMirror-matchingbracket { color: inherit !important; background: rgba(5,150,105,.2); }
.lx-preview { flex: 1; overflow: auto; padding: 20px; }
.lx-binary { text-align: center; color: var(--text-secondary); }
.lx-binary > i { font-size: 40px; margin-bottom: 10px; }
.lx-binary img { max-width: 100%; max-height: 55vh; display: block; margin: 0 auto 14px; border-radius: 8px; border: 1px solid var(--border-subtle);
  background: repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%) 50% / 16px 16px; }
.lx-binary code { font-size: 12px; background: var(--bg-surface-2); padding: 3px 6px; border-radius: 5px; word-break: break-all; }

.lx-pdf { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg-surface-2); }
.lx-pdf-bar { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); }
.lx-zoom { border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 50px; cursor: pointer; padding: 6px; border-radius: 6px; }
.lx-zoom:hover { background: var(--bg-surface-2); }
.lx-pdf-info { font-size: 12px; color: var(--text-secondary); padding-right: 4px; }
.lx-pdf-pages { flex: 1; overflow: auto; position: relative; display: flex; flex-direction: column; touch-action: pan-x pan-y; outline: none; }
/* wider than the box when zoomed: it grows (and scrolls) to the right instead of being cut on the left */
.lx-pdf-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 14px; min-width: 100%; width: max-content;
  box-sizing: border-box; transform-origin: 0 0; flex-shrink: 0; }
.lx-pdf-inner .lx-page { margin: 0 auto; }
.lx-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); flex-shrink: 0; max-width: none; }
.lx-page canvas { display: block; }
.lx-pdf-empty { margin: auto; text-align: center; color: var(--text-secondary); padding: 30px 16px; }
.lx-pdf-empty i { font-size: 34px; opacity: .5; margin-bottom: 8px; }
.lx-issues { position: absolute; left: 8px; right: 8px; bottom: 8px; max-height: 55%; display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden; }
.lx-issues[hidden] { display: none; }
.lx-issues-head { display: flex; align-items: center; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; color: var(--text-primary); }
.lx-issues-list { overflow: auto; padding: 4px; }
.lx-issue { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text-primary); }
.lx-issue:hover { background: var(--bg-surface-2); }
.lx-issue > i { margin-top: 3px; } .lx-issue.error > i { color: #dc2626; } .lx-issue.warning > i { color: #d97706; }
.lx-issue span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lx-issue b { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.lx-issue small { font-size: 11.5px; color: var(--text-secondary); overflow-wrap: anywhere; }

.lx-menu { position: fixed; z-index: 3000; min-width: 230px; padding: 6px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.lx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none;
  text-align: left; font-size: 13px; color: var(--text-primary); border-radius: 8px; cursor: pointer; }
.lx-menu button:hover { background: var(--bg-surface-2); }
.lx-menu i { width: 16px; color: var(--text-secondary); }

/* ---------- dark theme ---------- */
[data-theme="dark"] .lx-cm .cm-tag { color: #a5b4fc; }
[data-theme="dark"] .lx-cm .cm-keyword { color: #c4b5fd; }
[data-theme="dark"] .lx-cm .cm-atom { color: #fbbf24; }
[data-theme="dark"] .lx-cm .cm-builtin { color: #5eead4; }
[data-theme="dark"] .lx-cm .cm-comment { color: #7c8597; }
[data-theme="dark"] .lx-cm .cm-string, [data-theme="dark"] .lx-cm .cm-string-2 { color: #6ee7b7; }
[data-theme="dark"] .lx-cm .cm-number { color: #fdba74; }
[data-theme="dark"] .lx-node.on { color: #c7d2fe; }
[data-theme="dark"] .lx-pdf-pages { background: #1b1d22; }

/* ---------- tablets & phones: one pane at a time ---------- */
@media (max-width: 899px) {
  .lx-panes { display: inline-flex; }
  .lx-body { grid-template-columns: minmax(0, 1fr); }
  .lx-ed[data-pane="files"] .lx-code, .lx-ed[data-pane="files"] .lx-pdf,
  .lx-ed[data-pane="code"] .lx-files, .lx-ed[data-pane="code"] .lx-pdf,
  .lx-ed[data-pane="pdf"] .lx-files, .lx-ed[data-pane="pdf"] .lx-code { display: none; }
  .lx-code { border-right: 0; }
  .lx-files { border-right: 0; }
  .lx-node-acts { display: inline-flex; }
  .lx-top { flex-wrap: wrap; row-gap: 6px; }
  .lx-title { max-width: 52vw; }
  .lx-save { display: none; }
  .lx-compile span { display: none; }
  .lx-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .lx-panes button { padding: 6px 8px; }
  .lx-panes button i { display: none; }
  .lx-home-head .btn { width: 100%; }
}
.lx-issues-btn[hidden] { display: none; }

/* ⭐ 2026-10-24 — auto-compile switch, document picker, SyncTeX, uploads */
.lx-auto { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border-subtle); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 12px; font-weight: 700; padding: 5px 10px 5px 6px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.lx-auto:hover { border-color: var(--brand-300); }
.lx-auto:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.lx-switch { width: 26px; height: 15px; border-radius: 999px; background: var(--border-default); position: relative; transition: background .15s; flex-shrink: 0; }
.lx-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.lx-auto.on { color: var(--brand-600); border-color: rgba(79,70,229,.35); }
.lx-auto.on .lx-switch { background: var(--brand-600); }
.lx-auto.on .lx-switch::after { transform: translateX(11px); }
.lx-compile.busy { opacity: .85; }
.lx-target { max-width: 46%; min-width: 0; margin-left: 6px; padding: 5px 8px; font-size: 12px; border-radius: 8px;
  border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary); }
.lx-target[hidden] { display: none; }
.lx-code-bar .lx-sync { width: 28px; height: 28px; }
.lx-page { position: relative; cursor: text; }
.lx-sync-hl { position: absolute; border-radius: 4px; background: rgba(250,204,21,.38); outline: 2px solid rgba(234,179,8,.8);
  pointer-events: none; animation: lxPulse 1.8s ease-out forwards; }
@keyframes lxPulse { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.lx-cm .lx-flash-line { background: rgba(250,204,21,.28); transition: background .4s; }
.lx-tpl.up { border-style: dashed; }
.lx-tpl.up i { color: #e3a008; }
@media (max-width: 899px) {
  .lx-auto-txt { display: none; }
  .lx-auto { padding: 6px; }
  .lx-target { max-width: 52%; }
}

/* ⭐ 2026-10-24 — Phase 2: outline, share, history, read-only links */
.lx-files { overflow: hidden; }
.lx-tree { min-height: 80px; }
.lx-outline { border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; max-height: 42%; min-height: 0; }
.lx-outline-head { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 12px; cursor: pointer;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); text-align: left; }
.lx-outline-head i { font-size: 10px; transition: transform .15s; }
.lx-outline.closed .lx-outline-head i { transform: rotate(-90deg); }
.lx-outline.closed .lx-outline-list { display: none; }
.lx-outline-list { overflow: auto; padding: 0 4px 8px; }
.lx-ol-item { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; border-radius: 6px;
  padding: 4px 8px 4px calc(8px + var(--l, 0) * 12px); font-size: 12.5px; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-ol-item:hover { background: var(--bg-surface); }
.lx-ol-item.on { background: rgba(79,70,229,.12); color: var(--brand-700, #4338ca); font-weight: 600; }
[data-theme="dark"] .lx-ol-item.on { color: #c7d2fe; }
.lx-files-bar.ro .lx-icon-btn { display: none; }
.lx-title.ro { cursor: default; }
.lx-title.ro:hover { background: none; }
.lx-ro-badge { font-size: 12px; font-weight: 600; color: #0f766e; background: rgba(13,148,136,.1); padding: 4px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.lx-menu hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 4px 6px; }
.lx-menu .lx-on { margin-left: auto; font-size: 10px; font-weight: 700; color: #059669; background: rgba(5,150,105,.12); padding: 1px 6px; border-radius: 999px; }
.lx-share-txt { font-size: 14px; color: var(--text-secondary); line-height: 1.55; margin: 0 0 12px; }
.lx-share-row { display: flex; gap: 8px; margin-bottom: 12px; }
.lx-share-row input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--bg-surface-2); color: var(--text-primary); font-size: 12.5px; }
.lx-share-off { color: #dc2626; border-color: rgba(220,38,38,.35); }
.lx-hist .lx-hist-save { display: flex; gap: 8px; margin: 6px 0 4px; }
.lx-hist .lx-hist-save input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--border-default); border-radius: 8px; background: var(--bg-surface); color: var(--text-primary); }
.lx-hist-body { max-height: 56vh; overflow: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.lx-ver { border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-surface-2); }
.lx-ver-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.lx-ver-head > i { color: var(--brand-600); width: 16px; text-align: center; }
.lx-ver-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lx-ver-name b { font-size: 13.5px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-ver-name small { font-size: 11.5px; color: var(--text-secondary); }
.lx-ver-detail { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.lx-vf { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 12.5px; border: 0; background: var(--bg-surface); color: var(--text-primary);
  padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.lx-vf small { color: var(--text-secondary); margin-left: auto; }
.lx-vf.changed i { color: #d97706; } .lx-vf.deleted i { color: #dc2626; } .lx-vf.added { cursor: default; } .lx-vf.added i { color: #059669; }
.lx-vdiff { margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; max-height: 40vh; overflow: auto;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 8px; }
.lx-vdiff:empty { display: none; }
.lx-vdiff-head { position: sticky; top: 0; padding: 6px 10px; background: var(--bg-surface-2); border-bottom: 1px solid var(--border-subtle); font-family: inherit; display: flex; gap: 10px; }
.lx-vdiff-head .del { color: #dc2626; } .lx-vdiff-head .add { color: #059669; }
.lx-d { white-space: pre-wrap; word-break: break-word; padding: 1px 10px 1px 26px; position: relative; }
.lx-d span { position: absolute; left: 10px; opacity: .7; }
.lx-d.add { background: rgba(5,150,105,.12); } .lx-d.del { background: rgba(220,38,38,.12); text-decoration: line-through; text-decoration-color: rgba(220,38,38,.4); }
.lx-d.gap { color: var(--text-secondary); text-align: center; padding: 2px; }
@media (max-width: 899px) {
  .lx-ro-badge { max-width: 60vw; }
  .lx-ver-head { flex-wrap: wrap; }
  .lx-ver-name { flex-basis: calc(100% - 30px); }
}

/* ⭐ 2026-10-24 — the projects page: templates strip, search, filters, cards with the first page, list view */
.lx-home2 { max-width: 1240px; }
.lx-head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lx-usage { display: flex; flex-direction: column; gap: 5px; min-width: 140px; font-size: 12px; color: var(--text-secondary); }
.lx-usage-bar { height: 6px; border-radius: 999px; background: var(--bg-surface-2); border: 1px solid var(--border-subtle); overflow: hidden; }
.lx-usage-bar i { display: block; height: 100%; background: var(--brand-500); border-radius: 999px; }
.lx-usage-bar i.full { background: #dc2626; }
.lx-split { display: inline-flex; }
.lx-split .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.lx-split-more { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; padding-left: 10px !important; padding-right: 10px !important;
  border-left: 1px solid rgba(255,255,255,.25) !important; }

.lx-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 12px; margin: 4px 0 14px; scrollbar-width: thin; }
.lx-strip-card { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 118px; padding: 12px 8px 10px;
  border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface); color: var(--text-primary);
  font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: center; transition: transform .15s, border-color .15s, box-shadow .15s; }
.lx-strip-card:hover, .lx-strip-card:focus-visible { transform: translateY(-2px); border-color: var(--brand-300); box-shadow: 0 6px 16px rgba(0,0,0,.08); outline: none; }
.lx-strip-ico { width: 54px; height: 66px; border-radius: 6px; display: grid; place-items: center; font-size: 20px; color: var(--brand-600);
  background: linear-gradient(180deg, #fff, #f3f4ff); border: 1px solid var(--border-subtle); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.lx-strip-card.up .lx-strip-ico { color: #e3a008; border-style: dashed; background: var(--bg-surface-2); }
[data-theme="dark"] .lx-strip-ico { background: linear-gradient(180deg, #2a2b36, #23242e); }

.lx-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.lx-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; min-width: 240px; flex: 0 1 320px;
  border: 1px solid var(--border-default); border-radius: 10px; background: var(--bg-surface); color: var(--text-secondary); }
.lx-search:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.lx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text-primary); font-size: 14px; height: 100%; }
.lx-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lx-chip { border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.lx-chip span { font-weight: 700; opacity: .7; margin-left: 2px; }
.lx-chip.on { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.lx-chip.on span { opacity: .9; }
.lx-sort { height: 38px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: 10px; background: var(--bg-surface); color: var(--text-primary); font-size: 13px; }
.lx-views { display: inline-flex; border: 1px solid var(--border-default); border-radius: 10px; overflow: hidden; }
.lx-views button { width: 38px; height: 36px; border: 0; background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; }
.lx-views button.on { background: var(--bg-surface-2); color: var(--brand-600); }
.lx-bulk { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px;
  background: rgba(79,70,229,.08); border: 1px solid rgba(79,70,229,.25); font-size: 13px; font-weight: 600; color: var(--text-primary); }
.lx-bulk[hidden] { display: none; }
.lx-bulk span { flex: 1; }

.lx-results.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lx-pcard { display: flex; flex-direction: column; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-surface);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.lx-pcard:hover, .lx-pcard:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.10); border-color: var(--brand-300); outline: none; }
.lx-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg-surface-2); border-bottom: 1px solid var(--border-subtle); overflow: hidden; }
.lx-thumb img { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: 78%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); border-radius: 2px; }
.lx-thumb-wait { position: absolute; left: 11%; right: 11%; top: 10px; bottom: -10px; background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 50%, #eef0f4 75%);
  background-size: 200% 100%; animation: lxShimmer 1.2s infinite linear; border-radius: 2px; }
.lx-thumb-wait.fail { animation: none; }
[data-theme="dark"] .lx-thumb-wait { background: linear-gradient(90deg, #2a2b35 25%, #32333e 50%, #2a2b35 75%); background-size: 200% 100%; }
@keyframes lxShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.lx-thumb-none { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.lx-thumb-none i { font-size: 26px; opacity: .45; }
.lx-star { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.92); color: #9ca3af; box-shadow: 0 1px 4px rgba(0,0,0,.15); opacity: 0; transition: opacity .15s, transform .15s; }
.lx-pcard:hover .lx-star, .lx-pcard:focus-within .lx-star, .lx-star.on { opacity: 1; }
.lx-star.on { color: #f59e0b; }
.lx-star:hover { transform: scale(1.08); }
.lx-star.sm { position: static; width: 28px; height: 28px; opacity: 1; box-shadow: none; background: none; }
.lx-tag { position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.lx-tag.shared { background: rgba(13,148,136,.92); color: #fff; }
.lx-tag.sm { position: static; padding: 1px 6px; font-size: 10px; }
.lx-pcard-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.lx-pcard-top { display: flex; align-items: center; gap: 6px; }
.lx-pcard-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; color: var(--text-primary); }
.lx-pcard-top .lx-icon-btn { width: 30px; height: 30px; margin-right: -6px; }
.lx-pcard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.lx-pcard-meta.sub { justify-content: flex-start; gap: 12px; opacity: .85; }
.lx-pcard-meta.sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-st { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; white-space: nowrap; }
.lx-st.ok { color: #059669; } .lx-st.bad { color: #d97706; } .lx-st.none { color: var(--text-secondary); } .lx-st.none i { font-size: 7px; }

.lx-results.list { display: flex; flex-direction: column; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: var(--bg-surface); }
.lx-prow { display: grid; grid-template-columns: 34px 32px minmax(0, 1fr) 130px 80px 110px 40px; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle); cursor: pointer; font-size: 13px; }
.lx-prow:last-child { border-bottom: 0; }
.lx-prow:hover, .lx-prow:focus-visible { background: var(--bg-surface-2); outline: none; }
.lx-prow.sel { background: rgba(79,70,229,.07); }
.lx-prow.head { cursor: default; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-secondary); background: var(--bg-surface-2); }
.lx-prow-name { display: flex; flex-direction: column; min-width: 0; }
.lx-prow-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.lx-prow-name small { font-size: 11.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-muted { color: var(--text-secondary); font-size: 12.5px; }
.lx-check { display: grid; place-items: center; width: 30px; height: 30px; cursor: pointer; }
.lx-check input { width: 16px; height: 16px; accent-color: var(--brand-600); cursor: pointer; }
.lx-none { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--text-secondary); }
.lx-none i { font-size: 26px; opacity: .5; margin-bottom: 8px; }
.lx-menu button.danger { color: #dc2626; }
.lx-menu button.danger i { color: #dc2626; }

@media (max-width: 760px) {
  .lx-head-right { width: 100%; justify-content: space-between; }
  .lx-search { flex: 1 1 100%; min-width: 0; }
  .lx-bar .lx-grow { display: none; }
  .lx-results.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lx-pcard-meta.sub { display: none; }
  .lx-star { opacity: 1; }
  .lx-prow { grid-template-columns: 30px 28px minmax(0, 1fr) 70px 34px; }
  .lx-hide-sm { display: none; }
  .lx-prow.head span:nth-child(4), .lx-prow.head span:nth-child(5) { display: none; }
}
@media (max-width: 380px) { .lx-results.grid { grid-template-columns: minmax(0, 1fr); } }

/* ⭐ 2026-10-24 — editor: tabs, toolbar, symbols, snippets, gutter, folding, layout, status */
.lx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lx-code-bar { padding: 0 6px 0 0; gap: 4px; min-height: 38px; background: var(--bg-surface-2); }
.lx-tabs { display: flex; align-items: stretch; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; align-self: stretch; }
.lx-tabs::-webkit-scrollbar { height: 3px; } .lx-tabs::-webkit-scrollbar-thumb { background: var(--border-default); }
.lx-tab { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer;
  border-right: 1px solid var(--border-subtle); white-space: nowrap; flex-shrink: 0; position: relative; user-select: none; max-width: 230px; }
.lx-tab > span { overflow: hidden; text-overflow: ellipsis; }
.lx-tab small { opacity: .65; font-size: 10.5px; }
.lx-tab i { font-size: 11px; }
.lx-tab:hover { background: var(--bg-surface); color: var(--text-primary); }
.lx-tab.on { background: var(--bg-surface); color: var(--text-primary); font-weight: 600; }
.lx-tab.on::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--brand-500); }
.lx-tab:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.lx-tab-x { border: 0; background: none; color: inherit; width: 20px; height: 20px; border-radius: 5px; cursor: pointer; font-size: 11px; opacity: 0; display: grid; place-items: center; }
.lx-tab:hover .lx-tab-x, .lx-tab.on .lx-tab-x { opacity: .7; }
.lx-tab-x:hover { opacity: 1 !important; background: var(--bg-surface-2); }
.lx-tab.dirty .lx-tab-x { opacity: 1; }
.lx-tab.dirty .lx-tab-x i::before { content: "\f111"; font-size: 7px; color: #d97706; }
.lx-tab.dirty .lx-tab-x:hover i::before { content: "\f00d"; font-size: 11px; color: inherit; }

.lx-tools { display: flex; align-items: center; gap: 1px; padding: 3px 6px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface);
  overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.lx-tools::-webkit-scrollbar { display: none; }
.lx-tools[hidden] { display: none; }
.lx-tools button { border: 0; background: none; color: var(--text-secondary); min-width: 30px; height: 30px; padding: 0 6px; border-radius: 6px;
  cursor: pointer; font-size: 13px; flex-shrink: 0; display: inline-grid; place-items: center; }
.lx-tools button:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.lx-tools button.on { background: rgba(79,70,229,.14); color: var(--brand-600); }
.lx-tools button:focus-visible, .lx-layout button:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -1px; }
.lx-tx { font-family: "Times New Roman", Georgia, serif; font-size: 14.5px; font-weight: 600; line-height: 1; }
.lx-tx sub { font-size: 10px; }
.lx-tsep { width: 1px; height: 18px; background: var(--border-subtle); margin: 0 4px; flex-shrink: 0; }
.lx-head { height: 28px; padding: 0 6px; font-size: 12.5px; border-radius: 6px; border: 1px solid var(--border-subtle); background: var(--bg-surface);
  color: var(--text-primary); margin-right: 4px; flex-shrink: 0; cursor: pointer; }

.lx-symbols { border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface-2); flex-shrink: 0; }
.lx-symbols[hidden] { display: none; }
.lx-sym-tabs { display: flex; align-items: center; gap: 2px; padding: 4px 6px 0; overflow-x: auto; scrollbar-width: none; }
.lx-sym-tabs [data-st] { border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 5px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.lx-sym-tabs [data-st].on { background: var(--bg-surface); color: var(--brand-600); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.lx-sym-tabs .lx-icon-btn { width: 28px; height: 28px; }
.lx-sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 3px; padding: 6px; max-height: 128px; overflow: auto; }
.lx-sym-grid button { height: 34px; border: 1px solid var(--border-subtle); background: var(--bg-surface); border-radius: 6px; cursor: pointer;
  font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-size: 16px; color: var(--text-primary); padding: 0 2px; white-space: nowrap; overflow: hidden; }
.lx-sym-grid button:hover { border-color: var(--brand-500); background: rgba(79,70,229,.08); }
.lx-sym-hint { font-size: 11px; color: var(--text-secondary); padding: 0 10px 6px; }

.lx-cm .lx-ph { background: rgba(79,70,229,.12); outline: 1px dashed rgba(79,70,229,.55); border-radius: 2px; }
.CodeMirror-hints { z-index: 3001; }
.CodeMirror-hint.lx-hint-snip { color: var(--brand-600, #4f46e5); font-weight: 600; }
.CodeMirror-hint.lx-hint-snip::before { content: "⚡ "; }
.lx-cm .lx-gut { width: 16px; }
.lx-gm { display: inline-block; width: 16px; text-align: center; font-size: 11px; cursor: help; }
.lx-gm.err { color: #dc2626; } .lx-gm.warn { color: #d97706; }
.lx-cm .CodeMirror-foldgutter { width: 14px; }
.lx-cm .CodeMirror-foldgutter-open, .lx-cm .CodeMirror-foldgutter-folded { color: var(--text-secondary); cursor: pointer; opacity: .55; }
.lx-cm .CodeMirror-foldgutter-open:hover, .lx-cm .CodeMirror-foldgutter-folded { opacity: 1; }
.lx-cm .CodeMirror-foldmarker { color: var(--brand-600); text-shadow: none; font-family: inherit; background: rgba(79,70,229,.12); border-radius: 4px; padding: 0 6px; margin: 0 4px; }

.lx-status { display: flex; align-items: center; gap: 8px; padding: 2px 10px; min-height: 24px; font-size: 11.5px; color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle); background: var(--bg-surface-2); flex-shrink: 0; }
.lx-st-words { border: 0; background: none; color: inherit; font-size: 11.5px; cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.lx-st-words:hover { background: var(--bg-surface); color: var(--text-primary); }
.lx-preview:not([hidden]) ~ .lx-status .lx-st-pos { visibility: hidden; }

.lx-tpick { padding: 10px; min-width: 0; }
.lx-tpick-grid { display: grid; gap: 3px; }
.lx-tpick-grid button { width: 18px; height: 18px; padding: 0; border: 1px solid var(--border-default); border-radius: 3px; background: var(--bg-surface); cursor: pointer; }
.lx-tpick-grid button.on { background: rgba(79,70,229,.35); border-color: var(--brand-500); }
.lx-tpick-lbl { font-size: 12px; color: var(--text-secondary); text-align: center; margin-top: 8px; }

.lx-layout { display: inline-flex; align-items: center; gap: 1px; background: var(--bg-surface-2); padding: 2px; border-radius: 9px; }
.lx-layout button { border: 0; background: none; width: 30px; height: 28px; border-radius: 7px; color: var(--text-secondary); cursor: pointer; font-size: 12.5px; }
.lx-layout button:hover { color: var(--text-primary); }
.lx-layout button.on { background: var(--bg-surface); color: var(--brand-600); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lx-layout .lx-tsep { margin: 0 2px; }
@media (min-width: 900px) {
  .lx-ed.lx-nofiles .lx-files { display: none; }
  .lx-ed[data-layout="code"] .lx-pdf { display: none; }
  .lx-ed[data-layout="pdf"] .lx-code { display: none; }
  .lx-ed[data-layout="code"] .lx-code { border-right: 0; }
}
.lx-split-h { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 6; }
.lx-split-h:hover, .lx-resizing .lx-split-h { background: linear-gradient(90deg, transparent 3px, var(--brand-500) 3px, var(--brand-500) 5px, transparent 5px); }
.lx-ed:not([data-layout="split"]) .lx-split-h { display: none; }
.lx-resizing { user-select: none; cursor: col-resize; }
.lx-resizing .lx-pdf-pages, .lx-resizing .CodeMirror { pointer-events: none; }
.lx-ed.lx-full { position: fixed; inset: 0; z-index: 2000; height: 100vh !important; border-top: 0; }
html.lx-noscroll, html.lx-noscroll body { overflow: hidden; }

.lx-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-primary); padding: 6px 0; cursor: pointer; }
.lx-check input { width: 16px; height: 16px; accent-color: var(--brand-600); }
.lx-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lx-wc td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 899px) {
  .lx-layout { display: none; }
  .lx-split-h { display: none; }
  .lx-tab { padding-left: 10px; }
  .lx-tab-x { opacity: .7; }
}
@media (max-width: 480px) {
  .lx-2col { grid-template-columns: 1fr; }
  .lx-st-pos { display: none; }
}

/* ⭐ 2026-10-24 — maths preview, search in all files */
.lx-mathpv { z-index: 8; margin-top: 4px; padding: 8px 14px; max-width: min(640px, 92%); overflow-x: auto; background: var(--bg-surface);
  color: var(--text-primary); border: 1px solid var(--border-default); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.16); font-size: 1.1em; }
.lx-mathpv .katex-display { margin: 2px 0; }
.lx-mathpv.bad { font-size: 12px; color: var(--text-secondary); font-family: inherit; }
.lx-files-bar.ro .lx-icon-btn.lx-keep { display: inline-grid; place-items: center; }
.lx-files.searching .lx-tree, .lx-files.searching .lx-outline, .lx-files.searching > .lx-files-hint { display: none; }
.lx-psearch { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lx-psearch[hidden] { display: none; }
.lx-ps-head { display: flex; align-items: center; padding: 6px 6px 2px 12px; font-size: 12.5px; color: var(--text-primary); }
.lx-ps-head i { color: var(--brand-600); margin-right: 4px; }
.lx-ps-row { display: flex; gap: 4px; padding: 4px 8px; align-items: center; }
.lx-ps-row input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--border-default); border-radius: 7px; background: var(--bg-surface);
  color: var(--text-primary); font-size: 13px; font-family: "JetBrains Mono", ui-monospace, monospace; }
.lx-ps-row input:focus { outline: 2px solid var(--brand-500); outline-offset: -1px; }
.lx-ps-row .btn { white-space: nowrap; padding: 6px 8px; font-size: 12px; }
.lx-ps-opts { display: inline-flex; gap: 1px; }
.lx-ps-opts button { border: 1px solid transparent; background: none; color: var(--text-secondary); font-size: 11.5px; font-weight: 700; width: 26px; height: 28px;
  border-radius: 6px; cursor: pointer; font-family: ui-monospace, monospace; }
.lx-ps-opts button:hover { background: var(--bg-surface); }
.lx-ps-opts button.on { background: rgba(79,70,229,.14); color: var(--brand-600); border-color: rgba(79,70,229,.35); }
.lx-ps-sum { font-size: 11.5px; color: var(--text-secondary); padding: 4px 12px 6px; }
.lx-ps-res { flex: 1; overflow: auto; padding: 0 4px 8px; }
.lx-ps-file { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-primary); padding: 8px 8px 3px; }
.lx-ps-file i { color: var(--text-secondary); }
.lx-ps-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-ps-file b { font-size: 10.5px; background: var(--bg-surface); border-radius: 99px; padding: 1px 7px; color: var(--text-secondary); }
.lx-ps-hit { display: flex; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 4px 8px 4px 14px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: var(--text-primary); font-family: "JetBrains Mono", ui-monospace, monospace; }
.lx-ps-hit:hover, .lx-ps-hit:focus-visible { background: var(--bg-surface); outline: none; }
.lx-ps-ln { color: var(--text-secondary); min-width: 26px; text-align: right; flex-shrink: 0; }
.lx-ps-tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lx-ps-tx mark { background: rgba(250,204,21,.55); color: inherit; border-radius: 2px; padding: 0 1px; }
[data-theme="dark"] .lx-ps-tx mark { background: rgba(250,204,21,.35); }

/* ⭐ 2026-10-24 — PDF viewer: zoom menu, page number, drag */
.lx-zoom { min-width: 58px; }
.lx-zoom::after { content: " ▾"; font-size: 9px; opacity: .6; }
.lx-zmenu { min-width: 170px; }
.lx-zmenu hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 4px 0; }
.lx-zmenu [aria-checked="true"] { color: var(--brand-600); font-weight: 700; }
.lx-zmenu kbd { margin-left: auto; font-size: 10.5px; opacity: .6; }
.lx-pg { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; font-size: 12px; color: var(--text-secondary); }
.lx-pg[hidden] { display: none; }
.lx-pg .lx-icon-btn { width: 26px; height: 26px; font-size: 11px; }
.lx-pg-in { width: 34px; text-align: center; padding: 3px 2px; font-size: 12px; border: 1px solid var(--border-subtle); border-radius: 6px;
  background: var(--bg-surface); color: var(--text-primary); }
.lx-pg-n { white-space: nowrap; padding: 0 2px; }
.lx-pdf-pages:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-500); }
.lx-pdf-pages.lx-grabbing, .lx-pdf-pages.lx-grabbing .lx-page { cursor: grabbing; }
@media (max-width: 899px) {
  .lx-pg .lx-icon-btn { display: none; }
}

/* ⭐ 2026-10-24 — Trash */
.lx-trash-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px; border-radius: 10px; font-size: 13px;
  background: var(--bg-surface-2); color: var(--text-secondary); flex-wrap: wrap; }
.lx-trash-head > i { color: #dc2626; }
.lx-trash-head span { flex: 1; min-width: 200px; }
.lx-trow { grid-template-columns: 32px minmax(0, 1fr) auto auto auto !important; cursor: default; }
.lx-trow-ico { color: var(--text-secondary); text-align: center; }
.lx-icon-btn.danger:hover { color: #dc2626; }
.lx-soon { color: #dc2626; }
.lx-sort[hidden], .lx-views[hidden] { display: none; }

/* ⭐ 2026-10-24 — errors explained */
.lx-issue { flex-direction: column; gap: 0; padding: 0; cursor: default; }
.lx-issue:hover { background: none; }
.lx-issue-go { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text-primary); }
.lx-issue-go:hover { background: var(--bg-surface-2); }
.lx-issue-go > i { margin-top: 3px; } .lx-issue.error .lx-issue-go > i { color: #dc2626; } .lx-issue.warning .lx-issue-go > i { color: #d97706; }
.lx-issue-go span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lx-tip { display: flex; gap: 8px; margin: 0 10px 8px 34px; padding: 8px 10px; border-radius: 8px; background: rgba(250,204,21,.12); font-size: 12.5px; line-height: 1.5; color: var(--text-primary); }
.lx-tip > i { color: #ca8a04; margin-top: 3px; }
.lx-tip p { margin: 0; }
.lx-tip code { font-size: 11.5px; background: var(--bg-surface); padding: 1px 4px; border-radius: 4px; }
.lx-fixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lx-fix { font-size: 12px; padding: 4px 10px; }

/* ⭐ 2026-10-24 — add a reference */
.lx-cite-row { display: flex; gap: 6px; }
.lx-cite-row input { flex: 1; min-width: 0; }
.lx-cite-out { margin: -2px 0 12px; }
.lx-cite-card { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; background: rgba(79,70,229,.07); border: 1px solid rgba(79,70,229,.25); }
.lx-cite-card b { font-size: 14px; color: var(--text-primary); }
.lx-cite-card span { font-size: 12.5px; color: var(--text-secondary); }
.lx-cite-card code { align-self: flex-start; font-size: 12px; margin-top: 2px; background: var(--bg-surface); padding: 1px 6px; border-radius: 5px; }
.lx-cite-bib { max-height: 160px; overflow: auto; font-size: 11.5px; line-height: 1.45; background: var(--bg-surface-2); padding: 10px; border-radius: 8px; margin: 8px 0 0; white-space: pre-wrap; }
.lx-cite-err { color: #dc2626; font-size: 13px; margin: 0; }

/* ⭐ 2026-10-24 — PDF text layer (select / copy), links, search */
.lx-tl { position: absolute; inset: 0; overflow: hidden; line-height: 1; text-align: initial; -webkit-text-size-adjust: none; text-size-adjust: none;
  forced-color-adjust: none; transform-origin: 0 0; z-index: 2; opacity: 1; }
.lx-tl :is(span, br):not(.lx-hl) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.lx-tl span.markedContent { top: 0; height: 0; }
.lx-tl ::selection { background: rgba(37,99,235,.28); color: transparent; }
.lx-tl br::selection { background: transparent; }
.lx-tl .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
.lx-tl .endOfContent.active { top: 0; }
.lx-tl .lx-hl { color: transparent; background: rgba(250,204,21,.5); border-radius: 2px; margin: -1px; padding: 1px; }
.lx-tl .lx-hl.cur { background: rgba(249,115,22,.65); box-shadow: 0 0 0 1px rgba(234,88,12,.9); }
.lx-links { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.lx-links a { position: absolute; pointer-events: auto; border-radius: 2px; }
.lx-links a:hover { background: rgba(37,99,235,.12); outline: 1px solid rgba(37,99,235,.45); }
.lx-pfind { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); }
.lx-pfind[hidden] { display: none; }
.lx-pfind > i { color: var(--text-secondary); font-size: 12px; margin: 0 4px; }
.lx-pf-q { flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px; border: 1px solid var(--border-default); border-radius: 7px; background: var(--bg-surface); color: var(--text-primary); }
.lx-pf-q:focus { outline: 2px solid var(--brand-500); outline-offset: -1px; }
.lx-pf-n { font-size: 12px; color: var(--text-secondary); white-space: nowrap; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.lx-pf-n.none { color: #dc2626; }
.lx-pfind .lx-icon-btn { width: 28px; height: 28px; }
/* the text layer / links stay inside the pages box: the error list and other panels float above them */
.lx-pdf-pages { z-index: 0; }
.lx-issues { z-index: 5; }

/* AI explains an error (2026-10-30) */
.lx-ai { margin: 0 10px 10px 34px; }
.lx-ai-btn { font-size: 12px; padding: 4px 10px; }
.lx-ai-wait { font-size: 12.5px; color: var(--text-secondary); padding: 4px 0; }
.lx-ai-err { margin: 0 0 6px; font-size: 12.5px; color: #dc2626; }
.lx-ai-ans { padding: 8px 10px; border-radius: 8px; background: rgba(99,102,241,.10); font-size: 12.5px; line-height: 1.5; color: var(--text-primary); }
.lx-ai-head { font-weight: 600; margin-bottom: 4px; } .lx-ai-head i { color: #6366f1; } .lx-ai-head small { font-weight: 400; color: var(--text-secondary); }
.lx-ai-ans p { margin: 0 0 6px; overflow-wrap: anywhere; }
.lx-ai-ans code { font-size: 11.5px; background: var(--bg-surface); padding: 1px 4px; border-radius: 4px; }
.lx-ai-where { font-size: 11.5px; color: var(--text-secondary); margin: 6px 0 2px; }
.lx-ai-code { margin: 0; padding: 4px 8px; font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.lx-ai-code.del { background: rgba(220,38,38,.10); color: #b91c1c; border-radius: 6px 6px 0 0; }
.lx-ai-code.add { background: rgba(22,163,74,.12); color: #15803d; border-radius: 0 0 6px 6px; }
.lx-ai-code.add:first-of-type, .lx-ai-where + .lx-ai-code.add { border-radius: 6px; }
.lx-ai-none { color: var(--text-secondary); font-style: italic; }
.lx-ai-done { font-size: 12px; color: #15803d; font-weight: 600; }
[data-theme="dark"] .lx-ai-code.del { color: #fca5a5; } [data-theme="dark"] .lx-ai-code.add { color: #86efac; }

/* ⭐ 2026-11-06 — editing together */
.lx-people { display: inline-flex; align-items: center; }
.lx-people:empty { display: none; }
.lx-peer { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg-surface, #fff); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: -6px; cursor: pointer; padding: 0; }
.lx-peer:first-child { margin-left: 0; }
.lx-peer:focus-visible { outline: 2px solid var(--primary, #4f46e5); outline-offset: 1px; }
.lx-peer.more { background: var(--bg-surface-2, #64748b); color: var(--text-secondary); cursor: default; }
.lx-share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--border-default); border-radius: 8px; background: transparent; color: var(--text-primary); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lx-share-btn:hover { background: var(--bg-surface-2); }
.lx-peer-caret { position: relative; display: inline-block; width: 0; height: 1.2em; border-left: 2px solid var(--peer); margin: 0 -1px; vertical-align: text-bottom; pointer-events: none; }
.lx-peer-caret::before { content: ''; position: absolute; top: -3px; left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--peer); }
.lx-peer-flag { display: none; position: absolute; left: -2px; bottom: 100%; background: var(--peer); color: #fff; font: 600 11px/1.4 system-ui, sans-serif; padding: 1px 6px; border-radius: 4px 4px 4px 0; white-space: nowrap; z-index: 6; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.lx-peer-caret.show .lx-peer-flag { display: block; }
.lx-peer-caret.top .lx-peer-flag { bottom: auto; top: 100%; border-radius: 0 4px 4px 4px; }
.lx-tag.with { background: rgba(37,99,235,.92); color: #fff; max-width: calc(100% - 52px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-save.offline { color: #d97706; }
.lx-share-h { font-size: 14px; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.lx-share-hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 18px 0 14px; }
.lx-share-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lx-people-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.lx-people-list li { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.lx-person-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-surface-2); color: var(--text-primary); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lx-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lx-people-list small { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
@media (max-width: 900px) {
  .lx-share-btn span { display: none; }
  .lx-share-btn { padding: 6px 9px; }
  .lx-save.offline { display: inline-flex; }
}

/* ================= 2026-11-10 — the editor as a full-window studio ================= */
html.lx-studio, html.lx-studio body { overflow: hidden; }
html.lx-studio #appHeader, html.lx-studio .mobile-bottom-nav, html.lx-studio #appFooter, html.lx-studio .app-footer, html.lx-studio #askFab { display: none !important; }
html.lx-studio .lx-ed:not(.lx-full) { position: fixed; inset: 0; z-index: 150; border-top: 0; height: 100vh; height: 100dvh; }

/* top bar */
.lx-top { min-height: 56px; padding: 6px 12px; gap: 8px; background: var(--bg-surface); position: relative; }
.lx-top > .lx-icon-btn[data-act="back"] { background: var(--bg-surface-2); border-radius: 11px; width: 36px; height: 36px; }
.lx-title { font-size: 15.5px; letter-spacing: -.01em; }
.lx-compile { background: linear-gradient(135deg, #6366f1, #8b5cf6) !important; border: 0 !important; box-shadow: 0 6px 16px -8px rgba(99, 102, 241, .8); height: 36px; padding: 0 16px !important; border-radius: 10px !important; }
.lx-compile:hover:not(:disabled) { filter: brightness(1.08); }
.lx-compile.busy { background: linear-gradient(135deg, #64748b, #475569) !important; }
.lx-ed.lx-ok .lx-compile { background: linear-gradient(135deg, #10b981, #059669) !important; }
.lx-ed.lx-bad .lx-compile { background: linear-gradient(135deg, #f43f5e, #dc2626) !important; }
.lx-layout { background: var(--bg-surface-2); border-radius: 11px; padding: 3px; }
.lx-share-btn { border-radius: 10px; }
.lx-cmd-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 10px; border-radius: 10px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); cursor: pointer; font: inherit; flex-shrink: 0; }
.lx-cmd-btn:hover { border-color: var(--brand-300); color: var(--text-primary); }
.lx-cmd-btn kbd { font: 600 10.5px/1 Inter, sans-serif; padding: 4px 6px; border-radius: 6px; background: var(--bg-surface-2); border: 1px solid var(--border-subtle); color: var(--text-secondary); }
@media (max-width: 1280px) { .lx-cmd-btn kbd { display: none; } .lx-cmd-btn { width: 34px; padding: 0; justify-content: center; } }
/* a thin line that runs while the PDF is being made */
.lx-progress { height: 2px; margin-top: -2px; position: relative; z-index: 3; overflow: hidden; pointer-events: none; }
.lx-ed.lx-busy .lx-progress::before { content: ''; position: absolute; top: 0; bottom: 0; width: 35%; left: -35%; background: linear-gradient(90deg, transparent, #8b5cf6, #06b6d4, transparent); animation: lxRun 1.1s ease-in-out infinite; }
.lx-ed.lx-ok .lx-progress { background: #10b981; animation: lxFade 1.6s ease forwards; }
.lx-ed.lx-bad .lx-progress { background: #ef4444; animation: lxFade 1.6s ease forwards; }
@keyframes lxRun { to { left: 100%; } }
@keyframes lxFade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lx-ed.lx-busy .lx-progress::before { animation: none; left: 0; width: 100%; opacity: .6; } }

/* files: coloured icons, softer rows */
.lx-files { background: var(--bg-surface); }
.lx-node { border-radius: 8px; margin: 1px 2px; }
.lx-node.on { background: rgba(99, 102, 241, .12); box-shadow: inset 3px 0 0 var(--brand-500); }
.lx-node .fa-file-lines, .lx-node .fa-file-code { color: #6366f1 !important; }
.lx-node .fa-file-image { color: #ec4899 !important; }
.lx-node .fa-book, .lx-node .fa-file-contract, .lx-node .fa-book-bookmark { color: #10b981 !important; }
.lx-node .fa-file-pdf { color: #ef4444 !important; }
.lx-node .fa-file-csv, .lx-node .fa-file-excel { color: #16a34a !important; }
.lx-ol-item { border-left: 2px solid transparent; border-radius: 0 6px 6px 0; }
.lx-ol-item.on { border-left-color: var(--brand-500); }

/* tabs, toolbar, status */
.lx-tab.on::after { height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.lx-tools { padding: 4px 8px; gap: 2px; }
.lx-tools button { border-radius: 8px; transition: background .12s, color .12s; }
.lx-tools button:hover { color: var(--brand-600); }
.lx-status { min-height: 28px; gap: 12px; background: var(--bg-surface); border-top: 1px solid var(--border-subtle); }
.lx-st-comp { font-size: 11.5px; color: var(--text-secondary); display: inline-flex; gap: 5px; align-items: center; }
.lx-st-comp b.ok { color: #059669; font-weight: 600; } .lx-st-comp b.bad { color: #dc2626; font-weight: 600; }
.lx-st-words.goal { position: relative; padding-bottom: 4px; }
.lx-st-words.goal::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 1px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #8b5cf6 var(--g, 0%), var(--border-subtle) var(--g, 0%)); }
.lx-st-words.done { color: #059669; font-weight: 600; }
.lx-st-words.done::after { background: #10b981; }
.lx-goal { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.lx-goal input { width: 140px; }

/* the PDF sits on a soft desk */
.lx-pdf-pages { background-color: var(--bg-surface-2); background-image: radial-gradient(circle at 1px 1px, rgba(100, 116, 139, .22) 1px, transparent 0); background-size: 20px 20px; }
.lx-pdf-inner { gap: 18px; padding: 18px; }
.lx-page { box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 14px 34px -14px rgba(15, 23, 42, .45); border-radius: 2px; }

/* ---------- editor colours: each theme sets the same variables ---------- */
[data-cmt="night"], [data-cmt-pv="night"] { --cm-bg: #0b1220; --cm-gut: #0b1220; --cm-fg: #dbe4f0; --cm-ln: #44506a; --cm-act: rgba(99, 102, 241, .1); --cm-sel: rgba(99, 102, 241, .32); --cm-tag: #7aa2ff; --cm-kw: #c792ea; --cm-atom: #f78c6c; --cm-bi: #89ddff; --cm-br: #8892b0; --cm-com: #5c6a85; --cm-str: #c3e88d; --cm-num: #ffcb6b; --cm-cur: #ffcc00; }
[data-cmt="violet"], [data-cmt-pv="violet"] { --cm-bg: #1e1b2e; --cm-gut: #1a1728; --cm-fg: #ece8ff; --cm-ln: #5b5578; --cm-act: rgba(189, 147, 249, .09); --cm-sel: rgba(189, 147, 249, .3); --cm-tag: #ff79c6; --cm-kw: #bd93f9; --cm-atom: #ffb86c; --cm-bi: #8be9fd; --cm-br: #a39fc4; --cm-com: #6f6a93; --cm-str: #50fa7b; --cm-num: #f1fa8c; --cm-cur: #ff79c6; }
[data-cmt="ember"], [data-cmt-pv="ember"] { --cm-bg: #1f1d1a; --cm-gut: #1b1a17; --cm-fg: #f3eee6; --cm-ln: #5f584c; --cm-act: rgba(253, 151, 31, .08); --cm-sel: rgba(253, 151, 31, .25); --cm-tag: #f92672; --cm-kw: #fd971f; --cm-atom: #ae81ff; --cm-bi: #66d9ef; --cm-br: #a59f85; --cm-com: #75715e; --cm-str: #a6e22e; --cm-num: #e6db74; --cm-cur: #fd971f; }
[data-cmt="forest"], [data-cmt-pv="forest"] { --cm-bg: #0f1f1a; --cm-gut: #0d1b17; --cm-fg: #e3f2ea; --cm-ln: #44624f; --cm-act: rgba(52, 211, 153, .08); --cm-sel: rgba(52, 211, 153, .25); --cm-tag: #6ee7b7; --cm-kw: #fcd34d; --cm-atom: #fda4af; --cm-bi: #7dd3fc; --cm-br: #86a596; --cm-com: #567565; --cm-str: #bef264; --cm-num: #fdba74; --cm-cur: #6ee7b7; }
[data-cmt="solar"], [data-cmt-pv="solar"] { --cm-bg: #fdf6e3; --cm-gut: #f6efd9; --cm-fg: #586e75; --cm-ln: #b3ab90; --cm-act: rgba(181, 137, 0, .07); --cm-sel: rgba(38, 139, 210, .2); --cm-tag: #268bd2; --cm-kw: #6c71c4; --cm-atom: #cb4b16; --cm-bi: #2aa198; --cm-br: #93a1a1; --cm-com: #93a1a1; --cm-str: #859900; --cm-num: #d33682; --cm-cur: #dc322f; }
[data-cmt="paper"], [data-cmt-pv="paper"] { --cm-bg: #ffffff; --cm-gut: #fafafa; --cm-fg: #1f2328; --cm-ln: #b0b7c0; --cm-act: rgba(9, 105, 218, .05); --cm-sel: rgba(9, 105, 218, .16); --cm-tag: #0550ae; --cm-kw: #8250df; --cm-atom: #953800; --cm-bi: #116329; --cm-br: #6e7781; --cm-com: #6e7781; --cm-str: #0a3069; --cm-num: #cf222e; --cm-cur: #0969da; }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror { background: var(--cm-bg); color: var(--cm-fg); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-gutters { background: var(--cm-gut); border-right-color: color-mix(in srgb, var(--cm-fg) 10%, transparent); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-linenumber { color: var(--cm-ln); opacity: 1; }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-activeline-background { background: var(--cm-act); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-activeline .CodeMirror-linenumber { color: var(--cm-fg); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-selected, .lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-focused .CodeMirror-selected { background: var(--cm-sel); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-cursor { border-left: 2px solid var(--cm-cur); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-tag { color: var(--cm-tag); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-keyword { color: var(--cm-kw); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-atom { color: var(--cm-atom); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-builtin, .lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-variable-2 { color: var(--cm-bi); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-bracket { color: var(--cm-br); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-comment { color: var(--cm-com); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-string, .lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-string-2 { color: var(--cm-str); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .cm-number { color: var(--cm-num); }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-matchingbracket { color: var(--cm-fg) !important; background: color-mix(in srgb, var(--cm-tag) 28%, transparent); border-radius: 2px; }
.lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-foldgutter-open, .lx-ed[data-cmt]:not([data-cmt="auto"]) .lx-cm .CodeMirror-foldgutter-folded { color: var(--cm-ln); }
/* the colour picker in Editor settings */
.lx-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 4px; }
.lx-th { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; border: 2px solid var(--border-subtle); cursor: pointer; transition: border-color .15s, transform .15s; }
.lx-th:hover { transform: translateY(-2px); border-color: var(--border-strong, #94a3b8); }
.lx-th:has(input:checked) { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.lx-th input { position: absolute; opacity: 0; pointer-events: none; }
.lx-th input:focus-visible + .lx-th-pv { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.lx-th-pv { display: block; font: 12px/1.6 "JetBrains Mono", ui-monospace, monospace; padding: 8px 10px; border-radius: 8px; background: var(--cm-bg, var(--bg-surface-2)); color: var(--cm-fg, var(--text-primary)); white-space: nowrap; overflow: hidden; }
.lx-th-pv i { font-style: normal; }
.lx-th-pv .t { color: var(--cm-tag, #4f46e5); } .lx-th-pv .b { color: var(--cm-br, #64748b); } .lx-th-pv .c { color: var(--cm-com, #94a3b8); font-style: italic; }
.lx-th-pv .n { color: var(--cm-num, #c2410c); } .lx-th-pv .k { color: var(--cm-str, #059669); }
.lx-th b { font-size: 12.5px; padding: 0 4px; }

/* command box */
.lx-cmd-ov { position: fixed; inset: 0; z-index: 9500; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.lx-cmd { width: 100%; max-width: 620px; background: var(--bg-elevated, var(--bg-surface)); color: var(--text-primary); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); overflow: hidden; border: 1px solid var(--border-subtle); }
.lx-cmd-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.lx-cmd-in input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text-primary); min-width: 0; }
.lx-cmd-in kbd { font: 600 11px/1 Inter, sans-serif; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.lx-cmd-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; }
.lx-cmd-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; color: var(--text-primary); cursor: pointer; text-align: left; }
.lx-cmd-row i { width: 18px; text-align: center; color: var(--text-secondary); }
.lx-cmd-row.on, .lx-cmd-row:hover { background: rgba(99, 102, 241, .1); }
.lx-cmd-row.on i { color: var(--brand-600); }
.lx-cmd-none { color: var(--text-secondary); font-size: 13.5px; padding: 18px 12px; margin: 0; text-align: center; }
@media (max-width: 640px) { .lx-cmd-ov { padding-top: 10px; } .lx-cmd-btn { display: none; } .lx-st-comp { display: none; } }
/* the 30 px list checkbox rule (.lx-check above) squeezed the labelled checkboxes of Editor settings */
.lx-dialog .lx-check { width: auto; height: auto; display: flex; place-items: initial; }

/* ---------- 2026-11-10: a theme colours the whole studio, not just the code ----------
   html[data-lxt] is set only while the studio is open (latex-studio.js setStudioTheme); "auto" leaves the AeroGyan
   light / dark colours alone. Each palette re-defines the app's own variables, so bars, files, tabs, toolbar, status,
   the PDF desk and the dialogs / command box (they sit on <body>) all follow. --lx-on = text of a selected row. */
html.lx-studio[data-lxt="night"] {
  color-scheme: dark; --lx-tone: dark;
  --bg-page: #060b16; --bg-surface: #0f1729; --bg-surface-2: #0b1220; --bg-surface-3: #18233b; --bg-elevated: #131d33;
  --border-subtle: #1b2640; --border-default: #27344f; --border-strong: #3b4a69;
  --text-primary: #dbe4f0; --text-secondary: #94a3b8; --text-tertiary: #64748b; --text-inverse: #0b1220;
  --brand-300: #b4c6ff; --brand-400: #93acff; --brand-500: #7aa2ff; --brand-600: #6b8cff; --brand-700: #5b78ee;
  --lx-on: #c7d6ff; --lx-acc2: #c792ea; --lx-desk: #070d19;
}
html.lx-studio[data-lxt="violet"] {
  color-scheme: dark; --lx-tone: dark;
  --bg-page: #14121d; --bg-surface: #232036; --bg-surface-2: #1e1b2e; --bg-surface-3: #2d2945; --bg-elevated: #282440;
  --border-subtle: #302b48; --border-default: #3e385b; --border-strong: #574f7c;
  --text-primary: #ece8ff; --text-secondary: #b3add6; --text-tertiary: #7f78a6; --text-inverse: #1e1b2e;
  --brand-300: #ddc8ff; --brand-400: #cba8fb; --brand-500: #bd93f9; --brand-600: #a87cf2; --brand-700: #9466e0;
  --lx-on: #e4d4ff; --lx-acc2: #ff79c6; --lx-desk: #17152a;
}
html.lx-studio[data-lxt="ember"] {
  color-scheme: dark; --lx-tone: dark;
  --bg-page: #141310; --bg-surface: #272520; --bg-surface-2: #1f1d1a; --bg-surface-3: #312e27; --bg-elevated: #2b2924;
  --border-subtle: #34312a; --border-default: #433f35; --border-strong: #5c564a;
  --text-primary: #f3eee6; --text-secondary: #bdb5a6; --text-tertiary: #8a8273; --text-inverse: #1f1d1a;
  --brand-300: #fec58a; --brand-400: #fdae55; --brand-500: #fd971f; --brand-600: #e8840f; --brand-700: #c96e08;
  --lx-on: #fed3a3; --lx-acc2: #f92672; --lx-desk: #181713;
}
html.lx-studio[data-lxt="forest"] {
  color-scheme: dark; --lx-tone: dark;
  --bg-page: #08130f; --bg-surface: #13261f; --bg-surface-2: #0f1f1a; --bg-surface-3: #1a3129; --bg-elevated: #172c24;
  --border-subtle: #1e362d; --border-default: #2a4739; --border-strong: #3d604f;
  --text-primary: #e3f2ea; --text-secondary: #a3c2b2; --text-tertiary: #6f8f7f; --text-inverse: #0f1f1a;
  --brand-300: #a7f3d0; --brand-400: #6ee7b7; --brand-500: #34d399; --brand-600: #10b981; --brand-700: #059669;
  --lx-on: #bdf5dc; --lx-acc2: #fcd34d; --lx-desk: #0a1814;
}
html.lx-studio[data-lxt="solar"] {
  color-scheme: light; --lx-tone: light;
  --bg-page: #eee8d5; --bg-surface: #fdf6e3; --bg-surface-2: #f6efd9; --bg-surface-3: #eee8d5; --bg-elevated: #fffaf0;
  --border-subtle: #e8e0c7; --border-default: #d9d0b4; --border-strong: #c2b891;
  --text-primary: #2f3d43; --text-secondary: #5d7279; --text-tertiary: #93a1a1; --text-inverse: #fdf6e3;
  --brand-300: #8cc5ec; --brand-400: #4aa3df; --brand-500: #268bd2; --brand-600: #1f75b3; --brand-700: #195f92;
  --lx-on: #195f92; --lx-acc2: #6c71c4; --lx-desk: #eee8d5;
}
html.lx-studio[data-lxt="paper"] {
  color-scheme: light; --lx-tone: light;
  --bg-page: #f3f4f6; --bg-surface: #ffffff; --bg-surface-2: #f8f9fa; --bg-surface-3: #eff1f3; --bg-elevated: #ffffff;
  --border-subtle: #e8eaed; --border-default: #d6dae0; --border-strong: #b6bec7;
  --text-primary: #1f2328; --text-secondary: #57606a; --text-tertiary: #8c959f; --text-inverse: #ffffff;
  --brand-300: #80b7f5; --brand-400: #3d8ff0; --brand-500: #0969da; --brand-600: #0757b8; --brand-700: #054596;
  --lx-on: #0550ae; --lx-acc2: #8250df; --lx-desk: #eceef1;
}
html.lx-studio[data-lxt="night"], html.lx-studio[data-lxt="violet"], html.lx-studio[data-lxt="ember"], html.lx-studio[data-lxt="forest"] {
  --shadow-xs: 0 1px 2px rgba(0,0,0,.45); --shadow-sm: 0 1px 3px rgba(0,0,0,.5); --shadow-md: 0 8px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.55); --shadow-xl: 0 32px 72px rgba(0,0,0,.65);
}
html.lx-studio[data-lxt] body { background: var(--bg-page); color: var(--text-primary); }
/* the studio's indigo touches take the theme's accent */
html[data-lxt] .lx-compile { background: linear-gradient(135deg, var(--brand-500), var(--lx-acc2)) !important; box-shadow: 0 6px 16px -8px var(--brand-500); color: #fff; }
html[data-lxt="solar"] .lx-compile, html[data-lxt="paper"] .lx-compile { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)) !important; }
html[data-lxt="night"] .lx-compile, html[data-lxt="ember"] .lx-compile, html[data-lxt="forest"] .lx-compile, html[data-lxt="violet"] .lx-compile { color: #12111a !important; }
html[data-lxt="night"] .lx-compile *, html[data-lxt="ember"] .lx-compile *, html[data-lxt="forest"] .lx-compile *, html[data-lxt="violet"] .lx-compile * { color: inherit !important; }
html[data-lxt] .lx-compile.busy { background: linear-gradient(135deg, #64748b, #475569) !important; color: #fff !important; }
html[data-lxt] .lx-tab.on::after { background: linear-gradient(90deg, var(--brand-500), var(--lx-acc2)); }
html[data-lxt] .lx-node.on, html[data-lxt] .lx-ol-item.on { background: color-mix(in srgb, var(--brand-500) 16%, transparent); color: var(--lx-on); }
html[data-lxt] .lx-tools button.on, html[data-lxt] .lx-ps-opts button.on { background: color-mix(in srgb, var(--brand-500) 18%, transparent); color: var(--lx-on); }
html[data-lxt] .lx-tools button:hover { color: var(--lx-on); }
html[data-lxt] .lx-auto.on { color: var(--lx-on); border-color: color-mix(in srgb, var(--brand-500) 45%, transparent); }
html[data-lxt] .lx-cmd-row.on, html[data-lxt] .lx-cmd-row:hover { background: color-mix(in srgb, var(--brand-500) 14%, transparent); }
html[data-lxt] .lx-cmd-row.on i { color: var(--lx-on); }
html[data-lxt] .lx-th:has(input:checked) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 30%, transparent); }
html[data-lxt] .lx-st-words.goal::after { background: linear-gradient(90deg, var(--brand-500) var(--g, 0%), var(--border-subtle) var(--g, 0%)); }
html[data-lxt] .lx-ed.lx-busy .lx-progress::before { background: linear-gradient(90deg, transparent, var(--brand-500), var(--lx-acc2), transparent); }
html[data-lxt] .lx-cm .lx-ph, html[data-lxt] .lx-cm .CodeMirror-foldmarker { background: color-mix(in srgb, var(--brand-500) 18%, transparent); }
html[data-lxt] .lx-cm .lx-ph { outline-color: color-mix(in srgb, var(--brand-500) 60%, transparent); }
html[data-lxt] .lx-cmd-ov { background: rgba(0, 0, 0, .5); }
/* the PDF desk: a calm backdrop in the theme's own tone (the pages stay white paper) */
html[data-lxt] .lx-pdf-pages { background-color: var(--lx-desk); background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text-tertiary) 30%, transparent) 1px, transparent 0); }
html[data-lxt] .lx-page { box-shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 14px 34px -14px rgba(0, 0, 0, .6); }
/* scrollbars in the theme */
html[data-lxt] .lx-ed { scrollbar-color: var(--border-strong) transparent; }
.lx-th-note { font-weight: 400; font-size: 12px; color: var(--text-secondary); }
