:root {
  --bg: oklch(0.968 0.004 250);
  --surface: oklch(1 0 0);
  --sidebar: oklch(0.205 0.03 230);
  --sidebar-muted: oklch(0.78 0.02 230);
  --ink: oklch(0.22 0.02 235);
  --muted: oklch(0.49 0.02 235);
  --line: oklch(0.88 0.008 235);
  --primary: oklch(0.591 0.172 24);
  --primary-dark: oklch(0.48 0.15 24);
  --accent: oklch(0.55 0.12 175);
  --success-soft: oklch(0.94 0.04 175);
  --warning-soft: oklch(0.95 0.05 75);
  --danger-soft: oklch(0.95 0.045 25);
  font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-shell { width: min(920px, 100%); display: grid; grid-template-columns: 1.05fr 0.95fr; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.login-intro { padding: 56px; color: white; background: var(--sidebar); }
.login-brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--primary); font-size: 22px; font-weight: 800; }
.product-name { margin: 24px 0 10px; font-weight: 700; }
.login-intro h1 { margin: 0 0 18px; font-size: 34px; line-height: 1.2; letter-spacing: -0.025em; text-wrap: balance; }
.login-intro > p:not(.product-name) { max-width: 46ch; color: oklch(0.84 0.014 230); line-height: 1.75; }
.login-intro ul { display: grid; gap: 12px; margin: 26px 0 0; padding: 20px 0 0; border-top: 1px solid oklch(1 0 0 / 0.18); list-style: none; }
.login-intro li::before { content: "✓"; margin-right: 10px; color: oklch(0.76 0.13 155); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 56px; }
.login-chip { display: inline-flex; padding: 6px 10px; border-radius: 999px; color: oklch(0.42 0.12 35); background: oklch(0.94 0.025 35); font-size: 12px; font-weight: 700; }
.login-panel h2 { margin: 18px 0 6px; font-size: 24px; }
.login-panel p { color: var(--muted); line-height: 1.6; }
.login-panel form { display: grid; gap: 17px; margin-top: 22px; }
.login-panel label { display: grid; gap: 8px; font-weight: 650; }
.login-panel input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; outline: none; }
.login-panel input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.88 0.04 24); }
.login-panel form button { margin-top: 3px; padding: 12px; border: 0; border-radius: 8px; color: white; background: var(--primary); font-weight: 700; }
.login-panel form button:hover { background: var(--primary-dark); }
.login-note { margin-top: 18px; font-size: 12px; }
.login-alert { margin-top: 18px; padding: 10px 12px; border-radius: 8px; color: oklch(0.42 0.15 25); background: var(--danger-soft); }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 224px; flex: 0 0 224px; min-height: 100vh; padding: 22px 14px; background: var(--sidebar); color: white; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 8px 8px 24px; border-bottom: 1px solid oklch(1 0 0 / 0.14); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--primary); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; font-size: 11px; color: var(--sidebar-muted); }
nav { margin-top: 18px; display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 9px; color: oklch(0.91 0.01 230); background: transparent; text-align: left; }
.nav-item:hover, .nav-item:focus-visible { background: oklch(1 0 0 / 0.08); outline: none; }
.nav-item.active { background: oklch(0.91 0.035 220); color: oklch(0.27 0.06 230); font-weight: 700; }
.nav-item span { width: 18px; text-align: center; }
.sidebar-status { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 9px 2px; color: var(--sidebar-muted); font-size: 12px; border-top: 1px solid oklch(1 0 0 / 0.14); }
.sidebar-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.sidebar-status form { margin-left: auto; }
.sidebar-status button { padding: 0; border: 0; color: var(--sidebar-muted); background: transparent; text-decoration: underline; text-underline-offset: 3px; }
main { flex: 1; min-width: 0; }
.topbar { min-height: 104px; padding: 20px 28px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.breadcrumb { margin: 0 0 7px; color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.sync-copy { text-align: right; }
.sync-copy span, .sync-copy small { display: block; }
.sync-copy span { font-size: 13px; font-weight: 700; }
.sync-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.primary-button { padding: 9px 15px; border: 0; border-radius: 8px; color: white; background: var(--primary); font-weight: 700; }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:focus-visible, .text-button:focus-visible, input:focus-visible { outline: 3px solid oklch(0.75 0.1 24 / 0.45); outline-offset: 2px; }
.notice { margin: 20px 28px 0; padding: 12px 15px; border-radius: 8px; font-size: 13px; background: var(--warning-soft); color: oklch(0.36 0.07 58); display: none; }
.notice.visible { display: block; }
.notice.error { background: var(--danger-soft); color: oklch(0.42 0.13 24); }
.view { display: none; padding: 18px 28px 36px; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.metrics > div { padding: 20px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border-right: 0; }
.metrics span, .metrics small, .metrics strong { display: block; }
.metrics span { font-size: 13px; color: var(--muted); }
.metrics strong { margin: 8px 0 4px; font-size: 28px; line-height: 1; }
.metrics small { font-size: 11px; color: var(--muted); }
.inventory-totals { margin-top: 12px; }
.content-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel-heading { min-height: 76px; padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: transparent; color: oklch(0.43 0.11 225); font-size: 12px; font-weight: 700; }
.status-panel dl { margin: 0; padding: 8px 20px; }
.status-panel dl div { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.status-panel dl div:last-child { border-bottom: 0; }
.status-panel dt { color: var(--muted); font-size: 13px; }
.status-panel dd { margin: 0; font-size: 13px; font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--accent); }
.muted-dot { background: var(--muted); }
.toolbar { align-items: center; }
.search { width: min(360px, 46vw); display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.search input { width: 100%; border: 0; outline: none; background: transparent; color: var(--ink); }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 13px; }
th { padding: 11px 20px; background: oklch(0.985 0.002 250); color: var(--muted); text-align: left; font-size: 11px; font-weight: 600; border-bottom: 1px solid var(--line); }
td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: oklch(0.985 0.004 250); }
.product-cell strong, .product-cell small { display: block; }
.product-cell small { margin-top: 4px; color: var(--muted); }
.quantity { font-variant-numeric: tabular-nums; font-weight: 750; }
.quantity.danger { color: oklch(0.5 0.18 25); }
.quantity.warning { color: oklch(0.52 0.12 65); }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.normal { background: var(--success-soft); color: oklch(0.38 0.1 175); }
.badge.warning { background: var(--warning-soft); color: oklch(0.4 0.1 65); }
.badge.danger { background: var(--danger-soft); color: oklch(0.45 0.15 25); }
.empty-row td { height: 156px; text-align: center; color: var(--muted); }
.empty-row strong, .empty-row small { display: block; }
.empty-row strong { color: var(--ink); margin-bottom: 6px; }
.change-list { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics > div:nth-child(2) { border-right: 0; }
  .metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .login-body { padding: 18px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro, .login-panel { padding: 32px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; min-height: auto; height: auto; padding: 12px 14px; }
  .brand { padding: 4px 6px 12px; }
  nav { margin-top: 10px; display: flex; overflow-x: auto; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 9px 12px; }
  .sidebar-status { display: none; }
  .topbar { padding: 16px 18px; min-height: 88px; }
  .topbar-actions { gap: 9px; }
  .sync-copy { display: none; }
  .notice { margin: 14px 16px 0; }
  .view { padding: 14px 16px 28px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics > div { padding: 16px; }
  .panel-heading { padding: 14px 16px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  th, td { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
