/* ==========================================================================
   ACME Semantic Search - demo UI
   Light and dark palettes are both defined on tokens; nothing is themed inline.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --border-strong: #c6ccd4;
  --text: #14181d;
  --text-muted: #5d6875;
  --text-faint: #8a94a1;
  --accent: #1f5fa8;
  --accent-hover: #17497f;
  --accent-soft: #e8f0fa;
  --high: #1a7f4f;
  --high-soft: #e4f4ec;
  --medium: #a8700a;
  --medium-soft: #fbf1de;
  --low: #a03535;
  --low-soft: #fbe9e9;
  --flag: #a03535;
  --code-bg: #f2f4f7;
  --shadow: 0 1px 2px rgba(20, 24, 29, .06), 0 4px 12px rgba(20, 24, 29, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f1215;
  --surface: #171b20;
  --surface-2: #1e242b;
  --border: #2a3138;
  --border-strong: #3a434c;
  --text: #e8ebee;
  --text-muted: #a2acb7;
  --text-faint: #77828e;
  --accent: #6aa5e8;
  --accent-hover: #8ab9ef;
  --accent-soft: #17293d;
  --high: #57c08a;
  --high-soft: #14291f;
  --medium: #d9a63f;
  --medium-soft: #2b2416;
  --low: #e08383;
  --low-soft: #2c1a1a;
  --flag: #e08383;
  --code-bg: #12161a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.01em; }
h1 { font-size: 1.05rem; }
h2 { font-size: .95rem; }
code { font-family: var(--mono); font-size: .86em; }
a { color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------- top bar --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent);
}
.brand-sub {
  margin: 1px 0 0; font-size: .78rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.pill {
  font-size: .74rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.pill.ok { background: var(--high-soft); color: var(--high); border-color: transparent; }
.pill.bad { background: var(--low-soft); color: var(--low); border-color: transparent; }

/* --------------------------------------------------------------- buttons --- */
.btn-primary, .btn-ghost, .btn-link {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn-primary {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 9px 20px; font-weight: 580;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: .55; cursor: progress; }
.btn-ghost {
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); padding: 6px 12px;
  font-size: .82rem; text-decoration: none; display: inline-block;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-ghost.btn-compact { padding: 3px 9px; font-size: .76rem; }
.btn-link {
  background: none; border: 0; color: var(--accent); padding: 0;
  font-size: .84rem; text-decoration: underline; text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ tabs --- */
.tabs {
  display: flex; gap: 2px; padding: 0 24px; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 63px; z-index: 19;
}
.tab {
  font: inherit; font-size: .87rem; font-weight: 540; cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-muted); padding: 11px 14px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 22px 24px 72px; }
.panel { display: none; }
.panel.is-active { display: block; }

/* ----------------------------------------------------------------- cards --- */
.card, .search-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.muted { color: var(--text-muted); margin: 0 0 12px; font-size: .87rem; }
.small { font-size: .8rem; }

/* ---------------------------------------------------------------- search --- */
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1; min-width: 0; font: inherit; padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.search-row input:focus-visible,
.filters input:focus-visible, .filters select:focus-visible,
.inline-form input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.search-meta {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 12px; font-size: .84rem; color: var(--text-muted);
}
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
/* Author `display` above outranks the UA `[hidden] { display: none }`. */
.switch[hidden] { display: none; }
.switch input { accent-color: var(--accent); margin: 0; }

.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
/* `display: grid` above is an author rule, so it beats the UA stylesheet's
   `[hidden] { display: none }`. Without this the panel is permanently visible
   and the "Advanced filters" toggle appears to do nothing. */
.filters[hidden] { display: none; }
.filters label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: .78rem; font-weight: 580; color: var(--text-muted);
}
.filters input, .filters select {
  font: inherit; font-size: .87rem; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.filters .span-2 { grid-column: span 2; flex-direction: row; align-items: center; }

.examples { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chip {
  font: inherit; font-size: .79rem; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
  text-align: left;
}
.chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------- document preview ---
   A right-hand drawer rather than a centred modal: the search results stay
   visible on the left, so a reader can move between hits without losing the
   result list. Both the backdrop and the drawer are toggled with the `hidden`
   attribute, so each needs its own [hidden] guard - an author `display` rule
   otherwise beats the browser's `[hidden] { display: none }`.
   -------------------------------------------------------------------------- */
.preview-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20, 24, 29, .38);
}
.preview-backdrop[hidden] { display: none; }

.preview {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(720px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 28px rgba(20, 24, 29, .12);
}
.preview[hidden] { display: none; }

.preview-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex: none;
}
.preview-heading { min-width: 0; }
.preview-head h2 { margin: 0; font-size: 1rem; }
.preview-sub {
  margin: 3px 0 0; font-size: .78rem; color: var(--text-muted);
  overflow-wrap: anywhere;
}
.preview-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.preview-toolbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 9px 18px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); font-size: .8rem; flex: none;
}
.preview-toolbar[hidden] { display: none; }

