:root {
  --a-primary: #2f6fed;
  --a-primary-dark: #2358c9;
  --a-side: #1f2430;
  --a-side2: #171b24;
  --a-bg: #f4f6fb;
  --a-line: #e6e9f2;
  --a-text: #2b2f3a;
  --a-muted: #7b8194;
  --a-ok: #14a05a;
  --a-warn: #e8a01c;
  --a-danger: #e2483d;
  --a-radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--a-bg); color: var(--a-text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
ul { margin: 0; padding: 0; list-style: none; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; background: var(--a-side); color: #cfd5e4; flex: none;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 18px 18px 14px; font-size: 15px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; letter-spacing: .01em;
  line-height: 1.35; }
.sidebar .brand small { color: #8b93a7; font-weight: 400; font-size: 10.5px; display: block;
  margin-top: 2px; }
.sidebar .group { padding: 14px 18px 6px; font-size: 11px; letter-spacing: .08em; color: #77809a;
  text-transform: uppercase; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 18px; font-size: 13.5px;
  color: #cfd5e4; border-left: 3px solid transparent; }
.sidebar a.nav:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar a.nav.on { background: rgba(47,111,237,.18); color: #fff; border-left-color: var(--a-primary); }
.sidebar .ico { width: 18px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-a { height: 58px; background: #fff; border-bottom: 1px solid var(--a-line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.topbar-a h1 { font-size: 16px; }
.topbar-a .grow { flex: 1; }
.topbar-a .who { color: var(--a-muted); font-size: 13px; }
.content { padding: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: #fff; border-radius: var(--a-radius); padding: 16px; border: 1px solid var(--a-line); }
.stat .k { color: var(--a-muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .h { font-size: 12px; color: var(--a-muted); margin-top: 2px; }

.panel { background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius);
  margin-bottom: 16px; overflow: hidden; }
.panel .ph { display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--a-line); }
.panel .ph h3 { font-size: 15px; flex: 1; }
.panel .pb { padding: 16px; }
.panel .pb.tight { padding: 0; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.input, select.input, textarea.input {
  border: 1px solid var(--a-line); background: #fff; border-radius: 8px; padding: 8px 11px;
  font-size: 13.5px; outline: none; font-family: inherit; }
.input:focus { border-color: var(--a-primary); box-shadow: 0 0 0 3px rgba(47,111,237,.08); }
textarea.input { width: 100%; min-height: 90px; resize: vertical; }

.btn-a { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
  background: var(--a-primary); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 13.5px;
  cursor: pointer; font-weight: 500; }
.btn-a:hover { background: var(--a-primary-dark); }
.btn-a.ghost { background: #fff; border-color: var(--a-line); color: var(--a-text); }
.btn-a.danger { background: var(--a-danger); }
.btn-a.ok { background: var(--a-ok); }
.btn-a.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-a[disabled] { opacity: .5; pointer-events: none; }

table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--a-line);
  text-align: left; font-size: 13px; vertical-align: middle; }
table.grid th { background: #fafbfe; color: var(--a-muted); font-weight: 500; font-size: 12.5px;
  white-space: nowrap; }
table.grid tr:hover td { background: #fafbff; }
table.grid td.actions { white-space: nowrap; }
table.grid .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #eef0f5; color: #666; }
.tag.on { background: rgba(20,160,90,.1); color: var(--a-ok); }
.tag.off { background: rgba(226,72,61,.1); color: var(--a-danger); }
.tag.warn { background: rgba(232,160,28,.12); color: #b57b00; }

.pager-a { display: flex; gap: 6px; padding: 14px 16px; flex-wrap: wrap; align-items: center; }
.pager-a a, .pager-a span { min-width: 32px; height: 32px; padding: 0 9px; border-radius: 7px;
  background: #fff; border: 1px solid var(--a-line); display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; }
.pager-a .on { background: var(--a-primary); color: #fff; border-color: var(--a-primary); }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.fitem { grid-column: span 6; }
.fitem.s2 { grid-column: span 2; } .fitem.s3 { grid-column: span 3; }
.fitem.s4 { grid-column: span 4; } .fitem.s6 { grid-column: span 6; }
.fitem.s8 { grid-column: span 8; } .fitem.s12 { grid-column: span 12; }
.fitem label { display: block; font-size: 12.5px; color: var(--a-muted); margin-bottom: 5px; }
.fitem .input { width: 100%; }
.fitem .hint { color: var(--a-muted); font-size: 12px; margin-top: 4px; }
.group-title { grid-column: span 12; font-size: 13px; font-weight: 600; color: var(--a-primary);
  padding-top: 8px; border-top: 1px dashed var(--a-line); margin-top: 6px; }
.group-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.img-field { display: flex; gap: 10px; align-items: center; }
.img-field .prev { width: 64px; height: 64px; border-radius: 8px; border: 1px dashed var(--a-line);
  display: flex; align-items: center; justify-content: center; color: var(--a-muted); font-size: 12px;
  overflow: hidden; flex: none; }
.img-field .prev img { width: 100%; height: 100%; object-fit: cover; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2430, #2f6fed); padding: 20px; }
.login-box { width: 360px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-box h2 { font-size: 20px; margin-bottom: 4px; }
.login-box p.sub { color: var(--a-muted); font-size: 13px; margin: 0 0 22px; }
.login-box .fitem { margin-bottom: 14px; }
.login-box .input { width: 100%; padding: 11px 12px; }
.login-box .btn-a { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--a-muted); text-align: center; }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 10px 4px;
  border-bottom: 1px solid var(--a-line); }
.chart .bar { flex: 1; background: linear-gradient(180deg, var(--a-primary), #7aa5ff);
  border-radius: 6px 6px 0 0; min-height: 3px; position: relative; }
.chart .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--a-muted); }
.chart-x { display: flex; gap: 8px; padding: 6px 4px 0; }
.chart-x div { flex: 1; text-align: center; font-size: 11px; color: var(--a-muted); }

.tabs-a { display: flex; gap: 4px; border-bottom: 1px solid var(--a-line); padding: 0 16px; }
.tabs-a a { padding: 12px 14px; font-size: 13.5px; color: var(--a-muted);
  border-bottom: 2px solid transparent; }
.tabs-a a.on { color: var(--a-primary); border-bottom-color: var(--a-primary); font-weight: 600; }

.flex { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--a-muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -220px; z-index: 40; transition: .2s; }
  .sidebar.open { left: 0; }
  .fitem, .fitem.s2, .fitem.s3, .fitem.s4, .fitem.s6, .fitem.s8 { grid-column: span 12; }
  .content { padding: 14px; }
}

/* 选手列表：增/减票输入 */
.ticket-adj { width: 86px; min-width: 86px; text-align: center; padding: 6px 8px; }
.grid td .ticket-adj { display: inline-block; }

/* 富文本编辑器 */
.rte-wrap { border: 1px solid #dfe3ec; border-radius: 10px; overflow: hidden; background: #fff; }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 6px 8px; background: #f8fafc; border-bottom: 1px solid #eef1f6; }
.rte-toolbar button, .rte-img-btn { border: 0; background: transparent; color: #4b5563;
  font-size: 13px; padding: 5px 8px; border-radius: 6px; cursor: pointer; line-height: 1.2; }
.rte-toolbar button:hover, .rte-img-btn:hover { background: #e8eefc; color: #2563eb; }
.rte-size { height: 28px; border: 1px solid #dfe3ec; border-radius: 6px; padding: 0 6px;
  background: #fff; color: #4b5563; font-size: 12px; }
.rte-color { width: 30px; height: 28px; padding: 0; border: 1px solid #dfe3ec;
  border-radius: 6px; background: #fff; }
.rte-img-btn { position: relative; overflow: hidden; }
.rte-img-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rte { min-height: 180px; padding: 12px 14px; outline: none; font-size: 14px;
  line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.rte:focus { box-shadow: inset 0 0 0 2px rgba(59, 130, 246, .14); }
.rte img { max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0; }
.rte p { margin: 6px 0; }
.rte-tip { padding: 6px 12px 8px; color: #9aa1b2; font-size: 12px; background: #fff; }

/* 分享链接弹窗 */
.share-mask { position: fixed; inset: 0; z-index: 120; display: none;
  align-items: center; justify-content: center; background: rgba(15, 23, 42, .48); }
.share-mask.on { display: flex; }
.share-box { width: min(520px, 92vw); background: #fff; border-radius: 14px;
  padding: 20px 22px; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
.share-box h4 { margin: 0; font-size: 16px; color: #1f2430; }
.share-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }


/* 选手备注输入 */
.remark-input { width: 140px; min-width: 120px; padding: 6px 8px; font-size: 12.5px; }
