/* ============ 全局 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2e7d32; --primary-dark: #1b5e20; --primary-light: #e8f5e9;
  --accent: #f9a825; --danger: #e53935; --info: #1e88e5;
  --text: #263238; --text-sub: #78909c; --border: #e0e0e0;
  --bg: #f4f6f5; --card: #ffffff; --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; transition: .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-plain { background: #eceff1; color: var(--text); }
.btn-plain:hover { background: #dfe3e6; }
.btn-warn { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.btn-danger { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; letter-spacing: 6px; }
.btn-link { background: none; border: none; color: var(--info); padding: 2px 4px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ============ 入口页 ============ */
.entry-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.entry-bg { position: fixed; inset: 0; background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 45%, #66bb6a 100%); }
.entry-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.15), transparent 40%), radial-gradient(circle at 15% 85%, rgba(0,0,0,.18), transparent 45%); }
.entry-wrap { position: relative; z-index: 1; text-align: center; padding: 30px 16px; width: 100%; max-width: 860px; }
.logo-badge { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: linear-gradient(145deg, #f9a825, #f57f17); color: #fff; font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.entry-logo h1 { color: #fff; font-size: 30px; letter-spacing: 4px; }
.entry-logo p { color: rgba(255,255,255,.75); margin-top: 6px; font-size: 13px; letter-spacing: 1px; }
.entry-tip { color: rgba(255,255,255,.9); margin: 34px 0 18px; font-size: 15px; letter-spacing: 2px; }
.entry-cards { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.entry-card { background: rgba(255,255,255,.96); border-radius: 16px; padding: 32px 26px; width: 300px; box-shadow: 0 12px 32px rgba(0,0,0,.22); transition: .25s; }
.entry-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(0,0,0,.3); }
.entry-icon { color: var(--primary); margin-bottom: 14px; }
.entry-card h2 { font-size: 20px; margin-bottom: 8px; }
.entry-card p { color: var(--text-sub); font-size: 13px; line-height: 1.8; }
.entry-btn { display: inline-block; margin-top: 18px; background: var(--primary); color: #fff; padding: 9px 30px; border-radius: 22px; font-size: 14px; letter-spacing: 2px; }
.entry-card:hover .entry-btn { background: var(--primary-dark); }
.entry-foot { margin-top: 36px; color: rgba(255,255,255,.6); font-size: 12px; letter-spacing: 1px; }

/* ============ 登录页 ============ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1b5e20, #388e3c 60%, #81c784); }
.login-card { width: 380px; max-width: calc(100vw - 32px); background: #fff; border-radius: 16px; padding: 36px 34px 26px; box-shadow: 0 16px 44px rgba(0,0,0,.28); }
.login-head { text-align: center; margin-bottom: 26px; }
.login-head .logo-badge { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; margin-bottom: 12px; }
.login-head h1 { font-size: 21px; letter-spacing: 2px; }
.login-head p { color: var(--text-sub); font-size: 13px; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 2px 0 6px; text-align: center; }
.login-foot { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12px; color: var(--text-sub); }
.login-foot a { color: var(--primary); }

/* ============ 表单 ============ */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 6px; color: var(--text-sub); font-size: 13px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; transition: .2s; background: #fff; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,.12); }
.form-row { display: flex; gap: 12px; }
.form-row .form-item { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ============ 弹窗 / 提示 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 480px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.3); animation: pop .18s ease; }
.modal-lg { width: 640px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 22px; color: var(--text-sub); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--border); }
.confirm-text { font-size: 14px; line-height: 1.7; }

#toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #323232; color: #fff; padding: 9px 20px; border-radius: 20px; font-size: 13px; opacity: 0; transform: translateY(-8px); transition: .25s; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--primary); }
.toast-error { background: var(--danger); }

/* ============ 电脑版布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: linear-gradient(180deg, #1b5e20, #2e7d32); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 10; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.side-logo .logo-badge { width: 38px; height: 38px; font-size: 20px; border-radius: 10px; margin: 0; box-shadow: none; }
.side-logo h1 { font-size: 15px; letter-spacing: 1px; }
.side-logo p { font-size: 10px; color: rgba(255,255,255,.6); margin-top: 2px; }
.side-menu { flex: 1; padding: 12px 10px; overflow-y: auto; }
.menu-group { font-size: 11px; color: rgba(255,255,255,.45); padding: 12px 10px 6px; letter-spacing: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; cursor: pointer; color: rgba(255,255,255,.82); font-size: 14px; transition: .15s; }
.menu-item svg { width: 18px; height: 18px; flex: none; }
.menu-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; color: rgba(255,255,255,.55); }

.main { flex: 1; margin-left: 216px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 9; }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; color: var(--text-sub); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.content { padding: 22px 24px 40px; flex: 1; }

/* 卡片与统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-info p { color: var(--text-sub); font-size: 13px; }
.stat-info h3 { font-size: 22px; margin-top: 3px; }
.stat-info h3 small { font-size: 12px; color: var(--text-sub); font-weight: 400; margin-left: 3px; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.panel-head h3 { font-size: 15px; }
.panel-head h3::before { content: ""; display: inline-block; width: 4px; height: 14px; background: var(--primary); border-radius: 2px; margin-right: 8px; vertical-align: -1px; }
.panel-body { padding: 18px 20px; }
.panel-tools { display: flex; gap: 10px; align-items: center; }
.panel-tools input, .panel-tools select { padding: 7px 11px; border: 1px solid var(--border); border-radius: 6px; outline: none; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
.tb th { background: #fafbfa; color: var(--text-sub); font-weight: 500; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tb td { padding: 11px 12px; border-bottom: 1px solid #f0f2f1; white-space: nowrap; }
.tb tr:hover td { background: #f7faf7; }
.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
.tb-empty { text-align: center; color: var(--text-sub); padding: 34px 0 !important; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; }
.st-warn { background: #fff8e1; color: #f57f17; }
.st-info { background: #e3f2fd; color: #1565c0; }
.st-ok { background: var(--primary-light); color: var(--primary-dark); }
.st-done { background: #ede7f6; color: #5e35b1; }
.grade { font-weight: 600; color: var(--accent); }

/* 进度条 */
.progress { height: 8px; background: #eceff1; border-radius: 4px; overflow: hidden; min-width: 90px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #66bb6a, var(--primary)); border-radius: 4px; }
.progress.warn i { background: linear-gradient(90deg, #ffb300, #f57f17); }
.progress.danger i { background: linear-gradient(90deg, #e57373, var(--danger)); }

.quick-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed #eee; font-size: 13px; }
.quick-list li:last-child { border-bottom: none; }
.quick-list .q-title { color: var(--text); }
.quick-list .q-sub { color: var(--text-sub); font-size: 12px; margin-top: 2px; }

/* 报表 */
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--text-sub); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13px; }
.rank-list .rank-no { width: 22px; height: 22px; border-radius: 50%; background: #eceff1; color: var(--text-sub); display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.rank-list li:nth-child(1) .rank-no { background: #ffe082; color: #f57f17; }
.rank-list li:nth-child(2) .rank-no { background: #e0e0e0; color: #616161; }
.rank-list li:nth-child(3) .rank-no { background: #ffccbc; color: #e64a19; }
.rank-list .rank-bar { flex: 1; }
.rank-list .rank-val { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }

/* 打印磅单 */
.ticket-preview { border: 1px dashed var(--border); border-radius: 8px; padding: 18px; background: #fcfcfc; }
.ticket-preview h4 { text-align: center; margin-bottom: 12px; font-size: 16px; }
.ticket-preview table { width: 100%; font-size: 13px; border-collapse: collapse; }
.ticket-preview td { padding: 6px 4px; border-bottom: 1px dotted #ddd; }
.ticket-preview td:first-child { color: var(--text-sub); width: 90px; }

/* ============ 手机版 ============ */
.m-page { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; box-shadow: 0 0 30px rgba(0,0,0,.08); }
.m-header { background: linear-gradient(135deg, #1b5e20, #388e3c); color: #fff; padding: 16px 16px 46px; position: sticky; top: 0; z-index: 5; }
.m-header-row { display: flex; justify-content: space-between; align-items: center; }
.m-header h1 { font-size: 17px; }
.m-header p { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 3px; }
.m-header .m-logout { background: rgba(255,255,255,.16); border: none; color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 14px; }
.m-content { flex: 1; padding: 0 12px 76px; margin-top: -32px; position: relative; z-index: 2; }
.m-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.m-card-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.m-card-title .more { font-size: 12px; color: var(--text-sub); font-weight: 400; }
.m-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.m-stat { text-align: center; padding: 12px 4px; border-radius: 10px; background: var(--primary-light); }
.m-stat:nth-child(2) { background: #fff8e1; }
.m-stat:nth-child(3) { background: #e3f2fd; }
.m-stat p { font-size: 11px; color: var(--text-sub); }
.m-stat h3 { font-size: 16px; margin-top: 4px; }
.m-stat h3 small { font-size: 10px; color: var(--text-sub); font-weight: 400; }

.m-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid #f0f2f1; }
.m-list-item:last-child { border-bottom: none; }
.m-item-main { min-width: 0; }
.m-item-title { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-item-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.m-item-right { text-align: right; flex: none; margin-left: 10px; }
.m-item-right .amount { font-size: 15px; font-weight: 700; color: #e65100; font-variant-numeric: tabular-nums; }
.m-item-right .sub { font-size: 11px; color: var(--text-sub); margin-top: 3px; }

.m-fab { position: fixed; right: 18px; bottom: 86px; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; border: none; font-size: 26px; box-shadow: 0 6px 16px rgba(245,127,23,.4); z-index: 20; }
.m-tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; background: #fff; display: flex; border-top: 1px solid var(--border); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
.m-tab { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--text-sub); font-size: 11px; cursor: pointer; }
.m-tab svg { width: 22px; height: 22px; display: block; margin: 0 auto 2px; }
.m-tab.active { color: var(--primary); font-weight: 600; }

.m-user-head { display: flex; align-items: center; gap: 14px; padding: 6px 4px 14px; border-bottom: 1px solid #f0f2f1; }
.m-user-head .user-avatar { width: 52px; height: 52px; font-size: 22px; }
.m-cell { display: flex; justify-content: space-between; align-items: center; padding: 13px 4px; border-bottom: 1px solid #f0f2f1; font-size: 14px; }
.m-cell:last-child { border-bottom: none; }
.m-cell .cell-val { color: var(--text-sub); font-size: 13px; }
.m-cell .arrow { color: #b0bec5; }

.m-filter { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.m-filter button { flex: none; border: 1px solid var(--border); background: #fff; border-radius: 16px; padding: 6px 14px; font-size: 12px; color: var(--text-sub); }
.m-filter button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.m-search { display: flex; gap: 8px; margin-bottom: 12px; }
.m-search input { flex: 1; border: 1px solid var(--border); border-radius: 18px; padding: 8px 14px; outline: none; }

/* 空状态 */
.empty-state { text-align: center; padding: 40px 0; color: var(--text-sub); font-size: 13px; }
.empty-state svg { width: 52px; height: 52px; opacity: .4; margin-bottom: 10px; }

/* 响应式 */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .side-logo h1, .side-logo p, .menu-item span, .menu-group, .side-foot { display: none; }
  .menu-item { justify-content: center; padding: 12px 0; }
  .main { margin-left: 64px; }
  .content { padding: 14px 14px 30px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
