:root {
  color-scheme: light;
  --navy-950: #101a2d;
  --orange-600: #e85d04;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --text: #172033;
  --muted: #667085;
  --danger: #b42318;
  --warning: #9a3412;
  --success: #067647;
  --focus: #2563eb;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { min-width: 0; margin: 0; background: var(--canvas); }
a { color: #124bb5; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
a:hover { color: #083a93; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link { position: fixed; z-index: 20; top: 0.5rem; left: 0.5rem; padding: 0.7rem 0.9rem; border-radius: 0.4rem; color: #fff; background: var(--navy-950); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { min-width: 0; padding: 1.5rem 1rem; color: #d0d5dd; background: var(--navy-950); }
.brand { display: block; margin: 0 0.5rem 2rem; color: #fff; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand:hover { color: #fff; text-decoration: underline; }
.sidebar nav { display: grid; gap: 0.4rem; }
.nav-link { display: block; min-height: 2.75rem; padding: 0.7rem 0.75rem; border-radius: 0.45rem; color: #e4e7ec; font-weight: 600; text-decoration: none; }
.nav-link:hover, .nav-link:focus-visible { color: #fff; background: #253554; }
.nav-link.active { color: #9a3412; background: #ffedd5; box-shadow: inset 0.25rem 0 var(--orange-600); }
.content { min-width: 0; padding: 1.75rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
h1, h2 { color: var(--text); line-height: 1.25; }
h1 { margin: 0; font-size: clamp(1.6rem, 2vw, 2rem); }
h2 { margin-top: 0; font-size: 1.05rem; }
.eyebrow { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.notice, .panel, .summary article, .auth-card { border: 1px solid #dfe3eb; border-radius: 0.75rem; background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / 4%); }
.notice { display: flex; gap: 0.65rem; padding: 0.9rem 1rem; margin-bottom: 1rem; color: #7a2e0e; background: #fff8eb; border-color: #fedf89; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.section-heading { grid-column: 1 / -1; margin: 0; }
.summary article { display: grid; gap: 0.45rem; padding: 0.9rem; }
.summary span, .muted { color: var(--muted); font-size: 0.8125rem; }
.summary strong { overflow-wrap: anywhere; }
.panel { padding: 1rem; margin-bottom: 1rem; }
.detail-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 0.55rem 1rem; margin: 0; }
.detail-facts dt { color: #475467; font-size: 0.875rem; font-weight: 700; }
.detail-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.filters fieldset, .auth-card fieldset, .panel fieldset { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; min-width: 0; padding: 0; margin: 0; border: 0; }
legend { width: 100%; padding: 0; margin-bottom: 0.5rem; color: var(--text); font-weight: 700; }
.filters label, .form-field { display: grid; gap: 0.35rem; color: #344054; font-size: 0.875rem; font-weight: 600; }
button, input, select, .control { min-height: 44px; max-width: 100%; border: 1px solid #98a2b3; border-radius: 0.45rem; padding: 0.55rem 0.7rem; color: var(--text); background: #fff; font: inherit; }
input { min-width: min(14rem, 100%); }
.button { border-color: #9a3412; color: #fff; background: #9a3412; font-weight: 700; cursor: pointer; }
.button:hover { border-color: #7c2d12; background: #7c2d12; }
.button.secondary { color: #344054; border-color: #98a2b3; background: #fff; }
.button.secondary:hover { color: #172033; background: #f2f4f7; }
.table-panel { padding: 0; }
.table-heading { padding: 1rem 1rem 0; margin-bottom: 0.75rem; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
table { width: 100%; min-width: 48.75rem; border-collapse: collapse; }
caption { padding: 0.75rem 1rem; color: var(--muted); text-align: left; caption-side: top; }
th, td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid #eaecf0; vertical-align: middle; }
th { color: #475467; background: #f9fafb; font-size: 0.8125rem; font-weight: 700; }
tbody tr:hover { background: #f8fbff; }
.product-cell { display: flex; align-items: center; gap: 0.65rem; min-width: 17.5rem; }
.product-cell a { font-weight: 700; overflow-wrap: anywhere; }
.thumbnail { flex: 0 0 auto; width: 2.625rem; height: 2.625rem; border-radius: 0.45rem; object-fit: cover; background: #e7edf8; }
.fallback { display: grid; place-items: center; color: #475467; font-size: 0.6875rem; }
.tag { display: inline-block; padding: 0.18rem 0.5rem; border-radius: 999px; color: #344054; background: #eaecf0; font-size: 0.75rem; font-weight: 700; line-height: 1.4; }
.demo-badge { color: #475467; background: #eaecf0; }
.badge-success { color: var(--success); background: #d1fadf; }
.badge-warning { color: var(--warning); background: #fedf89; }
.badge-danger { color: var(--danger); background: #fee4e2; }
.badge-neutral { color: #344054; background: #eaecf0; }
.empty-state { padding: 3rem 1.25rem; text-align: center; }
.empty-state h2 { margin: 0; font-size: 1.125rem; }
.empty-state p { color: var(--muted); }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-main { width: min(100%, 28rem); }
.auth-card { padding: 1.5rem; }
.auth-card h1 { margin-bottom: 1rem; }
.auth-card form { display: grid; gap: 1rem; }
.auth-card fieldset { display: grid; align-items: stretch; }
.form-errors, .field-errors { padding: 0.65rem 0.75rem; color: #8a1c17; background: #fee4e2; border-radius: 0.4rem; }
.field-errors ul, .form-errors ul { padding-left: 1.25rem; margin: 0; }
.auth-card input { width: 100%; min-width: 0; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { padding: 0.9rem 1rem; }
  .brand { margin: 0 0 0.7rem; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: 0.15rem; }
  .nav-link { flex: 0 0 auto; white-space: nowrap; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll { overflow-x: auto; }
}

@media (max-width: 700px) {
  .detail-facts { grid-template-columns: max-content minmax(0, 1fr); gap: 0.45rem 0.75rem; }
}

@media (max-width: 420px) {
  .content { padding: 1rem; }
  .topbar, .notice { align-items: flex-start; flex-direction: column; }
  .summary { grid-template-columns: 1fr; }
  .topbar form { width: 100%; }
  .topbar .button { width: 100%; }
  .filters label, .filters select, .filters input, .filters .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
