:root {
  --bg: #0a0a0a;
  --surface: #111;
  --surface-alt: #141414;
  --border: #2b2b2b;
  --text: #e5e5e5;
  --text-dim: #9aa3ad;
  --accent: #58a6ff;
  --accent-strong: #79b8ff;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  padding: calc(var(--uni-top-offset, 64px) + 16px) 16px 120px;
}

.top-bar {
  position: sticky;
  top: var(--uni-top-offset, 64px);
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  margin-bottom: 24px;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.field-grid {
  display: grid;
  gap: 16px;
}

.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.field-grid input,
.field-grid textarea,
.field-grid select,
.card-toolbar input,
.card-toolbar select,
.inspector-body input,
.inspector-body textarea,
.inspector-body select {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.case-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.case-meta .label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--text-dim);
}

.quick-add {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick-add button,
.export-card button,
.contradiction-form button,
.inspector-footer button,
.card-row button {
  background: var(--accent);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: #0a0a0a;
  font-weight: 600;
  cursor: pointer;
}

.quick-add button {
  min-width: 130px;
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  color: var(--text);
}

.view-panel.hidden {
  display: none;
}

.card-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.card-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-section h3 {
  margin: 0;
  font-size: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-row {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-row .row-title {
  font-weight: 600;
  font-size: 14px;
}

.card-row .row-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.card-row .row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.graph-wrapper {
  position: relative;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: radial-gradient(circle at top, #151515, #0a0a0a 65%);
  overflow: hidden;
}

.graph-wrapper svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.graph-nodes {
  position: relative;
  width: 100%;
  height: 100%;
}

.graph-node {
  position: absolute;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.15);
  border: 1px solid rgba(88, 166, 255, 0.5);
  font-size: 12px;
  cursor: grab;
  min-width: 80px;
  text-align: center;
}

.graph-node.claim { border-color: #ffb347; background: rgba(255, 179, 71, 0.15); }
.graph-node.entity { border-color: #6bffb0; background: rgba(107, 255, 176, 0.15); }
.graph-node.source { border-color: #c5b3ff; background: rgba(197, 179, 255, 0.15); }
.graph-node.snippet { border-color: #ff8ccf; background: rgba(255, 140, 207, 0.15); }
.graph-node.event { border-color: #7fe7ff; background: rgba(127, 231, 255, 0.15); }

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-lane {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-alt);
}

.timeline-lane h4 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--accent-strong);
}

.timeline-item {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.timeline-item:first-of-type {
  border-top: none;
}

.contradiction-form {
  display: grid;
  gap: 12px;
}

.export-grid {
  display: grid;
  gap: 16px;
}

.export-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-card h3 {
  margin: 0;
  font-size: 16px;
}

.file-input {
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}

.file-input input {
  display: none;
}

.preview {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.small {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}

.inspector {
  position: fixed;
  right: 16px;
  top: calc(var(--uni-top-offset, 64px) + 16px);
  bottom: 16px;
  width: min(420px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateX(110%);
  transition: transform 0.2s ease;
  z-index: 20;
}

.inspector.open {
  transform: translateX(0);
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspector-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.inspector-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .inspector {
    left: 16px;
    right: 16px;
    bottom: 16px;
    top: auto;
    height: 70vh;
    width: auto;
    transform: translateY(110%);
  }

  .inspector.open {
    transform: translateY(0);
  }
}

@media (min-width: 900px) {
  .contradiction-form {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .export-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
