:root {
  color-scheme: light;
  --navy: #1f4e78;
  --navy-dark: #173b5d;
  --blue: #5b9bd5;
  --blue-soft: #eaf3fb;
  --green: #c6e0b4;
  --green-soft: #f3f9ee;
  --orange: #ed7d31;
  --orange-soft: #fff2e8;
  --ink: #24364b;
  --muted: #6b7c8f;
  --line: #d8e0e8;
  --surface: #ffffff;
  --page: #f4f7fa;
  --danger: #b42318;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 4vw, 56px);
  color: #fff;
  background: var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.15);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle,
.topbar-note {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

main {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 56px) 40px;
}

.hero-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  align-items: end;
  padding: 10px 0 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

h1,
h2 {
  margin: 0;
  color: var(--navy-dark);
}

h1 {
  max-width: 520px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
}

h2 {
  font-size: 22px;
}

.hero-description {
  max-width: 520px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.input-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(35, 66, 96, 0.08);
}

.input-panel,
.metric-row {
  display: none;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 10px;
}

.input-field {
  display: grid;
  gap: 6px;
}

.input-field-wide {
  grid-column: span 4;
  grid-template-columns: auto minmax(150px, 1fr);
  align-items: center;
}

.input-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.input-field small {
  font-weight: 400;
}

.input-field input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #c7d3df;
  border-radius: 8px;
  color: var(--ink);
  background: #fcfdff;
  outline: none;
}

.input-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.18);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.button {
  padding: 10px 15px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.button-primary {
  color: #fff;
  background: var(--navy);
}

.button-primary:hover {
  background: var(--navy-dark);
}

.button-secondary {
  color: var(--navy);
  background: var(--blue-soft);
}

.dashboard-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-link:hover {
  color: #fff;
  background: var(--navy-dark);
}

.button-copy {
  padding: 7px 10px;
  color: var(--navy);
  background: var(--blue-soft);
  font-size: 12px;
}

.button-copy:hover:not(:disabled) {
  background: #d7e8f7;
}

.button-copy:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
}

.form-hint.error {
  color: var(--danger);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 28px;
}

