@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300;1,400&family=Open+Sans:wght@300;400;600;700&display=swap");

:root {
  --bg: #0d0d0d;
  --bg-side: #121212;
  --bg-card: #1a1a1a;
  --bg-input: #141414;
  --field-bg: #141414;
  --field-bg-focus: rgba(255, 162, 0, 0.06);
  --field-border: rgba(255, 255, 255, 0.12);
  --field-border-focus: rgba(255, 162, 0, 0.55);
  --field-text: #f4f5f7;
  --field-placeholder: #6a6a6a;
  --field-label: #9a9a9a;
  --ink: #f4f5f7;
  --muted: #b0b0b0;
  --faint: #7a7a7a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #ffa200;
  --accent-2: #ffb84d;
  --accent-dim: rgba(255, 162, 0, 0.12);
  --accent-border: rgba(255, 162, 0, 0.35);
  --danger: #ff4d6d;
  --ok: #62c98d;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --btn-ink: #1c1408;
  --side-w: 260px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  color: #ffd080;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— Shell —— */
.app-frame {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.85rem 1rem;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.45rem 0.85rem;
  color: inherit;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(90, 180, 255, 0.25));
}

.sidebar-brand-text {
  display: grid;
  gap: 0.1rem;
  line-height: 1.15;
}

.sidebar-brand-text strong {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-brand-text span {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.side-nav {
  display: grid;
  gap: 0.25rem;
  padding: 0.25rem 0;
}

.side-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-link:hover {
  background: rgba(255, 162, 0, 0.08);
  color: var(--accent);
  filter: none;
  box-shadow: none;
}

.side-link.active {
  background: rgba(255, 162, 0, 0.14);
  color: var(--accent);
  box-shadow: none;
}

.sidebar-queue {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.35rem;
}

.sidebar-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.35rem;
}

.sidebar-queue-head h2 {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.icon-btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  padding: 0;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: none;
}

.icon-btn:hover {
  color: var(--accent);
  background: rgba(255, 162, 0, 0.1);
  filter: none;
  box-shadow: none;
}

.sidebar-foot {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem;
}

.avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 162, 0, 0.18);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.user-chip strong {
  display: block;
  font-size: 0.84rem;
  color: #fff;
}

.user-chip span {
  display: block;
  font-size: 0.72rem;
  color: var(--faint);
}

.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

.main-stage {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
}

.athenaeum-live-panel {
  display: none;
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  border-left: 1px solid rgba(90, 180, 255, 0.08);
  background: #0a0a0a;
}

@media (min-width: 1100px) {
  .athenaeum-live-panel {
    display: block;
  }
}

.athenaeum-live-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: min(120px, 18%);
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(13, 13, 13, 0.72) 45%, transparent 100%);
}

.athenaeum-wallpaper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.athenaeum-wallpaper.active {
  opacity: 1;
}

.athenaeum-aether-center {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform, left, top;
}

.athenaeum-aether-center-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(320px, 72vw);
  height: min(320px, 72vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(120, 200, 255, 0.42) 0%,
    rgba(70, 160, 235, 0.18) 38%,
    rgba(40, 100, 180, 0.06) 58%,
    transparent 72%
  );
  filter: blur(22px);
  animation: athenaeum-aether-glow-pulse 5.5s ease-in-out infinite;
}

.athenaeum-aether-logo {
  position: relative;
  display: block;
  width: clamp(104px, 16vw, 168px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(100, 200, 255, 0.55))
    drop-shadow(0 0 42px rgba(56, 140, 220, 0.32));
}

@keyframes athenaeum-aether-glow-pulse {
  0%,
  100% {
    opacity: 0.82;
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .athenaeum-aether-center-glow {
    animation: none;
  }
}

.athenaeum-live-caption {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(90, 180, 255, 0.14);
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.athenaeum-live-caption img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(90, 180, 255, 0.35));
}

.athenaeum-live-caption strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

.athenaeum-live-caption span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: rgba(140, 210, 255, 0.75);
  letter-spacing: 0.04em;
}

.top-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #141414 0%, var(--bg) 100%);
}

.welcome {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.top-strip h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.status-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--faint);
}

.status-badge.open {
  color: #9fe3b4;
  border-color: rgba(98, 201, 141, 0.3);
  background: rgba(98, 201, 141, 0.08);
}

