:root {
  --bg-desk: #F5F1E8;
  --bg-surface: #FAF7F0;
  --bg-canvas: #EBE6DC;
  --text-ink: #24211E;
  --text-secondary: #4A463F;
  --text-muted: #706B63;
  --border-hairline: #D8D2C7;
  --border-dark: #A69F94;
  --accent-oxblood: #A8483C;
  --accent-oxblood-subtle: rgba(168, 72, 60, 0.06);
  --heading-maroon: #6E2424;
  --heading-maroon-dark: #562020;

  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-subtle: 2px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow-y: auto;
}

body {
  background-color: var(--bg-desk);
  color: var(--text-ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.desk-container {
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

/* Editorial Header */
.desk-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-hairline);
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--heading-maroon);
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.meta-sep {
  color: var(--border-dark);
}

/* Main Two-Column Evidence Desk */
.desk-workspace {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
  flex: 1;
  align-items: start;
}

/* Left Column: Evidence Map */
.desk-map-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 120px);
  min-height: 480px;
  position: sticky;
  top: 16px;
}

.panel-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-hairline);
  background: var(--bg-desk);
}

.panel-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.desk-section-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--heading-maroon-dark);
}

.panel-hint {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.graph-controls {
  display: flex;
  gap: 10px;
}

.btn-desk-text {
  background: none;
  border: none;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-desk-text:hover {
  color: var(--text-ink);
}

.cy-wrapper {
  flex: 1;
  position: relative;
  background: var(--bg-canvas);
}

#cy {
  width: 100%;
  height: 100%;
}

.graph-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--heading-maroon-dark);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.45;
}

/* Archival Quote Caption Strip */
.graph-caption-strip {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  background: rgba(245, 241, 232, 0.96);
  border: 1px solid var(--border-hairline);
  border-left: 3px solid var(--accent-oxblood);
  border-radius: var(--radius-subtle);
  padding: 6px 10px;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  pointer-events: none;
  z-index: 10;
}

.graph-legend {
  padding: 8px 14px;
  background: var(--bg-desk);
  border-top: 1px solid var(--border-hairline);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.legend-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 11px;
}

.node-swatch {
  display: inline-block;
  vertical-align: middle;
}

.event-swatch {
  width: 14px;
  height: 9px;
  border-radius: 1px;
  background: #E4DED3;
  border: 1px solid #7A7265;
}

.doc-swatch {
  width: 13px;
  height: 8px;
  border-radius: 1px;
  background: #EAE5DA;
  border: 1px solid #8A8275;
}

.person-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 12px;
  border-radius: 1px;
  background: #F0ECE4;
  border: 1px solid #9E9689;
  font-size: 8px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  line-height: 1;
}

.edge-line {
  display: inline-block;
  vertical-align: middle;
}

.evidence-line {
  width: 14px;
  height: 1.5px;
  background: #9E9689;
}

/* Right Column: Document Desk */
.desk-document-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Question Section (Editorial single search line) */
.query-section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-hairline);
}

.query-form {
  margin-bottom: 8px;
}

.search-line-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 4px;
  transition: border-color 0.15s ease;
}

.search-line-wrap:focus-within {
  border-bottom-color: var(--accent-oxblood);
}

.query-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-ink);
  outline: none;
  padding: 4px 0;
}

.query-input::placeholder {
  color: var(--text-muted);
}

.btn-ask {
  background: var(--heading-maroon-dark);
  color: #FAF7F0;
  border: 1px solid var(--heading-maroon-dark);
  border-radius: var(--radius-subtle);
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-ask:hover {
  background: var(--heading-maroon);
}

.btn-ask:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.example-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}

.examples-label {
  color: var(--text-muted);
}

.example-link {
  background: none;
  border: none;
  border-bottom: 1px dashed var(--border-dark);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 0 1px;
}

.example-link:hover {
  color: var(--accent-oxblood);
  border-bottom-color: var(--accent-oxblood);
}

.link-sep {
  color: var(--border-dark);
}

/* Answer & Evidence Container */
.answer-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.answer-section {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.answer-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.status-indicator {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-indicator.answered {
  color: #2F6F4F;
}

.status-indicator.conflicting_evidence {
  color: #8C6212;
}

.status-indicator.insufficient_evidence {
  color: var(--text-muted);
}

.source-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.desk-subhead {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--heading-maroon-dark);
  margin-bottom: 8px;
}

.grounded-answer {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-ink);
}

.reasoning-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(140, 98, 18, 0.06);
  border-left: 2px solid #8C6212;
  font-size: 12px;
  color: #5C410B;
}

/* Quiet Data Use Disclosure */
.data-use-panel {
  margin-top: 12px;
  border-top: 1px dashed var(--border-hairline);
  padding-top: 6px;
}

.data-use-summary {
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: baseline;
  list-style: none;
}

.data-use-summary::-webkit-details-marker {
  display: none;
}

.data-use-summary:hover {
  color: var(--text-secondary);
}

