:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #05070a;
  color: #edf7f4;
  --bg: #05070a;
  --panel: rgba(12, 17, 22, 0.94);
  --panel-strong: rgba(16, 24, 31, 0.98);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(202, 223, 219, 0.12);
  --line-strong: rgba(73, 231, 202, 0.42);
  --text: #edf7f4;
  --muted: #93a7a3;
  --faint: #63746f;
  --teal: #49e7ca;
  --green: #a7ef72;
  --amber: #ffc66d;
  --red: #ff747e;
  --blue: #75b8ff;
  --ink: #06100e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(73, 231, 202, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 184, 255, 0.028) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, rgba(117, 184, 255, 0.12), transparent 34%),
    var(--bg);
  background-size: 30px 30px, 30px 30px, auto, auto;
  color: var(--text);
}

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

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p {
  line-height: 1.55;
}

button,
input,
select,
.button-link {
  font: inherit;
}

button,
.button-link {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(73, 231, 202, 0.1);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  text-decoration: none;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

button:hover,
.button-link:hover {
  background: rgba(73, 231, 202, 0.16);
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(73, 231, 202, 0.08);
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

button.primary {
  width: 100%;
  min-height: 50px;
  border-color: rgba(73, 231, 202, 0.85);
  background: linear-gradient(135deg, rgba(73, 231, 202, 0.98), rgba(167, 239, 114, 0.88));
  box-shadow: 0 18px 48px rgba(73, 231, 202, 0.2);
  color: var(--ink);
  font-weight: 850;
}

button.ghost,
.button-link.ghost {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #c6d6d2;
}

button.danger:hover {
  border-color: rgba(255, 116, 126, 0.72);
  background: rgba(255, 116, 126, 0.14);
}

button.secondary-small,
.button-link.secondary-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

button.is-active {
  border-color: var(--teal);
  background: rgba(73, 231, 202, 0.22);
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(3, 7, 10, 0.72);
  color: var(--text);
  outline: none;
  padding: 9px 11px;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(73, 231, 202, 0.08);
}

summary {
  cursor: pointer;
}

.eyebrow {
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.review-cockpit {
  display: grid;
  grid-template-columns: minmax(242px, 282px) minmax(390px, 1.08fr) minmax(430px, 0.92fr);
  gap: 12px;
  height: 100dvh;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.cockpit-rail,
.work-surface,
.review-dock {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cockpit-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border-radius: 16px 8px 8px 16px;
  padding: 18px;
}

.work-surface {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border-radius: 8px;
  padding: 18px;
}

.review-dock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  border-radius: 8px 16px 16px 8px;
  padding: 12px;
}

.brand-block {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(73, 231, 202, 0.6);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(73, 231, 202, 0.2), rgba(117, 184, 255, 0.1)),
    rgba(255, 255, 255, 0.04);
  color: var(--teal);
  font-weight: 900;
}

.rail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mission-panel,
.rail-note,
.rail-tools,
.queue-panel,
.evidence-drawer,
.config-console,
.report-console,
.correction-drawer,
.auto-review-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.mission-panel,
.rail-note,
.rail-tools {
  padding: 14px;
}

.mission-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.flow-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: #dceae6;
  font-size: 14px;
}

.flow-list span {
  display: grid;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(167, 239, 114, 0.34);
  border-radius: 999px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.rail-note {
  border-left: 3px solid var(--amber);
}

.rail-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--amber);
}

.rail-note p,
.surface-head p,
.result-hint {
  color: var(--muted);
  font-size: 13px;
}

