/* --round scales every rounded corner, so 0 gives square corners. --line is the line height of the
   interface and --line-text that of the documents in the reader and the task, whose lines are long
   and justified and so need more. Each is a multiple of the font size. */
:root {
  --bg: #fcfcfc;
  --panel: #f0f0f0;
  --panel-2: #e0e0e0;
  --fg: #131313;
  --muted: #353535;
  --faint: #575757;
  --border: #999999;
  --accent: #b3121f;
  --accent-fg: #ffffff;
  --hit-line: rgba(0, 0, 0, 0.075);
  --mark: rgba(230, 40, 50, 0.2);
  --selection: rgba(0, 0, 0, 0.13);
  --active-line: rgba(0, 0, 0, 0.025);
  --added: rgba(179, 18, 31, 0.12);
  --danger: #8f1a1a;
  --ok: #3d7a35;
  --alert: #e00000;
  --liked-bg: #e9f3e4;
  --liked-border: #b5d3aa;
  --avoided-bg: #f8e9e6;
  --avoided-border: #e3bbb3;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --round: 0.3;
  --line: 1.3;
  --line-text: 1.4;
  color-scheme: light;
}

/* Light unless the theme menu at the bottom left picks dark (theme.js sets it before the page is drawn). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131313;
  --panel: #1b1b1b;
  --panel-2: #2c2c2c;
  --fg: #f2f2f2;
  --muted: #d4d4d4;
  --faint: #adadad;
  --border: #5e5e5e;
  --accent: #f07474;
  --accent-fg: #160b0b;
  --hit-line: rgba(255, 255, 255, 0.09);
  --mark: rgba(255, 90, 90, 0.28);
  --selection: rgba(255, 255, 255, 0.16);
  --active-line: rgba(255, 255, 255, 0.03);
  --added: rgba(240, 116, 116, 0.16);
  --danger: #ee8a80;
  --ok: #8fcf84;
  --liked-bg: #1d2a1d;
  --liked-border: #3f5e3c;
  --avoided-bg: #2e1f1d;
  --avoided-border: #6a3e38;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14.5px/var(--line) var(--font);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 1px solid var(--border);
  border-radius: calc(6px * var(--round));
  padding: 2px 8px;
  cursor: pointer;
}
button:hover { background: var(--panel-2); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

input[type="search"] {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(6px * var(--round));
}

code { font-family: inherit; font-size: 0.92em; }

/* Text that stays on one line, cut short with an ellipsis. */
.task-tab > .name, .dir-name, #file-list .file, .hit-title, .hit-loc, .tune-label, .feedback-head .feedback-open, .path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#app {
  --default-w-tasks: 168px;
  --default-w-side: 360px;
  display: grid;
  grid-template-columns: var(--w-tasks, var(--default-w-tasks)) var(--w-side, var(--default-w-side)) minmax(0, var(--fr-reader, 1fr)) minmax(0, var(--fr-task, 1fr));
  height: calc(100vh - 26px);
}

/* ---- task tabs ---- */

#tasks {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 8px 14px;
}
.brand { font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.icon-btn { width: 28px; height: 28px; padding: 0; font-size: 18px; line-height: 1; }

#task-tabs {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 3px 6px 10px; /* room at the top for the first tab's focus outline */
  overflow-y: auto;
  flex: 1;
}
.tasks-hint { margin: 0; padding: 0 10px 8px 14px; }
.task-tab {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: calc(5px * var(--round));
}
.task-tab > .name {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: none;
  padding: 3px 8px;
  color: var(--muted);
  background: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-tab > .rename {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--fg);
  padding: 2px 7px;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: calc(5px * var(--round));
}
.task-tab:hover { background: var(--panel-2); }
.task-tab.active { background: var(--panel-2); }
.task-tab.active > .name { color: var(--fg); font-weight: 600; }
/* The delete button shows on hover, over the end of the name, which then ends sooner. */
.task-x {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  padding: 0 7px;
  border: none;
  border-radius: 0 calc(5px * var(--round)) calc(5px * var(--round)) 0;
  background: var(--panel-2);
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
}
.task-x:hover { background: var(--panel-2); font-weight: 700; }
.task-tab:hover > .task-x { display: flex; }
.task-tab:hover > .name { padding-right: 26px; }
.task-tab:has(> .rename) > .task-x, body.dragging-task .task-x { display: none; }
.task-tab.dragging { opacity: 0.45; }
/* The tab that follows the mouse while it is dragged. Its box is see-through and its text isn't. */
.task-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-radius: calc(5px * var(--round));
  background: color-mix(in srgb, var(--panel-2) 50%, transparent);
  color: var(--fg);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.task-ghost.active { font-weight: 600; }
