:root {
  color-scheme: light;
  --font-heading: 'Be Vietnam Pro', Inter, system-ui, sans-serif;
  --font-body: 'Source Sans 3', Inter, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --bg: #f3f6fb;
  --bg-soft: #eef3f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --border: #d8e2ee;
  --border-strong: #bdd0e6;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --primary: #1e3a8a;
  --primary-soft: #dbeafe;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --success: #047857;
  --success-soft: #d1fae5;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --warning: #b45309;
  --warning-soft: #ffedd5;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 28px 64px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(30, 58, 138, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(180, 83, 9, 0.08), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
a {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.22);
  outline-offset: 2px;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: linear-gradient(rgba(30, 41, 59, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(30, 41, 59, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 88%);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  z-index: 10;
}

.sidebar-top,
.sidebar-bottom {
  display: grid;
  gap: 16px;
}

.sidebar-logo,
.sidebar-item,
.sidebar-status-dot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border-radius: 16px;
  padding: 0 14px;
  white-space: nowrap;
}

.sidebar-logo {
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 700;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.92), rgba(255, 255, 255, 0.98));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.logo-mark,
.nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.sidebar-wordmark,
.nav-label {
  display: inline-flex;
  align-items: center;
}

.sidebar-wordmark,
.mono-eyebrow,
.col-label,
.field-tag,
.page-indicator-mono,
.code-block,
.status-badge,
.history-status,
.field-count-badge,
.history-total-badge {
  font-family: var(--font-mono);
}

.accent-dot {
  color: var(--accent);
}

.sidebar-nav-items {
  display: grid;
  gap: 10px;
}

.sidebar-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.sidebar-item:hover,
.sidebar-item.active {
  background: rgba(219, 234, 254, 0.78);
  border-color: var(--border-strong);
  color: var(--primary);
  transform: translateY(-1px);
}

.sidebar-item.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.sidebar-status-dot {
  color: var(--muted);
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.status-dot-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(4, 120, 87, 0.1);
  flex: 0 0 auto;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

.view {
  display: none;
  animation: viewIn 0.24s ease both;
}

.view.active {
  display: block;
}

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

.hidden {
  display: none !important;
}

.primary-btn,
.ghost-btn,
.tab-btn,
.icon-btn,
.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  min-height: 42px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.primary-btn:hover,
.ghost-btn:hover,
.tab-btn:hover,
.icon-btn:hover,
.filter-pill:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.ghost-btn,
.tab-btn,
.icon-btn,
.filter-pill {
  background: var(--surface);
  color: var(--text-soft);
}

.primary-btn.disabled,
.ghost-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.small-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.icon-btn {
  width: 42px;
  padding: 0;
}

.icon-btn svg,
.btn-icon,
.btn-arrow {
  width: 16px;
  height: 16px;
}

.upload-scene {
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: center;
  gap: 18px;
  max-width: 860px;
  margin: 0 auto;
}

.upload-header {
  max-width: 620px;
}

.mono-eyebrow {
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
  margin-bottom: 12px;
}

.upload-title,
.history-title {
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
}

.upload-title {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  line-height: 1.08;
}

.title-accent {
  color: var(--primary);
}

.upload-subtitle,
.upload-highlights,
.upload-highlight-card,
.upload-highlight-card strong,
.upload-highlight-card span {
  display: none;
}

.upload-desc {
  color: var(--text-soft);
  font-size: 1.02rem;
  margin-top: 10px;
  line-height: 1.65;
  max-width: 540px;
}

.upload-form {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
}

.file-drop {
  min-height: 280px;
  border-radius: 22px;
  border: 1.5px dashed var(--border-strong);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.62), rgba(255, 255, 255, 0.98));
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.file-drop::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.file-drop:hover,
.file-drop.has-file {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.84), rgba(255, 255, 255, 1));
}

.file-drop input {
  display: none;
}

.drop-icon-wrap {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(219, 234, 254, 0.95);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(30, 58, 138, 0.08);
}

