/* ===== 乒乓球培训管理工作台 - 简洁商务风 ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f4f6f9; color: #26313f; font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
/* dvh = 动态视口高度，自动适应手机地址栏伸缩；旧浏览器回退到 vh */
.layout { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---- 左侧固定导航 ---- */
.sidebar {
  width: 226px; flex: none; background: #1c2a44; color: #cfd8e6;
  display: flex; flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; color: #fff; font-weight: 700; font-size: 15px; line-height: 1.35;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand .logo {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg,#3b82f6,#2563eb); color:#fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  cursor: pointer; font-size: 14px; color: #b9c6d9;
  border-left: 3px solid transparent; user-select: none;
  touch-action: manipulation;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.on { background: rgba(37,99,235,.28); color: #fff; border-left-color: #3b82f6; }
.nav-item .idx {
  width: 20px; height: 20px; flex: none; border-radius: 5px; font-size: 11px;
  background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center;
}
.nav-item.on .idx { background: #3b82f6; }
.nav-home { border-left-color: transparent !important; color: #8aa0c8 !important; }
.nav-home .ico { width: 20px; text-align: center; flex: none; }
.nav-home.on, .nav-home:hover { background: rgba(59,130,246,.18); color: #fff !important; }
.sb-foot { padding: 12px 14px; font-size: 11px; color: #6d7f99; border-top: 1px solid rgba(255,255,255,.08); }

/* ---- 嵌套可折叠导航 ---- */
.nav-cat { font-weight: 600; }
.nav-cat .caret { display: inline-block; width: 14px; color: #8aa0c8; font-size: 11px; flex: none; }
.nav-sub { margin-left: 6px; border-left: 1px solid rgba(255,255,255,.10); padding-left: 4px; }
.nav-leaf { position: relative; }
.nav-leaf .leaf-dot { width: 6px; height: 6px; border-radius: 50%; background: #7e93b3; display: inline-block; flex: none; margin-left: 4px; }
.nav-leaf.on { background: rgba(37,99,235,.30); color: #fff; border-left-color: #3b82f6; }
.tbl-wrap .row-off { opacity: .5; }

/* ---- 权限设置 ---- */
.perm-sec { border: 1px solid #eef1f5; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.perm-sec-t { font-weight: 700; margin-bottom: 6px; color: #1c2a44; }
.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #f0f2f6; font-size: 13px; }
.perm-row:last-child { border-bottom: none; }
.perm-c label { margin-left: 14px; color: #5b6b7f; }

/* ---- 工作台首页 ---- */
.hero {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  background: linear-gradient(120deg,#1c2a44,#27406e); color: #fff;
  border-radius: 12px; padding: 18px 22px; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(28,42,68,.18);
}
.hero-greet { font-size: 19px; font-weight: 700; }
.hero-sub { font-size: 13px; color: #b9c6e0; margin-top: 4px; }
.hero-r { display: flex; align-items: center; gap: 10px; }
.hero-sync { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); padding: 5px 12px; border-radius: 20px; font-size: 12.5px; }
.hero-sync.ok { color: #d1fae5; } .hero-sync.bad { color: #fecaca; }
.hero-sync .dot { width: 7px; height: 7px; }
.hero-sync .dot.ok { background: #34d399; } .hero-sync .dot.bad { background: #f87171; }

.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.entry {
  display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e5e9f0;
  border-radius: 10px; cursor: pointer; background: #fff; transition: all .15s; user-select: none;
  touch-action: manipulation;
}
.entry:hover { border-color: #2563eb; box-shadow: 0 2px 8px rgba(37,99,235,.12); transform: translateY(-1px); }
.entry-ic { width: 38px; height: 38px; flex: none; border-radius: 9px; background: #eff4ff; display: flex; align-items: center; justify-content: center; font-size: 19px; }
.entry-lb { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.entry-ds { font-size: 11.5px; color: #8a97a8; margin-top: 2px; }
.entry-badge { background: #dc2626; color: #fff; border-radius: 10px; font-size: 10.5px; padding: 0 6px; font-weight: 700; }

.alert-grp { margin-bottom: 12px; }
.alert-title { font-size: 13px; font-weight: 700; color: #1c2a44; margin-bottom: 7px; padding-left: 9px; border-left: 3px solid #2563eb; }
.alert-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; border: 1px solid #f0f2f6; margin-bottom: 6px; background: #fafbfd;
  touch-action: manipulation;
}
.alert-item:hover { background: #eff4ff; border-color: #c7d7fb; }
.alert-tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-go { color: #2563eb; font-size: 12px; flex: none; }

@media (max-width: 920px) {
  .home-grid { grid-template-columns: 1fr; }
}

/* ---- 右侧内容区 ---- */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 52px; flex: none; background: #fff; border-bottom: 1px solid #e5e9f0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 16px;
}
.page-title { font-size: 16px; font-weight: 700; }
.sync-widget { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #5b6b7f; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.dot.ok { background: #16a34a; } .dot.bad { background: #dc2626; }
#main { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

/* ---- 卡片 ---- */
.card {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-title .count {
  display: inline-block; min-width: 20px; text-align: center; margin-left: 6px;
  background: #eef2ff; color: #4353c4; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 600;
}
.card-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 10px; line-height: 1.6;
}
.muted { color: #94a3b8; }

/* ---- 输入控件 ---- */
input, select, textarea {
  font-family: inherit; font-size: 13px; color: #26313f;
  border: 1px solid #d7dde6; border-radius: 7px; padding: 7px 10px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { width: 100%; resize: vertical; }
.search { width: 170px; }
.flt { max-width: 170px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid #eef1f5; }
.toolbar .cnt { margin-left: auto; font-size: 12px; color: #6d7f99; }
.toolbar .show-hid { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #b45309; cursor: pointer; user-select: none; }
.toolbar .show-hid input { width: auto; }
.cell-note { width: 100%; min-width: 130px; padding: 4px 6px; font-size: 12px; }
.cell-edit { width: 100%; min-width: 90px; padding: 4px 6px; font-size: 12px; border: 1px solid #d3deeb; border-radius: 4px; background: #fff; }
.cell-edit:focus { outline: none; border-color: #2f6fed; box-shadow: 0 0 0 2px rgba(47,111,237,.15); }

/* ---- 按钮 ---- */
.btn {
  border: 1px solid #d7dde6; background: #fff; color: #334155; border-radius: 7px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
  touch-action: manipulation;
}
.btn:hover { background: #f1f5f9; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4fd7; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.mini {
  border: 1px solid #d7dde6; background: #fff; color: #2563eb; border-radius: 6px;
  padding: 3px 8px; font-size: 12px; cursor: pointer; margin: 1px 2px; font-family: inherit; white-space: nowrap;
  touch-action: manipulation;
}
.mini:hover { background: #eff6ff; }
.mini.danger { color: #dc2626; }
.mini.danger:hover { background: #fef2f2; }
.mini.primary { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ---- 表格 ---- */
.tbl-wrap { overflow-x: auto; }
.daily-date { font-weight: 600; color: #1c2a44; margin: 14px 0 6px; font-size: 13.5px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; background: #f8fafc; color: #5b6b7f; font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid #e5e9f0; white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid #eef2f6; vertical-align: top; max-width: 280px; word-break: break-all; }
.tbl tr:hover td { background: #f8fafc; }
.tbl td.ops, .tbl th.ops { white-space: nowrap; text-align: right; }
.tbl td.empty { text-align: center; color: #94a3b8; padding: 22px 0; }
.tbl tr.sch-sep td { background: #eef2f7; color: #334155; font-size: 13px; padding: 7px 10px; font-weight: 600; }
.tbl tr.sch-sep + tr td { border-top: 2px solid #dbe3ec; }

/* ---- 徽章 ---- */
.tag-auto { font-size: 11px; cursor: help; }
.badge {
  display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 12px; white-space: nowrap;
  background: #f1f5f9; color: #475569;
}
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fffbeb; color: #b45309; }
.badge.danger { background: #fef2f2; color: #dc2626; }
.badge.info { background: #eff6ff; color: #1d4ed8; }

/* ---- 异常归属行高亮 ---- */
.row-warn { background: #fff7ed !important; }
.row-warn:hover { background: #ffedd5 !important; }
.row-warn td:first-child { box-shadow: inset 3px 0 0 #f97316; }

/* ---- 标签页 ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1px solid #d7dde6; background: #fff; color: #475569; border-radius: 8px;
  padding: 7px 16px; font-size: 13.5px; cursor: pointer; font-family: inherit;
  touch-action: manipulation;
}
.tab:hover { border-color: #93b4f5; color: #2563eb; }
.tab.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }
.tabs.sub .tab { padding: 5px 13px; font-size: 12.5px; border-radius: 20px; }
.tabs.sub .tab.on { background: #1c2a44; border-color: #1c2a44; }

/* ---- 小班 / 班级切换标签 ---- */
.class-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 2px; }
.ctab {
  border: 1px solid #d7dde6; background: #f7f9fc; color: #475569; border-radius: 20px;
  padding: 6px 16px; font-size: 13px; cursor: pointer; font-family: inherit;
  touch-action: manipulation;
}
.ctab:hover { border-color: #93b4f5; color: #2563eb; }
.ctab.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; }

/* ---- 统计卡 ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 10px; padding: 13px 16px;
}
.stat .v { font-size: 21px; font-weight: 700; margin-top: 3px; }
.stat .l { font-size: 12px; color: #64748b; }
.stat.warn .v { color: #b45309; } .stat.danger .v { color: #dc2626; } .stat.ok .v { color: #047857; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 12px; width: 640px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal.wide { width: 860px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid #e5e9f0; font-weight: 700; font-size: 15px;
}
.mclose { border: none; background: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.mclose:hover { color: #334155; }
.modal-body { padding: 16px 18px; overflow-y: auto; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .fi { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #5b6b7f; }
.form-grid .fi.full { grid-column: 1 / -1; }
.form-grid .fi input, .form-grid .fi select, .form-grid .fi textarea { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.full { grid-column: 1 / -1; }

/* ---- 费用支出：顶部录入表单 ---- */
.exp-form { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px 14px; padding: 16px; }
.exp-form .fi { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #5b6b7f; }
.exp-form .fi.full { grid-column: 1 / -1; }
.exp-form .fi input, .exp-form .fi select { width: 100%; }
.exp-form .form-actions { grid-column: 1 / -1; }

/* ---- 训练计划 / 文字填写区 ---- */
.plan-show {
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px;
  padding: 12px 14px; font-size: 13px; line-height: 1.8; margin-bottom: 10px; min-height: 44px;
}
.plan-input { min-height: 76px; }

/* ---- 通知编辑 ---- */
.notify-form { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.notify-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: #5b6b7f; }
#ntext { min-height: 150px; line-height: 1.8; }

/* ---- 明细展开 ---- */
tr.detail-row td { background: #f8fafc; padding: 0 10px 12px; }
.sub-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; background: #fff; border: 1px solid #e5e9f0; border-radius: 8px; }
.sub-tbl th, .sub-tbl td { padding: 6px 10px; border-bottom: 1px solid #eef2f6; text-align: left; }

/* ---- Toast ---- */
#toasts { position: fixed; top: 62px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1c2a44; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 20px rgba(0,0,0,.18); animation: slidein .25s ease;
}
.toast.warn { background: #b45309; }
.toast.err { background: #dc2626; }

/* ---- 一对一训练提醒 ---- */
.p1-remind-toast { max-width: 340px; padding: 12px 14px; cursor: default; }
.p1rt-tt { font-weight: 700; margin-bottom: 4px; }
.p1rt-bd { font-size: 12px; line-height: 1.5; opacity: .92; margin-bottom: 8px; word-break: break-word; }
.p1-remind-card .p1r-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.p1r-item { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.p1r-when { background: #eef4ff; color: #1e3a5f; padding: 1px 8px; border-radius: 6px; font-weight: 600; }
.p1r-src { margin-left: auto; font-size: 11px; color: #94a3b8; background: #f1f5f9; padding: 1px 8px; border-radius: 6px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid #eef2f6; display: flex; justify-content: flex-end; gap: 8px; }
.modal-title { font-weight: 700; }
.rk { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.rk-row { display: flex; gap: 14px; align-items: flex-end; margin: 10px 0; flex-wrap: wrap; }
.rk-lb { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.rk-in { padding: 7px 9px; border: 1px solid #d7dee8; border-radius: 7px; font-size: 14px; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---- 档案详情 ---- */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 16px; margin-bottom: 6px; }
.profile-grid .pi { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eef2f6; }
.profile-grid .pi b { color: #5b6b7f; font-weight: 600; margin-right: 6px; }
.sect-title { font-size: 13.5px; font-weight: 700; margin: 16px 0 8px; color: #1c2a44; }

/* ---- 响应式（平板 / 手机）---- */
@media (max-width: 920px) {
  /* 移动端：改用自然滚动，修复 100vh 地址栏遮挡导致按钮不可点击 */
  html, body { height: auto; overflow-y: auto; }
  .layout {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }
  /* 侧栏变为顶部栏，sticky 固定让导航始终可见 */
  .sidebar {
    width: 100%; flex-direction: column; flex: none;
    position: sticky; top: 0; z-index: 50;
  }
  .nav { display: flex; overflow-x: auto; padding: 0; flex: none; -webkit-overflow-scrolling: touch; }
  .nav-item { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; padding: 10px 12px; min-height: 44px; }
  .nav-item.on { border-bottom-color: #3b82f6; }
  .sb-foot { display: none; }
  .brand { padding: 10px 14px; font-size: 13px; }
  .brand span br { display: none; }
  /* 内容区自然排列，topbar 随内容滚动 */
  .content { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .exp-form { grid-template-columns: 1fr 1fr; }
  #main { padding: 12px; overflow: visible; padding-bottom: 60px; }
  .search { width: 130px; }
  /* 触摸目标增大 */
  .btn { min-height: 36px; }
  .btn.sm { min-height: 32px; }
  .mini { min-height: 30px; padding: 5px 10px; }
  .entry { min-height: 48px; }
  .nav-item { min-height: 44px; }
}
@media (max-width: 560px) {
  .exp-form { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .entry-grid { grid-template-columns: 1fr; }
  .hero { padding: 14px 16px; }
  .hero-greet { font-size: 17px; }
  .topbar { padding: 0 12px; }
  .page-title { font-size: 14px; }
  .sync-widget .dot + span { display: none; }
  #main { padding: 10px; }
}

/* ---- 首页手机扫码访问卡片 ---- */
.scan-card { margin-bottom: 14px; }
.scan-body { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.scan-img { width: 150px; height: 150px; border: 1px solid #e3e8f0; border-radius: 10px; background: #fff; }
.scan-info { flex: 1; min-width: 220px; }
.scan-url { font-weight: 700; color: #1c2a44; font-size: 15px; margin-bottom: 10px; word-break: break-all; }
.scan-info .note { font-size: 12.5px; color: #5b6b7f; line-height: 1.6; }
@media (max-width: 560px) {
  .scan-body { gap: 12px; }
  .scan-img { width: 120px; height: 120px; }
}

/* ---- 敏感模块访问密码弹窗 ---- */
.gate-card {
  background: #fff; border-radius: 14px; width: 380px; max-width: 100%;
  padding: 24px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.25); text-align: center;
}
.gate-title { font-size: 17px; font-weight: 800; color: #1c2a44; margin-bottom: 6px; }
.gate-sub { font-size: 12.5px; color: #5b6b7f; line-height: 1.6; margin-bottom: 16px; }
.gate-input {
  width: 100%; padding: 11px 13px; border: 1px solid #d7dee8; border-radius: 9px;
  font-size: 14px; margin-bottom: 10px; box-sizing: border-box; outline: none;
}
.gate-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.gate-err { color: #dc2626; font-size: 12.5px; min-height: 18px; margin-bottom: 6px; text-align: left; }
.gate-btns { display: flex; gap: 10px; margin-top: 6px; }
.gate-btns .btn { flex: 1; justify-content: center; }
.gate-foot { margin-top: 14px; }
.gate-foot a { color: #3b82f6; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.gate-foot a:hover { text-decoration: underline; }
.gate-change { margin-top: 12px; padding-top: 14px; border-top: 1px dashed #e5e9f0; text-align: left; }

/* ---- 学校训练模块 ---- */
.school-tabs { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.school-tabs .tabs { margin-bottom: 0; }
.school-tabs .tabs-tools { display: flex; gap: 8px; }
.train-card { margin-top: 14px; }
.sec-body { display: block; }
.sec-body .train-card:first-child { margin-top: 0; }
.sub-tbl td .cell {
  width: 100%; box-sizing: border-box; border: 1px solid #d7dee8; border-radius: 6px;
  padding: 4px 6px; font-size: 12.5px; background: #fff; color: #1f2d3d; font-family: inherit;
}
.sub-tbl select.cell { padding: 3px 4px; cursor: pointer; }
.sub-tbl td .cell:focus { outline: 2px solid #2563eb; outline-offset: 0; }
.sub-tbl .c-sel { width: 34px; text-align: center; }
.sub-tbl .c-act { white-space: nowrap; }
.sub-tbl .c-act .btn { margin: 1px 2px; }
.sub-tbl .c-seq { width: 40px; text-align: center; color: #64748b; font-size: 12.5px; }
.tbl-wrap .muted { color: #94a3b8; }

/* ---- 学期导航条 ---- */
.sem-nav-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.sem-label { font-size: 13px; font-weight: 700; color: #1c2a44; min-width: 120px; text-align: center; padding: 0 4px; }
.sem-year { padding: 4px 8px; border: 1px solid #d7dee8; border-radius: 6px; font-size: 13px; background: #fff; color: #1f2d3d; max-width: 110px; }
.seg { display: inline-flex; border: 1px solid #d7dee8; border-radius: 6px; overflow: hidden; }
.seg .btn { border: none; border-radius: 0; }
.seg .btn.on { background: #2563eb; color: #fff; }
.tbl-footer { padding: 8px 4px 2px; font-size: 13px; color: #475569; }
.tbl-footer b { color: #1c2a44; font-size: 15px; }
.signin-tbl .st-term { min-width: 80px; text-align: center; white-space: nowrap; }
.signin-tbl .st-stat { min-width: 54px; text-align: center; }

/* ---- 签到表组件 ---- */
.signin-tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 4px; }
.signin-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.signin-tbl th, .signin-tbl td { border: 1px solid #e2e8f0; padding: 4px 6px; text-align: center; white-space: nowrap; }
.signin-tbl thead th { background: #f0f4f8; color: #475569; font-weight: 700; font-size: 12px; }
.signin-tbl .st-cls { min-width: 70px; text-align: left; }
.signin-tbl .st-nm { min-width: 60px; text-align: left; font-weight: 600; }
/* 日期列 / 翻页列：学校训练 .signin-tbl 与其余模块 .tbl 通用 */
.st-date { min-width: 78px; text-align: center; white-space: nowrap; }
.st-nav { min-width: 36px; padding: 2px !important; text-align: center; }
.st-date-empty { color: #94a3b8; font-weight: 500; }
.signin-tbl tbody tr:nth-child(even) { background: #f9fafb; }
.signin-tbl tbody tr:hover { background: #eff6ff; }

/* 签到状态单元格 */
.signin-cell { padding: 2px !important; }
.signin-cell.st-present { background: #dcfce7 !important; }
.signin-cell.st-makeup { background: #dbeafe !important; }
.signin-cell.st-leave { background: #fef3c7 !important; }
.signin-cell.st-absent { background: #fee2e2 !important; }

/* 签到按钮 */
.signin-btn {
  display: inline-block; min-width: 36px; padding: 4px 8px;
  border: none; border-radius: 5px; cursor: pointer; font-size: 12px;
  font-family: inherit; touch-action: manipulation; background: #f1f5f9; color: #94a3b8;
  transition: all .12s;
}
.signin-btn:hover { background: #e2e8f0; }
.signin-cell.st-present .signin-btn { background: #22c55e; color: #fff; font-weight: 600; }
.signin-cell.st-makeup .signin-btn { background: #3b82f6; color: #fff; font-weight: 600; }
.signin-cell.st-leave .signin-btn { background: #f59e0b; color: #fff; font-weight: 600; }
.signin-cell.st-absent .signin-btn { background: #ef4444; color: #fff; font-weight: 600; }
.signin-cell-has { white-space: nowrap; }
.signin-del {
  display: inline-block; margin-left: 3px; width: 18px; height: 22px; line-height: 20px;
  border: none; border-radius: 5px; cursor: pointer; font-size: 11px; font-family: inherit;
  background: #fee2e2; color: #dc2626; touch-action: manipulation; vertical-align: middle;
}
.signin-del:hover { background: #fecaca; }
.signin-btn.signin-add { background: #f1f5f9; color: #94a3b8; font-weight: 700; }
.signin-btn.signin-add:hover { background: #e2e8f0; color: #475569; }

/* 日期列签到下拉（自由选择 出勤/请假/补课） */
.signin-pick {
  width: 100%; min-width: 66px; padding: 3px 2px; font-size: 12px; font-family: inherit;
  border: 1px solid #cdd5e3; border-radius: 5px; background: #fff; color: #64748b;
  cursor: pointer; touch-action: manipulation; text-align: center; text-align-last: center;
}
.signin-pick:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.18); }
.signin-cell.st-present .signin-pick { background: #22c55e; color: #fff; font-weight: 600; border-color: #16a34a; }
.signin-cell.st-makeup  .signin-pick { background: #3b82f6; color: #fff; font-weight: 600; border-color: #2563eb; }
.signin-cell.st-leave   .signin-pick { background: #f59e0b; color: #fff; font-weight: 600; border-color: #d97706; }
.signin-cell.st-absent  .signin-pick { background: #ef4444; color: #fff; font-weight: 600; border-color: #dc2626; }
.signin-pick option { background: #fff; color: #1f2937; font-weight: 500; }

/* 日期列表头删除按钮 */
th.st-date { position: relative; padding-right: 16px; }
.date-del {
  position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; line-height: 12px;
  border: none; border-radius: 3px; background: transparent; color: #cbd5e1;
  font-size: 10px; cursor: pointer; font-family: inherit; padding: 0; touch-action: manipulation;
}
th.st-date:hover .date-del { color: #dc2626; background: #fee2e2; }

/* 日期矩阵接入普通 .tbl 表格（假期 / 小班 / 一对一 汇总表） */
.signin-grid-tbl .signin-cell { padding: 2px !important; text-align: center; }
.signin-grid-tbl thead th.st-date { font-size: 12px; }
.signin-grid-tbl .st-nav .btn.sm { padding: 2px 5px; min-height: 22px; font-size: 11px; }

/* 假期训练：剩余课时（未补完高亮警示） */
.remain-warn { color: #dc2626; font-weight: 700; }

/* 缴费登记表：单元格内下拉 / 数字 / 日期输入 */
.fee-reg-tbl select, .fee-reg-tbl input { width: 100%; box-sizing: border-box; font-size: 13px; }
.fee-reg-tbl select.fee-status { min-width: 88px; }
.fee-reg-tbl input.fee-amount { text-align: right; }
.fee-reg-tbl td { vertical-align: middle; }
.fee-reg-tbl tr.grp td { color: #334155; }

/* 签到汇总 */
.signin-summary {
  display: flex; gap: 20px; flex-wrap: wrap; padding: 8px 4px 0;
  font-size: 12.5px; color: #64748b;
}
.ss-item b { color: #1c2a44; font-size: 14px; }

/* 禁用按钮 */
.btn.disabled { opacity: .4; pointer-events: none; }

/* ---- 训练汇总模块 ---- */
.sum-filter .sum-filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 4px 0; }
.sum-filter .fi { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #64748b; }
.sum-filter .fi select { padding: 6px 10px; border: 1px solid #d7dee8; border-radius: 6px; font-size: 13px; background: #fff; color: #1f2d3d; min-width: 120px; }
.sum-stats { padding: 14px 18px; }
.stats-row { display: flex; flex-wrap: wrap; gap: 24px; }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: 22px; font-weight: 700; color: #2563eb; }
.stat-lbl { font-size: 12px; color: #94a3b8; }
.sum-section { margin-top: 14px; }
.sum-section .sec-body .ledger-card:first-child { margin-top: 0; }
.ledger-card { margin-top: 12px; }
.ledger-card .sub-tbl { font-size: 12.5px; }
.ledger-expand { text-align: center; padding: 8px; }
.ledger-modal-body { max-height: 70vh; overflow: auto; }
.ledger-modal-body h3 { text-align: center; margin-bottom: 14px; font-size: 16px; }
.ledger-modal-body .sub-tbl { font-size: 13px; }

/* ---- 月历视图组件 ---- */
.cal-card { margin-top: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-month-lbl { font-size: 15px; font-weight: 700; color: #1c2a44; min-width: 100px; text-align: center; }
.cal-filter { font-size: 12px; color: #64748b; margin-right: 6px; }
.cal-body { padding: 0 4px 8px; }
.cal-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 4px 12px; font-size: 12px; color: #64748b;
}
.cal-stat { color: #475569; }
.cal-stat b { color: #2563eb; font-size: 14px; }
.cal-dot-leg { display: inline-flex; align-items: center; gap: 4px; }
.cal-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.cal-dot.ok { background: #22c55e; }
.cal-dot.absent { background: #ef4444; }
.cal-dot.leave { background: #f59e0b; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-grid-head { margin-bottom: 2px; }
.cal-hd {
  text-align: center; font-size: 12px; font-weight: 700; color: #64748b;
  padding: 4px 0; background: #f0f4f8; border-radius: 4px;
}
.cal-cell {
  min-height: 58px; border: 1px solid #eef1f5; border-radius: 6px;
  padding: 4px 5px; cursor: default; position: relative;
  background: #fff; transition: background .12s;
}
.cal-cell.other { color: #cbd5e1; background: #f9fafb; }
.cal-cell.today { border-color: #3b82f6; border-width: 2px; }
.cal-cell.today .cal-date-num { color: #2563eb; font-weight: 800; }
.cal-cell.has-data { cursor: pointer; touch-action: manipulation; }
.cal-cell.has-data:hover { background: #eff6ff; border-color: #93c5fd; }
.cal-date-num { font-size: 12.5px; font-weight: 600; color: #475569; }
.cal-dots {
  display: flex; flex-wrap: wrap; gap: 2px 4px; margin-top: 3px;
  font-size: 10px; color: #64748b; line-height: 1;
}
.cal-dots > * { display: inline-flex; align-items: center; gap: 1px; }
.cal-day-detail { padding: 4px 0; }
.cal-day-date { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: #1c2a44; }

/* ---- 学期管理组件 ---- */
.sem-mgr-card { margin-bottom: 14px; }
.sem-current {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px dashed #e5e9f0; margin-bottom: 10px;
}
.sem-cur-label { font-size: 15px; color: #1c2a44; }
.sem-cur-label b { color: #2563eb; font-size: 17px; }
.sem-cur-info { font-size: 12.5px; color: #64748b; }
.sem-archive-list { margin-bottom: 10px; }
.sem-archive-title { font-size: 13px; font-weight: 700; color: #1c2a44; margin-bottom: 6px; }
.sem-archive-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border: 1px solid #eef1f5; border-radius: 8px;
  margin-bottom: 6px; background: #fafbfd; transition: background .12s;
  touch-action: manipulation;
}
.sem-archive-item:hover { background: #f0f7ff; }
.sem-arch-info { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sem-arch-label { font-weight: 700; color: #1c2a44; font-size: 14px; }
.sem-arch-date { font-size: 12px; color: #94a3b8; }
.sem-arch-stats { font-size: 12px; color: #64748b; }
.sem-arch-ops { display: flex; gap: 6px; flex: none; }
.sem-no-archive {
  padding: 14px; text-align: center; color: #94a3b8; font-size: 13px;
  background: #fafbfd; border-radius: 8px; margin-bottom: 10px;
}
.sem-help {
  font-size: 12px; color: #64748b; line-height: 1.7;
  padding: 10px 12px; background: #fffbeb; border-radius: 8px; border: 1px solid #fef3c7;
}
.sem-archive-modal { padding: 4px 0; }
.sem-modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; color: #1c2a44; }
.sem-modal-sec { margin-bottom: 16px; }
.sem-modal-cat { font-size: 14px; font-weight: 700; color: #1c2a44; margin-bottom: 8px; padding-left: 8px; border-left: 3px solid #2563eb; }

/* ---- 从学员档案添加学员（弹窗选择列表） ---- */
.add-arc-list { max-height: 50vh; overflow: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 4px; }
.add-arc-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.add-arc-item:last-child { border-bottom: none; }

/* ============================================================
 * 多端横屏 / 安全区适配
 * 目标设备：手机（横屏 landscape）· 小度闺蜜机平板（横屏 landscape）· 电脑（桌面）
 * ============================================================ */

/* 刘海屏 / 圆角屏安全区：状态栏、底部手势条不遮挡内容与弹窗 */
.sidebar { padding-top: env(safe-area-inset-top); }
.topbar { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
#main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.modal-mask { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* 横屏手机 / 小平板：即便宽度略超 920，也采用顶部横向导航，避免左侧栏挤压内容 */
@media (orientation: landscape) and (max-width: 1024px) {
  html, body { height: auto; overflow-y: auto; }
  .layout { display: block; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .sidebar {
    width: 100%; flex-direction: column; flex: none;
    position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top);
  }
  .nav { display: flex; overflow-x: auto; padding: 0; flex: none; -webkit-overflow-scrolling: touch; }
  .nav-item { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; padding: 10px 12px; min-height: 44px; }
  .nav-item.on { border-bottom-color: #3b82f6; }
  .sb-foot { display: none; }
  .brand { padding: 8px 14px; font-size: 13px; }
  .brand span br { display: none; }
  .content { display: block; }
  #main { padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); overflow: visible; }
}

/* 横屏且高度较小（手机横置常见 360~480px）：压缩导航与内边距，保证内容可读、弹窗可滚动 */
@media (orientation: landscape) and (max-height: 540px) {
  .topbar { height: 46px; padding-top: 0; padding-bottom: 0; }
  .brand { padding: 6px 14px; font-size: 13px; }
  .brand .logo { width: 28px; height: 28px; font-size: 15px; }
  .nav { padding: 0; }
  .nav-item { min-height: 40px; padding: 8px 11px; font-size: 13px; }
  #main { padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); }
  .card { padding: 10px 13px; margin-bottom: 10px; }
  .card-title { font-size: 14px; }
  .modal { max-height: 95vh; }
  .modal-head { padding: 10px 14px; }
  .modal-body { padding: 12px 14px; }
  .modal-foot { padding: 10px 14px; }
  .form-grid { gap: 8px 12px; }
  .stats { gap: 8px; }
  .stat { padding: 9px 12px; }
  .stat .v { font-size: 18px; }
}
.add-arc-item:hover { background: #f8fafc; }
.add-arc-item input { flex: none; }

/* ---- 批量签到弹窗（新增签到记录） ---- */
.batch-signin { padding: 2px 0; }
.batch-signin .fi { margin-bottom: 12px; }
.batch-signin .chk-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px 10px; max-height: 46vh; overflow: auto;
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px; background: #fafbfd;
}
.chk-item {
  display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.3;
  padding: 4px 6px; border-radius: 6px; cursor: pointer;
}
.chk-item:hover { background: #f1f5f9; }
.chk-item input { flex: none; }
.chk-actions { margin-top: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
