/* 移动端优先 · 兼容手机浏览器与微信内置浏览器 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  background: #f4f6fa; color: #1f2329;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
input, select, textarea, button { font-family: inherit; font-size: 16px; }

.page { max-width: 640px; margin: 0 auto; padding: 12px 14px 90px; }

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px 14px;
}
.topbar-name { font-size: 20px; font-weight: 700; }
.topbar-role { font-size: 12px; color: #8a919c; margin-top: 2px; }
.topbar-acts { display: flex; gap: 8px; }

/* 按钮 */
.btn {
  border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 16px; cursor: pointer;
}
.btn-block { display: block; width: 100%; margin-top: 12px; }
.btn-primary { background: #2f6bff; color: #fff; }
.btn-primary:disabled { background: #a9c1ff; }
.btn-ghost { background: #eceff4; color: #333; }
.mini-btn {
  border: 1px solid #d5dbe5; background: #fff; color: #4a5568;
  border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.mini-btn.primary { background: #2f6bff; border-color: #2f6bff; color: #fff; }
.mini-btn.danger { color: #e64545; border-color: #f3c1c1; }

/* 输入 */
.ipt {
  width: 100%; border: 1px solid #d5dbe5; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: #fff; color: #1f2329;
  outline: none;
}
.ipt:focus { border-color: #2f6bff; }
textarea.ipt { resize: none; }
.field-err { color: #e64545; font-size: 12px; margin: -6px 0 8px 4px; min-height: 14px; }

/* 登录页 */
.login-wrap { max-width: 420px; margin: 0 auto; padding: 60px 24px; }
.login-logo { font-size: 30px; font-weight: 800; text-align: center; }
.login-sub { text-align: center; color: #8a919c; font-size: 13px; margin: 8px 0 28px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.login-tab {
  flex: 1; border: none; background: #eceff4; color: #666;
  border-radius: 10px; padding: 10px 0; font-size: 14px; cursor: pointer;
}
.login-tab.active { background: #2f6bff; color: #fff; }
.otp-row { display: flex; gap: 8px; }
.otp-row .ipt { flex: 1; }
.otp-row .btn { flex-shrink: 0; padding: 0 14px; height: 48px; font-size: 14px; }
.login-tip { text-align: center; color: #a0a6b0; font-size: 12px; margin-top: 22px; }

/* 统计卡片 */
.stat-cards { display: flex; gap: 10px; margin-bottom: 16px; }
.stat-card {
  flex: 1; background: #fff; border-radius: 12px; padding: 14px 8px;
  text-align: center; box-shadow: 0 1px 4px rgba(30, 50, 90, .05);
}
.stat-num { font-size: 17px; font-weight: 700; color: #2f6bff; word-break: break-all; }
.stat-label { font-size: 12px; color: #8a919c; margin-top: 4px; }

.section-title { font-size: 15px; font-weight: 700; margin: 18px 2px 10px; }

/* 订单卡片 */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: #fff; border-radius: 12px; padding: 14px;
  box-shadow: 0 1px 4px rgba(30, 50, 90, .05);
}
.order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order-student { font-size: 16px; font-weight: 700; }
.order-row { font-size: 14px; color: #4a5568; margin-top: 4px; line-height: 1.5; }
.order-time { font-size: 12px; color: #a0a6b0; margin-top: 8px; }
.order-acts { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

.badge { font-size: 12px; border-radius: 20px; padding: 3px 10px; }
.st-pending { background: #fff3e0; color: #e08a00; }
.st-allocated { background: #e8f0ff; color: #2f6bff; }
.st-received { background: #e6f7ec; color: #1a9e4b; }

/* 悬浮录单按钮 */
.fab {
  position: fixed; right: 20px; bottom: calc(28px + env(safe-area-inset-bottom));
  background: #2f6bff; color: #fff; border: none; border-radius: 30px;
  padding: 14px 24px; font-size: 16px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(47, 107, 255, .35); cursor: pointer; z-index: 50;
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 26, 38, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-box {
  background: #fff; border-radius: 14px; padding: 20px;
  width: 100%; max-width: 420px; max-height: 85vh; overflow-y: auto;
}
.modal-lg { max-width: 480px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-text { font-size: 15px; line-height: 1.6; margin-bottom: 8px; }
.modal-btns { display: flex; gap: 10px; margin-top: 16px; }
.modal-btns .btn { flex: 1; }
.kv {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 14px; padding: 7px 0; border-bottom: 1px solid #f0f2f6;
}
.kv span { color: #8a919c; flex-shrink: 0; }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }
.money { color: #e08a00; }

/* 分配页 */
.alloc-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.alloc-row .alloc-sales { flex: 1.2; margin-bottom: 0; }
.alloc-row .alloc-amt { flex: 1; margin-bottom: 0; }
.alloc-total { font-size: 14px; margin-top: 12px; text-align: center; }
.alloc-total .ok { color: #1a9e4b; }
.alloc-total .warn { color: #e64545; }

/* Tab 与筛选 */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; border: none; background: #eceff4; color: #666;
  border-radius: 10px; padding: 9px 0; font-size: 14px; cursor: pointer;
}
.tab.active { background: #2f6bff; color: #fff; }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid #d5dbe5; background: #fff; color: #4a5568;
  border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.chip.active { background: #2f6bff; border-color: #2f6bff; color: #fff; }

/* 表格 */
.panel { background: #fff; border-radius: 12px; padding: 14px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid #f0f2f6; text-align: left; }
.table th { background: #f7f9fc; color: #4a5568; font-weight: 600; }

.loading, .empty { text-align: center; color: #a0a6b0; font-size: 14px; padding: 30px 0; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 26, 38, .88); color: #fff; font-size: 14px;
  border-radius: 10px; padding: 10px 20px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 200; max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: rgba(200, 50, 50, .92); }

/* 双列行 / 科目选择 / 课时单价 */
.row2 { display: flex; gap: 8px; }
.row2 .ipt { flex: 1; }
.subj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.subj-item { background: #f7f9fc; border-radius: 10px; padding: 8px 10px; }
.subj-label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.subj-label i { font-style: normal; color: #8a919c; font-size: 12px; margin-left: auto; }
.subj-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2f6bff; }
.subj-h { margin: 6px 0 0; padding: 8px 10px; font-size: 14px; }
.unit-price-box {
  background: #eef4ff; border-radius: 10px; padding: 10px 14px;
  font-size: 14px; margin-bottom: 12px; line-height: 1.6;
}
.unit-price-box b { color: #2f6bff; font-size: 17px; }
.hint { font-size: 12px; color: #a0a6b0; font-weight: 400; }

/* 录单课程行：科目 | 班型 | 价格 | 课时 | 删 */
.course-row {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr 0.75fr 0.65fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.course-row .ipt { padding: 8px 8px; font-size: 13px; margin-bottom: 0; }
.course-row select.ipt { padding-left: 4px; }
.course-row .mini-btn { padding: 8px 10px; }

/* 可滚动列表 */
.scroll-box {
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

/* 业绩表折叠明细 */
.perf-table th, .perf-table td { font-size: 13px; padding: 8px 6px; }
.pd-box { background: #f8f9fc; border-top: 1px dashed #e3e6ee; padding: 6px 12px; }
.pd-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1fr 1.2fr 1fr;
  gap: 6px; padding: 5px 0; font-size: 13px; align-items: center;
}
.pd-row.pd-sub { padding-left: 14px; color: #5a6270; font-size: 12px; }
.pd-row.pd-gain { color: #2f6bff; }
.pd-remain { color: #8a919c; font-size: 12px; text-align: right; }
.pd-gain-amt { font-weight: 600; text-align: right; }

/* 大屏（iPad 横屏 / 桌面）：仅 .page.wide（报名信息表/业绩表）放宽容器、表格完整显示 */
@media (min-width: 900px) {
  .page.wide { max-width: 1500px; padding: 16px 28px 90px; }
  .page.wide .table-wrap { overflow-x: visible; }
  .page.wide .table { white-space: normal; word-break: break-word; }
  .page.wide .table th, .page.wide .table td { padding: 9px 10px; vertical-align: top; }
  .page.wide .scroll-box { max-height: none; overflow-y: visible; }
}

/* 报名表列宽优化：学员/家长姓名留 4 字、年级 3 字不折行；科目/备注超长省略号截断 */
.table.report th, .table.report td { padding: 9px 8px; }
.table.report th:nth-child(1), .table.report td:nth-child(1),
.table.report th:nth-child(10), .table.report td:nth-child(10) { white-space: nowrap; min-width: 4.5em; }
.table.report th:nth-child(2), .table.report td:nth-child(2) { white-space: nowrap; min-width: 3.2em; }
.table.report th:nth-child(7), .table.report td:nth-child(7),
.table.report th:nth-child(12), .table.report td:nth-child(12) {
  font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
