/* ──────────────────────────────────────────────────────────────
   Legal Eye · Workspace UI Kit styles
   Lifted from production le-app.css. RTL by default.
   Prefix .le-* so it doesn't clash with the colors_and_type.css
   semantic element styles.
   ────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-canvas);
  color: var(--fg-1);
  overflow: hidden;
}

/* ─── Shell ─── */
.le-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.le-sidebar {
  background: var(--ink);
  color: var(--fg-on-dark);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.le-sidebar-header {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(148,163,184,0.10);
  display: flex; align-items: center; gap: 10px;
}
.le-sidebar-logo {
  width: 36px; height: 36px; border-radius: 8px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(217,184,92,0.25);
}
.le-sidebar-logo img { width: 100%; height: 100%; display: block; }
.le-sidebar-title {
  font-family: var(--font-serif);
  font-weight: 900; font-size: 18px; line-height: 1.1; letter-spacing: -0.6px;
}
.le-sidebar-subtitle {
  font-family: var(--font-mono);
  font-size: 9px; color: var(--fg-on-dark-muted);
  margin-top: 3px; letter-spacing: 0.8px;
}
.le-sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.le-sidebar-section { margin-bottom: 14px; }
.le-sidebar-section-title {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-on-dark-muted);
  padding: 4px 10px; margin-bottom: 4px;
}
.le-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--fg-on-dark); cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
  border: none; background: transparent;
  width: 100%; text-align: right;
  font-family: inherit;
}
.le-sidebar-item:hover { background: rgba(148,163,184,0.10); }
.le-sidebar-item.active { background: rgba(191,155,48,0.22); color: #fff; }
.le-sidebar-item-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--fg-on-dark-muted);
  display: grid; place-items: center;
  font-size: 14px;
}
.le-sidebar-item.active .le-sidebar-item-icon { color: #fde68a; }
.le-sidebar-item-count {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-on-dark-muted);
}
.le-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(148,163,184,0.10);
  font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-on-dark-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.le-sidebar-footer button {
  background: transparent; border: none; color: var(--fg-on-dark);
  cursor: pointer; padding: 4px 6px; border-radius: 4px;
  font-size: 14px;
}
.le-sidebar-footer button:hover { background: rgba(148,163,184,0.15); }

/* ─── Main ─── */
.le-main {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  background: var(--bg-canvas);
}
.le-topbar {
  height: 52px; flex-shrink: 0;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(140%) blur(8px);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 5;
}
.le-topbar-breadcrumb {
  font-size: 13px; color: var(--fg-2);
  display: flex; align-items: center;
  flex: 1; min-width: 0;
}
.le-topbar-breadcrumb b { color: var(--fg-1); font-weight: 600; }
.le-topbar-actions { display: flex; align-items: center; gap: 4px; }
.le-topbar-btn {
  width: 32px; height: 32px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  display: grid; place-items: center; font-size: 14px;
  color: var(--fg-2); transition: all 0.12s;
  font-family: inherit;
}
.le-topbar-btn:hover { background: var(--bg-hover); color: var(--fg-1); }
.le-topbar-auth {
  margin-inline-start: 6px;
  background: transparent; border: 0; cursor: pointer;
  padding: 0;
}
.le-topbar-auth-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #876d2c, #5a4818);
  color: #fde68a; font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* ─── Workspace ─── */
.le-workspace {
  flex: 1; overflow-y: auto;
  padding: 24px 32px;
  padding-bottom: 220px;
}
.le-workspace-inner { max-width: 1000px; margin: 0 auto; }

