/* ============================================================
   Design tokens — Linear-style quiet aesthetic
============================================================ */
:root {
  /* Depth stack — LCH neutrals, hue 272 (slight blue-violet tint) */
  --depth-0:  lch(1.82% 0 272 / 1); /* sidebar — Linear --bg-sidebar-color */
  --depth-1:  lch(4.52% 0.3 272);   /* base bg (Linear bg-primary) */
  --depth-2:  lch(6.77% 0.75 272);  /* surface: panels, cards (Linear bg-quaternary) */
  --depth-3:  lch(9.02% 2.1 272);   /* elevated: inputs, tags (Linear bg-secondary) */
  --depth-4:  lch(11.27% 3 272);    /* floating: dropdowns, tooltips (Linear bg-tertiary) */

  /* Borders */
  --border:       lch(15.32% 1.38 272);  /* most visible (Linear border-tertiary) */
  --border-muted: lch(8.84% 1.38 272);   /* Linear border-secondary */
  --border-dim:   lch(8.84% 1.38 272);   /* Linear border-primary in dark collapses */

  /* Text */
  --text:    lch(100% 0 272);              /* pure white */
  --text-2:  lch(90.35% 1.15 272);         /* body */
  --muted:   lch(61.399% 1.15 272);        /* meta / secondary */
  --muted-2: lch(36.308% 1.15 272);        /* labels / kickers / disabled */

  /* Accent — Linear blue-violet (single brand note, used sparingly) */
  --accent:       lch(53% 52.26 286.91);
  --accent-dim:   lch(48% 50 286.91);
  --accent-deep:  lch(40% 45 286.91);
  --accent-faint: lch(53% 52.26 286.91 / 0.08);
  --accent-glow:  lch(53% 52.26 286.91 / 0.20);
  --accent-ring:  lch(53% 52.26 286.91 / 0.32);

  /* Status (semantic accents — used by enriched-batch, ev-sync, validation banners) */
  --accent-info:        lch(62% 35 250);
  --accent-info-bg:     lch(62% 35 250 / 0.10);
  --accent-warn:        lch(72% 50 80);
  --accent-warn-bg:     lch(72% 50 80 / 0.10);
  --accent-success:     lch(62% 50 145);
  --accent-success-bg:  lch(62% 50 145 / 0.10);
  --accent-danger:      lch(60% 55 25);
  --accent-danger-bg:   lch(60% 55 25 / 0.10);

  /* Existing aliases — kept for backwards compat with .status.ok / .status.err / etc. */
  --ok:   var(--accent-success);
  --err:  var(--accent-danger);
  --warn: var(--accent-warn);

  /* Typography — Inter; mono drops to system */
  --font-display: var(--font-body);
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* Shadows — quieter than the current blue-tinted heavy stack */
  --shadow-sm:
    0 1px 2px rgba(0,0,0,0.20),
    0 0 0 1px rgba(255,255,255,0.02);
  --shadow-md:
    0 4px 12px rgba(0,0,0,0.24),
    0 1px 3px rgba(0,0,0,0.12);
  --shadow-accent:
    0 0 0 1px var(--accent-ring),
    0 4px 16px var(--accent-glow);

  /* Spacing scale — unchanged */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;

  /* Radius — unchanged */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    8px;
  --r-lg: 12px;

  /* Easing — unchanged */
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  margin: 0;
  background: var(--depth-1);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   App shell
============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 228px 1fr;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
============================================================ */
.sidebar {
  background: var(--depth-0);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--sp-4) var(--sp-2) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar > * { position: relative; z-index: 1; }

/* Brand — display font, tight tracking */
.brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: var(--sp-2);
  line-height: 1.2;
}

.brand span {
  display: block;
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: 3px;
  opacity: 0.9;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: var(--sp-2);
}
.sidebar-section[hidden] { display: none; }

.section-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
  font-weight: 500;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Nav items — slide-in hover, glow on active */
.mode-item,
.nav-item,
.mode-active {
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: none;
  transform: translateX(0);
  transition:
    color 160ms var(--ease),
    background-color 160ms var(--ease),
    border-left-color 160ms var(--ease),
    transform 200ms var(--spring);
}

.mode-item:hover,
.nav-item:hover,
.mode-active:hover {
  background: var(--depth-2);
  color: var(--text-2);
  transform: translateX(2px);
}

