/* Resizable IDE panels (latex-workspace.js initPanelLayout). */
@media (min-width: 901px) {

  .workspace--ide.is-sidebar-hidden [data-panel-resizer="sidebar"] { display:none; }
  .workspace--ide .compile-panel--collapsible.is-open {
    flex:0 0 var(--output-width, 360px);
    width:var(--output-width, 360px);
    min-width:var(--output-width, 360px);
    max-width:var(--output-width, 360px);
  }
  .workspace--ide.is-pdf-only .editor-area--ide,
.workspace--ide.is-pdf-only [data-panel-resizer="output"] { display:none; }
  .workspace--ide.is-pdf-only .compile-panel--collapsible.is-open { flex:1 1 auto; width:auto; max-width:none; }
  .panel-resizer { flex:0 0 5px; background:var(--sidebar-border, var(--color-blue-650)); cursor:col-resize; touch-action:none; }
  .panel-resizer:hover,
.panel-resizer:focus-visible { background:var(--primary); outline:none; }
  .panel-resizer[data-panel-resizer="output"]:has(+ .compile-panel--collapsible:not(.is-open)) { display:none; }
  .workspace--ide.is-resizing { cursor:col-resize; user-select:none; }
  .workspace--ide.is-resizing iframe { pointer-events:none; }
}

@media (max-width: 900px) {
  .panel-resizer { display:none; }
}

[data-sidebar-visibility][aria-pressed="false"] { opacity:.6; }

/* PDF viewer toolbar controls must not inherit the compile form's full-width fields. */

.ide-tool-select:focus-visible { outline:2px solid var(--primary); outline-offset:1px; }

/* Version history: sidebar extras and the «Viaje en el tiempo» dialog. The diff uses the editor's dark palette. */
.project-history { display:grid; gap:8px; align-content:start; }
.project-history[hidden] { display:none; }
.project-history > *,
.history-checkpoint > * { min-width:0; max-width:100%; box-sizing:border-box; }
.project-history .sidebar-action { width:100%; justify-content:center; white-space:normal; text-align:center; }
.project-history .file-search { width:100%; }
.history-hit--named span { color:var(--color-earth-850); font-weight:600; }

.history-tt { display:grid; grid-template-rows:auto auto auto auto minmax(0, 1fr) auto; gap:10px; height:100%; padding:16px 20px; box-sizing:border-box; }
.history-tt__head,
.history-tt__bar,
.history-tt__foot { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; }

.history-tt__modes { display:inline-flex; gap:2px; margin:0; padding:2px; border:1px solid var(--line); border-radius:var(--radius); }
.history-tt__modes label { position:relative; padding:3px 10px; border-radius:var(--radius-sm); font-size:var(--text-12); cursor:pointer; }
.history-tt__modes label:has(input:checked) { color:var(--color-neutral-50); background:var(--primary); }
.history-tt__modes input { position:absolute; opacity:0; pointer-events:none; }
.history-tt__modes label:has(input:focus-visible) { outline:2px solid var(--primary); outline-offset:2px; }
.history-tt__check,
.history-tt__bar label { display:inline-flex; align-items:center; gap:6px; font-size:var(--text-12); white-space:nowrap; }
.history-tt__timeline { display:flex; align-items:center; gap:8px; }
.history-tt__track { position:relative; flex:1; min-width:0; padding-bottom:10px; }
.history-tt__track input[type="range"] { width:100%; margin:0; accent-color:var(--primary); }
.history-tt__ticks { position:absolute; inset:auto 8px 0 8px; height:8px; pointer-events:none; }
.history-tt__tick { position:absolute; top:0; width:2px; height:6px; margin-left:-1px; background:var(--muted); border-radius:var(--radius-xs); opacity:.55; }
.history-tt__tick.is-named { width:8px; height:8px; margin-left:-4px; background:var(--color-earth-850); border-radius:var(--radius-round); opacity:1; }
.history-tt__tick.is-now { background:var(--primary); opacity:1; }
.history-tt__step { width:30px; height:30px; padding:0; font-size:var(--text-18); line-height:1; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-sm); cursor:pointer; }
.history-tt__step:focus-visible { outline:2px solid var(--primary); outline-offset:1px; }
.history-tt__meta { margin:0; font-size:var(--text-13); color:var(--ink); }
.history-tt__bar select { max-width:min(420px, 60vw); }
.history-tt__stats { flex:1; min-width:200px; margin:0; font-size:var(--text-12); color:var(--muted); font-variant-numeric:tabular-nums; }

