:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dbe2ea;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #16745f;
  --brand-dark: #0f5d4c;
  --danger: #b42318;
  --warning: #a15c07;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
button:hover { background: var(--brand-dark); }
button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
button.secondary:hover { background: #f3f6f9; }
button.danger { background: var(--danger); }
button.small { padding: 5px 8px; font-size: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 76px; resize: vertical; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #536170; font-weight: 600; background: #f8fafc; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eff6f3, #edf2f8);
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 6px; font-size: 26px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: #4b5563; font-size: 13px; }
.app-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: #102820;
  color: #dce7e2;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-size: 20px; font-weight: 700; margin: 4px 8px 18px; }
.nav { display: grid; gap: 5px; }
.nav button {
  text-align: left;
  background: transparent;
  color: #dce7e2;
  border-color: transparent;
  padding: 10px 12px;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,.11); }
.main { min-width: 0; }
.topbar {
  height: 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.content { padding: 22px; max-width: 1480px; }
.page-title { margin: 0; font-size: 24px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-header h2 { font-size: 16px; margin: 0; }
.panel-body { padding: 16px; overflow-x: auto; }
.metric { padding: 18px; }
.metric .label { color: var(--muted); }
.metric .value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: 220px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}
.form-grid .wide { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef7f4;
  color: var(--brand-dark);
  font-size: 12px;
}
.badge.warn { background: #fff6e7; color: var(--warning); }
.badge.off { background: #f1f5f9; color: #64748b; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr);
  gap: 16px;
}
.cart-total {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cart-total strong { font-size: 24px; }
.notice {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: none;
}
.notice.show { display: block; }
.notice.error { background: #fee4e2; color: var(--danger); }
.notice.ok { background: #dcfae6; color: #067647; }
.right { text-align: right; }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-3, .cols-4, .split { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .toolbar input, .toolbar select { width: 100%; }
}
