:root {
  --bg-void: #000000;
  --bg-surface: #070709;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.055);
  --border-dim: rgba(255, 255, 255, 0.075);
  --border-active: rgba(255, 255, 255, 0.17);
  --text-primary: #e8e8ed;
  --text-secondary: #a1a1aa;
  --text-muted: #8b8b9a;
  --accent-green: #65d6a6;
  --accent-green-soft: rgba(101, 214, 166, 0.12);
  --accent-amber: #e0b76a;
  --accent-red: #f28b82;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 5px;
  --radius-md: 9px;
  --radius-lg: 14px;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

.grid-bg {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.011) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.011) 1px, transparent 1px),
    radial-gradient(circle at 50% 18%, rgba(101, 214, 166, 0.042), transparent 64%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.82) 54%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 0%, rgba(0, 0, 0, 0.82) 54%, transparent 100%);
}

.grid-bg::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 12%, rgba(0, 0, 0, 0.44) 100%);
  content: "";
}

#network-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.86;
  pointer-events: none;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 42px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(2, 2, 4, 0.86);
  backdrop-filter: blur(20px) saturate(1.1);
}

.brand {
  display: inline-flex;
  gap: 9px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand strong {
  color: var(--text-primary);
}

.brand:hover {
  color: var(--text-primary);
}

.system-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.session-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.session-controls form {
  display: flex;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 14px rgba(101, 214, 166, 0.65);
}

main {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 132px 0 88px;
}

.login-page {
  background:
    radial-gradient(circle at 50% 20%, rgba(101, 214, 166, 0.052), transparent 58%),
    var(--bg-void);
}

.login-shell {
  display: grid;
  place-items: center;
  width: min(520px, calc(100% - 32px));
  min-height: 100vh;
  padding: 32px 0;
}

.login-card {
  width: 100%;
  padding: clamp(28px, 6vw, 48px);
}

.login-card h1 {
  margin: 10px 0 12px;
  font-size: clamp(32px, 7vw, 52px);
  font-weight: 480;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.login-form {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.login-error {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(242, 139, 130, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(242, 139, 130, 0.08);
  color: var(--accent-red);
  font-size: 13px;
}

.login-note,
.login-back {
  color: var(--text-muted);
  font-size: 12px;
}

.login-note {
  margin-top: 20px;
}

.login-back {
  display: inline-block;
  margin-top: 18px;
  text-decoration: none;
}

.login-back:hover {
  color: var(--text-primary);
}

.hero {
  max-width: 840px;
  margin-bottom: 44px;
}

.eyebrow,
.section-index,
.card-mark,
.state-badge,
.counter,
.hash-panel span {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow::before {
  width: 24px;
  height: 1px;
  background: var(--text-muted);
  content: "";
}

.hero h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 5vw, 4.7rem);
  font-weight: 300;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero h1 em {
  color: var(--text-secondary);
  font-style: normal;
}

.hero-copy {
  max-width: 700px;
  color: var(--text-secondary);
  font-size: clamp(0.98rem, 1.5vw, 1.12rem);
}

.matter-chip {
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 24px;
  padding: 8px 11px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  font-family: var(--mono);
  font-size: 10px;
}

.matter-chip:not([hidden]) {
  display: flex;
}

.matter-chip span {
  margin-right: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.matter-chip code {
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow,
.card {
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.22);
}

.workflow {
  margin-bottom: 24px;
  padding: 26px 30px 20px;
}

.workflow-heading,
.card-heading,
.upload-footer,
.download-actions,
.workflow-actions {
  display: flex;
  align-items: center;
}

.workflow-heading,
.card-heading,
.upload-footer {
  justify-content: space-between;
}

.workflow-heading h2,
.card-heading h2 {
  margin-top: 4px;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.workflow-actions {
  gap: 10px;
}

.state-badge,
.counter,
.card-mark {
  padding: 5px 8px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
}

.progress-track {
  display: block;
  appearance: none;
  width: 100%;
  height: 5px;
  margin: 25px 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.progress-track::-webkit-progress-bar {
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.06);
}

.progress-track::-webkit-progress-value {
  border-radius: inherit;
  background: var(--text-primary);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
  transition: width 300ms ease;
}

.progress-track::-moz-progress-bar {
  border-radius: inherit;
  background: var(--text-primary);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
  transition: width 300ms ease;
}

.progress-track.is-indeterminate {
  animation: progress-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes progress-pulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  list-style: none;
}

.pipeline-steps li {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 180ms ease;
}

.pipeline-steps li span {
  margin-right: 5px;
}

.pipeline-steps li.is-active {
  color: var(--text-primary);
}

.pipeline-steps li.is-complete {
  color: var(--accent-green);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(330px, 0.78fr);
  gap: 24px;
  align-items: start;
}

.primary-column,
.side-column {
  display: grid;
  gap: 24px;
}

.side-column {
  position: sticky;
  top: 92px;
}

.card {
  padding: 30px;
  transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.card:hover {
  border-color: var(--border-active);
  background: var(--bg-glass-hover);
  box-shadow: 0 28px 84px rgba(0, 0, 0, 0.3);
}

.card-heading {
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-dim);
}

.card-copy {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-primary);
  padding: 12px 13px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

input:hover,
textarea:hover,
input:focus,
textarea:focus {
  border-color: var(--border-active);
  background: rgba(0, 0, 0, 0.72);
  box-shadow: 0 0 0 3px rgba(101, 214, 166, 0.07);
}

textarea {
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 11px 19px;
  border: 1px solid var(--text-primary);
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: #09090b;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(232, 232, 237, 0.08);
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(232, 232, 237, 0.14);
}

.button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 5px 16px rgba(232, 232, 237, 0.08);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.button-secondary,
.button-quiet {
  border-color: var(--border-active);
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

.button-quiet {
  border-color: var(--border-dim);
  color: var(--text-secondary);
}

.button-compact {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.66rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 30px;
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  outline: 0;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.dropzone:hover,
.dropzone.is-dragover,
.dropzone:focus-visible {
  border-color: var(--text-primary);
  background: rgba(255, 255, 255, 0.035);
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(101, 214, 166, 0.08), inset 0 0 42px rgba(101, 214, 166, 0.025);
}

.dropzone[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.dropzone-glyph {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border: 1px solid var(--border-active);
  border-radius: 50%;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 22px;
}

.dropzone strong {
  margin-bottom: 5px;
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 500;
}

.dropzone span:last-of-type {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dropzone-help {
  margin-top: 9px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.045em;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--mono);
  font-size: 10px;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--text-muted);
}

.remove-file {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.remove-file:hover {
  border-color: var(--accent-red);
  background: rgba(242, 139, 130, 0.07);
  color: var(--accent-red);
}

.upload-footer {
  gap: 18px;
  margin-top: 20px;
}

.upload-footer p {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
}

.report-sections {
  display: grid;
  gap: 8px;
}

.report-section {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.018);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.report-section code,
.report-section span:last-child {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 9px;
}

.report-section.is-ready span:last-child {
  color: var(--accent-green);
}

.download-actions {
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.download-actions .button {
  flex: 1 1 180px;
}

.download-hint {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.signature-badge {
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.signature-badge.is-pending {
  color: var(--accent-amber);
}

.signature-badge.is-verified {
  color: var(--accent-green);
}

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

.review-list.empty-state {
  padding: 22px;
  border: 1px dashed var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -7px 0 18px;
}

.priority-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.priority-chip::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  content: "";
}

.priority-chip.is-blocking::before { background: var(--accent-red); }
.priority-chip.is-warning::before { background: var(--accent-amber); }
.priority-chip.is-optional::before { background: var(--text-secondary); }

.review-item {
  padding: 15px;
  border: 1px solid var(--border-dim);
  border-left: 2px solid var(--accent-amber);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.review-item.is-blocking {
  border-left-color: var(--accent-red);
}

.review-item.is-optional {
  border-left-color: var(--text-muted);
}

.review-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}

.review-item h3 {
  margin-bottom: 10px;
  font-size: 0.87rem;
  font-weight: 500;
}

.review-item details {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.review-item summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.review-item ul {
  display: grid;
  gap: 6px;
  margin: 9px 0 0 16px;
}

.review-item .button {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 0.66rem;
}

.metrics {
  display: grid;
  gap: 0;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-dim);
}

.metrics dt,
.metrics dd {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.metrics dt {
  color: var(--text-muted);
}

.metrics dd {
  color: var(--text-secondary);
  text-align: right;
}

.metrics dd.is-good {
  color: var(--accent-green);
}

.hash-panel {
  margin-top: 18px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
}

.hash-panel span {
  display: block;
  margin-bottom: 7px;
}

.hash-panel code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 9px;
}

.notice {
  position: fixed;
  z-index: 40;
  right: 22px;
  bottom: 22px;
  width: min(410px, calc(100% - 44px));
  padding: 14px 16px;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  background: rgba(11, 11, 14, 0.97);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.notice.is-error {
  border-color: rgba(242, 139, 130, 0.5);
  color: var(--accent-red);
}

.notice.is-success {
  border-color: rgba(101, 214, 166, 0.45);
  color: var(--accent-green);
}

footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 42px;
  border-top: 1px solid var(--border-dim);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.11em;
}

@media (max-width: 1050px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    position: static;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 18px;
  }

  .brand span,
  .system-state {
    display: none;
  }

  #network-background {
    opacity: 0.72;
  }

  main {
    width: min(100% - 28px, 1380px);
    padding-top: 104px;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .workflow,
  .card {
    padding: 21px;
  }

  .workflow-heading,
  .card-heading,
  .upload-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pipeline-steps li {
    font-size: 0;
  }

  .pipeline-steps li span {
    font-size: 9px;
  }

  .form-grid,
  .side-column {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .upload-footer .button,
  .download-actions .button {
    width: 100%;
  }

  .report-section {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .report-section span:last-child {
    display: none;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}