/* Where the dragged tab would go. */
.drop-line {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: calc(1px * var(--round));
  background: var(--fg);
  pointer-events: none;
}
body.dragging-task, body.dragging-task * { cursor: grabbing !important; user-select: none; }
.tasks-empty { color: var(--faint); padding: 8px 10px; font-size: 13.5px; }

/* ---- side panels ---- */

#side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}
/* As tall as the reader's and the task's headers, so their bottom lines meet. */
.side-head { display: flex; align-items: stretch; gap: 8px; height: 38px; flex: none; padding: 0 10px; border-bottom: 1px solid var(--border); }
.side-tabs { display: flex; gap: 4px; }
.side-tabs button {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 2px 10px 0;
  color: var(--muted);
}
.side-tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.panel { display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow-y: scroll; min-height: 0; flex: 1; }

.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-box { position: relative; flex: 1; min-width: 0; }
#search-history {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 60vh;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(6px * var(--round));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.history-head { padding: 2px 10px 4px; color: var(--faint); font-size: 12.5px; }
.history-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; cursor: pointer; }
.history-item:hover, .history-item[aria-selected="true"] { background: var(--panel-2); }
.history-query { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-forget { flex: none; border: none; padding: 0 6px; color: var(--faint); visibility: hidden; }
.history-forget:hover { color: var(--fg); background: none; }
.history-item:hover .history-forget, .history-item[aria-selected="true"] .history-forget { visibility: visible; }
.folder-picks { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.tree { display: flex; flex-direction: column; padding: 4px 10px 8px; }
.tree-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 6px; padding: 1px 0; font-size: 13px; color: var(--muted); }
.tree-row > input { margin: 0; accent-color: var(--accent); cursor: pointer; }
.tree-row.depth-0 { color: var(--fg); font-weight: 600; }
.tree-row.depth-0 + .tree-row.depth-0 { margin-top: 2px; }
.tree-row:has(> input:not(:checked):not(:indeterminate)) .tree-label { color: var(--faint); }
.tree-row.foldable { cursor: pointer; user-select: none; }
.tree-row.foldable:hover .tree-label { text-decoration: underline; text-decoration-color: var(--border); }
.tree-name { display: flex; align-items: center; gap: 2px; padding-left: calc(var(--depth) * 18px); min-width: 0; }
.tree-label { overflow-wrap: anywhere; }
.tree-fold { flex: none; width: 16px; padding: 0; border: none; background: none; color: var(--faint); font-size: 11px; line-height: 1.4; text-align: center; }
button.tree-fold { cursor: pointer; }
button.tree-fold:hover { color: var(--fg); }
.source-count { color: var(--faint); font-size: 11.5px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hint, .status-line { color: var(--faint); font-size: 12.5px; }
.status-line { font-variant-numeric: tabular-nums; }
.status-line strong { color: var(--fg); }
.as-typed { padding: 0; border: none; background: none; color: var(--accent); font-size: inherit; text-decoration: underline; }
.as-typed:hover { background: none; }
.related-bar { display: flex; gap: 8px; align-items: center; }
#related-refresh { flex: none; margin-left: auto; align-self: center; }
#related-refresh:not(:disabled), .meaning-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
#related-refresh:disabled, .meaning-btn:disabled { opacity: 0.5; cursor: default; }

#file-list { list-style: none; margin: 0; padding: 0; }
#file-list .folder { color: var(--faint); font-size: 12.5px; padding: 8px 4px 2px; }
#file-list .dir {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 100%;
  padding: 3px 6px;
  border: none;
  border-radius: calc(4px * var(--round));
  background: none;
  text-align: left;
}
#file-list .dir:not(:disabled) { cursor: pointer; }
#file-list .dir:not(:disabled):hover { background: var(--panel-2); }
#file-list .dir:disabled { cursor: default; opacity: 1; }
.dir-arrow { flex: none; width: 10px; color: var(--faint); font-size: 12px; }
.dir-name { font-weight: 500; }
.dir-count { margin-left: auto; flex: none; color: var(--faint); font-size: 12.5px; }
#file-list .file {
  padding: 3px 6px 3px 14px;
  border-radius: calc(4px * var(--round));
  cursor: pointer;
}
#file-list .file:hover { background: var(--panel-2); }
#file-list .file.current { background: var(--panel-2); color: var(--accent); }

/* ---- results (search and related) ---- */

.results { display: flex; flex-direction: column; gap: 6px; }
/* While newer results are on the way, the old ones fade under a veil of the page's colour. It comes
   after a moment, so a quick answer doesn't flicker, and clicks still reach the results below. */