.status-badge.open::before {
  background: var(--ok);
}

.ghost-link {
  font-size: 0.78rem;
  color: var(--faint);
}

.content {
  flex: 0 0 auto;
  padding: 1.25rem 1.75rem 3rem;
  width: min(920px, 100%);
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.page-intro {
  margin-bottom: 1rem;
}

.page-intro h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 40rem;
}

.stack-gap {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem 1.3rem;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.card-head .hint.tight,
.hint.tight {
  margin: 0;
  text-align: right;
}

.auth-card {
  max-width: 420px;
  margin-top: 0.5rem;
}

.auth-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.auth-card .lede {
  margin-bottom: 1rem;
}

/* —— Upload —— */
.dropzone {
  position: relative;
  margin-bottom: 1rem;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-border);
  background: rgba(255, 162, 0, 0.05);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: 0;
  background: transparent;
}

.dropzone-inner {
  pointer-events: none;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 2rem 1.25rem;
  text-align: center;
}

.drop-plus {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin-bottom: 0.35rem;
  background: var(--accent);
  color: var(--btn-ink);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.drop-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #fff;
}

.drop-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--faint);
}

.drop-btn {
  margin-top: 0.55rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-name {
  margin: 0.65rem 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-2);
}

.upload-meta {
  margin-bottom: 0.25rem;
}

.grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

/* —— Type / tags / models —— */
.type-readout {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.45rem;
}

.type-readout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--field-label);
}

.type-badge {
  display: inline-flex;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffd080;
  background: rgba(255, 162, 0, 0.12);
  border: 1px solid rgba(255, 162, 0, 0.28);
}

.auto-badge {
  display: inline-flex;
  margin-left: 0.35rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffd080;
  background: rgba(255, 162, 0, 0.12);
  border: 1px solid rgba(255, 162, 0, 0.28);
  vertical-align: middle;
}

.models-block {
  display: grid;
  gap: 0.45rem;
}

.models-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--field-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 0.5rem;
}

.tags-preview {
  max-height: 9.5rem;
  overflow: auto;
  padding: 0.2rem 0 0.55rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.tags-preview .chip {
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.7rem;
}

.tags-editor {
  min-height: 4.5rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e8ebf2;
}

.chip.detected {
  border-color: rgba(255, 162, 0, 0.28);
  background: rgba(255, 162, 0, 0.08);
  color: #ffe0a8;
}

.chip.manual {
  border-color: rgba(255, 162, 0, 0.45);
  background: rgba(255, 162, 0, 0.14);
  color: #ffe0a8;
}

.chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.75;
}

.chip button:hover {
  opacity: 1;
  filter: none;
  box-shadow: none;
}

.model-add-row input {
  flex: 1 1 12rem;
}

.synth-label {
  margin: 0;
}

.synth-editor {
  min-height: 320px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.source-editor {
  min-height: 220px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
}

.combined-editor {
  min-height: 420px;
  font-size: 0.86rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
}

.source-url {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 162, 0, 0.22);
  background: rgba(255, 162, 0, 0.06);
  color: #ffd080;
  font-size: 0.8rem;
  word-break: break-all;
}

.source-url strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}

/* —— Vault Ancilla console (Spark-adapted) —— */
.vault-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ancilla-industry {
  min-width: 11rem;
}

.ancilla-industry select {
  margin-top: 0.25rem;
}

.vault-intro-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.vault-mode-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  gap: 2px;
}

.vault-mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
}

.vault-mode-btn:hover {
  color: var(--text);
}

.vault-mode-btn.active {
  color: #0b1220;
  background: linear-gradient(135deg, #ffc857, #ff9f1a);
  font-weight: 600;
}

.browse-filters-card .card-head {
  margin-bottom: 0.75rem;
}

.browse-filters {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 0.9fr;
  gap: 0.65rem 0.75rem;
}

.browse-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--field-label);
}

.browse-filters input,
.browse-filters select {
  width: 100%;
}

.browse-tag-field {
  position: relative;
  display: block;
}

.browse-tag-field input {
  padding-right: 2.2rem;
}