.drop-icon {
  width: 48px;
  height: 48px;
}

.file-drop-title {
  font-family: var(--font-heading);
  font-size: 1.34rem;
  font-weight: 700;
}

.file-drop-hint {
  color: var(--muted);
  font-size: 0.98rem;
}

.upload-submit-btn {
  min-height: 52px;
  border-radius: 16px;
  font-size: 1rem;
}

.recent-jobs-section {
  width: 100%;
}

.recent-jobs-list {
  display: grid;
  gap: 10px;
}

.recent-jobs-empty,
.history-empty,
.page-list-empty,
.fallback-empty {
  color: var(--muted);
  padding: 18px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.recent-job-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.recent-job-row:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

.recent-dot,
.history-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted-2);
}

.recent-dot.completed,
.history-status-dot.completed,
.dot-success {
  background: var(--success);
}

.recent-dot.failed,
.history-status-dot.failed,
.dot-danger {
  background: var(--danger);
}

.recent-dot.processing,
.recent-dot.queued,
.history-status-dot.processing,
.history-status-dot.queued,
.dot-warn {
  background: var(--warning);
}

.recent-filename,
.history-filename,
.status-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.97rem;
}

.recent-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.status-bar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 0.9fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.status-bar-left,
.status-bar-center,
.status-bar-right,
.status-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-bar-right {
  justify-content: flex-end;
}

.status-sep {
  color: var(--muted-2);
}

.status-badge,
.history-status {
  font-size: 0.74rem;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
}

.status-badge.badge-success,
.history-status.success {
  color: var(--success);
  background: var(--success-soft);
}

.status-badge.badge-danger,
.history-status.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-badge.badge-warn,
.history-status.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-pages,
.status-percent,
.status-phase {
  color: var(--text-soft);
  font-size: 0.9rem;
  white-space: nowrap;
}

.status-progress-wrap {
  flex: 1;
}

.status-progress-bar {
  height: 10px;
  flex: 1;
  min-width: 120px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.status-progress-fill,
#progressFill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}

.status-message {
  display: none;
}

.error-banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 120px);
  min-height: 680px;
}

.page-nav-col,
.viewer-col,
.history-scene {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.page-nav-col {
  display: flex;
  flex-direction: column;
}

.page-nav-header {
  padding: 12px 14px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-nav-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.page-nav-header-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.page-nav-tabs {
  display: flex;
  gap: 2px;
}

.page-nav-tab {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.page-nav-tab:hover {
  background: rgba(219, 234, 254, 0.5);
  color: var(--primary);
}

.page-nav-tab.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
  position: relative;
  bottom: -1px;
}

.left-tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.left-tab-panel.active {
  display: flex;
  flex-direction: column;
}

.viewer-panel {
  display: none;
  flex: 1;
  min-height: 0;
}

.viewer-panel.active {
  display: flex;
  flex-direction: column;
}

.workspace.result-mode {
  grid-template-columns: 300px minmax(0, 1fr);
}

.raw-json-block.hidden {
  display: none;
}

.left-json-block {
  flex: 1;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  overflow: auto;
}

.json-visual,
.json-graph {
  flex: 1;
  min-height: 0;
  padding: 18px;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(circle at 16px 16px, rgba(30, 58, 138, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.96));
  background-size: 18px 18px, auto;
  overflow: auto;
}

.json-visual {
  gap: 14px;
  background: linear-gradient(180deg, #f8fafc, #ffffff);
  overflow: auto;
}

.json-visual-header,
.graph-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.json-visual-header h2,
.graph-header h3 {
  margin: 2px 0 0;
  font-family: var(--font-heading);
  color: var(--text);
}

.json-visual-header h2 {
  font-size: 1.15rem;
  line-height: 1.25;
}

.graph-header h3 {
  font-size: 0.9rem;
}

.graph-eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.json-document-type,
.graph-count,
.graph-node-type {
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
  padding: 5px 7px;
  white-space: nowrap;
}

.json-section-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.json-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.json-section-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text);
}

.json-section-header span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.json-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.json-info-item,
.json-mini-card,
.law-article-card {
  padding: 12px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 14px;
  background: #ffffff;
}

.json-info-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-bottom: 5px;
}

