:root {
  color-scheme: dark;
  --navy: #071225;
  --navy-soft: #0c1d35;
  --panel: #0d1a2d;
  --panel-light: #12243d;
  --cyan: #68d4ff;
  --cyan-soft: rgba(104, 212, 255, 0.14);
  --green: #6ee7a8;
  --orange: #ffb86c;
  --text: #edf5ff;
  --muted: #93a7be;
  --line: rgba(159, 192, 222, 0.16);
  --paper: #f8f8f3;
  --paper-ink: #17283b;
  font-family: "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(104, 212, 255, 0.11), transparent 26rem),
    var(--navy);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(104, 212, 255, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: -999px;
  z-index: 100;
  border-radius: 99px;
  background: var(--cyan);
  color: var(--navy);
  padding: 0.65rem 1rem;
  font-weight: 700;
}

.skip-link:focus {
  left: 0.75rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.audit-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 18, 37, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(104, 212, 255, 0.4);
  border-radius: 9px;
  background: var(--cyan-soft);
  color: var(--cyan);
}

.product-name {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transform: translateX(-50%);
}

.product-name > span {
  font-weight: 700;
}

.product-name small {
  padding: 0.3rem 0.55rem;
  border-radius: 99px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.privacy-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(110, 231, 168, 0.1);
}

.document-bar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 29, 53, 0.88);
}

.document-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-mark {
  width: 39px;
  height: 44px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(104, 212, 255, 0.25);
  border-radius: 5px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: "DM Mono", monospace;
  font-size: 0.56rem;
  font-weight: 500;
}

