.upstream-import-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
}
.upstream-import-dialog::backdrop { background: rgba(18, 31, 43, .48); }
.upstream-import-shell { max-height: calc(100vh - 28px); overflow: auto; background: #fff; }
.upstream-import-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e7ec;
  background: #fff;
}
.upstream-import-heading small { display: block; margin-bottom: 3px; color: #718096; font-size: 11px; }
.upstream-import-heading h2 { font-size: 18px; }
.upstream-step { padding: 18px 20px 22px; }
.upstream-upload-grid {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(360px, 1.2fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}
.upstream-source-card {
  padding: 14px;
  border: 1px solid #d8e0e7;
  background: #f8fafc;
}
.upstream-file-label input[type="file"] { height: auto; padding: 9px; }
.upstream-sample-link { display: inline-flex; align-items: center; margin-top: 12px; padding: 9px 12px; border: 1px solid #9db0c0; border-radius: 5px; background: #fff; color: #17405e; font-size: 13px; font-weight: 600; text-decoration: none; }
.upstream-sample-link:hover { background: #eef4f8; }
.upstream-preview {
  min-height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d8e0e7;
  background: #eef2f5;
  color: #718096;
  font-size: 12px;
}
.upstream-preview img {
  max-width: 88%;
  max-height: 240px;
  object-fit: contain;
  transition: transform .2s ease;
}
.upstream-step h3 { margin: 0 0 10px; font-size: 14px; color: #21384b; }
.upstream-default-grid,
.upstream-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.upstream-default-grid label,
.upstream-row-grid label { margin: 0; }
.upstream-default-grid .span-2,
.upstream-row-grid .span-2 { grid-column: span 2; }
.upstream-info {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #5f7890;
  background: #f7f9fb;
  color: #5f6f7d;
  font-size: 12px;
  line-height: 1.55;
}
.upstream-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.upstream-review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.upstream-review-bar strong { display: block; color: #22394c; font-size: 14px; }
.upstream-review-bar small { display: block; margin-top: 3px; color: #718096; font-size: 11px; }
.upstream-review-rows { display: grid; gap: 10px; }
.upstream-row {
  padding: 13px;
  border: 1px solid #d8e0e7;
  border-radius: 8px;
  background: #fff;
}
.upstream-row.is-duplicate { background: #f7f7f7; opacity: .72; }
.upstream-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.upstream-row-head strong { font-size: 12px; color: #34495a; }
.upstream-check {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 5px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}
.upstream-check input { width: auto; height: auto; margin: 0; }
.upstream-quality {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid #c9d3dc;
  font-size: 10px;
  color: #5d6b77;
}
.upstream-quality.good { border-color: #b6d8c2; background: #edf7f1; color: #2d6d46; }
.upstream-quality.warn { border-color: #dec78f; background: #fff8e8; color: #7a5200; }

@media (max-width: 700px) {
  .upstream-import-dialog { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .upstream-import-shell { max-height: 100vh; }
  .upstream-import-heading { padding: 13px 15px; }
  .upstream-step { padding: 15px; }
  .upstream-upload-grid { grid-template-columns: 1fr; gap: 10px; }
  .upstream-preview { min-height: 190px; }
  .upstream-preview img { max-height: 185px; }
  .upstream-default-grid,
  .upstream-row-grid { grid-template-columns: 1fr; }
  .upstream-default-grid .span-2,
  .upstream-row-grid .span-2 { grid-column: auto; }
  .upstream-review-bar { align-items: flex-start; }
  .upstream-footer { display: grid; grid-template-columns: 1fr 1fr; }
  .upstream-footer button { width: 100%; }
}