.mode-item.active,
.nav-item.active {
  background: var(--accent-faint);
  color: var(--text);
  border-radius: var(--r-sm);
  transform: translateX(0);
}

.mode-item:focus-visible,
.nav-item:focus-visible,
.mode-active:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: -2px;
}

.mode-item-sub {
  padding-left: 22px;
  font-size: 12px;
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--sp-3) 0 0;
  border-top: 1px solid var(--border-muted);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
}

.sidebar-footer button.secondary {
  width: auto;
  flex-shrink: 0;
}

.sidebar-footer button.secondary {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--muted-2);
  font-size: 12px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: none;
  letter-spacing: -0.01em;
  transition:
    border-color 160ms var(--ease),
    color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.sidebar-footer button.secondary:hover {
  border-color: var(--muted);
  color: var(--text-2);
  background-color: var(--depth-2);
}

.sidebar-footer button.secondary:active {
  transform: translateY(1px);
}

/* ============================================================
   Main area
============================================================ */
.main {
  padding: var(--sp-6) 40px 80px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  align-items: center;
  min-height: 100vh;
}

/* Page header — accent left border, subtle shadow */
.page-header {
  width: 80%;
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4) 10px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-lg);
  background: var(--depth-2);
  box-shadow: var(--shadow-sm);
}

.page-header-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-header-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

/* ============================================================
   Panels
============================================================ */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--depth-2);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel.is-hidden,
.main-section.is-hidden { display: none; }

.config-panel { width: 80%; max-width: 960px; }
.main-section  { width: 80%; max-width: 960px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-muted);
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.03em;
}

.config-body { display: grid; gap: 14px; min-width: 0; }
.config-body > * { min-width: 0; }

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ============================================================
   Layout grids
============================================================ */
.row3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
}

.row3 select { width: 100%; }

.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.row-project-actions {
  align-items: end;
  grid-template-columns: 1fr auto;
  margin-top: var(--sp-2);
}

.row-project-actions .muted { align-self: end; }
.row-project-actions button { justify-self: end; }

/* ============================================================
   Form controls — consistent depth-3 bg
============================================================ */
input,
select,
textarea,
button {
  font-family: var(--font-body);
  font-size: 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  padding: 7px 10px;
  background: var(--depth-3);
  color: var(--text);
  transition:
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease),
    background-color 160ms var(--ease);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--depth-4);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--depth-2);
  color: var(--muted-2);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================================
   Buttons — full interactive states
============================================================ */
button {
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: -0.01em;
  border-radius: var(--r-sm);
  padding: 7px 14px;
  line-height: 20px;
  transition:
    background-color 160ms var(--ease),
    border-color 160ms var(--ease),
    box-shadow 200ms var(--ease),
    transform 120ms var(--spring),
    color 160ms var(--ease);
}

/* Primary — solid teal, dark text, glow on hover */
button.primary {
  background: var(--accent);
  border: 1px solid var(--accent-dim);
  color: #ffffff;
  font-weight: 700;
  box-shadow:
    0 1px 3px lch(53% 52.26 286.91 / 0.20),
    0 0 0 0 transparent;
}

button.primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-deep);
  box-shadow:
    0 2px 8px lch(53% 52.26 286.91 / 0.30),
    0 0 20px lch(53% 52.26 286.91 / 0.15);
}

button.primary:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 1px 4px lch(53% 52.26 286.91 / 0.15);
}

button.primary:disabled {
  background: var(--depth-3);
  border-color: var(--border);
  color: var(--muted-2);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Secondary — depth-3 bg, visible border */
button.secondary {
  background: var(--depth-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover {
  background: var(--depth-4);
  border-color: var(--muted);
  color: var(--text);
}

button.secondary:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: none;
}

button.secondary:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* ============================================================
   Query input card — glow on focus
============================================================ */
.input-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--depth-2);
  padding: var(--sp-4);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 200ms var(--ease),
    box-shadow 200ms var(--ease);
}

/* Activated when textarea inside is focused — via JS fallback: .input-card:focus-within */
.input-card:focus-within {
  border-color: var(--accent-deep);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--accent-faint),
    0 0 32px lch(53% 52.26 286.91 / 0.06);
}

.input-card label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
  font-weight: 500;
}

textarea {
  width: 100%;
  min-height: 120px;
  resize: none;
  line-height: 1.65;
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--depth-3);
  font-size: 13.5px;
  color: var(--text);
  font-family: var(--font-body);
}