.document-identity > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.document-identity strong {
  max-width: 35rem;
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-identity span {
  color: var(--muted);
  font-size: 0.67rem;
}

.document-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.document-actions label {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.document-actions select {
  height: 40px;
  min-width: 165px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 0 2rem 0 0.75rem;
  font-size: 0.74rem;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border-radius: 7px;
  padding: 0 1rem;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background 160ms ease,
    opacity 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button-secondary {
  border: 1px solid rgba(104, 212, 255, 0.3);
  background: var(--cyan-soft);
}

.button-primary {
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: var(--navy);
}

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

.notice-bar {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 18, 37, 0.76);
  color: var(--muted);
  font-size: 0.66rem;
}

.notice-bar > div {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.notice-bar p {
  margin: 0;
}

.notice-bar > span {
  font-family: "DM Mono", monospace;
  white-space: nowrap;
}

.spark {
  color: var(--cyan);
  font-size: 0.9rem;
}

.error-banner {
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(255, 184, 108, 0.35);
  background: rgba(255, 184, 108, 0.12);
  color: #ffd0a0;
  font-size: 0.75rem;
}

.audit-workspace {
  height: calc(100vh - 190px);
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(470px, 0.95fr);
}

.source-panel,
.review-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.source-panel {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(104, 212, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 212, 255, 0.025) 1px, transparent 1px),
    #0a1728;
  background-size: 24px 24px;
}

.panel-heading,
.fields-heading {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.panel-heading > div,
.fields-heading > div {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.panel-heading span,
.fields-heading span,
.confidence-summary span,
.progress-summary span {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.panel-heading h1,
.fields-heading h2 {
  margin: 0;
  font-size: 0.84rem;
}

.page-count {
  font-family: "DM Mono", monospace;
}

.document-stage {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 1.7rem;
  transition: background 150ms ease;
}

.document-stage.is-dragging {
  background: rgba(104, 212, 255, 0.08);
}

.document-paper {
  width: min(590px, 94%);
  min-height: 730px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.3rem);
  border-radius: 2px;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.paper-label {
  display: inline-block;
  margin-bottom: 1.7rem;
  color: #75849a;
  font-family: "DM Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-text {
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  line-height: 1.75;
}

.document-line {
  width: fit-content;
  max-width: 100%;
  min-height: 1.2em;
  margin: 0;
  padding: 0 0.18rem;
  overflow-wrap: anywhere;
}

.document-line:first-child {
  margin-bottom: 1.25rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.document-line.is-evidence {
  border-radius: 3px;
  background: rgba(104, 212, 255, 0.32);
  box-shadow: 0 0 0 2px rgba(104, 212, 255, 0.12);
}

.drop-hint {
  position: sticky;
  bottom: 0.8rem;
  display: block;
  width: fit-content;
  margin: 1.4rem auto 0;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(13, 26, 45, 0.95);
  color: var(--muted);
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.64rem;
}

.review-panel {
  background: var(--navy);
}

.review-summary {
  min-height: 84px;
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 1px solid var(--line);
  background: #06101f;
}

.confidence-summary,
.progress-summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1.2rem;
}

.confidence-summary {
  border-right: 1px solid var(--line);
}

.confidence-summary strong {
  margin-top: 0.15rem;
  color: var(--cyan);
  font-size: 1.55rem;
}

.progress-summary > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress-summary strong {
  color: var(--green);
  font-size: 0.66rem;
}

.progress-track {
  height: 4px;
  margin-top: 0.75rem;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-track > span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--green);
  transition: width 200ms ease;
}

#accept-all {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--cyan);
  padding: 0.25rem 0;
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 700;
}

#accept-all:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.field-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 0.85rem 1rem 1.2rem;
}

.field-card {
  margin-bottom: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.field-card:hover,
.field-card.is-active {
  border-color: rgba(104, 212, 255, 0.4);
  background: var(--panel-light);
}

.field-card.is-accepted {
  border-left: 3px solid var(--green);
}

.field-card.needs-attention:not(.is-accepted) {
  border-left: 3px solid var(--orange);
}

.field-meta,
.field-value-row,
.field-evidence {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field-meta label {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.confidence-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.52rem;
}

.confidence-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.confidence-tag.medium::before {
  background: var(--orange);
}

.field-value-row {
  margin-top: 0.35rem;
}

.field-value-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 0.3rem 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.field-value-row input:hover,
.field-value-row input:focus {
  border-bottom-color: rgba(104, 212, 255, 0.36);
  outline: 0;
}

.accept-field {
  min-width: 62px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--cyan-soft);
  color: var(--cyan);
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 700;
}

.field-card.is-accepted .accept-field {
  min-width: 30px;
  border-color: rgba(110, 231, 168, 0.45);
  background: rgba(110, 231, 168, 0.12);
  color: var(--green);
}

.field-evidence {
  justify-content: flex-start;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.52rem;
}

.field-evidence span {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-evidence q {
  overflow: hidden;
  font-family: "DM Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.empty-state strong {
  font-size: 1.1rem;
}

.empty-state p {
  max-width: 22rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.review-footer {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.private-note {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.private-note > span {
  width: 27px;
  height: 27px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(110, 231, 168, 0.12);
  color: var(--green);
  font-size: 0.68rem;
}

.private-note p {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.52rem;
}

.private-note strong {
  color: var(--text);
  font-size: 0.58rem;
}

.noscript {
  margin: 0;
  padding: 1rem;
  background: #5a2016;
  color: white;
  text-align: center;
}

@media (max-width: 980px) {
  .audit-workspace {
    height: auto;
    grid-template-columns: 1fr;
  }

  .source-panel {
    min-height: 690px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-panel {
    min-height: 740px;
  }
}

@media (max-width: 720px) {
  .product-name {
    display: none;
  }

  .privacy-badge {
    font-size: 0.54rem;
  }

  .document-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-identity strong {
    max-width: calc(100vw - 6rem);
  }

  .document-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .document-actions select {
    min-width: 0;
    flex: 1;
  }

  .notice-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice-bar > span {
    white-space: normal;
  }

  .document-stage {
    padding: 1rem;
  }

  .document-paper {
    width: 100%;
    min-height: 620px;
    padding: 2rem 1.5rem;
  }

  .review-summary {
    grid-template-columns: 110px 1fr;
  }

  .confidence-summary,
  .progress-summary {
    padding: 0.75rem;
  }

  .progress-summary > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .review-footer {
    align-items: stretch;
    flex-direction: column;
  }
}

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