.results, #related-terms { position: relative; }
.results::after, #related-terms::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.results.stale::after, #related-terms.stale::after { opacity: 0.6; transition-delay: 0.15s; }
.hit {
  border: 1px solid var(--border);
  border-radius: calc(8px * var(--round));
  padding: 7px 9px;
  cursor: pointer;
  background: var(--bg);
}
.hit:hover { border-color: var(--faint); }
.hit.opened { background: var(--panel-2); } /* the result last opened in the reader */
.hit-head { display: flex; gap: 6px; align-items: baseline; }
.hit-title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}
.hit-title:hover { text-decoration-color: currentColor; }
/* Passages marked More like this and Less like this, until the next refresh. */
.hit.liked { background: var(--liked-bg); border-color: var(--liked-border); }
.hit.avoided { background: var(--avoided-bg); border-color: var(--avoided-border); }
.hit-actions { display: flex; gap: 4px; align-self: center; }
.hit-actions button { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font-size: 13px; background: var(--bg); }
.hit-actions button:hover { background: var(--panel-2); }
.hit-actions .add { color: var(--accent); border-color: var(--accent); }
.hit-actions .hit-menu-btn { color: var(--muted); padding: 1px 6px; }
.hit-actions .hit-menu-btn[aria-expanded="true"] { background: var(--panel-2); border-color: var(--faint); }

.icon { display: inline-flex; flex: none; }
.icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-more svg, .icon-less svg { stroke-width: 2.6; }
.icon circle { fill: currentColor; stroke: none; }