.history-tt__name { display:inline-flex; gap:6px; }
.history-tt__name[hidden] { display:none; }
.history-tt__name input { width:min(260px, 50vw); }
.history-tt__more,
.history-tt__empty { margin:8px; color:var(--ide-muted); font:var(--text-12)/1.4 Inter, Segoe UI, sans-serif; }

/* The editor's dark palette (workspace.css), written out: the dialog is outside the editor that defines it. */
.history-diff {
  min-height:0; overflow:auto; color:var(--ide-text); background:var(--color-blue-700); border:1px solid var(--ide-border); border-radius:var(--radius); font:var(--text-12)/1.5 "JetBrains Mono", monospace; }
.history-diff:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.history-table { width:100%; border-collapse:collapse; table-layout:fixed; }
.history-table td { vertical-align:top; }
.history-table__no { width:4.5ch; padding:0 6px; color:var(--ide-muted); text-align:right; user-select:none; font-variant-numeric:tabular-nums; }
.history-table__mark { width:2ch; color:var(--ide-muted); text-align:center; user-select:none; }
.history-table__code { padding:0 8px 0 2px; white-space:pre-wrap; overflow-wrap:anywhere; }
.history-table--side .history-table__code + .history-table__no { border-left:1px solid var(--ide-border); }
/* Side by side: columns no, mark, old text (3), no, mark, new text (6). Red removed, green added, and − / + marks. */
.history-table--side tr:is(.is-del, .is-mod) td:nth-child(3),
.history-table--inline tr.is-del td { background:var(--diff-del-bg); }
.history-table--side tr:is(.is-add, .is-mod) td:nth-child(6),
.history-table--inline tr.is-add td { background:var(--alpha-success-16); }
.history-table--side tr.is-add td:nth-child(3),
.history-table--side tr.is-del td:nth-child(6) { background:var(--alpha-surface-4); }
.history-table--side tr.is-mod td:nth-child(3) mark { color:inherit; background:var(--alpha-danger-45); border-radius:var(--radius-xs); }
.history-table--side tr.is-mod td:nth-child(6) mark { color:inherit; background:var(--alpha-success-45); border-radius:var(--radius-xs); }
.history-table--side tr:is(.is-del, .is-mod) td:nth-child(2),
.history-table--inline tr.is-del .history-table__mark { color:var(--color-red-200); }
.history-table--side tr:is(.is-add, .is-mod) td:nth-child(5),
.history-table--inline tr.is-add .history-table__mark { color:var(--color-green-100); }
.history-table tr.is-current td { box-shadow:inset 0 1px 0 var(--color-earth-850), inset 0 -1px 0 var(--color-earth-850); }
.history-table__fold { padding:2px 8px; background:var(--alpha-surface-4); }
.history-table__unfold { padding:0; color:var(--ide-option); background:none; border:0; font:inherit; cursor:pointer; }
.history-table__unfold:hover,
.history-table__unfold:focus-visible { text-decoration:underline; }
@media (max-width: 720px) {
  .history-tt { padding:12px; }
  .history-tt__timeline { flex-wrap:wrap; }
  .history-tt__track { flex-basis:100%; order:-1; }
  .history-table__no { width:3.5ch; padding:0 3px; }
}

.comment-input { width:100%; resize:vertical; font:var(--text-12)/1.4 Inter, Segoe UI, sans-serif; }
.comment-thread { margin-bottom:10px; padding:6px; border:1px solid var(--color-blue-500); border-radius:var(--radius-sm); }
.comment-thread.is-resolved { opacity:.6; }
.comment-thread.is-targeted { border-color:var(--color-earth-850); box-shadow:0 0 0 1px var(--color-earth-850); }
.comment-thread__body { margin:4px 6px; color:var(--color-neutral-200); white-space:pre-wrap; }
.comment-thread__replies { margin:0 6px 4px 14px; padding:0; color:var(--color-neutral-350); list-style:"↳ "; }

