/* ========== 主题变量 ========== */
:root {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-soft: #fff7ed;
  --accent: #f59e0b;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-light: #9ca3af;
  --border: #e8eaed;
  --sidebar: #1f2937;
  --sidebar-sub: #111827;
  --sidebar-text: #cbd5e1;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #3b82f6;
  --info-soft: #eff6ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }
.icon { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }

/* ========== 布局 ========== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 22px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand-logo .icon { width: 24px; height: 24px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; color: #6b7280; padding: 10px 12px 6px; letter-spacing: .05em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm);
  cursor: pointer; margin-bottom: 3px; transition: .15s; color: var(--sidebar-text); font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(234,88,12,.35); }
.nav-item .icon { width: 19px; height: 19px; }
.sidebar-foot { padding: 14px 20px; font-size: 11px; color: #6b7280; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--success); font-weight: 600; }
.live-dot::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 4px rgba(16,185,129,.18); animation: pulse 2s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } }
.content { padding: 26px 28px 48px; flex: 1; }

/* ========== 通用组件 ========== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card + .card { margin-top: 18px; }
.card-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h2 { font-size: 16px; font-weight: 700; }
.card-header .sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.card-body { padding: 20px 22px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--text-sub); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: #fff; color: var(--text); font-weight: 600; cursor: pointer; transition: .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: #fecaca; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
}
.badge-green { background: var(--success-soft); color: #047857; }
.badge-red { background: var(--danger-soft); color: #b91c1c; }
.badge-blue { background: var(--info-soft); color: #1d4ed8; }
.badge-orange { background: var(--primary-soft); color: var(--primary-dark); }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

.muted { color: var(--text-sub); }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; }
.amount-in { color: var(--success); }
.amount-out { color: var(--primary); }

/* ========== 统计卡 ========== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; gap: 16px; align-items: center;
}
.stat-icon { width: 50px; height: 50px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.stat-icon.orange { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.blue { background: var(--info-soft); color: var(--info); }
.stat-icon.amber { background: #fffbeb; color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--text-sub); font-weight: 700; background: #fafbfc; user-select: none; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
td .avatar {
  width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; margin-right: 9px;
}
.row-actions { display: flex; gap: 4px; }

/* ========== 表单 ========== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: #374151; }
.form-group .hint { font-size: 11px; color: var(--text-light); }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d8dce2; border-radius: var(--radius-sm);
  background: #fff; color: var(--text); outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder { color: #b6bcc6; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 4px 0 2px; }

/* ========== 弹窗 ========== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: rise .2s ease-out;
}
.modal.wide { max-width: 700px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; cursor: pointer; color: var(--text-sub); }
.icon-btn:hover { background: #f3f4f6; }

/* ========== Toast ========== */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 380px; background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--info); display: flex; gap: 10px; align-items: flex-start;
  animation: slideIn .22s ease-out;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast .icon { color: var(--info); }
