:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --nav: #121826;
  --nav-soft: #1f2937;
  --blue: #2563eb;
  --green: #059669;
  --amber: #f59e0b;
  --red: #dc2626;
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar { background: var(--nav); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand strong { display: block; font-size: 18px; }
.brand small { color: #aab4c5; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: #2563eb; font-weight: 800; }
.brand-mark.large { width: 58px; height: 58px; font-size: 22px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { padding: 11px 12px; border-radius: 8px; color: #d8dee9; display: flex; flex-direction: column; gap: 2px; }
.nav a:hover, .nav a.active { background: var(--nav-soft); color: #fff; }
.nav a small { color: #94a3b8; font-size: 12px; }
.nav-group { color: #7dd3fc; font-size: 12px; padding: 14px 12px 4px; }
.logout { margin-top: auto; }
.logout button, .button, .primary, .text-button { border: 0; border-radius: 8px; cursor: pointer; }
.logout button { width: 100%; padding: 11px; color: #fff; background: rgba(255,255,255,.1); }
.main { padding: 24px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 26px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.menu-toggle { display: none; width: 42px; height: 42px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 10px 28px rgba(15,23,42,.06); }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-size: 18px; }
.filters, .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
.checkbox { flex-direction: row; align-items: center; color: var(--ink); }
.checkbox input { width: auto; }
.table-check { margin: 0; }
.primary { background: var(--blue); color: #fff; padding: 11px 16px; font-weight: 700; }
.button { background: #e8eef8; color: #172033; padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center; }
.text-button, .text-link { color: var(--blue); background: transparent; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.batch-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 14px; }
.batch-bar label { margin-bottom: 0; min-width: 180px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metrics.order-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metrics article { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.metrics span, .metrics small { display: block; color: var(--muted); }
.metrics strong { display: block; font-size: 26px; margin: 8px 0; }
.rank-list { display: grid; gap: 10px; }
.rank-list.columns { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.rank-list div, .mini-list div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.rank-list small, .mini-list span { color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: var(--muted); font-size: 13px; background: #f8fafc; }
.data-table td small { display: block; color: var(--muted); margin-top: 4px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; background: #eef2ff; color: #3730a3; padding: 4px 9px; font-size: 12px; margin: 2px 4px 2px 0; white-space: nowrap; }
.pay-unpaid { background: #fee2e2; color: #991b1b; }
.pay-partial { background: #fef3c7; color: #92400e; }
.pay-paid { background: #dcfce7; color: #166534; }
.mobile-list { display: none; }
.order-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.order-card header, .order-card footer { display: flex; justify-content: space-between; gap: 12px; }
.order-card p { color: var(--muted); }
.split-preview { display: grid; gap: 12px; margin-bottom: 18px; }
.split-preview div { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.split-preview span { color: var(--muted); }
.split-preview strong { display: block; font-size: 24px; margin-top: 6px; }
.stack { display: grid; gap: 10px; margin-bottom: 14px; }
.muted { color: var(--muted); line-height: 1.8; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #101827 0%, #243b5f 48%, #0f766e 100%); }
.login-panel { width: min(960px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: stretch; }
.login-copy { color: #fff; padding: 40px 22px; display: flex; flex-direction: column; justify-content: center; }
.login-copy h1 { font-size: 40px; margin: 22px 0 12px; }
.login-copy p { color: #dbeafe; font-size: 18px; line-height: 1.8; }
.login-card { background: #fff; border-radius: 8px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.login-card h2 { margin-top: 0; }
.alert { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.toast { position: fixed; top: 18px; right: 18px; z-index: 50; background: #dcfce7; color: #166534; border: 1px solid #86efac; border-radius: 8px; padding: 12px 16px; box-shadow: 0 16px 38px rgba(15,23,42,.18); }
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: inline-grid; place-items: center; }
  .main { padding: 16px; }
  .grid.two, .login-panel { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar h1 { font-size: 21px; }
  .metrics { grid-template-columns: 1fr; }
  .table-panel { overflow: hidden; }
  .data-table { display: none; }
  .mobile-list { display: block; }
  .login-copy { padding: 12px 4px; }
  .login-copy h1 { font-size: 30px; }
}
