:root {
  color-scheme: light;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1b2130;
  --muted: #697386;
  --faint: #a2a9b6;
  --accent: #3d5afe;
  --accent-hover: #2f4ae0;
  --accent-soft: #eaeeff;
  --accent-text: #ffffff;
  --add-bg: #e3f5e8;
  --add-bar: #2da44e;
  --chg-bg: #fff3cf;
  --chg-bar: #d4a72c;
  --rm-bg: #fde8ea;
  --rm-bar: #e5484d;
  --rm-text: #b4232a;
  --dup-bg: #efe7ff;
  --dup-bar: #8250df;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 10px;
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --code-font: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #161a22;
    --surface-2: #1b2029;
    --surface-3: #232935;
    --border: #262c37;
    --border-strong: #353c4a;
    --text: #e4e7ee;
    --muted: #97a0b1;
    --faint: #5d6677;
    --accent: #7b93ff;
    --accent-hover: #93a6ff;
    --accent-soft: rgba(123, 147, 255, .16);
    --accent-text: #0e1116;
    --add-bg: rgba(46, 160, 67, .17);
    --add-bar: #3fb950;
    --chg-bg: rgba(210, 153, 34, .17);
    --chg-bar: #d29922;
    --rm-bg: rgba(248, 81, 73, .15);
    --rm-bar: #f85149;
    --rm-text: #ff8b84;
    --dup-bg: rgba(163, 113, 247, .17);
    --dup-bar: #a371f7;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161a22;
  --surface-2: #1b2029;
  --surface-3: #232935;
  --border: #262c37;
  --border-strong: #353c4a;
  --text: #e4e7ee;
  --muted: #97a0b1;
  --faint: #5d6677;
  --accent: #7b93ff;
  --accent-hover: #93a6ff;
  --accent-soft: rgba(123, 147, 255, .16);
  --accent-text: #0e1116;
  --add-bg: rgba(46, 160, 67, .17);
  --add-bar: #3fb950;
  --chg-bg: rgba(210, 153, 34, .17);
  --chg-bar: #d29922;
  --rm-bg: rgba(248, 81, 73, .15);
  --rm-bar: #f85149;
  --rm-text: #ff8b84;
  --dup-bg: rgba(163, 113, 247, .17);
  --dup-bar: #a371f7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

@font-face {
  font-family: "Parisienne";
  src: url("fonts/parisienne.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

code { font-family: var(--code-font); font-size: .92em; }

svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

h1, h2, h3 { margin: 0; }

/* Buttons and inputs */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 500 13px var(--ui-font);
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, .code:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; }
.btn.danger { color: var(--rm-text); }
.btn.danger:hover:not(:disabled) { background: var(--rm-bg); border-color: var(--rm-bar); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.tiny { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.large { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.icon-btn { padding: 0; width: 32px; justify-content: center; font-size: 18px; line-height: 1; }
.btn.tiny.icon-btn { width: 24px; font-size: 16px; }
.btn.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.check.compact { font-size: 12px; color: var(--muted); gap: 5px; align-items: center; white-space: nowrap; }
.check.compact input { margin: 0; }
.check input { flex: none; margin: 2px 0 0; accent-color: var(--accent); width: 14px; height: 14px; }
.muted { color: var(--muted); }

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.brand .tagline {
  margin-left: 3px;
  font: 400 21px "Parisienne", "Segoe Script", cursive;
  letter-spacing: 0;
  color: var(--accent);
}
.actions { display: flex; align-items: center; gap: 6px; }

/* The views, like in TeX Tools, and folding the unchanged entries */
.view-controls { display: flex; align-items: center; gap: 6px; }
body:not(.has-files) .view-controls { display: none; }
.segmented.views label > span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; }
.segmented.views .view-label { display: inline; padding: 0; }
.views svg { width: 14px; height: 14px; }
body.view-original .workspace, body.view-preview .workspace { grid-template-columns: minmax(0, 1fr); }
body.view-original #pane-preview, body.view-preview #pane-original,
body.view-original .gutter, body.view-preview .gutter { display: none; }

/* Search in both panes */
.search {
  flex: 0 1 360px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 32px;
  padding: 0 3px 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
body:not(.has-files) .search { display: none; }
.search > svg { width: 15px; height: 15px; }
.search input { flex: 1; min-width: 60px; height: 100%; padding: 0 6px; border: 0; outline: 0; background: transparent; color: var(--text); font: 13px var(--ui-font); }
/* The clear button of the browser is replaced by one that all browsers show */
.search input::-webkit-search-cancel-button { appearance: none; }
.search-count { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.search-count.none { color: var(--rm-text); }
.search .icon-btn { width: 24px; height: 24px; color: var(--muted); }
/* Show only the entries that match, or all of them */
.search-filter {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 24px;
  margin-left: 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.search-filter:hover { background: var(--surface-3); color: var(--text); }
.search-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-filter[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.search-filter svg { width: 17px; height: 17px; }
.search .icon-btn svg { width: 15px; height: 15px; }
/* While searching, only the entries that match, with a blank line between
   them, and the files with them */
.content.filtering > .l,
.content.filtering > .src > .l:not(.src-head),
.content.filtering .entry:not(.match),
.content.filtering > .src:not(.has-match) { display: none; }
.content.filtering .entry.match { margin-bottom: 1.6em; }
/* The search shows the folded entries that match, without the folds */
.content.filtering .folded { display: contents; }
.content.filtering .folded > .l { display: none; }
.search-empty { margin: 0; padding: 24px 16px; color: var(--muted); font: 13px var(--ui-font); text-align: center; }
/* Words that match the search */
.code mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; }


/* Layout: the settings on the left of the panes */

.layout { flex: 1; min-height: 0; display: flex; }

.sidebar {
  display: none;
  flex: none;
  flex-direction: column;
  width: 348px;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
body.settings-shown .sidebar { display: flex; }
/* The whole head hides the settings, like the bar shows them */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.sidebar-head:hover { background: var(--surface-2); }
.sidebar-head h2 { flex: 1; font-size: 14px; font-weight: 650; }
.sidebar-head .icon-btn { color: var(--muted); }
.sidebar-head:hover .icon-btn { color: var(--text); }
.sidebar-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px 20px; }
/* The files at the top of the panel, which stand out from the settings */
.files-area {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}
.files-area .sec { border-bottom-color: color-mix(in srgb, var(--accent) 15%, var(--border)); }
.files-area .sec:last-child { border-bottom: 0; }
.files-area .sec h3 { color: var(--accent); }
.files-area .file-field { background: var(--surface); }
.file-row.wide .btn { flex: 1; justify-content: center; }
/* The bib files */
.file-list { display: flex; flex-direction: column; gap: 4px; }
.file-list .file-field > svg { width: 14px; height: 14px; color: var(--muted); }
.file-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* `0px`, not `0%`, so that the settings never make the page taller: they
   scroll by themselves, also in short windows */
.sidebar-body { flex: 1 1 0px; min-height: 0; overflow-y: auto; }
.backdrop { display: none; position: fixed; inset: 0; z-index: 29; background: rgba(10, 14, 22, .35); }

/* The hidden settings: a bar on the left, which opens them */
.rail {
  display: none;
  flex: none;
  width: 44px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  cursor: pointer;
}
body:not(.settings-shown) .rail { display: block; }
.rail:hover { background: var(--surface-2); }
.rail-button {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 12.5px var(--ui-font);
  cursor: pointer;
}
.rail:hover .rail-button { color: var(--text); }
.rail-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rail-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
}
.rail:hover .rail-icon { border-color: var(--accent); color: var(--accent); }
.rail-label { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .02em; }
.rail-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--dup-bar);
  color: #fff;
  font: 700 11px/18px var(--ui-font);
  text-align: center;
}

/* Settings */

.sec { display: flex; flex-direction: column; gap: 7px; padding: 12px 18px 14px; border-bottom: 1px solid var(--border); }
.sec:last-child { border-bottom: 0; }
.sec-head { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.sec h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sec .sum { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sec-head .btn { margin-left: auto; }
.sec .check { display: flex; }
/* A setting with an example below it */
.opt { display: flex; flex-direction: column; gap: 1px; }
.opt .hint { padding-left: 21px; }
.opt.off .hint, .opt.off .hint strong { color: var(--faint); }
/* A setting above the others of its section */
.opt.lead { padding-bottom: 8px; margin-bottom: 1px; border-bottom: 1px dashed var(--border); }
/* All rules of a setting with why, e.g., of converting the fields */
.rules { margin: 4px 0 0 21px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.rules summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  color: var(--accent);
  font-weight: 550;
  cursor: pointer;
  list-style: none;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.rules .chev { width: 13px; height: 13px; transition: transform .15s; }
.rules[open] .chev { transform: rotate(90deg); }
.rules[open] summary { border-bottom: 1px solid var(--border); }
.rules-body { display: flex; flex-direction: column; gap: 8px; max-height: 380px; padding: 8px 10px 10px; overflow-y: auto; }
.rules-body p { margin: 0; }
.rules-note { color: var(--text); }
.rules h4 { margin: 2px 0 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rules ul { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.rule-change { color: var(--text); }
.rule-why { color: var(--muted); }
.rules code { font-size: 11px; }
.rules-small { color: var(--muted); font-style: italic; }
.check.off { color: var(--faint); cursor: not-allowed; }
.check.off .online { color: var(--faint); background: none; }
.segmented label.off { cursor: not-allowed; }
.segmented label.off span { color: var(--faint); }
/* The output that the .bbl file sets */
.format-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}
.format-note svg { width: 13px; height: 13px; margin-top: 2px; color: var(--accent); }
/* Some conference papers have an abbreviation of their conference, and
   some do not. It opens the list of both. */
.conf-warning {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 4px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--chg-bar) 55%, transparent);
  border-radius: 7px;
  background: var(--chg-bg);
  color: var(--text);
  font: 12px/1.45 var(--ui-font);
  text-align: left;
  cursor: pointer;
}
.conf-warning:hover { border-color: var(--chg-bar); }
.conf-warning:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.conf-warning svg { width: 13px; height: 13px; margin-top: 2px; color: var(--chg-bar); }
.conf-warning-link { color: var(--accent); font-weight: 600; white-space: nowrap; }
.online {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 10.5px/17px var(--ui-font);
  white-space: nowrap;
}
.online svg { width: 11px; height: 11px; }
.indent { display: flex; flex-direction: column; gap: 6px; padding-left: 21px; margin-bottom: 4px; }
.file-row { display: flex; align-items: center; gap: 6px; }
.file-row .hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .btn.small { padding: 0 9px; }
.btn.small svg { width: 14px; height: 14px; }
.file-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 2px 2px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.hint.warn { color: var(--chg-bar); }
.hint strong { color: var(--text); font-weight: 600; }
.hint code { font-size: 11.5px; }
/* Keys that are not found, e.g., cited keys that are not in the bib files,
   scrolling after 3 rows */
.key-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 70px; overflow-y: auto; }
.key-list[hidden] { display: none; }
.key-list code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--chg-bg);
  color: var(--text);
  font: 11.5px/18px var(--code-font);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.option-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.option-row .segmented { flex: 1; }
.option-label { font-size: 13px; white-space: nowrap; }

/* Reviewing duplicates, with the decided pairs */
.review {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 7px 10px 8px;
  border: 1px solid color-mix(in srgb, var(--dup-bar) 40%, var(--border));
  border-radius: 8px;
  background: var(--dup-bg);
  color: color-mix(in srgb, var(--dup-bar) 72%, var(--text));
  font: 600 12.5px var(--ui-font);
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.review:hover { border-color: var(--dup-bar); }
.review:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.review.todo { background: var(--surface); }
.review-row { display: flex; align-items: center; gap: 7px; }
.review-row svg { width: 14px; height: 14px; }
.review-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.review-bar { display: block; height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--dup-bar) 20%, transparent); overflow: hidden; }
.review-fill { display: block; height: 100%; border-radius: inherit; background: var(--dup-bar); transition: width .2s; }
.review.done { border-color: color-mix(in srgb, var(--add-bar) 45%, var(--border)); background: var(--add-bg); color: color-mix(in srgb, var(--add-bar) 70%, var(--text)); }
.review.done:hover { border-color: var(--add-bar); }
.review.done .review-bar { background: color-mix(in srgb, var(--add-bar) 22%, transparent); }
.review.done .review-fill { background: var(--add-bar); }

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: text;
}
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding: 0 2px 0 8px;
  border-radius: 6px;
  background: var(--surface-3);
  font: 12px var(--code-font);
}
.tag.used { background: var(--rm-bg); color: var(--rm-text); }
.tag button { border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; }
.tag button:hover { opacity: 1; }
.tags input { flex: 1; min-width: 90px; height: 22px; border: 0; outline: 0; background: transparent; color: var(--text); font: 12.5px var(--ui-font); }

.segmented { display: flex; padding: 3px; border-radius: 8px; background: var(--surface-3); }
.segmented label { flex: 1; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 4px 6px; border-radius: 6px; text-align: center; font-size: 12.5px; color: var(--muted); white-space: nowrap; transition: all .12s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* Workspace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  padding: 12px 16px 10px;
}

/* Between the panes: the toggle for linked scrolling */
.gutter { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gutter::before, .gutter::after { content: ""; flex: 1; width: 1px; background: var(--border); }
.gutter.linked::before, .gutter.linked::after { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }
body:not(.has-files) .gutter { display: none; }
.link-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .12s;
}
.link-toggle:hover { color: var(--text); border-color: var(--accent); }
.link-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.link-toggle[aria-pressed="true"] .icon-unlinked,
.link-toggle[aria-pressed="false"] .icon-linked { display: none; }

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pane-head h2 { font-size: 13px; font-weight: 650; }
.pane-head .meta { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 4px; }
.sw.add { background: var(--add-bar); }
.sw.chg { background: var(--chg-bar); }
.sw.rm { background: var(--rm-bar); }

.code {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  position: relative;
  padding: 6px 0 24px;
  font: 12.5px/1.6 var(--code-font);
  tab-size: 4;
}
.code.small { font-size: 12px; padding: 4px 0; }

.l { display: flex; padding-right: 12px; border-left: 3px solid transparent; }
.l .n {
  flex: none;
  width: 3.6em;
  padding-right: 1.1em;
  text-align: right;
  color: var(--faint);
  user-select: none;
}
.l .t { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.l.add { background: var(--add-bg); border-left-color: var(--add-bar); }
.l.chg { background: var(--chg-bg); border-left-color: var(--chg-bar); }
.l.rm { background: var(--rm-bg); border-left-color: var(--rm-bar); }
.l.rm .t { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--rm-bar) 60%, transparent); }
.l.sep .t { color: var(--muted); font-family: var(--ui-font); font-size: 12px; font-weight: 600; }
.l.sep { margin: 10px 0 4px; padding: 3px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.content > .src:first-child > .l.sep { margin-top: -6px; border-top: 0; }
/* The name of a file stays at the top while its entries are shown. It sticks
   above the padding of the pane, which is not covered otherwise. */
.src-head { position: sticky; top: -6px; z-index: 2; cursor: pointer; }
.src-head:hover .src-name { color: var(--text); }
.src-head svg { width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; }

.entry { position: relative; cursor: pointer; }
.entry:hover { background: color-mix(in srgb, var(--surface-3) 55%, transparent); }
.entry.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.entry.gone { background: var(--rm-bg); }
.entry.gone .l { border-left-color: var(--rm-bar); }
.entry.gone .t { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--rm-bar) 60%, transparent); }
/* A run of unchanged entries that is folded. A fold is three lines high, so
   that it stands out from the lines. */