/* The only scrolling region, so the header and toolbar stay put. */
.preview-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }

/* One indexed passage, rendered as a readable block rather than as a numbered
   retrieval artefact: the section heading leads, the text follows. */
.pv-passage { padding: 2px 0 2px 12px; border-left: 2px solid transparent; }
.pv-passage + .pv-passage { margin-top: 4px; }
.pv-section {
  font-size: .74rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 16px 0 5px;
}
.pv-passage:first-child .pv-section { margin-top: 0; }
.pv-text { margin: 0; font-size: .9rem; line-height: 1.62; white-space: pre-wrap; }

/* The passage the search actually matched. */
.pv-passage.is-match {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
}
.pv-passage.is-match .pv-section { color: var(--accent); margin-top: 0; }
.pv-match-flag {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 4px;
  background: var(--accent); color: var(--surface);
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; vertical-align: 1px;
}
.pv-passage.is-quoted { opacity: .62; }
.pv-passage.is-quoted.is-hidden { display: none; }

.pv-foot {
  margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: .76rem; color: var(--text-faint); font-family: var(--mono);
}

@media (max-width: 760px) {
  .preview { width: 100vw; border-left: 0; }
  .preview-body { padding: 14px 14px 32px; }
}

/* ---------------------------------------------------------------- answer --- */
.answer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.answer-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.answer-text { font-size: 1.02rem; line-height: 1.6; margin: 0 0 14px; }
.answer-text .cite {
  font-family: var(--mono); font-size: .78em; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}

.badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 5px; text-transform: uppercase;
}
.badge.HIGH { background: var(--high-soft); color: var(--high); }
.badge.MEDIUM { background: var(--medium-soft); color: var(--medium); }
.badge.LOW { background: var(--low-soft); color: var(--low); }
.badge.flag { background: var(--low-soft); color: var(--flag); }

.meta-line {
  font-size: .78rem; color: var(--text-faint); font-family: var(--mono);
  display: flex; flex-wrap: wrap; gap: 4px 14px;
}

.sources { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.source {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: .85rem;
}
.source-title {
  font-weight: 600; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap;
}
.source-meta {
  color: var(--text-muted); font-size: .78rem; margin-top: 2px;
  display: flex; flex-wrap: wrap; gap: 3px 12px;
}
.source-quote {
  margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--border-strong);
  color: var(--text-muted); font-size: .83rem; font-style: italic;
}

.section-label {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint); margin: 18px 0 8px;
}

.feedback-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: .84rem; color: var(--text-muted);
}

/* --------------------------------------------------------------- results --- */
.result {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.result-head {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 7px;
}
.rank {
  font-family: var(--mono); font-size: .76rem; font-weight: 700;
  color: var(--text-faint); min-width: 26px;
}
.result-text { font-size: .89rem; margin: 0 0 9px; }

.score-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px; font-family: var(--mono); font-size: .72rem;
}
.score {
  background: var(--surface-2); border-radius: 4px; padding: 4px 7px;
  display: flex; justify-content: space-between; gap: 6px;
  color: var(--text-muted);
}
.score b { color: var(--text); font-weight: 600; }
.score.total { background: var(--accent-soft); color: var(--accent); }
.score.total b { color: var(--accent); }

/* ----------------------------------------------------------------- stats --- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.stat-value { font-size: 1.5rem; font-weight: 640; letter-spacing: -.02em; }
.stat-label {
  font-size: .74rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .05em; margin-top: 2px;
}
.stat.pass .stat-value { color: var(--high); }
.stat.fail .stat-value { color: var(--low); }

/* ---------------------------------------------------------------- tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); font-weight: 700; white-space: nowrap;
}
tbody tr:hover { background: var(--surface-2); }
td.num { font-family: var(--mono); font-size: .8rem; text-align: right; }
.tag {
  font-size: .72rem; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.tag.email { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.ok { background: var(--high-soft); color: var(--high); border-color: transparent; }
.tag.warn { background: var(--medium-soft); color: var(--medium); border-color: transparent; }
.tag.err { background: var(--low-soft); color: var(--low); border-color: transparent; }

/* ---------------------------------------------------------------- ingest --- */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input {
  flex: 1; min-width: 220px; font: inherit; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--text-muted);
  transition: border-color .12s ease, background .12s ease;
}
.dropzone p { margin: 0 0 4px; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }

/* ----------------------------------------------------------------- misc ---- */
.pre {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  font-family: var(--mono); font-size: .76rem; white-space: pre-wrap;
  overflow-x: auto; max-height: 380px; overflow-y: auto; margin: 0;
  color: var(--text-muted);
}
.notice {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: .87rem;
  margin-bottom: 14px; border: 1px solid transparent;
}
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.warn { background: var(--medium-soft); color: var(--medium); }
.notice.err { background: var(--low-soft); color: var(--low); }

