/* ============================================================
   ET运动会管理系统 — 界面样式 v3.3（色彩收敛 + 无障碍修正）
   设计令牌：:root 变量统一换肤；保留旧系统结构类名兼容。
   品牌：深青为唯一主色；橄榄绿降级为暖近黑侧栏（保留旧用户肌肉记忆）；
        橙色仅作"当前位置/必须注意"，不再大面积铺底。
   无障碍：所有白字/底色组合 ≥ WCAG AA 4.5:1（v3.2 的橙 2.15、绿 3.30
        已替换为 #c2410c / #15803d）；补全 :focus-visible 焦点环。
   ============================================================ */
:root {
  /* 主色板（青——唯一品牌色） */
  --c-primary: #0f5d6e;
  --c-primary-h: #0b4756;
  --c-primary-soft: #e6f2f5;
  --c-deep: #0a3440;          /* 顶栏/登录卡渐变终点 */
  /* 强调色（仅"当前所在/必须注意"，白字 5.18:1） */
  --c-accent: #c2410c;
  --c-accent-h: #9a3412;
  /* 侧栏：暖近黑，替代原橄榄 #73680b */
  --c-menu: #1c1a14;
  --c-menu-h: #2a261c;
  --c-menu2: #232019;
  /* 旧变量名保留（大量视图/模板仍引用） */
  --c-teal: #0f5d6e;
  --c-teal-h: #146b80;
  /* 语义色 */
  --c-success: #15803d;
  --c-success-soft: #f0fdf4;
  --c-warn: #b45309;
  --c-warn-soft: #fffbeb;
  --c-danger: #b91c1c;
  --c-danger-soft: #fef2f2;
  --c-info: #0e7490;
  /* 中性色 */
  --c-bg: #f3f5f9;
  --c-card: #ffffff;
  --c-border: #e5e7eb;
  --c-track: #e3e9f1;
  --c-text: #1f2937;
  --c-text-2: #5b6675;        /* 4.9:1（原 #6b7280 4.83，略提对比） */
  --c-text-3: #64748b;        /* 4.76:1（原 #9ca3af 仅 2.54，不达标） */
  /* 几何 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 4px 14px rgba(16, 24, 40, .10);
  --shadow-3: 0 10px 30px rgba(16, 24, 40, .16);
  --font: "PingFang SC", "Microsoft YaHei", "微软雅黑", system-ui, sans-serif;
}

/* 键盘焦点：v3.2 全站 0 处，此处统一补齐 */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.admenu:focus-visible, .admenu2:focus-visible, .tabbar .tab:focus-visible,
#logintext span:focus-visible, #adleft a:focus-visible {
  outline: 2px solid #fde68a;
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--c-bg);
  text-align: center;
  font-size: 14px;
  color: var(--c-text);
  line-height: 1.6;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-h); }
.num { font-variant-numeric: tabular-nums; }

