/* 赛事通 · 统一样式。无外部依赖，局域网离线可用。 */
:root {
  --brand: #1f5fd4;
  --brand-dark: #16408f;
  --ok: #12a150;
  --warn: #d98a00;
  --danger: #d92c2c;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.3; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .875rem; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.spacer { flex: 1 1 auto; }

/* ---------- 布局 ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem;
  background: linear-gradient(100deg, var(--brand-dark), var(--brand)); color: #fff;
  box-shadow: 0 1px 6px rgba(16,24,40,.15); position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-weight: 700; letter-spacing: .5px; display: flex; align-items: center; gap: .5rem; }
.topbar .dot { width: 9px; height: 9px; border-radius: 50%; background: #57e08f; box-shadow: 0 0 8px #57e08f; }
.topbar .dot.off { background: #ffb4b4; box-shadow: none; }
.topbar a, .topbar .pill { color: #dbe7ff; }
.topbar .pill { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: .15rem .7rem; font-size: .8rem; }
.page { max-width: 1240px; margin: 0 auto; padding: 1.25rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.card > h2 { display: flex; align-items: center; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; }
}

/* ---------- 表单 ---------- */
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,95,212,.25); border-color: var(--brand); }
.field { margin-bottom: .75rem; }
button, .btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem;
  border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; cursor: pointer; transition: .15s; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, button.primary:hover { background: var(--brand-dark); color: #fff; }
button.danger { border-color: #f3c0c0; color: var(--danger); }
button.danger:hover { background: #fff5f5; }
button.success { background: var(--ok); border-color: var(--ok); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sm, .btn.sm { padding: .3rem .6rem; font-size: .8rem; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7f9fc; color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .3px; position: sticky; top: 0; }
tbody tr:hover { background: #f9fbff; }
.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 10px; }

/* ---------- 徽标 ---------- */
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; background: #eef3fd; color: var(--brand); }
.tag.ok { background: #e7f7ee; color: var(--ok); }
.tag.warn { background: #fdf3e2; color: var(--warn); }
.tag.fail { background: #fff4ce; color: #8a6d00; border: 1px solid #ffe08a; }

/* 导入失败行：整行标黄，一眼能看出哪几行没进来 */
tr.row-failed td { background: #fff8e1; border-top: 1px solid #ffe08a; border-bottom: 1px solid #ffe08a; }
tr.row-failed td:first-child { border-left: 3px solid #f0b429; font-weight: 600; }
.tag.danger { background: #fdecec; color: var(--danger); }
.tag.gray { background: #f1f2f4; color: var(--muted); }

/* ---------- 数字看板 ---------- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .num.ok { color: var(--ok); }
.stat .num.warn { color: var(--warn); }
.stat .num.danger { color: var(--danger); }
.stat .num.brand { color: var(--brand); }
.stat .label { color: var(--muted); font-size: .8rem; }

/* ---------- 进度条 ---------- */
.bar { height: 10px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4b8bf5, var(--brand)); border-radius: 999px; transition: width .4s; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem;
}
.toast > div {
  background: #101828; color: #fff; padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow);
  font-size: .875rem; animation: slideIn .2s ease-out; max-width: 380px;
}
.toast > div.ok { background: var(--ok); }
.toast > div.err { background: var(--danger); }
.toast > div.warn { background: var(--warn); }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 2.5rem 1rem 1rem; }
.hero h1 { font-size: 2rem; }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1.25rem; }
@media (max-width: 900px) { .role-grid { grid-template-columns: 1fr; } }
.role-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem;
  box-shadow: var(--shadow); transition: .18s; color: var(--ink);
}
.role-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 12px 32px rgba(31,95,212,.14); }
.role-card .icon { font-size: 2rem; }
.role-card h3 { margin: .6rem 0 .2rem; font-size: 1.1rem; }
.role-card p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ---------- 终端 ---------- */
.terminal { max-width: 900px; margin: 0 auto; padding: 1.25rem; }
.scan-box { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
#scan-input {
  font-size: 1.6rem; font-weight: 700; letter-spacing: 2px; text-align: center; padding: .9rem;
  font-family: ui-monospace, Consolas, monospace;
}
.state-panel {
  border-radius: 16px; padding: 1.5rem; margin-bottom: 1rem; text-align: center;
  border: 2px solid var(--line); background: #fff; transition: .15s;
}
.state-panel .headline { font-size: 2rem; font-weight: 800; letter-spacing: 1px; }
.state-panel .sub { font-size: 1.05rem; margin-top: .35rem; }
.state-panel .detail { margin-top: 1rem; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .4rem .9rem; text-align: left; }
.state-panel .detail dt { color: var(--muted); font-size: .78rem; }
.state-panel .detail dd { margin: 0; font-weight: 600; }
.state-panel.idle { border-color: var(--line); color: var(--muted); }
.state-panel.ok { border-color: var(--ok); background: #f2fdf7; }
.state-panel.ok .headline { color: var(--ok); }
.state-panel.dup { border-color: var(--warn); background: #fffaf0; }
.state-panel.dup .headline { color: var(--warn); }
.state-panel.err { border-color: var(--danger); background: #fff5f5; }
.state-panel.err .headline { color: var(--danger); }
.kv { display: flex; gap: .4rem; font-size: .85rem; }

/* ---------- 模态 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.55); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 1rem;
}
.modal { background: #fff; border-radius: 14px; padding: 1.5rem; width: min(560px, 100%); max-height: 90vh; overflow: auto; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button {
  border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: .6rem .9rem; color: var(--muted); font-weight: 600;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--brand); }

/* ---------- 参赛证打印 ---------- */
.print-toolbar {
  position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line);
  padding: .75rem 1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
}
.badge-sheet { display: grid; gap: 0; }
.badge {
  border: 1px solid #9aa4b2; border-radius: 6px; padding: 6mm 5mm; background: #fff;
  display: flex; flex-direction: column; gap: 2mm; break-inside: avoid; page-break-inside: avoid;
  margin: 2mm;
}
.badge .bd-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #c9d1da; padding-bottom: 1mm; }
.badge .bd-head .ev { font-size: 8pt; color: #475467; letter-spacing: .5px; }
.badge .bd-head .no { font-size: 8pt; color: #475467; font-family: ui-monospace, Consolas, monospace; }
.badge .bd-title { text-align: center; font-size: 13pt; font-weight: 800; letter-spacing: 3px; margin: 1mm 0; }
.badge .bd-body { display: flex; gap: 3mm; flex: 1; }
.badge .bd-fields { flex: 1; font-size: 9pt; display: grid; grid-template-columns: auto 1fr; gap: .8mm 2mm; align-content: start; }
.badge .bd-fields dt { color: #667085; white-space: nowrap; }
.badge .bd-fields dd { margin: 0; font-weight: 600; word-break: break-all; }
.badge .bd-codes { width: 24mm; display: flex; flex-direction: column; align-items: center; gap: 1mm; }
.badge .bd-codes .qr svg { width: 23mm; height: 23mm; display: block; }
/* 条形码刻意横向拉满整卡：1D 枪对模块宽度敏感，窄栏会把 140+ 模块压到 0.18mm 以下扫不出。
   SVG 用 preserveAspectRatio="none" 横向拉伸——一维码只按条宽比例识别，非等比缩放不影响可读性。 */
.badge .bd-barcode { margin-top: 1mm; display: flex; align-items: center; gap: 2mm; }
.badge .bd-barcode svg { flex: 1 1 auto; height: 10mm; display: block; }
.badge .bd-code-text { font-size: 7pt; color: #475467; font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }
.badge .bd-foot { font-size: 6.5pt; color: #98a2b3; border-top: 1px dashed #d0d5dd; padding-top: 1mm; display: flex; justify-content: space-between; }

@media print {
  body { background: #fff; }
  .print-toolbar, .toast { display: none !important; }
  .badge-sheet { gap: 0; }
  .badge { margin: 0; border-color: #b6bec9; }
  @page { size: A4 portrait; margin: 8mm; }
}


/* ===================== 界面刷新（2026-11） =====================
   在原有样式之上做统一收口：字号层级、圆角、留白、按钮居中、
   以及高分屏/窄窗口下的自适应。只覆盖，不删除原有类。 */

:root {
  --brand: #2563eb;
  --brand-700: #1d4ed8;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted-2: #64748b;
  --line-2: #e2e8f0;
  --surface: #ffffff;
  --bg-2: #f5f7fb;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, .04), 0 12px 28px rgba(16, 24, 40, .08);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI",
               "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-2);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; }

/* 按钮：文字水平垂直都居中，避免长短不一时"看起来没对齐" */
button, .btn, .topbar a, .topbar .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  text-align: center;
  line-height: 1.1;
}

button, .btn {
  min-height: 38px;
  padding: .5rem 1.05rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .93rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .16s ease, box-shadow .16s ease, transform .06s ease, border-color .16s ease;
  box-shadow: var(--shadow-1);
}

button:active, .btn:active { transform: translateY(1px); box-shadow: none; }

button.sm, .btn.sm {
  min-height: 32px;
  padding: .32rem .8rem;
  font-size: .85rem;
  box-shadow: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

input, select, textarea {
  min-height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  padding: .45rem .7rem;
  font-size: .95rem;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
  outline: none;
}

label { font-size: .88rem; font-weight: 600; color: var(--ink-2); }

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-1);
  background: var(--surface);
}

.table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  /* 可滚动：名单/日志行数多时用滚轮下滑；overlay 避免出现两条滚动条 */
  overflow: auto;
  overscroll-behavior: contain;
  max-height: 62vh;
}

/* 后台主体本身也要能滚动，避免内容被固定高度截断 */
.admin-body, .panel-body { overflow: auto; }

/* 名单表格：表头吸顶，下滑时始终知道看的是哪一列 */
.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

table { border-collapse: separate; border-spacing: 0; }
th { font-weight: 600; font-size: .85rem; letter-spacing: .02em; color: var(--muted-2); }
td { font-size: .92rem; }
tbody tr:hover { background: #f8fafc; }

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .12rem .6rem;
  font-size: .8rem;
  font-weight: 600;
}

.topbar { box-shadow: var(--shadow-1); }
.topbar .pill { min-height: 30px; padding: .25rem .85rem; border-radius: 999px; font-size: .85rem; }
.topbar .brand { letter-spacing: .01em; }

.stat { border-radius: var(--radius); }
.stat .num { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.role-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.role-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.role-card { transition: box-shadow .18s ease, transform .18s ease; }

.toast > div { border-radius: var(--radius); box-shadow: var(--shadow-2); }

/* 自适应：中等窗口两列，窄窗口单列；表格横向滚动而不是撑破布局 */
@media (max-width: 1200px) {
  .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .page { padding: 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 {
    grid-template-columns: 1fr;
  }
  .topbar { flex-wrap: wrap; gap: .5rem; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .page { padding: 12px; }
  button, .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