.metric-card {
  display: grid;
  gap: 5px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.metric-label,
.metric-note {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  color: var(--navy);
  font-size: 21px;
}

.section-block {
  margin-top: 30px;
}

.reference-details {
  margin-top: 28px;
}

.quick-calculation-section {
  display: none;
}

.metric-row {
  display: none;
}

.reference-details > summary {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.reference-details[open] > summary {
  border-radius: 10px 10px 0 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-caption {
  color: var(--muted);
  font-size: 12px;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 990px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
}

thead th {
  color: #fff;
  background: var(--navy);
  font-weight: 700;
}

.fee-table thead th:first-child,
.sample-table thead th:first-child {
  text-align: left;
}

.fee-table tbody tr:last-child td,
.sample-table tbody tr:last-child td {
  border-bottom: 0;
}

.fee-table tbody tr:nth-child(even),
.sample-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.fee-table td:first-child,
.sample-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.fee-table td:nth-child(4) {
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
}

.fee-table .status-cell {
  color: var(--muted);
}

.fee-table .status-cell.warn {
  color: #9a6700;
}

.fee-table .status-cell.error {
  color: var(--danger);
}

.fee-table .copy-fee {
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  color: var(--navy);
  background: #d7e8f7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.fee-table .copy-fee:hover {
  background: #c8dff1;
}

.batch-table {
  min-width: 2180px;
  border-collapse: separate;
  border-spacing: 0;
}

.batch-table th,
.batch-table td {
  padding: 7px 8px;
}

.batch-table th:nth-child(1),
.batch-table td:nth-child(1) {
  width: 42px;
  min-width: 42px;
}

.batch-table th:nth-child(2),
.batch-table td:nth-child(2) {
  width: 190px;
  min-width: 190px;
}

.batch-table th:nth-child(n + 3):nth-child(-n + 7),
.batch-table td:nth-child(n + 3):nth-child(-n + 7) {
  width: 100px;
  min-width: 100px;
}

.batch-table thead th:nth-child(1) {
  background: var(--navy);
}

.batch-table thead th:nth-child(n + 2):nth-child(-n + 7) {
  background: var(--orange);
}

.batch-table thead th:nth-child(n + 8):nth-child(-n + 23) {
  background: var(--blue);
}

.batch-table td:nth-child(1) {
  background: var(--surface);
}

.batch-table td:nth-child(n + 2):nth-child(-n + 7) {
  background: var(--orange-soft);
}

.batch-table td:nth-child(n + 8):nth-child(-n + 23) {
  background: var(--blue-soft);
}

.batch-table .batch-select-cell,
.batch-table .batch-select-column {
  text-align: center;
}

.batch-table tr > :nth-child(1),
.batch-table tr > :nth-child(2),
.batch-table tr > :nth-child(3),
.batch-table tr > :nth-child(4),
.batch-table tr > :nth-child(5),
.batch-table tr > :nth-child(6),
.batch-table tr > :nth-child(7) {
  position: sticky;
  background-clip: padding-box;
}

.batch-table tr > :nth-child(1) {
  left: 0;
}

.batch-table tr > :nth-child(2) {
  left: 42px;
}

.batch-table tr > :nth-child(3) {
  left: 232px;
}

.batch-table tr > :nth-child(4) {
  left: 332px;
}

.batch-table tr > :nth-child(5) {
  left: 432px;
}

.batch-table tr > :nth-child(6) {
  left: 532px;
}

.batch-table tr > :nth-child(7) {
  left: 632px;
  box-shadow: 4px 0 8px rgba(31, 78, 120, 0.12);
}

.batch-table thead tr > :nth-child(-n + 7) {
  z-index: 30;
}

.batch-table tbody tr > :nth-child(-n + 7) {
  z-index: 10;
}

.batch-table .batch-row-checkbox,
.batch-table #batchSelectAllCheckbox {
  width: 15px;
  height: 15px;
  accent-color: var(--navy);
  cursor: pointer;
}

.batch-table .batch-input {
  width: 76px;
  padding: 6px 7px;
  border: 1px solid #c7d3df;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  text-align: center;
}

.batch-table .batch-input[data-field="sku"] {
  width: 164px;
  text-align: left;
}

.paste-help {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.batch-table .batch-input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.18);
}

.batch-table .batch-fee {
  min-width: 72px;
  font-weight: 600;
}

.batch-table .batch-dimensions {
  width: 290px;
  max-width: 290px;
  overflow: hidden;
  color: var(--navy-dark);
  white-space: normal;
  text-align: left;
  line-height: 1.45;
}

.batch-table tr.row-selected td {
  box-shadow: inset 0 0 0 999px rgba(255, 235, 59, 0.12);
}

.batch-table .fee-warning {
  color: #000 !important;
}

.batch-table .fee-error {
  color: var(--danger);
}

.batch-table .fee-over-guidance {
  color: #000 !important;
  background-color: #fee4e2 !important;
  font-weight: 600;
}

.batch-table .row-invalid .batch-fee {
  color: #9aa8b5;
}

.batch-table .batch-actions {
  background: var(--surface);
}

.batch-table .batch-copy,
.batch-table .batch-delete {
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.batch-table .batch-copy {
  color: var(--navy);
  background: #d7e8f7;
}

.batch-table .batch-delete {
  margin-left: 4px;
  color: #8b3d32;
  background: #fbe3df;
}

.sample-table thead th:nth-child(-n + 4) {
  background: var(--orange);
}

.sample-table thead th:nth-child(n + 5) {
  background: var(--blue);
}

.sample-table td:nth-child(-n + 4) {
  background: var(--orange-soft);
}

.sample-table td:nth-child(n + 5) {
  background: var(--blue-soft);
}

.sample-table .load-row {
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--navy);
  background: #d7e8f7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.rule-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
  padding: 15px;
  border: 1px solid #d7e7d1;
  border-radius: 12px;
  background: var(--green-soft);
}

.rule-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.rule-item strong {
  color: var(--ink);
}

.algorithm-summary {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

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

.algorithm-card {
  min-height: 155px;
  padding: 14px;
  border: 1px solid #dbe5ee;
  border-radius: 10px;
  background: #f8fbfe;
}

.algorithm-card h3 {
  margin: 0 0 8px;
  color: var(--navy-dark);
  font-size: 15px;
}

.algorithm-card p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.6;
}

.algorithm-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.rule-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
}

.rule-dot-blue {
  background: var(--blue);
}

.rule-dot-green {
  background: #70ad47;
}

.rule-dot-orange {
  background: var(--orange);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 4vw, 56px) 24px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .hero-section {
    grid-template-columns: 1fr;
  }

  .input-grid {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-note {
    display: none;
  }

  main {
    padding-top: 18px;
  }

  .input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .input-field-wide {
    grid-column: span 2;
  }

  .metric-row,
  .rule-strip {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 460px) {
  .metric-row,
  .rule-strip {
    grid-template-columns: 1fr;
  }

  .algorithm-grid {
    grid-template-columns: 1fr;
  }

  .input-field-wide {
    grid-template-columns: 1fr;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
 .site-nav {
      display: flex;
      gap: 8px;
      max-width: 1440px;
      margin: 0 auto;
      padding: 16px 26px 0;
      font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    }
    .site-nav a {
      display: inline-flex;
      align-items: center;
      min-height: 32px;
      padding: 6px 12px;
      border: 1px solid #d8e1ea;
      border-radius: 8px;
      color: #23445f;
      background: #fff;
      text-decoration: none;
      font-size: 12px;
    }
    .site-nav a:hover,
    .site-nav a[aria-current="page"] { color: #fff; border-color: #1f527c; background: #1f527c; }