.browse-filter-clear {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.browse-filter-clear:hover {
  color: var(--field-text);
  background: rgba(255, 162, 0, 0.14);
  filter: none;
  box-shadow: none;
}

.browse-doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.browse-doc {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.9rem;
  align-items: start;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 22, 0.72);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.browse-doc.has-pdf {
  cursor: pointer;
}

.browse-doc.has-pdf:hover {
  border-color: rgba(126, 232, 255, 0.35);
  background: rgba(12, 22, 34, 0.9);
}

.browse-doc h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  line-height: 1.3;
}

.browse-doc .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.browse-doc-file {
  margin: 0 0 0.45rem;
  color: var(--faint);
  font-size: 0.78rem;
  word-break: break-all;
}

.browse-doc-tags,
.browse-doc-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.browse-doc-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 7.5rem;
}

.browse-open-btn {
  white-space: nowrap;
}

.browse-open-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .browse-filters {
    grid-template-columns: 1fr 1fr;
  }

  .browse-doc {
    grid-template-columns: 1fr;
  }

  .browse-doc-actions {
    flex-direction: row;
  }

  .vault-intro-controls {
    align-items: stretch;
    width: 100%;
  }

  .vault-mode-toggle {
    width: 100%;
  }

  .vault-mode-btn {
    flex: 1;
  }
}

.spark-console {
  margin-bottom: 0.9rem;
}

.spark-console-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.05rem 1.05rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(8, 18, 28, 0.97), #040a12 55%, #070709);
  border: 1px solid rgba(0, 212, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(255, 162, 0, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.45);
  clip-path: polygon(
    12px 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    12px 100%,
    0 calc(100% - 12px),
    0 12px
  );
}

.spark-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 232, 255, 0.55);
  pointer-events: none;
}

.spark-corner--tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.spark-corner--tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.spark-corner--bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.spark-corner--br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.spark-console-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
  background: linear-gradient(90deg, rgba(255, 162, 0, 0.12), transparent 55%);
  margin: -0.15rem -0.15rem 0;
  padding: 0.55rem 0.65rem 0.65rem;
}

.spark-tag {
  margin: 0 0 0.15rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 232, 255, 0.85);
}

.spark-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #eaf9ff;
  text-shadow: 0 0 18px rgba(0, 232, 255, 0.25);
}

.spark-readout {
  text-align: right;
}

.spark-readout-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.spark-readout-value {
  font-size: 0.84rem;
  font-weight: 700;
  color: #7ee8ff;
}

/* Orb — Luminous Spark handoff (molten amber + crest PNG) */
.spark-orb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
  max-height: 208px;
  padding: 10px 16px 6px;
  background: transparent;
  border-bottom: 1px solid rgba(120, 50, 0, 0.1);
}

.spark-orb-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 320px;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.spark-orb-wrap:focus-visible {
  filter: drop-shadow(0 0 12px rgba(255, 160, 40, 0.55));
}

.spark-orb-wrap--canvas {
  perspective: none;
  overflow: hidden;
}

.spark-orb-wrap--canvas .spark-orb-canvas {
  display: block;
  width: 176px;
  height: 176px;
}

.spark-orb-wrap--reduced .spark-orb-canvas {
  filter: saturate(0.85);
}

.spark-orb-caption {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 190, 90, 0.82);
  text-align: center;
  transition: color 0.3s ease;
}

.spark-screen {
  flex: 1;
  min-height: 168px;
}

.spark-screen-viewport {
  position: relative;
  min-height: 168px;
  max-height: 38vh;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  background: rgba(2, 8, 14, 0.9);
}

.spark-screen-scanlines,
.spark-screen-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spark-screen-scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.35;
}

.spark-screen-grid {
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.45;
}

.luminous-spark-log {
  position: relative;
  z-index: 1;
  height: 100%;
  max-height: 38vh;
  min-height: 168px;
  overflow: auto;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  padding: 0.85rem;
}

