:root {
  --ink: #111216;
  --muted: #646872;
  --line: #dfe1e6;
  --surface: #ffffff;
  --canvas: #f4f5f7;
  --red: #e60024;
  --red-dark: #b8001c;
  --red-soft: #fff1f3;
  --green: #178a4b;
  --green-soft: #eaf8f0;
  --amber: #8a5b00;
  --amber-soft: #fff5d9;
  --shadow: 0 12px 32px rgb(17 18 22 / 8%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 3px solid #1b67d9; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; color: #fff; background: var(--ink); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.app-header { position: sticky; z-index: 20; top: 0; display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 32px; color: #fff; background: var(--ink); border-bottom: 3px solid var(--red); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; font-weight: 900; color: #fff; background: var(--red); transform: skew(-7deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 20px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: #aeb1b8; font-size: 10px; letter-spacing: .18em; }
.header-status { display: flex; align-items: center; gap: 9px; color: #d7d8dc; font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #8b8e96; }
.header-status.is-ok .status-dot { background: #39d17c; }
.header-status.is-error .status-dot { background: #ff5d75; }

.dev-warning { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 10px 24px; color: #6d4600; background: var(--amber-soft); border-bottom: 1px solid #efd696; font-size: 14px; }
.dev-warning strong { color: #7e0013; text-transform: uppercase; }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: 1680px; margin: 0 auto; }
.sidebar { position: sticky; top: 75px; height: calc(100vh - 75px); padding: 28px 18px; background: #fff; border-right: 1px solid var(--line); }
.dev-warning:not([hidden]) + .app-shell .sidebar { top: 111px; height: calc(100vh - 111px); }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { padding: 12px 14px; color: #373a42; border-left: 3px solid transparent; border-radius: 4px; font-weight: 700; text-decoration: none; }
.nav-link:hover, .nav-link.is-active { color: var(--red); background: var(--red-soft); border-left-color: var(--red); }
.sidebar-note { margin: 28px 10px 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
main { min-width: 0; padding: 40px clamp(22px, 4vw, 64px) 90px; }
.page-section { max-width: 1280px; margin: 0 auto 64px; scroll-margin-top: 96px; }
.dev-warning:not([hidden]) + .app-shell .page-section { scroll-margin-top: 132px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .14em; }
h1, h2, h3 { margin-top: 0; line-height: 1.18; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 5vw, 52px); letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 28px; letter-spacing: -.025em; }
h3 { margin-bottom: 20px; font-size: 20px; }
.lead, .section-copy { color: var(--muted); line-height: 1.75; }
.lead { max-width: 800px; margin: 0; font-size: 17px; }
.section-copy { margin: 0 0 20px; }

.panel { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.session-panel { max-width: 1280px; margin: 0 auto 64px; }
.login-form { padding: 18px; background: #fafafb; border: 1px solid var(--line); border-radius: 9px; }
.login-submit-field { align-content: end; }
.login-submit-field .button { width: 100%; }
.field-label { color: transparent; font-size: 14px; font-weight: 800; user-select: none; }
.session-endpoint { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.session-endpoint code { color: var(--ink); overflow-wrap: anywhere; }
.development-controls { margin-top: 20px; padding: 18px; background: var(--amber-soft); border: 1px solid #efd696; border-radius: 9px; }
.development-controls .checkbox-row { margin-bottom: 0; }
.compact-panel { min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2, .section-heading h3, .section-heading p { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 800; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.5; }
input, select, textarea { width: 100%; min-height: 46px; padding: 11px 12px; color: var(--ink); background: #fff; border: 1px solid #bfc2ca; border-radius: 7px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgb(230 0 36 / 10%); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; color: #474a52; font-size: 14px; line-height: 1.5; }
.checkbox-row input { flex: 0 0 auto; width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--red); }
.session-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 20px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.session-details div { min-width: 0; padding: 15px; background: #fff; }
.session-details dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.session-details dd { overflow-wrap: anywhere; margin: 0; font-weight: 800; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 9px 16px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-weight: 800; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button-primary { color: #fff; background: var(--red); }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { color: var(--ink); background: #fff; border-color: #bfc2ca; }
.button-secondary:hover { border-color: var(--ink); }
.button-danger { color: #fff; background: #820016; }
.button-danger:hover { background: #5c000f; }
.draft-form .button { margin-top: 18px; }
.structured-field { padding-top: 4px; }
.editor-heading, .editor-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.editor-heading { margin-bottom: 12px; }
.editor-heading strong, .editor-heading small { display: block; }
.editor-heading small { margin-top: 4px; }
.editor-heading .button, .editor-section-heading .button, .editor-row .button, .agency-card .button, .tier-card .button { margin-top: 0; }
.structured-editor { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #fbfbfc; }
.editor-table { overflow-x: auto; }
.editor-grid { display: grid; min-width: 980px; gap: 8px; align-items: end; }
.product-grid { min-width: 2380px; grid-template-columns: 1.1fr 1.45fr 1.65fr minmax(260px, 1fr) .72fr .9fr 1.05fr .58fr 1.45fr .9fr .82fr .62fr 1.05fr 70px 78px; }
.product-name-controls, .product-kind-controls { display: grid; gap: 8px; min-width: 0; }
.product-kind-controls label { display: grid; gap: 4px; font-size: 12px; }
.product-kind-controls select { width: 100%; min-width: 0; }
.product-media-control { display: grid; gap: 8px; min-width: 220px; }
.product-media-control input[type="file"] { max-width: 230px; font-size: 12px; }
.product-media-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.product-media-actions .button { min-height: 32px; padding: 6px 10px; }
.product-media-control textarea[readonly] { background: var(--surface-muted, #f4f1eb); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.product-media-control small { color: var(--text-muted, #665f55); line-height: 1.4; }
.product-media-control small[data-kind="success"] { color: #256b43; }
.product-media-control small[data-kind="error"] { color: #a33a2b; }
.price-grid { grid-template-columns: 1.2fr 1.1fr 1.1fr .9fr 1.2fr 1.2fr 70px 78px; }
.plan-grid { min-width: 1160px; grid-template-columns: 1.1fr 1.1fr .85fr 1.2fr 1.2fr 1.2fr 1.2fr 70px 78px; }
.editor-table-head { padding: 10px 12px; color: var(--muted); background: #f0f1f4; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.editor-row { padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-row:last-child { border-bottom: 0; }
.editor-row input, .editor-row select, .editor-row textarea { min-height: 40px; padding: 8px 9px; font-size: 13px; }
.editor-row textarea { resize: vertical; }
.editor-check { display: grid; min-height: 40px; place-items: center; }
.editor-check input { width: 18px; min-height: 18px; padding: 0; accent-color: var(--red); }
.editor-remove { min-height: 38px; padding: 7px 10px; color: #820016; background: #fff; border-color: #dba7b0; font-size: 12px; }
.editor-remove:hover { color: #fff; background: #820016; }
.editor-empty { margin: 0; padding: 24px 14px; color: var(--muted); text-align: center; }
.agency-list { display: grid; gap: 14px; padding: 14px; }
.agency-card, .tier-card { min-width: 0; margin: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.agency-card > legend, .tier-card > legend { padding: 0 7px; font-weight: 900; }
.agency-fields { display: grid; grid-template-columns: 1fr .8fr 1.4fr 80px 78px; gap: 10px; align-items: end; }
.tier-list { display: grid; gap: 12px; margin-top: 12px; }
.tier-card { background: #f8f8fa; }
.tier-fields { display: grid; grid-template-columns: 1fr .8fr 1.35fr 1.2fr 1.2fr 1fr 1fr 80px 78px; gap: 9px; align-items: end; }
.editor-inline-field { display: grid; gap: 5px; min-width: 0; }
.editor-inline-field > span { color: var(--muted); font-size: 11px; font-weight: 800; }
.editor-inline-field input, .editor-inline-field select { min-height: 40px; padding: 8px 9px; font-size: 13px; }
.editor-section { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #cfd1d7; }
.editor-section-heading { margin-bottom: 9px; }
.editor-section-heading h4, .editor-section-heading h5 { margin: 0; font-size: 14px; }
.fee-grid { grid-template-columns: 1.15fr .85fr 1.35fr .9fr 72px 72px 78px; min-width: 850px; }
.adjustment-grid { grid-template-columns: .9fr 1.15fr .85fr 1.35fr .9fr 72px 78px; min-width: 860px; }
.nested-editor-rows { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; }
.nested-editor-rows .editor-row { min-width: 850px; }
.nested-editor-rows .editor-empty { min-width: 0; }
.agreement-list { display: grid; gap: 12px; padding: 14px; }
.agreement-card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 78px; gap: 10px; align-items: end; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.agreement-url, .agreement-digest { grid-column: span 2; }
.agreement-card .button { margin-top: 0; }
.form-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.button-group, .action-toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 22px; }
.list-grid { margin-top: 22px; }
.operations-grid, .preorder-operations-panel, .operational-inline-form { margin-top: 22px; }
.amount-limit-fieldset { margin: 22px 0; padding: 18px; border: 1px solid var(--line); border-radius: 9px; }
.amount-limit-fieldset legend { padding: 0 8px; font-weight: 900; }
.amount-policy-editor-actions { margin-top: 18px; }
.amount-policy-publish-panel, .amount-policy-table-panel { margin-top: 22px; }
.amount-policy-publish-panel form > .button { margin-top: 18px; }
.amount-policy-table { min-width: 1320px; }
.amount-policy-limit-list { display: grid; gap: 4px; min-width: 270px; margin: 0; padding: 0; list-style: none; }
.amount-policy-limit-list li { display: flex; justify-content: space-between; gap: 14px; }
.amount-policy-limit-list span { color: var(--muted); }
.amount-policy-limit-list strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.preorder-operations-panel .inventory-filter-form { margin-bottom: 18px; }
.operational-inline-form { padding-top: 20px; border-top: 1px solid var(--line); }
.operational-inline-form .button-group { margin-top: 16px; }
.preorder-quota-select { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.quota-pending { color: #7c0013; background: var(--red-soft); }
.inventory-filter-panel { margin-bottom: 18px; padding: 18px 22px; }
.inventory-filter-form { display: flex; align-items: end; gap: 12px; }
.inventory-filter-form .field { width: min(360px, 100%); }
.inventory-filter-form .button { flex: 0 0 auto; }
.inventory-table-panel { margin-top: 0; }
.inventory-table { min-width: 1120px; }
.inventory-table th:nth-child(n+4):nth-child(-n+9),
.inventory-table td:nth-child(n+4):nth-child(-n+9) { text-align: right; font-variant-numeric: tabular-nums; }
.inventory-table td:last-child { white-space: nowrap; }
.inventory-ledger-button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.table-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.inventory-flag { display: flex; width: max-content; margin: 5px 0 0 auto; }
.order-filter-panel { margin-bottom: 18px; padding: 18px 22px; }
.order-filter-form { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 12px; }
.order-table-panel { margin-top: 0; }
.order-table { min-width: 1040px; }
.order-table td:nth-child(6) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-detail-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.member-business-filter-panel { margin-bottom: 18px; padding: 18px 22px; }
.member-business-filter-form { grid-template-columns: repeat(3, minmax(170px, 1fr)) auto; }
.member-business-table-panel { margin-top: 0; }
.member-business-table { min-width: 1240px; }
.member-business-table td:nth-child(6),
.member-business-table td:nth-child(7) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.member-business-detail-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.member-business-detail-panel { margin-top: 22px; border-top: 4px solid var(--red); }
.member-business-detail-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.member-business-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.member-business-subpanel { min-width: 0; margin-top: 16px; padding: 18px; background: #f8f8fa; border: 1px solid var(--line); border-radius: 9px; }
.member-business-subpanel h4, .member-business-subpanel h5 { margin: 0 0 14px; }
.member-business-inner-table-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.member-business-card-table { min-width: 980px; }
.member-business-attachment-table { min-width: 760px; }
.member-business-timeline-table { min-width: 980px; }
.member-business-fulfillment-table { min-width: 1500px; }
.member-business-fulfillment-table td { min-width: 170px; vertical-align: top; line-height: 1.55; }
.member-business-attachment-ids code { display: inline-block; margin: 2px 0; overflow-wrap: anywhere; }
.member-business-attachment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.member-business-attachment-preview-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.member-business-attachment-preview { display: grid; gap: 12px; margin: 16px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.member-business-attachment-preview[hidden] { display: none; }
.member-business-attachment-preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.member-business-attachment-preview-toolbar figcaption { color: var(--muted); font-size: 12px; font-weight: 800; }
.member-business-attachment-preview img { display: block; width: min(100%, 720px); max-height: 720px; justify-self: center; object-fit: contain; border-radius: 7px; background: #f1f2f5; }
.member-business-attachment-preview img[hidden] { display: none; }
.member-business-action-form { display: grid; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.member-business-action-form[hidden] { display: none; }
.member-business-action-form > .button { justify-self: start; }
.member-business-action-fields { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.member-business-action-fields[hidden] { display: none; }
.member-business-card-amount-field { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 220px); align-items: center; gap: 12px; margin-top: 10px; }
.member-business-card-amount-field span { overflow-wrap: anywhere; font-weight: 700; }
.support-filter-panel { margin-bottom: 18px; padding: 18px 22px; }
.support-filter-form { grid-template-columns: repeat(2, minmax(170px, 1fr)) auto; }
.support-table-panel { margin-top: 0; }
.support-table { min-width: 900px; }
.support-detail-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.support-message-panel { margin-bottom: 20px; }
.support-message-panel h4 { margin: 0 0 12px; }
.support-message-list { display: grid; gap: 10px; }
.support-message { padding: 14px 16px; background: #f7f7f9; border: 1px solid var(--line); border-left: 4px solid #a8abb3; border-radius: 8px; }
.support-message-staff { border-left-color: var(--red); }
.support-message-system { border-left-color: #59616f; }
.support-message header { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.support-message p { margin: 9px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-assign-form, .support-reply-form { display: grid; gap: 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.support-assign-form { grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr); margin-bottom: 20px; }
.support-assign-form .button-group, .support-assign-form .form-note { grid-column: 1 / -1; }
.staff-role-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 22px; margin-bottom: 22px; }
.staff-role-grid .panel, .staff-detail-panel { margin-top: 0; }
.staff-filter-form { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)) auto; gap: 14px; align-items: end; margin-bottom: 16px; }
.staff-table-wrap, .role-table-wrap { margin-top: 12px; }
.staff-table { min-width: 780px; }
.role-table { min-width: 720px; }
.staff-table td, .role-table td { vertical-align: top; }
.staff-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.staff-action-grid h4 { margin: 0; }
.stack-form { display: grid; gap: 15px; }
.stack-form select[multiple] { min-height: 150px; }
.permission-picker { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 8px; }
.permission-picker legend { padding: 0 8px; font-weight: 700; }
.permission-option-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; max-height: 310px; margin-top: 12px; overflow: auto; }
.permission-option { display: flex; gap: 8px; align-items: flex-start; min-width: 0; padding: 7px 8px; background: #f7f7f9; border-radius: 6px; font-size: 12px; overflow-wrap: anywhere; }
.permission-option input { flex: 0 0 auto; margin-top: 2px; }
.role-update-panel { margin-bottom: 22px; }
.role-update-form { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 15px; }
.role-update-form .form-note, .role-update-form .button { grid-column: 1 / -1; }
.staff-management-button, .role-edit-button, .audit-detail-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.audit-filter-panel { padding: 18px 22px; }
.audit-filter-form { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 14px; align-items: end; }
.audit-filter-form .field-wide { grid-column: span 2; }
.audit-filter-actions { align-self: end; }
.audit-table-panel { margin-top: 18px; }
.audit-table { min-width: 1180px; }
.audit-detail-panel pre { max-height: 520px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.preorder-special-report-panel { margin-top: 22px; }
.preorder-special-report-filter-form { grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; margin-bottom: 12px; }
.preorder-special-report-table-wrap { margin-top: 18px; border: 1px solid var(--line); border-radius: 9px; }
.preorder-special-report-table { min-width: 1040px; }
.preorder-special-report-action { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.preorder-special-report-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.preorder-special-report-pagination output { min-width: 70px; color: var(--muted); text-align: center; font-size: 12px; font-weight: 800; }
.order-detail-panel { margin-top: 22px; border-top: 4px solid var(--red); }
.compact-select-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.compact-select-label select { min-width: 74px; min-height: 38px; padding: 6px 28px 6px 10px; }
.grading-service-order-table { min-width: 980px; }
.grading-fulfillment-form { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: #f8f8fa; }
.grading-fulfillment-form h4 { margin: 0 0 14px; }
.grading-fulfillment-actions { margin-top: 14px; }
.grading-card-result-editor { display: grid; gap: 10px; margin-top: 14px; }
.grading-card-result-row { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(120px, .7fr) minmax(180px, 1fr); gap: 10px; align-items: end; }
.grading-card-result-row strong { align-self: center; }
.grading-service-card-table { min-width: 860px; }
.grading-service-card-wrap { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 9px; }
.grading-service-card-table caption { padding: 15px 16px; color: var(--ink); background: #fff; text-align: left; font-weight: 900; }
.grading-service-payment-wrap { margin-top: 20px; border: 1px solid var(--line); border-radius: 9px; }
.grading-service-payment-table { min-width: 1180px; }
.grading-service-payment-table caption { padding: 15px 16px; color: var(--ink); background: #fff; text-align: left; font-weight: 900; }
.grading-platform-report-button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.order-detail-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0 0 20px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; }
.order-detail-summary div { min-width: 0; padding: 14px; background: #fff; }
.order-detail-summary dt, .safe-field-list dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.order-detail-summary dd, .safe-field-list dd { overflow-wrap: anywhere; margin: 0; font-size: 14px; font-weight: 800; }
.order-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.order-subpanel { min-width: 0; padding: 18px; background: #f8f8fa; border: 1px solid var(--line); border-radius: 9px; }
.order-subpanel h4 { margin: 0 0 14px; }
.preorder-payment-panel { grid-column: 1 / -1; }
.preorder-operation-fields { margin-top: 16px; }
.preorder-evidence-field { grid-column: 1 / -1; }
.preorder-operation-toolbar { margin-top: 16px; }
.safe-field-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0; }
.safe-field-list div { min-width: 0; }
.order-contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.order-contact-actions .button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.order-contact-input { width: 100%; min-width: 0; font-size: 14px; font-weight: 800; }
.order-shipping-input { width: 100%; min-width: 0; margin-top: 8px; }
.order-contact-note { display: block; margin-top: 6px; }
.order-lines-wrap { border: 1px solid var(--line); border-radius: 9px; }
.order-lines-table { min-width: 720px; }
.order-lines-table caption { padding: 15px 16px; color: var(--ink); background: #fff; text-align: left; font-weight: 900; }
.order-lines-table td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.order-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.order-history-table-wrap { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.order-history-table, .order-note-table { min-width: 720px; }
.order-history-table td, .order-note-table td { vertical-align: top; }
.order-note-form { display: grid; gap: 10px; }
.order-note-form label { font-weight: 800; }
.order-note-form .button { justify-self: start; }
.order-action-area { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.order-action-area h4 { margin: 0 0 5px; }
.order-action-area .form-note { max-width: 520px; }
.order-action-toolbar { justify-content: flex-end; }
.operations-workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.operations-detail-panel { margin-top: 22px; }
.operations-form { display: grid; gap: 14px; }
.operations-form h4, .operations-form h5 { margin: 0; }
.inline-load-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.operations-card-list { display: grid; gap: 18px; margin-top: 20px; }
.warehouse-card-operation { padding: 18px; background: #f8f8fa; border: 1px solid var(--line); border-radius: 9px; }
.warehouse-card-operation > h4 { margin: 0 0 14px; overflow-wrap: anywhere; }
.operation-card-summary { padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.compact-operation-card { align-content: start; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.operations-command-result { margin-top: 18px; padding: 16px; background: #f8f8fa; border-left: 4px solid var(--red); border-radius: 7px; }
.operations-command-result:empty { display: none; }
.operations-command-result h4 { margin: 0 0 12px; }
.grading-return-workspace > .panel { align-content: start; }
.one-time-secret { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 20px; padding: 16px 18px; color: #fff; background: var(--ink); border-left: 5px solid var(--red); border-radius: 8px; }
.one-time-secret p { margin: 5px 0 8px; color: #cfd1d7; font-size: 12px; }
.one-time-secret code { display: block; max-width: 760px; overflow-wrap: anywhere; color: #fff; }
.one-time-secret .button { flex: 0 0 auto; }
.refund-closed-note { margin: 18px 0 0; padding: 14px 16px; color: #6f0012; background: var(--red-soft); border-left: 4px solid var(--red); border-radius: 7px; line-height: 1.6; }
.idempotency-preview { padding: 10px 12px; color: var(--muted); background: #f5f5f7; border-radius: 7px; font-size: 12px; }
.idempotency-preview code { color: var(--ink); overflow-wrap: anywhere; }
#order-action-dialog { width: min(760px, calc(100vw - 32px)); }
.dialog-summary { margin: -8px 0 20px; padding: 12px 14px; color: var(--muted); background: #f5f5f7; border-radius: 7px; line-height: 1.55; }
#inventory-dialog { width: min(720px, calc(100vw - 32px)); }
.badge { display: inline-flex; width: max-content; align-items: center; padding: 5px 9px; color: #363941; background: #eceef2; border-radius: 999px; font-size: 12px; font-weight: 900; }
.badge-warning { color: #7c0013; background: var(--red-soft); }
.badge-success { color: #0e6a39; background: var(--green-soft); }
.badge-error { color: #93001a; background: #ffe1e6; }
.revision-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.revision-card { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.revision-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.revision-card h4 { margin: 0 0 5px; font-size: 16px; }
.revision-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.revision-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.revision-actions .button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.empty-state { padding: 28px 16px; color: var(--muted); text-align: center; }
.action-toolbar { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.diff-panel { margin-top: 20px; }
pre { max-height: 440px; overflow: auto; margin: 0; padding: 18px; color: #e6e8ed; background: #15161a; border-radius: 8px; font: 13px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 15px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); background: #f7f7f9; font-size: 12px; text-transform: uppercase; }
td { font-size: 13px; overflow-wrap: anywhere; }
.toast-region { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; width: min(390px, calc(100vw - 40px)); gap: 10px; }
.toast { padding: 14px 16px; color: #fff; background: var(--ink); border-left: 4px solid var(--red); border-radius: 7px; box-shadow: var(--shadow); }
.toast.is-success { border-left-color: #39d17c; }
.toast.is-error { border-left-color: #ff5d75; }
dialog { width: min(540px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: 12px; box-shadow: 0 30px 90px rgb(0 0 0 / 35%); }
dialog::backdrop { background: rgb(0 0 0 / 62%); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 20px 24px 28px; color: var(--muted); background: #f7f7f9; border-top: 1px solid var(--line); font-size: 12px; }
.site-footer a { color: inherit; text-underline-offset: 3px; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--red); }

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; min-width: 0; height: auto; padding: 12px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-link { flex: 0 0 auto; border-bottom: 3px solid transparent; border-left: 0; }
  .nav-link:hover, .nav-link.is-active { border-bottom-color: var(--red); border-left: 0; }
  .sidebar-note { display: none; }
  .workspace-grid, .operations-workspace-grid { grid-template-columns: 1fr; }
  .sidebar + main { padding-top: 30px; }
  .page-section { scroll-margin-top: 96px; }
}

@media (max-width: 720px) {
  .app-header { padding: 10px 16px; flex-wrap: wrap; gap: 12px; }
  .header-status { display: none; }
  .dev-warning { align-items: flex-start; flex-direction: column; gap: 2px; }
  main { padding: 28px 14px 70px; }
  .hero, .section-heading { align-items: stretch; flex-direction: column; }
  .form-grid, .three-columns, .session-details { grid-template-columns: 1fr; }
  .grading-card-result-row { grid-template-columns: 1fr; }
  .panel { padding: 20px 16px; }
  .button-group .button, .action-toolbar .button { flex: 1 1 150px; }
  .inventory-filter-form { align-items: stretch; flex-direction: column; }
  .inventory-filter-form .field, .inventory-filter-form .button { width: 100%; }
  .order-filter-form, .order-detail-summary, .order-detail-grid, .order-history-grid, .safe-field-list, .member-business-detail-grid, .member-business-detail-summary, .support-assign-form, .staff-role-grid, .staff-action-grid, .staff-filter-form, .role-update-form, .audit-filter-form, .inline-load-form { grid-template-columns: 1fr; }
  .audit-filter-form .field-wide, .role-update-form .form-note, .role-update-form .button { grid-column: 1; }
  .permission-option-list { grid-template-columns: 1fr; }
  .order-action-area, .one-time-secret { align-items: stretch; flex-direction: column; }
  .order-action-toolbar { justify-content: stretch; }
  .order-action-toolbar .button, .one-time-secret .button { width: 100%; }
  .editor-heading, .editor-section-heading { align-items: stretch; flex-direction: column; }
  .agency-fields, .tier-fields { grid-template-columns: 1fr; }
  .member-business-card-amount-field { grid-template-columns: 1fr; }
  .agreement-card { grid-template-columns: 1fr; }
  .agreement-url, .agreement-digest { grid-column: auto; }
  .editor-check { display: flex; justify-content: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
/* The global language control stays usable without crowding the session status. */
.language-switch { display: flex; align-items: center; gap: .5rem; white-space: nowrap; font-size: .875rem; }
.language-switch select { width: auto; min-width: 6rem; }
html[lang="en"] .button { white-space: normal; }
html[lang="en"] .nav-link { overflow-wrap: anywhere; }

/* Product language is chosen before creating rows, independently of series. */
#products .field, #products .editor-heading { min-width: 0; }
#products .editor-heading { display: block; }
.product-language-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; min-width: 0; width: min(100%, 520px); margin-top: 14px; }
.product-language-entry label, .product-language-entry small { grid-column: 1 / -1; }
.product-language-entry label { font-weight: 700; }
.product-language-entry select { min-height: 44px; min-width: 0; width: 100%; margin: 0; }
.product-language-entry small { margin-top: 0; max-width: 440px; }
@media (max-width: 560px) { .product-language-entry { width: 100%; grid-template-columns: 1fr; } }

/* Staff collection uses the existing dispatch and confirmation dialogs. */
.staff-collection-choice { min-inline-size: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.staff-collection-choice legend { padding: 0 6px; font-weight: 700; }
.staff-collection-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.staff-collection-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; overflow-wrap: anywhere; }
.staff-collection-option input[type="radio"] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; margin: 0; }
.staff-collection-option span { min-width: 0; white-space: normal; }
.staff-collection-option:has(input:checked) { border-color: var(--red); background: #fff5f5; }
.staff-collection-option:has(input:disabled) { cursor: default; color: var(--muted); }
.staff-collection-review-line { display: block; margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.staff-collection-business-value, .staff-collection-recovery p { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.staff-collection-recovery .button { min-height: 44px; white-space: normal; }
#order-action-dialog, #order-confirm-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
#order-action-dialog .dialog-summary { overflow-wrap: anywhere; }
#order-detail-title { min-width: 0; overflow-wrap: anywhere; }
#order-action-dialog .dialog-actions .button, #order-confirm-dialog .dialog-actions .button { min-height: 44px; }
#order-confirm-description { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .staff-collection-modes { grid-template-columns: 1fr; }
  #order-action-dialog .dialog-actions, #order-confirm-dialog .dialog-actions { flex-wrap: wrap; }
  #order-action-dialog .dialog-actions .button, #order-confirm-dialog .dialog-actions .button { min-width: 0; min-height: 44px; white-space: normal; flex: 1 1 120px; }
}

/* Keep complete detail identifiers readable at narrow widths. */
#support-detail-title, #audit-detail-title, #warehouse-package-detail-title, #warehouse-task-detail-title, #grading-batch-detail-title { min-width: 0; overflow-wrap: anywhere; }

/* Keep each authorized order record complete on narrow screens. */
@media (max-width: 600px) {
  .order-history-table, .order-note-table { min-width: 0; table-layout: fixed; }
  .order-history-table thead, .order-note-table thead { display: none; }
  .order-history-table tbody, .order-note-table tbody { display: block; }
  .order-history-table tr, .order-note-table tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: 12px; border-bottom: 1px solid var(--line); }
  .order-history-table tr:last-child, .order-note-table tr:last-child { border-bottom: 0; }
  .order-history-table td, .order-note-table td { display: block; min-width: 0; padding: 6px 0; border: 0; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
  .order-history-table td code, .order-note-table td code { white-space: normal; overflow-wrap: anywhere; word-break: normal; }
  .order-history-table td:not([colspan])::before, .order-note-table td:not([colspan])::before { display: block; margin-bottom: 3px; color: var(--muted); font-size: 12px; font-weight: 700; }
  .order-history-table td:nth-child(1):not([colspan])::before, .order-note-table td:nth-child(1):not([colspan])::before { content: "时间"; }
  .order-history-table td:nth-child(2)::before { content: "状态"; }
  .order-history-table td:nth-child(3)::before { content: "原因"; }
  .order-history-table td:nth-child(4)::before { content: "操作主体"; }
  .order-note-table td:nth-child(2)::before { content: "备注"; }
  .order-note-table td:nth-child(3)::before { content: "员工"; }
  .order-note-table td:nth-child(4)::before { content: "订单版本"; }
  :lang(en) .order-history-table td:nth-child(1):not([colspan])::before, :lang(en) .order-note-table td:nth-child(1):not([colspan])::before { content: "Time"; }
  :lang(en) .order-history-table td:nth-child(2)::before { content: "Status"; }
  :lang(en) .order-history-table td:nth-child(3)::before { content: "Reason"; }
  :lang(en) .order-history-table td:nth-child(4)::before { content: "Actor"; }
  :lang(en) .order-note-table td:nth-child(2)::before { content: "Note"; }
  :lang(en) .order-note-table td:nth-child(3)::before { content: "Staff"; }
  :lang(en) .order-note-table td:nth-child(4)::before { content: "Order version"; }
}

/* Keep order task anchors below the wrapped mobile header. */
@media (max-width: 720px) {
  #order-detail-panel .sp-task-pages .sp-link { scroll-margin-top: 160px; }
}