.json-info-value,
.json-mini-card strong {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
}

.json-missing,
.json-empty-line,
.json-visual-empty {
  color: var(--muted);
  font-style: italic;
}

.json-card-list {
  display: grid;
  gap: 10px;
}

.json-mini-card p,
.law-article-card p {
  margin: 6px 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.json-preface {
  margin: 0 0 12px;
  color: var(--text-soft);
  line-height: 1.6;
}

.law-structure-item {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.law-structure-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 11px 12px;
  cursor: pointer;
}

.law-structure-item summary:focus-visible,
.raw-json-details summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.law-structure-item summary span,
.law-article-title span {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.law-structure-item summary strong,
.law-article-title strong {
  color: var(--text);
  font-size: 0.9rem;
  text-align: right;
}

.law-structure-item.nested,
.law-structure-item.nested.deeper {
  margin: 8px 10px;
}

.law-article-card {
  margin: 8px 10px 10px;
}

.law-article-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-soft);
  line-height: 1.55;
}

.law-article-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.raw-json-details summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.raw-json-inline {
  max-height: 360px;
  margin-top: 10px;
  overflow: auto;
}

.graph-tree,
.graph-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.graph-tree {
  padding-bottom: 10px;
}

.graph-children {
  position: relative;
  margin-left: 14px;
  padding-left: 14px;
}

.graph-children::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 8px;
  left: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--primary), rgba(148, 163, 184, 0.35));
}

.graph-node {
  position: relative;
  margin: 8px 0;
}

.graph-node .graph-node::before {
  content: '';
  position: absolute;
  top: 17px;
  left: -14px;
  width: 14px;
  height: 1px;
  background: rgba(30, 58, 138, 0.36);
}

.graph-node-card {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-soft);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

summary.graph-node-card {
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

summary.graph-node-card:hover,
summary.graph-node-card:focus-visible {
  border-color: var(--border-strong);
  background: #ffffff;
  outline: none;
  transform: translateY(-1px);
}

.graph-node-card::-webkit-details-marker {
  display: none;
}

.graph-node-dot {
  width: 10px;
  height: 10px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.graph-node-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.graph-node-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: capitalize;
}

.graph-node-value {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-node-leaf .graph-node-card {
  background: rgba(248, 250, 252, 0.96);
}

.graph-node-leaf .graph-node-dot {
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.workspace.graph-mode {
  grid-template-columns: 300px minmax(0, 1fr);
}

.neo-graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.neo-graph-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(30, 58, 138, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.08), transparent 38%),
    radial-gradient(circle at 1px 1px, rgba(30, 58, 138, 0.09) 1px, transparent 0),
    linear-gradient(135deg, #f8fbff, #ffffff 46%, #f1f5ff);
  background-size: auto, 18px 18px, auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), var(--shadow-sm);
  overflow: hidden;
}

.neo-graph-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}

