:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  color: #202124;
  background: #f5f6f7;
  letter-spacing: 0;
  --ink: #202124;
  --muted: #687078;
  --line: #d8dcdf;
  --line-strong: #bcc2c7;
  --surface: #ffffff;
  --surface-soft: #f7f8f8;
  --brand: #b42318;
  --brand-dark: #8f1b13;
  --review: #b54708;
  --review-bg: #fff4e5;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #26734d;
  --success-bg: #ecfdf3;
  --focus: #2563eb;
  --shadow: 0 8px 24px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  padding: 10px;
  background: #eef0f1;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
tr:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.app-shell {
  height: calc(100vh - 20px);
  min-height: 500px;
  display: grid;
  grid-template-rows: 84px 104px minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(32, 33, 36, 0.06);
}

.topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-block,
.topbar-actions,
.brand-block > div,
.summary-context,
.detail-title-row,
.status-line,
.match-meta,
.section-heading,
.evidence-row,
.candidate-row,
.pagination,
.page-buttons,
.detail-actions {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  font-size: 15px;
}

.brand-copy {
  min-width: 0;
  gap: 16px;
}

.brand-block h1 {
  margin: 0;
  font-size: 30px;
  line-height: 38px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-divider {
  width: 1px;
  height: 28px;
  flex: 0 0 auto;
  background: var(--line-strong);
}

.brand-block p {
  max-width: 34vw;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  position: relative;
  gap: 8px;
  flex: 0 0 auto;
}

.topbar-actions .primary-button,
.topbar-actions .secondary-button {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

.export-control {
  position: relative;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  width: 214px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.export-option {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.export-option > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.export-option svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.export-option strong {
  color: var(--muted);
  font-size: 12px;
}

.export-option:hover:not(:disabled) {
  background: var(--surface-soft);
}

.export-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.page-button,
.close-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 600;
}

.primary-button {
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.primary-button:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.secondary-button {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.text-button:hover:not(:disabled),
.page-button:hover:not(:disabled),
.close-button:hover:not(:disabled) {
  background: #eef0f1;
}

.icon-button,
.close-button {
  width: 36px;
  padding: 0;
  color: #4b535a;
  background: var(--surface);
  border-color: var(--line-strong);
}

.file-field {
  min-width: 0;
  min-height: 82px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.file-field:hover {
  border-color: #d7bbb8;
  background: #fffafa;
}

.file-step {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--brand);
  background: var(--danger-bg);
  font-size: 16px;
  font-weight: 700;
}

.file-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.file-copy strong,
.file-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.file-copy small {
  color: var(--muted);
  font-size: 12px;
}

.file-field input {
  width: 92px;
  min-width: 0;
  font-size: 0;
  color: transparent;
}

.file-field input::file-selector-button {
  width: 92px;
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.summary-band {
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.summary-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 10px 18px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-left: 3px solid #8a9298;
  text-align: left;
}

.summary-item + .summary-item {
  margin-left: 8px;
}

.summary-item span {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.summary-item strong {
  font-size: 30px;
  font-weight: 700;
}

.summary-item.review {
  border-left-color: var(--review);
}

.summary-item.unmatched {
  border-left-color: var(--danger);
}

.summary-item.pass {
  border-left-color: var(--success);
}

.summary-item.excluded {
  border-left-color: #667085;
}

.summary-item.is-active {
  background: #f1f3f4;
}

.summary-context {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

.workspace {
  grid-row: 3;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(660px, 1fr) minmax(350px, 410px);
}

.list-pane,
.right-rail,
.detail-pane {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.list-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 48px;
}

.results-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
}

.results-heading h2,
.upload-panel-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
}

.results-heading p,
.upload-panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.results-heading > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.right-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  background: #fafafa;
}

.upload-panel {
  padding: 18px 18px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}

.upload-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.offline-badge {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 0 9px;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid #badbc8;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.offline-badge svg {
  width: 14px;
  height: 14px;
}

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

.detail-pane {
  position: relative;
  overflow-y: auto;
  background: #fafafa;
}

.toolbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 182px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: #f3f4f4;
  border: 1px solid transparent;
  border-radius: 6px;
}

.search-field:focus-within {
  background: #fff;
  border-color: var(--focus);
}

.search-field svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.select-field {
  height: 38px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  padding-left: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.select-field span {
  color: var(--muted);
  font-size: 11px;
}

.select-field select {
  min-width: 0;
  height: 36px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.result-count {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.table-wrap {
  position: relative;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 790px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f3f4;
}

th {
  height: 38px;
  padding: 0 12px;
  color: #525a61;
  border-bottom: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

th:nth-child(2) { width: 24%; }
th:nth-child(3) { width: 18%; }
th:nth-child(4) { width: 20%; }
th:nth-child(6) { width: 22%; }
.status-col { width: 82px; }
.number-col { width: 54px; text-align: right; }
.chevron-col { width: 34px; }

tbody tr {
  cursor: pointer;
  background: #fff;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #f7f8f8;
}

tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}

td {
  height: 62px;
  padding: 8px 12px;
  border-bottom: 1px solid #e7e9eb;
  vertical-align: middle;
}

td.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-primary,
.cell-secondary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-primary {
  font-weight: 600;
}

.cell-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.status-badge,
.issue-tag,
.source-badge,
.check-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}

.status-badge {
  min-width: 56px;
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.status-badge.review {
  color: var(--review);
  background: var(--review-bg);
}

.status-badge.unmatched {
  color: var(--danger);
  background: var(--danger-bg);
}

.status-badge.pass {
  color: var(--success);
  background: var(--success-bg);
}

.status-badge.excluded {
  color: #475467;
  background: #f2f4f7;
}

.issue-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 42px;
  overflow: hidden;
}

.issue-tag {
  min-height: 20px;
  padding: 2px 7px;
  color: #6a3506;
  background: #fff4e5;
  border: 1px solid #f0cda6;
  font-size: 10px;
}

.issue-tag.more {
  color: var(--muted);
  background: #f1f3f4;
  border-color: #d8dcdf;
}

.empty-state,
.detail-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
}

.empty-state {
  position: absolute;
  inset: 38px 0 0;
  background: #fff;
}

.empty-state svg,
.detail-empty svg {
  width: 28px;
  height: 28px;
  color: #8a9298;
}

.pagination {
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.page-buttons {
  gap: 4px;
}

.page-button,
.text-button {
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  color: #4b535a;
  background: transparent;
  border-color: transparent;
}

.page-button.is-active {
  color: #fff;
  background: #4b535a;
}

.detail-empty {
  min-height: 100%;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 18px 14px;
  background: rgba(250, 250, 250, 0.96);
  border-bottom: 1px solid var(--line);
}

.detail-title-row {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.detail-title-row h2 {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.detail-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.status-line {
  margin-top: 8px;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.meta-item {
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.meta-item:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.meta-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.meta-item span,
.evidence-label,
.section-heading span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.meta-item strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.detail-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h3 {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
}

.match-block {
  padding: 11px;
  background: #fff;
  border: 1px solid var(--line);
}

.match-block + .match-block {
  margin-top: 8px;
}

.match-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.match-meta {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.source-badge {
  min-height: 20px;
  padding: 2px 7px;
  color: #344054;
  background: #eef0f1;
  font-size: 10px;
}

.match-text {
  margin: 9px 0 0;
  color: #384047;
  font-size: 12px;
  line-height: 19px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.check-list,
.child-list,
.candidate-list {
  display: grid;
  gap: 7px;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 3px;
}

.check-row.fail,
.check-row.manual {
  border-left-color: var(--review);
}

.check-row.pass {
  border-left-color: var(--success);
}

.check-state {
  width: 23px;
  height: 23px;
  color: #fff;
}

.check-state.fail,
.check-state.manual {
  background: var(--review);
}

.check-state.pass {
  background: var(--success);
}

.check-state svg {
  width: 14px;
  height: 14px;
}

.check-content {
  min-width: 0;
}

.check-content strong {
  display: block;
  font-size: 12px;
}

.check-content dl {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 4px 7px;
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 17px;
}

.check-content dt {
  color: var(--muted);
}

.check-content dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.child-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.child-row:first-child {
  border-top: 1px solid var(--line);
}

.child-row span:first-child {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.child-name {
  min-width: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.child-quantity {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.candidate-row {
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.candidate-row:last-child {
  border-bottom: 0;
}

.candidate-main {
  min-width: 0;
}

.candidate-main strong,
.candidate-main span {
  display: block;
  overflow-wrap: anywhere;
}

.candidate-main strong {
  font-size: 11px;
}

.candidate-main span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.candidate-score {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(245, 246, 247, 0.78);
  backdrop-filter: blur(2px);
}

.loading-panel {
  width: min(380px, calc(100vw - 32px));
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-panel > .spinner { order: 1; }
.loading-panel > #loadingTitle { order: 2; }
.loading-panel > #loadingMessage { order: 3; }
.loading-panel > .progress-track { order: 4; }
.loading-panel > .progress-line { order: 5; }
.loading-panel > .progress-stats { order: 6; }

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
  border-radius: 999px;
  background: #e8eaed;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.18s ease-out;
}

.progress-line,
.progress-stats {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.progress-line strong {
  color: var(--brand);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.progress-stats {
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
}

.progress-stats span {
  white-space: nowrap;
}

.progress-stats strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.loading-panel span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e0e3e5;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 11px 14px;
  color: #fff;
  background: #343a40;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 1180px) {
  .topbar {
    gap: 14px;
    padding-inline: 20px;
  }

  .brand-copy {
    gap: 12px;
  }

  .brand-block p {
    max-width: 21vw;
  }

  .workspace {
    grid-template-columns: minmax(620px, 1fr) 360px;
  }

  .summary-band {
    grid-template-columns: repeat(5, minmax(96px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    padding: 0;
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr);
    border: 0;
    border-radius: 0;
  }

  .topbar {
    min-height: 64px;
    padding: 9px 12px;
  }

  .brand-block p {
    max-width: 28vw;
  }

  .topbar-actions .secondary-button span,
  .topbar-actions .primary-button span {
    display: none;
  }

  .topbar-actions .secondary-button,
  .topbar-actions .primary-button {
    width: 36px;
    padding: 0;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px 12px;
  }

  .summary-item {
    min-height: 50px;
    padding: 6px 9px;
  }

  .summary-item + .summary-item {
    margin-left: 0;
  }

  .summary-item strong {
    font-size: 19px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .list-pane {
    min-height: calc(100vh - 190px);
    grid-template-rows: auto auto minmax(480px, 1fr) 48px;
  }

  .right-rail {
    order: -1;
    display: block;
    overflow: visible;
    border-left: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .upload-panel {
    padding: 14px 12px;
  }

  .file-list {
    grid-template-columns: 1fr 1fr;
  }

  .summary-context {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 160px;
    padding: 9px 12px;
  }

  .result-count {
    grid-column: 1 / -1;
  }

  .detail-pane {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: none;
    border-left: 0;
  }

  .detail-pane.is-open {
    display: block;
  }

  .detail-empty {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    display: none;
  }

  .brand-block h1 {
    font-size: 22px;
    line-height: 28px;
  }

  .brand-divider,
  .brand-block p {
    display: none;
  }

  .file-list {
    grid-template-columns: 1fr;
  }

  .file-field {
    grid-template-columns: 38px minmax(0, 1fr) 82px;
    padding: 10px;
  }

  .file-field input,
  .file-field input::file-selector-button {
    width: 82px;
  }

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .select-field,
  .result-count {
    grid-column: 1;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .pagination > span {
    display: none;
  }

  .page-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* Unified desktop scale: matches the production instruction converter. */
@media (min-width: 761px) {
  body {
    padding: 0;
    background: var(--bg);
    font-size: 14px;
  }

  .app-shell {
    width: calc(100% - 24px);
    height: calc(100vh - 24px);
    min-height: calc(100vh - 24px);
    margin: 12px auto;
    grid-template-rows: 86px 104px minmax(0, 1fr);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(17, 24, 32, 0.04);
  }

  .topbar {
    min-height: 86px;
    gap: 24px;
    padding: 16px 28px;
  }

  .brand-block {
    gap: 14px;
  }

  .brand-mark {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 8px;
    font-size: 15px;
  }

  .brand-copy {
    gap: 10px;
  }

  .brand-block h1 {
    font-size: 22px;
    line-height: 1.25;
    font-weight: 750;
  }

  .brand-divider {
    height: 18px;
  }

  .brand-block p {
    font-size: 13px;
  }

  .topbar-actions {
    gap: 10px;
  }

  .topbar-actions .primary-button,
  .topbar-actions .secondary-button {
    min-width: 96px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
  }

  .summary-band {
    min-height: 104px;
    padding: 12px 28px;
  }

  .summary-item {
    min-height: 76px;
    padding: 10px 18px;
  }

  .summary-item span {
    font-size: 14px;
  }

  .summary-item strong {
    font-size: 30px;
  }

  .workspace {
    grid-template-columns: minmax(0, 2.15fr) minmax(340px, 0.85fr);
  }

  .results-heading {
    min-height: 58px;
    gap: 16px;
    padding: 8px 20px;
  }

  .results-heading h2,
  .upload-panel-heading h2 {
    font-size: 16px;
    line-height: 1.35;
    font-weight: 750;
  }

  .results-heading p,
  .upload-panel-heading p {
    font-size: 12px;
  }

  .upload-panel {
    padding: 12px 20px 16px;
  }

  .upload-panel-heading {
    margin-bottom: 12px;
  }

  .file-field {
    min-height: 64px;
    grid-template-columns: 36px minmax(0, 1fr) 88px;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .file-step {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .file-field input,
  .file-field input::file-selector-button {
    width: 88px;
  }
}

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