/* =====================================================================
   新芮运动会报名编排统计系统 —— 全局样式
   现代化 / 响应式 / 打印友好
   版本: v1.0 (修改本文件请同步升级模板中的 ?v= 参数)
   ===================================================================== */

:root {
    --primary: #1e6fd9;
    --primary-dark: #1554a8;
    --primary-light: #e8f1fd;
    --success: #18a058;
    --warning: #f0a020;
    --danger: #e0434c;
    --text: #1f2937;
    --text-sub: #6b7280;
    --border: #e5e7eb;
    --bg: #f4f6f9;
    --card: #ffffff;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(16, 42, 80, .08);
    --shadow-lg: 0 8px 28px rgba(16, 42, 80, .14);
    --nav-w: 216px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px; color: var(--text); background: var(--bg);
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; border: 0; }

/* ---------------- 布局 ---------------- */
.app-header {
    position: sticky; top: 0; z-index: 60;
    background: linear-gradient(120deg, var(--primary) 0%, #2b8fff 100%);
    color: #fff; box-shadow: var(--shadow);
}
.app-header .hd-inner {
    max-width: 1500px; margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 14px;
}
.app-header .logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header .logo .mark {
    width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
    background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
}
.app-header .logo .txt { min-width: 0; }
.app-header .logo .t1 { font-size: 16px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .logo .t2 { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .spacer { flex: 1; }
.app-header .hd-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.app-header .hd-user .avatar {
    width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.app-header a { color: #fff; }
.btn-link { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff;
    padding: 5px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.btn-link:hover { background: rgba(255,255,255,.3); text-decoration: none; }

.app-body { max-width: 1500px; margin: 0 auto; padding: 16px; display: flex; gap: 16px; align-items: flex-start; }
.app-side { width: var(--nav-w); flex: 0 0 var(--nav-w); position: sticky; top: 68px; }
.app-main { flex: 1; min-width: 0; }

/* ---------------- 侧栏导航 ---------------- */
.side-nav { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.side-nav .grp-title { font-size: 12px; color: var(--text-sub); padding: 10px 12px 4px; font-weight: 700; }
.side-nav a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: 14px; margin-bottom: 2px;
}
.side-nav a:hover { background: var(--primary-light); text-decoration: none; }
.side-nav a.on { background: var(--primary); color: #fff; font-weight: 600; }
.side-nav a .ic { width: 20px; text-align: center; opacity: .9; }

/* ---------------- 移动端底部导航 ---------------- */
.mobile-tabs {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,.06);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    /* 手机上标签多于屏宽: 允许横向滑动, 吸附到标签边界(滑起来像原生标签栏, 也提示还有后续标签) */
    scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.mobile-tabs .tb { display: flex; min-width: 100%; }
.mobile-tabs a {
    flex: 1 0 auto; min-width: 72px; text-align: center; padding: 8px 6px; font-size: 12px; color: var(--text-sub);
    scroll-snap-align: start;
}
.mobile-tabs a.on { color: var(--primary); font-weight: 700; }
.mobile-tabs a .ic { display: block; font-size: 18px; margin-bottom: 2px; }

/* ---------------- 卡片 / 区块 ---------------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card > .hd {
    padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card > .hd .sub { font-weight: 400; font-size: 12px; color: var(--text-sub); }
.card > .bd { padding: 14px 16px; }
.card > .bd.flush { padding: 0; }
.spacer { flex: 1; }

/* ---------------- 统计块 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
    background: linear-gradient(135deg, #fff 0%, #f7faff 100%);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center;
}
.stat .n { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.stat.ok .n { color: var(--success); }
.stat.warn .n { color: var(--warning); }
.stat.err .n { color: var(--danger); }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 14px; border: 1px solid var(--border); background: #fff; color: var(--text);
    border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1.4; white-space: nowrap;
    transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { opacity: .9; color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { opacity: .9; color: #fff; }
.btn.warn { background: var(--warning); border-color: var(--warning); color: #fff; }
/* 导出/下载防连点: 锁定期间置灰(配合 app.js 的 [data-lock] 处理) */
.ydh-off { opacity: .55 !important; cursor: progress !important; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 10px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > label { font-size: 12px; color: var(--text-sub); font-weight: 600; }
.fld .hint { font-size: 11px; color: #9ca3af; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=tel], input[type=email], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
    min-height: 38px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,111,217,.12); }
textarea { min-height: 90px; resize: vertical; }
label.cb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .fld { min-width: 130px; }
/* 占满一行: 参赛证的项目多选等较长勾选列表 */
.inline-form .fld.wide { flex: 1 0 100%; }
.cb-tools { display: flex; gap: 6px; margin-bottom: 2px; }
.cb-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px 12px; max-height: 150px; overflow: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.cb-grid label.cb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 可搜索下拉(单位选择) ---------------- */
.combo { position: relative; }
.combo-list {
    position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 40;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto;
}
.combo-list .it { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f3f4f6; }
.combo-list .it:last-child { border-bottom: 0; }
.combo-list .it:hover { background: var(--primary-light); }
.combo-list .it .sub { color: var(--text-sub); font-size: 12px; margin-top: 2px; }
.combo-empty { padding: 10px 12px; color: var(--text-sub); font-size: 12px; }
.pick {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
    padding: 5px 10px; background: var(--primary-light); color: var(--primary);
    border-radius: 8px; font-size: 13px;
}
.pick .x { cursor: pointer; font-weight: 700; padding: 0 2px; }
.school-search { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* ---------------- 表格 ---------------- */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
table.tb th, table.tb td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.tb th { background: #f8fafc; font-weight: 700; color: var(--text-sub); white-space: nowrap; position: sticky; top: 0; }
table.tb tbody tr:hover { background: #f9fbff; }
table.tb td.c, table.tb th.c { text-align: center; }
table.tb .act { white-space: nowrap; }
/* 姓名列不折行: 中文姓名两三字被挤成两行很难看 */
table.tb .nm { white-space: nowrap; }
table.tb .act a { margin: 0 4px; }
/* 分组名单: 点了「交换」等待选第二个人时, 第一个行高亮 */
table.tb tr.swap-pick td { background: #fff7e6 !important; box-shadow: inset 0 1px 0 #f59e0b, inset 0 -1px 0 #f59e0b; }
table.tb input[type=text] { min-height: 30px; padding: 4px 6px; font-size: 13px; }
/* 裁判空白表: 一页一块, 一页排满后剩余高度由 flex 摊成表间距, 便于裁剪 */
/* 整页块高度 = A4 297mm − @page sheet 上下边距 8mm×2 = 281mm 可用, 块取 275mm(底部留 6mm 切边/防舍入错页) */
.sheet-page { height: 275mm; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; gap: 10mm; page-break-inside: avoid; }
.sheet-page.page-break { page-break-after: always; }
.sheet-page.page-start { page-break-before: always; }
/* 检查表页顶部留一行空白: 首张表上面太空会不好写字(box-sizing:border-box, 不改整页高度) */
.sheet-page.chk-page { padding-top: 8mm; }
/* 空白记圈表: 1 圈数列 + 20 队员列 + 每圈第1名成绩 + 脱圈人数, 屏幕上横向滚动 */
table.tb.blank-lap { min-width: 900px; font-size: 11px; table-layout: fixed; }
table.tb.blank-lap th, table.tb.blank-lap td { padding: 4px 2px; }
/* 田赛记录表: 裁判要手写米数/次数, 书写行高按 9mm 留够 */
table.tb.tb-field tbody td { height: 9mm; }
/* 田赛测距记录表: 预赛 3 次 + 预赛最好/名次 + 决赛 3 次 + 最终成绩/名次, 表头折两行才放得下 */
table.tb.tb-fld2 { table-layout: fixed; }
table.tb.tb-fld2 th { white-space: normal; line-height: 1.25; }
/* 跳高/撑杆跳记录表: 12 个高度列, 每列内叠 3 小格 = 该高度的 3 次机会 */
table.tb.tb-hj { min-width: 720px; font-size: 11px; table-layout: fixed; }
table.tb.tb-hj th, table.tb.tb-hj td { padding: 3px 2px; overflow: hidden; }
/* 表头里的虚线给裁判写该列的实际高度(如 1.20) */
table.tb.tb-hj th.hj-h { padding: 3px 1px; line-height: 1.25; }
table.tb.tb-hj th.hj-h i { display: block; height: 11px; margin-top: 2px; border-bottom: 1px dotted #9aa7b8; }
table.tb.tb-hj td.hj { padding: 0; }
table.tb.tb-hj td.hj i { display: block; height: 5mm; border-bottom: 1px dotted #b7c3d3; }
table.tb.tb-hj td.hj i:last-child { border-bottom: 0; }
.tb-empty { padding: 28px; text-align: center; color: var(--text-sub); }

/* ---------------- 徽标 ---------------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--primary-light); color: var(--primary); }
.tag.ok { background: #e7f7ee; color: var(--success); }
.tag.warn { background: #fdf3e3; color: var(--warning); }
.tag.err { background: #fdeaea; color: var(--danger); }
.tag.gray { background: #f1f2f4; color: var(--text-sub); }

/* ---------------- 提示 / 弹窗 ---------------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; border: 1px solid transparent; }
.alert.ok { background: #e7f7ee; color: #137a45; border-color: #b7e6cd; }
.alert.err { background: #fdeaea; color: #b3262e; border-color: #f6c9cc; }
.alert.warn { background: #fdf3e3; color: #92610b; border-color: #f5dfae; }
.alert.info { background: var(--primary-light); color: var(--primary-dark); border-color: #c3ddfa; }

.mask { position: fixed; inset: 0; background: rgba(15,25,40,.5); z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.mask.on { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal .mh { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; align-items: center; }
.modal .mb { padding: 16px; overflow: auto; }
.modal .mf { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal .close { cursor: pointer; color: var(--text-sub); font-size: 20px; line-height: 1; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; }
#toast .t { background: rgba(25,35,50,.92); color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; box-shadow: var(--shadow-lg); animation: fadeIn .2s; }
#toast .t.ok { background: rgba(24,160,88,.95); }
#toast .t.err { background: rgba(224,67,76,.95); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ---------------- 首页 ---------------- */
.hero {
    background: linear-gradient(120deg, #1e6fd9 0%, #35a3ff 60%, #52c7ff 100%);
    color: #fff; border-radius: 16px; padding: 26px 22px; margin-bottom: 16px; box-shadow: var(--shadow-lg);
}
.hero h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.hero p { margin: 4px 0; opacity: .92; font-size: 13px; }
.hero .btns { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { background: #fff; color: var(--primary); border-color: #fff; font-weight: 600; }
.hero .btn.ghost { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.5); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #c3ddfa; }
.feature .fi { font-size: 24px; margin-bottom: 6px; }
.feature h4 { margin: 0 0 4px; font-size: 15px; }
.feature p { margin: 0; font-size: 12px; color: var(--text-sub); line-height: 1.6; }

/* 门户「选择学校」网格: 桌面每行 5 个, 卡片比通用 feature 紧凑 */
.school-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.school-grid .feature { padding: 12px; }
.school-grid .feature .fi { font-size: 20px; margin-bottom: 4px; }
.school-grid .feature h4 { font-size: 14px; overflow-wrap: anywhere; }
@media (min-width: 1100px) { .school-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* 门户「没有您的单位？免费申请试用」引导条 */
.apply-cta {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 12px; padding: 16px 18px; border-radius: var(--radius);
    background: linear-gradient(100deg, var(--primary) 0%, #39a6f9 60%, #4ec9f5 100%);
    color: #fff; box-shadow: var(--shadow-lg);
}
.apply-cta .txt b { display: block; font-size: 17px; letter-spacing: .5px; }
.apply-cta .txt span { font-size: 12px; opacity: .92; }
.apply-cta .apply-btn {
    margin-left: auto; padding: 11px 26px; font-size: 16px; border-radius: 999px;
    background: #fff; color: var(--primary); border-color: #fff; font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.apply-cta .apply-btn:hover { background: #fff3cd; color: var(--primary-dark); border-color: #fff3cd; transform: translateY(-1px); }
@media (prefers-reduced-motion: no-preference) {
    .apply-cta .apply-btn { animation: cta-pop 2.2s ease-in-out infinite; }
    @keyframes cta-pop { 0%, 70%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 35% { transform: translateY(-2px); box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); } }
}
@media (max-width: 640px) { .apply-cta .apply-btn { margin-left: 0; width: 100%; text-align: center; } }

.steps { counter-reset: s; }
.steps .step { position: relative; padding: 8px 0 8px 34px; border-bottom: 1px dashed var(--border); font-size: 13px; line-height: 1.7; }
.steps .step:before {
    counter-increment: s; content: counter(s);
    position: absolute; left: 0; top: 8px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.steps .step:last-child { border-bottom: 0; }

/* ---------------- 登录 ---------------- */
.login-wrap { max-width: 380px; margin: 40px auto; }
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px; }
.login-card h2 { margin: 0 0 4px; font-size: 20px; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-sub); font-size: 12px; margin-bottom: 18px; }

/* 竞赛日程按大类分节的节头行 */
table.tb tr.sch-cat td { background: #eef3fb; font-weight: 800; text-align: center; letter-spacing: 1px; }
@media print { table.tb tr.sch-cat td { background: #e8eef8 !important; } }

/* 分组名单·道次版式: 列为道次(每张表最多12列), 行为组次, 格内=姓名+换行+参赛队 */
table.tb.tb-group-grid { table-layout: fixed; min-width: 0; }
table.tb.tb-group-grid th, table.tb.tb-group-grid td {
    padding: 6px 2px; text-align: center; vertical-align: middle; word-break: break-word; line-height: 1.35;
}
table.tb.tb-group-grid td .grp-team { color: var(--text-sub); font-size: 11px; }
.grp-block { margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
.grp-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
@media print {
    table.tb.tb-group-grid { min-width: 0; font-size: 9.5px; }
    table.tb.tb-group-grid th, table.tb.tb-group-grid td { padding: 3px 1px; }
    table.tb.tb-group-grid td .grp-team { font-size: 8.5px; }
    .grp-title { font-size: 11pt; margin-bottom: 2mm; }
    .grp-block { margin-bottom: 4mm; }
}

/* ---------------- 分类教练录入(报名页 / 管理端编辑弹窗) ---------------- */
.coach-cat { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-top: 8px; background: #fbfcfe; }
.coach-cat .cc-hd { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.coach-cat .cc-cap { color: var(--text-sub); font-size: 12px; }
.coach-cat .cc-sub { color: var(--text-sub); font-size: 12px; font-weight: 400; margin-left: 6px; }
.coach-cat .cc-hd .btn { margin-left: auto; }
.coach-cat .cc-rows { display: flex; flex-direction: column; gap: 6px; }
.coach-cat .cc-row { display: grid; grid-template-columns: 76px 1fr 1fr 32px; gap: 6px; align-items: center; }
.coach-cat .cc-row select, .coach-cat .cc-row input { padding: 6px 8px; font-size: 13px; }
.coach-cat .cc-x { padding: 4px 8px; }
@media (max-width: 480px) {
    .coach-cat .cc-row { grid-template-columns: 62px 1fr 1fr 28px; }
}

/* 系统设置: 教练小类分组表(大类表头 + 小类行) */
.cc-tb .cc-cat-hd td { background: #f2f6fc; border-top: 2px solid var(--border); }
.cc-tb .cc-cat-hd input.cc-note, .cc-tb .cc-cat-hd input.ac-note { padding: 5px 8px; font-size: 12px; }
.cc-tb tr.cc-row td:first-child, .cc-tb tr.ac-row td:first-child { padding-left: 22px; }
.cc-tb tr.cc-row:last-child td { border-bottom: 1px solid var(--border); }

/* ---------------- 球类对阵(小组积分表 + 淘汰赛签表) ---------------- */
/* .muted 在多个列表页用作"未填/不限"的弱化文字, 之前一直没有定义 */
.muted { color: var(--text-sub); }
.cup-grp { margin-bottom: 14px; }
.cup-rnd { width: 116px; white-space: nowrap; }
.cup-grp-hd { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.cup-ko { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; }
.cup-ko-col { flex: 1 0 168px; min-width: 168px; }
.cup-ko-hd { font-size: 12px; font-weight: 700; color: var(--text-sub); text-align: center; margin-bottom: 6px; }
.cup-ko-card { border: 1px solid var(--border); border-radius: 8px; padding: 5px 7px; margin-bottom: 10px; background: #fff; }
.cup-ko-time { font-size: 11px; color: var(--text-sub); text-align: center; margin-bottom: 3px; }
.cup-ko-t { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 1px 0; }
.cup-ko-t .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cup-ko-t .sc { width: 22px; text-align: right; color: var(--text-sub); }
.cup-ko-t.win { font-weight: 700; color: var(--primary); }
.cup-ko-t.win .sc { color: var(--primary); }
.cup-ko-in { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; }
.cup-ko-in input { padding: 3px 5px; }

/* ---------------- 参赛证 / 打印 ---------------- */
.badges { display: flex; flex-wrap: wrap; gap: 12px; }
.badge {
    width: 240px; border: 1px solid #c9d6e6; border-radius: 10px; padding: 10px; background: #fff;
    display: flex; gap: 10px; page-break-inside: avoid;
}
.badge .ph { width: 76px; height: 100px; border: 1px solid #dfe6ee; border-radius: 6px; object-fit: cover; background: #f5f7fa; }
.badge .info { flex: 1; font-size: 12px; line-height: 1.7; }
.badge .info .nm { font-size: 16px; font-weight: 800; }
.badge .info .no { color: var(--primary); font-weight: 700; }

/* 参赛证预览版式: 与打印一致(名称置顶, 照片+信息在下), 寸照适当增大 */
/* 屏幕预览忽略「每页」分组盒, 保持连续流式; 打印时该盒才承担分页 */
.badges > .badge-page { display: contents; }
/* 背景底图只在打印时逐页铺(屏幕是流式预览, 分页盒没有自己的盒子, 铺出来会挤成一个巨块) */
.badges .badge-bg { display: none; }
.badge-area .badge { width: 300px; flex-direction: column; }
.badge-area .bh {
    font-size: 14px; font-weight: 800; text-align: center; color: var(--primary);
    border-bottom: 1px solid #e3eaf3; padding-bottom: 4px; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge-area .bc { display: flex; gap: 10px; align-items: center; }
.badge-area .badge .ph { width: 90px; height: 120px; }
.badge-area .badge .info { font-size: 12px; line-height: 1.6; }

/* 球类队证(每队一张): 项目 + 队名 + 领队教练 + 全体队员名单 */
.badge-area .tb-badge { width: 330px; }
.tb-badge .tb-ev { font-size: 15px; font-weight: 800; text-align: center; }
.tb-badge .tb-team { font-size: 13px; font-weight: 700; margin: 4px 0; }
.tb-badge .tb-meta { font-size: 12px; line-height: 1.6; }
.tb-badge .tb-roster { display: flex; gap: 10px; margin-top: 6px; }
.tb-badge .tb-col { flex: 1; font-size: 11.5px; }
.tb-badge .tb-p { display: flex; gap: 6px; border-bottom: 1px dotted #dde3ea; padding: 1px 0; }
.tb-badge .tb-p .no { width: 34px; color: var(--primary); font-weight: 700; }
.tb-badge .tb-p .nm { flex: 1; }
.tb-badge .tb-foot { margin-top: 6px; font-size: 11px; color: var(--text-sub); }

/* 队证「含照片」版式: 一队一张 A4, 队员各一格(一寸照 + 姓名 + 号码/性别)。
   网格列数与行数由服务端按人数算好写在 style="--bcols/--brows" 上, 保证一队列在一页内。 */
.tb-photo .tb-photo-page { display: block; margin-bottom: 14px; }
.tb-photo .tb-badge { width: auto; }
/* 上传了队证底图时, 屏幕上也按"一页一张 A4"显示并把底图铺满该页(没底图时仍是流式预览) */
.badge-area.tb-photo .badge-bg { display: none; }
.badge-area.tb-photo.has-bg .badges > .badge-page {
    display: block; position: relative; width: 210mm; max-width: 100%; aspect-ratio: 210 / 297;
    box-sizing: border-box; padding: 4mm 5mm; margin: 0 auto 12px; overflow: hidden;
    background: #fff; box-shadow: 0 1px 8px rgba(15, 23, 42, .12);
}
.badge-area.tb-photo.has-bg .badge-bg {
    display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%;
    object-fit: fill; margin: 0; padding: 0; border: 0; z-index: 0;
}
.badge-area.tb-photo.has-bg .tb-badge { background: transparent; border: 0; position: relative; z-index: 1; height: 100%; }
.badge-area.tb-photo .tb-badge { display: flex; flex-direction: column; }
.tb-photo .tb-photos {
    display: grid; grid-template-columns: repeat(var(--bcols, 4), 1fr);
    grid-template-rows: repeat(var(--brows, 3), minmax(40mm, 1fr));
    gap: 3mm; margin-top: 3mm;
}
.tb-photo .tp {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1mm; padding: 1.5mm 1mm; border: 1px solid #c9d6e6; border-radius: 4px; overflow: hidden;
}
.tb-photo .tp img, .tb-photo .tp .ph-empty { width: 55%; aspect-ratio: 5 / 7; height: auto; }
.tb-photo .tp img { object-fit: cover; border-radius: 3px; }
.tb-photo .tp .ph-empty { background-color: #f4f6f9; }
.tb-photo .tp .nm { font-size: 12.5px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-photo .tp .sub { font-size: 11px; color: var(--text-sub); }

/* 无照片占位: 灰色人形图标, 与寸照 38x50 尺寸一致 */
.ph-empty {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 50px; border-radius: 4px; background-color: #eef1f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b6bfca'%3E%3Cpath d='M12 12a5 5 0 1 0-5-5 5 5 0 0 0 5 5zm0 2c-4 0-8 2-8 5v1h16v-1c0-3-4-5-8-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 22px 22px;
    vertical-align: middle;
}

.print-title { display: none; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 12px; flex-wrap: wrap; }
.pg-btn { padding: 5px 12px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.pg-info { font-size: 12px; color: var(--text-sub); }

/* ---------------- 页脚 ---------------- */
.app-footer { max-width: 1500px; margin: 0 auto; padding: 18px 16px 30px; color: var(--text-sub); font-size: 12px; text-align: center; line-height: 1.8; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
    .app-body { padding: 12px; flex-direction: column; }
    .app-side { display: none; width: 100%; flex: none; position: static; }
    .app-side.show { display: block; }
    .app-main { width: 100%; }
    .mobile-tabs { display: block; }
    body { padding-bottom: 58px; }
    .hero h1 { font-size: 20px; }
    .card > .hd { padding: 10px 12px; font-size: 14px; }
    .card > .bd { padding: 12px; }
    /* 手机上列宽按内容自适应: 窄表(如积分榜)不再被 520px 最小宽度撑出横向滚动;
       列多/输入框固定的宽表仍会超出容器, 由 .tw 横向滑动 */
    table.tb { font-size: 12px; min-width: 0; }
    .stat .n { font-size: 22px; }
    .modal { max-height: 92vh; }
}
@media (max-width: 480px) {
    .app-header .logo .t2 { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    /* 字段多且短的表单(如报名页领队/教练信息)在手机上保持两列, 降低纵向占用 */
    .form-grid.grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid.grid-2 { gap: 8px; }
    .form-grid.grid-2 .fld > label { font-size: 11px; white-space: nowrap; }
    .form-grid.grid-2 input[type=text] { padding: 7px 8px; font-size: 13px; min-height: 34px; }
    .btn { padding: 7px 10px; font-size: 12px; }
}

/* ---------------- 打印 ---------------- */
@page { size: A4; margin: 3mm; }
/* 裁判记录表(含附在后面的空白检查表/记圈表)单独用大一点的页边距:
   打印机四周通常有 4~5mm 不可打印区, 3mm 时表格最外框会被切掉。
   命名页不受支持时会退回上面的 3mm, 与改动前一致, 不会更差。 */
@page sheet { size: A4; margin: 8mm; }
.sheet-print, .sheet-page { page: sheet; }
@media print {
    body { background: #fff; padding: 0; }
    .app-header, .app-side, .mobile-tabs, .app-footer, .no-print, .pager { display: none !important; }
    .app-body { display: block; padding: 0; max-width: none; }
    .card { box-shadow: none; border: 0; margin: 0; page-break-inside: avoid; }
    .card > .hd { padding: 6px 0; }
    /* 打印时隐藏卡片头部的操作按钮与筛选控件(复制/打印/筛选等) */
    .card > .hd .btn, .card > .hd select, .card > .hd input { display: none !important; }
    .card > .bd { padding: 0; }
    table.tb th, table.tb td { padding: 4px 6px; border: 1px solid #999; }
    table.tb.blank-lap { min-width: 0; }
    /* 跳高表: 竖版 A4 内容宽 204mm, 12 个高度列各约 9mm, 只勾 O/X 够用 */
    table.tb.tb-hj { min-width: 0; font-size: 9.5px; }
    table.tb.tb-hj th, table.tb.tb-hj td { padding: 2px 1px; }
    /* 田赛测距表 15 列, 打印时用小字号 + 窄内边距 */
    table.tb.tb-fld2 { min-width: 0; font-size: 9.5px; }
    table.tb.tb-fld2 th, table.tb.tb-fld2 td { padding: 2px 1px; }
    /* 打印大标题默认不显示(裁判记录表/参赛证等每块自带小标题, 不需要占位);
       需要整页大标题的打印块给元素加 .show 显式开启 */
    .print-title { display: none; }
    .print-title.show { display: block; font-size: 16pt; font-weight: 800; text-align: center; letter-spacing: 1px; margin: 0 0 8px; }
    /* 参赛证: A4(210x297), 页边距 3mm(可用高 291mm), 每页 10 张 = 2 列 × 5 行。
       分页由服务端按 10 张切好一个 .badge-page 块、整块 break-after: page,
       不让浏览器自己切分整张大网格(切分会在第 2、4 页各吃掉一整行)。
       单张 99mm×53mm, 5 行 + 4×6mm 行距 = 289mm, 底部仅剩 2mm 切边(用户指定要这个密排)。
       注意: 2mm 安全量低于早先出问题的连续网格版, 若某些打印机再丢行, 改回 52.5mm 卡即可。 */
    .badge-area { page-break-inside: auto; }
    .badge-area .badges { display: block; }
    .badge-area .badge-page {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        column-gap: 6mm;
        row-gap: 6mm;
        align-content: start;
        position: relative;
        break-after: page; page-break-after: always;
        break-inside: avoid; page-break-inside: avoid;
    }
    /* 末块不再强制换页, 否则末尾多一张空白页 */
    .badge-area .badge-page:last-child { break-after: auto; page-break-after: auto; }
    /* 参赛证背景底图(系统设置里上传的 A4 图): 每页铺一张, 盖满整张 A4。
       .badge-page 的可用区是 204×291mm(页边距 3mm), 向左上各偏 3mm 才对到页面原点,
       这样按 210×297mm 满幅设计的 logo／套章在纸上不偏移。 */
    .badge-area .badge-bg {
        display: block; position: absolute; left: -3mm; top: -3mm;
        width: 210mm; height: 297mm; margin: 0; padding: 0; border: 0;
        object-fit: fill; z-index: 0;
    }
    /* 底图是绝对定位的, 超出分页盒的部分会被裁掉: 末页证件不足 10 张时盒高只有几十毫米,
       下半页的背景就印不出来。给铺底图的页补满整页高度(可用高 291mm), 每页都按整页铺。 */
    .badge-area.has-bg .badge-page { min-height: 291mm; }
    .badge-area .badge {
        width: auto; height: 53mm; margin: 0; padding: 2.5mm 3mm;
        box-sizing: border-box; display: flex; flex-direction: column;
        border: 1px solid #c9d6e6; border-radius: 6px; overflow: hidden;
        position: relative; z-index: 1;
        break-inside: avoid; page-break-inside: avoid;
    }
    /* 铺了底图时证件格改成透明, 否则每格的白底会把 logo／套章整个盖掉 */
    .badge-area.has-bg .badge { background: transparent; border-color: #999; }
    .badge-area.has-bg .badge .bh { border-bottom-color: #999; color: #222; }
    .badge-area.has-bg .badge .ph { background: transparent; border-color: #999; }
    .badge-area.has-bg .badge .info .no { color: #222; }
    .badge-area .bh {
        font-size: 11pt; font-weight: 800; text-align: center; color: var(--primary);
        border-bottom: 1px solid #e3eaf3; padding-bottom: 1.5mm; margin-bottom: 2mm;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .badge-area .bc { display: flex; gap: 3mm; align-items: center; flex: 1; min-height: 0; }
    .badge-area .badge .ph { width: 25mm; height: 33mm; border-radius: 3px; flex: none; }
    .badge-area .badge .info { font-size: 10.5pt; line-height: 1.45; flex: 1; min-width: 0; }
    .badge-area .badge .info .nm { font-size: 14pt; font-weight: 800; margin-bottom: 1mm; }
    .badge-area .badge .info .no { font-size: 11.5pt; color: var(--primary); font-weight: 700; }
    /* 球类队证: 每页 4 张 = 2 列 × 2 行, 单张 99×141mm(2×141 + 6mm 行距 = 288mm, 底部留 3mm 切边) */
    .badge-area .badge-page.tb-page { grid-template-rows: repeat(2, 141mm); }
    .badge-area .tb-badge { height: 141mm; padding: 3mm 3.5mm; }
    .badge-area .tb-badge .tb-ev { font-size: 13pt; font-weight: 800; text-align: center; margin: 1mm 0; }
    .badge-area .tb-badge .tb-team { font-size: 12pt; font-weight: 700; text-align: center; margin-bottom: 1mm; }
    .badge-area .tb-badge .tb-meta {
        font-size: 9.5pt; line-height: 1.5; padding: 1mm 0;
        border-top: 1px solid #999; border-bottom: 1px solid #999;
    }
    .badge-area .tb-badge .tb-roster { display: flex; gap: 4mm; flex: 1; min-height: 0; margin-top: 1.5mm; }
    .badge-area .tb-badge .tb-col { flex: 1; font-size: 9.5pt; }
    .badge-area .tb-badge .tb-p { display: flex; gap: 1.5mm; line-height: 1.55; }
    .badge-area .tb-badge .tb-p .no { width: 9mm; color: #222; font-weight: 700; }
    .badge-area .tb-badge .tb-p .nm { flex: 1; }
    .badge-area .tb-badge .tb-p .gd { width: 5mm; color: #666; }
    .badge-area .tb-badge .tb-foot {
        font-size: 9pt; color: #222; margin-top: 1mm; padding-top: 1mm; border-top: 1px solid #999;
    }
    /* 队证「含照片」: 一页一张(291mm 可用高), 照片网格吃掉标题与页脚之外的全部高度 */
    .badge-area .badge-page.tb-photo-page { display: block; grid-template-columns: none; height: 291mm; }
    .badge-area.tb-photo .tb-badge { width: 100%; height: 100%; padding: 4mm 5mm; }
    .badge-area.tb-photo .tb-ev { font-size: 16pt; }
    .badge-area.tb-photo .tb-team { font-size: 15pt; }
    .badge-area.tb-photo .tb-meta { font-size: 10.5pt; }
    .badge-area.tb-photo .tb-photos {
        flex: 1; min-height: 0; margin-top: 2.5mm; gap: 2mm;
        grid-template-rows: repeat(var(--brows, 3), minmax(0, 1fr));
    }
    .badge-area.tb-photo .tp { border-color: #999; border-radius: 2mm; gap: 0.8mm; padding: 1mm; }
    .badge-area.tb-photo .tp img, .badge-area.tb-photo .tp .ph-empty { width: 58%; }
    .badge-area.tb-photo .tp .nm { font-size: 11pt; }
    .badge-area.tb-photo .tp .sub { font-size: 9pt; }
    .badge-area.tb-photo .tb-foot { font-size: 10pt; }
}