.toast.success .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }
.toast-title { font-weight: 700; font-size: 13px; }
.toast-msg { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* ========== 空状态 ========== */
.empty { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty .icon { width: 46px; height: 46px; color: #d1d5db; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ========== 二维码 ========== */
.qr-wrap { text-align: center; }
.qr-img { width: 220px; height: 220px; image-rendering: pixelated; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: #fff; }
.qr-code { font-size: 20px; font-weight: 800; letter-spacing: .06em; margin-top: 14px; color: var(--primary-dark); }
.qr-name { font-size: 14px; color: var(--text-sub); margin-top: 2px; }
.qr-tip { font-size: 12px; color: var(--text-light); margin-top: 14px; }

/* ========== 报表图表 ========== */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-label { width: 92px; flex: none; font-size: 13px; color: #374151; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f3f4f6; border-radius: 999px; height: 22px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--primary)); min-width: 2px; transition: width .5s; }
.bar-value { width: 80px; flex: none; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-sub); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--primary); margin-right: 6px; }

/* ========== 收银端 ========== */
.cashier-shell { min-height: 100vh; background: linear-gradient(160deg, #fff7ed 0%, #f4f5f7 42%); }
.cashier-top { background: var(--sidebar); color: #fff; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; }
.cashier-top .brand { border: none; padding: 0; }
.cashier-top .brand-name { font-size: 16px; }
.cashier-body { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.cashier-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; align-items: start; }
.cashier-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.cashier-card .head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.cashier-card .head h2 { font-size: 17px; font-weight: 700; }
.cashier-card .body { padding: 22px; }
.step-badge { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }

.cashier-select { display: flex; gap: 10px; align-items: center; }
.cashier-select select { flex: 1; }

.scan-box {
  position: relative; border: 2px dashed #fcd9b8; border-radius: 14px; background: #fffaf5;
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.scan-box video { width: 100%; height: 100%; object-fit: cover; display: none; }
.scan-box.scanning video { display: block; }
.scan-placeholder { text-align: center; color: var(--text-light); padding: 20px; }
.scan-placeholder .icon { width: 52px; height: 52px; color: #f0b27e; margin-bottom: 12px; }
.scan-frame {
  position: absolute; inset: 12%; border: 2px solid rgba(234,88,12,.6); border-radius: 10px; pointer-events: none;
  display: none;
}
.scan-box.scanning .scan-frame { display: block; }
.scan-frame::before, .scan-frame::after { content: ''; position: absolute; background: var(--primary); }
.scan-frame::before { top: -2px; left: 18px; right: 18px; height: 3px; box-shadow: 0 calc(100% + 0px) 0 var(--primary); }
.scan-line { position: absolute; left: 8%; right: 8%; height: 2px; background: var(--primary); box-shadow: 0 0 12px var(--primary); animation: scan 2.2s ease-in-out infinite; display: none; }
.scan-box.scanning .scan-line { display: block; }
@keyframes scan { 0%,100% { top: 15%; } 50% { top: 85%; } }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-light); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.code-input { display: flex; gap: 10px; }
.code-input input { font-size: 17px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

.amount-input-wrap { position: relative; }
.amount-input-wrap .currency { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 700; color: var(--primary); }
.amount-input-wrap input { font-size: 28px; font-weight: 800; padding: 14px 14px 14px 38px; text-align: left; height: 64px; }
.quick-amounts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.quick-amounts button { flex: 1; min-width: 56px; padding: 8px 4px; border: 1px solid var(--border); background: #fff; border-radius: 9px; cursor: pointer; font-weight: 600; color: #374151; }
.quick-amounts button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.employee-preview {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px;
  background: var(--info-soft); border: 1px solid #dbeafe; margin-bottom: 16px;
}
.employee-preview .avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--info); color: #fff; font-size: 16px; }
.employee-preview .info { flex: 1; }
.employee-preview .info .name { font-size: 16px; font-weight: 700; }
.employee-preview .info .code { font-size: 12px; color: var(--text-sub); }
.employee-preview .balance { text-align: right; }
.employee-preview .balance .num { font-size: 20px; font-weight: 800; color: var(--info); }
.employee-preview .balance .lbl { font-size: 11px; color: var(--text-sub); }

.result-card { text-align: center; padding: 10px 0; }
.result-icon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; background: var(--success-soft); color: var(--success); }
.result-icon .icon { width: 34px; height: 34px; }
.result-icon.error { background: var(--danger-soft); color: var(--danger); }
.result-title { font-size: 18px; font-weight: 800; }
.result-title.error { color: var(--danger); }
.result-amount { font-size: 38px; font-weight: 800; color: var(--primary); margin: 8px 0; }
.result-detail { font-size: 13px; color: var(--text-sub); }

.recent-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.recent-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: none; }
.recent-item .who { flex: 1; }
.recent-item .who .name { font-weight: 600; }
.recent-item .who .time { font-size: 11px; color: var(--text-light); }
.recent-item .amt { font-weight: 700; color: var(--primary); }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; cursor: pointer; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
input:checked + .slider { background: var(--primary); }
input:checked + .slider::before { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch-row .label { font-weight: 600; }
.switch-row .desc { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; border: 1px solid #fed7aa; }
.notice.info { background: var(--info-soft); color: #1d4ed8; border-color: #dbeafe; }

/* ========== 登录页 ========== */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 18% 18%, #fff7ed, transparent 45%), linear-gradient(135deg, #1f2937, #111827);
}
.login-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 18px;
  padding: 36px 34px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.login-logo .icon { width: 30px; height: 30px; }
.login-brand h1 { font-size: 20px; font-weight: 800; }
.login-brand p { color: var(--text-sub); font-size: 13px; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-hint {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-sub); text-align: center; line-height: 1.8;
}
.login-hint b { color: var(--primary-dark); }

/* ========== 收银台结果横幅（手机端为主） ========== */
.result-banner { display: none; }
.touch-lg { min-height: 46px; font-size: 15px; }
.consume-btn { min-height: 54px; font-size: 18px; letter-spacing: .04em; }

/* ========== 员工自助端 ========== */
.emp-shell { min-height: 100vh; background: linear-gradient(160deg, #eff6ff 0%, #f4f5f7 45%); }
.emp-top { background: var(--sidebar); color: #fff; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; }
.emp-top .brand { border: none; padding: 0; }
.emp-top .brand-name { font-size: 16px; }
.emp-top .brand-sub { font-size: 11px; }
.emp-body { max-width: 560px; margin: 0 auto; padding: 24px 16px 60px; }
.emp-wrap { width: 100%; }

.emp-balance-card {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  border-radius: 18px; padding: 24px 24px 20px; box-shadow: 0 12px 28px rgba(234,88,12,.28);
}
.ebc-top { display: flex; align-items: center; justify-content: space-between; }
.ebc-label { font-size: 13px; opacity: .9; }
.ebc-code { font-family: monospace; font-size: 13px; opacity: .85; background: rgba(255,255,255,.18); padding: 3px 10px; border-radius: 999px; }
.ebc-amount { font-size: 46px; font-weight: 800; letter-spacing: -.02em; margin: 12px 0 16px; }
.ebc-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.25); padding-top: 14px; font-size: 14px; }
.ebc-group { background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; font-size: 12px; }

.emp-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-top: 18px; overflow: hidden; }
.emp-card-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.emp-card-head h2 { font-size: 16px; font-weight: 700; }
.emp-card-body { padding: 4px 18px; }
.emp-record { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.emp-record:last-child { border-bottom: none; }
.er-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; }
.er-icon .icon { width: 19px; height: 19px; }
.er-icon.out { background: var(--primary-soft); color: var(--primary); }
.er-icon.in { background: var(--success-soft); color: var(--success); }
.er-info { flex: 1; min-width: 0; }
.er-name { font-weight: 700; font-size: 14px; }
.er-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.er-note { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.er-right { text-align: right; flex: none; }
.er-amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.er-amount.out { color: var(--primary); }
.er-amount.in { color: var(--success); }
.er-balance { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ========== 响应式 ========== */
@media (max-width: 920px) {
  .cashier-grid { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .brand { padding: 14px 18px; }
  .nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-item { white-space: nowrap; margin: 0; padding: 9px 14px; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 14px; gap: 10px; }
  .stat-value { font-size: 20px; }
  .page-head h1 { font-size: 19px; }
}

/* ========== 手机端收银台（竖屏优先） ========== */
@media (max-width: 640px) {
  .cashier-top { padding: 12px 14px; }
  .cashier-top .brand-name { font-size: 15px; }
  .cashier-top .brand-sub { font-size: 11px; }
  .cashier-top .brand-logo { width: 36px; height: 36px; }
  .cashier-top .brand-logo .icon { width: 21px; height: 21px; }
  .cashier-body { padding: 12px 12px calc(28px + env(safe-area-inset-bottom)); }
  .cashier-grid { display: block; }

  /* 结果横幅置顶，滚动时保持可见 */
  .result-banner {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 8px; z-index: 15;
    padding: 13px 14px; border-radius: 14px; margin-bottom: 14px;
    background: #fff; border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0,0,0,.08);
    transition: background .25s, border-color .25s;
  }
  .result-banner.ok { background: var(--success-soft); border-color: #a7f3d0; }
  .result-banner.error { background: var(--danger-soft); border-color: #fecaca; }
  .rb-icon {
    width: 42px; height: 42px; border-radius: 12px; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: #f3f4f6; color: var(--text-sub);
  }
  .result-banner.ok .rb-icon { background: var(--success); color: #fff; }
  .result-banner.error .rb-icon { background: var(--danger); color: #fff; }
  .rb-icon .icon { width: 24px; height: 24px; }
  .rb-text { flex: 1; min-width: 0; }
  .rb-title { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rb-detail { font-size: 12px; color: var(--text-sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rb-amount { font-size: 20px; font-weight: 800; color: var(--primary); white-space: nowrap; }
  .result-banner.error .rb-amount { color: var(--danger); }

  /* 桌面结果卡片隐藏，改用横幅 */
  .result-card-desktop { display: none; }

  .cashier-card .head { padding: 14px 16px; }
  .cashier-card .head h2 { font-size: 16px; }
  .cashier-card .body { padding: 16px; }
  .cashier-card + .cashier-card { margin-top: 14px !important; }

  /* 扫码框竖屏更聚焦 */
  .scan-box { aspect-ratio: 1 / 1; }
  .scan-placeholder .icon { width: 46px; height: 46px; }

  /* 金额与触控 */
  .amount-input-wrap input { height: 60px; font-size: 26px; }
  .quick-amounts button { min-height: 44px; font-size: 15px; }
  .code-input input { min-height: 46px; font-size: 16px; }
  .cashier-select select { min-height: 44px; font-size: 15px; }

  /* 员工预览卡片 */
  .employee-preview { padding: 12px; gap: 10px; }
  .employee-preview .balance .num { font-size: 18px; }
}

/* 横屏或大屏手机：结果横幅与操作并排更紧凑 */
@media (min-width: 641px) {
  .cashier-main { min-width: 0; }
}

/* ========== 员工自助端 ========== */
.emp-shell {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.emp-top {
  flex: none;
  padding: 16px 18px;
  background: linear-gradient(120deg, var(--primary-dark), var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(234,88,12,.25);
}
.emp-top .brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.emp-top .brand-logo {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
}
.emp-top .brand-logo .icon { width: 24px; height: 24px; }
.emp-top .brand-name { font-size: 17px; font-weight: 800; line-height: 1.2; }
.emp-top .brand-sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.emp-body { flex: 1; padding: 18px; }
.emp-wrap { max-width: 560px; margin: 0 auto; }

/* 余额卡 */
.emp-balance-card {
  border-radius: 18px;
  padding: 22px 22px 18px;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ea580c 55%, #c2410c);
  box-shadow: 0 10px 28px rgba(234,88,12,.32);
  position: relative;
  overflow: hidden;
}
.emp-balance-card::after {
  content: ''; position: absolute; right: -40px; top: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.emp-balance-card .ebc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.emp-balance-card .ebc-label { font-size: 13px; opacity: .9; }
.emp-balance-card .ebc-code {
  font-family: monospace; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.18); padding: 4px 9px; border-radius: 20px;
}
.emp-balance-card .ebc-amount { font-size: 42px; font-weight: 800; margin: 14px 0 10px; letter-spacing: -1px; }
.emp-balance-card .ebc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.emp-balance-card .ebc-group { opacity: .9; font-size: 12px; }

/* 记录卡 */
.emp-card {
  margin-top: 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.emp-card-head {
  padding: 15px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.emp-card-head h2 { font-size: 15px; font-weight: 800; }
.emp-card-body { padding: 6px 16px; }
.emp-record {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid var(--border);
}
.emp-record:last-child { border-bottom: none; }
.emp-record .er-icon {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.emp-record .er-icon .icon { width: 20px; height: 20px; }
.emp-record .er-icon.out { background: var(--danger-soft); color: var(--danger); }
.emp-record .er-icon.in { background: var(--success-soft); color: var(--success); }
.emp-record .er-info { flex: 1; min-width: 0; }
.emp-record .er-name { font-weight: 700; font-size: 14px; }
.emp-record .er-time { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.emp-record .er-note { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.emp-record .er-right { text-align: right; flex: none; }
.emp-record .er-amount { font-size: 17px; font-weight: 800; }
.emp-record .er-amount.out { color: var(--danger); }
.emp-record .er-amount.in { color: var(--success); }
.emp-record .er-balance { font-size: 11px; color: var(--text-light); margin-top: 2px; }

@media (max-width: 480px) {
  .emp-body { padding: 14px; }
  .emp-balance-card .ebc-amount { font-size: 36px; }
  .emp-top { padding: 13px 14px; }
}

/* ========== 员工排班日历 ========== */
.month-nav { display: inline-flex; align-items: center; gap: 6px; }
.month-nav input[type="month"] {
  height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 14px;
}
.sched-table { border-collapse: collapse; min-width: 100%; font-size: 12px; }
.sched-table th, .sched-table td {
  border: 1px solid var(--border); padding: 0; text-align: center; height: 34px;
}
.sched-table thead th {
  background: #f9fafb; position: sticky; top: 0; z-index: 2;
  font-weight: 700; color: var(--text-sub); vertical-align: middle;
}
.sched-name-col {
  position: sticky; left: 0; z-index: 3; background: var(--card);
  min-width: 130px; text-align: left !important; padding: 0 10px !important; white-space: nowrap;
}
.sched-table thead .sched-name-col { z-index: 4; background: #f9fafb; }
.sched-total-col { min-width: 58px; background: #fafafa; }
.sched-day { min-width: 30px; line-height: 1.15; }
.sched-day span { display: block; font-size: 12px; }
.sched-day small { display: block; font-size: 9px; font-weight: 400; opacity: .7; }
.sched-day.weekend, .sched-cell.weekend { background: #fff7ed; }
.sched-cell .sched-dot {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: #f3f4f6; transition: all .12s; padding: 0;
}
.sched-cell .sched-dot:hover { transform: scale(1.12); border-color: var(--primary); }
.sched-cell .sched-dot.on {
  background: var(--success); border-color: #059669;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
@media (max-width: 640px) {
  .page-actions { flex-wrap: wrap; }
  .sched-name-col { min-width: 95px; font-size: 11px; }
  .sched-day { min-width: 26px; }
}