/* ─── Welcome ─── */
.le-welcome { margin-top: 4vh; text-align: center; }
.le-welcome-icon {
  width: 88px; height: 88px; border-radius: 22px;
  background: #fff;
  border: 1px solid var(--rule);
  display: grid; place-items: center;
  margin: 0 auto 22px;
  box-shadow: var(--shadow-elev);
}
.le-welcome-title {
  font-family: var(--font-serif);
  font-size: 32px; font-weight: 700;
  color: var(--fg-1); margin: 0 0 10px;
}
.le-welcome-subtitle {
  color: var(--fg-2);
  font-size: 15px; max-width: 540px; margin: 0 auto 28px;
  line-height: 1.65;
}
.le-welcome-subtitle b { color: var(--fg-1); }
.le-welcome-resume {
  max-width: 700px; margin: 0 auto 16px;
  text-align: right;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(191,155,48,0.04), rgba(191,155,48,0.01));
  border: 1px solid rgba(191,155,48,0.20);
  border-radius: 12px;
}
.le-welcome-resume-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.6px;
  color: var(--gold);
}
.le-welcome-resume-clear {
  border: 0; background: transparent;
  color: var(--fg-3); cursor: pointer;
  font-size: 14px; padding: 0 4px;
}
.le-welcome-resume-card {
  width: 100%; text-align: right;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-serif);
  transition: border-color 0.15s, transform 0.15s;
}
.le-welcome-resume-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.le-welcome-resume-q { font-size: 14px; color: var(--fg-1); }
.le-welcome-resume-meta {
  margin-top: 4px;
  display: flex; gap: 10px; align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
  letter-spacing: 0.3px;
}
.le-welcome-resume-ago { margin-inline-start: auto; }
.le-welcome-suggestions {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; max-width: 700px; margin: 0 auto;
}
.le-welcome-card {
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px; cursor: pointer;
  text-align: right; font-size: 13px;
  color: var(--fg-1);
  font-family: inherit;
  transition: all 0.15s;
  line-height: 1.5;
}
.le-welcome-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.le-welcome-card-icon { font-size: 20px; margin-bottom: 8px; }

/* ─── Messages ─── */
.le-messages { display: flex; flex-direction: column; gap: 24px; }
.le-msg-user {
  align-self: flex-end; max-width: 80%;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 12px 12px 4px 12px;
  padding: 12px 16px;
  font-size: 14px; line-height: 1.6;
  box-shadow: var(--shadow-card);
}
.le-msg-assistant { align-self: stretch; }
.le-msg-assistant-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.le-msg-assistant-avatar {
  width: 24px; height: 24px; border-radius: 6px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.le-msg-assistant-avatar img { width: 100%; height: 100%; display: block; }
.le-msg-assistant-label {
  font-size: 12px; color: var(--fg-2); font-weight: 500;
}
.le-msg-assistant-confidence {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
  display: flex; align-items: center; gap: 4px;
}
.le-msg-assistant-confidence .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
}
.le-msg-assistant-body {
  font-size: 14.5px; line-height: 1.85;
  color: var(--fg-1);
  padding: 0 4px;
}
.le-msg-assistant-body p { margin: 0 0 12px; }

/* Inline citations & claim spans (lifted from le-app.css) */
.le-src-cite {
  padding: 0 3px; border-radius: 3px;
  border-bottom: 1.5px solid transparent;
  cursor: help;
}
.le-src-cite-ok { background: rgba(58,128,98,0.10); border-bottom-color: var(--success); }
.le-src-cite-partial { background: rgba(160,120,32,0.10); border-bottom-color: var(--warning); }
.le-src-cite-bad { background: rgba(139,46,46,0.10); border-bottom-color: var(--danger); }
.le-src-cite sup {
  font-size: 0.6em; font-weight: 700; vertical-align: super;
  margin-inline-start: 1px; font-family: var(--font-mono);
}
.le-src-cite-ok sup { color: var(--success); }
.le-src-cite-partial sup { color: var(--warning); }
.le-src-cite-bad sup { color: var(--danger); }

.le-inline-cite {
  background: var(--gold-soft);
  color: var(--gold-strong);
  padding: 0 6px; border-radius: 4px;
  font-size: 0.88em; font-weight: 600;
  cursor: pointer;
  font-family: var(--font-mono);
}

/* ─── Sources block ─── */
.le-sources-block {
  margin-top: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}