.luminous-spark-msg {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.luminous-spark-msg--assistant {
  justify-self: start;
  background: linear-gradient(180deg, rgba(0, 40, 55, 0.75), rgba(8, 18, 28, 0.9));
  border: 1px solid rgba(0, 212, 255, 0.22);
  color: #e8f7ff;
}

.luminous-spark-msg--user {
  justify-self: end;
  background: linear-gradient(180deg, rgba(255, 162, 0, 0.18), rgba(40, 24, 0, 0.85));
  border: 1px solid rgba(255, 162, 0, 0.32);
  color: #ffe0a8;
}

.spark-msg-who {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.spark-msg-body {
  white-space: pre-wrap;
}

.luminous-spark-msg.is-typing .spark-msg-body::after {
  content: "▍
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.spark-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.spark-suggestion-chip {
  appearance: none;
  border: 1px solid rgba(0, 212, 255, 0.28);
  background: rgba(0, 40, 55, 0.45);
  color: #bfefff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.spark-suggestion-chip:hover {
  border-color: rgba(255, 162, 0, 0.45);
  color: #ffe0a8;
  background: rgba(255, 162, 0, 0.08);
  filter: none;
  box-shadow: none;
}

.spark-input-deck {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.spark-input-deck:has(.spark-voice-btn:not([hidden])) {
  grid-template-columns: auto 1fr auto;
}

.spark-input-deck input {
  margin: 0;
  background-color: rgba(2, 12, 20, 0.92);
  border-color: rgba(0, 212, 255, 0.28);
  color: #e8f7ff;
}

.spark-input-deck input::placeholder {
  color: rgba(126, 232, 255, 0.45);
}

.spark-input-deck input:focus {
  border-color: rgba(0, 212, 255, 0.55);
  background-color: rgba(0, 40, 55, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.spark-voice-btn,
.spark-send-btn {
  box-shadow: none;
}

.spark-voice-btn {
  background: transparent;
  color: #7ee8ff;
  border: 1px solid rgba(0, 212, 255, 0.35);
  font-weight: 700;
}

.spark-voice-btn:hover {
  background: rgba(0, 212, 255, 0.08);
  filter: none;
}

.spark-send-btn {
  background: linear-gradient(180deg, #ffb01a 0%, var(--accent) 100%);
  color: var(--btn-ink);
}

.citations-card {
  margin-top: 0.25rem;
}

.ancilla-citations {
  display: grid;
  gap: 0.55rem;
}

.cite-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
}

.cite-card h4 {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  color: #fff;
}

.cite-card .meta {
  margin-bottom: 0.35rem;
}

.cite-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .spark-orb-stage {
    max-height: 178px;
    padding: 8px 12px 4px;
  }

  .spark-orb-wrap,
  .spark-orb-wrap--canvas .spark-orb-canvas {
    width: 148px;
    height: 148px;
  }

  .spark-input-deck {
    grid-template-columns: 1fr auto;
  }

  .spark-voice-btn {
    grid-column: 1 / -1;
  }
}

.action-card .actions {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.pdf-catalog-row {
  display: grid;
  gap: 0.55rem;
  margin: 0.35rem 0 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 162, 0, 0.22);
  background: rgba(255, 162, 0, 0.06);
}

.pdf-catalog-row.hidden {
  display: none;
}

.pdf-catalog-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: #ffe0a8;
  font-weight: 600;
}

.pdf-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 162, 0, 0.2);
}

.pdf-catalog-indicator.is-off .pdf-dot {
  background: var(--faint);
  box-shadow: none;
}

.pdf-catalog-indicator.is-off {
  color: var(--muted);
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-inline input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.action-bar {
  flex-wrap: wrap;
}

.action-busy {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 162, 0, 0.28);
  background: rgba(255, 162, 0, 0.08);
  color: #ffe0a8;
  font-size: 0.86rem;
}

.action-busy.hidden {
  display: none;
}

.spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgba(255, 162, 0, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.action-bar.is-busy button {
  opacity: 0.55;
  pointer-events: none;
}

.action-bar button.is-loading {
  opacity: 1;
  position: relative;
  padding-left: 2rem;
}

.action-bar button.is-loading::before {
  content: "";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  margin-top: -0.425rem;
  border: 2px solid rgba(26, 18, 0, 0.25);
  border-top-color: #1a1200;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.action-bar button.secondary.is-loading::before {
  border: 2px solid rgba(255, 162, 0, 0.25);
  border-top-color: var(--accent);
}

/* —— Forms —— */
label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--field-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Shared text fields, selects, and textareas across all views */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="hidden"]):not([type="range"]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--field-border);
  background-color: var(--field-bg);
  color: var(--field-text);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.85rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color-scheme: dark;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.35rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23b0b0b0' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px 8px;
  cursor: pointer;
}

