/* 百德化学ERP 网页版：品牌主色深蓝 #123C7A，手机与电脑通用 */
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f2f4f7; color: #222; font-size: 15px; }
a { color: #123c7a; text-decoration: none; }
button { cursor: pointer; }

/* 登录 / 设置页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(180deg, #123c7a 0%, #0d2c5c 100%); }
.auth-card { background: #fff; border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; color: #123c7a; text-align: center; }
.auth-card .sub { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }
.auth-card label { display: block; color: #666; font-size: 14px; margin: 12px 0 6px; }
.auth-card input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.auth-card .hint { color: #999; font-size: 12px; margin-top: 16px; line-height: 1.6; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #123c7a; color: #fff; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 20px 16px 12px; font-size: 19px; font-weight: bold; }
.sidebar .brand small { display: block; font-size: 11px; font-weight: normal; opacity: .7; margin-top: 2px; letter-spacing: 2px; }
.sidebar nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar nav a { display: block; padding: 11px 18px; color: rgba(255,255,255,.85); font-size: 15px; }
.sidebar nav a.active { background: rgba(255,255,255,.16); color: #fff; border-left: 3px solid #fff; }
.sidebar .me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.2); font-size: 13px; line-height: 1.7; }
.sidebar .me button { background: none; border: 1px solid rgba(255,255,255,.6); color: #fff; border-radius: 6px; padding: 4px 10px; font-size: 12px; margin-right: 6px; margin-top: 4px; }
.main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.main h2 { margin: 4px 0 16px; font-size: 20px; color: #123c7a; }
.main h2 small { font-size: 13px; color: #999; font-weight: normal; margin-left: 8px; }

/* 卡片与表格 */
.card { background: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(18,60,122,.06); }
.card h3 { margin: 0 0 12px; font-size: 16px; color: #123c7a; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 10px rgba(18,60,122,.06); }
.stat .label { color: #666; font-size: 13px; }
.stat .num { font-size: 24px; font-weight: bold; margin-top: 6px; }
.stat .num.red { color: #c8102e; }
.stat .num.green { color: #137333; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
th { color: #666; font-weight: normal; background: #fafbfc; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fc; }
.money { color: #c8102e; font-weight: bold; }
.profit-neg { color: #c8102e; }
.profit-pos { color: #137333; }
.muted { color: #999; font-size: 13px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.tag-green { background: #e6f4ea; color: #137333; }
.tag-red { background: #fce8e6; color: #c8102e; }
.tag-blue { background: #e8f0fe; color: #123c7a; }
.tag-grey { background: #f1f3f4; color: #666; }
.tag-orange { background: #fef7e0; color: #b06000; }
.empty { text-align: center; color: #999; padding: 36px 0; }

/* 按钮与表单 */
.btn { background: #123c7a; color: #fff; border: none; border-radius: 8px; font-size: 14px; padding: 9px 16px; }
.btn:hover { background: #0d2c5c; }
.btn-plain { background: #fff; color: #123c7a; border: 1px solid #123c7a; border-radius: 8px; font-size: 14px; padding: 8px 14px; }
.btn-danger { background: #c8102e; color: #fff; border: none; border-radius: 8px; font-size: 14px; padding: 8px 14px; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: default; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.toolbar .spacer { flex: 1; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; color: #666; font-size: 13px; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.form-row .req::after { content: ' *'; color: #c8102e; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.calc-line { background: #f7f9fc; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.8; margin-top: 4px; }

/* 弹窗 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; padding: 22px; }
.modal h3 { margin: 0 0 16px; color: #123c7a; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast { background: #333; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; margin-top: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.toast.err { background: #c8102e; }

/* 手机适配 */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar .brand { padding: 12px 16px 6px; font-size: 17px; }
  .sidebar nav { display: flex; overflow-x: auto; padding: 0 6px 6px; }
  .sidebar nav a { white-space: nowrap; padding: 8px 12px; border-left: none !important; border-radius: 8px; }
  .sidebar nav a.active { background: rgba(255,255,255,.2); }
  .sidebar .me { padding: 8px 16px; }
  .main { padding: 14px 12px 50px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 20px 10px; }
}
