:root {
  color-scheme: light;
  --ink: #17384a;
  --muted: #687f8c;
  --line: rgba(38, 135, 153, .17);
  --cyan: #10aabd;
  --blue: #487ed8;
  --panel: rgba(255, 255, 255, .9);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #e8f8fa; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(62, 208, 213, .19), transparent 28rem),
    radial-gradient(circle at 92% 16%, rgba(80, 127, 222, .13), transparent 27rem),
    linear-gradient(145deg, #edfdfd, #edf5fa 65%, #e6f7f8);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.admin-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 66px;
  padding: 8px max(22px, calc((100vw - 1260px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(245, 254, 255, .84);
  backdrop-filter: blur(18px);
}

.admin-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.admin-brand > span:last-child { display: grid; gap: 2px; }
.admin-brand strong { font-size: 16px; letter-spacing: .04em; }
.admin-brand small { color: var(--muted); font-size: 11px; }
.admin-brand-mark { width: 31px; height: 31px; border: 2px solid var(--cyan); border-radius: 9px; transform: rotate(45deg); box-shadow: inset 0 0 0 6px rgba(53, 184, 200, .12), 0 0 18px rgba(25, 164, 183, .18); }

.admin-user-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.admin-user-actions > span { max-width: 220px; margin-right: 4px; overflow: hidden; color: #315365; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.admin-user-actions button, .quiet-button, .pagination button {
  min-height: 38px;
  padding: 7px 13px;
  color: #365d70;
  border: 1px solid rgba(35, 133, 153, .2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .65);
  cursor: pointer;
}

main { width: min(1260px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 54px; }
.admin-login-gate { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.login-card, .password-card {
  display: grid;
  gap: 16px;
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(24, 91, 111, .13);
}
.login-card h1, .password-card h2 { margin: 0; color: #143e52; }
.login-card > p:not(.eyebrow), .password-card > p:not(.eyebrow) { margin: -7px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-card > a { color: #4f7384; text-align: center; text-decoration: none; font-size: 13px; }
.eyebrow { margin: 0; color: #078da3; font-size: 10px; font-weight: 700; letter-spacing: .18em; }

.login-card label, .password-card label, .filter-bar label { display: grid; gap: 7px; color: #315467; font-size: 12px; font-weight: 650; }
input {
  min-height: 43px;
  width: 100%;
  padding: 9px 12px;
  color: #173d50;
  border: 1px solid rgba(35, 137, 158, .23);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, .86);
  font-size: 16px;
}
input:focus { border-color: #20aabe; box-shadow: 0 0 0 3px rgba(32, 170, 190, .13); }
.primary-button, .export-button {
  min-height: 40px;
  padding: 8px 15px;
  color: #fff;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 7px 18px rgba(33, 130, 171, .17);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
button:disabled, .is-disabled { opacity: .48; pointer-events: none; }
.form-message { min-height: 19px; margin: -5px 0 !important; color: #bd3948 !important; font-size: 12px !important; }
.form-message.is-success { color: #087950 !important; }

.admin-app { display: grid; gap: 24px; }
.password-warning { display: flex; align-items: center; gap: 20px; padding: 16px 18px; color: #704d11; border: 1px solid rgba(222, 154, 34, .28); border-radius: 14px; background: rgba(255, 215, 131, .28); }
.password-warning div { display: grid; gap: 4px; }
.password-warning span { font-size: 12px; }
.password-warning button { margin-left: auto; padding: 8px 14px; color: #6a470e; border: 1px solid rgba(174, 111, 14, .25); border-radius: 9px; background: rgba(255, 255, 255, .55); cursor: pointer; }

.page-heading { display: flex; align-items: end; gap: 20px; }
.page-heading > div { display: grid; gap: 5px; }
.page-heading h1 { margin: 0; color: #153f53; font-size: clamp(25px, 3vw, 34px); }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }
.page-heading > button { margin-left: auto; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.summary-grid article { display: grid; gap: 8px; min-height: 104px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 10px 32px rgba(30, 100, 119, .06); }
.summary-grid span { color: var(--muted); font-size: 12px; }
.summary-grid strong { color: #124b61; font-size: 28px; font-variant-numeric: tabular-nums; }

.admin-tabs { display: flex; gap: 7px; padding: 5px; width: fit-content; border-radius: 12px; background: rgba(34, 142, 161, .09); }
.admin-tabs button { min-width: 116px; min-height: 40px; color: #607986; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.admin-tabs button.is-active { color: #0c6174; background: rgba(255, 255, 255, .94); box-shadow: 0 5px 18px rgba(26, 99, 117, .1); font-weight: 700; }

.data-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 14px 40px rgba(28, 93, 111, .07); }
.filter-bar { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(150px, .8fr) minmax(150px, .8fr) auto; align-items: end; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.filter-actions { display: flex; align-items: center; gap: 7px; }
.filter-actions .primary-button, .filter-actions .quiet-button, .filter-actions .export-button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.users-filter-bar { grid-template-columns: minmax(220px, 420px) auto; justify-content: space-between; }

.table-wrap { position: relative; min-height: 230px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid rgba(38, 135, 153, .1); font-size: 13px; }
th { color: #66808d; background: rgba(220, 246, 248, .42); font-size: 11px; letter-spacing: .04em; }
td { color: #294c5e; }
td small { display: block; margin-top: 4px; color: #8296a0; }
.score-value { color: #087e91; font-size: 16px; font-weight: 750; }
.role-pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; color: #326273; background: rgba(43, 151, 170, .11); font-size: 11px; }
.role-pill.is-admin { color: #725018; background: rgba(229, 169, 64, .15); }
.table-state { position: absolute; inset: 68px 0 auto; margin: 0; padding: 46px 20px; color: #718995; text-align: center; font-size: 13px; }

.pagination { display: flex; align-items: center; min-height: 62px; padding: 12px 18px; border-top: 1px solid var(--line); }
.pagination > span { color: #6a838f; font-size: 12px; }
.pagination > div { display: flex; gap: 7px; margin-left: auto; }

.password-dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: visible; border: 0; border-radius: 22px; background: transparent; box-shadow: 0 30px 90px rgba(0, 15, 24, .3); }
.password-dialog::backdrop { background: rgba(4, 23, 32, .57); backdrop-filter: blur(7px); }
.password-card { position: relative; max-height: calc(100dvh - 24px); overflow: auto; }
.dialog-close { position: absolute; top: 13px; right: 14px; width: 38px; height: 38px; padding: 0; color: #456676; border: 0; border-radius: 50%; background: rgba(45, 131, 149, .1); font-size: 26px; cursor: pointer; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { grid-template-columns: repeat(3, 1fr); }
  .filter-actions { grid-column: 1 / -1; }
  .users-filter-bar { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .admin-header { min-height: 59px; padding: 7px 12px; }
  .admin-brand small { display: none; }
  .admin-user-actions > span, #admin-password-button { display: none; }
  .admin-user-actions button { padding: 7px 10px; }
  main { width: min(100% - 20px, 1260px); padding: 22px 0 40px; }
  .login-card, .password-card { padding: 26px 20px; }
  .page-heading { align-items: start; }
  .page-heading > button { margin-top: 4px; }
  .summary-grid { gap: 9px; }
  .summary-grid article { min-height: 88px; padding: 15px; }
  .summary-grid strong { font-size: 23px; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; flex-wrap: wrap; }
  .password-warning { align-items: start; }
  .password-warning button { margin-left: 0; }
  .admin-tabs { width: 100%; }
  .admin-tabs button { min-width: 0; flex: 1; }
}

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