textarea:focus {
  outline: none;
  border-color: var(--border-dim);
  box-shadow: none;
}

textarea::placeholder { color: var(--muted-2); }

/* ============================================================
   Controls bar
============================================================ */
.controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  flex-wrap: wrap;
}

.controls.is-hidden { display: none; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  cursor: pointer;
  user-select: none;
  transition: color 160ms var(--ease);
}

.checkbox:hover { color: var(--text-2); }

.checkbox input {
  width: 14px;
  height: 14px;
  margin: 0;
  border-radius: 3px;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  border: 1px solid var(--border);
  background: var(--depth-3);
}

.status {
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.status.ok  { color: var(--ok); }
.status.err { color: var(--err); }

/* ============================================================
   Results — spring-eased entrance, teal accent reveal
============================================================ */
.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-connector {
  height: 0;
  width: 0;
  margin: 4px auto -4px;
  border-left: 1px dashed var(--border);
  opacity: 0;
}

.result-connector.is-animating {
  animation: connectorIn 300ms var(--spring) forwards;
}

@keyframes connectorIn {
  from { height: 0; opacity: 0; }
  to   { height: 32px; opacity: 1; }
}

.result-card {
  border: 1px solid var(--border);
  border-top: 2px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--depth-2);
  padding: var(--sp-4);
  opacity: 0;
  transform: translateY(8px);
  box-shadow: var(--shadow-sm);
}

.result-card.is-animating {
  animation: cardReveal 360ms var(--spring) forwards;
}

@keyframes cardReveal {
  from {
    border-top-color: var(--border);
    box-shadow: var(--shadow-sm);
  }
  to {
    border-top-color: var(--accent);
    box-shadow:
      var(--shadow-md),
      0 0 0 0 transparent,
      0 -1px 24px lch(53% 52.26 286.91 / 0.07);
  }
}

.result-card.is-visible {
  animation: resultIn 320ms var(--spring) forwards;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-muted);
}

.result-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.copy-btn {
  border: 1px solid var(--border-dim);
  background: var(--depth-3);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.03em;
  transition:
    color 160ms var(--ease),
    border-color 160ms var(--ease),
    background-color 160ms var(--ease);
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent-deep);
  background: var(--accent-faint);
}

.result-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-timer {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Markdown content */
.result-body h1,
.result-body h2,
.result-body h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 6px;
  color: var(--text);
  letter-spacing: -0.02em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-muted);
}

.result-body p {
  margin: 8px 0;
  line-height: 1.7;
  color: var(--text-2);
}

.result-body ul,
.result-body ol { margin: 8px 0 8px 20px; padding: 0; }

.result-body li {
  margin: 4px 0;
  color: var(--text-2);
  line-height: 1.65;
}

.result-body code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--depth-3);
  padding: 1px 5px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-dim);
  color: var(--accent);
}

.result-body pre {
  background: var(--depth-3);
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow-x: auto;
  white-space: pre-wrap;
  margin: 10px 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.result-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-2);
}

/* ============================================================
   Sources
============================================================ */
.sources {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-muted);
}

.sources-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
  font-weight: 500;
}

.source-item {
  padding: 9px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-muted);
  background: var(--depth-3);
  margin-bottom: 6px;
  transition: border-color 160ms var(--ease);
}

.source-item:hover { border-color: var(--border); }
.source-item:last-child { margin-bottom: 0; }

.source-item .source-label {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 3px;
  color: var(--text);
}

.source-excerpt,
.source-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--depth-1);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
  padding: 6px 9px;
  white-space: pre-wrap;
  word-break: break-word;
}

.source-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

/* ============================================================
   Utility
============================================================ */
.muted {
  color: var(--muted);
  font-size: 12px;
}

.is-hidden { display: none !important; }

.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ============================================================
   History
============================================================ */
.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--border-muted);
  border-radius: var(--r);
  padding: 10px 12px;
  background: var(--depth-3);
  transition:
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease);
  cursor: default;
}

.history-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.history-item-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  letter-spacing: 0.02em;
}

.history-item-question {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.history-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.history-detail {
  border: 1px solid var(--border-muted);
  border-radius: var(--r);
  padding: 14px;
  background: var(--depth-3);
  min-height: 240px;
}

.history-detail h3 {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  margin: 14px 0 6px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

.history-detail h3:first-child { margin-top: 0; }

.history-detail pre {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--depth-1);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-muted);
  margin: 0 0 8px;
  color: var(--text-2);
}