/* ============ 登录页（保留四入口结构，现代化） ============ */
#maindiv { padding-top: 4vh; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
#yuanjiaokuang {
  width: 460px; max-width: 94vw; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--c-primary-h) 0%, var(--c-deep) 100%);
  border: 1px solid rgba(255,255,255,.18); box-shadow: var(--shadow-3);
  overflow: hidden;
}
#ydhname {
  height: 52px; color: #fff; text-align: center; font-size: 21px;
  line-height: 52px; letter-spacing: 1px; font-weight: 600;
  border-bottom: 1px solid rgba(255,204,0,.35);
}
#logintext { margin: 14px 16px 0 16px; display: flex; gap: 4px; }
#logintext span {
  padding: 7px 14px; border-radius: var(--r-md) var(--r-md) 0 0;
  font-size: 14px; cursor: pointer; transition: background .15s;
}
#logintext span.on { background: #fff; color: var(--c-teal); font-weight: 600; }
#logintext span.off { background: rgba(255,255,255,.12); color: #fff; }
#logintext span.off a { color: #fff; }
#bzrbtkuang {
  background: #fff; margin: 0 16px 16px 16px;
  border-radius: 0 0 var(--r-md) var(--r-md); padding: 18px 20px;
  text-align: left; min-height: 190px; box-shadow: inset 0 1px 0 rgba(0,0,0,.03);
}
.login-row { margin: 12px 0; display: flex; align-items: center; }
.login-row label { width: 76px; text-align: right; padding-right: 8px; color: var(--c-text-2); flex: none; }
.login-row input, .login-row select {
  flex: 1; height: 36px; padding: 4px 10px; font-size: 15px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.login-row input:focus, .login-row select:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
#butdiv { text-align: center; margin-top: 18px; }
#jgtext { color: var(--c-danger); text-align: center; background: var(--c-danger-soft); margin: 8px 16px 0; padding: 6px; border-radius: var(--r-sm); font-size: 13px; }
/* 空错误位不再渲染成一条无内容的浅色带（v3.2 的登录页白条） */
#jgtext:empty { display: none; }
.buttomtext { padding: 8px; color: rgba(255,255,255,.85); text-align: center; font-size: 12.5px; }
#ethome { border-top: 1px solid rgba(255,204,0,.3); color: rgba(255,255,255,.7); font-size: 12px; padding-bottom: 10px; }

/* ============ 按钮 ============ */
.btcs, button.btcs {
  margin: 3px; padding: 6px 16px; height: 34px; border: 0;
  border-radius: var(--r-sm); background: var(--c-primary); color: #fff;
  cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 500;
  transition: background .15s, transform .06s, box-shadow .15s;
  box-shadow: var(--shadow-1); display: inline-flex; align-items: center; gap: 5px;
}
.btcs:hover { background: var(--c-primary-h); }
.btcs:active { transform: translateY(1px); }
.btcs:disabled { background: #cbd5e1; color: #f1f5f9; cursor: not-allowed; box-shadow: none; }
.btcs.red { background: var(--c-danger); }
.btcs.red:hover { background: #b91c1c; }
.btcs.green { background: var(--c-success); }
.btcs.green:hover { background: #15803d; }
.btcs.orange { background: var(--c-accent); }
.btcs.orange:hover { background: var(--c-accent-h); }
.btcs.gray { background: #6b7280; }
.btcs.gray:hover { background: #4b5563; }
.btcs.ghost { background: #fff; color: var(--c-primary); border: 1px solid var(--c-primary); }
.btcs.ghost:hover { background: var(--c-primary-soft); }
/* 禁用态必须排在上面的配色之后：`.btcs.orange` 与 `.btcs:disabled` 特异性相同，
   靠后写才生效。否则红/绿/橙按钮禁用后仍然是醒目色，看不出不能点。 */
.btcs:disabled,
.btcs.red:disabled, .btcs.green:disabled,
.btcs.orange:disabled, .btcs.gray:disabled, .btcs.ghost:disabled {
  background: #cbd5e1; color: #f1f5f9; border-color: #cbd5e1;
  cursor: not-allowed; box-shadow: none; transform: none;
}

/* ============ 管理端主框架 ============ */
.adone {
  width: 100%; min-width: 960px; max-width: 1400px;
  margin: 12px auto; border-radius: var(--r-md);
  background: var(--c-card); text-align: left; padding: 0 0 12px 0;
  box-shadow: var(--shadow-2);
  /* clip 而非 hidden：不建立滚动容器，表头 position:sticky 才能相对视口生效 */
  overflow: clip;
  /* 内容不足时也铺满一屏，避免底部露出 body 灰底 */
  display: flex; flex-direction: column;
  min-height: calc(100vh - 24px);
}
#ydhtitle {
  border-bottom: 1px solid var(--c-border); margin: 0; padding: 0 18px;
  height: 52px; line-height: 52px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-deep) 100%);
}
#titletext { font-size: 20px; font-weight: 600; color: #fff; letter-spacing: .5px; }
#systuichu { font-size: 13.5px; color: rgba(255,255,255,.9); margin: 0; height: auto; line-height: 52px; }
#systuichu .menucs { padding: 0 6px; color: #fde68a; }
.voice-toggle {
  border: 0; border-radius: 999px; padding: 3px 12px; margin-right: 10px;
  font-size: 13px; cursor: pointer; font-family: inherit;
  background: rgba(255,255,255,.18); color: #fff; transition: all .15s;
}
.voice-toggle.on { background: var(--c-success); color: #fff; }
.voice-toggle:not(.on) { opacity: .75; }
#systongzhi {
  padding: 8px 18px; font-size: 13px; color: var(--c-warn);
  background: var(--c-warn-soft); border-bottom: 1px solid #fde68a;
  text-align: left;
}
/* flex 容器的 min-height 不会让 flex:1 的子项拿到剩余空间（无确定高度 → 剩余为 0），
   所以这里直接给主体算出下限：
   视口 - margin上12 - 顶栏52 - 通知条40 - 卡片padding底12 - margin下12 = 128 */
#syszhuti { display: flex; min-height: max(600px, calc(100vh - 128px)); flex: 1; }
#adleft {
  width: 176px; flex: none; border-right: 1px solid var(--c-border);
  background: linear-gradient(180deg, var(--c-menu) 0%, #12100a 100%);
  padding: 12px 8px 20px 8px;
}
#adleft a { color: #fff; display: block; }
.admenu {
  margin: 6px 2px; font-size: 14.5px; background: transparent; color: #fff;
  text-align: center; border-radius: var(--r-sm); line-height: 36px;
  cursor: pointer; transition: background .15s;
}
.admenu:hover { background: rgba(255,255,255,.14); }
.admenu.cur { background: var(--c-accent); color: #fff; font-weight: 600; box-shadow: var(--shadow-1); }
.admenu2 {
  margin: 4px 2px; font-size: 14px; color: rgba(255,255,255,.92); text-align: center;
  border-radius: var(--r-sm); border: 0;
  background: transparent; line-height: 34px; cursor: pointer; transition: background .15s;
}
/* 分组标题：小字、疏排、左对齐，让"系统/管理"这类次级区有归属感 */
.menugrp {
  font-size: 11px; color: rgba(255,255,255,.42); letter-spacing: .14em;
  padding: 14px 10px 2px 10px; text-align: left; user-select: none;
}
.admenu2:hover { background: rgba(255,255,255,.14); }
.admenu2.cur { background: var(--c-accent-h); color: #fff; font-weight: 600; }
#menufg { width: 86%; margin: 10px auto; border-bottom: 1px solid rgba(255,255,255,.25); }
.admenu .mi { margin-right: 6px; }
.admenu .mt { display: inline; }
/* 窄屏折叠为图标栏 */
@media (max-width: 1180px) {
  .adone { min-width: 0; }
  #adleft { width: 60px; padding: 12px 4px; }
  .admenu, .admenu2 { font-size: 0; }
  .admenu .mi, .admenu2 .mi { font-size: 18px; margin: 0; }
  .admenu .mt, .admenu2 .mt { display: none; }
  #adright { padding: 14px 14px; }
}
#adright {
  flex: 1; padding: 18px 22px; min-width: 0; text-align: left;
  background: var(--c-bg); display: flex; flex-direction: column;
}
#adright > .crumbs { flex: none; }
/* 内容区主体撑满，空状态/短表单不再顶在上方留一大片灰 */
#adright > :last-child { flex: 1 0 auto; }
#adright iframe { width: 100%; min-height: 580px; border: 0; }

/* 面包屑：只做导航，不与页面标题争主次（原来 15px 粗体 + 页面 16px 标题，两个"标题"打架） */
.crumbs { font-size: 12.5px; color: var(--c-text-3); margin-bottom: 6px; }
.crumbs b { color: var(--c-text-2); font-size: 12.5px; font-weight: 400; margin-right: 6px; }
.crumbs a { color: var(--c-text-3); }
.crumbs a:hover { color: var(--c-primary); }

/* ============ 表格 ============ */
table { border-collapse: collapse; margin: 6px 0; }
table td, table th { border: 1px solid var(--c-border); padding: 7px 10px; }
table th { background: #f8fafc; color: var(--c-text-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
table tr:nth-child(even) td { background: #fafbfc; }
table tr:hover td { background: var(--c-primary-soft); }
.mini-table td, .mini-table th { border: 1px solid var(--c-border); }
.mini-table th { background: #f8fafc; }
/* 数字列：右对齐 + 等宽数字，纵向比较不跳列 */
table td.n, table th.n { text-align: right; font-variant-numeric: tabular-nums; }
table td.c, table th.c { text-align: center; }
/* 表头吸顶：长表滚动时不再丢失列名 */
table thead th, table tr:first-child th { position: sticky; top: 0; z-index: 2; }
@media print { table thead th, table tr:first-child th { position: static; } }

/* 表格内操作按钮紧凑化 */
.mini-table .btcs { padding: 2px 10px; height: 27px; font-size: 13px; margin: 1px; }
.table-wrap { overflow-x: auto; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 var(--c-border); }

/* ============ Tab 页签 ============ */
.tabbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px 0; }
.tabbar .tab {
  font-size: 14px; text-align: center; padding: 6px 14px; border-radius: var(--r-sm);
  cursor: pointer; background: #fff; border: 1px solid var(--c-border); color: var(--c-text-2);
  transition: all .15s;
}
.tabbar .tab:hover { border-color: var(--c-primary); color: var(--c-primary); }
.tabbar .tab.on { background: var(--c-primary); color: #fff; border-color: var(--c-primary); font-weight: 500; }
.tabbar .tab a { color: inherit; }
.clearboth { clear: both; }

/* ============ 卡片 / 表单 ============ */
.xiaotitle { font-size: 18px; margin: 2px 0 12px 0; font-weight: 600; color: var(--c-text); letter-spacing: -.01em; }
/* 表单底部操作行：居中 + 与上文拉开距离（原先靠内联 style 实现） */
.actbar { line-height: 32px; text-align: center; margin: 16px 0 8px 0; }
.tc { text-align: center; }
.tipgreen { color: var(--c-success); }
.newydhhang { line-height: 32px; text-align: left; margin: 6px 0; }
.fieldsetbox {
  border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 12px 16px;
  margin: 12px 0; background: var(--c-card); box-shadow: var(--shadow-1);
}
.fieldsetbox legend { color: var(--c-teal); font-size: 14.5px; font-weight: 600; padding: 0 8px; }
.lbk { font-size: 14px; width: 360px; margin-top: 3px; padding: 6px 10px; border: 1px solid var(--c-border); border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s; }
.lbk:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.lbks { width: 120px; padding: 6px; border: 1px solid var(--c-border); border-radius: var(--r-sm); }
select.lbk { width: 130px; height: 32px; }
textarea.lbk { font-family: inherit; }

/* 字段标签：统一宽度让同一行的控件起点对齐（原先 70/72/90/96 混用，
   导致「平记录加分：」在 70px 里折行，"分"和单位"分"挤成"分分："） */
.flbl { display: inline-block; width: 96px; }

/* 内联校验 */
.fld-err { border-color: var(--c-danger) !important; }
.fld-err-msg { color: var(--c-danger); font-size: 12px; line-height: 1.4; }

/* ============ 徽章 ============ */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 18px; }
.badge.green { background: var(--c-success-soft); color: var(--c-success); border: 1px solid #bbf7d0; }
.badge.orange { background: var(--c-warn-soft); color: var(--c-warn); border: 1px solid #fde68a; }
.badge.red { background: var(--c-danger-soft); color: var(--c-danger); border: 1px solid #fecaca; }
.badge.blue { background: var(--c-primary-soft); color: var(--c-primary); border: 1px solid #b6dde5; }
.badge.gray { background: #f3f4f6; color: var(--c-text-2); border: 1px solid var(--c-border); }

/* ============ Toast ============ */
/* 旧服务端页（static/admin.js）仍用 .msgbox，保留；改挂右上角避免压住顶栏 */
.msgbox {
  position: fixed; top: 16px; right: 16px; left: auto; transform: none;
  background: #fff; border-radius: var(--r-md); border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-text-3);
  box-shadow: var(--shadow-3); padding: 10px 18px; z-index: 9999;
  display: none; font-size: 14px; text-align: left;
  /* 原来只写了 max-width:360px，content-box 下再加上 36px 内边距，
     手机上就宽出屏幕、右边界被裁（截图里右边露了半个字） */
  box-sizing: border-box;
  max-width: min(360px, calc(100vw - 32px));
}
.msgbox.ok { border-color: #bbf7d0; border-left-color: var(--c-success); color: #14532d; background: var(--c-success-soft); }
.msgbox.err { border-color: #fecaca; border-left-color: var(--c-danger); color: #7f1d1d; background: var(--c-danger-soft); cursor: pointer; }
.msgbox.warn { border-color: #fde68a; border-left-color: var(--c-warn); color: #78350f; background: var(--c-warn-soft); cursor: pointer; }

/* SPA 用：消息栈，可堆叠；错误/警告常驻直到手动关闭 */
.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--c-border); border-left: 4px solid var(--c-text-3);
  border-radius: var(--r-md); box-shadow: var(--shadow-3);
  padding: 10px 12px; font-size: 14px; line-height: 1.5;
  color: var(--c-text); text-align: left;
  animation: toastIn .18s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.toast.ok { border-left-color: var(--c-success); }
.toast.err { border-left-color: var(--c-danger); background: var(--c-danger-soft); border-color: #fecaca; }
.toast.warn { border-left-color: var(--c-warn); background: var(--c-warn-soft); border-color: #fde68a; }
.toast .t-ico { flex: none; font-size: 14px; line-height: 1.55; }
.toast .t-msg { flex: 1; word-break: break-word; }
.toast .t-close {
  flex: none; border: 0; background: transparent; color: var(--c-text-3);
  cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; font-family: inherit;
}
.toast .t-close:hover { color: var(--c-text); }

/* ============ 模态 ============ */
.dsh-modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 10000;
  padding: 16px;
}
.dsh-modal {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  max-width: 480px; width: 100%; overflow: hidden;
  /* 弹窗限高：内容超出视口时头部/底部固定、正文区自己滚动，
     否则「保存」按钮被截在屏幕外且整窗无法滑动 */
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
}
.dsh-modal-head { padding: 14px 20px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--c-border); flex: none; }
.dsh-modal-body { padding: 18px 20px; font-size: 14px; color: var(--c-text); line-height: 1.7; overflow-y: auto; min-height: 0; flex: 1; }
.dsh-modal-foot { padding: 12px 20px; text-align: right; border-top: 1px solid var(--c-border); flex: none; }
.dsh-modal input[type=text], .dsh-modal input[type=password], .dsh-modal input[type=date], .dsh-modal select {
  width: 100%; height: 36px; margin-top: 8px; padding: 4px 10px;
  border: 1px solid var(--c-border); border-radius: var(--r-sm); font-size: 14px;
}
.dsh-modal input:focus, .dsh-modal select:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.dsh-modal .err { color: var(--c-danger); font-size: 12.5px; margin-top: 6px; }
/* 编辑类弹窗里的行内表单（.newydhhang）不能被上面的 width:100% 拆散：
   否则「类型:」标签被拦腰断成「类/型:」、每个下拉各占一行，
   弹窗被撑到一千多像素高，下拉一开还会贴着弹窗边缘。恢复自然宽度，让字段像页面上一样成行排列。 */
.dsh-modal .newydhhang input[type=text], .dsh-modal .newydhhang input[type=number],
.dsh-modal .newydhhang input[type=date], .dsh-modal .newydhhang select {
  width: auto; max-width: 100%; min-width: 96px;
}
/* 字段多的编辑弹窗（如编辑项目）用宽版，行内字段能排下 */
.dsh-modal.wide { max-width: 780px; }

/* ============ 进度条 ============ */
.bfbwk { float: left; background: #eef2f7; border: 1px solid var(--c-border); width: 380px; height: 20px; text-align: center; position: relative; border-radius: 999px; overflow: hidden; }
.bfbnk { position: absolute; left: 0; top: 0; background: linear-gradient(90deg, #22c55e, #16a34a); height: 20px; width: 0%; text-align: center; color: #fff; font-size: 12px; line-height: 20px; transition: width .2s; }

/* ============ 统计卡片 ============ */
.statcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.statcard {
  padding: 18px 8px; background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--r-md); text-align: center; box-shadow: var(--shadow-1);
  transition: transform .15s, box-shadow .15s;
}
.statcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.statcard .num { font-size: 30px; color: var(--c-teal); font-weight: 700; }
.statcard .lbl { font-size: 13px; color: var(--c-text-2); margin-top: 4px; }

/* ============ 提示 ============ */
.tips { color: var(--c-text-2); font-size: 12.5px; line-height: 20px; }
.tipred { color: var(--c-danger); }

/* ============ 打印页 ============ */
/* 打印默认纸张：A4 纵向（各打印页如需 A3/横向自行 @page 覆盖） */
@page { size: A4 portrait; margin: 12mm; }
.printpage { width: 100%; }
.printpage { max-width: 100%; overflow: visible; }
.printpage table { max-width: 100%; }
.printpage table { width: 100%; }
.printpage table td, .printpage table th { border: 1px solid #000; padding: 3px 6px; font-size: 12px; }
.printtitle { text-align: center; font-size: 20px; font-weight: 700; margin: 8px 0; }
.printsub { text-align: center; font-size: 13px; margin: 4px 0; }
.certbox {
  width: 640px; margin: 14px auto; border: 3px solid var(--c-accent-h); border-radius: 12px;
  padding: 20px; text-align: center; page-break-inside: avoid; background: #fffef8;
}
.awardbox {
  width: 700px; height: 470px; margin: 16px auto; border: 6px double #b91c1c;
  border-radius: 16px; padding: 40px; text-align: center;
  page-break-inside: avoid; background: #fffdf2; position: relative;
}
.awardbox .atitle { font-size: 44px; color: #b91c1c; font-weight: 700; letter-spacing: 20px; margin: 10px 0 30px 0; }
.awardbox .aline { font-size: 20px; line-height: 44px; }
.awardbox .afoot {
  position: absolute; bottom: 30px; right: 56px; font-size: 15px;
  text-align: right; line-height: 26px;   /* 落款靠右下，符合正式奖状格式 */
}
/* 奖状纸型/方向（对齐旧系统 Print5：16K/A4 × 横/竖） */
.awardbox.p-a4-landscape { width: 700px; height: 470px; }
.awardbox.p-a4-portrait { width: 470px; height: 700px; }
.awardbox.p-16k-landscape { width: 690px; height: 492px; }
.awardbox.p-16k-portrait { width: 492px; height: 690px; }
.awardbox.p-a4-portrait .atitle, .awardbox.p-16k-portrait .atitle { letter-spacing: 10px; }

@media print {
  /* 打印一律走浅色：深色偏好常驻会把标题/说明留成浅灰，白纸上不可见。
     用 html:root 提高特异性，压过文件末尾 (prefers-color-scheme: dark) 的 :root */
  html:root {
    --c-bg: #fff; --c-card: #fff; --c-border: #ccc;
    --c-text: #000; --c-text-2: #333; --c-text-3: #555;
    --c-primary: #000; --c-primary-h: #000;
    --c-primary-soft: #fff; --c-success-soft: #fff; --c-warn-soft: #fff; --c-danger-soft: #fff;
  }
  .adone, .noprint, .tabbar, .btcs, .dsh-modal-mask, .msgbox, .toast-stack { display: none !important; }
  body { background: #fff; color: #000; }
  /* 打印强制浅色：v3.2 只重置了 body，深色偏好下斑马纹会把偶数行印成深灰块 */
  table, table tr, table tr td, table tr th, table tr:nth-child(even) td, table tr:hover td {
    background: #fff !important; color: #000 !important;
  }
  .badge, .badge.green, .badge.orange, .badge.red, .badge.blue, .badge.gray {
    background: #fff !important; color: #000 !important; border-color: #666 !important;
  }
  /* 防内容越界：长文本允许断行，定宽卡片不超出纸张可打印区 */
  body { overflow-wrap: anywhere; word-break: break-word; }
  .printpage > * { max-width: 100%; }
  .printpage img, .printpage table { max-width: 100%; }
  .printpage .certbox, .printpage .awardbox { max-width: 100%; margin-left: auto; margin-right: auto; }
  .printpage table td, .printpage table th { font-size: 11px; }
}

/* ============ 手机/班主任端 ============ */
.mpage { max-width: 640px; margin: 0 auto; background: var(--c-bg); min-height: 100vh; text-align: left; box-shadow: 0 0 24px rgba(0,0,0,.06); }
.mheader {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-deep) 100%);
  color: #fff; padding: 12px 14px; font-size: 17px; text-align: center; font-weight: 600;
  /* 只让 .mnav 吸顶：两层都 sticky 会互相盖住（v3.2 现场反馈标题被压住）。
     标题过长用省略号收尾，不能把右边控件挤出去 */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.mnav {
  background: var(--c-accent); color: #fff; padding: 4px 6px; text-align: center;
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: center;
  gap: 2px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mnav::-webkit-scrollbar { display: none; }
.mnav a { color: #fff; font-size: 14px; padding: 9px 10px; flex: none; white-space: nowrap; border-radius: 6px; }
.mnav a:active { background: rgba(0, 0, 0, .14); }
.mbody { padding: 12px; }
.mcard {
  background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 14px; margin: 10px 0; box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.mcard:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.mcard:active { transform: translateY(0); box-shadow: var(--shadow-1); }
/* 卡片右侧箭头：明确"可点"，原来只有 hover 变色 */
.mcard::after {
  content: '\203A'; position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); color: var(--c-text-3);
  font-size: 20px; line-height: 1; pointer-events: none;
}
.mcard { position: relative; padding-right: 34px; }
.mcard h3 { margin: 0 0 8px 0; color: var(--c-teal); font-size: 16px; }
.mbtn {
  display: inline-block; background: var(--c-primary); color: #fff; border: 0;
  border-radius: var(--r-sm); padding: 7px 16px; cursor: pointer; font-size: 14px; margin: 2px;
  transition: background .15s;
}
.mbtn:hover { background: var(--c-primary-h); }
.mbtn.gray { background: #6b7280; }
.mbtn.red { background: var(--c-danger); }
.mbtn.sm { padding: 4px 10px; font-size: 13px; }
.minput { border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 7px; width: 200px; font-size: 14px; }
.minput:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }

/* ============ 照片 ============ */
.aphoto { width: 44px; height: 58px; object-fit: cover; border: 1px solid var(--c-border); border-radius: var(--r-sm); }
.aphoto-big { width: 90px; height: 120px; object-fit: cover; border: 2px solid var(--c-border); border-radius: var(--r-sm); }

/* ============ 空状态 ============ */
.empty {
  text-align: center; color: var(--c-text-3); padding: 32px 16px 30px; font-size: 13.5px;
  border: 1px dashed var(--c-border); border-radius: var(--r-md); background: #fafbfc;
}
.empty::before {
  content: '\1F5C2'; display: block; font-size: 26px; line-height: 1;
  opacity: .45; margin-bottom: 10px;
}
.empty b { display: block; font-size: 15px; color: var(--c-text-2); margin-bottom: 4px; }
.empty .empty-act { margin-top: 12px; }

/* ============ 深色模式（P2） ============ */
/* ============ 深色主题 ============
   两套入口，规则必须保持同步：
     ① html[data-theme="dark"]        —— 用户手动选深色
     ② html:not([data-theme="light"]) —— 未手动指定且系统为深色（跟随系统）
   打印时由 @media print 的 html:root 强制浅色，不受此处影响。
   改动深色配色时请同时改下面两块。
   ============================================================ */

  html[data-theme="dark"] {
    --c-bg: #0f172a; --c-card: #1e293b; --c-border: #334155;
    --c-text: #e2e8f0; --c-text-2: #94a3b8; --c-text-3: #64748b;
    --c-primary-soft: #0d3b45; --c-success-soft: #14532d; --c-warn-soft: #451a03;
    --c-danger-soft: #450a0a;
    /* 深底上的品牌色必须提亮，否则统计数字/分区标题读不出来 */
    --c-teal: #7fd1e0; --c-teal-h: #9adcea;
    --c-warn: #fbbf24; --c-success: #4ade80; --c-danger: #f87171;
    --c-track: #26303f;
  }
  html[data-theme="dark"] table th { background: #263449; }
  html[data-theme="dark"] table tr:nth-child(even) td { background: #1a2436; }
  html[data-theme="dark"] table tr:hover td { background: #24324a; }
  html[data-theme="dark"] .fieldsetbox, .statcard, .mcard, .tabbar .tab { background: var(--c-card); }
  html[data-theme="dark"] .toast { background: var(--c-card); color: var(--c-text); }
  html[data-theme="dark"] .toast.err { background: #2a1416; }
  html[data-theme="dark"] .toast.warn { background: #2a1f0c; }
  html[data-theme="dark"] .msgbox { background: var(--c-card); }
  html[data-theme="dark"] .empty { background: #16213a; }

@media (prefers-color-scheme: dark) {

  html:not([data-theme="light"]) {
    --c-bg: #0f172a; --c-card: #1e293b; --c-border: #334155;
    --c-text: #e2e8f0; --c-text-2: #94a3b8; --c-text-3: #64748b;
    --c-primary-soft: #0d3b45; --c-success-soft: #14532d; --c-warn-soft: #451a03;
    --c-danger-soft: #450a0a;
    /* 深底上的品牌色必须提亮，否则统计数字/分区标题读不出来 */
    --c-teal: #7fd1e0; --c-teal-h: #9adcea;
    --c-warn: #fbbf24; --c-success: #4ade80; --c-danger: #f87171;
    --c-track: #26303f;
  }
  html:not([data-theme="light"]) table th { background: #263449; }
  html:not([data-theme="light"]) table tr:nth-child(even) td { background: #1a2436; }
  html:not([data-theme="light"]) table tr:hover td { background: #24324a; }
  html:not([data-theme="light"]) .fieldsetbox, .statcard, .mcard, .tabbar .tab { background: var(--c-card); }
  html:not([data-theme="light"]) .toast { background: var(--c-card); color: var(--c-text); }
  html:not([data-theme="light"]) .toast.err { background: #2a1416; }
  html:not([data-theme="light"]) .toast.warn { background: #2a1f0c; }
  html:not([data-theme="light"]) .msgbox { background: var(--c-card); }
  html:not([data-theme="light"]) .empty { background: #16213a; }
}

/* ============================================================
   报名矩阵（班主任端）— 行是运动员，列是项目，格子就是报名
   见 templates/teacher.html 的 mv2()。命名统一 mx 前缀，避免与旧类冲突。
   ============================================================ */
.mxbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mxstat { flex: 1 1 84px; background: var(--c-bg); border-radius: var(--r-sm); padding: 8px 10px; }
.mxstat b { display: block; font-size: 19px; line-height: 1.15; }
.mxstat span { font-size: 11.5px; color: var(--c-text-2); }
.mxstat.ok b { color: var(--c-success); }
.mxstat.warn b { color: var(--c-accent); }

.mxtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.mxtab { padding: 6px 13px; border: 1px solid var(--c-border); border-radius: 999px;
         font-size: 13px; cursor: pointer; background: var(--c-card); color: var(--c-text); }
.mxtab.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.mxtab .n { font-size: 11.5px; opacity: .8; margin-left: 3px; }

.mxseg { display: inline-flex; border: 1px solid var(--c-border); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.mxseg button { padding: 5px 14px; font-size: 13px; border: 0; background: var(--c-card); color: var(--c-text); cursor: pointer; }
.mxseg button.on { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 600; }

.mxtx thead th .en { display: block; line-height: 1.25; }
.mxtx thead th .cap { display: block; font-size: 10.5px; font-weight: 400; opacity: .8; }
.mxwrap { overflow-x: auto; -webkit-overflow-scrolling: touch;
          border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-card); }
/* width:100% 让少量项目时把表格撑满（否则右边一大片空白）；
   列只给 min-width，项目多时靠 min-width 顶住、整体横向滚动 */
table.mxtx { border-collapse: separate; border-spacing: 0; width: 100%; }
table.mxtx th, table.mxtx td { border-bottom: 1px solid var(--c-border); padding: 0; text-align: center; }
table.mxtx tr:last-child td { border-bottom: 0; }
table.mxtx thead th { background: var(--c-bg); padding: 6px 3px; font-weight: 600;
                      font-size: 11.5px; color: var(--c-text-2); white-space: nowrap; }
table.mxtx thead th.full { color: #cbd5e1; background: #f8fafc; }
table.mxtx th.mxwho, table.mxtx td.mxwho {
  width: 88px; min-width: 88px; text-align: left; padding: 5px 8px;
  position: sticky; left: 0; background: var(--c-card); z-index: 2; white-space: nowrap; }
table.mxtx thead th.mxwho { background: var(--c-bg); z-index: 3; }
table.mxtx td.mxwho { font-size: 13px; }
table.mxtx td.mxwho .nm { font-size: 13px; line-height: 1.3; }
table.mxtx td.mxwho .sub { font-size: 11px; line-height: 1.3; color: var(--c-text-3); }
/* 报名卡片不是可点卡片，去掉通用 .mcard 右侧那个「>」箭头（会让人以为能点进去） */
#mv2 .mcard::after { content: none; }

/* 班主任端整页、检录页、录成绩页的 mcard 都不可点：箭头只会误导，
   而且 padding-right:34px 白占宽度（手机上内容本来就窄） */
#mv1 .mcard::after, #mv3 .mcard::after, #mv4 .mcard::after, #mv5 .mcard::after,
#evinfo .mcard::after, #evlist .mcard::after { content: none; }
#mv1 .mcard, #mv3 .mcard, #mv4 .mcard, #mv5 .mcard,
#evinfo .mcard, #evlist .mcard { padding-right: 14px; }

.mxcell { width: 100%; height: 36px; border: 0; background: none; cursor: pointer;
          display: flex; align-items: center; justify-content: center; padding: 0; }
.mxbox { width: 21px; height: 21px; border: 1.5px solid #cbd5e1; border-radius: 5px;
         display: flex; align-items: center; justify-content: center;
         font-size: 13px; line-height: 1; color: #fff; background: var(--c-card); }
.mxcell.on .mxbox { background: var(--c-success); border-color: var(--c-success); }
.mxcell.off { cursor: not-allowed; }
.mxcell.off .mxbox { background: #f1f5f9; border-color: #e2e8f0; }
.mxcell.wd .mxbox { background: #fff; border-color: var(--c-warn); color: var(--c-warn); font-size: 15px; }
.mxcell.pending .mxbox { opacity: .4; }
.mxcell:not(.off):hover .mxbox { border-color: var(--c-primary); }

.mxtip { font-size: 12.5px; color: var(--c-text-2); margin: 8px 0; line-height: 1.7; }
.mxtip.warn { color: var(--c-accent); }
.mxact { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ============ 手机端适配收口（390~430px 真机） ============
   目标：单手竖屏可用——文字不小于 13px、可点区域不小于 42px、
   输入框 ≥16px（iOS 小于 16px 会自动放大页面，现场录成绩很难受）。 */
@media (max-width: 520px) {
  /* 手机上提示条改成底部浮条：放顶部会盖住页面标题，而且横向容易顶出屏幕 */
  .msgbox {
    top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px; right: 12px; max-width: none;
    padding: 11px 14px; font-size: 13.5px; line-height: 1.6;
  }
  .mbody { padding: 10px 12px calc(26px + env(safe-area-inset-bottom, 0px)); }
  .mnav { justify-content: flex-start; }
  .mcard { padding: 12px; margin: 9px 0; }
  .mcard h3 { font-size: 15.5px; }
  .mbtn { padding: 10px 16px; min-height: 42px; font-size: 15px; }
  .mbtn.sm { padding: 8px 12px; min-height: 38px; }
  .minput, .login-row input, .login-row select, select.lbk, input.lbk, textarea.lbk { font-size: 16px; }
  .minput { padding: 10px; }
  /* 登录页：460px 卡片在手机上贴边，标签+输入挤成两行 */
  #yuanjiaokuang { width: auto; margin: 0 10px; max-width: none; }
  #ydhname { height: auto; line-height: 1.4; padding: 12px 8px; font-size: 18px; }
  #logintext { flex-wrap: wrap; margin: 10px 10px 0; }
  #logintext span { padding: 7px 11px; font-size: 13.5px; white-space: nowrap; }
  #bzrbtkuang { padding: 14px 12px; margin: 0 10px 12px; }
  .login-row label { width: 62px; font-size: 13.5px; }
  .login-row input, .login-row select { height: 44px; }
  #butdiv { margin-top: 14px; }
  #butdiv .btcs { min-width: 96px; min-height: 44px; font-size: 15.5px; }
  .buttomtext { font-size: 11.5px; line-height: 1.7; padding: 6px 12px; }
}

/* ============ 管理端窄屏（手机/小平板） ============ */
@media (max-width: 720px) {
  .adone { margin: 6px; border-radius: 10px; }
  #ydhtitle { height: auto; line-height: 1.6; flex-wrap: wrap; gap: 4px; padding: 8px 10px; }
  #titletext { font-size: 15.5px; }
  #systuichu { line-height: 1.9; font-size: 12px; display: flex; align-items: center;
               gap: 6px; flex-wrap: wrap; }
  .voice-toggle { margin-right: 0; padding: 3px 9px; font-size: 11.5px; }
  #systongzhi, #licbar { padding: 6px 10px; font-size: 11.5px; }
  #adleft { width: 52px; padding: 8px 2px; }
  .admenu, .admenu2 { line-height: 32px; margin: 4px 0; }
  #adright { padding: 10px; }
  .crumbs { font-size: 12px; }
  /* 宽表格不强行改 display（会把列对齐全毁掉），让内容区自己横向滚动 */
  #adright { overflow-x: auto; }
}

/* 管理端的手机入口提示：默认藏起来，桌面不打扰 */
.mobi-tip { display: none; }
@media (max-width: 720px) {
  .mobi-tip { display: block; padding: 7px 10px; font-size: 12px; line-height: 1.6;
    background: #eef6f9; color: #0f5c6e; border-bottom: 1px solid #d7e6ec; }
  .mobi-tip a { color: #0f5c6e; font-weight: 700; text-decoration: underline; }
}