.rail-tools {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.rail-tools summary {
  color: #c6d6d2;
  font-weight: 800;
}

.rail-tools[open] summary {
  margin-bottom: 10px;
}

.surface-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.surface-head {
  min-height: 72px;
  padding: 2px 2px 0;
}

.surface-head h2 {
  margin-top: 3px;
  font-size: 26px;
}

.surface-head > p {
  max-width: 430px;
  text-align: right;
}

.intake-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.drop-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.primary-drop .drop-zone {
  min-height: 228px;
}

.evidence-drop .drop-zone {
  min-height: 132px;
}

.drop-zone {
  position: relative;
  display: grid;
  align-content: end;
  gap: 8px;
  border: 1.5px dashed rgba(73, 231, 202, 0.46);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(73, 231, 202, 0.13), rgba(117, 184, 255, 0.06) 52%, rgba(255, 198, 109, 0.06)),
    rgba(5, 12, 16, 0.88);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  padding: 18px;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.drop-zone::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.drop-zone.compact {
  min-height: 96px;
  padding: 16px;
}

.drop-zone:hover,
.drop-zone:focus-within,
.drop-zone.is-dragging {
  border-color: var(--teal);
  background:
    linear-gradient(135deg, rgba(73, 231, 202, 0.2), rgba(117, 184, 255, 0.09), rgba(255, 198, 109, 0.08)),
    rgba(3, 10, 14, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(73, 231, 202, 0.2),
    0 18px 52px rgba(73, 231, 202, 0.11);
}

.drop-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  position: relative;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}

.drop-zone.compact .drop-title {
  font-size: 17px;
}

.drop-meta {
  position: relative;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-line {
  min-height: 22px;
  color: var(--amber);
  font-size: 14px;
  line-height: 1.45;
}

.queue-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.compact-head {
  margin-bottom: 10px;
}

.doc-list,
.finding-list,
.rule-list,
.batch-plan,
.batch-list {
  display: grid;
  gap: 10px;
}

.compact-list,
.rule-list,
.batch-list {
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.doc-item,
.batch-item,
.rule-item,
.finding {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.doc-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.doc-item input[type="checkbox"] {
  width: auto;
  min-height: auto;
  margin-top: 4px;
  accent-color: var(--teal);
}

.doc-actions {
  display: block;
  margin-top: 8px;
}

.advanced-doc-actions {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
}

.advanced-doc-actions summary {
  min-height: 30px;
  padding: 4px 8px;
}

.advanced-doc-actions div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 6px;
}

.doc-name,
.rule-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.doc-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cad-summary {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(117, 184, 255, 0.24);
  border-radius: 8px;
  background: rgba(117, 184, 255, 0.06);
  color: #d2ebff;
  font-size: 12px;
  line-height: 1.35;
}

.cad-hints {
  color: var(--amber);
}

.batch-title {
  color: var(--green);
  font-weight: 850;
}

.batch-item,
.rule-item {
  padding: 11px;
}

.evidence-drawer {
  overflow: hidden;
}

.evidence-drawer summary,
.trace-drawer summary {
  padding: 14px;
  color: #c6d6d2;
  font-weight: 850;
}

.evidence-drawer[open] summary,
.trace-drawer[open] summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.local-library {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 74px 64px 64px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.upload-label {
  color: #c1d1cd;
  font-size: 13px;
  font-weight: 800;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.config-console {
  display: grid;
  gap: 12px;
  flex: 0 0 auto;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(73, 231, 202, 0.08), transparent 36%),
    var(--panel-strong);
}

.auto-review-panel {
  display: grid;
  gap: 10px;
  border-color: rgba(73, 231, 202, 0.22);
  background:
    linear-gradient(135deg, rgba(73, 231, 202, 0.1), rgba(117, 184, 255, 0.045)),
    rgba(255, 255, 255, 0.035);
  padding: 13px;
}

.auto-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin: 0 5px 6px 0;
  border: 1px solid rgba(73, 231, 202, 0.32);
  border-radius: 999px;
  background: rgba(73, 231, 202, 0.09);
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  padding: 3px 9px;
}

.auto-summary {
  color: #d6e9e4;
  font-size: 13px;
}

.review-mode-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.review-mode-row label {
  color: #c1d1cd;
  font-size: 13px;
  font-weight: 850;
}

.correction-drawer {
  overflow: hidden;
}

.correction-drawer summary {
  color: #c6d6d2;
  font-weight: 850;
  padding: 12px;
}

.correction-drawer[open] {
  padding-bottom: 12px;
}

.correction-drawer[open] summary {
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.correction-drawer .field,
.correction-drawer .field-row {
  margin: 0 12px 10px;
}

.compact-tone {
  max-width: 220px;
}

.report-console {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.report-console[hidden] {
  display: none;
}

#findingCount {
  min-width: 62px;
  border: 1px solid rgba(167, 239, 114, 0.34);
  border-radius: 999px;
  background: rgba(167, 239, 114, 0.1);
  color: var(--green);
  font-weight: 850;
  padding: 6px 10px;
  text-align: center;
}

#findingCount:empty {
  display: none;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.result-actions[hidden],
.trace-drawer[hidden] {
  display: none;
}

.output {
  min-height: 150px;
  max-height: 42vh;
  overflow: auto;
  border: 1px solid rgba(73, 231, 202, 0.16);
  border-radius: 10px;
  background: #03070a;
  box-shadow: inset 0 0 36px rgba(73, 231, 202, 0.035);
  color: #e4fff8;
  line-height: 1.56;
  padding: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}

.output[hidden] {
  display: none;
}

.finding-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.finding {
  padding: 12px;
}

.finding-title {
  margin-bottom: 8px;
  color: var(--green);
  font-weight: 850;
}

.citation {
  margin-top: 8px;
  border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0;
  background: rgba(73, 231, 202, 0.07);
  color: #d0e5e0;
  padding: 10px;
  overflow-wrap: anywhere;
}

.trace-drawer {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.trace-output {
  max-height: 260px;
  margin: 12px;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 20px;
}

.topbar h1 {
  font-size: 30px;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.progress-layout {
  display: grid;
  gap: 16px;
}

.progress-hero {
  display: grid;
  gap: 14px;
}

.progress-bar {
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 220ms ease;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 6px;
  color: var(--teal);
  font-size: 24px;
  font-weight: 850;
  line-height: 1.1;
}

.progress-detail {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

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

.detail-value {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: rgba(73, 231, 202, 0.1);
  color: var(--teal);
  font-weight: 850;
  padding: 4px 10px;
}

.badge.is-completed {
  background: rgba(167, 239, 114, 0.12);
  color: var(--green);
}

.badge.is-error {
  background: rgba(255, 116, 126, 0.12);
  color: var(--red);
}

@media (max-width: 1260px) {
  .review-cockpit {
    grid-template-columns: 230px minmax(370px, 1fr) minmax(380px, 0.92fr);
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .review-cockpit {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .cockpit-rail,
  .work-surface,
  .review-dock {
    overflow: visible;
    border-radius: 14px;
  }

  .review-dock {
    display: grid;
  }

  .report-console {
    min-height: 460px;
  }

  .surface-head > p {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .review-cockpit,
  .app-shell {
    width: auto;
    padding: 10px;
  }

  .surface-head,
  .section-head,
  .topbar {
    flex-direction: column;
  }

  .intake-board,
  .evidence-grid,
  .field-row,
  .local-library,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .primary-drop .drop-zone,
  .evidence-drop .drop-zone {
    min-height: 138px;
  }

  .result-actions,
  .topbar-actions {
    width: 100%;
  }

  .result-actions button,
  .topbar-actions button,
  .topbar-actions .button-link {
    flex: 1;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
