* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; background: #f4f6f9; color: #333; font-size: 14px; }
a { text-decoration: none; color: inherit; }

/* 顶栏 */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 52px; background: #1f2937; color: #fff;
          display: flex; align-items: center; justify-content: space-between; padding: 0 20px; z-index: 100; }
.topbar .brand { font-size: 17px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; }

/* 侧栏 */
.sidebar { position: fixed; top: 52px; bottom: 0; left: 0; width: 160px; background: #111827; padding-top: 10px; }
.sidebar a { display: block; color: #cbd5e1; padding: 12px 20px; }
.sidebar a:hover { background: #1f2937; color: #fff; }
.sidebar a.active { background: #2563eb; color: #fff; }

/* 内容区 */
.content { margin: 52px 0 0 160px; padding: 20px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { font-size: 20px; }

/* 面板 / 卡片 */
.panel { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.panel h3 { margin-bottom: 12px; font-size: 15px; border-left: 3px solid #2563eb; padding-left: 8px; }
.panel h4 { margin: 14px 0 8px; font-size: 14px; color: #555; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: #fff; border-radius: 8px; padding: 18px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card .num { font-size: 24px; font-weight: 700; color: #2563eb; margin-bottom: 6px; }
.card .label { color: #777; font-size: 13px; }
.card-warn { border: 1px solid #f59e0b; }
.card-warn .num { color: #f59e0b; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border: 1px solid #e5e7eb; padding: 8px 10px; text-align: left; }
.table th { background: #f3f4f6; font-weight: 600; white-space: nowrap; }
.table tr:hover td { background: #fafbfc; }
.empty { text-align: center; color: #999; padding: 24px !important; }
.low { color: #dc2626; font-weight: 700; }
.pos { color: #16a34a; }
.neg { color: #dc2626; }
.tag-warn { background: #fef3c7; color: #b45309; padding: 1px 8px; border-radius: 4px; font-size: 12px; }

/* 按钮 */
.btn { display: inline-block; background: #fff; border: 1px solid #d1d5db; color: #333;
       padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }

/* 表单 */
label { display: block; margin-bottom: 12px; font-size: 13px; color: #555; }
label input, label select { margin-top: 4px; }
input, select, button { font-family: inherit; font-size: 13px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
}
input:focus, select:focus { outline: none; border-color: #2563eb; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 18px; }
.form-actions { grid-column: 1 / -1; margin-top: 8px; display: flex; gap: 10px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form input[type=text] { width: 200px; }
.hidden { display: none !important; }
.total-line { margin: 12px 0; font-weight: 600; font-size: 15px; }
.total-line span { color: #dc2626; font-size: 18px; }
table td input[type=number] { width: 100px; }
table td select { min-width: 220px; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* 登录页 */
.login-body { background: #111827; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; border-radius: 10px; padding: 34px 38px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.login-box h1 { text-align: center; margin-bottom: 20px; font-size: 22px; }
.login-box label input { width: 100%; }
.login-box .btn-primary { margin-top: 8px; }
.hint { margin-top: 14px; text-align: center; color: #999; font-size: 12px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { margin-left: 0; }
  .grid2 { grid-template-columns: 1fr; }
}