.neo-graph-toolbar span {
  padding: 5px 8px;
  border: 1px solid rgba(30, 58, 138, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.neo-graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  cursor: grab;
  touch-action: none;
}

.neo-graph-canvas:active {
  cursor: grabbing;
}

.neo-graph-hit-area {
  fill: transparent;
  cursor: grab;
}

.neo-viewport {
  transform-origin: center;
}

.neo-link {
  stroke: rgba(30, 58, 138, 0.42);
  stroke-width: 1.5;
}

.neo-link-label {
  fill: #334155;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.015em;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.94);
  stroke-width: 5px;
  text-transform: none;
}

.neo-node {
  cursor: grab;
  outline: none;
}

.neo-node:active {
  cursor: grabbing;
}

.neo-node circle {
  stroke: rgba(255, 255, 255, 0.98);
  stroke-width: 3;
  filter: drop-shadow(0 9px 14px rgba(15, 23, 42, 0.18));
  transition: filter 0.16s ease, stroke-width 0.16s ease, transform 0.16s ease;
}

.neo-node:focus-visible circle,
.neo-node:hover circle,
.neo-node.selected circle {
  stroke-width: 5;
  filter: drop-shadow(0 12px 20px rgba(30, 58, 138, 0.32));
}

.neo-node.selected circle {
  stroke: #fbbf24;
}

.neo-node-title,
.neo-node-subtitle {
  fill: #ffffff;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(15, 23, 42, 0.24);
  stroke-width: 2px;
}

.neo-node-title {
  font-size: 8px;
  font-weight: 900;
}

.neo-node-subtitle {
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0.88;
  text-transform: uppercase;
}

.neo-graph-detail {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(30, 58, 138, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.neo-detail-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.neo-detail-dot {
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.neo-graph-detail h4 {
  margin: 10px 0 6px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
}

.neo-graph-detail p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}

.neo-detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.neo-detail-metrics span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(30, 58, 138, 0.08);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 900;
}

.neo-detail-properties {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.neo-detail-properties > strong {
  color: var(--text);
  font-size: 0.8rem;
}

.neo-detail-property {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
}

.neo-detail-property span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.neo-detail-empty {
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.neo-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.neo-graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.neo-graph-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(15, 23, 42, 0.08);
}

@media (max-width: 1180px) {
  .neo-graph-layout {
    grid-template-columns: 1fr;
  }

  .neo-graph-detail {
    max-height: 260px;
  }
}

.graph-empty {
  margin: 12px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.graph-empty.compact {
  margin: 8px 0 0 14px;
  padding: 10px;
  font-size: 0.76rem;
}

.col-label {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

.page-nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-nav-controls .icon-btn {
  width: 30px;
  min-height: 30px;
  border-radius: 10px;
}

.page-indicator-mono,
.field-count-badge,
.history-total-badge {
  color: var(--primary);
  font-size: 0.76rem;
}

.activity-rail-hidden {
  display: none;
}

.page-list {
  padding: 8px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
}

.page-accordion-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.page-accordion-item.active {
  border-color: var(--border-strong);
  background: var(--primary-soft);
}

.page-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text-soft);
}

.page-accordion-item.active .page-accordion-header {
  color: var(--primary);
}

.page-accordion-header:hover {
  background: rgba(219, 234, 254, 0.4);
}

.page-accordion-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
}

.page-accordion-meta {
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-accordion-item.active .page-accordion-meta {
  color: var(--primary);
}

.page-accordion-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.page-accordion-item.active .page-accordion-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.page-accordion-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 4px 0;
}

.page-accordion-item.active .page-accordion-body {
  display: block;
}

.page-field-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.86rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.4);
}

.page-field-row:last-child {
  border-bottom: 0;
}

.page-field-row:hover {
  background: rgba(219, 234, 254, 0.5);
  color: var(--primary);
}

.page-field-row.active {
  background: rgba(30, 58, 138, 0.08);
  color: var(--primary);
}

.page-field-row-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.page-field-row-state {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
}

.page-field-row-state.success { background: var(--success); }
.page-field-row-state.info    { background: var(--info); }
.page-field-row-state.warn    { background: var(--warning); }

.page-field-row-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}



.page-list-item,
.activity-chip {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-soft);
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
}

