:root {
    --bg: #f3f5f2;
    --surface: #ffffff;
    --ink: #202521;
    --muted: #68716b;
    --line: #d9ded9;
    --green: #12644c;
    --green-dark: #0c4c39;
    --amber: #a66708;
    --red: #b2362d;
    --blue: #285f8f;
    --radius: 6px;
    font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    letter-spacing: 0;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { background: #202521; color: #fff; border-bottom: 4px solid var(--green); }
.topbar-inner { width: min(1480px, 100%); min-height: 64px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.brand { color: #fff; font-weight: 700; white-space: nowrap; }
.brand small { display: block; margin-top: 2px; color: #bdc7c0; font-size: 11px; font-weight: 400; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #e5ebe7; padding: 20px 13px; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a.active { color: #fff; border-bottom-color: #55b48e; text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 12px; white-space: nowrap; font-size: 13px; }
.page { width: min(1480px, 100%); margin: 0 auto; padding: 28px 24px 48px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.25; }
.page-head p { margin: 7px 0 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0 0 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 16px; font-size: 17px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: var(--radius); padding: 16px; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.field { min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.span-4 { grid-column: span 4; }
label { display: block; margin-bottom: 6px; color: #3f4742; font-size: 13px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #bfc7c1; border-radius: 4px; font: inherit; letter-spacing: 0; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(18,100,76,.18); border-color: var(--green); }
.check { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; }
.check input { width: 16px; min-height: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 14px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { color: #fff; background: var(--green); }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { color: var(--ink); background: #fff; border-color: #aeb7b0; }
.btn-danger { color: #fff; background: var(--red); }
.btn-link { min-height: auto; padding: 0; color: #fff; background: transparent; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e5e9e5; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #465049; background: #f5f7f5; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafcfb; }
.wrap { white-space: normal; min-width: 180px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 3px; font-size: 12px; font-weight: 600; }
.badge-green { color: #0c593f; background: #dff2e9; }
.badge-amber { color: #764500; background: #fff0cc; }
.badge-red { color: #8d211b; background: #fbe1df; }
.badge-blue { color: #214f75; background: #e0edf8; }
.alert { padding: 12px 14px; margin-bottom: 16px; border: 1px solid; border-radius: var(--radius); }
.alert-success { color: #0c593f; background: #e8f5ee; border-color: #a9d7c3; }
.alert-error { color: #84251f; background: #fff0ef; border-color: #efb3af; }
.alert ul { margin: 0; padding-left: 20px; }
.empty { padding: 42px 18px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; background: #eef1ee; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 54px; background: #fff; border-right: 1px solid var(--line); }
.login-panel h1 { margin: 0 0 8px; font-size: 28px; }
.login-panel .subtitle { margin: 0 0 32px; color: var(--muted); }
.login-panel .field { margin-bottom: 16px; }
.login-panel .btn { width: 100%; }
.login-side { display: flex; align-items: end; color: #fff; background: #e8eef3 url('/images/login-bg.jpg') top center/100% auto no-repeat; }
.login-side > div { width: 100%; padding: 46px 64px; background: #202521; border-bottom: 6px solid var(--green); }
.login-side strong { display: block; max-width: 620px; font-size: 40px; line-height: 1.25; }
.login-side span { display: block; margin-top: 12px; color: #d5e3dc; }
.signed-link { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.signed-link input { font-family: Consolas, monospace; font-size: 12px; }
.registration-filters { padding-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(135px, 1fr)) auto; gap: 10px; align-items: end; }
.registration-filters .muted { margin: 12px 0 0; font-size: 13px; }
.category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.category-card[hidden] { display: none; }
.category-card { display: block; min-height: 128px; padding: 16px; border: 1px solid var(--line); border-left: 5px solid #9aa39c; border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.category-card:hover { text-decoration: none; border-color: var(--green); }
.category-card.category-ready { border-left-color: var(--green); background: #f4fbf7; }
.category-card.category-empty { background: #f8f9f8; }
.category-card.category-registered { border-color: #dfad58; border-left-color: var(--amber); background: #fff7e7; box-shadow: 0 2px 8px rgba(166,103,8,.12); }
.category-card.category-registered:hover { border-color: var(--amber); }
.badge-registered { color: #764500; background: #ffe3a3; }
.category-card strong, .category-card small { display: block; margin-top: 13px; }
.category-card small { color: var(--muted); }
.category-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.avatar { width: 42px; height: 52px; display: inline-flex; object-fit: cover; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 3px; background: #f0f3f0; color: var(--muted); font-size: 11px; vertical-align: middle; }
.avatar-lg { width: 56px; height: 70px; }
.avatar-empty { text-align: center; }
.portrait-preview { display: block; width: 72px; height: 90px; margin-top: 8px; object-fit: cover; border: 1px solid var(--line); }
.player-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.player-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.player-card > div { flex: 1; min-width: 0; }
.player-card strong, .player-card small { display: block; }
.player-card small { margin-top: 4px; color: var(--muted); }
.qr-panel { display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: center; }
.qrcode { display: flex; justify-content: center; min-height: 240px; }
.section-title { margin: 24px 0 12px; font-size: 17px; }
.solo-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.check-card:hover { border-color: var(--green); background: #f4fbf7; }
.check-card input { width: 18px; min-height: 18px; margin-top: 2px; }
.check-card strong, .check-card small { display: block; }
.check-card small { margin-top: 5px; color: var(--muted); }
@media (max-width: 900px) {
    .topbar-inner { padding: 0 14px; gap: 12px; flex-wrap: wrap; }
    .brand { padding-top: 12px; }
    .nav { order: 3; width: 100%; }
    .nav a { padding: 10px 9px 12px; }
    .page { padding: 20px 14px 38px; }
    .stats, .form-grid, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field.span-4 { grid-column: span 2; }
    .login-shell { grid-template-columns: 1fr; }
    .login-side { display: none; }
    .login-panel { min-height: 100vh; padding: 36px 24px; }
    .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qr-panel { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .page-head { display: block; }
    .page-head .actions { margin-top: 14px; }
    .stats, .form-grid, .grid-2 { grid-template-columns: 1fr; }
    .field.span-2, .field.span-4 { grid-column: span 1; }
    .userbox span { display: none; }
    .signed-link { grid-template-columns: 1fr; }
    .category-grid, .player-grid, .solo-category-grid { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
}
@media print {
    .topbar, .no-print, .alert { display: none !important; }
    body, .page { background: #fff; padding: 0; }
    .panel, .table-wrap { border: 0; padding: 0; }
    th, td { border: 1px solid #777; }
}
