:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #17202a;
  --muted: #64748b;
  --line: #d8dee7;
  --primary: #116466;
  --primary-2: #0b4f50;
  --accent: #c97b19;
  --ok: #16794c;
  --bad: #b42318;
  --manual: #fff4b8;
  --auto: #dceeff;
  --bag: #ffd9d5;
  --film: #e7dcff;
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
}

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

button.primary:hover {
  background: var(--primary-2);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
  white-space: nowrap;
}

.role-switcher {
  display: grid;
  grid-template-columns: 72px 160px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: block;
  min-height: calc(100vh - 70px);
}

.top-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-bottom: 0;
  text-align: center;
  white-space: nowrap;
}

.nav-button.active {
  border-color: var(--primary);
  background: #e6f2f2;
  color: var(--primary-2);
}

.main {
  padding: 20px 28px;
  overflow: auto;
}

.mobile-workspace {
  min-height: 100vh;
}

.mobile-workspace .main {
  padding: 12px;
}

.mobile-workspace .view-header {
  margin-bottom: 10px;
}

.mobile-workspace .view-header h2 {
  font-size: 20px;
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.view-header h2 {
  margin: 0;
  font-size: 22px;
}

.view-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 700;
}

.panel-body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.order-info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
}

.order-info-grid .field {
  flex: 0 0 auto;
  min-width: 0;
}

.order-info-grid .field input {
  min-width: 0;
}

.order-field-sm {
  width: 134px;
}

.order-field-customer {
  width: 360px;
}

.order-field-code {
  width: 150px;
}

.order-field-product {
  width: 620px;
}

.order-field-material {
  width: 280px;
}

.order-field-spec {
  width: 260px;
}

.order-field-qty {
  width: 164px;
}

.order-field-bag {
  width: 190px;
}

.order-field-basis {
  width: 620px;
  max-width: 100%;
}

.order-field-basis select {
  width: 100%;
}

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

.field.manual input,
.field.manual select,
.field.manual textarea {
  background: var(--manual);
}

.field.auto input,
.field.auto textarea {
  background: var(--auto);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.bag {
  background: var(--bag);
  color: #8a2a22;
}

.badge.film {
  background: var(--film);
  color: #55379a;
}

.badge.ok {
  background: #dcf7e9;
  color: var(--ok);
}

.badge.warn {
  background: #fff2d5;
  color: #8a4b00;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

button.review-button {
  border-color: #247a4a;
  background: #247a4a;
  color: #fff;
}

button.review-button:hover {
  background: #1c623b;
}

.workflow-actions {
  position: sticky;
  z-index: 8;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08);
}

.workflow-current {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.workflow-current > span,
.workflow-current small {
  color: var(--muted);
}

.record-status {
  display: inline-flex;
  min-width: 68px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.record-status.draft {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #475569;
}

.record-status.editing {
  border-color: #8ab8db;
  background: #e3f2fc;
  color: #175d8e;
}

.record-status.pending {
  border-color: #e2c15a;
  background: #fff2bd;
  color: #705300;
}

.record-status.approved {
  border-color: #83c99a;
  background: #dcf5e3;
  color: #176534;
}

.review-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.review-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.review-dialog-head,
.review-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
}

.review-dialog-head {
  border-bottom: 1px solid var(--line);
}

.review-dialog-head button {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
}

.review-dialog-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.review-dialog-body textarea {
  width: 100%;
  resize: vertical;
}

.review-dialog-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.review-dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #344054;
  font-weight: 700;
}

td input,
td select {
  min-width: 92px;
}

.section-scope-bag td[data-scope="input"],
.section-scope-bag input,
.section-scope-bag select {
  background: var(--bag);
}

.section-scope-film td[data-scope="input"],
.section-scope-film input,
.section-scope-film select {
  background: var(--film);
}

.section-scope-all td[data-scope="input"],
.section-scope-all input,
.section-scope-all select {
  background: var(--manual);
}

.section-scope-bag td[data-scope="input"],
.section-scope-film td[data-scope="input"],
.section-scope-all td[data-scope="input"] {
  background: transparent;
}

.dimension-compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.dimension-compact-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.dimension-compact-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: start;
}

.dimension-compact-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-compact-head select {
  width: 108px;
  min-width: 0;
  height: 32px;
  padding: 4px 6px;
}