select option,
select optgroup {
  background-color: var(--bg-card);
  color: var(--field-text);
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 2l8 8M10 2L2 10' stroke='%23b0b0b0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--field-placeholder);
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--field-border-focus);
  background-color: var(--field-bg-focus);
  box-shadow: 0 0 0 3px rgba(255, 162, 0, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--field-text);
  caret-color: var(--field-text);
  border: 1px solid var(--field-border);
  -webkit-box-shadow: 0 0 0 1000px var(--field-bg) inset;
  box-shadow: 0 0 0 1000px var(--field-bg) inset;
  transition: background-color 9999s ease-out 0s;
}

textarea {
  resize: vertical;
}

textarea[readonly] {
  background-color: rgba(0, 0, 0, 0.28);
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.actions {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

button,
.btn {
  appearance: none;
  border: 0;
  background: linear-gradient(180deg, #ffb01a 0%, var(--accent) 100%);
  color: var(--btn-ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0.68rem 1.15rem;
  cursor: pointer;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 18px rgba(255, 162, 0, 0.18);
}

button:hover {
  filter: brightness(1.04);
}

button.secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

button.secondary:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  filter: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

button.danger {
  background: transparent;
  color: #ffb3c0;
  box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.45);
  font-weight: 600;
}

button.danger:hover {
  background: rgba(255, 77, 109, 0.08);
  filter: none;
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

.hint {
  color: var(--faint);
  font-size: 0.84rem;
  font-weight: 400;
  margin: 0.4rem 0 0;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
}

.hint code,
.footer-note code {
  color: var(--accent-2);
  background: var(--accent-dim);
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8em;
}

.banner {
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  margin: 0.85rem 0 0;
  background: rgba(255, 162, 0, 0.08);
  border: 1px solid rgba(255, 162, 0, 0.18);
  color: #ffe4b8;
  font-size: 0.88rem;
  line-height: 1.45;
}

.banner.warn {
  background: rgba(255, 77, 109, 0.08);
  border-color: rgba(255, 77, 109, 0.28);
  color: #ffc2cd;
}

.list {
  display: grid;
  gap: 0.4rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.15rem;
  max-height: none;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 162, 0, 0.45) rgba(255, 255, 255, 0.04);
}

.list::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

.list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.list::-webkit-scrollbar-thumb {
  background: rgba(255, 162, 0, 0.4);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 162, 0, 0.65);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.list::-webkit-scrollbar-corner {
  background: transparent;
}

.doc {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 0;
  max-width: 100%;
}

.doc:hover {
  border-color: rgba(255, 162, 0, 0.35);
  background: rgba(255, 162, 0, 0.04);
}

.doc.active {
  border-color: rgba(255, 162, 0, 0.55);
  background: rgba(255, 162, 0, 0.1);
  box-shadow: inset 2px 0 0 var(--accent);
}

.doc h3 {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta {
  color: var(--faint);
  font-size: 0.68rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  border: 1px solid transparent;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.pill.ingested {
  color: #9fe3b4;
  background: rgba(98, 201, 141, 0.12);
  border-color: rgba(98, 201, 141, 0.25);
}

.pill.failed,
.pill.duplicate {
  color: #ffb0c0;
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.28);
}

.pill.proposed,
.pill.extracted,
.pill.uploaded,
.pill.extracting {
  color: #ffd080;
  background: rgba(255, 162, 0, 0.1);
  border-color: rgba(255, 162, 0, 0.28);
}

.pill.pdf-pill {
  color: #7ee8ff;
  background: rgba(126, 232, 255, 0.1);
  border-color: rgba(126, 232, 255, 0.28);
}

.hidden {
  display: none !important;
}

.footer-note {
  margin-top: 1.5rem;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.5;
}

@media (max-width: 1099px) {
  .athenaeum-live-panel {
    display: none !important;
  }

  .main-stage {
    display: block;
  }
}

@media (max-width: 900px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-queue {
    max-height: 220px;
  }

  .content {
    padding: 1rem 1.1rem 2.5rem;
  }

  .top-strip {
    padding: 1rem 1.1rem;
    flex-direction: column;
    align-items: flex-start;
  }
}
