/* 撸货报单管理系统 - 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; background: #f1f5f9; color: #1e293b; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }
input, select, textarea { font-family: inherit; }

/* 登录页 */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #38bdf8 100%); }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(2, 6, 23, .35); }
.login-logo { font-size: 22px; font-weight: 700; color: #1e293b; text-align: center; letter-spacing: 1px; }
.login-sub { color: #64748b; text-align: center; margin: 8px 0 24px; font-size: 13px; }
.login-card .input { margin-bottom: 14px; }
.login-err { color: #dc2626; font-size: 13px; min-height: 18px; margin-bottom: 6px; text-align: center; }

/* 布局 */
#app { display: flex; min-height: 100vh; }
.sidebar { width: 208px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; }
.brand { padding: 18px 16px; font-size: 17px; font-weight: 700; color: #fff; border-bottom: 1px solid #1e293b; }
.brand span { color: #38bdf8; }
.sidebar nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar nav a { display: block; padding: 10px 14px; border-radius: 8px; color: #cbd5e1; cursor: pointer; margin-bottom: 2px; transition: all .15s; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: #2563eb; color: #fff; font-weight: 600; }
.side-foot { padding: 12px 16px; font-size: 12px; color: #475569; border-top: 1px solid #1e293b; }
.main { flex: 1; margin-left: 208px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: #fff; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 10; }
.top-title { font-size: 16px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #334155; }
.role-badge { background: #eff6ff; color: #2563eb; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.content { padding: 20px 24px; flex: 1; }

/* 卡片与表格 */
.card { background: #fff; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.card h3 { font-size: 15px; margin-bottom: 12px; color: #0f172a; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.stat-card .num { font-size: 24px; font-weight: 700; color: #0f172a; margin-top: 6px; }
.stat-card .label { color: #64748b; font-size: 13px; }
.stat-card.blue .num { color: #2563eb; } .stat-card.green .num { color: #16a34a; } .stat-card.orange .num { color: #ea580c; } .stat-card.red .num { color: #dc2626; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 10px; background: #f8fafc; color: #475569; font-weight: 600; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:hover td { background: #f8fafc; }
.empty { text-align: center; color: #94a3b8; padding: 30px 0; }

/* 按钮 */
.btn { display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; color: #334155; cursor: pointer; font-size: 13px; transition: all .15s; }
.btn:hover { border-color: #2563eb; color: #2563eb; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-warn { background: #ea580c; border-color: #ea580c; color: #fff; }
.btn-warn:hover { background: #c2410c; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }

/* 表单 */
.input, .select, .textarea { width: 100%; padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; outline: none; background: #fff; }
.input:focus, .select:focus, .textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; }
.field label { display: block; font-size: 12px; color: #64748b; margin-bottom: 5px; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; }
.filter-bar .grow { flex: 1; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.red { background: #fee2e2; color: #b91c1c; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 100%; padding: 22px 24px; box-shadow: 0 20px 60px rgba(2, 6, 23, .3); }
.modal.wide { width: 860px; }
.modal h3 { margin-bottom: 16px; font-size: 16px; }
.modal-close { float: right; cursor: pointer; color: #94a3b8; font-size: 20px; line-height: 1; }
.modal-close:hover { color: #334155; }

/* 提示 */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 10px 22px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 999; box-shadow: 0 10px 30px rgba(2, 6, 23, .25); }
.toast-ok { background: #16a34a; }
.toast-err { background: #dc2626; }

/* 工具条 */
.toolbar { display: flex; gap: 8px; }
.prod-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid #e2e8f0; display: block; }
.gray { color: #94a3b8; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: #64748b; font-size: 13px; }
.pager .btn { min-width: 60px; }

/* 详情网格 */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.detail-grid .item { padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.detail-grid .item b { display: block; font-size: 12px; color: #94a3b8; font-weight: 400; margin-bottom: 2px; }
.detail-grid .item span { color: #1e293b; word-break: break-all; }

/* 移动端适配 */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .brand { font-size: 0; }
  .sidebar .brand::after { content: "撸货"; font-size: 16px; }
  .sidebar nav a { text-align: center; padding: 10px 4px; font-size: 12px; }
  .side-foot { display: none; }
  .main { margin-left: 60px; }
  .content { padding: 14px 12px; }
  .form-row .field { min-width: 100%; }
}

/* 汉堡菜单按钮（手机端显示） */
.menu-btn { display: none; background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: #334155; padding: 0 6px 0 0; }
.menu-btn:active { opacity: .6; }
.mask { display: none; }
.top-title { display: flex; align-items: center; gap: 8px; }

/* 手机端（≤768px） */
@media (max-width: 768px) {
  .menu-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 230px; box-shadow: none; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(2, 6, 23, .4); }
  body.sidebar-open .mask { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 19; }
  .sidebar nav a { text-align: left; padding: 12px 16px; font-size: 14px; }
  .sidebar .brand { font-size: 16px; }
  .sidebar .brand::after { content: ""; }
  .sidebar .brand span { font-size: 13px; }
  .side-foot { display: block; }
  .main { margin-left: 0; }
  .content { padding: 12px 10px; }
  .topbar { padding: 10px 12px; }
  .top-title { font-size: 15px; }
  .top-right { gap: 6px; }
  .top-right > span:first-child { display: none; }
  .top-right .btn-sm { padding: 6px 10px; font-size: 13px; }
  .card { padding: 12px; border-radius: 8px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .num { font-size: 20px; }
  .filter-bar { gap: 8px; }
  .filter-bar .input, .filter-bar .select { width: 100%; min-width: 0; flex: 1 1 100%; }
  .filter-bar .btn { min-height: 38px; }
  .btn { padding: 9px 14px; min-height: 38px; font-size: 14px; }
  .btn-sm { padding: 6px 10px; min-height: 34px; font-size: 13px; }
  .table-wrap { margin: 0 -10px; padding: 0 10px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px 8px; }
  .modal { width: 100%; padding: 16px; }
  .modal.wide { width: 100%; }
  .modal-mask { padding: 12px 10px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; }
  .toolbar { flex-wrap: wrap; }
  .pager { flex-wrap: wrap; gap: 6px; }
  .login-card { width: calc(100% - 32px); padding: 28px 22px; }
  .login-card .btn-block { padding: 12px; font-size: 16px; min-height: 46px; }
}