.folded { display: none; }
.l.fold {
  align-items: center;
  height: 4.8em;
  border-block: 2px solid var(--surface);
  background: var(--surface-3);
  background-clip: padding-box;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.l.fold .n { display: flex; justify-content: flex-end; color: inherit; }
.l.fold .n svg { width: 14px; height: 14px; }
.l.fold .t { font: 500 12px var(--ui-font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l.fold:hover { background: color-mix(in srgb, var(--surface-3) 55%, var(--border-strong)); color: var(--text); }
.l.fold:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Possible duplicates are marked without hiding the highlighted changes */
.entry.dup .l:not(.add):not(.chg):not(.rm) { border-left-color: var(--dup-bar); }

/* Badges move to a row below the text when they do not fit next to it,
   instead of squeezing the key */
.l.has-badges { flex-wrap: wrap; }
.l.has-badges .t { flex: 1 1 auto; max-width: calc(100% - 3.6em); }
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: flex-start;
  gap: 4px;
  margin: 2px 0 0 auto;
  padding-left: 8px;
}
.badge {
  flex: none;
  align-self: flex-start;
  padding: 0 7px;
  border-radius: 999px;
  font: 600 10.5px/17px var(--ui-font);
  letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none;
}
.badge.rm { background: var(--rm-bar); color: #fff; }
.badge.chg { background: var(--chg-bar); color: #1b1300; }
.badge.dup { background: var(--dup-bar); color: #fff; cursor: pointer; }
.badge.err { background: var(--rm-bar); color: #fff; }
.badge.cited { margin: 0 0 0 4px; background: var(--accent); color: #fff; vertical-align: 1px; }

.overlay {
  position: absolute;
  inset: 41px 0 0 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(1px);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.overlay.show { display: flex; }
.overlay.error { color: var(--rm-text); }
.overlay.error .spinner { display: none; }
.overlay p { margin: 0; max-width: 460px; white-space: pre-wrap; }
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pane.busy .pane-head h2::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  vertical-align: -1px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* Empty state */

.empty { display: none; grid-column: 1 / -1; place-items: center; padding: 10px; overflow: auto; }
body:not(.has-files) .empty { display: grid; }
body:not(.has-files) .pane { display: none; }
.drop-card {
  max-width: 560px;
  width: 100%;
  padding: 44px 36px;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  transition: border-color .15s, background .15s;
}
body.dragging .drop-card { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 44px; height: 44px; color: var(--accent); stroke-width: 1.6; margin-bottom: 12px; }
.drop-card h1 { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.drop-card > p { margin: 8px auto 0; color: var(--muted); max-width: 400px; }
.drop-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.paste-hint { margin: 14px 0 0 !important; font-size: 12.5px; }
kbd {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 11.5px var(--code-font);
}
.privacy { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px !important; font-size: 12px; }
.privacy svg { width: 14px; height: 14px; }
.credit { margin: 10px 0 0 !important; font-size: 12px; }

body.has-files.dragging .workspace { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 14px; }

/* Status bar */

.status {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 34px;
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}
.status-left { white-space: nowrap; }
.status-left strong { color: var(--text); font-weight: 600; }
.status-messages { flex: 1; min-width: 0; display: flex; gap: 14px; overflow: hidden; }
.msg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.warning { color: var(--chg-bar); }
.msg.error { color: var(--rm-text); }
.msg svg { width: 14px; height: 14px; }
.msg button { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.credits { display: flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; font-size: 12px; }
.credit a, .about-small a, .credit-link span {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 2px;
}
.credit a, .about-small a { color: inherit; }
.credit a:hover, .about-small a:hover, .credit-link:hover { color: var(--accent); }
.credit-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.credit-link svg { width: 13px; height: 13px; }
svg.icon-fill { fill: currentColor; stroke: none; }
.status-right { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chg-bar); }
.dot.ready { background: var(--add-bar); }
.dot.error { background: var(--rm-bar); }

/* Dialog */

.dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(10, 14, 22, .45); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px 20px; }
.dialog-head h2 { font-size: 16px; font-weight: 650; }
.dialog-head .meta { flex: 1; color: var(--muted); font-size: 13px; }
.dialog > .hint { padding: 0 20px 12px; }
.dup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 20px; min-height: 0; flex: 1; }
.dup-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, background .15s;
}
.dup-side header { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.dup-side .dup-id { font-family: var(--code-font); font-size: 12.5px; }
.dup-state { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dup-side .code { max-height: 46vh; border-radius: 6px; background: var(--surface-2); }
.dup-side.removed { border-color: var(--rm-bar); background: var(--rm-bg); }
.dup-side.removed .dup-state { color: var(--rm-text); }
.dup-side.removed .code .t { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--rm-bar) 60%, transparent); }
.dup-side.kept { border-color: var(--add-bar); }
.dup-side.kept .dup-state { color: var(--add-bar); }
.dup-side .l.only { background: var(--dup-bg); border-left-color: var(--dup-bar); }
.dialog > .dup-note { padding: 10px 20px 0; color: var(--text); }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 18px; }
.about-dialog { width: min(580px, calc(100vw - 32px)); }
.about-body { display: flex; flex-direction: column; gap: 14px; padding: 6px 20px 22px; overflow: auto; }
.about-body p { margin: 0; }
.about-links { display: grid; gap: 8px; }
.about-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .12s, background .12s;
}
.about-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.about-link svg { width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.about-link strong { display: block; font: 600 13px var(--code-font); }
.about-link small { display: block; font-size: 12.5px; color: var(--muted); }
.about-small { font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.dialog-foot .hint { color: var(--rm-text); }
.confirm-dialog { width: min(520px, calc(100vw - 32px)); }
.conf-dialog { width: min(900px, calc(100vw - 32px)); }
.conf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; padding: 0 20px; overflow: auto; }
.conf-side { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.conf-side h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.conf-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.conf-list p { margin: 0; }
.conf-venue { font-size: 13px; }
.conf-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px !important; }
.conf-key {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font: 12px var(--code-font);
  cursor: pointer;
}
.conf-key:hover { border-color: var(--accent); color: var(--accent); }
.conf-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.confirm-body { display: flex; flex-direction: column; gap: 10px; padding: 6px 20px 0; font-size: 13.5px; line-height: 1.55; }
.confirm-body p { margin: 0; }
.confirm-body code { font-size: 12.5px; }
.paste-dialog { width: min(820px, calc(100vw - 32px)); }
.paste-dialog .dialog-head { flex-wrap: wrap; row-gap: 2px; }
.paste-dialog .dialog-head .meta { order: 3; flex-basis: 100%; }
.paste-dialog .dialog-head .icon-btn { margin-left: auto; }
#paste-text {
  display: block;
  width: calc(100% - 40px);
  height: min(52vh, 460px);
  margin: 8px 20px 0;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: 12.5px/1.55 var(--code-font);
  tab-size: 4;
}
#paste-text:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.spacer { flex: 1; }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  transform: translate(-50%, 12px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Smaller screens */

/* The search is the first to move to a second row, before it gets too
   narrow, and then the views show only their icons */
@media (max-width: 1220px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .search { order: 5; flex: 1 1 100%; }
}
@media (max-width: 960px) {
  .segmented.views .view-label { display: none; }
}
/* The settings open over the panes, with the bar on the left */
@media (max-width: 1100px) {
  .rail { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(360px, 100vw);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-body { overscroll-behavior: contain; }
  body.settings-overlay .backdrop { display: block; }
  .legend { display: none; }
}
/* Small windows scroll the page instead of squeezing the panes */
@media (max-width: 1100px), (max-height: 760px) {
  body { height: auto; min-height: 100%; }
  .layout { flex: 1 0 auto; }
  .pane { height: max(420px, calc(100vh - 110px)); }
  .empty { padding-bottom: 24px; }
}
@media (max-width: 900px) {
  .status { flex-wrap: wrap; row-gap: 2px; }
  .credits { order: 3; flex-basis: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .gutter { flex-direction: row; }
  .gutter::before, .gutter::after { width: auto; height: 1px; }
  .pane { height: max(360px, 75vh); }
}
@media (max-width: 700px) {
  .actions .btn:not(.primary):not(.icon-btn) { padding: 0 8px; }
  .dup-grid, .conf-grid { grid-template-columns: 1fr; }
  .pane-head { flex-wrap: wrap; row-gap: 4px; }
  .drop-card { padding: 32px 20px; }
  .drop-actions { flex-direction: column; }
  .drop-actions .btn { justify-content: center; }
}