/* Log entries grouped by severity (latex-workspace.js renderLogDiagnostics). */
.log-entries__tabs { display:flex; flex-wrap:wrap; gap:4px; margin:4px 0 8px; }
.log-entries__tabs button { padding:3px 8px; color:var(--color-neutral-900); background:var(--color-neutral-50); border:1px solid var(--color-earth-750); border-radius:var(--radius); font:500 var(--text-11)/1.4 Inter, Segoe UI, sans-serif; cursor:pointer; }
.log-entries__tabs button:hover { background:var(--color-earth-400); }
.log-entries__tabs button[aria-selected="true"] { color:var(--color-neutral-50); background:var(--color-neutral-900); border-color:var(--color-neutral-900); }
.log-entries__list { margin:0; padding:0; list-style:none; }
.log-entry { margin-bottom:8px; padding:6px 8px; background:var(--color-neutral-50); border:1px solid var(--color-earth-600); border-left:3px solid var(--color-earth-1200); border-radius:var(--radius-xs); }
.log-entry--error { border-left-color:var(--color-red-300); }
.log-entry--typesetting { border-left-color:var(--color-neutral-550); }
.log-entry[hidden] { display:none; }
.log-entry__head { display:flex; gap:6px; align-items:baseline; font-size:var(--text-12); }
.log-entry__head strong { font-weight:600; word-break:break-word; }
.log-entry__badge { flex:none; padding:0 5px; color:var(--color-neutral-50); background:var(--color-earth-1200); border-radius:var(--radius-xs); font-size:var(--text-11); text-transform:uppercase; }
.log-entry--error .log-entry__badge { background:var(--color-red-300); }
.log-entry--typesetting .log-entry__badge { background:var(--color-neutral-550); }
.log-entry__meta { display:flex; gap:10px; align-items:center; margin-top:4px; font-size:var(--text-11); }

.log-entry__toggle { padding:0; color:var(--color-neutral-900); background:transparent; border:0; font:inherit; text-decoration:underline; cursor:pointer; }
.log-entry__toggle:hover { background:transparent; }
.log-entry__raw { max-height:160px; margin:6px 0 0; padding:6px; overflow:auto; background:var(--color-earth-100); border-radius:var(--radius-xs); font:var(--text-11)/1.4 "JetBrains Mono", monospace; white-space:pre-wrap; }

.issue-list:empty { display:none; }

.word-count { display:grid; grid-template-columns:1fr auto; gap:6px 24px; margin:8px 0; font-size:var(--text-14); }
.word-count[hidden] { display:none; }
.word-count dt { color:var(--color-neutral-900); }
.word-count dd { margin:0; font-weight:600; text-align:right; font-variant-numeric:tabular-nums; }