.page-list-item strong,
.activity-chip strong {
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.page-list-item.active,
.page-list-item:hover,
.activity-chip.active,
.activity-chip:hover {
  color: var(--primary);
  border-color: var(--border-strong);
  background: var(--primary-soft);
}

.viewer-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-hint {
  flex-shrink: 0;
  margin: 10px 10px 0;
  border-radius: 12px;
}

.subtle {
  color: var(--muted);
}

.pdf-hint {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 0.92rem;
}

.pdf-hint.warn {
  color: var(--warning);
  border-color: #fdba74;
  background: var(--warning-soft);
}

.pdf-hint.success {
  color: var(--success);
  border-color: #86efac;
  background: var(--success-soft);
}

.page-canvas {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.page-canvas.empty,
.page-canvas.loading {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.canvas-empty-state {
  display: grid;
  place-items: center;
  gap: 14px;
  text-align: center;
  max-width: 420px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  color: var(--muted-2);
}

.loader-ring {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

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

.pdf-viewer-shell {
  width: 100%;
  min-height: 100%;
  overflow: visible;
}

.pdf-viewer-stage {
  position: relative;
  width: min(100%, 1120px);
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.pdf-page-image {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  animation: imageIn 0.22s ease both;
}

@keyframes imageIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pdf-overlay-layer {
  position: absolute;
  inset: 0;
}

.review-box {
  position: absolute;
  border-radius: 6px;
  border: 2px solid rgba(29, 78, 216, 0.88);
  background: rgba(219, 234, 254, 0.18);
  pointer-events: auto;
}

.review-box.ghost {
  border-color: rgba(180, 83, 9, 0.58);
  background: rgba(254, 243, 199, 0.2);
  opacity: 0.94;
}

.review-box.selected {
  border-color: var(--primary);
  background: rgba(30, 58, 138, 0.12);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.16);
  animation: pulseBox 0.7s ease;
}

@keyframes pulseBox {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 58, 138, 0.28);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(30, 58, 138, 0);
  }
}

.box-label {
  position: absolute;
  top: -27px;
  left: 0;
  z-index: 2;
  max-width: 280px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}

.box-label-ghost {
  background: var(--accent);
}

.inspector-intro {
  display: none;
}

.field-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  min-height: 0;
}
.fallback-sheet {
  display: grid;
  gap: 14px;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
}

.fallback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fallback-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fallback-field-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.fallback-field-card.active {
  border-color: var(--border-strong);
  background: var(--primary-soft);
}

.history-scene {
  min-height: calc(100vh - 48px);
  padding: 22px;
}

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

.history-header-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.history-title {
  font-size: clamp(1.4rem, 2.3vw, 2rem);
}

.history-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  width: 16px;
  height: 16px;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 38px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.search-input:focus {
  border-color: var(--border-strong);
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.history-row:hover {
  border-color: var(--border-strong);
  background: #ffffff;
}

.history-row-open {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.history-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.history-row-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-row-actions {
  display: flex;
  gap: 8px;
}

.history-pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.history-pagination .ghost-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

@media (max-width: 1440px) {
  .workspace {
    grid-template-columns: 200px minmax(0, 1fr) 360px;
  }
}

@media (max-width: 1280px) {
  .status-bar {
    grid-template-columns: 1fr;
  }

  .status-bar-right {
    justify-content: flex-start;
  }

  .upload-highlights {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 180px minmax(0, 1fr) 330px;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 16px;
  }

  .sidebar-top {
    grid-template-columns: 1fr;
  }

  .sidebar-nav-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-content {
    padding: 18px;
  }

  .workspace {
    height: auto;
    grid-template-columns: 1fr;
  }

  .page-nav-col {
    max-height: 320px;
  }

  .page-list {
    flex-direction: column;
  }

  .inspector-col {
    min-height: 520px;
  }

  .history-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 14px;
  }

  .upload-title {
    font-size: 2.5rem;
  }

  .upload-subtitle {
    font-size: 1.02rem;
  }

  .upload-form,
  .history-scene {
    padding: 16px;
  }

  .file-drop {
    min-height: 220px;
    padding: 20px;
  }

  .tabbar {
    grid-template-columns: 1fr;
  }

  .search-wrap {
    min-width: 100%;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .history-row-actions {
    justify-content: flex-start;
  }
}
