:root {
  --ink: #182b45;
  --muted: #687588;
  --page: #f4f7fb;
  --surface: #ffffff;
  --line: #dfe6ee;
  --blue: #2563c9;
  --blue-soft: #eaf2ff;
  --teal: #0d766e;
  --teal-soft: #e8f6f3;
  --orange: #b85c00;
  --orange-soft: #fff1df;
  --danger: #be3d3c;
  --danger-soft: #fff0ef;
  --shadow: 0 5px 18px rgba(21, 42, 77, 0.08);
  --radius: 6px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--page); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__inner, .content-width { width: min(1480px, calc(100% - 40px)); margin: 0 auto; }
.topbar__inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.breadcrumbs, .eyebrow { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.breadcrumbs span { margin: 0 7px; color: #a3afbf; }
.title-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: 23px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.25; }

.connection-badge, .filter-status { padding: 4px 8px; border: 1px solid #bcd2ed; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 12px; white-space: nowrap; }
.connection-badge.is-ready { border-color: #a9d8d0; background: var(--teal-soft); color: var(--teal); }
.connection-badge.is-warning { border-color: #f0c68a; background: var(--orange-soft); color: var(--orange); }
.connection-badge.is-error { border-color: #efb9b7; background: var(--danger-soft); color: var(--danger); }

.topbar-actions, .filter-actions, .toolbar-meta, .field-config-tools, .dialog-footer, .pagination, .report-switcher__inner { display: flex; align-items: center; gap: 8px; }
button { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid transparent; border-radius: 5px; font-weight: 600; transition: background 120ms ease, border-color 120ms ease, color 120ms ease; }
button svg { width: 16px; height: 16px; stroke-width: 2; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #76a7eb; outline-offset: 1px; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
.primary-button { border-color: var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { border-color: #1e55ae; background: #1e55ae; }
.secondary-button { border-color: #bfcbd8; background: #fff; color: var(--ink); }
.secondary-button:hover, .tertiary-button:hover, .icon-text-button:hover { background: #f1f5fa; }
.tertiary-button, .icon-text-button { border-color: transparent; background: transparent; color: var(--blue); }
.icon-text-button { height: 28px; padding: 0 4px; font-weight: 500; }
.icon-button { width: 34px; padding: 0; border-color: #cbd5df; background: #fff; color: #536174; }
.icon-button:hover { border-color: #93b5e2; background: var(--blue-soft); color: var(--blue); }

.report-switcher { background: #fff; border-bottom: 1px solid var(--line); }
.report-switcher__inner { min-height: 52px; justify-content: flex-start; }
.report-tab { height: 52px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: #546276; }
.report-tab:hover { background: #f7faff; color: var(--blue); }
.report-tab.is-active { border-bottom-color: var(--blue); color: var(--blue); }
.source-note { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 12px; }
.source-note svg { width: 15px; height: 15px; color: var(--teal); }

.filter-band { padding: 22px 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.section-heading, .report-toolbar, .dialog-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading h2, .report-toolbar h2 { margin-top: 4px; }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px; margin-top: 18px; }
.field-control { min-width: 0; display: grid; gap: 6px; }
.field-control span { color: #4e5c6e; font-size: 12px; font-weight: 600; }
input, select { width: 100%; height: 34px; padding: 0 10px; border: 1px solid #cfd8e2; border-radius: 4px; background: #fff; color: var(--ink); }
input::placeholder { color: #9aa7b6; }
select { appearance: auto; }
.customer-search { position: relative; min-width: 0; }
.customer-search__control { display: flex; min-width: 0; }
.customer-search__control input { min-width: 0; padding-right: 38px; }
.customer-search__toggle { width: 34px; flex: 0 0 34px; margin-left: -34px; padding: 0; border: 0; border-left: 1px solid #d9e1ea; border-radius: 0 4px 4px 0; background: transparent; color: #64748b; }
.customer-search__toggle:hover { background: #edf5ff; color: var(--blue); }
.customer-option-menu { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 6; max-height: 372px; overflow: auto; border: 1px solid #b9c9dc; border-radius: 5px; background: #fff; box-shadow: 0 10px 24px rgba(30, 54, 86, 0.16); }
.customer-option { width: 100%; min-height: 34px; justify-content: space-between; padding: 7px 10px; border: 0; border-bottom: 1px solid #edf1f5; border-radius: 0; background: #fff; color: var(--ink); font-size: 13px; font-weight: 400; text-align: left; }
.customer-option:last-child { border-bottom: 0; }
.customer-option:hover { background: #edf5ff; color: var(--blue); }
.customer-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-option small { flex: 0 0 auto; margin-left: 10px; color: #8a99ab; font-size: 11px; }
.customer-option-empty { padding: 11px 10px; color: var(--muted); font-size: 12px; }
.multi-select { position: relative; min-width: 0; }
.multi-select__control { display: flex; align-items: center; min-height: 34px; border: 1px solid #cfd8e2; border-radius: 4px; background: #fff; }
.multi-select__control:focus-within { border-color: #7eaae5; box-shadow: 0 0 0 2px rgba(35, 105, 205, 0.1); }
.multi-select__tags { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 4px; min-width: 0; padding: 3px 0 3px 6px; }
.multi-select__tags:empty { display: none; }
.multi-tag { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; height: 23px; padding: 0 3px 0 7px; border: 1px solid #c4d9f5; border-radius: 3px; background: #edf5ff; color: #245896; font-size: 12px; line-height: 1; }
.multi-tag > span { overflow: hidden; max-width: 142px; text-overflow: ellipsis; white-space: nowrap; }
.multi-tag button { display: grid; width: 18px; height: 18px; place-items: center; margin-left: 2px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #5f7ea8; }
.multi-tag button:hover { background: #d4e7ff; color: #174e90; }
.multi-tag svg { width: 13px; height: 13px; }
.multi-select__control input { min-width: 72px; flex: 1 1 90px; height: 32px; padding: 0 8px; border: 0; outline: 0; box-shadow: none; }
.multi-select__toggle { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; padding: 0; border: 0; border-left: 1px solid #d9e1ea; border-radius: 0 4px 4px 0; background: transparent; color: #64748b; }
.multi-select__toggle:hover { background: #edf5ff; color: var(--blue); }
.multi-select__toggle svg { width: 15px; height: 15px; }
.multi-option-menu { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 8; max-height: 300px; overflow: auto; border: 1px solid #b9c9dc; border-radius: 5px; background: #fff; box-shadow: 0 10px 24px rgba(30, 54, 86, 0.16); }
.multi-option { width: 100%; min-height: 34px; justify-content: space-between; padding: 7px 10px; border: 0; border-bottom: 1px solid #edf1f5; border-radius: 0; background: #fff; color: var(--ink); font-size: 13px; font-weight: 400; text-align: left; }
.multi-option:last-child { border-bottom: 0; }
.multi-option:hover { background: #edf5ff; color: var(--blue); }
.multi-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-option small { flex: 0 0 auto; margin-left: 10px; color: #8a99ab; font-size: 11px; }
.multi-option-empty { padding: 11px 10px; color: var(--muted); font-size: 12px; }
.filter-actions { align-self: end; justify-content: flex-end; }
.additional-filter-builder { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 0.85fr) minmax(180px, 1.3fr) auto; align-items: end; gap: 12px 14px; padding: 14px; border: 1px solid #cfe0f6; border-radius: var(--radius); background: #f8fbff; }
.additional-filter-builder > button { align-self: end; }
.active-filter-list { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; }
.active-filter-chip { display: inline-flex; align-items: center; min-height: 28px; max-width: 100%; border: 1px solid #bcd2ed; border-radius: 4px; background: #fff; color: #405169; font-size: 12px; }
.active-filter-chip > span { overflow: hidden; padding: 0 7px 0 9px; text-overflow: ellipsis; white-space: nowrap; }
.active-filter-chip button { width: 26px; height: 26px; padding: 0; border: 0; border-left: 1px solid #dbe6f3; border-radius: 0; background: transparent; color: #66778c; }
.active-filter-chip button:hover { background: #edf5ff; color: var(--blue); }
.active-filter-chip svg { width: 14px; height: 14px; }

.report-band { padding: 24px 0 34px; }
.report-toolbar { align-items: center; margin: 0 0 14px; }
.toolbar-meta { color: var(--muted); font-size: 13px; }
.table-frame { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table-scroll { overflow: auto; max-height: 590px; }
table { width: 100%; min-width: 1250px; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e6ebf1; white-space: nowrap; text-align: left; }
th { position: sticky; top: 0; z-index: 1; background: #f6f8fb; color: #405169; font-size: 12px; font-weight: 700; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 2; width: 45px; text-align: center; background: inherit; }
th:first-child { z-index: 3; background: #f6f8fb; }
tbody tr { background: #fff; }
tbody tr:hover, tbody tr.is-selected { background: #f3f8ff; }
td { color: #28384e; font-size: 13px; }
td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.serial-column { width: 62px; min-width: 62px; text-align: center; color: #617188; font-variant-numeric: tabular-nums; }
tfoot .summary-row td { position: sticky; bottom: 0; z-index: 1; border-top: 1px solid #b9c9dc; border-bottom: 0; background: #eef5fc; color: #304c6a; font-weight: 700; }
tfoot .summary-row td:first-child { z-index: 3; background: #eef5fc; }
.sort-button { width: 100%; height: auto; justify-content: flex-start; padding: 0; border: 0; background: none; color: inherit; font-size: 12px; }
.sort-button svg { width: 14px; height: 14px; color: #91a1b3; }
.row-checkbox, .header-checkbox { width: 15px; height: 15px; accent-color: var(--blue); }
.status-tag { display: inline-flex; min-width: 58px; justify-content: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-tag--fulfilled, .status-tag--ok, .status-tag--signed { background: var(--teal-soft); color: var(--teal); }
.status-tag--processing, .status-tag--pending { background: var(--orange-soft); color: var(--orange); }
.status-tag--cancelled, .status-tag--late { background: var(--danger-soft); color: var(--danger); }
.status-tag--neutral { background: #eef2f6; color: #586679; }
.empty-state { height: 220px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 6px; color: #45576e; font-size: 14px; }
.empty-state span { font-size: 12px; }
.table-footer { min-height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; color: var(--muted); font-size: 13px; }
.pagination .icon-button { width: 30px; height: 30px; }

.column-dialog { width: min(940px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 20px 60px rgba(20, 37, 61, 0.28); }
.column-dialog::backdrop { background: rgba(18, 32, 50, 0.38); }
.dialog-shell { display: flex; flex-direction: column; max-height: min(760px, calc(100vh - 32px)); }
.dialog-header { align-items: flex-start; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); }
.dialog-note { margin: 16px 24px 8px; color: var(--muted); font-size: 13px; }
.field-config-tools { padding: 8px 24px 14px; border-bottom: 1px solid var(--line); }
.field-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; overflow: auto; padding: 20px 24px; }
.field-group { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.field-group h3 { padding: 10px 12px; background: #f6f8fb; color: #43536a; font-size: 13px; }
.field-option { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid #edf0f4; color: #344359; font-size: 13px; }
.field-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.field-option.is-core { color: var(--ink); font-weight: 700; }
.dialog-footer { justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfd; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 10; transform: translate(-50%, 16px); padding: 10px 14px; border-radius: 5px; background: #26394f; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 140ms ease, transform 140ms ease; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.action-cell { min-width: 128px; }
.table-action { height: 28px; padding: 0 6px; border: 0; background: transparent; color: var(--blue); font-weight: 600; }
.table-action:hover { background: var(--blue-soft); }
.table-action svg { width: 15px; height: 15px; }

.return-label-dialog { width: min(1220px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 20px 60px rgba(20, 37, 61, 0.28); }
.return-label-dialog::backdrop { background: rgba(18, 32, 50, 0.38); }
.return-label-dialog__shell { min-height: 0; max-height: min(760px, calc(100vh - 32px)); }
.return-label-dialog__intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.return-label-dialog__intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.return-selection-count { flex: 0 0 auto; color: var(--blue); font-size: 13px; font-weight: 700; white-space: nowrap; }
.return-label-table-frame { min-height: 260px; overflow: hidden; background: #fff; }
.return-label-table-scroll { max-height: 470px; }
.return-label-table { min-width: 980px; }
.return-label-table th:first-child, .return-label-table td:first-child { position: static; width: 45px; }
.return-label-table th { top: 0; }
.return-label-table td { white-space: nowrap; }
.package-code { display: grid; gap: 3px; min-width: 170px; }
.package-code strong { color: var(--ink); font-size: 12px; }
.package-code span { color: var(--muted); font-size: 12px; }
.dimension-value { font-variant-numeric: tabular-nums; }
.return-label-empty { height: 260px; text-align: center; color: var(--muted); }
.return-label-empty strong { display: block; margin-bottom: 6px; color: #45576e; font-size: 14px; }
.return-label-empty span { font-size: 12px; }

@media (max-width: 1120px) { .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .topbar__inner, .content-width { width: min(100% - 24px, 1480px); }
  .topbar__inner { min-height: 112px; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 0; }
  .topbar-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .report-switcher__inner { overflow-x: auto; }
  .source-note { display: none; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .additional-filter-builder { grid-template-columns: 1fr 1fr; }
  .additional-filter-builder > button { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .section-heading, .report-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-meta { width: 100%; justify-content: space-between; }
  .field-groups { grid-template-columns: 1fr; }
  .return-label-dialog__intro { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 440px) { h1 { font-size: 20px; } .filter-grid { grid-template-columns: 1fr; } .additional-filter-builder { grid-template-columns: 1fr; } .additional-filter-builder > button { grid-column: auto; } .filter-actions { justify-content: stretch; } .filter-actions button { flex: 1; } .connection-badge { display: none; } }
