:root {
  --blue: #0876f9;
  --blue-dark: #075ed8;
  --blue-soft: #eef6ff;
  --yellow: #ffc928;
  --navy: #102349;
  --text: #33476d;
  --muted: #71809a;
  --line: #dce6f4;
  --surface: #ffffff;
  --danger: #dc424b;
  --success: #22a56b;
  --shadow: 0 12px 32px rgba(27, 84, 154, 0.11);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: #fff;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--navy);
  background: #fff;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(8, 118, 249, 0.25);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 12px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--navy);
  text-decoration: none;
  font-size: 23px;
}

.admin-logo {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 3px solid #ffe178;
  border-radius: 50%;
  color: #fff;
  background: var(--yellow);
  box-shadow: inset 0 0 0 2px #fff, 0 5px 14px rgba(218, 157, 0, 0.22);
  font-size: 16px;
  font-weight: 900;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-actions a {
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.admin-shell {
  width: min(100% - 40px, 1240px);
  margin: 0 auto;
  padding: 34px 0 50px;
}

.login-view {
  width: min(100%, 430px);
  margin: 48px auto 0;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.security-mark {
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(8, 118, 249, 0.25);
}

.security-mark svg {
  width: 45px;
  fill: currentColor;
}

.login-view h1 {
  margin: 0;
  font-size: 25px;
}

.login-view > p {
  margin: 10px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.login-view form { text-align: left; }

.login-view label,
.adjust-card label {
  display: block;
  margin: 0 0 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.password-control { position: relative; }

.password-control input,
.adjust-card input {
  width: 100%;
  height: 48px;
  padding: 0 82px 0 14px;
  border: 1px solid #cfdbea;
  border-radius: 10px;
  color: var(--navy);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.password-control input:focus,
.adjust-card input:focus,
.search-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(8, 118, 249, 0.1);
  outline: 0;
}

.password-control button {
  position: absolute;
  top: 5px;
  right: 6px;
  height: 38px;
  cursor: pointer;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.primary-button,
.outline-button,
.refresh-button,
.search-form button,
.pagination button,
.adjust-button {
  cursor: pointer;
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.primary-button {
  min-height: 46px;
  border: 0;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(8, 118, 249, 0.2);
}

.login-view .primary-button {
  width: 100%;
}

.primary-button:hover,
.refresh-button:hover,
.search-form button:hover { filter: brightness(1.06); }

.primary-button:active,
.outline-button:active,
.refresh-button:active,
.search-form button:active,
.pagination button:active,
.adjust-button:active { transform: scale(0.97); }

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.outline-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #b8d6ff;
  color: var(--blue-dark);
  background: #fff;
}

.form-error {
  min-height: 20px;
  margin: 7px 0;
  color: var(--danger);
  font-size: 12px;
}

.login-view > small {
  display: block;
  margin-top: 16px;
  color: #8694a9;
  font-size: 11px;
}

.dashboard-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.dashboard-title-row h1,
.dashboard-title-row p {
  margin: 0;
}

.dashboard-title-row h1 { font-size: 28px; }

.dashboard-title-row p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.sync-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9cadc2;
}

.sync-status.is-online { color: #20845b; }
.sync-status.is-online i { background: var(--success); }
.sync-status.is-error { color: var(--danger); }
.sync-status.is-error i { background: var(--danger); }

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow);
}

.stats-band article {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 116px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.stats-band article:last-child { border-right: 0; }

.stat-icon {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.stat-icon.is-blue { background: var(--blue); }
.stat-icon.is-yellow { color: #4c3900; background: var(--yellow); }

.stats-band p,
.stats-band strong { margin: 0; }

.stats-band p {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
}

.stats-band strong {
  font-size: clamp(22px, 2.2vw, 30px);
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.search-form {
  position: relative;
  display: flex;
  width: min(100%, 530px);
}

.search-form svg {
  position: absolute;
  top: 12px;
  left: 13px;
  width: 20px;
  fill: #6f8099;
}

.search-form input {
  width: 100%;
  height: 44px;
  padding: 0 92px 0 42px;
  border: 1px solid #cfdbea;
  border-radius: 10px;
  color: var(--navy);
}

.search-form button {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  color: #fff;
  background: var(--blue);
}

.refresh-button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  color: #fff;
  background: var(--blue);
}

.players-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.players-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.players-table th,
.players-table td {
  padding: 15px 16px;
  border-right: 1px solid #e5edf7;
  border-bottom: 1px solid #e5edf7;
  vertical-align: middle;
}

.players-table th:last-child,
.players-table td:last-child { border-right: 0; }
.players-table tr:last-child td { border-bottom: 0; }

.players-table th {
  color: #40516c;
  background: #f8faff;
  font-size: 12px;
}

.player-cell strong,
.player-cell small {
  display: block;
}

.player-cell strong { color: var(--navy); }

.player-cell small {
  max-width: 180px;
  margin-top: 3px;
  overflow: hidden;
  color: #8694a9;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-positive {
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 900;
}

.balance-negative {
  color: var(--danger);
  font-size: 15px;
  font-weight: 900;
}

.status-yes { color: var(--success); font-weight: 800; }
.status-no { color: var(--muted); }

.adjust-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #aecdff;
  color: var(--blue-dark);
  background: #fff;
}

.adjust-button:hover { background: var(--blue-soft); }

.empty-cell {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.table-footer p { margin: 0; }

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #cbd9eb;
  color: var(--blue-dark);
  background: #fff;
}

.admin-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 35, 73, 0.48);
  backdrop-filter: blur(4px);
}

.adjust-card {
  position: relative;
  z-index: 1;
  width: min(100%, 450px);
  padding: 28px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(10, 33, 70, 0.25);
}

.adjust-card h2 { margin: 0; font-size: 22px; }

.adjust-card > p {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.adjust-card input {
  margin-bottom: 7px;
  padding-right: 14px;
}

.adjust-card label:not(:first-of-type) { margin-top: 16px; }

.adjust-card small {
  color: var(--muted);
  font-size: 11px;
}

.adjust-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  color: #657691;
  background: #f0f5fb;
  font-size: 22px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .primary-button { padding: 0 18px; }

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 26px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  color: #fff;
  background: var(--navy);
  box-shadow: 0 12px 28px rgba(10, 33, 70, 0.25);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .stats-band article:nth-child(2) { border-right: 0; }
  .stats-band article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .admin-header {
    min-height: 68px;
    padding: 10px 16px;
  }

  .admin-brand { gap: 9px; font-size: 18px; }
  .admin-logo { width: 42px; height: 42px; font-size: 13px; }
  .header-actions { gap: 8px; }
  .header-actions a { font-size: 12px; }
  .outline-button { padding: 0 9px; font-size: 11px; }
  .admin-shell { width: min(100% - 24px, 1240px); padding-top: 22px; }
  .login-view { margin-top: 20px; padding: 28px 20px; }
  .dashboard-title-row { align-items: flex-start; flex-direction: column; }
  .dashboard-title-row h1 { font-size: 24px; }
  .stats-band article { min-height: 96px; padding: 15px; }
  .stat-icon { flex-basis: 42px; width: 42px; height: 42px; }
  .stats-band strong { font-size: 22px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-form { width: 100%; }
  .refresh-button { width: 100%; }
  .table-footer { align-items: flex-start; flex-direction: column; }
  .pagination { width: 100%; justify-content: space-between; }
  .adjust-card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

