/* Syllo ECA — phase-1 design tokens (purpleplatform-aligned: purple accent, dense,
   keyboard-friendly). A fuller adoption of the purpleplatform/frontend design system
   lands with the real component set in a later phase. */
:root {
  --pp-purple: #6d28d9;
  --pp-purple-700: #5b21b6;
  --pp-purple-50: #f5f3ff;
  --bg: #0f1020;
  --panel: #17182b;
  --panel-2: #1d1f36;
  --line: #2a2c47;
  --text: #e7e8f5;
  --muted: #a3a6c2;
  --accent: #a78bfa;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  /* Fixed file-row height (drives the virtualized listing's window math). Bumped on phones
     for touch-friendly hit targets — the virtualizer reads this at runtime. */
  --eca-row-h: 34px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #241a45 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

.eca-app { display: flex; flex-direction: column; height: 100vh; }

/* Panel/dialog titles are real headings (<h2>) for screen-reader structure, but must look
   identical to the prior inline <span> — strip the UA heading font-size/margins so they inherit
   the panel's own sizing rules (.gcs-title / .cc-title / .ov-title / .rv-title / .eca-help-head). */
.gcs-title, .cc-title, .ov-title, .rv-title,
.eca-help-head > h2 {
  margin: 0; font-size: inherit; font-weight: 700; line-height: inherit;
}

.eca-header {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.10), transparent);
}
.eca-brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.eca-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pp-purple); box-shadow: 0 0 12px var(--accent); }
.eca-brand .sub { color: var(--muted); font-weight: 500; font-size: 12px; }

.eca-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.eca-url {
  width: 300px; max-width: 32vw; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: var(--mono); font-size: 12px;
}
.eca-btn:disabled { opacity: .45; cursor: default; }
.eca-btn:disabled:hover { border-color: var(--line); }
.eca-btn {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; user-select: none;
}
.eca-btn:hover { border-color: var(--accent); }
.eca-btn.primary { background: var(--pp-purple); border-color: var(--pp-purple-700); }
.eca-btn.primary:hover { background: var(--pp-purple-700); }