.dimension-compact-standard {
  min-height: 28px;
  margin: 7px 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.dimension-compact-card input {
  width: 132px;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
}

.physical-table {
  min-width: 820px;
}

.physical-table th,
.physical-table td {
  text-align: center;
  vertical-align: middle;
}

.physical-table .physical-merged-cell {
  vertical-align: middle;
}

.physical-solvent-table {
  margin-top: 12px;
  min-width: 0;
  table-layout: fixed;
}

.physical-solvent-table td input,
.physical-solvent-table td select {
  width: 108px;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
}

.physical-solvent-table td,
.physical-solvent-table th {
  text-align: center;
  vertical-align: middle;
}

.physical-table .physical-direction {
  width: 70px;
  font-weight: 700;
}

.physical-table td input,
.physical-table td select {
  width: 108px;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
}

.judge-cell {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.auto-judge-note {
  display: block;
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.auto-judge-note:not(:empty) {
  color: var(--primary-2);
}

select[data-auto-judge-select][data-judgement-state="pass"][data-judge-target-id] {
  border-color: #86c89a;
  background: #dcf5e3;
  color: #176534;
}

select[data-auto-judge-select][data-judgement-state="fail"][data-judge-target-id] {
  border-color: #e99a9a;
  background: #fde2e2;
  color: #8b2020;
}

select[data-auto-judge-select][data-judgement-state="pending"][data-judge-target-id] {
  border-color: #e4c467;
  background: #fff2bd;
  color: #6c5000;
}

select[data-auto-judge-select][data-judgement-state="na"][data-judge-target-id] {
  border-color: #cbd5e1;
  background: #eef2f6;
  color: #526170;
}

.physical-value-list {
  display: grid;
  gap: 6px;
  align-items: center;
}

.physical-value-list.count-1 {
  grid-template-columns: 108px;
  justify-content: center;
}

.physical-value-list.count-3 {
  grid-template-columns: repeat(3, 108px);
  justify-content: center;
}

.physical-value-list.count-5 {
  grid-template-columns: repeat(5, 108px);
  justify-content: center;
}

.physical-value-list input {
  min-width: 0;
}

.zip-mode-select {
  display: block;
  width: 96px;
  min-width: 0;
  height: 30px;
  margin: 6px auto 0;
  padding: 3px 6px;
  font-size: 13px;
}

.physical-average-output {
  width: 108px;
}

.physical-compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.physical-remark {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.physical-remark > span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.physical-remark textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  background: var(--manual);
}

.physical-compact-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.physical-compact-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.physical-compact-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.physical-compact-head select {
  width: 108px;
  min-width: 0;
  height: 32px;
  padding: 4px 6px;
}

.physical-compact-standard {
  min-height: 34px;
  padding: 7px 10px;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
  background: #fff;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}

.physical-compact-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  padding: 8px 10px 10px;
}

.physical-compact-row {
  display: grid;
  grid-template-columns: 42px 108px;
  gap: 6px;
  align-items: center;
}

.physical-compact-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.physical-compact-row input {
  width: 108px;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
}

.physical-judgement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px 14px;
  margin-top: 14px;
}

.physical-judgement-card {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.2fr) 110px minmax(150px, 1.3fr);
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.physical-judgement-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.physical-judgement-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.physical-judgement-card select,
.physical-judgement-card input {
  min-width: 0;
  height: 38px;
}

.physical-judgement-card.scope-all select,
.physical-judgement-card.scope-all input,
.physical-judgement-card.scope-all {
  background: var(--manual);
}

.physical-judgement-card.scope-bag select,
.physical-judgement-card.scope-bag input,
.physical-judgement-card.scope-bag {
  background: var(--bag);
}

.physical-judgement-card.scope-film select,
.physical-judgement-card.scope-film input,
.physical-judgement-card.scope-film {
  background: var(--film);
}

.notice {
  border: 1px solid #f1d293;
  border-radius: var(--radius);
  background: #fff8e6;
  color: #6b4700;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.empty {
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stepper button {
  flex: 1 1 72px;
  min-width: 0;
}

.mobile-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 14px;
  overflow: hidden;
}

.mobile-section h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 16px;
}

.mobile-item-list {
  display: grid;
}

.mobile-item-card {
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.mobile-item-card:last-child {
  border-bottom: 0;
}

.mobile-spec-grid {
  display: grid;
  gap: 6px;
  align-items: start;
}

.mobile-spec-head,
.mobile-standard-line,
.mobile-measure-grid label,
.mobile-input-line {
  min-width: 0;
}

.mobile-spec-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.mobile-spec-label,
.mobile-standard-line span,
.mobile-judgement-inline span,
.mobile-measure-grid span,
.mobile-input-line span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-spec-name {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-judgement-inline {
  display: grid;
  grid-template-columns: auto 62px;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.mobile-judgement-inline select {
  height: 28px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.mobile-standard-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  align-items: start;
}

.mobile-standard-line strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.mobile-judgement-remark {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}

.mobile-judgement-remark span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-judgement-remark input {
  min-width: 0;
  height: 34px;
}

.mobile-input-line {
  display: block;
  margin-top: 10px;
}

.mobile-input-line span {
  display: block;
  margin-bottom: 4px;
}

.mobile-measure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mobile-item-card.scope-all input,
.mobile-item-card.scope-all select {
  background: var(--manual);
}

.mobile-item-card.scope-bag input,
.mobile-item-card.scope-bag select {
  background: var(--bag);
}

.mobile-item-card.scope-film input,
.mobile-item-card.scope-film select {
  background: var(--film);
}

.mobile-item-card input,
.mobile-item-card select {
  min-width: 0;
  height: 42px;
}

.mobile-item-card .mobile-judgement-inline select {
  height: 28px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.mobile-physical-list {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.mobile-physical-group {
  overflow: hidden;
  border: 1px solid #1f2937;
  border-radius: 2px;
  background: #fff;
}

.mobile-physical-summary {
  display: grid;
  gap: 6px;
  padding: 8px 6px;
  border-bottom: 1px solid #1f2937;
}

.mobile-physical-measure-table {
  display: grid;
}

.mobile-physical-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  border-bottom: 1px solid #1f2937;
}

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

.mobile-physical-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mobile-physical-inputs.count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-physical-cell {
  min-width: 0;
  min-height: 68px;
  border-right: 1px solid #1f2937;
  border-bottom: 0;
  padding: 4px;
  font-size: 13px;
  line-height: 1.2;
  display: grid;
  align-content: center;
  color: #111827;
  word-break: break-word;
}

.mobile-physical-direction {
  display: grid;
  align-items: center;
  justify-items: center;
  min-width: 0;
  min-height: 68px;
  border-right: 1px solid #1f2937;
  padding: 4px;
  background: var(--manual);
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

.mobile-physical-inputs .mobile-physical-cell:nth-child(3n),
.mobile-physical-inputs.count-1 .mobile-physical-cell {
  border-right: 0;
}

.mobile-physical-inputs .mobile-physical-cell:nth-child(n + 4) {
  border-top: 1px solid #1f2937;
}

.mobile-physical-cell.head {
  justify-items: center;
  text-align: center;
  font-weight: 700;
  background: #fff;
}

.mobile-physical-cell.value {
  font-weight: 700;
  background: #fff;
}

.mobile-physical-cell.measure {
  gap: 3px;
  background: var(--manual);
}

.mobile-physical-cell.measure span {
  display: block;
  color: #111827;
  font-size: 12px;
  text-align: center;
}

.mobile-physical-cell input,
.mobile-physical-cell select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 3px 4px;
  border-radius: 3px;
  font-size: 13px;
}

.mobile-physical-cell input[readonly] {
  color: #111827;
  font-weight: 700;
}

.mobile-solvent-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-top: 1px solid #1f2937;
  background: var(--manual);
}

.mobile-solvent-row label {
  min-width: 0;
}

.mobile-solvent-row span {
  display: block;
  margin-bottom: 4px;
  color: #111827;
  font-size: 12px;
  text-align: center;
}

.mobile-solvent-row input,
.mobile-solvent-row select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 3px 4px;
  border-radius: 3px;
  font-size: 13px;
}

.mobile-physical-cell.select-cell {
  background: var(--manual);
}

.mobile-physical-group.scope-bag .mobile-physical-cell.measure,
.mobile-physical-group.scope-bag .mobile-physical-direction,
.mobile-physical-group.scope-bag .mobile-physical-cell.select-cell,
.mobile-physical-group.scope-bag input,
.mobile-physical-group.scope-bag select {
  background: var(--bag);
}

.mobile-physical-group.scope-film .mobile-physical-cell.measure,
.mobile-physical-group.scope-film .mobile-physical-direction,
.mobile-physical-group.scope-film .mobile-physical-cell.select-cell,
.mobile-physical-group.scope-film input,
.mobile-physical-group.scope-film select {
  background: var(--film);
}

.mobile-physical-summary .mobile-judgement-inline select {
  height: 28px;
  background: transparent;
  padding: 2px 4px;
}

.record-grid {
  display: grid;
  gap: 10px;
}

.record-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.record-search-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 150px auto 150px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.record-search-count {
  align-self: center;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.record-search-count strong {
  color: var(--text);
}

.ledger-panel {
  display: grid;
  gap: 10px;
}

.ledger-filters {
  display: grid;
  grid-template-columns: 150px 150px 140px auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.ledger-summary {
  color: var(--muted);
  font-size: 13px;
}

.ledger-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
  border: 1px solid #9fb8aa;
  background: #fff;
}

.ledger-table {
  min-width: 2800px;
  border-collapse: collapse;
  table-layout: auto;
}

.ledger-table th,
.ledger-table td {
  border: 1px solid #b7cfc2;
  padding: 5px 6px;
  color: #111827;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  vertical-align: middle;
}

.ledger-table thead th {
  position: sticky;
  z-index: 2;
  text-align: center;
  background: #e9f5ed;
  color: #173b2a;
  font-weight: 700;
}

.ledger-table thead tr:first-child th {
  top: 0;
  background: #d7ecdf;
}

.ledger-table thead tr:nth-child(2) th {
  top: 29px;
}

.ledger-table tbody tr:nth-child(even) td {
  background: #fbfdfc;
}

.record-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 2fr) 100px 150px auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}

.record-row strong {
  display: block;
}

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

.print-sheet {
  max-width: 980px;
  margin: 0 auto 24px;
  border: 1px solid #111827;
  background: #fff;
  padding: 18px;
}

.print-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #111827;
  border-left: 1px solid #111827;
}

.print-meta div {
  border-right: 1px solid #111827;
  border-bottom: 1px solid #111827;
  padding: 7px;
  min-height: 34px;
}

.print-table {
  min-width: 0;
  border: 1px solid #111827;
  margin-top: 10px;
}

.print-table th,
.print-table td {
  border: 1px solid #111827;
  padding: 6px;
  color: #111827;
}

.print-sign {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 14px;
}

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

.upload-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.upload-block h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.rule-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

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

.rule-table {
  min-width: 980px;
}

.rule-table th,
.rule-table td {
  text-align: center;
  vertical-align: middle;
}

.rule-table input,
.rule-table select {
  min-width: 0;
  height: 34px;
  padding: 5px 7px;
}

.rule-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.rule-table td:nth-child(2) input,
.rule-table td:nth-child(8) input {
  text-align: left;
}

@media (max-width: 820px) {
  .topbar,
  .grid.two,
  .grid.three,
  .grid.four,
  .record-row,
  .upload-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 10px;
    padding: 12px;
    align-items: stretch;
  }

  .top-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .order-info-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .order-info-grid .field {
    width: 100%;
    grid-column: auto;
  }

  .physical-judgement-grid {
    grid-template-columns: 1fr;
  }

  .physical-judgement-card {
    grid-template-columns: 1fr;
  }

  .ledger-filters {
    grid-template-columns: 1fr;
  }

  .record-search-panel {
    grid-template-columns: 1fr;
  }

  .record-search-count {
    text-align: left;
  }

  .workflow-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-current {
    flex-wrap: wrap;
  }

  .nav-button {
    min-width: 0;
    padding: 8px 6px;
  }

  .main {
    padding: 12px;
  }

  .view-header {
    display: block;
  }

  .role-switcher {
    grid-template-columns: 64px 1fr;
  }

  table {
    min-width: 680px;
  }

  .mobile-section table {
    min-width: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .sidebar,
  .view-header,
  .actions,
  .notice {
    display: none !important;
  }

  .workspace {
    display: block;
    min-height: 0;
  }

  .main {
    padding: 0;
  }

  .panel {
    border: 0;
  }

  .panel-title {
    display: none;
  }

  .print-sheet {
    max-width: none;
    border: 0;
    padding: 0;
  }
}