.history-empty {
  color: var(--muted-2);
  font-size: 13px;
  font-style: italic;
  font-family: var(--font-body);
}

.history-hint {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  border: 1px solid lch(53% 52.26 286.91 / 0.22);
  background: var(--accent-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--accent);
}

.history-hint.is-hidden { display: none; }

.history-hint button.secondary {
  font-size: 11.5px;
  padding: 4px 10px;
  border-color: lch(53% 52.26 286.91 / 0.25);
  background: lch(53% 52.26 286.91 / 0.06);
  color: var(--accent);
}

.history-hint button.secondary:hover {
  background: lch(53% 52.26 286.91 / 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Batch panel
============================================================ */
.batch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.bsm-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  user-select: none;
  transition: color 250ms var(--ease);
}
.bsm-label-inactive { color: var(--muted-2); }

/* ============================================================
   Mode hero
============================================================ */
.mode-hero {
  text-align: center;
  padding: var(--sp-5) var(--sp-4) var(--sp-3);
  pointer-events: none;
  user-select: none;
}
.mode-hero-title {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  margin: 0 0 10px;
  line-height: 1.2;
}
.mode-hero-title em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}
.mode-hero-desc {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 auto;
  max-width: 460px;
  line-height: 1.6;
}

/* ============================================================
   Evidence panel
============================================================ */
.ev-card { margin-bottom: 12px; overflow:hidden; }
.ev-sm-btn { padding:5px 12px; font-size:13px; width:auto; }
/* Drop zone */
.ev-dropzone {
  display:flex; align-items:center; gap:12px;
  margin-top:8px; padding:12px 16px;
  border:1.5px dashed var(--border);
  border-radius:8px;
  background:var(--depth-3);
  cursor:pointer;
  transition:border-color 150ms, background 150ms;
}
.ev-dropzone:hover, .ev-dropzone.drag-over {
  border-color:var(--accent);
  background: var(--accent-faint);
}
.ev-dropzone-icon {
  color:var(--accent);
  flex-shrink:0;
  opacity:.8;
}
.ev-dropzone-text {
  display:flex; align-items:center; gap:8px;
  font-size:13px; color:var(--muted);
}
.ev-dropzone-label { white-space:nowrap; }
.ev-choose-btn {
  padding:3px 11px; font-size:12px; font-weight:600;
  background:var(--depth-4); color:var(--text-2);
  border:1px solid var(--border); border-radius:5px;
  cursor:pointer; transition:border-color 120ms, color 120ms;
}
.ev-choose-btn:hover { border-color:var(--accent); color:var(--accent); }
/* Selected file row */
.ev-upload-actions {
  display:flex; align-items:center; gap:8px; margin-top:8px;
}
.ev-selected-name {
  flex:1; font-size:13px; color:var(--text-2);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  padding:4px 8px; background:var(--depth-3);
  border:1px solid var(--border); border-radius:6px;
}
.ev-clear-btn {
  background:none; border:none; color:var(--muted); font-size:14px;
  cursor:pointer; padding:4px 6px; line-height:1; border-radius:4px;
  flex-shrink:0;
}
.ev-clear-btn:hover { color:var(--err); }

/* Batch upload progress */
.ev-batch-progress { margin-top:10px; overflow:hidden; min-width:0; }
.ev-progress-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; font-size:13px; }
.ev-progress-bar-wrap { height:6px; background:var(--depth-3); border-radius:3px; overflow:hidden; margin-bottom:8px; }
.ev-progress-bar { height:100%; background:var(--accent); border-radius:3px; transition:width 200ms; }
.ev-batch-file { display:flex; justify-content:space-between; padding:3px 0; border-bottom:1px solid var(--border); }
.ev-bf-path { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-2); }
.ev-bf-status { flex-shrink:0; margin-left:12px; font-size:12px; }
.ev-bf-status.ok { color:var(--ok); }
.ev-bf-status.err { color:var(--err); }
.ev-bf-status.muted { color:var(--muted); }