/* A result's menu. */
.hit-menu {
  position: fixed;
  z-index: 1000;
  min-width: 210px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(8px * var(--round));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: calc(5px * var(--round));
  text-align: left;
  font-size: 13.5px;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.menu-item .menu-label { flex: 1; }
.menu-item .icon-more { color: var(--ok); }
.menu-item .icon-less, .menu-item .icon-hide, .menu-item .icon-doc { color: var(--danger); }
.menu-item .icon-check { color: var(--accent); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
:root[data-theme="dark"] .hit-menu { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.hit-loc { color: var(--faint); font-size: 12.5px; }
.hit-body { margin-top: 4px; font-size: 14px; }
.hit-body p { margin: 0 0 4px; overflow-wrap: anywhere; text-align: justify; }
.hit-body .line.ctx { color: var(--faint); }
.hit-body mark { background: var(--mark); color: inherit; border-radius: calc(2px * var(--round)); }
.hit-why { color: var(--faint); font-size: 12px; margin-top: 4px; }

.lane { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lane h3 { margin: 6px 0 0; font-size: 14px; display: flex; gap: 6px; align-items: baseline; }
.lane h3 .count { color: var(--faint); font-weight: 400; }
.lane h3 .took { color: var(--faint); font-weight: 400; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lane h3 .took::before { content: "· "; }
.results.stale .took { position: relative; z-index: 1; }  /* counts live above the fade */
.lane-desc, .lane-note, .feedback-note { margin: 0; color: var(--faint); font-size: 12.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: calc(999px * var(--round));
  overflow: hidden;
  font-size: 12.5px;
  background: color-mix(in srgb, var(--accent) calc(var(--w, 0) * 22%), var(--bg));
}
.chip button { border: none; border-radius: 0; padding: 1px 6px; background: none; }
.chip button:focus-visible { outline-offset: -2px; } /* inside the chip, which cuts off what is outside it */
.chip > span.chip-label { padding: 1px 2px 1px 7px; }
.chip .chip-x { color: var(--faint); padding: 1px 5px 1px 2px; }
.chip.boosted { border-color: var(--accent); }
.chip.boosted .chip-label::before { content: "↑ "; color: var(--accent); }
.chip.ignored { background: none; }
.chip.ignored .chip-label { text-decoration: line-through; color: var(--faint); }
.steer-row { display: flex; flex-direction: column; gap: 4px; }
.steer-row input { font: 13px var(--font); padding: 5px 8px; }
.steer-error { color: var(--danger); font-size: 12.5px; }

/* ---- tunable parameters ---- */

.tune { border: 1px solid var(--border); border-radius: calc(8px * var(--round)); background: var(--panel); flex: none; }
.tune > summary { display: flex; align-items: flex-start; gap: 6px; cursor: pointer; padding: 6px 10px; font-size: 13.5px; color: var(--muted); user-select: none; list-style: none; }
.tune > summary::-webkit-details-marker { display: none; }
.tune > summary::before { content: "▸"; flex: none; }
.tune[open] > summary::before { content: "▾"; }
.tune-title { flex: 1; min-width: 0; }
.tune-reset { flex: none; padding: 0 6px; font-size: 12px; color: var(--fg); }
.tune-reset:disabled { opacity: 0.5; cursor: default; }
.tune[open] > summary { border-bottom: 1px solid var(--border); }
.tune-count { color: var(--accent); }
.llm-help { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }  /* the same space under the title's line as under Generate */
.llm-help textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  min-height: 4.6em;
  padding: 6px 8px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(6px * var(--round));
}
.llm-help textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.llm-row { display: flex; gap: 8px; align-items: center; }
.llm-generate { flex: none; }
.llm-generate:disabled { opacity: 0.5; cursor: default; }
.llm-help::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--panel);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.llm-help.busy::after { opacity: 0.6; pointer-events: auto; cursor: progress; }
.llm-status { position: relative; z-index: 1; }  /* the time counts above the fade */
.help-body { padding: 2px 12px 10px; max-height: 60vh; overflow-y: auto; font-size: 13px; line-height: var(--line-text); color: var(--fg); }
.help-body h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.help-body p { margin: 0 0 8px; }
.help-body ul { margin: 0 0 8px; padding-left: 18px; }
.help-body li { margin: 3px 0; }
.help-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; padding: 0 3px; border-radius: calc(3px * var(--round)); background: var(--panel-2); overflow-wrap: anywhere; }
.tune-body { padding: 2px 10px 10px; display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; }
.tune-group { margin-top: 8px; font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg); }
.meaning-btn { flex: none; font-size: 13.5px; }
.tune-default { padding: 0 4px; font-size: 12px; white-space: nowrap; }
.tune-row:not(.changed) .tune-default { visibility: hidden; }
.tune-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 34px max-content; align-items: center; gap: 8px; font-size: 13px; }
.tune-label { white-space: normal; overflow: visible; }
/* In a narrow panel a slider's name goes on a line of its own, above the slider, where it has room. */
.tune-body { container-type: inline-size; }
@container (max-width: 300px) {
  .tune-row { grid-template-columns: minmax(0, 1fr) 34px max-content; row-gap: 0; }
  .tune-row .tune-label { grid-column: 1 / -1; }
  .tune-row select { grid-column: 1 / 3; }
}
/* The red fill runs to the middle of the handle, so the handle and the fill read as one shape. */
.tune-row input[type="range"] {
  --thumb: 12px;
  --track: 6px;
  --to: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--fill, 0));
  position: relative;
  top: var(--slider-shift, 0px); /* set by levelSliders in app.js */
  width: 100%;
  height: var(--thumb);
  margin: 0;
  background: none;
  appearance: none;
  cursor: pointer;
}
.tune-row input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track);
  border: 1px solid transparent;
  border-radius: calc(var(--track) / 2);
  background:
    linear-gradient(to right, var(--accent) var(--to), transparent 0) border-box,
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(var(--faint), var(--faint)) border-box;
}
.tune-row input[type="range"]::-webkit-slider-thumb {
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - 2px - var(--thumb)) / 2);
  border: none;
  border-radius: 50%;
  background: var(--accent);
  appearance: none;
}
.tune-row input[type="range"]::-moz-range-track { box-sizing: border-box; height: var(--track); border: 1px solid var(--faint); border-radius: calc(var(--track) / 2); background: var(--bg); }
.tune-row input[type="range"]::-moz-range-progress { height: var(--track); border-radius: calc(var(--track) / 2) 0 0 calc(var(--track) / 2); background: var(--accent); }
.tune-row input[type="range"]::-moz-range-thumb { width: var(--thumb); height: var(--thumb); border: none; border-radius: 50%; background: var(--accent); }
.tune-row select { grid-column: 2 / 4; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--border); border-radius: calc(4px * var(--round)); }
.tune-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
/* A thin outline thickens the letters without widening them, as bold would, so the label doesn't wrap differently. */
.tune-row.changed .tune-label, .tune-row.changed output { color: var(--accent); -webkit-text-stroke: 0.04em currentColor; }

/* ---- feedback drawer ---- */

.feedback-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feedback-item { border-left: 2px solid var(--border); padding-left: 8px; }
.feedback-head { display: flex; gap: 6px; align-items: baseline; }
.feedback-head button { padding: 0 7px; font-size: 12.5px; }
.feedback-head .feedback-open {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0;
  text-align: left;
  color: var(--muted);
}
.feedback-head .feedback-open:hover { background: none; color: var(--accent); }
.feedback-text { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.feedback-tag { color: var(--danger); font: 12px var(--font); margin-right: 6px; }
.feedback-steer { display: block; font-size: 12.5px; color: var(--fg); overflow-wrap: anywhere; }

/* ---- resizable panes ---- */

#tasks, #side, #reader { position: relative; }
.resizer { position: absolute; top: 0; right: -8px; width: 8px; height: 100%; cursor: col-resize; z-index: 5; outline: none; }
.resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; }
.resizer:hover::after, .resizer:focus-visible::after, .resizer.dragging::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }

/* ---- reader and task panes ---- */

#reader, #task { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#reader { border-right: 1px solid var(--border); }
.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex: none;
}
.path { flex: 1; min-width: 0; color: var(--muted); }
#task-name { color: var(--fg); font-weight: 600; }
.save-state { color: var(--faint); font-size: 12.5px; }
.save-state[data-state="failed"] { color: var(--accent); } /* not on disk, and not about to be: not to be missed */
.add-btn { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.add-btn:hover { background: var(--accent); filter: brightness(1.1); }
.editor { flex: 1; min-height: 0; }
.banner {
  padding: 8px 12px;
  background: color-mix(in srgb, var(--danger) 14%, var(--bg));
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#statusbar {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
}
#flash { margin-left: auto; color: var(--accent); }
#statusbar { gap: 8px; }
/* How wide a browser draws a <select> and where it puts the arrow differ between browsers, and the
   arrow can cover the end of the name. So the visible box is ordinary text, the chosen name and an
   arrow pointing up (the menu opens upward), and the real <select> lies invisibly on top of it to
   take clicks and keys. The box is as wide as its text in every browser. */
.status-pick {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 19px;
  padding: 0 6px 0 5px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(4px * var(--round));
  cursor: pointer;
}
.status-pick[hidden] { display: none; }
.status-pick.status-name { padding-right: 5px; cursor: default; }
.status-pick.status-name::after, .status-pick.status-name select { display: none; }
.status-pick::after { content: ""; border: 4px solid transparent; border-top-width: 0; border-bottom-color: currentColor; }
.status-pick:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.status-pick select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; font: inherit; cursor: pointer; }
#statusbar.update-ready .status-pick { color: var(--fg); }
#statusbar { position: relative; }
#statusbar.update-ready { background: var(--alert); border-top-color: var(--alert); color: #fff; }
#statusbar.update-ready #flash { color: #fff; }
#reload-page {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: var(--alert);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
#reload-page:hover:not(:disabled) { background: var(--alert); text-decoration: underline; }
#reload-page:focus-visible { outline-color: #fff; outline-offset: -3px; }
#index-size { margin-left: 16px; white-space: nowrap; }

@media (max-width: 1100px) {
  #app { --default-w-tasks: 140px; --default-w-side: 300px; }
}

@media (max-width: 860px) {
  #app { display: flex; flex-direction: column; height: auto; }
  .resizer { display: none; }
  #tasks { max-height: 160px; }
  #side { max-height: 60vh; }
  #reader, #task { height: 70vh; }
}

/* Scrollbars stay visible: this replaces the overlay kind that fades away. A browser without these
   selectors (Firefox) gets its own, which on some systems still fades, as set in the system. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  min-height: 40px;
  border: 3px solid transparent;
  border-radius: calc(6px * var(--round));
  background: var(--faint) content-box;
}
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background: var(--muted) content-box; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: var(--faint) transparent; }
}

/* Find in a pane (Ctrl/⌘+F). */
.find-panel { display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--border); }
.find-panel input { flex: 1; min-width: 60px; max-width: 320px; padding: 3px 7px; font: inherit; font-size: 13.5px; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: calc(4px * var(--round)); }
.find-panel button { padding: 1px 8px; font-size: 13px; }
.find-count { min-width: 64px; padding: 0 4px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.find-count.none { color: var(--fg); font-weight: 600; }
.cm-panels { background: var(--panel) !important; color: var(--fg) !important; border: none !important; }
#reader .cm-searchMatch, #task .cm-searchMatch { background: color-mix(in srgb, var(--accent) 22%, transparent); outline: none; border-radius: calc(2px * var(--round)); }
#reader .cm-searchMatch-selected, #task .cm-searchMatch-selected { background: color-mix(in srgb, var(--accent) 55%, transparent); outline: 1px solid var(--accent); }

/* Presets of a panel's settings. */
.preset-bar { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.preset-bar label { color: var(--muted); }
.preset-bar select { flex: 1; min-width: 0; padding: 2px 4px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: calc(4px * var(--round)); }
.preset-bar button { flex: none; padding: 1px 8px; font-size: 12.5px; }
.preset-bar button:disabled { opacity: 0.5; cursor: default; }