.comment-group { margin:10px 0 4px; color:var(--color-blue-150); word-break:break-all; }
.comment-group small { color:var(--color-earth-850); }
.comment-scope { margin:8px 0 6px; }
.project-comments .project-search__hit:disabled { opacity:.55; cursor:not-allowed; }
.comment-thread .project-search__options { flex-wrap:wrap; }
.comment-thread__reply { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.comment-thread__reply[hidden] { display:none; }

/* File viewer of the explorer: a PDF in the app's viewer, images and media fitted, any other text read-only. */
.file-viewer { display:grid; grid-template-rows:auto minmax(0, 1fr); gap:var(--space-12); height:100%; padding:var(--space-16) 20px; box-sizing:border-box; }
.file-viewer__head { display:flex; align-items:center; gap:var(--space-12); min-width:0; }
.file-viewer__badge { flex:none; display:inline-grid; place-items:center; min-width:44px; height:44px; padding:0 var(--space-4); border-radius:var(--radius); background:var(--bg); color:var(--muted); font:700 var(--text-11)/1 var(--font-mono); letter-spacing:.02em; box-sizing:border-box; }
.file-viewer__badge[data-kind="pdf"] { background:var(--danger-soft); color:var(--danger-ink); }
.file-viewer__badge[data-kind="image"] { background:var(--diff-add-bg); color:var(--diff-add-ink); }
.file-viewer__badge[data-kind="audio"], .file-viewer__badge[data-kind="video"] { background:var(--primary); color:var(--surface); }
.file-viewer__badge[data-kind="other"] { background:var(--ide-bg); color:var(--ide-text); }
.file-viewer__badge--lg { min-width:64px; height:64px; font-size:var(--text-14); }
.file-viewer__heading { flex:1; min-width:0; }
.file-viewer__name { margin:0; color:var(--ink); font-size:var(--text-16); font-weight:600; line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-viewer__meta { display:flex; flex-wrap:wrap; gap:0 var(--space-8); margin:2px 0 0; color:var(--muted); font-size:var(--text-12); }
.file-viewer__folder { font-family:var(--font-mono); overflow-wrap:anywhere; }
.file-viewer__folder[hidden] { display:none; }
.file-viewer__actions { display:flex; align-items:center; gap:var(--space-4); }
.file-viewer__nav { display:inline-flex; align-items:center; gap:2px; margin-right:var(--space-8); padding-right:var(--space-8); border-right:1px solid var(--line); }
.file-viewer__count { min-width:7ch; color:var(--muted); font-size:var(--text-12); text-align:center; font-variant-numeric:tabular-nums; white-space:nowrap; }
.file-viewer__icon { display:inline-grid; place-items:center; width:var(--ctl-h); height:var(--ctl-h); padding:0; border:1px solid transparent; border-radius:var(--radius); background:transparent; color:var(--ink); font-size:var(--text-16); font-weight:600; line-height:1; text-decoration:none; cursor:pointer; }
.file-viewer__icon:hover { background:var(--bg); border-color:var(--line); }
.file-viewer__icon:focus-visible { outline:none; box-shadow:var(--focus-ring); }
.file-viewer__icon[hidden] { display:none; }
.file-viewer__pdf, .file-viewer__body { min-height:0; overflow:auto; border:1px solid var(--line); border-radius:var(--radius); background:var(--bg); }
/* A column, not a grid: the hidden search bar takes no row, and the pages must still get all the height left. */
.file-viewer__pdf:not([hidden]) { display:flex; flex-direction:column; overflow:hidden; }
.file-viewer__pdf .pdf-viewer__body { flex:1 1 auto; min-height:0; }
.file-viewer__pdf .pdf-viewer__toolbar { border-bottom:1px solid var(--line); background:var(--surface); }
.file-viewer__body[hidden] { display:none; }
.file-viewer__body:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.file-viewer__pages { height:auto; min-height:0; overflow:auto; padding:var(--space-12); resize:none; } /* fills the dialog, unlike the panel's fixed 460px */
.file-viewer__stage { display:grid; place-items:center; min-height:100%; padding:var(--space-16); box-sizing:border-box; }
/* Transparent images over a checkerboard, as image editors show them. */
.file-viewer__stage:has(.file-viewer__image) { background:repeating-conic-gradient(var(--line) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.file-viewer__image, .file-viewer__video { display:block; max-width:100%; max-height:100%; object-fit:contain; box-shadow:var(--shadow); }
.file-viewer__image { cursor:zoom-in; }
.file-viewer__body.is-real-size .file-viewer__stage { place-items:start; }
.file-viewer__body.is-real-size .file-viewer__image { max-width:none; max-height:none; cursor:zoom-out; }
.file-viewer__audio { width:min(520px, 100%); }
.file-viewer__code { position:relative; min-height:100%; background:var(--ide-bg); }
.file-viewer__copy { position:sticky; top:var(--space-8); float:right; margin:var(--space-8) var(--space-8) 0 0; z-index:var(--z-raised); }
.file-viewer__lines, .file-viewer__text { margin:0; padding:var(--space-12) 0; color:var(--ide-text); font:var(--text-12)/1.6 var(--font-mono); }
.file-viewer__text { padding-inline:var(--space-16); white-space:pre-wrap; overflow-wrap:anywhere; }
.file-viewer__lines { padding-left:7ch; list-style:none; counter-reset:line; }
.file-viewer__lines li { position:relative; padding:0 var(--space-16) 0 var(--space-8); white-space:pre-wrap; overflow-wrap:anywhere; counter-increment:line; }
.file-viewer__lines li::before { content:counter(line); position:absolute; right:100%; width:6ch; color:var(--ide-muted); text-align:right; user-select:none; font-variant-numeric:tabular-nums; }
.file-viewer__lines li:hover { background:var(--ide-chrome); }
.file-viewer__empty { display:grid; place-items:center; align-content:center; gap:var(--space-8); min-height:100%; padding:var(--space-24); text-align:center; box-sizing:border-box; }
.file-viewer__empty-title { margin:var(--space-8) 0 0; color:var(--ink); font-size:var(--text-15); font-weight:600; }
.file-viewer__note { margin:0; max-width:52ch; color:var(--muted); font-size:var(--text-13); }
.file-viewer__empty .btn { margin-top:var(--space-8); }
.file-viewer__loading { display:flex; align-items:center; justify-content:center; gap:var(--space-8); min-height:100%; color:var(--muted); font-size:var(--text-13); }
.file-viewer__loading::before { content:""; width:16px; height:16px; border:2px solid var(--line); border-top-color:var(--primary); border-radius:var(--radius-round); animation:compile-spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .file-viewer__loading::before { animation:none; } }
@media (max-width: 720px) {
  .file-viewer { padding:var(--space-12); }
  .file-viewer__head { flex-wrap:wrap; }
  .file-viewer__heading { flex-basis:calc(100% - 56px); } /* the badge and name on one row, the buttons below */
  .file-viewer__actions { flex-basis:100%; justify-content:flex-end; }
}