.ev-table { width:100%; border-collapse:collapse; font-size:13px; table-layout:fixed; }
.ev-table th { text-align:left; font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; padding:6px 8px; border-bottom:1px solid var(--border); white-space:nowrap; }
.ev-table td { padding:7px 8px; border-bottom:1px solid var(--border); vertical-align:middle; }
.ev-table tr:last-child td { border-bottom:none; }
.ev-table td input[type=text] { padding:4px 7px; font-size:12px; }
.ev-status-ready      { color:var(--ok); font-weight:600; }
.ev-status-processing { color:var(--accent); }
.ev-status-removed,
.ev-status-stored     { color:var(--muted); }
.ev-status-unsupported,
.ev-status-unknown    { color:var(--err); }
.ev-subtab-bar { display:flex; gap:4px; margin-bottom:14px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.ev-subtab { background:none; border:none; border-bottom:2px solid transparent; padding:5px 12px; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer; border-radius:4px 4px 0 0; transition:color 120ms; }
.ev-subtab.active { color:var(--accent); border-bottom-color:var(--accent); }
.ev-subtab:hover:not(.active) { color:var(--text); }
.ev-sync-bar { padding:8px 12px; border-radius:6px; font-size:13px; margin-bottom:14px; background:var(--depth-3); border:1px solid var(--border); color:var(--text); }
.ev-sync-badge { display:inline-block; padding:1px 7px; border-radius:10px; font-size:11px; font-weight:700; }
.ev-sync-ok    { background: var(--accent-success-bg); color: var(--accent-success); }
.ev-sync-miss  { background: var(--accent-warn-bg);    color: var(--accent-warn); }
.ev-sync-stale { background: var(--accent-warn-bg);    color: var(--accent-warn); }
.ev-sync-orphan{ background: var(--accent-danger-bg);  color: var(--accent-danger); }
/* Filter bar */
.ev-filter-bar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:12px; padding:10px 0 0; }
.ev-filter-bar input[type=text] { flex:1; min-width:140px; padding:5px 9px; font-size:13px; }
.ev-filter-bar select { padding:5px 9px; font-size:13px; }
/* Pagination controls */
.ev-pagination { display:flex; gap:8px; align-items:center; margin-top:10px; }
.ev-page-info { color:var(--muted); font-size:13px; }
/* Sortable column headers */
.ev-table th.ev-sortable { cursor:pointer; user-select:none; white-space:nowrap; }
.ev-table th.ev-sortable:hover { color:var(--text); }
.ev-table th.ev-sort-asc::after  { content:" ▲"; font-size:9px; }
.ev-table th.ev-sort-desc::after { content:" ▼"; font-size:9px; }
/* Metadata modal */
.ev-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:9999; display:flex; align-items:center; justify-content:center; }
.ev-modal { background:var(--depth-2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:24px; min-width:320px; max-width:560px; width:90%; max-height:80vh; overflow-y:auto; position:relative; box-shadow: var(--shadow-md); }
.ev-modal-close { position:absolute; top:10px; right:12px; background:none; border:none; font-size:18px; cursor:pointer; color:var(--muted); line-height:1; padding:4px; }
.ev-modal h3 { margin:0 32px 16px 0; font-size:15px; }
.ev-meta-row { display:flex; gap:12px; padding:5px 0; border-bottom:1px solid var(--border); font-size:13px; }
.ev-meta-row:last-child { border-bottom:none; }
.ev-meta-key { color:var(--muted); min-width:150px; flex-shrink:0; font-size:12px; }
.ev-meta-val { min-width:0; word-break:break-all; }

/* ============================================================
   Light theme — override tokens on [data-theme="light"]
   LCH hue 282 (whisper of blue-violet in the neutrals)
============================================================ */
[data-theme="light"] {
  --depth-0:  lch(95.94% 0.5 282);   /* sidebar (Linear --bg-sidebar-color) */
  --depth-1:  lch(98.94% 0.5 282);   /* base bg (Linear bg-primary) */
  --depth-2:  lch(96.94% 0.5 282);   /* panels (Linear bg-quaternary) */
  --depth-3:  lch(93.44% 0.5 282);   /* inputs (Linear bg-secondary) */
  --depth-4:  lch(91.94% 0.5 282);   /* floating (Linear bg-tertiary) */

  --border:       lch(85.44% 0 282);
  --border-muted: lch(89.49% 0 282);
  --border-dim:   lch(96.24% 0 282);

  --text:    lch(9.894% 0 282);
  --text-2:  lch(19.788% 1.25 282);
  --muted:   lch(39.576% 1.25 282);
  --muted-2: lch(65.3% 1.25 282);

  /* Accent stays the same hue; faint/glow nudged for legibility on light bg */
  --accent-faint: lch(53% 52.26 286.91 / 0.10);
  --accent-glow:  lch(53% 52.26 286.91 / 0.18);

  /* Status — re-tuned for light bg (lower lightness, similar chroma) */
  --accent-info:        lch(48% 40 250);
  --accent-info-bg:     lch(48% 40 250 / 0.10);
  --accent-warn:        lch(50% 60 65);
  --accent-warn-bg:     lch(50% 60 65 / 0.10);
  --accent-success:     lch(45% 55 145);
  --accent-success-bg:  lch(45% 55 145 / 0.10);
  --accent-danger:      lch(50% 65 25);
  --accent-danger-bg:   lch(50% 65 25 / 0.10);

  /* Shadows — much subtler on light bg */
  --shadow-sm:
    0 1px 2px rgba(0,0,0,0.04),
    0 0 0 1px rgba(0,0,0,0.02);
  --shadow-md:
    0 4px 12px rgba(0,0,0,0.06),
    0 1px 3px rgba(0,0,0,0.04);
  --shadow-accent:
    0 0 0 1px var(--accent-ring),
    0 4px 16px var(--accent-glow);
}


/* ============================================================
   Theme toggle — pill-style sun/moon switch
============================================================ */
.theme-toggle {
  display: flex;
  width: 64px;
  height: 32px;
  padding: 4px;
  border-radius: 16px;
  cursor: pointer;
  position: relative;
  align-items: center;
  background: lch(11.27% 3 272);
  border: 1px solid lch(15.32% 1.38 272);
  transition:
    background 300ms var(--ease),
    border-color 300ms var(--ease);
  outline: none;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.tt-thumb {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: lch(15.32% 1.38 272);
  color: lch(100% 0 272);
  flex-shrink: 0;
  transition:
    transform 300ms var(--ease),
    background 300ms var(--ease),
    color 300ms var(--ease);
  transform: translateX(0);
  z-index: 1;
  position: relative;
}

.tt-track-icon {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  color: lch(36.308% 1.15 272);
  transition:
    color 300ms var(--ease),
    right 300ms var(--ease),
    left 300ms var(--ease);
}

/* Dark mode: thumb shows moon, track shows sun */
.tt-thumb .tt-sun  { display: none; }
.tt-thumb .tt-moon { display: block; }
.tt-track-icon .tt-sun  { display: block; }
.tt-track-icon .tt-moon { display: none; }

/* Light mode: thumb shows sun on right, track shows moon on left */
.theme-toggle.is-light {
  background: lch(91.94% 0.5 282);
  border-color: lch(85.44% 0 282);
}

.theme-toggle.is-light .tt-thumb {
  transform: translateX(32px);
  background: lch(93.44% 0.5 282);
  color: lch(9.894% 0 282);
}

.theme-toggle.is-light .tt-track-icon {
  right: auto;
  left: 8px;
  color: lch(9.894% 0 282);
}

.theme-toggle.is-light .tt-thumb .tt-sun  { display: block; }
.theme-toggle.is-light .tt-thumb .tt-moon { display: none; }
.theme-toggle.is-light .tt-track-icon .tt-sun  { display: none; }
.theme-toggle.is-light .tt-track-icon .tt-moon { display: block; }

/* ============================================================
   History toggle — keep-history pill switch
============================================================ */
.ht-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-left: auto;
}
.hist-toggle {
  display: flex;
  width: 52px;
  height: 28px;
  padding: 3px;
  border-radius: 14px;
  cursor: pointer;
  position: relative;
  align-items: center;
  background: var(--depth-3);
  border: 1px solid var(--border);
  transition: background 250ms var(--ease), border-color 250ms var(--ease);
  outline: none;
  flex-shrink: 0;
}
.hist-toggle:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.ht-thumb {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--depth-4);
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 250ms var(--ease), background 250ms var(--ease), color 250ms var(--ease);
  transform: translateX(0);
  z-index: 1;
  position: relative;
}
.ht-track-icon {
  position: absolute;
  right: 7px;
  display: flex;
  align-items: center;
  color: var(--muted-2);
  transition: color 250ms var(--ease), right 250ms var(--ease), left 250ms var(--ease);
}
/* OFF: thumb left shows slash, track right shows clock */
.ht-thumb   .ht-icon-on  { display: none; }
.ht-thumb   .ht-icon-off { display: block; }
.ht-track-icon .ht-icon-on  { display: block; }
.ht-track-icon .ht-icon-off { display: none; }
/* ON */
.hist-toggle.is-on { background: lch(53% 52.26 286.91 / 0.14); border-color: var(--accent); }
.hist-toggle.is-on .ht-thumb {
  transform: translateX(24px);
  background: var(--accent);
  color: #ffffff;
}
.hist-toggle.is-on .ht-track-icon { right: auto; left: 7px; color: var(--muted); }
.hist-toggle.is-on .ht-thumb   .ht-icon-on  { display: block; }
.hist-toggle.is-on .ht-thumb   .ht-icon-off { display: none; }
.hist-toggle.is-on .ht-track-icon .ht-icon-on  { display: none; }
.hist-toggle.is-on .ht-track-icon .ht-icon-off { display: block; }
.ht-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  user-select: none;
}

