:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #5f6b66;
  --line: #d8dfdc;
  --surface: #f7f9f8;
  --panel: #ffffff;
  --green: #167a5a;
  --green-dark: #0c5e45;
  --blue: #2e67b1;
  --amber: #b97817;
  --red: #b33437;
  --teal-soft: #e9f6f2;
  --blue-soft: #eaf1fb;
  --shadow: 0 18px 40px rgba(23, 32, 28, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f3f6f5 0%, #edf2f1 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.upload-panel,
.review-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.upload-panel {
  display: flex;
  min-height: calc(100vh - 48px);
  flex-direction: column;
  gap: 18px;
  padding: 22px;
}

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

.brand-row,
.toolbar,
.section-title,
.toolbar-actions,
.summary-strip {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.drop-zone {
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: 8px;
  padding: 24px;
  border: 1.5px dashed #9fb4ad;
  background: var(--teal-soft);
  text-align: center;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

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

.drop-zone span:last-child {
  max-width: 100%;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.drop-icon {
  width: 44px;
  height: 44px;
  color: var(--green-dark);
}

.primary-action,
.secondary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

.primary-action {
  width: 100%;
  background: var(--green);
  color: white;
}

.secondary-action {
  background: var(--blue);
  color: white;
}

.ghost-action {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.progress-stack {
  display: grid;
  gap: 8px;
}

.progress-label,
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e3e9e7;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 260ms ease;
}

.doc-visual {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 150px;
  margin-top: auto;
  padding: 18px;
  background: #f0f4f7;
  border: 1px solid var(--line);
}

.doc-sheet {
  display: grid;
  gap: 9px;
  width: 84px;
  height: 112px;
  padding: 16px 12px;
  background: white;
  border-top: 5px solid var(--blue);
  box-shadow: 0 10px 22px rgba(23, 32, 28, 0.08);
}

.doc-sheet div {
  height: 8px;
  background: #c8d6d1;
}

.route-lines {
  display: grid;
  gap: 14px;
}

.route-lines span {
  display: block;
  height: 10px;
  background: linear-gradient(90deg, var(--green) 0 38%, transparent 38% 46%, var(--blue) 46% 100%);
}

.route-lines span:nth-child(2) {
  width: 82%;
}

.route-lines span:nth-child(3) {
  width: 64%;
}

.summary-strip {
  justify-content: space-between;
  gap: 12px;
}

.summary-strip div {
  flex: 1;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric {
  display: block;
  color: var(--green-dark);
  font-size: 26px;
  font-weight: 850;
}

.summary-strip span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions {
  gap: 10px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
}

.result-list,
.cargo-form {
  min-width: 0;
}

.section-title {
  margin-bottom: 12px;
}

.section-title span {
  align-self: end;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  text-align: right;
}

.field-results {
  display: grid;
  gap: 8px;
}

.parse-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--blue-soft);
  border: 1px solid #c6d8ee;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
}

.parse-meta strong {
  color: var(--amber);
  font-weight: 750;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
}

.field-row.is-missing {
  border-left-color: var(--amber);
}

.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.field-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.confidence {
  display: inline-grid;
  min-width: 50px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.confidence.high {
  background: #dff3ea;
  color: var(--green-dark);
}

.confidence.medium {
  background: #fff2d8;
  color: var(--amber);
}

.confidence.low {
  background: #f9dedf;
  color: var(--red);
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  gap: 12px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  color: var(--blue);
}

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

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5d1;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

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

.just-filled {
  animation: fillPulse 900ms ease;
}

@keyframes fillPulse {
  0% {
    background: #dff3ea;
  }
  100% {
    background: white;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .workspace,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .upload-panel,
  .review-panel {
    min-height: auto;
  }

  .toolbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title span {
    text-align: left;
  }
}

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

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1;
  }
}