.eca-status {
  padding: 8px 18px; color: var(--muted); font-family: var(--mono); font-size: 12px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.eca-body { display: grid; grid-template-columns: 340px 1fr; flex: 1; min-height: 0; }

/* The browser pane paints an explicit solid panel background. Without it the only painted
   background behind the listing was the body's radial-gradient, which a contrast checker
   (axe) resolves to white — dropping the muted date/size text (`--muted`) to ~2.38:1. On the
   solid `--panel` fill, `--muted` computes at 7.31:1 (passes WCAG AA). One fix clears the
   color-contrast finding across all of .lh-modified / .lh-created / .lh-sz + the row date/size. */
.eca-browser { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.eca-breadcrumb { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.crumb { padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.crumb:disabled { opacity: .4; cursor: default; }
.crumb-path { color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* Breadcrumb trail spanning the base tree AND the in-archive path. */
.crumb-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--mono); font-size: 12px; min-width: 0; }
.crumb-seg {
  padding: 2px 7px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--accent); cursor: pointer; font-family: var(--mono); font-size: 12px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb-seg:hover { border-color: var(--line); background: var(--panel-2); }
.crumb-seg.current { color: var(--muted); cursor: default; }
.crumb-seg.current:hover { border-color: transparent; background: transparent; }
.crumb-sep { color: var(--muted); opacity: .6; }

/* An archive file in the listing reads as a "door" into a sub-tree. */
.eca-row.arc .nm { color: #f0abfc; }

/* Paints its own solid panel background (in addition to .eca-browser) so the muted row
   date/size text resolves against --panel even when rows are scrolled off-screen or pushed
   below an open panel — where a contrast checker falls back to the white canvas default. */
.eca-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; background: var(--panel); }
.eca-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px;
  padding: 0 8px; border-radius: 8px; cursor: pointer;
  /* Fixed row height so the directory listing can be windowed/virtualized: a constant
     itemSize lets us render only the visible rows + two spacers and still address any
     row by `scrollTop = index * row-h`. The height var is overridden per breakpoint so
     the JS window math (which reads it) tracks the touch-friendly phone sizing. */
  height: var(--eca-row-h, 34px);
}
/* Virtual-list spacers: zero-content rows that reserve the off-screen scroll height above
   and below the rendered window, so the scrollbar + scroll position stay correct while only
   a bounded number of real rows exist in the DOM. Inert to AT + pointer. */
.eca-vspacer { padding: 0; margin: 0; pointer-events: none; }
.eca-row:hover { background: var(--panel-2); }
.eca-row.dir .nm { color: var(--accent); }
.eca-row .ic { text-align: center; }
.eca-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eca-row .sz { color: var(--muted); font-family: var(--mono); font-size: 11px; }

.eca-viewer { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.v-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--accent); }
.v-text {
  margin: 0; padding: 14px; overflow: auto; flex: 1; font-family: var(--mono); font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.v-img-wrap { flex: 1; overflow: auto; display: grid; place-items: center; padding: 16px; background:
  repeating-conic-gradient(#1a1b2e 0% 25%, #15162680 0% 50%) 50% / 22px 22px; }
.v-img { max-width: 100%; max-height: 100%; image-rendering: auto; box-shadow: 0 8px 30px #0008; display: block; }

/* ---- Redaction overlay (draw rects on an image/PDF page; burned in on produce) -------- */
/* The stage shrink-wraps the displayed image so the absolutely-positioned layer covers exactly
   the rendered image box (`.v-img` is constrained by max-width/height, so its element box == the
   visible pixels). Overlays are positioned in % of the layer, so they re-flow on resize/zoom. */
.v-redact-stage { position: relative; display: inline-block; line-height: 0; max-width: 100%; max-height: 100%; }
.v-redact-layer { position: absolute; inset: 0; pointer-events: none; }
/* The transparent drawing surface (only present in redact mode) captures the drag. */
.v-redact-capture { position: absolute; inset: 0; z-index: 1; pointer-events: auto; cursor: crosshair; touch-action: none; }
.v-redact-layer.drawing { outline: 2px dashed var(--pp-purple); outline-offset: 2px; }
/* A committed redaction region. Above the capture surface (z-index) so its delete control is
   always clickable even while redact mode's drawing surface is active. */
.v-redact-rect {
  position: absolute; z-index: 2; background: rgba(0,0,0,.62); border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #000; box-sizing: border-box; pointer-events: none;
}
.v-redact-tag {
  position: absolute; top: 1px; left: 2px; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: #fff; background: var(--pp-purple); border-radius: 3px; padding: 0 4px; line-height: 1.5;
  text-shadow: 0 1px 2px #000; pointer-events: none;
}
.v-redact-del {
  position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; line-height: 16px;
  font-size: 11px; text-align: center; color: #fff; background: #b91c1c; border: 1px solid #fff;
  border-radius: 4px; cursor: pointer; pointer-events: auto; padding: 0;
}
.v-redact-del:hover { background: #dc2626; }
.v-redact-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* The live rubber-band rectangle while dragging. */
.v-redact-draft {
  position: absolute; background: rgba(109,40,217,.28); border: 1.5px dashed var(--pp-purple);
  box-sizing: border-box; pointer-events: none;
}
/* The controls strip under the toolbar when redact mode is on. */
.v-redact-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--panel);
  font-size: 12px;
}
.v-redact-count { font-weight: 600; color: var(--accent); }
.v-redact-guarantee {
  color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px;
}
.v-redact-status { color: var(--muted); }
.v-tab.redact-tab.active { background: #111; border-color: #fff; color: #fff; }
/* Reason-code picker dialog. */
.v-reason-dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, 92vw); max-height: 88vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 60px #000a; z-index: 50;
}
.v-reason-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.v-reason-help { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.v-reason-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.v-reason-btn {
  display: flex; align-items: baseline; gap: 10px; text-align: left;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text); cursor: pointer;
}
.v-reason-btn:hover { border-color: var(--accent); }
.v-reason-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.v-reason-code { font-weight: 700; min-width: 44px; color: var(--accent); }
.v-reason-desc { color: var(--muted); font-size: 12px; }
.v-reason-custom { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.v-reason-custom-lbl { color: var(--muted); font-size: 12px; }
.v-reason-custom-in {
  flex: 1; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); color: var(--text); font-size: 13px; text-transform: uppercase;
}
.v-reason-custom-in:focus { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .v-redact-draft, .v-redact-rect { transition: none; }
}

/* ---- PII detection → redaction suggestions -------------------------------------------- */
/* Toolbar toggle active state (mirrors the redact/review tabs). */
.v-tab.pii-tab.active { background: var(--pp-purple); border-color: var(--pp-purple-700); color: #fff; }
/* Highlighted PII span in the text viewer — the offset→rect anchor + visual cue. */
mark.pii-hl {
  background: rgba(252,211,77,.30); color: inherit; border-bottom: 2px solid #fcd34d;
  border-radius: 2px; padding: 0; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
/* The suggestions panel under the toolbar (sibling of the metadata panel). */
.v-pii-panel {
  border-bottom: 1px solid var(--line); background: var(--panel);
  padding: 10px 14px; max-height: 42vh; overflow: auto; font-size: 12.5px;
}
.v-pii-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.v-pii-title { font-weight: 700; color: var(--accent); }
.v-pii-status { color: var(--muted); margin-bottom: 6px; min-height: 1em; }
.v-pii-note { color: var(--muted); padding: 6px 0; line-height: 1.5; }
.v-pii-note.small { font-size: 11.5px; }
.v-pii-note.warn { color: #fcd34d; }
.v-pii-note.err { color: #fca5a5; }
.v-pii-note .le-title { font-weight: 700; color: var(--text); margin-bottom: 2px; }
.v-pii-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.v-pii-maplabel { color: var(--muted); }
.v-pii-maplabel.info { color: #fcd34d; }
.v-pii-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.v-pii-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
/* Accepted rows: signal "done" via the border + a tinted background + the ✓ label, NOT opacity
   (dimming the whole row drops the muted text below the WCAG contrast threshold). */
.v-pii-item.accepted { border-color: var(--pp-purple-700); background: rgba(109,40,217,.12); }
.v-pii-kind {
  font-weight: 700; font-size: 10.5px; letter-spacing: .03em; color: #fff;
  background: var(--pp-purple); border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.v-pii-value { font-family: var(--mono); color: var(--text); font-size: 12px; word-break: break-all; }
.v-pii-loc { color: #bcbed6; font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.v-pii-done { color: #86efac; font-weight: 600; white-space: nowrap; }
.v-pii-actions { display: flex; gap: 6px; }
@media (prefers-reduced-motion: reduce) {
  mark.pii-hl { border-bottom-width: 2px; }
}
@media (max-width: 600px) {
  .v-pii-loc { margin-left: 0; }
  .v-pii-item { gap: 6px; }
}

/* ---- Multi-page PDF viewer (lazy-rendered scrollable page column) ---------------------- */
/* Page-navigation toolbar above the scroller: prev / jump-to-page / next + indicator. */
.v-pdf-nav {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 14px; border-bottom: 1px solid var(--line); background: var(--panel);
  font-size: 12px;
}
.v-pdf-jump-lbl { color: var(--muted); }
.v-pdf-jump {
  width: 64px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); color: var(--text); font-size: 13px; font-family: var(--mono);
}
.v-pdf-jump:focus { border-color: var(--accent); outline: none; }
.v-pdf-of { color: var(--muted); }
/* The scroller: a vertical column of page slots. Focusable region for keyboard page nav. */
.v-pdf-scroll {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  scroll-behavior: smooth;
}
.v-pdf-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* One page slot. scroll-margin keeps jump-to-page from tucking under the sticky toolbar. */
.v-pdf-page { width: min(100%, 980px); scroll-margin-top: 12px; }
/* The stage reserves an aspect-correct box (set inline from the page's intrinsic dims) so the
   scroll position stays stable while a page's raster streams in. It also hosts the per-page
   redaction layer (position: relative is inherited from .v-redact-stage). */
.v-pdf-stage { width: 100%; height: auto; max-width: 100%; max-height: none; background: #fff; }
.v-pdf-img { width: 100%; height: auto; max-width: 100%; max-height: none; }
/* Placeholder shown until a page is rasterized (or after it's released out of the lazy window). */
.v-pdf-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: repeating-linear-gradient(45deg, #1a1b2e, #1a1b2e 10px, #181930 10px, #181930 20px);
  color: var(--muted); font-size: 12px;
}
.v-pdf-ph-num { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .v-pdf-scroll { scroll-behavior: auto; }
}
@media (max-width: 640px) {
  .v-pdf-page { width: 100%; }
  .v-pdf-nav { gap: 6px; }
}

/* Viewer-type switcher (auto-detected default + force Text/Hex). */
.v-switch {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.v-switch-lbl { color: var(--muted); font-size: 12px; margin-right: 4px; }
.v-tab {
  padding: 4px 11px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 12px; user-select: none;
}
.v-tab:hover { border-color: var(--accent); }
.v-tab.active { background: var(--pp-purple); border-color: var(--pp-purple-700); color: #fff; }

.v-head .v-meta { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 10px; }
.v-head .v-err { color: #fca5a5; font-weight: 400; font-size: 12px; margin-left: 10px; }

.v-text.nomono { font-family: var(--sans); }

/* Hex dump: offset | hex | ascii, monospaced. */
.v-hex {
  margin: 0; padding: 14px; overflow: auto; flex: 1;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.45;
  white-space: pre; color: var(--text); tab-size: 2;
}

/* CSV/TSV table. */
.v-table-wrap { overflow: auto; flex: 1; padding: 8px; min-height: 0; }
.v-table { border-collapse: collapse; font-family: var(--mono); font-size: 12px; width: max-content; min-width: 100%; }
.v-table th, .v-table td {
  border: 1px solid var(--line); padding: 5px 9px; text-align: left;
  white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis;
}
.v-table thead th { position: sticky; top: 0; background: var(--panel-2); color: var(--accent); z-index: 1; }
.v-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.v-table tbody tr:hover { background: var(--panel-2); }
/* Numeric columns right-align + tabular figures for readable columns of numbers. */
.v-table th.num, .v-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* CSV "load more rows" affordance (re-parses the already-streamed bytes; no full fetch). */
.v-loadmore {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--line); background: var(--panel);
}
.v-loadmore-note { color: var(--muted); font-size: 11.5px; }

/* Syntax-highlighted code viewer: line-number gutter + token spans. */
.v-code-wrap { overflow: auto; flex: 1; min-height: 0; background: var(--panel); }
.v-code { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12.5px; }
.v-code td.ln {
  text-align: right; vertical-align: top; padding: 0 12px 0 14px; user-select: none;
  color: var(--muted); opacity: .65; width: 1%; white-space: nowrap;
  position: sticky; left: 0; background: var(--panel); border-right: 1px solid var(--line);
}
.v-code td.cd { padding: 0 14px 0 12px; width: 100%; }
.v-code td.cd pre { margin: 0; white-space: pre; font-family: inherit; line-height: 1.5; }
.v-code tbody tr:hover td.cd { background: rgba(255,255,255,.025); }
.v-code tbody tr:hover td.ln { color: var(--accent); opacity: 1; }
/* Token colors (purpleplatform-aligned dark palette). */
.tok-kw { color: #c4b5fd; font-weight: 600; }   /* keyword  */
.tok-st { color: #86efac; }                      /* string   */
.tok-nu { color: #fca5a5; }                      /* number   */
.tok-cm { color: var(--muted); font-style: italic; } /* comment */
.tok-fn { color: #93c5fd; }                      /* function */
.tok-ty { color: #fcd34d; }                      /* type     */

/* Streaming media (audio/video) preview. */
.v-media-wrap { flex: 1; overflow: auto; display: grid; place-items: center; padding: 20px; min-height: 0; }
.v-media-el { max-width: 100%; max-height: 100%; }
video.v-media-el { box-shadow: 0 8px 30px #0008; border-radius: 6px; background: #000; }
audio.v-media-el { width: min(560px, 100%); }

.eca-empty { color: var(--muted); padding: 28px; text-align: center; }

.eca-foot { padding: 8px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.eca-foot .eng { color: var(--accent); }

/* ---- Search panel (local / keyword / semantic) ---------------------------------------- */
.eca-btn.search-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

.eca-search {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.08), var(--panel));
  padding: 12px 18px; max-height: 46vh; overflow: auto;
}
.eca-search-bar { display: flex; align-items: center; gap: 10px; }
.eca-search-kinds { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sk-tab {
  padding: 7px 14px; border: 0; background: var(--panel-2); color: var(--muted);
  cursor: pointer; font-size: 13px; user-select: none;
}
.sk-tab + .sk-tab { border-left: 1px solid var(--line); }
.sk-tab:hover { color: var(--text); }
.sk-tab.active { background: var(--pp-purple); color: #fff; }

/* Processing-location switch (header): a compact segmented Local | Remote control. */
.eca-proc { display: inline-flex; align-items: center; gap: 6px; }
.eca-proc .proc-lbl { color: var(--muted); font-size: 12px; }
.eca-proc { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px 3px 9px; background: var(--panel-2); }
.proc-tab {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel);
  color: var(--muted); cursor: pointer; font-size: 12px; user-select: none;
}
.proc-tab + .proc-tab { margin-left: -1px; }
.proc-tab:hover { color: var(--text); border-color: var(--accent); }
.proc-tab.active { background: var(--pp-purple); border-color: var(--pp-purple-700); color: #fff; }
.eca-search-input {
  flex: 1; min-width: 0; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-family: var(--sans); font-size: 14px;
}
.eca-search-input:focus { border-color: var(--accent); }
.eca-search-input:focus:not(:focus-visible) { outline: none; }

/* "indexed N docs locally" badge — muted by default, lit purple in Local mode. */
.eca-index-badge {
  white-space: nowrap; font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; background: var(--bg);
  user-select: none;
}
.eca-index-badge.on { color: var(--accent); border-color: var(--pp-purple-700); background: rgba(109,40,217,.12); }

.eca-search-note {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); font-size: 12.5px;
}
.eca-search-hint { margin-top: 10px; color: var(--muted); font-size: 12px; }

.eca-hits { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.eca-hit {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; transition: border-color .12s, background .12s;
}
.eca-hit:hover { border-color: var(--accent); background: var(--panel); }
.hit-head { display: flex; align-items: center; gap: 8px; }
.hit-ic { width: 18px; text-align: center; }
.hit-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-score {
  margin-left: auto; color: var(--accent); font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--bg);
}
.hit-path { color: var(--muted); font-family: var(--mono); font-size: 11px; margin: 2px 0 0 26px; }
.hit-snippet {
  margin: 6px 0 0 26px; color: var(--muted); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hit-mark { background: rgba(167,139,250,.28); color: var(--text); border-radius: 3px; padding: 0 2px; }

/* ---- Chat panel ("Chat with your matter") --------------------------------------------- */
.eca-btn.chat-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

.eca-chat {
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.08), var(--panel));
  max-height: 60vh; min-height: 240px;
}
.eca-chat-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.10), transparent);
}
.eca-chat-head .cc-title { font-weight: 700; }
.eca-chat-head .cc-sub { color: var(--muted); font-size: 12px; }
.eca-chat-head .eca-btn { margin-left: auto; }

.eca-chat-thread {
  flex: 1; overflow: auto; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.eca-chat-hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.eca-chat-hint em { color: var(--accent); font-style: italic; }

.cc-turn { display: flex; flex-direction: column; gap: 8px; }
.cc-bubble {
  border-radius: 11px; padding: 10px 13px; max-width: 78%;
  border: 1px solid var(--line); font-size: 13.5px; line-height: 1.55;
}
.cc-bubble .cc-role {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin-bottom: 4px;
}
.cc-bubble.user {
  align-self: flex-end; background: var(--pp-purple); border-color: var(--pp-purple-700); color: #fff;
}
.cc-bubble.user .cc-role { color: rgba(255,255,255,.75); }
.cc-bubble.asst { align-self: flex-start; background: var(--panel-2); }
/* An honest *notice* assistant turn (AI not configured / matter not indexed): neutral, not an
   answer, not an error — distinct from the grounded-answer bubble. */
.cc-bubble.asst.notice { background: rgba(56,189,248,.07); border-color: rgba(56,189,248,.35); }
.cc-text { white-space: pre-wrap; word-break: break-word; }

/* Inline info notice inside an assistant bubble (degradation states). */
.cc-notice {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap;
}
.cc-notice-ic { color: #38bdf8; font-weight: 700; flex: none; }
/* Collapsed disclosure for the devops/setup detail of a notice (e.g. AI-not-configured). Hidden
   by default so an end user just sees the friendly message; admins can expand for env-var setup. */
.cc-notice-detail { margin: 6px 0 0 26px; font-size: 12px; color: var(--muted); }
.cc-notice-detail > summary { cursor: pointer; color: var(--muted); }
.cc-notice-detail > summary:hover { color: var(--text); }
.cc-notice-detail-body { margin-top: 4px; line-height: 1.5; }

/* "Partial context" badge shown when the backend capped the grounding context. */
.cc-partial {
  margin-top: 8px; padding: 6px 9px; border-radius: 7px; font-size: 11.5px;
  color: #fcd34d; background: rgba(252,211,77,.10); border: 1px solid rgba(252,211,77,.30);
}

.cc-cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.cc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--pp-purple-700);
  background: rgba(109,40,217,.14); color: var(--accent); cursor: pointer;
  font-size: 11.5px; font-family: var(--mono); max-width: 280px;
}
.cc-chip:hover { background: rgba(109,40,217,.26); border-color: var(--accent); }
.cc-chip-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; max-width: 150px; }
/* The cited snippet, dimmed + clipped so a chip stays compact but previews the evidence. */
.cc-chip-snip {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); opacity: .85; font-style: italic; max-width: 120px;
  border-left: 1px solid var(--pp-purple-700); padding-left: 6px;
}
.cc-model { margin-top: 7px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

.cc-typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.cc-error { color: #fca5a5; font-size: 13px; }

.eca-chat-note {
  align-self: stretch; padding: 10px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12.5px;
}

.eca-chat-bar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel);
}
/* Accessible label for the textarea, visually hidden (the placeholder is decorative only). */
.cc-input-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.eca-chat-input {
  flex: 1; min-width: 0; padding: 9px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 14px;
  /* Textarea: bounded auto-ish growth, scroll past the cap; no horizontal resize jitter. */
  resize: vertical; line-height: 1.45; max-height: 140px; min-height: 40px;
}
.eca-chat-input:focus { border-color: var(--accent); }
.eca-chat-input:focus:not(:focus-visible) { outline: none; }
.eca-chat-input:disabled { opacity: .6; }

/* ---- Accessibility: visually-hidden utility ------------------------------------------- */
/* Content that is present for assistive tech (screen-reader heading structure, scroll-region
   labels) but not painted on screen. Standard clip-rect technique; stays focusable if focused. */
.eca-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;
}

/* ---- Accessibility: visible focus rings (keyboard operability) ------------------------- */
/* Show a clear ring on keyboard focus across every interactive surface. `:focus-visible`
   keeps mouse clicks ringless while making Tab/arrow navigation obvious. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.eca-btn:focus-visible, .crumb:focus-visible, .crumb-seg:focus-visible,
.sk-tab:focus-visible, .v-tab:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.eca-list:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.eca-row:focus-visible, .eca-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Keyboard-selected file row (arrow-key navigation). Distinct from :hover so both can show. */
.eca-row.kbsel {
  background: rgba(109,40,217,.22);
  box-shadow: inset 0 0 0 1px var(--pp-purple-700);
}
.eca-row[aria-selected="true"] { background: rgba(109,40,217,.22); }

/* ---- Reduced motion (global) ---------------------------------------------------------- */
/* A blanket safety net: when the user asks for reduced motion, neutralize all decorative
   transitions and animations app-wide. Targeted blocks elsewhere (spinner throttle, drawer)
   still apply; this catches the long tail (hit/bucket hovers, job/progress bar width tweens,
   the indeterminate sweep) so nothing animates against the user's stated preference.
   Near-zero (not 0) durations still fire transitionend/animationend so any JS depending on
   those events keeps working; `scroll-behavior: auto` disables smooth-scrolling. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Loading: spinner + skeletons ----------------------------------------------------- */
.eca-spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(167,139,250,.3); border-top-color: var(--accent);
  animation: eca-spin .7s linear infinite; vertical-align: -2px;
}
@keyframes eca-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .eca-spinner { animation-duration: 2s; }
  .skel-ic, .skel-nm { animation: none !important; }
}

.eca-loading, .eca-search-loading {
  display: flex; align-items: center; gap: 9px; color: var(--muted);
  padding: 18px; font-size: 13px;
}
.eca-search-loading { padding: 12px 2px 2px; }

/* Directory loading skeleton. */
.eca-list-skel { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.skel-row { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 8px; padding: 7px 8px; }
.skel-ic, .skel-nm {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: eca-shimmer 1.3s ease infinite;
}
.skel-ic { width: 16px; height: 16px; border-radius: 5px; }
.skel-nm { width: 70%; }
.skel-row:nth-child(2n) .skel-nm { width: 52%; }
.skel-row:nth-child(3n) .skel-nm { width: 84%; }
@keyframes eca-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Live "N items… (P pages)" counter shown while a large GCS bucket streams in page by page. */
.eca-list-count {
  display: flex; align-items: center; gap: 9px;
  margin: 8px; padding: 7px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2);
  color: var(--accent); font-size: 12.5px; font-weight: 600;
}
.eca-list-count .elc-spin {
  width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: eca-spin .8s linear infinite;
}
.eca-list-count .elc-txt { font-family: var(--mono); font-size: 12px; color: var(--text); }
@keyframes eca-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .eca-list-count .elc-spin { animation: none; }
}

/* ---- Error states (directory listing + viewer) ---------------------------------------- */
.eca-list-error, .eca-error {
  margin: 14px; padding: 14px; border-radius: 10px;
  border: 1px solid #7f1d1d; background: rgba(127,29,29,.18); color: var(--text);
}
.le-title { font-weight: 600; color: #fca5a5; margin-bottom: 6px; }
.le-msg { color: var(--muted); font-family: var(--mono); font-size: 12px; word-break: break-word; }

/* ---- Keyboard-shortcuts help overlay -------------------------------------------------- */
.eca-help-backdrop {
  position: fixed; inset: 0; background: rgba(8,8,18,.62); z-index: 50;
  display: grid; place-items: center; padding: 24px;
}
.eca-help {
  width: min(440px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 20px 60px #0009; overflow: hidden;
}
.eca-help-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-weight: 700; background: linear-gradient(180deg, rgba(109,40,217,.14), transparent);
}
.eca-help-list { list-style: none; margin: 0; padding: 10px 16px 16px; }
.eca-help-list li {
  display: flex; align-items: center; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid rgba(42,44,71,.5);
}
.eca-help-list li:last-child { border-bottom: 0; }
.eca-help-list span { color: var(--muted); margin-left: auto; text-align: right; }
.eca-help-list kbd {
  font-family: var(--mono); font-size: 11.5px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; min-width: 22px; text-align: center;
}
.eca-btn.help-toggle { font-weight: 700; min-width: 34px; }
.eca-btn.help-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

/* ---- Encrypted-archive password prompt (#119) --------------------------------------- */
/* Reuses the .eca-help-backdrop overlay; the dialog body matches the help/reason dialogs. */
.eca-pw-dialog {
  width: min(420px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 20px 60px #0009; overflow: hidden;
}
.eca-pw-dialog:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.eca-pw-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.eca-pw-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.eca-pw-error {
  color: #fecaca; background: rgba(220,38,38,.14); border: 1px solid rgba(220,38,38,.45);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-weight: 600;
}
.eca-pw-label { color: var(--muted); font-size: 12px; }
.eca-pw-input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 14px; width: 100%;
}
.eca-pw-input:focus { border-color: var(--accent); outline: none; }
.eca-pw-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.eca-pw-actions .eca-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Ops controls: selection toolbar + ops actions + job status ----------------------- */
.eca-btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.eca-btn.formats-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

.eca-ops {
  display: flex; flex-direction: column; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.06), transparent);
}
.eca-ops-sel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ops-count { color: var(--muted); font-size: 12px; }
.ops-count.on { color: var(--accent); font-weight: 600; }
.eca-ops-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* In-archive ops bar: same shape, a hair more "inside the archive" (teal-leaning tint). */
.eca-ops-arc { background: linear-gradient(180deg, rgba(20,184,166,.07), transparent); }
/* One-line affordance hint above the ops actions (always-on toolbar). */
.eca-ops-hint { color: var(--muted); font-size: 11.5px; }

/* ---- Email message view --------------------------------------------------------------- */
.eca-email { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: auto; }
.em-headers {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.06), transparent);
}
.em-subject { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; word-break: break-word; }
.em-hrow { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.6; }
.em-hkey { color: var(--muted); min-width: 46px; font-family: var(--mono); text-transform: uppercase; font-size: 10.5px; letter-spacing: .4px; padding-top: 2px; }
.em-hval { color: var(--text); word-break: break-word; flex: 1; }
.em-note {
  margin-top: 9px; padding: 8px 10px; border-radius: 8px; font-size: 11.5px; line-height: 1.5;
  border: 1px solid #92400e; background: rgba(146,64,14,.16); color: #fcd34d;
}
.em-tabs { display: flex; gap: 6px; padding: 8px 16px 0; }
.em-body { flex: 1; min-height: 180px; display: flex; flex-direction: column; padding: 12px 16px; }
.em-body .v-text { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.em-html {
  flex: 1; width: 100%; min-height: 320px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; /* email HTML usually assumes a light background */
}
.em-attachments { padding: 10px 16px 16px; border-top: 1px solid var(--line); }
.em-att-head { color: var(--accent); font-weight: 600; font-size: 12.5px; margin-bottom: 8px; }
.em-att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.em-att {
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.em-att:hover { border-color: var(--accent); background: var(--panel); }
.em-att-ic { text-align: center; }
.em-att-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.em-att-sz { color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* File-row checkbox column + date columns: extend the row grid to
   (chk | ic | nm | modified | created | sz). The NAME track keeps a guaranteed minimum and gets
   ALL the slack, while the date/size tracks shrink (and truncate) under pressure — so the
   filename is ALWAYS visible even in the narrow ~340px browser side panel (where a viewport-keyed
   media query doesn't fire). The two date columns still collapse entirely on narrow viewports
   (see the responsiveness block). Fix: name must never collapse to width 0. */
.eca-row { grid-template-columns: 20px 22px minmax(90px, 1fr) minmax(0, auto) minmax(0, auto) minmax(0, auto); }
.eca-row .ck { display: grid; place-items: center; }
.eca-chk { width: 14px; height: 14px; accent-color: var(--pp-purple); cursor: pointer; }
.eca-row.picked { background: rgba(109,40,217,.16); box-shadow: inset 0 0 0 1px var(--pp-purple-700); }

/* The name track gets the slack and never wraps; ellipsis when it has to. min-width:0 lets the
   grid track shrink the *content* (without it the row could overflow rather than truncate). */
.eca-row .nm { min-width: 0; }

/* Date columns (Modified / Created) — compact, muted, monospaced; never wrap, truncate (ellipsis)
   rather than steal the name's width. No fixed min-width: they yield to the name under pressure. */
.eca-row .col-date {
  color: var(--muted); font-family: var(--mono); font-size: 11px;
  white-space: nowrap; text-align: right; min-width: 0; max-width: 116px;
  overflow: hidden; text-overflow: ellipsis;
}
.eca-row .col-created { color: #8a8db0; }
.eca-row .sz { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Listing column header, aligned to the same grid as a row. Paints its own solid panel
   background (in addition to .eca-browser) so the muted header text resolves against --panel
   even when the header is scrolled off-screen / behind an open panel — where a contrast
   checker would otherwise fall back to the white canvas default. */
.eca-list-head {
  display: grid; grid-template-columns: 20px 22px minmax(90px, 1fr) minmax(0, auto) minmax(0, auto) minmax(0, auto); gap: 8px;
  align-items: center; padding: 6px 14px 6px 8px; margin: 0 6px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
}
.eca-list-head .lh-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eca-list-head .col-date, .eca-list-head .lh-sz {
  text-align: right; white-space: nowrap; min-width: 0; max-width: 116px; overflow: hidden;
  text-overflow: ellipsis; font-family: var(--mono);
}

/* Job status area. */
.eca-jobs {
  border-bottom: 1px solid var(--line); padding: 8px 12px;
  max-height: 38vh; overflow: auto; background: var(--panel);
}
.eca-jobs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.eca-job { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 8px; background: var(--panel-2); }
.eca-job.done { border-color: var(--pp-purple-700); }
.eca-job.failed { border-color: #7f1d1d; }
.job-head { display: flex; align-items: center; gap: 8px; }
.job-pill {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.job-pill.running { color: var(--accent); border-color: var(--pp-purple-700); background: rgba(109,40,217,.14); }
.job-pill.done { color: #86efac; border-color: #14532d; background: rgba(20,83,45,.2); }
.job-pill.failed { color: #fca5a5; border-color: #7f1d1d; background: rgba(127,29,29,.2); }
.job-pill.queued { color: var(--muted); }
.job-label { flex: 1; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-prog { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.job-bar { height: 5px; border-radius: 4px; background: var(--bg); margin: 7px 0 4px; overflow: hidden; }
.job-bar-fill { display: block; height: 100%; background: var(--pp-purple); transition: width .25s ease; }
.job-err { color: #fca5a5; font-size: 12px; font-family: var(--mono); margin-top: 4px; word-break: break-word; }

.job-results { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.job-res { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; align-items: baseline; font-size: 12px; }
.job-res .res-ic { color: #86efac; }
.job-res.bad .res-ic { color: #fca5a5; }
.res-path { font-family: var(--mono); font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-detail { color: var(--muted); font-size: 11px; white-space: nowrap; }
.res-preview { grid-column: 2 / -1; color: var(--muted); font-size: 11.5px; line-height: 1.4; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Image-op thumbnail gallery. */
.job-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { width: 120px; }
.thumb-box { height: 80px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center;
  background: repeating-conic-gradient(#1a1b2e 0% 25%, #15162680 0% 50%) 50% / 18px 18px; overflow: hidden; }
.thumb.bad .thumb-box { border-color: #7f1d1d; }
.thumb-ph { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.thumb-ph.err { color: #fca5a5; }
.thumb-ic { font-size: 22px; }
.thumb-sz { font-family: var(--mono); font-size: 10px; }
.thumb-name { font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-open { margin-top: 5px; width: 100%; }
.thumb-detail { color: var(--muted); font-size: 10px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Upload note banner. */
.eca-upload-note {
  display: flex; align-items: center; gap: 10px; padding: 8px 18px;
  border-bottom: 1px solid var(--line); background: rgba(109,40,217,.10); color: var(--text); font-size: 12.5px;
}
.eca-upload-note .eca-x { margin-left: auto; background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.eca-upload-note .eca-x:hover { color: var(--text); }

/* ---- Viewer: metadata panel + extraction kind badges ---------------------------------- */
.v-tab.meta-tab { margin-left: auto; }
.kind-badge {
  font-family: var(--mono); font-size: 10.5px; margin-left: 8px; padding: 1px 7px; border-radius: 6px;
  color: var(--accent); border: 1px solid var(--pp-purple-700); background: rgba(109,40,217,.14); vertical-align: 1px;
}
.kind-badge.warn { color: #fcd34d; border-color: #92400e; background: rgba(146,64,14,.2); }
.kind-badge.err { color: #fca5a5; border-color: #7f1d1d; background: rgba(127,29,29,.2); }

/* "(processed remotely)" — a subtle, honest marker on remote-only operations (OCR / Tika
   text extraction, semantic search, image→PDF) that always run on the backend regardless of
   the Processing toggle, so the user knows the bytes left the device. Deliberately quiet. */
.remote-note {
  font-size: 10.5px; color: var(--muted); margin-left: 8px; cursor: help; vertical-align: 1px;
  font-style: italic; white-space: nowrap;
}
.eca-ops-remote-note { display: block; margin: 6px 0 0; font-style: normal; white-space: normal; line-height: 1.4; }
.remote-dot { color: var(--accent); margin-left: 3px; font-weight: 700; cursor: help; }

.v-meta-panel { border-bottom: 1px solid var(--line); background: var(--panel); padding: 10px 14px; max-height: 36vh; overflow: auto; }
.v-meta-head { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.v-meta-note { color: var(--muted); font-size: 12.5px; }
.v-meta-note.err { color: #fca5a5; }
.v-meta-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.v-meta-table th { text-align: left; vertical-align: top; padding: 4px 12px 4px 0; color: var(--muted); font-family: var(--mono); white-space: nowrap; font-weight: 500; }
.v-meta-table td { padding: 4px 0; word-break: break-word; color: var(--text); }
.v-meta-table tr + tr th, .v-meta-table tr + tr td { border-top: 1px solid rgba(42,44,71,.5); }

.v-extract-note { margin: 14px; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.v-extract-note.err { border-color: #7f1d1d; background: rgba(127,29,29,.18); }

/* ---- Supported-formats dialog --------------------------------------------------------- */
.eca-formats {
  width: min(760px, 94vw); max-height: 88vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px #0009;
}
.eca-formats-body { padding: 8px 18px 18px; overflow: auto; }
.fmt-group { margin-top: 14px; }
.fmt-h { margin: 0 0 6px; color: var(--accent); font-size: 13px; }
.fmt-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.fmt-table th { text-align: left; vertical-align: top; width: 230px; padding: 5px 14px 5px 0; color: var(--text); font-weight: 600; }
.fmt-table td { padding: 5px 0; color: var(--muted); }
.fmt-table tr + tr th, .fmt-table tr + tr td { border-top: 1px solid rgba(42,44,71,.5); }
.fmt-foot { margin-top: 16px; color: var(--muted); font-size: 11.5px; font-style: italic; }

/* ---- GCS source panel ----------------------------------------------------------------- */
.eca-btn.gcs-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

.eca-gcs {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.08), var(--panel));
  padding: 12px 18px; display: flex; flex-direction: column; gap: 10px;
  max-height: 60vh; overflow: auto;
}
.eca-gcs-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eca-gcs-head .gcs-title { font-weight: 700; }
.eca-gcs-head .gcs-sub { color: var(--muted); font-size: 12px; flex: 1; min-width: 200px; }
.eca-gcs-head .eca-btn { margin-left: auto; }

.eca-gcs-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gcs-lbl { color: var(--muted); font-size: 12px; min-width: 52px; }
.eca-gcs-input {
  flex: 0 1 240px; min-width: 0; padding: 7px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-family: var(--mono); font-size: 12.5px;
}
.eca-gcs-input.wide { flex: 1 1 360px; }
.eca-gcs-input:focus { border-color: var(--accent); }
.eca-gcs-input:focus:not(:focus-visible) { outline: none; }

.eca-gcs-buckets, .eca-gcs-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.eca-gcs-bucket, .eca-gcs-project {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 12.5px;
  transition: border-color .12s, background .12s;
}
.eca-gcs-bucket:hover, .eca-gcs-project:hover { border-color: var(--accent); background: var(--panel); }
.eca-gcs-bucket .gb-nm, .eca-gcs-project .gp-nm { font-family: var(--mono); }
.eca-gcs-project.active { border-color: var(--pp-purple-700); background: rgba(109,40,217,.18); }

.eca-gcs-note {
  padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); font-size: 12.5px;
}

/* Deliberate-index note shown in the ops area while browsing GCS. */
.eca-gcs-index-note {
  padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.5;
  border: 1px solid var(--pp-purple-700); background: rgba(109,40,217,.12); color: var(--text);
}
.eca-gcs-index-note strong { color: var(--accent); }

/* ---- Long-op progress bar (engine-progress) ------------------------------------------- */
/* Shown over the body for slow ops: mounting a large archive (central-directory phase), big
   entry reads (decompress/download). Determinate when the engine reports a total; an animated
   indeterminate sweep otherwise. */
.eca-progress {
  padding: 8px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.10), var(--panel));
}
/* Fix 4: the bar stays mounted (stable node identity → the width transition isn't reset every
   tick). When idle it's collapsed via this class instead of being torn down by `<Show>`.
   `display:none` fully removes it from layout but preserves the element + its `.ep-fill` width
   so the next op resumes without a flash. */
.eca-progress.hidden { display: none; }
.eca-progress .ep-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.eca-progress .ep-label { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.eca-progress .ep-detail { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-left: auto; }
.eca-progress .ep-bar { height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; position: relative; }
.eca-progress .ep-fill {
  display: block; height: 100%; background: linear-gradient(90deg, var(--pp-purple), var(--accent));
  width: 0; transition: width .2s ease; border-radius: 4px;
}
/* Indeterminate: a sweeping segment (total unknown). */
.eca-progress .ep-bar.indet .ep-fill {
  width: 38%; transition: none; position: absolute; left: 0;
  animation: eca-indet 1.1s ease-in-out infinite;
}
@keyframes eca-indet {
  0%   { left: -40%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .eca-progress .ep-bar.indet .ep-fill { animation-duration: 2.6s; }
}

/* ---- Responsiveness (phone → tablet/folded → desktop) --------------------------------- */
/* The drawer toggle (☰ Files) is desktop-hidden; it appears only on narrow viewports where
   the browser collapses into a slide-over drawer. */
.eca-btn.drawer-toggle { display: none; }
/* Drawer backdrop is inert/absent on wide viewports. */
.eca-drawer-backdrop { display: none; }

/* Tablet / folded (Pixel Fold inner ~840px, folded outer ~580px) and below: collapse the
   date columns so the name + size stay readable in the now-narrower browser pane. */
@media (max-width: 1024px) {
  .eca-row { grid-template-columns: 20px 22px minmax(90px, 1fr) minmax(0, auto); }
  .eca-list-head { grid-template-columns: 20px 22px minmax(90px, 1fr) minmax(0, auto); }
  .eca-row .col-date, .eca-list-head .col-date { display: none; }
}

/* Below ~900px: single-column layout. The browser becomes a slide-over DRAWER over the
   viewer (which takes the full width); ☰ Files toggles it. This covers the Pixel Fold's
   folded state and most tablets/phones. */
@media (max-width: 900px) {
  .eca-btn.drawer-toggle { display: inline-block; }
  .eca-header { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .eca-actions { gap: 6px; }
  /* The URL box is rarely needed on a phone; let it wrap to its own full-width row, last. */
  .eca-url { width: 100%; max-width: 100%; flex: 1 1 100%; order: 99; }

  /* Single column: the viewer fills the body; the browser overlays as a drawer. */
  .eca-body { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  .eca-viewer { grid-column: 1; grid-row: 1; min-width: 0; }
  .eca-browser {
    grid-column: 1; grid-row: 1;
    position: absolute; inset: 0 auto 0 0; z-index: 40;
    width: min(86vw, 360px); max-width: 86vw;
    background: var(--panel); border-right: 1px solid var(--line);
    box-shadow: 8px 0 30px #0007;
    transform: translateX(-102%); transition: transform .22s ease;
    will-change: transform;
  }
  .eca-body.drawer-open .eca-browser { transform: translateX(0); }
  .eca-drawer-backdrop {
    display: block; position: absolute; inset: 0; z-index: 35;
    background: rgba(8,8,18,.5); opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .eca-body.drawer-open .eca-drawer-backdrop { opacity: 1; pointer-events: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .eca-browser { transition: none; }
  .eca-drawer-backdrop { transition: none; }
}

/* Phone (~600px and below): condense the header further + let the search bar wrap. */
@media (max-width: 600px) {
  .eca-header { padding: 9px 10px; }
  .eca-brand .sub { display: none; }            /* keep the brand compact */
  .eca-actions { gap: 5px; }
  .eca-btn { padding: 6px 9px; font-size: 12.5px; }
  /* Touch tap targets (WCAG 2.5.8 / AA): on phones every header control + the Processing
     segmented control must be at least ~44px tall so they're comfortably tappable. Mirrors
     the touch-friendly --eca-row-h: 46px row sizing below. Buttons keep their padding; the
     min-height does the lifting (inline-flex centers the label). The file-input <label>
     buttons (.eca-btn applied to <label>) need explicit flex centering to match. */
  .eca-header .eca-btn,
  .eca-actions .eca-btn,
  .eca-btn.drawer-toggle {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .eca-proc { align-items: center; }
  .proc-tab { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  /* Touch-friendly hit targets for the file rows + interactive list items. The virtualizer
     reads this height at runtime, so the window math stays correct on phones. */
  :root { --eca-row-h: 46px; }
  .em-att { padding: 11px 10px; }
  .crumb, .crumb-seg { padding: 6px 9px; }
  .eca-search { padding: 12px; }
  .eca-search-bar { flex-wrap: wrap; }
  .eca-search-input { flex: 1 1 100%; order: 3; }
  .eca-index-badge { order: 4; }
  .eca-search-kinds { order: 1; }
  /* Email HTML body can otherwise force horizontal scroll; clamp it. */
  .em-html { min-height: 240px; }
  .eca-gcs-input, .eca-gcs-input.wide { flex: 1 1 100%; }
}

/* Very narrow (folded outer display ~390px): make the file browser drawer near-full-width
   and keep everything single-column with no horizontal overflow. */
@media (max-width: 430px) {
  .eca-browser { width: 92vw; max-width: 92vw; }
  .eca-brand { font-size: 13px; }
  .v-switch { flex-wrap: wrap; row-gap: 6px; }
  .v-tab.meta-tab { margin-left: 0; }
  .eca-status { font-size: 11px; padding: 7px 10px; }
}

/* ======================================================================================
   Surfaced backend capabilities: Case Overview dashboard, Review/coding panel, faceted
   search (chips + structured snippets). Reuses the existing purple design tokens + the
   panel/note/chip vocabulary so these read as part of the same app.
   ====================================================================================== */

/* Active states for the new header toggles (match the search/chat toggles). */
.eca-btn.overview-toggle.active,
.eca-btn.review-toggle.active { background: var(--pp-purple); border-color: var(--pp-purple-700); }

/* ---- Faceted search additions --------------------------------------------------------- */
.eca-facets { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.facet-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.facet-label {
  flex: 0 0 64px; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px;
}
.facet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.facet-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 11.5px;
}
.facet-chip:hover { border-color: var(--accent); }
.facet-chip.active { background: var(--pp-purple); border-color: var(--pp-purple-700); color: #fff; }
.facet-chip .fc-count {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: var(--bg); border-radius: 6px; padding: 0 5px;
}
.facet-chip.active .fc-count { color: rgba(255,255,255,.85); background: rgba(0,0,0,.18); }
.hit-elide { color: var(--muted); }

/* ---- Case Overview dashboard ---------------------------------------------------------- */
.eca-overview {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.08), var(--panel));
  padding: 12px 18px; max-height: 60vh; overflow: auto;
}
.eca-ov-head { display: flex; align-items: center; gap: 10px; }
.eca-ov-head .ov-title { font-weight: 700; }
.eca-ov-head .ov-sub { color: var(--muted); font-size: 12px; }
.eca-ov-head .eca-btn { margin-left: auto; }
.eca-ov-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.ov-dup-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.ov-scope { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-left: auto; }
.eca-ov-body { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.ov-scope-line { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ov-flag {
  padding: 8px 11px; border-radius: 8px; border: 1px solid #b4530030;
  background: rgba(180,120,0,.12); color: #fcd34d; font-size: 12.5px;
}
.ov-totals { display: flex; flex-wrap: wrap; gap: 10px; }
.ov-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 96px;
  padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2);
}
.ov-stat.sm { min-width: 84px; padding: 7px 10px; }
.ov-stat b { font-size: 18px; color: var(--text); }
.ov-stat.sm b { font-size: 15px; }
.ov-stat span { color: var(--muted); font-size: 11px; }
.ov-section { display: flex; flex-direction: column; gap: 6px; }
.ov-h { margin: 4px 0 2px; font-size: 13px; color: var(--accent); }
.ov-empty { color: var(--muted); font-size: 12.5px; }
.ov-unknown { color: var(--muted); font-size: 11.5px; }
.ov-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ov-bar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 8px; }
.ov-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.ov-bar-track { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.ov-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--pp-purple), var(--accent)); }
.ov-bar-val { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.ov-bar-detail { color: var(--muted); }
.ov-dup-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-dup-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ov-dup-row { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; font-size: 12px; }
.ov-dup-count { color: var(--accent); font-family: var(--mono); }
.ov-dup-size { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.ov-dup-member { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; }
.ov-email-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ov-email-h { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }

/* ---- Interactive timeline (within the overview panel) ---------------------------------- */
/* A chronological vertical-bar chart over the corpus: clickable buckets drive a date filter on
   the search/listing. Bars are CSS only (no chart lib / CDN — anti-exfil). */
.ov-timeline-section { gap: 8px; }
.ov-timeline-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-timeline-head .ov-h { margin: 0; }
.ov-tl-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ov-tl-tab {
  appearance: none; border: 0; background: var(--panel-2); color: var(--muted);
  font: inherit; font-size: 12px; padding: 4px 12px; cursor: pointer; line-height: 1.4;
}
.ov-tl-tab + .ov-tl-tab { border-left: 1px solid var(--line); }
.ov-tl-tab:hover { color: var(--text); }
.ov-tl-tab.active { background: var(--pp-purple); color: #fff; }
.ov-timeline { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ov-tl-active {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--pp-purple-700, var(--accent));
  background: rgba(109,40,217,.14); font-size: 12.5px;
}
.ov-tl-active-txt { color: var(--text); font-weight: 600; }
.ov-tl-clear { margin-left: auto; padding: 2px 9px; font-size: 12px; }
.ov-tl-bars {
  list-style: none; margin: 0; padding: 6px 2px 0; display: flex; align-items: flex-end;
  gap: 6px; min-height: 132px; overflow-x: auto; overflow-y: hidden;
}
.ov-tl-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 28px; flex: 1 1 0; }
.ov-tl-bar-btn {
  appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer;
  width: 100%; height: 116px; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 3px; border-radius: 6px 6px 0 0;
}
.ov-tl-count { font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 1; }
.ov-tl-bar {
  display: block; width: 78%; min-width: 10px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--pp-purple));
  transition: height .18s ease, filter .12s ease, background .12s ease;
}
.ov-tl-bar-btn:hover .ov-tl-bar { filter: brightness(1.12); }
.ov-tl-bar-btn:hover .ov-tl-count { color: var(--text); }
.ov-tl-bar-btn.active .ov-tl-bar { background: linear-gradient(180deg, #fbbf24, var(--pp-purple)); box-shadow: 0 0 0 2px var(--accent) inset; }
.ov-tl-bar-btn.active .ov-tl-count { color: var(--text); font-weight: 700; }
.ov-tl-xlabel {
  font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center;
}
.ov-tl-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.ov-tl-axis-unit { font-family: inherit; }
.ov-tl-cap { font-size: 11px; color: var(--muted); margin: 0; }
.ov-tl-unknown { color: var(--muted); }
.ov-tl-empty { padding: 6px 0; }

/* ---- Near-duplicate clusters (within the overview panel) ------------------------------- */
.ov-neardup { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.ov-thr-ctrl { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.ov-thr-ctrl input[type="range"] { accent-color: var(--pp-purple); cursor: pointer; }
.ov-thr-val { font-family: var(--mono); font-size: 12px; color: var(--text); min-width: 38px; text-align: right; }
.ov-nd-body { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.ov-nd-clusters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ov-nd-cluster { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); padding: 9px 11px; }
.ov-nd-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ov-nd-size { font-weight: 700; color: var(--text); font-size: 13px; }
.ov-nd-sim {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.ov-nd-cap { color: var(--muted); font-size: 11.5px; }
.ov-nd-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ov-nd-member { min-width: 0; }
.ov-nd-open {
  display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0;
  text-align: left; cursor: pointer; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); padding: 4px 7px; font: inherit;
}
.ov-nd-open:hover { border-color: var(--accent); background: var(--bg); }
.ov-nd-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ov-nd-name { font-size: 12.5px; white-space: nowrap; }
.ov-nd-path {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-family: var(--mono); font-size: 11px;
}
.ov-nd-more { color: var(--muted); font-size: 11.5px; padding: 3px 7px; }

/* ---- Email threads (conversation grouping) -------------------------------------------- */
.ov-threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ov-thread { border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); padding: 7px 9px; }
.ov-thread-head {
  display: flex; align-items: baseline; gap: 10px; width: 100%; min-width: 0;
  text-align: left; cursor: pointer; border: 0; background: transparent; color: var(--text);
  font: inherit; padding: 2px 0;
}
.ov-thread-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.ov-thread-caret { color: var(--accent); width: 1em; flex: 0 0 auto; }
.ov-thread-subject { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-thread-count {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; flex: 0 0 auto;
}
.ov-thread-dates { color: var(--muted); font-family: var(--mono); font-size: 11px; flex: 0 0 auto; }
.ov-thread-parts { color: var(--muted); font-size: 11.5px; margin: 2px 0 0 1.1em; word-break: break-word; }
.ov-thread-msgs { list-style: none; margin: 6px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ov-thread-msg { min-width: 0; }
.ov-thread-open {
  display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0;
  text-align: left; cursor: pointer; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); padding: 4px 7px; font: inherit;
}
.ov-thread-open:hover { border-color: var(--accent); background: var(--bg); }
.ov-thread-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ov-msg-from { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.ov-msg-date { color: var(--muted); font-family: var(--mono); font-size: 11px; flex: 0 0 auto; }
.ov-msg-path {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-family: var(--mono); font-size: 11px; text-align: right;
}
.ov-thread-more { color: var(--muted); font-size: 11.5px; padding: 3px 7px; }

/* ---- Languages (document language detection) ------------------------------------------ */
/* An accessible language histogram: human name + ISO-code chip + a proportional CSS bar (no
   chart lib / CDN), largest first, with a few clickable example docs per language. */
.ov-lang-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ov-lang-row { display: flex; flex-direction: column; gap: 3px; }
.ov-lang-head { display: grid; grid-template-columns: 130px auto 1fr auto; align-items: center; gap: 8px; }
.ov-lang-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.ov-lang-name.undet { color: var(--muted); font-style: italic; }
.ov-lang-code {
  font-family: var(--mono); font-size: 10.5px; color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 7px;
}
.ov-lang-track { height: 10px; }
.ov-lang-count { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.ov-lang-examples { list-style: none; margin: 1px 0 2px 0; padding: 0 0 0 8px; display: flex; flex-direction: column; gap: 2px; }
.ov-lang-ex { min-width: 0; }
.ov-lang-open {
  display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0;
  text-align: left; cursor: pointer; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); padding: 3px 7px; font: inherit;
}
.ov-lang-open:hover { border-color: var(--accent); background: var(--bg); }
.ov-lang-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ov-lang-ex-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-family: var(--mono); }
.ov-lang-ex-conf { color: var(--muted); font-family: var(--mono); font-size: 10.5px; flex: 0 0 auto; }

/* ---- Review & coding panel ------------------------------------------------------------ */
.eca-review {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(109,40,217,.08), var(--panel));
  padding: 12px 18px; max-height: 70vh; overflow: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.eca-rv-head { display: flex; align-items: center; gap: 10px; }
.eca-rv-head .rv-title { font-weight: 700; }
.eca-rv-head .rv-sub { color: var(--muted); font-size: 12px; }
.eca-rv-head .eca-btn { margin-left: auto; }
.rv-progress { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rv-stat { color: var(--muted); font-size: 12.5px; }
.rv-stat b { color: var(--text); font-size: 15px; margin-right: 4px; }
.rv-resp { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.rv-resp-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); font-family: var(--mono);
}
.rv-resp-chip[data-resp="responsive"] { color: #86efac; border-color: #14532d; }
.rv-resp-chip[data-resp="non-responsive"] { color: #fca5a5; border-color: #7f1d1d; }
.rv-resp-chip[data-resp="needs-review"] { color: #fcd34d; border-color: #78350f; }
.rv-section { display: flex; flex-direction: column; gap: 8px; }
.rv-section-head { font-size: 13px; color: var(--accent); font-weight: 600; }
.rv-report-summary { font-size: 12.5px; }
.rv-report-counts { display: inline-flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.rv-report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rv-empty { color: var(--muted); font-size: 12.5px; }
.rv-form { display: flex; flex-direction: column; gap: 10px; }
.rv-target { font-family: var(--mono); font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-field { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; margin: 0; }
.rv-field legend { color: var(--muted); font-size: 11px; padding: 0 4px; }
.rv-radios { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.rv-radio, .rv-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.rv-note-lbl { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.rv-note {
  resize: vertical; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px;
}
.rv-note:focus { border-color: var(--accent); }
.rv-tags-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rv-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rv-tags-empty { color: var(--muted); font-size: 12px; }
.rv-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 9px;
  border-radius: 999px; border: 1px solid var(--pp-purple-700); background: rgba(109,40,217,.14);
  color: var(--accent); font-size: 11.5px; font-family: var(--mono);
}
.rv-tag-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 11px; }
.rv-tag-x:hover { color: #fca5a5; }
.rv-tag-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rv-tag-input {
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font-size: 12.5px; width: 120px;
}
.rv-tag-input:focus { border-color: var(--accent); }
.rv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rv-audit { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-left: auto; }
.rv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rv-list-item { display: flex; align-items: center; gap: 8px; }
.rv-list-main {
  flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0;
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; text-align: left;
}
.rv-list-main:hover { border-color: var(--accent); }
.rv-list-main.static { cursor: default; }
.rv-li-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-li-meta { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-left: auto; }
.rv-list-del { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; cursor: pointer; padding: 6px 9px; }
.rv-list-del:hover { color: #fca5a5; border-color: #7f1d1d; }
.rv-prod-new { display: flex; gap: 8px; align-items: center; }
.rv-prod-input {
  flex: 1; min-width: 0; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 13px;
}
.rv-prod-input:focus { border-color: var(--accent); }
.v-tab.review-tab { margin-left: 6px; }

/* Focus rings for the new interactive surfaces (keyboard operability). */
.facet-chip:focus-visible, .rv-list-main:focus-visible, .rv-list-del:focus-visible,
.rv-tag-x:focus-visible, .v-tab.review-tab:focus-visible,
.ov-tl-tab:focus-visible, .ov-tl-bar-btn:focus-visible, .ov-tl-clear:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Respect reduced-motion: drop the bar grow/hover transitions. */
@media (prefers-reduced-motion: reduce) {
  .ov-tl-bar { transition: none; }
}

/* Responsive: stack the overview email columns + let the bar label shrink on narrow screens. */
@media (max-width: 900px) {
  .ov-email-cols { grid-template-columns: 1fr; }
  .ov-bar-row { grid-template-columns: 96px 1fr auto; }
}
@media (max-width: 600px) {
  .eca-overview, .eca-review { padding: 12px; }
  .ov-bar-row { grid-template-columns: 84px 1fr auto; }
  .facet-label { flex-basis: 100%; }
  /* On narrow screens stack the member name over its path so neither is clipped awkwardly. */
  .ov-nd-open { flex-direction: column; align-items: stretch; gap: 1px; }
  .ov-thread-open { flex-direction: column; align-items: stretch; gap: 1px; }
  /* Languages: let the name column shrink so the bar + code chip stay readable. */
  .ov-lang-head { grid-template-columns: 84px auto 1fr auto; }
  .ov-msg-from { max-width: 100%; }
  .ov-msg-path { text-align: left; }
  .ov-thread-head { flex-wrap: wrap; }
  .ov-thr-ctrl { flex-wrap: wrap; }
  /* Timeline stays usable on mobile: bars keep a tappable min width and scroll horizontally. */
  .ov-tl-col { min-width: 34px; flex: 0 0 auto; }
  .ov-tl-bars { gap: 8px; }
  .ov-tl-clear { margin-left: 0; }
}

/* ---- Produce wizard (guided redact → Bates → load files → produce) -------------------
   Reuses the .eca-help-backdrop overlay; the dialog body matches the help/formats dialogs
   (purple accent, dense, keyboard-friendly). Focus trap + Escape come from dialog_keydown. */
.eca-wizard {
  width: min(560px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 20px 60px #0009; overflow: hidden;
}
.eca-wizard:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Step indicator */
.wiz-steps {
  display: flex; gap: 0; margin: 0; padding: 10px 14px; list-style: none;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.wiz-step {
  display: flex; align-items: center; gap: 7px; flex: 1; color: var(--muted);
  font-size: 12.5px; position: relative;
}
.wiz-step + .wiz-step::before {
  content: ""; position: absolute; left: -6px; top: 50%; width: 12px; height: 1px;
  background: var(--line);
}
.wiz-step-num {
  width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px;
  background: var(--bg);
}
.wiz-step.active { color: var(--text); }
.wiz-step.active .wiz-step-num { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 10px #a78bfa44; }

/* Body / panes */
.wiz-body { padding: 16px; overflow-y: auto; }
.wiz-pane { display: flex; flex-direction: column; gap: 12px; }
.wiz-h { margin: 0; color: var(--accent); font-size: 14px; font-weight: 600; }
.wiz-help { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* Scope card */
.wiz-scope-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg);
  display: flex; flex-direction: column; gap: 8px;
}
.wiz-scope-name { font-weight: 600; color: var(--text); }
.wiz-scope-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.wiz-note { color: var(--muted); font-size: 12px; }
.wiz-warn {
  color: #fecaca; background: #7f1d1d33; border: 1px solid #b91c1c66; border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; line-height: 1.5;
}

/* Options form */
.wiz-field { display: flex; flex-direction: column; gap: 5px; }
.wiz-lbl { color: var(--muted); font-size: 12px; }
.wiz-in {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  padding: 7px 10px; font-size: 13px; font-family: var(--sans);
}
.wiz-in:focus { border-color: var(--accent); outline: none; }
.wiz-hint { color: var(--muted); font-size: 11.5px; }
.wiz-check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.wiz-incl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; gap: 8px; }
.wiz-incl legend { color: var(--accent); font-size: 12px; padding: 0 4px; }

/* Summary */
.wiz-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiz-summary li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.wiz-summary li:last-child { border-bottom: none; }
.wiz-sum-k { color: var(--muted); }
.wiz-sum-v { color: var(--text); font-weight: 600; text-align: right; }
.wiz-artifacts { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.wiz-artifacts-h { color: var(--accent); font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.wiz-artifacts ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.wiz-artifacts code { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.wiz-guarantee {
  margin: 0; color: #bbf7d0; background: #064e3b44; border: 1px solid #10b98155;
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.5;
}

/* Produce / running / done */
.wiz-empty { color: var(--muted); font-size: 13px; }
.wiz-running { display: flex; flex-direction: column; gap: 10px; }
.wiz-running-label { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.wiz-progress { position: static; padding: 0; opacity: 1; }
.wiz-done { display: flex; flex-direction: column; gap: 12px; }
.wiz-done-head { color: #bbf7d0; font-weight: 700; font-size: 14px; }
.wiz-skips summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.wiz-skips ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; word-break: break-all; }
.wiz-download-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Footer nav */
.wiz-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border-top: 1px solid var(--line); background: var(--panel-2);
}
.wiz-foot-spacer { flex: 1; }
.rv-produce-btn { white-space: nowrap; }

@media (max-width: 560px) {
  .wiz-step-label { display: none; }
  .wiz-summary li { flex-direction: column; gap: 2px; }
  .wiz-sum-v { text-align: left; }
}