.le-sources-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-surface-soft);
  font-size: 12px; font-weight: 600;
  color: var(--fg-2);
  display: flex; align-items: center; gap: 6px;
}
.le-sources-list { display: flex; flex-direction: column; }
.le-source-item {
  padding: 11px 14px; border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: background 0.12s;
  display: flex; align-items: flex-start; gap: 10px;
  background: transparent; border-inline: none;
  width: 100%; text-align: right;
  border-top: 0;
  font-family: inherit;
}
.le-source-item:last-child { border-bottom: none; }
.le-source-item:hover { background: var(--bg-surface-soft); }
.le-source-num {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700; font-size: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  margin-top: 1px;
}
.le-source-content { flex: 1; min-width: 0; display: block; }
.le-source-title {
  font-size: 13px; font-weight: 600;
  color: var(--fg-1); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.le-source-excerpt {
  font-size: 12.5px; color: var(--fg-2);
  line-height: 1.55; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.le-source-meta {
  margin-top: 6px;
  display: flex; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
  direction: ltr;
}
.le-source-badge {
  display: inline-flex; align-items: center;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
}
.le-source-badge-community { background: #d1fae5; color: #065f46; }
.le-source-badge-session { background: #fef3c7; color: #92400e; }
.le-source-badge-fresh { background: #fee2e2; color: #991b1b; }

/* ─── Streaming RAG (Day 41) ─── */
.le-stream-shell {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 18px 20px;
}
.le-stream-status {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #f8f4ea;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #475569;
  transition: all 0.4s ease;
  margin-bottom: 12px;
}
.le-stream-status.done {
  background: rgba(58,128,98,0.08);
  border-color: rgba(58,128,98,0.30);
  color: var(--success);
}
.le-stream-check { color: var(--success); font-weight: 700; font-size: 16px; }
.le-stream-status-text { flex: 1; }
.le-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gold);
  animation: le-pulse 1.2s ease-in-out infinite;
}
@keyframes le-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
.le-stream-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.le-stream-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: rgba(191,155,48,0.10);
  color: #92400e;
  border: 1px solid rgba(191,155,48,0.30);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.le-stream-pill b { font-weight: 700; }
.le-stream-pill--strength {
  background: rgba(58,128,98,0.10);
  color: var(--success);
  border-color: rgba(58,128,98,0.30);
}
.le-stream-pill--strength b { font-size: 15px; }

/* ─── Verbatim stamp ─── */
.le-stamp-set {
  position: relative;
  height: 200px;
  margin: 28px 0 8px;
}
.le-stamp {
  position: absolute;
  color: var(--gold);
  background: rgba(191,155,48,0.04);
  border-radius: 50%;
  display: grid; place-items: center;
  transform-origin: center;
  opacity: 0;
  animation: le-stamp-in 0.85s cubic-bezier(.2,1.6,.5,1) both;
}
.le-stamp svg { position: absolute; inset: 0; }
.le-stamp-inner {
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
}
.le-stamp-kind { font-size: 8px; opacity: 0.8; }
.le-stamp-glyph {
  font-family: var(--font-serif);
  font-size: 30px; font-weight: 900; font-style: italic;
  text-transform: none; letter-spacing: -1px;
  margin: 5px 0 6px;
  color: var(--gold);
}
.le-stamp-glyph.tick { font-size: 38px; font-style: normal; }
.le-stamp-caption { font-size: 7.5px; opacity: 0.85; }

.le-stamp:nth-child(1) { right: 10px;  top: 12px; }
.le-stamp:nth-child(2) { right: 130px; top: 36px; }
.le-stamp:nth-child(3) { right: 260px; top: 6px; }

@keyframes le-stamp-in {
  0%   { opacity: 0; transform: scale(2.4) rotate(0deg); }
  55%  { opacity: 1; }
  78%  { transform: scale(0.92) rotate(var(--le-stamp-rotation, 0deg)); }
  100% { opacity: 1; transform: scale(1) rotate(var(--le-stamp-rotation, 0deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .le-stamp { animation: none; opacity: 1; transform: scale(1) rotate(var(--le-stamp-rotation, 0deg)); }
}

/* ─── Talmudic analysis layout ─── */
.le-talmud {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  font-family: var(--font-serif);
  position: relative;
  margin-top: 16px;
}
.le-talmud-tag {
  position: absolute;
  top: 0; right: 0;
  background: var(--ink);
  color: var(--bg-canvas);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.5px;
  border-radius: 0 16px 0 8px;
  z-index: 1;
}
.le-talmud-side {
  padding: 28px 20px;
  background: #fdfbf5;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--fg-2);
}
.le-talmud-side--pro { border-inline-end: 1px solid var(--rule); }
.le-talmud-side--con { border-inline-start: 1px solid var(--rule); }
.le-talmud-side-head {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.le-talmud-side-mark {
  font-family: var(--font-serif);
  font-size: 18px; font-style: italic; font-weight: 700; color: var(--ink);
}
.le-talmud-side-label.pro { color: var(--success); }
.le-talmud-side-label.con { color: var(--danger); }
.le-talmud-source {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.le-talmud-source:last-of-type { border-bottom: 0; }
.le-talmud-source-title {
  font-family: var(--font-serif);
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.35;
}
.le-talmud-source-excerpt {
  margin: 0;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.6;
}
.le-talmud-source-cite {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
  margin-top: 4px; letter-spacing: 0.3px;
}
.le-talmud-exceptions {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.le-talmud-chip {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-canvas);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--fg-2);
}

.le-talmud-center {
  padding: 38px 44px 28px;
  background: #fff;
}
.le-talmud-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.le-talmud-q {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 28px;
  line-height: 1.32; color: var(--ink);
  margin: 0 0 18px;
}
.le-talmud-q::first-letter {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 64px;
  float: right;
  line-height: 0.85;
  margin-inline-start: 8px;
  margin-top: 4px;
  color: var(--gold);
}
.le-talmud-rule {
  width: 56px; height: 2px;
  background: var(--gold);
  margin: 14px 0 20px;
}
.le-talmud-body {
  font-family: var(--font-serif);
  font-size: 16px; line-height: 1.8; color: var(--ink-2);
}
.le-talmud-body p { margin: 0 0 14px; }
.le-talmud-body b { color: var(--ink); }
.le-talmud-body .le-inline-cite,
.le-talmud-body .le-src-cite-ok,
.le-talmud-body .le-src-cite-partial { font-family: var(--font-mono); font-size: 0.78em; }

/* ─── Composer ─── */
.le-composer {
  position: fixed; bottom: 0;
  inset-inline-start: 280px; inset-inline-end: 0;
  background: var(--bg-canvas);
  border-top: 1px solid var(--rule);
  padding: 16px 32px 18px;
  z-index: 4;
}
.le-composer-inner {
  max-width: 760px; margin: 0 auto;
  background: var(--bg-input);
  border: 1.5px solid var(--rule);
  border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}
.le-composer-inner:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(191,155,48,0.10), var(--shadow-card);
}
.le-composer-textarea {
  width: 100%; resize: none; outline: none; border: none;
  background: transparent; color: var(--fg-1);
  padding: 14px 16px 4px;
  font: inherit; font-size: 14.5px; line-height: 1.6;
  min-height: 56px; max-height: 200px;
  direction: rtl;
}
.le-composer-actions {
  display: flex; align-items: center;
  padding: 6px 10px 10px; gap: 4px;
}
.le-composer-action {
  width: 32px; height: 32px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  color: var(--fg-3); font-size: 15px;
  display: grid; place-items: center;
  transition: all 0.12s; font-family: inherit;
}
.le-composer-action:hover { background: var(--bg-hover); color: var(--fg-1); }
.le-composer-send {
  margin-inline-start: auto;
  padding: 8px 18px; border-radius: 8px;
  background: var(--gold); color: #fff;
  border: none; cursor: pointer;
  font-weight: 600; font-size: 13px;
  font-family: inherit;
  transition: background 0.12s;
}
.le-composer-send:hover:not(:disabled) { background: var(--gold-strong); }
.le-composer-send:disabled { opacity: 0.5; cursor: not-allowed; }
.le-composer-hint {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  margin-top: 8px;
  letter-spacing: 0.3px;
}
.le-composer-hint b { color: var(--gold); font-weight: 700; }


/* ─────────────────────────────────────────────────────────────
   NEW: Editorial flow indicator (replaces single-spinner)
   ───────────────────────────────────────────────────────────── */
.le-flow-shell {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 22px 26px;
}
.le-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  position: relative;
}
.le-flow-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-inline-start: 4px;
}
.le-flow-step:not(:last-child)::before {
  content: '';
  position: absolute;
  top: 26px;
  inset-inline-end: 100%;
  width: 14px;
  height: 1px;
  background: var(--rule);
}
.le-flow-step.done:not(:last-child)::before,
.le-flow-step.active:not(:last-child)::before {
  background: var(--gold);
}
.le-flow-step-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--rule);
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-weight: 900; font-size: 22px; font-style: italic;
  color: var(--fg-3);
  position: relative;
  flex-shrink: 0;
  transition: all 0.25s;
}
.le-flow-step.active .le-flow-step-circle {
  border-color: var(--gold); color: var(--gold);
  box-shadow: 0 0 0 5px rgba(191,155,48,0.12);
  animation: le-flow-pulse 1.4s ease-in-out infinite;
}
@keyframes le-flow-pulse {
  0%, 100% { box-shadow: 0 0 0 5px rgba(191,155,48,0.12); }
  50%      { box-shadow: 0 0 0 11px rgba(191,155,48,0); }
}
.le-flow-step.done .le-flow-step-circle {
  background: var(--gold); border-color: var(--gold); color: #fff;
}
.le-flow-step.done .le-flow-step-circle::after {
  content: '✓'; position: absolute;
  top: -6px; inset-inline-start: -6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--gold);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  font-style: normal;
}
.le-flow-step-text { font-family: var(--font-serif); min-width: 0; padding-top: 6px; }
.le-flow-step-label { font-size: 14px; font-weight: 700; color: var(--fg-1); line-height: 1.2; }
.le-flow-step-meta {
  font-family: var(--font-mono);
  font-size: 10.5px; color: var(--fg-3);
  margin-top: 4px; letter-spacing: 0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.le-flow-step.done .le-flow-step-meta { color: var(--success); }
.le-flow-step.active .le-flow-step-meta { color: var(--gold); }
.le-flow-banner {
  margin-top: 16px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(58,128,98,0.07);
  border: 1px solid rgba(58,128,98,0.30);
  border-radius: 8px;
}
.le-flow-banner-tick {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--success); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700;
  flex-shrink: 0; font-size: 13px;
}
.le-flow-banner span { font-size: 13px; color: var(--ink-2); }
.le-flow-banner b { color: var(--success); }

/* ─────────────────────────────────────────────────────────────
   NEW: hover stamp on inline citations
   The <Citation> wraps its content + a hidden mini-stamp that
   appears on hover, positioned absolutely above the cite.
   ───────────────────────────────────────────────────────────── */
.le-src-cite { position: relative; }
.le-cite-hover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(2) rotate(0deg);
  width: 96px; height: 96px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.35s cubic-bezier(.2,1.6,.5,1);
  z-index: 20;
  display: grid; place-items: center;
  color: var(--gold);
}
.le-src-cite:hover .le-cite-hover {
  opacity: 1;
  transform: translateX(-50%) scale(1) rotate(-6deg);
}
.le-cite-hover-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: rgba(191,155,48,0.06);
}
.le-cite-hover-ring::before {
  content: ''; position: absolute; inset: 4px;
  border: 0.5px solid var(--gold);
  border-radius: 50%;
  opacity: 0.6;
}
.le-cite-hover-inner {
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold);
  line-height: 1.1;
}
.le-cite-hover-kind { font-size: 7px; opacity: 0.85; }
.le-cite-hover-tick {
  display: block;
  font-family: var(--font-serif);
  font-size: 28px; font-weight: 900;
  color: var(--gold);
  letter-spacing: 0; text-transform: none;
  margin: 2px 0 1px;
}
.le-cite-hover-meta {
  font-size: 6px; opacity: 0.8; display: block;
  max-width: 70px; margin: 0 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─────────────────────────────────────────────────────────────
   NEW: Midnight Chambers theme — dark mode reimagined
   Activated via body[data-theme="midnight"]. Variable overrides
   only; layout stays identical.
   ───────────────────────────────────────────────────────────── */
body[data-theme="midnight"] {
  --bg-canvas:        #0a1424;
  --bg-surface:       rgba(20, 30, 55, 0.55);
  --bg-surface-soft:  rgba(20, 30, 55, 0.35);
  --bg-input:         rgba(15, 23, 42, 0.4);
  --bg-hover:         rgba(217, 184, 92, 0.08);
  --fg-1:             #faf7f0;
  --fg-2:             rgba(250, 247, 240, 0.72);
  --fg-3:             rgba(250, 247, 240, 0.45);
  --ink:              #faf7f0;
  --ink-2:            rgba(250, 247, 240, 0.86);
  --rule:             rgba(217, 184, 92, 0.18);
  --gold:             #d9b85c;
  --gold-strong:      #c89b3c;
  --gold-soft:        rgba(217, 184, 92, 0.10);
  --success:          #6ee7a3;
}
body[data-theme="midnight"] .le-main {
  background:
    radial-gradient(150% 95% at 50% -25%, #17284c 0%, #0d1830 40%, #0a1424 72%);
  position: relative;
  background-image:
    radial-gradient(38% 26% at 80% 4%, rgba(217,184,92,0.14) 0%, transparent 70%),
    radial-gradient(ellipse at 90% -10%, rgba(217,184,92,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 5% 100%,  rgba(217,184,92,0.05) 0%, transparent 45%);
}
body[data-theme="midnight"] .le-main::before {
  content: '§';
  position: fixed;
  top: -80px; inset-inline-end: -120px;
  font-family: var(--font-serif);
  font-size: 720px;
  font-style: italic;
  color: rgba(217, 184, 92, 0.03);
  line-height: 0.85;
  pointer-events: none; user-select: none;
  z-index: 0;
  text-shadow: 0 0 120px rgba(217,184,92,0.06);
}
/* Twinkling starfield — sits behind workspace content, above the canvas */
body[data-theme="midnight"] .le-main::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(1.6px 1.6px at 14% 16%, rgba(250,247,240,0.55), transparent),
    radial-gradient(1.2px 1.2px at 26% 54%, rgba(250,247,240,0.4), transparent),
    radial-gradient(1.4px 1.4px at 38% 24%, rgba(217,184,92,0.5), transparent),
    radial-gradient(1px 1px at 47% 70%, rgba(250,247,240,0.35), transparent),
    radial-gradient(1.5px 1.5px at 58% 12%, rgba(250,247,240,0.5), transparent),
    radial-gradient(1.1px 1.1px at 64% 44%, rgba(217,184,92,0.42), transparent),
    radial-gradient(1.3px 1.3px at 72% 64%, rgba(250,247,240,0.4), transparent),
    radial-gradient(1px 1px at 81% 30%, rgba(250,247,240,0.32), transparent),
    radial-gradient(1.5px 1.5px at 88% 56%, rgba(250,247,240,0.5), transparent),
    radial-gradient(1.2px 1.2px at 33% 84%, rgba(250,247,240,0.34), transparent),
    radial-gradient(1.3px 1.3px at 54% 88%, rgba(217,184,92,0.4), transparent),
    radial-gradient(1px 1px at 19% 38%, rgba(250,247,240,0.3), transparent);
  opacity: 0.55;
}
@media (prefers-reduced-motion: no-preference) {
  body[data-theme="midnight"] .le-main::after { animation: le-twinkle 7s ease-in-out infinite; }
  @keyframes le-twinkle { 0%, 100% { opacity: 0.42; } 50% { opacity: 0.78; } }
}
/* Graceful day ↔ night transition (applies in both themes) */
.le-main, .le-topbar, .le-sidebar, .le-welcome-icon, .le-welcome-card,
.le-welcome-resume-card, .le-msg-user, .le-talmud, .le-talmud-side,
.le-talmud-center, .le-flow-shell, .le-composer-inner {
  transition: background-color 0.55s ease, border-color 0.55s ease, color 0.4s ease, box-shadow 0.55s ease;
}
body[data-theme="midnight"] .le-topbar {
  background: rgba(10, 20, 36, 0.86);
  border-bottom-color: rgba(217, 184, 92, 0.18);
}
body[data-theme="midnight"] .le-workspace { position: relative; z-index: 1; }
body[data-theme="midnight"] .le-welcome-icon {
  background: rgba(20, 30, 55, 0.65);
  border-color: rgba(217, 184, 92, 0.25);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 0 60px rgba(217,184,92,0.10);
}
body[data-theme="midnight"] .le-welcome-card {
  background: rgba(20, 30, 55, 0.5);
  border-color: rgba(217, 184, 92, 0.18);
  color: var(--fg-1);
  backdrop-filter: blur(6px);
}
body[data-theme="midnight"] .le-welcome-card:hover {
  border-color: var(--gold);
  background: rgba(20, 30, 55, 0.7);
}
body[data-theme="midnight"] .le-welcome-resume {
  background: linear-gradient(135deg, rgba(217,184,92,0.08), rgba(217,184,92,0.02));
  border-color: rgba(217,184,92,0.25);
}
body[data-theme="midnight"] .le-welcome-resume-card {
  background: rgba(20, 30, 55, 0.55);
  border-color: rgba(217, 184, 92, 0.18);
  color: var(--fg-1);
}
body[data-theme="midnight"] .le-msg-user {
  background: rgba(20, 30, 55, 0.6);
  border-color: rgba(217, 184, 92, 0.18);
  color: var(--fg-1);
  backdrop-filter: blur(6px);
}
body[data-theme="midnight"] .le-talmud {
  background: rgba(20, 30, 55, 0.45);
  border-color: rgba(217, 184, 92, 0.18);
  backdrop-filter: blur(8px);
}
body[data-theme="midnight"] .le-talmud-side {
  background: rgba(15, 23, 42, 0.55);
}
body[data-theme="midnight"] .le-talmud-center {
  background: rgba(20, 30, 55, 0.35);
}
body[data-theme="midnight"] .le-flow-shell {
  background: rgba(20, 30, 55, 0.55);
  border-color: rgba(217, 184, 92, 0.18);
  backdrop-filter: blur(6px);
}
body[data-theme="midnight"] .le-flow-step-circle { background: rgba(15, 23, 42, 0.6); }
body[data-theme="midnight"] .le-composer {
  background: linear-gradient(180deg, transparent, #0a1424 30%);
  border-top-color: rgba(217, 184, 92, 0.18);
}
body[data-theme="midnight"] .le-composer-inner {
  background: rgba(20, 30, 55, 0.6);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 44px rgba(0,0,0,0.45), 0 0 0 1px rgba(217,184,92,0.06), 0 -12px 50px rgba(217,184,92,0.05);
}


/* ─────────────────────────────────────────────────────────────
   Opposing Counsel mode — split-screen dialectical analysis
   ───────────────────────────────────────────────────────────── */
.le-oc {
  margin-top: 16px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.le-oc-head {
  padding: 28px 36px 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-canvas);
  position: relative;
}
.le-oc-head-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--gold); margin-bottom: 10px;
}
.le-oc-head-h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 26px; line-height: 1.3;
  color: var(--ink);
  margin: 0;
}

