/* 博扬职业培训学校管理系统 · 设计系统 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --sidebar: #0f2c5c;
  --sidebar-active: #1b4b91;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.boot-loading { padding: 80px; text-align: center; color: var(--muted); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 14px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c7d2fe; color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; color: #fff; border-color: var(--danger); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { opacity: .9; color: #fff; }
.btn-lg { height: 44px; font-size: 15px; padding: 0 22px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  font-size: 14px; color: var(--text); outline: none; transition: .15s;
}
.textarea { height: auto; padding: 8px 10px; min-height: 68px; resize: vertical; font-family: inherit; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item > label { font-size: 13px; color: var(--muted); }
.form-item.full { grid-column: 1 / -1; }
.required::before { content: '*'; color: var(--danger); margin-right: 2px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.table th { background: #f9fafb; color: var(--muted); font-weight: 500; font-size: 13px; }
table.table tbody tr:hover { background: #f9fbff; }
table.table td.wrap { white-space: normal; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; line-height: 18px; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-orange { background: var(--warn-bg); color: #b45309; }
.badge-red { background: var(--danger-bg); color: var(--danger); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search-input { width: 220px; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.money { font-family: "SF Mono", Menlo, Consolas, monospace; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 600; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.blue .value { color: var(--primary); }
.stat.green .value { color: var(--success); }
.stat.orange .value { color: #d97706; }
.stat.red .value { color: var(--danger); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, #0f2c5c, #1d4ed8 55%, #2563eb);
}
.login-brand {
  flex: 1.1; color: #fff; padding: 60px 56px; display: flex; flex-direction: column; justify-content: center;
}
.login-brand .logo { font-size: 30px; font-weight: 700; letter-spacing: 1px; }
.login-brand .slogan { margin-top: 14px; font-size: 16px; opacity: .9; line-height: 1.9; }
.login-brand .features { margin-top: 30px; display: grid; gap: 12px; max-width: 420px; }
.login-brand .features div { background: rgba(255,255,255,.12); padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.login-box {
  flex: .9; display: flex; align-items: center; justify-content: center; padding: 40px 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 34px 30px;
  box-shadow: 0 20px 50px rgba(2, 20, 60, .25);
}
.login-card h2 { font-size: 20px; margin-bottom: 6px; }
.login-card .tip { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.demo-accounts { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.9; border-top: 1px dashed var(--border); padding-top: 12px; }

/* ---------- 后台布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: var(--sidebar); color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 18px 14px; font-size: 16px; color: #fff; font-weight: 600; line-height: 1.4; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand small { display: block; font-size: 12px; font-weight: 400; color: #94a3b8; margin-top: 4px; }
.sidebar nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 14px; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 500; }
.sidebar nav .nav-group { padding: 14px 12px 6px; font-size: 12px; color: #64748b; letter-spacing: 1px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .user-box { display: flex; align-items: center; gap: 10px; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.content { padding: 18px; flex: 1; }
.menu-toggle { display: none; }
.mask { display: none; }

/* ---------- 老师端（移动端优先） ---------- */
.teacher-layout { min-height: 100vh; background: var(--bg); padding-bottom: 76px; }
.teacher-header {
  background: linear-gradient(135deg, #0f2c5c, #2563eb); color: #fff; padding: 16px 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.teacher-header .hi { font-size: 16px; font-weight: 600; }
.teacher-header .sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.teacher-body { padding: 14px; display: grid; gap: 12px; }
.student-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.student-card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.student-card .name { font-size: 16px; font-weight: 600; }
.student-card .course { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* 课次格子（上下拆分：上=上午，下=下午） */
.lesson-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lesson-cell {
  width: 34px; height: 46px; border-radius: 8px; border: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; background: #fff; color: var(--muted);
  font-size: 12px; line-height: 1;
}
.lesson-cell .lm-t, .lesson-cell .lm-b { flex: 1; display: flex; align-items: center; justify-content: center; }
.lesson-cell .lm-t { border-bottom: 1px dashed var(--border); }
.lesson-cell.lm-void .lm-t, .lesson-cell.lm-void .lm-b { color: #cbd5e1; }
.lesson-cell.lm-am .lm-t { background: var(--success); color: #fff; }
.lesson-cell.lm-pm .lm-b { background: var(--success); color: #fff; }
.lesson-cell.lm-both .lm-t, .lesson-cell.lm-both .lm-b { background: var(--success); color: #fff; }
.lesson-cell.lm-today { box-shadow: 0 0 0 2px var(--primary); }
.lesson-cell.done { background: var(--success); border-color: var(--success); color: #fff; }
.lesson-cell.today { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 上午/下午 时段选择 */
.seg-group { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer; }
.seg input { accent-color: var(--primary); }
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border);
  display: flex; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 10px; z-index: 30;
}
.bottom-bar .btn { flex: 1; height: 44px; }

/* 扫码 */
.scan-box { position: relative; background: #000; border-radius: 12px; overflow: hidden; }
.scan-box video, .scan-box img { width: 100%; display: block; }
.scan-frame {
  position: absolute; left: 12%; right: 12%; top: 18%; bottom: 18%;
  border: 2px solid rgba(255,255,255,.85); border-radius: 12px;
}
.scan-line { position: absolute; left: 12%; right: 12%; height: 2px; background: #22c55e; top: 20%; animation: scanMove 2s linear infinite; }
@keyframes scanMove { 0% { top: 20%; } 50% { top: 78%; } 100% { top: 20%; } }

/* ---------- 弹窗 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.modal.wide { max-width: 860px; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: toastIn .2s ease;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 分页 */
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 4px; }

/* 打印（收据 / 报名表 / 学员课卡） */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .bottom-bar { display: none !important; }
  body.printing #app, body.printing .toast-wrap { display: none !important; }
  .content { padding: 0; }
  .card { border: none; box-shadow: none; }
  .print-area { display: block !important; }
}
.print-doc { width: 720px; margin: 0 auto; font-size: 14px; color: #000; }
.print-doc h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.print-doc .sub { text-align: center; color: #555; font-size: 12px; margin-bottom: 14px; }
.print-doc table { width: 100%; border-collapse: collapse; }
.print-doc table th, .print-doc table td { border: 1px solid #333; padding: 8px 10px; text-align: left; }
.print-doc table th { background: #f2f2f2; width: 100px; font-weight: 500; }
.print-doc .sign { display: flex; justify-content: space-between; margin-top: 40px; font-size: 13px; }

/* A4 收据：财务联 + 客户联 + 学员上课核销卡（三联同页） */
.print-sheet { width: 210mm; margin: 0 auto; background: #fff; padding: 0; box-sizing: border-box; }
.receipt { margin: 0; }
.receipt + .receipt { margin-top: 0; }
.receipt-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.5px solid #111; padding-bottom: 1.5mm; }
.receipt-head h2 { font-size: 17px; margin: 0; letter-spacing: 1px; }
.receipt-head .r-sub { font-size: 13px; color: #333; margin-top: 1mm; letter-spacing: 3px; }
.receipt-head .r-no { font-size: 11px; color: #333; text-align: right; line-height: 1.6; }
.r-flag { font-size: 11px; color: #555; padding-top: 1mm; }
.receipt-body { display: flex; gap: 5mm; padding-top: 1.5mm; }
.r-main { flex: 1; min-width: 0; }
.r-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.r-table th, .r-table td { border: 1.5px solid #111; padding: 1.1mm 2mm; text-align: left; line-height: 1.35; }
.r-table th { background: #f4f4f4; width: 20mm; font-weight: 500; white-space: nowrap; }
.r-money { font-size: 14px; font-weight: 700; }
.r-cn { font-weight: 600; letter-spacing: 1px; }
.r-sign { display: flex; justify-content: space-between; margin-top: 2mm; font-size: 11px; }
.r-qr { width: 40mm; text-align: center; border: 1px dashed #999; padding: 2mm 1.5mm; }
.r-qr img { width: 30mm; height: 30mm; display: block; margin: 0 auto; }
.r-qr-tip { font-size: 10px; margin-top: 1.5mm; color: #333; line-height: 1.4; }
.r-qr-sub { font-size: 10px; color: #666; margin-top: 1mm; }
.r-qr-lg { width: 46mm; }
.r-qr-lg img { width: 34mm; height: 34mm; }
.r-qr svg { width: 30mm; height: 30mm; display: block; margin: 0 auto; }
.r-qr-lg svg { width: 34mm; height: 34mm; }
/* 核销卡：二维码与学员信息整体成一个带边框卡片 */
.r-card { border: 1.5px solid #111; padding: 2.5mm 3mm; box-sizing: border-box; }
.r-card .receipt-head { border-bottom: 1.5px solid #111; padding-bottom: 1mm; margin-bottom: 1mm; }
.r-card .receipt-body { padding-top: 0; }
.r-card .r-qr { border: none; border-left: 1px dashed #999; padding: 0 0 0 3mm; margin: 0; }
.r-foot { font-size: 10px; color: #555; margin-top: 1.5mm; border-top: 1px dashed #bbb; padding-top: 1mm; }
.cut-line { border-top: 1px dashed #666; margin: 3mm 0; text-align: center; height: 0; }
.cut-line span { position: relative; top: -7px; background: #fff; padding: 0 6px; font-size: 10px; color: #666; }
@media print {
  @page { size: A4 portrait; margin: 6mm; }
  .print-sheet { padding: 0; width: auto; }
  .print-area, .print-sheet { height: auto; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .mask.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .login-brand { display: none; }
  .search-input { width: 100%; }
}
