:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #dfe4ea;
  --primary: #1769e0;
  --primary-dark: #0f54bd;
  --success: #16855b;
  --warning-bg: #fff7e8;
  --warning-border: #f0c777;
  --focus: #111827;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23, 105, 224, 0.25); outline-offset: 2px; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--focus); color: #fff; border-radius: 6px; }
.skip-link:focus { top: 12px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; padding: 22px 16px; background: #161c2a; color: #fff; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 48px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 7px; background: #fff; color: #161c2a; font-weight: 800; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 1px; color: #aeb8ca; font-size: 12px; }
.side-nav { display: grid; gap: 7px; margin-top: 30px; }
.nav-item { width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: #cbd3df; text-align: left; text-decoration: none; cursor: pointer; }
.nav-item:hover { background: #222b3e; color: #fff; }
.nav-item.active { background: #fff; color: #172033; font-weight: 700; }
.side-note { margin-top: auto; padding: 14px; border: 1px solid #374158; border-radius: 7px; color: #cbd3df; }
.side-note strong { color: #fff; font-size: 13px; }
.side-note p { margin: 7px 0 0; font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #44c795; }

.workspace { width: calc(100% - 224px); max-width: 1500px; min-height: 100vh; margin-left: 224px; padding: 28px clamp(20px, 3vw, 42px) 20px; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
h1, h2, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 28px; line-height: 1.3; }
h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.operator-block { text-align: right; }
.operator-block span, .operator-block strong { display: block; }
.operator-block span { color: var(--muted); font-size: 12px; }
.operator-block strong { font-size: 13px; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--warning-border); border-radius: 7px; background: var(--warning-bg); }
.notice strong { flex: 0 0 auto; color: #8a5c00; }
.notice span { color: #5e4a21; }
.filter-panel, .results { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.filter-panel { padding: 20px; margin-bottom: 16px; }
.section-heading, .result-toolbar, .sort-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading p, .result-toolbar p { margin: 3px 0 0; color: var(--muted); }
.filter-grid { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(130px, .75fr)) auto; gap: 12px; align-items: end; margin-top: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field span { color: #344054; font-size: 13px; font-weight: 700; }
input, select { width: 100%; height: 44px; border: 1px solid #cfd6df; border-radius: 6px; background: #fff; color: var(--text); padding: 0 12px; }
input::placeholder { color: #98a2b3; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); color: #fff; }
.button.secondary { border-color: #cfd6df; background: #fff; color: #344054; }
.button.secondary:hover { border-color: #98a2b3; background: #f8fafc; color: #172033; }
.button.small { min-height: 36px; padding: 0 11px; font-size: 13px; }
.sort-row { justify-content: flex-start; margin-top: 18px; padding-top: 16px; border-top: 1px solid #edf0f3; }
.sort-row > span { color: var(--muted); font-weight: 700; }
.segmented { display: inline-flex; padding: 3px; border-radius: 7px; background: #eef1f5; }
.sort-button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 5px; background: transparent; color: #475467; cursor: pointer; }
.sort-button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(17, 24, 39, .12); font-weight: 700; }

.results { overflow: hidden; }
.result-toolbar { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.api-badge { padding: 5px 9px; border: 1px solid #a9dbc7; border-radius: 5px; background: #edfaf5; color: var(--success); font-size: 12px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 930px; }
th, td { padding: 15px 16px; border-bottom: 1px solid #edf0f3; text-align: left; vertical-align: middle; }
th { background: var(--surface-muted); color: #475467; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
td small { display: block; color: var(--muted); }
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 300px; }
.product-cell strong { display: block; margin-bottom: 2px; font-size: 14px; }
.product-thumb { display: grid; place-items: center; flex: 0 0 54px; width: 54px; height: 54px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 800; }
.product-thumb.blue { background: #4277b8; }
.product-thumb.green { background: #3e8d71; }
.product-thumb.orange { background: #bc6a35; }
.price { color: #d43c2f; }
.sales { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; min-width: 240px; }
.empty-state { padding: 54px 20px; text-align: center; }
.empty-state p { margin: 5px 0 0; color: var(--muted); }

.compliance-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding: 18px 20px; border-left: 4px solid var(--primary); background: #eef5ff; }
.compliance-strip p { margin: 4px 0 0; color: #475467; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 24px 2px 4px; color: var(--muted); font-size: 12px; }
.site-footer nav { display: flex; gap: 18px; }

dialog { width: min(540px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); color: var(--text); }
dialog::backdrop { background: rgba(15, 23, 42, .55); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.dialog-close { min-width: 56px; min-height: 40px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.detail-list { display: grid; grid-template-columns: 110px 1fr; gap: 9px 14px; margin: 0; padding: 20px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; word-break: break-all; }
.dialog-note, #action-dialog-message { margin: 0; padding: 0 20px 20px; }
.dialog-note { color: var(--muted); font-size: 13px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); padding: 11px 14px; border-radius: 6px; background: #172033; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

.legal-body { background: #f4f6f8; }
.legal-header { background: #161c2a; color: #fff; }
.legal-header-inner, .legal-main, .legal-footer { width: min(900px, calc(100% - 32px)); margin: 0 auto; }
.legal-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; }
.legal-header .brand { min-width: 140px; }
.legal-header nav { display: flex; gap: 18px; }
.legal-header nav a { color: #d6deea; }
.legal-main { margin-top: 28px; margin-bottom: 28px; padding: clamp(22px, 4vw, 44px); border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.legal-main h1 { margin-bottom: 6px; }
.legal-main h2 { margin-top: 30px; margin-bottom: 8px; }
.legal-main p, .legal-main li { color: #475467; }
.legal-main ul { padding-left: 22px; }
.legal-meta { margin: 0 0 24px; color: var(--muted); }
.legal-footer { display: flex; justify-content: space-between; gap: 16px; padding: 0 0 26px; color: var(--muted); font-size: 12px; }
.not-found-main { min-height: 52vh; display: grid; place-items: center; text-align: center; }
.not-found-code { margin: 0; color: var(--primary); font-size: 56px; font-weight: 800; line-height: 1; }
.not-found-main h1 { margin-top: 14px; }
.not-found-main .button { margin-top: 12px; }

@media (max-width: 1120px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-wide { grid-column: span 2; }
  .search-button { width: 100%; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .sidebar { position: static; width: 100%; min-height: auto; padding: 12px 14px; flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand { flex: 0 0 auto; }
  .brand small, .side-note { display: none; }
  .side-nav { display: flex; flex: 0 0 auto; gap: 5px; margin: 0; }
  .nav-item { width: auto; padding: 8px 11px; white-space: nowrap; }
  .workspace { width: 100%; margin-left: 0; padding: 18px 12px; }
  .workspace-header { align-items: flex-start; }
  h1 { font-size: 23px; }
  .operator-block { max-width: 48%; }
  .notice { display: block; }
  .notice strong { display: block; margin-bottom: 3px; }
  .filter-panel { padding: 16px; }
  .section-heading, .result-toolbar, .sort-row, .compliance-strip { align-items: flex-start; }
  .filter-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .sort-row { display: block; overflow-x: auto; }
  .sort-row > span { display: block; margin-bottom: 7px; }
  .segmented { white-space: nowrap; }
  .result-toolbar { display: block; }
  .api-badge { display: inline-block; margin-top: 10px; }
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr { padding: 16px; border-bottom: 8px solid var(--bg); }
  tbody tr:last-child { border-bottom: 0; }
  td { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 8px 0; border: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; }
  td:first-child { display: block; padding-top: 0; }
  td:first-child::before { display: none; }
  .product-cell { min-width: 0; }
  .row-actions { min-width: 0; }
  .row-actions .button { flex: 1 1 90px; }
  .compliance-strip { display: block; }
  .compliance-strip .button { margin-top: 12px; }
  .site-footer, .legal-footer { display: block; }
  .site-footer nav { margin-top: 8px; }
  .legal-header-inner { min-height: auto; padding: 12px 0; align-items: flex-start; }
  .legal-header nav { display: grid; gap: 4px; text-align: right; }
  .legal-main { margin-top: 14px; padding: 20px; }
  .detail-list { grid-template-columns: 88px 1fr; }
}

@media (max-width: 420px) {
  .brand-mark { width: 36px; height: 36px; }
  .brand strong { font-size: 15px; }
  .nav-item { min-height: 40px; padding: 7px 9px; font-size: 13px; }
  .workspace-header { display: block; }
  .operator-block { max-width: none; margin-top: 12px; text-align: left; }
  .segmented { display: grid; grid-template-columns: repeat(3, auto); }
  .sort-button { padding: 0 9px; }
}

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