:root {
  --bg: #0d1118;
  --surface: rgba(17, 24, 39, .72);
  --surface-strong: rgba(17, 24, 39, .88);
  --surface-rgb: 17 24 39;
  --panel-opacity: .7;
  --ink: #f7fafc;
  --muted: #a9b4c4;
  --line: rgba(255, 255, 255, .13);
  --blue: #60a5fa;
  --blue-dark: #93c5fd;
  --green: #5eead4;
  --red: #fca5a5;
  --amber-bg: rgba(251, 191, 36, .16);
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --primary: #a855f7;
  --secondary: #60a5fa;
}
* { box-sizing: border-box; }
html {
  transition: background-color .42s ease;
}
html.theme-loading,
html.theme-loading *,
html.theme-loading *::before,
html.theme-loading *::after {
  transition: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(3, 7, 18, .78), rgba(3, 7, 18, .48)),
    radial-gradient(circle at top left, rgba(168, 85, 247, .24), transparent 36%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, .18), transparent 34%),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  transition: color .42s ease, background .42s ease;
}
body[data-theme="light"] {
  --bg: #eef3f8;
  --surface: rgba(255, 255, 255, .74);
  --surface-strong: rgba(255, 255, 255, .9);
  --surface-rgb: 255 255 255;
  --ink: #101827;
  --muted: #4b5565;
  --line: rgba(15, 23, 42, .16);
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #0f766e;
  --red: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, .18);
  background:
    linear-gradient(135deg, rgba(248, 250, 252, .78), rgba(226, 232, 240, .5)),
    radial-gradient(circle at top left, rgba(168, 85, 247, .18), transparent 36%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, .2), transparent 34%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--user-background, url("/static/admin-background.jpg")) center/cover no-repeat;
  filter: blur(4px) saturate(1.05);
  transform: scale(1.04);
  opacity: .42;
  transition: opacity .42s ease, filter .42s ease;
}
body.bg-changing::before {
  opacity: 0;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transition: background .42s ease, border-color .42s ease;
}
.brand { color: var(--ink); font-size: 18px; font-weight: 900; }
.nav-brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar-mini,
.brand-logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 12px 32px rgba(37, 117, 252, .32);
}
.brand-logo {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}
.brand-logo span { display: none; }
.brand-logo.missing-logo img { display: none; }
.brand-logo.missing-logo span { display: grid; place-items: center; }
.brand-logo.large {
  width: 72px;
  height: 72px;
  font-size: 22px;
  box-shadow: 0 14px 34px rgba(96,165,250,.28);
}
nav, .nav-links { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 16px; flex-wrap: nowrap; }
.nav-links a, .nav-links .link-button, .identity-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  line-height: 1;
}
.nav-links a:hover, .nav-links .link-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, .08);
}
.identity-button {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  cursor: pointer;
}
.identity-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, .08);
}
.profile-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.profile-popover {
  position: fixed;
  z-index: 50;
  top: 76px;
  right: max(20px, calc((100vw - 1180px) / 2));
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(var(--surface-rgb) / min(.95, calc(var(--panel-opacity) + .18)));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.profile-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.profile-popover form {
  display: grid;
  gap: 14px;
}
.profile-popover button {
  width: 100%;
}
.range-field input {
  padding: 0;
  accent-color: var(--primary);
}
.range-field span {
  color: var(--ink);
  font-weight: 900;
}
.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 9px;
}
.choice-group legend {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.choice-pill {
  display: block;
}
.choice-pill input,
.swatch-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice-pill span {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.08);
  font-weight: 900;
  cursor: pointer;
  transition: color .24s ease, background .24s ease, border-color .24s ease;
}
.choice-pill input:checked + span {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
.swatch-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.swatch-choice span {
  width: 34px;
  height: 34px;
  display: block;
  border: 2px solid rgba(255,255,255,.36);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 0 rgba(255,255,255,0);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.swatch-choice input:checked + span {
  transform: translateY(-1px);
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--swatch) 28%, transparent);
}
.container { max-width: 1120px; margin: 0 auto; padding: 36px 24px 60px; }
.banner { margin-bottom: 20px; padding: 13px 16px; border-radius: 8px; color: var(--green); background: rgba(45, 212, 191, .14); border: 1px solid rgba(94, 234, 212, .22); }
.banner.warning { color: #fbbf24; background: var(--amber-bg); }
.banner.error { color: var(--red); background: rgba(252, 165, 165, .12); }
.hero, .result-header { margin: 18px 0 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
h1 { margin: 6px 0 10px; font-size: clamp(30px, 4vw, 42px); letter-spacing: 0; }
h2 { letter-spacing: 0; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .14em; font-weight: 900; color: var(--secondary); }
.muted { margin: 0; max-width: 680px; color: var(--muted); line-height: 1.65; }
.panel, .credential-card, .table-panel, .auth-card, .private-card {
  padding: 28px;
  background: rgb(var(--surface-rgb) / var(--panel-opacity));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: background .42s ease, border-color .42s ease, box-shadow .42s ease;
}
.compact { max-width: 850px; }
.filter-form, .search-form, .import-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; background: rgba(255,255,255,.09); color: var(--ink); font: inherit; transition: color .42s ease, background .42s ease, border-color .42s ease; }
select option { color: #111827; background: #fff; }
.profile-popover .range-field input { min-height: auto; padding: 0; border: 0; background: transparent; }
input:focus, select:focus, textarea:focus { border-color: var(--secondary); outline: 2px solid rgba(96, 165, 250, .22); }
.filter-form label { width: 170px; }
button, .action { min-height: 43px; border: 0; border-radius: 8px; padding: 11px 20px; font: inherit; font-weight: 800; cursor: pointer; }
.primary { color: white; background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.primary:hover { filter: brightness(1.05); }
.danger-button { color: white; background: #b42318; }
.secondary { border: 1px solid var(--line); color: var(--ink); background: rgba(255,255,255,.08); }
.secondary:hover { color: var(--blue-dark); border-color: rgba(96,165,250,.4); }
.receive { min-width: 130px; }
.fine-print { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.auth-card { max-width: 430px; margin: 54px auto; padding: 38px; }
.auth-card h1 { font-size: 32px; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 26px; }
.form.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.page-title { margin: 12px 0 30px; }
.credential-card { max-width: 700px; }
dl { display: grid; grid-template-columns: 130px 1fr; gap: 18px 24px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; word-break: break-all; }
.copy-value { min-height: 0; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: rgba(255,255,255,.08); text-align: left; font: inherit; font-weight: 800; word-break: break-all; cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.copy-value:hover, .copy-value:focus { border-color: rgba(96,165,250,.55); background: rgba(96,165,250,.14); outline: none; }
.copy-value.copied { color: white; border-color: rgba(45,212,191,.6); background: rgba(20,184,166,.34); }
.success-text { color: var(--green); }
.inline { display: inline-flex; margin: 0; }
.link-button { padding: 0; min-height: auto; color: var(--blue); background: transparent; font-weight: 600; }
.nav-links .inline { display: inline-flex; align-items: center; }
.link-button.danger { color: var(--red); }
.stats { display: flex; gap: 16px; margin-bottom: 22px; }
.stats div { min-width: 145px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 8px; background: rgb(var(--surface-rgb) / var(--panel-opacity)); backdrop-filter: blur(18px); }
.stats strong { display: block; margin-bottom: 5px; font-size: 30px; }
.stats span { color: var(--muted); }
.admin-tools { margin-bottom: 22px; }
.search-form { margin-bottom: 25px; }
.search-form input { width: 270px; }
.search-form select { width: 150px; }
.import-form input[type="file"] { width: 310px; padding: 8px; }
.danger-zone { margin-top: 14px; padding-top: 16px; border-top: 1px dashed rgba(252,165,165,.4); }
.table-panel { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 15px 16px; text-align: left; color: var(--muted); background: rgba(255,255,255,.06); }
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.tag { display: inline-block; padding: 4px 9px; border-radius: 999px; color: #dbeafe; background: rgba(255,255,255,.08); font-size: 12px; }
.uid-code { display: inline-block; max-width: 230px; color: var(--muted); font-size: 12px; word-break: break-all; }
.status-正常, .status-approved { color: var(--green); background: rgba(45,212,191,.14); }
.status-封禁, .marked, .status-rejected, .status-disabled { color: var(--red); background: rgba(252,165,165,.12); }
.status-pending, .locked { color: #fbbf24; background: var(--amber-bg); }
.actions { white-space: nowrap; }
.actions a, .actions form { margin-right: 12px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.checkbox { flex-direction: row; align-items: center; margin-top: 27px; }
.checkbox input { width: auto; }
.buttons { display: flex; flex-direction: row; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 22px; margin-bottom: 22px; }
.chart-panel h2, .dashboard-grid h2, .my-locks h2 { margin: 0 0 18px; font-size: 20px; }
.pie-chart { width: 170px; height: 170px; margin: 4px auto 18px; border-radius: 50%; background: conic-gradient(var(--primary) 0 var(--available), #f59e0b var(--available) 100%); box-shadow: inset 0 0 0 24px color-mix(in srgb, var(--surface-strong) 88%, var(--bg)), 0 8px 22px rgba(0,0,0,.24); transition: background .42s ease, box-shadow .42s ease; }
.chart-legend { display: flex; flex-direction: column; gap: 10px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; }
.dot.available { background: var(--primary); }
.dot.locked-dot { background: #f59e0b; }
.account-action-space { min-height: 116px; display: flex; align-items: flex-end; gap: 12px; margin-top: 22px; }
.my-locks { margin-top: 22px; padding: 22px; overflow-x: auto; }
.request-note { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255,255,255,.06); line-height: 1.7; }
.access-forms { display: grid; gap: 12px; min-width: 300px; }
.access-forms form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.access-action-row { display: grid; gap: 10px; }
.reset-password-form { display: flex; width: 100%; }
.reset-password-form input { width: min(360px, 100%); }
.access-button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.access-button-row form { display: inline-flex; gap: 10px; align-items: center; flex-wrap: nowrap; }
.access-forms input { min-width: 180px; }
.access-forms textarea { min-width: 220px; min-height: 43px; }
.private-login-page .header { display: none; }
.private-login-shell { min-height: 100vh; display: grid; place-items: center; padding: 34px 18px; }
.private-card { width: min(500px, 100%); padding: 38px; }
.login-brand { display: inline-flex; align-items: center; gap: 14px; color: var(--ink); font-size: 24px; font-weight: 900; line-height: 1; }
.private-card h1 { font-size: clamp(36px, 7vw, 58px); }
.mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 22px; font-weight: 900; background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 14px 34px rgba(96,165,250,.28); flex: 0 0 auto; }
.table-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.table-toolbar h2 { margin: 0 0 6px; }
.admin-swiss-stage { padding: 0 20px 22px; }
.admin-swiss-stage h3 { margin: 8px 0 14px; color: var(--ink); font-size: 18px; }
.admin-swiss-scroll { max-width: 100%; overflow-x: hidden; padding: 8px 0 4px; }
.admin-swiss-board { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: clamp(10px, 1.35vw, 20px); }
.admin-swiss-column { display: grid; gap: 18px; }
.admin-swiss-column.first { padding-top: 78px; }
.admin-swiss-column.results { padding-top: 54px; }
.admin-swiss-group { display: grid; gap: 7px; }
.admin-swiss-group h4 { margin: 0 0 2px; color: var(--muted); font-size: 18px; font-weight: 900; }
.admin-swiss-match { min-height: 56px; display: grid; grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr); align-items: center; gap: 5px; border: 1px solid transparent; border-radius: 6px; padding: 6px; background: rgba(255,255,255,.06); }
.admin-swiss-match form { margin: 0; }
.admin-swiss-match.empty { opacity: .45; }
.admin-versus { color: var(--muted); font-size: 12px; font-weight: 900; text-align: center; text-transform: uppercase; }
.admin-team-chip { width: 100%; min-width: 0; display: grid; justify-items: center; gap: 4px; border: 0; color: var(--muted); background: transparent; font: inherit; text-align: center; cursor: pointer; }
.admin-team-chip:hover .admin-team-logo { border-color: color-mix(in srgb, var(--primary) 72%, white); transform: translateY(-1px); }
.admin-team-chip.selected { color: #fff; }
.admin-team-chip.selected .admin-team-logo { background: rgba(0,116,0,.9); border-color: color-mix(in srgb, var(--primary) 80%, white); box-shadow: 0 0 0 3px rgba(45,212,191,.2); }
.admin-team-chip.muted { opacity: .38; }
.admin-team-chip.placeholder { pointer-events: none; }
.admin-team-logo { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; color: #fff; background: rgba(39,51,65,.9); font-size: 12px; font-weight: 900; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.admin-team-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.admin-team-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 800; }
.admin-result-badge { grid-column: 1 / -1; justify-self: center; color: var(--primary); font-size: 10px; font-weight: 900; }
.admin-clear-result { grid-column: 1 / -1; justify-self: center; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.admin-result-badge.pending { color: #fbbf24; }
@media (max-width: 720px) {
  .header { height: auto; min-height: 68px; padding: 14px 18px; flex-direction: column; align-items: flex-start; }
  nav, .nav-links { flex-wrap: wrap; justify-content: flex-start; }
  .profile-popover { top: 96px; right: 16px; }
  nav { gap: 14px; }
  .container { padding: 24px 16px; }
  .hero, .result-header { align-items: flex-start; flex-direction: column; }
  .form.two-columns { display: flex; }
  .stats { flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats div { min-width: auto; }
  .table-panel { overflow-x: auto; }
  table { min-width: 980px; }
  .admin-swiss-scroll { overflow-x: auto; }
  .admin-swiss-board { min-width: 980px; gap: 24px; }
  dl { grid-template-columns: 1fr; gap: 7px; }
  dd { margin-bottom: 14px; }
}

.icp-footer {
  position: relative;
  z-index: 2;
  padding: 0 18px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.icp-footer a { color: inherit; }
.icp-footer a:hover { color: var(--ink); }
.private-icp-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: 14px;
}