.spinner {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px;
  border-radius: 999px; font-size: .85rem; font-weight: 540;
  box-shadow: var(--shadow); z-index: 50;
}

.config-group { margin-bottom: 18px; }
.config-group > h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); margin-bottom: 7px;
}
.kv {
  display: grid; grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 2px 14px; font-size: .83rem;
}
.kv dt { color: var(--text-muted); font-family: var(--mono); font-size: .78rem; }
.kv dd { margin: 0; font-family: var(--mono); font-size: .78rem; word-break: break-word; }

@media (max-width: 620px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .tabs { top: 0; position: static; }
  .search-row { flex-direction: column; }
  .filters .span-2 { grid-column: span 1; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 6px; }
}

/* ==========================================================================
   Onboarding, upload and progress
   ========================================================================== */

/* Empty state: what a first-time user sees before anything is indexed. */
.empty-state {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 48px 28px; text-align: center; max-width: 620px; margin: 32px auto;
}
.empty-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 14px; }
.empty-state h2 { font-size: 1.15rem; margin-bottom: 8px; }
.empty-state p {
  color: var(--text-muted); font-size: .92rem; margin: 0 auto 22px;
  max-width: 46ch; line-height: 1.6;
}
.empty-state code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; margin: 0 1px;
}

/* Dropzone */
.dropzone { padding: 34px 22px; }
.dropzone-inner { display: grid; gap: 6px; place-items: center; }
.dropzone-icon {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 1.3rem; margin-bottom: 6px;
}
.dropzone-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.dropzone-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Upload preview: what is about to be sent */
.upload-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.upload-count {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.upload-count b { display: block; font-size: 1.2rem; font-weight: 640; }
.upload-count span { font-size: .74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.upload-count.skip b { color: var(--text-faint); }
.file-list {
  max-height: 220px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.file-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 5px 11px; font-size: .8rem; border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: 0; }
.file-row .path { font-family: var(--mono); font-size: .74rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.skipped .path { text-decoration: line-through; color: var(--text-faint); }

/* Progress */
.progress-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.progress-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.progress-title { font-weight: 600; display: flex; align-items: center; gap: 9px; }
.progress-bar {
  height: 9px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px; background: var(--accent);
  transition: width .35s ease;
}
.progress-fill.done { background: var(--high); }
.progress-fill.failed { background: var(--low); }
.progress-fill.indeterminate {
  width: 35%; animation: slide 1.25s ease-in-out infinite;
}
@keyframes slide {
  0%   { margin-left: 0%; }
  50%  { margin-left: 65%; }
  100% { margin-left: 0%; }
}
.progress-meta {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 9px; font-size: .8rem; color: var(--text-muted);
}
.progress-current { font-family: var(--mono); font-size: .75rem; }
.progress-steps {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.step {
  font-size: .72rem; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-faint);
}
.step.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.step.done { background: var(--high-soft); color: var(--high); border-color: transparent; }

/* Completion banner with the onward action */
.done-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px;
  background: var(--high-soft); border-radius: var(--radius-sm);
}
.done-banner .headline { font-weight: 600; color: var(--high); }
.done-banner .sub { font-size: .84rem; color: var(--text-muted); margin-top: 2px; }

/* Folder cards */
.folder-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 12px;
}
.folder-card {
  text-align: left; font: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.folder-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.folder-card.is-active { border-color: var(--accent); background: var(--accent-soft); }
.folder-name {
  font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: baseline;
}
.folder-name .icon { color: var(--text-faint); flex: none; }
.folder-stats {
  margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap;
  font-size: .78rem; color: var(--text-muted);
}
.folder-stats b { color: var(--text); font-weight: 620; }

/* Links to the original document */
.doc-link {
  color: var(--text); font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 5px;
  border-bottom: 1px solid transparent;
}
.doc-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.doc-link-icon { font-size: .8em; color: var(--text-faint); flex: none; }
/* The `file:` cell in a passage footer: label and link on one baseline, and
   the link inherits the footer's small mono type instead of the heavier
   .doc-link weight used in headings. */
.meta-file { display: inline-flex; align-items: baseline; gap: 5px; }
.meta-file .doc-link { font: inherit; font-weight: 500; }
.doc-link:hover .doc-link-icon { color: var(--accent); }
.cite-inline {
  font-family: var(--mono); font-size: .76rem; font-weight: 700;
  color: var(--accent); margin-right: 6px;
}


/* Shown only when a new build is deployed while the user is mid-task, so the
   page does not reload and discard what they were doing. */
.new-build-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--accent-soft, #eef2ff);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: center;
  cursor: pointer;
}

.new-build-banner:hover {
  filter: brightness(0.97);
}