/* ============================================================
   Project Members — user picker dropdown
============================================================ */
.pm-user-results {
  position: absolute;
  background: var(--depth-4);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  width: 100%;
}
.pm-user-results .pm-user-option {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-2);
}
.pm-user-results .pm-user-option:hover {
  background: var(--depth-3);
  color: var(--text);
}

/* ============================================================
   Responsive
============================================================ */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar::before { display: none; }
  .history-grid { grid-template-columns: 1fr; }
  .row3, .row { grid-template-columns: 1fr; }
  .checkbox { margin-left: 0; }
  .main-section, .config-panel, .page-header { width: 100%; }
  .main { padding: var(--sp-4) var(--sp-4) 60px; }
}

/* =============================== Platform Users table =============================== */
.pu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.pu-table th,
.pu-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.pu-table th {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pu-table td.pu-30d {
  color: var(--accent-success);
}

/* ── Enriched Batch: format guide ────────────────────────────────────────── */
.enriched-format-guide {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.enriched-format-guide summary {
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
  background: var(--depth-3);
}
.enriched-format-guide summary:hover {
  background: var(--depth-2);
}
.enriched-format-content {
  padding: 12px 14px;
  font-size: 12px;
}
.enriched-format-content p {
  margin: 0 0 8px;
  color: var(--muted);
}
.enriched-format-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-bottom: 10px;
}
.enriched-format-table td {
  padding: 4px 8px;
  border: 1px solid var(--border);
}
.enriched-row-header td {
  background: var(--accent-info-bg);
  color: var(--accent-info);
  font-weight: 600;
}
.enriched-row-desc td {
  background: var(--accent-warn-bg);
  color: var(--accent-warn);
}
.enriched-format-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.enriched-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.enriched-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.enriched-swatch-header {
  background: var(--accent-info);
}
.enriched-swatch-desc {
  background: var(--accent-warn);
}
.enriched-meta-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}
.enriched-meta-hint code {
  background: var(--depth-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

/* ── Enriched Batch: validation summary ──────────────────────────────────── */
.enriched-validation {
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.enriched-validation.valid {
  background: var(--accent-success-bg);
  border: 1px solid var(--accent-success);
}
.enriched-validation.valid .enriched-validation-title {
  color: var(--accent-success);
  font-weight: 600;
  margin-bottom: 4px;
}
.enriched-validation.warning {
  background: var(--accent-warn-bg);
  border: 1px solid var(--accent-warn);
}
.enriched-validation.warning .enriched-validation-title {
  color: var(--accent-warn);
  font-weight: 600;
  margin-bottom: 4px;
}
.enriched-validation.error {
  background: var(--accent-danger-bg);
  border: 1px solid var(--accent-danger);
}
.enriched-validation.error .enriched-validation-title {
  color: var(--accent-danger);
  font-weight: 600;
  margin-bottom: 4px;
}
.enriched-validation-details {
  color: var(--muted);
}

/* ---- Mode menu (disclosure widget) ------------------------------------ */
/* `.sidebar > * { position: relative; z-index: 1 }` (app.css:138) gives every
   sidebar section its own stacking context. To let the popover overlay the
   sections below, the .mode-section itself must be lifted above its siblings.
   Setting `z-index: 2` here promotes the entire section's stacking context;
   the popover's own `z-index: 5` then orders within that context. */
.mode-section { position: relative; z-index: 2; }

.mode-active {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
  /* Picker showing current mode — visually distinct from .nav-item.active
     (which marks the current page). Subtle bg + primary text + neutral
     border reads as "selectbox with chosen value", no accent left-border. */
  background: var(--depth-3);
  color: var(--text);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
}

.mode-active:hover {
  background: var(--depth-4);
  border-color: var(--border);
  color: var(--text);
}

.mode-active-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-chevron {
  font-size: 11px;
  opacity: 0.55;
  transition: transform 160ms var(--ease);
  flex: 0 0 auto;
  margin-left: 8px;
}
/* Chevron rotation derived from aria-expanded — never toggled imperatively. */
.mode-active[aria-expanded="true"] .mode-chevron { transform: rotate(180deg); }

.mode-popover {
  position: absolute;
  top: 100%;
  left: 8px;
  right: 8px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--depth-4);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 0;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.mode-popover[hidden] { display: none; }

.mode-popover .mode-item {
  border-radius: 0;
  padding: 6px 14px;
  width: 100%;
}

.mode-popover .mode-item[aria-selected="true"] {
  background: linear-gradient(to right,
    lch(53% 52.26 286.91 / 0.13) 0%,
    lch(53% 52.26 286.91 / 0.03) 100%);
  color: var(--text);
}


.cite-marker-cluster {
  display: inline;
  margin: 0 var(--sp-1);
  line-height: 0;
}

.cite-marker {
  display: inline-block;
  font-size: 0.72em;
  vertical-align: super;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-ring);
  cursor: pointer;
  padding: 0 1px;
  transition: color 150ms var(--ease), border-bottom-style 150ms var(--ease);
}

.cite-marker:hover {
  border-bottom-style: solid;
  color: var(--accent-dim);
}

.cite-marker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--r-xs);
}