.data-use-summary-text {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.data-use-panel[open] .data-use-summary-text {
  color: var(--text-secondary);
}

.data-use-content {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-subtle);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.data-use-line {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Plain-text Editorial Metrics Section */
.data-use-metrics-section {
  margin: 6px 0 2px 0;
  padding: 6px 0;
  border-top: 1px dashed var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.data-use-metrics-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-ink);
  margin-bottom: 1px;
}

.data-use-metrics-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-row {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: flex;
  gap: 6px;
}

.metric-label {
  color: var(--text-muted);
  min-width: 44px;
}

.metric-val {
  color: var(--text-ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

.metric-row-note {
  color: var(--text-secondary);
  font-size: 11.5px;
  margin-top: 1px;
}

.data-use-metrics-fallback {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0;
}

.prototype-boundary-box {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-hairline);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.prototype-boundary-label {
  font-weight: 500;
  color: var(--text-secondary);
  margin-right: 4px;
}

/* Numbered Claims (Evidence Notes) */
.evidence-notes-section {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.claims-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.claim-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: all 0.15s ease;
}

.claim-item:last-child {
  border-bottom: none;
}

.claim-item:hover {
  background: rgba(0, 0, 0, 0.015);
}

.claim-item.active-claim {
  border-left: 2px solid var(--accent-oxblood);
  padding-left: 10px;
  background: var(--accent-oxblood-subtle);
}

.claim-chronology {
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 2px;
  line-height: 1.4;
}

.claim-chronology.current {
  color: #2F6F4F;
}

.claim-chronology.historical {
  color: #8C6212;
}

.claim-chronology.uncertain {
  color: var(--text-muted);
}

.claim-text {
  font-size: 13.5px;
  color: var(--text-ink);
  font-weight: 500;
}

.claim-quote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 2px solid var(--accent-oxblood);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  font-style: italic;
}

.claim-source-ref {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Sources Section */
.sources-section {
  padding-bottom: 14px;
}

.receipts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.receipt-card {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-hairline);
  cursor: pointer;
  transition: all 0.15s ease;
}

.receipt-card:last-child {
  border-bottom: none;
}

.receipt-card:hover {
  background: rgba(0, 0, 0, 0.015);
}

.receipt-card.active-receipt {
  border-left: 2px solid var(--accent-oxblood);
  padding-left: 10px;
  background: var(--accent-oxblood-subtle);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.receipt-location {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.receipt-topic {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-ink);
  margin-bottom: 3px;
}

.receipt-quote {
  margin: 4px 0;
  padding: 4px 10px;
  border-left: 2px solid #8A8275;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  font-style: italic;
}

.receipt-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.technical-details {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.technical-details summary {
  cursor: pointer;
  user-select: none;
}

.technical-details summary:hover {
  color: var(--text-ink);
}

.tech-content {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  display: flex;
  gap: 12px;
  color: var(--text-muted);
}

.tech-content code {
  color: var(--text-ink);
}

/* Right to be Forgotten (Deletion Drawer) */
.deletion-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-subtle);
  overflow: hidden;
  margin-top: 8px;
}

.deletion-summary {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-desk);
  user-select: none;
}

.deletion-summary-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--heading-maroon-dark);
}

.deletion-meta-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.deletion-content {
  padding: 12px 14px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deletion-intro {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.deletion-controls {
  display: flex;
  gap: 6px;
}

.deletion-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-subtle);
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-ink);
  outline: none;
}

.deletion-input:focus {
  border-color: var(--accent-oxblood);
}

.btn-desk-secondary {
  background: #EAE6DC;
  color: var(--text-ink);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-subtle);
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.btn-desk-secondary:hover {
  background: #DDD8CD;
}

.btn-desk-danger {
  background: var(--accent-oxblood);
  color: #FAF8F5;
  border: 1px solid var(--accent-oxblood);
  border-radius: var(--radius-subtle);
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.btn-desk-danger:hover {
  background: #8F372E;
}

.deletion-results,
.deletion-report {
  background: var(--bg-desk);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-subtle);
  padding: 10px;
  font-size: 11.5px;
}

.deletion-heading {
  font-weight: 600;
  color: var(--heading-maroon-dark);
  font-size: 11.5px;
  margin-bottom: 5px;
}

.deletion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  font-size: 11px;
  color: var(--text-secondary);
}

.deletion-foot {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Decision Blast Radius (Phase 10) */
.blast-radius-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blast-radius-heading {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading-maroon-dark);
}

.blast-radius-intro {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.blast-summary-bar {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-subtle);
  border: 1px solid var(--border-hairline);
}

.blast-topics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blast-topic-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-subtle);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.blast-topic-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.blast-topic-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-ink);
}

.blast-status-tag {
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
}

.blast-status-tag.no_derived_evidence_remaining {
  color: #8C6212;
}

.blast-status-tag.reduced_evidence {
  color: #8C6212;
}

.blast-status-tag.still_supported {
  color: #2F6F4F;
}

.blast-topic-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.blast-receipts-details {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.blast-receipts-details summary {
  cursor: pointer;
  user-select: none;
  text-decoration: underline;
}

.blast-receipts-details summary:hover {
  color: var(--text-ink);
}

.blast-receipts-content {
  margin-top: 4px;
  padding: 4px 6px;
  background: var(--bg-desk);
  border-left: 2px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.deletion-success-heading {
  font-weight: 600;
  color: #2F6F4F;
  font-size: 11.5px;
  margin-bottom: 5px;
}

.deletion-report-list {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.deletion-notice {
  margin-top: 6px;
  padding: 5px 8px;
  background: rgba(47, 111, 79, 0.08);
  border: 1px solid rgba(47, 111, 79, 0.25);
  border-radius: var(--radius-subtle);
  color: #2F6F4F;
  font-size: 11px;
  font-weight: 500;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Spinner */
.spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #FAF8F5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1024px) {
  .desk-container {
    padding: 12px 16px 24px 16px;
  }

  .desk-workspace {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .desk-map-panel {
    position: static;
    height: 440px;
    min-height: 360px;
  }
}