.le-oc-split {
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  align-items: stretch;
  position: relative;
}
.le-oc-side {
  padding: 26px 28px;
  display: flex; flex-direction: column;
  position: relative;
  min-height: 380px;
}
.le-oc-side--pro {
  background: linear-gradient(180deg, rgba(58,128,98,0.045) 0%, #fff 65%);
}
.le-oc-side--con {
  background: linear-gradient(180deg, rgba(139,46,46,0.04) 0%, #fff 65%);
}

.le-oc-side-tag {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.le-oc-side-letter {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: var(--gold);
  font-family: var(--font-serif);
  font-style: italic; font-weight: 900;
  font-size: 22px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.le-oc-side-label {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 18px;
  color: var(--ink); line-height: 1.1;
}
.le-oc-side-latin {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 1.6px; color: var(--fg-3);
  margin-top: 3px;
}
.le-oc-side-score {
  margin-inline-start: auto;
  text-align: center;
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1;
}
.le-oc-side-score b {
  font-family: var(--font-serif); font-weight: 900; font-style: italic;
  font-size: 36px; color: var(--gold);
}
.le-oc-side--con .le-oc-side-score b { color: var(--danger); }
.le-oc-side--pro .le-oc-side-score b { color: var(--success); }
.le-oc-side-score span {
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-3);
  margin-top: 4px;
}

.le-oc-claim {
  font-family: var(--font-serif);
  font-size: 15px; line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 18px;
}
.le-oc-claim b { color: var(--ink); }

.le-oc-cases { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.le-oc-case {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; gap: 10px;
}
.le-oc-side--pro .le-oc-case { border-color: rgba(58,128,98,0.25); }
.le-oc-side--con .le-oc-case,
.le-oc-case--con { border-color: rgba(139,46,46,0.20); }
.le-oc-case-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  font-family: var(--font-mono);
  font-weight: 700; font-size: 11px;
  display: grid; place-items: center; flex-shrink: 0;
  margin-top: 1px;
}
.le-oc-case-body { flex: 1; min-width: 0; }
.le-oc-case-title {
  font-family: var(--font-serif);
  font-size: 13px; font-weight: 700;
  color: var(--ink); margin-bottom: 4px;
  line-height: 1.3;
}
.le-oc-case-excerpt {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13px; line-height: 1.55;
  color: var(--fg-2);
}
.le-oc-case-meta {
  margin-top: 6px;
  display: flex; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
}
.le-oc-badge {
  display: inline-flex; align-items: center;
  padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 600;
}
.le-oc-badge--pro { background: rgba(58,128,98,0.12); color: var(--success); }
.le-oc-badge--con { background: rgba(139,46,46,0.12); color: var(--danger); }

.le-oc-stamp {
  margin-top: 18px;
  width: 110px; height: 110px;
  display: grid; place-items: center;
  position: relative;
  align-self: flex-end;
}
.le-oc-stamp--pro { color: var(--success); }
.le-oc-stamp--con { color: var(--danger); }
.le-oc-stamp svg { position: absolute; inset: 0; }
.le-oc-stamp-inner {
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 1.2px;
  font-size: 8px; line-height: 1.1;
}
.le-oc-stamp-kind { opacity: 0.85; }
.le-oc-stamp-glyph {
  font-family: var(--font-serif);
  font-weight: 900; font-size: 30px;
  margin: 4px 0 4px;
}
.le-oc-stamp-case { font-size: 7px; opacity: 0.85; }

.le-oc-divider {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 0;
}
.le-oc-divider-line {
  position: absolute;
  top: 26px; bottom: 26px;
  left: 50%; width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold) 15%, var(--gold) 85%, transparent);
  opacity: 0.4;
}
.le-oc-divider-glyph {
  width: 44px; height: 60px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  display: grid; place-items: center;
  padding: 8px;
  z-index: 1;
}
.le-oc-divider-glyph svg { width: 100%; height: 100%; }

.le-oc-verdict {
  padding: 26px 36px;
  background: var(--ink);
  color: #faf7f0;
}
.le-oc-verdict-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase;
  color: #d9b85c; margin-bottom: 14px;
}
.le-oc-verdict-bar {
  display: flex;
  height: 28px; border-radius: 6px;
  overflow: hidden;
  background: rgba(250,247,240,0.08);
  margin-bottom: 14px;
}
.le-oc-verdict-fill {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  color: #fff;
  transition: width 0.5s cubic-bezier(.2,1,.3,1);
}
.le-oc-verdict-fill--pro { background: var(--success); }
.le-oc-verdict-fill--con { background: var(--danger); }
.le-oc-verdict-call {
  font-family: var(--font-serif);
  font-size: 16px; line-height: 1.6;
  color: rgba(250,247,240,0.86);
}
.le-oc-verdict-call b { color: #d9b85c; }

@media (max-width: 760px) {
  .le-oc-split { grid-template-columns: 1fr; }
  .le-oc-divider {
    padding: 8px 0;
    flex-direction: row;
  }
  .le-oc-divider-line {
    top: 50%; bottom: auto; height: 1px; width: auto;
    left: 26px; right: 26px;
    background: linear-gradient(90deg, transparent, var(--gold) 15%, var(--gold) 85%, transparent);
  }
  .le-oc-stamp { align-self: center; }
}

/* Topbar OC-mode toggle */
.le-topbar-mode {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.8px;
  color: var(--fg-2);
  margin-inline-end: 6px;
  transition: all 0.15s;
}
.le-topbar-mode:hover { border-color: var(--gold); color: var(--gold); }
.le-topbar-mode.is-active {
  background: var(--ink); color: #faf7f0; border-color: var(--ink);
}
.le-topbar-mode.is-active::before {
  content: '§'; font-family: var(--font-serif);
  color: #d9b85c; font-size: 14px;
}


/* Welcome card with illustration treatment */
.le-welcome-card { text-align: right; padding: 18px 18px 16px; }
.le-welcome-card-illust {
  width: 56px; height: 56px;
  background: #fdfbf5;
  border: 1px solid var(--rule);
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 12px;
  transition: transform var(--motion-step, 220ms), border-color var(--motion-step, 220ms);
}
.le-welcome-card:hover .le-welcome-card-illust {
  transform: rotate(-3deg);
  border-color: var(--gold);
}
.le-welcome-card-tag {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 1.6px; color: var(--gold);
  margin-bottom: 6px;
}
.le-welcome-card-title {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 14px;
  color: var(--fg-1); margin-bottom: 6px; line-height: 1.35;
}
.le-welcome-card-sub {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3); letter-spacing: 0.3px;
}