.cite-marker-cluster > a + a::before {
  content: ", ";
  color: var(--muted);
}

.sources {
  margin-top: var(--sp-5);
}

.sources-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
  letter-spacing: 0.03em;
}

.cite-chip {
  background: var(--depth-2);
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  transition: background 250ms var(--ease), border-color 250ms var(--ease);
}

.cite-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cite-chip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
}

.cite-chip-head::-webkit-details-marker {
  display: none;
}

.cite-chip-caret {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 200ms var(--ease);
  margin-right: var(--sp-1);
  flex-shrink: 0;
}

.cite-chip[open] .cite-chip-caret {
  transform: rotate(45deg);
}

.cite-chip-label {
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-mono);
}

.cite-chip-file {
  color: var(--text);
  font-weight: 500;
}

.cite-chip-loc {
  color: var(--muted);
  font-size: 0.82rem;
}

.cite-chip-open {
  margin-left: auto;
  color: var(--accent-dim);
  font-size: 0.82rem;
  text-decoration: none;
}

.cite-chip-open:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cite-chip-excerpt {
  margin: var(--sp-2) 0 var(--sp-1) 0;
  padding: var(--sp-2) var(--sp-3);
  background: var(--accent-faint);
  border-left: 2px solid var(--accent-ring);
  color: var(--text-2);
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.cite-chip-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

/* Derived-identifier state — warning-tinted border + badge.
   TODO: theme currently lacks a --warn token; reusing --err until one is added. */
.cite-chip-derived-id {
  border-left-color: var(--err);
}

.cite-chip-derived {
  color: var(--err);
  font-size: 0.8rem;
  font-style: italic;
}

/* Flash animations — use accent-glow / accent-ring from theme. */
@keyframes cite-chip-flash-kf {
  0%, 100% { background: var(--depth-2); }
  30%      { background: var(--accent-glow); }
}

@keyframes cite-marker-flash-kf {
  0%, 100% { background: transparent; }
  30%      { background: var(--accent-ring); }
}

.cite-chip-flash {
  animation: cite-chip-flash-kf 1.5s var(--ease);
}

.cite-marker-flash {
  animation: cite-marker-flash-kf 1.5s var(--ease);
  border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
  .cite-chip-flash {
    animation: none;
    background: var(--accent-glow);
    transition: none;
  }
  .cite-marker-flash {
    animation: none;
    background: var(--accent-ring);
  }
  .cite-marker,
  .cite-chip,
  .cite-chip-open {
    transition: none;
  }
}

