:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --paper: #fff;
  --ink: #1d1d1f;
  --muted: #62626a;
  --blue: #0066cc;
  --line: #e7e7eb;
  --green: #18674b;
  --red: #b31d31;
  --radius: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #0071e3; outline-offset: 3px; }
input, select { min-width: 0; padding: 10px 13px; border: 1px solid #d9d9e0; border-radius: 11px; color: var(--ink); background: #fff; }
input::placeholder { color: #6d6d75; }
input:disabled, select:disabled { opacity: .65; }
label { display: grid; gap: 6px; font-weight: 600; }
label > input, label > select { width: 100%; font-weight: 400; }
.muted { color: var(--muted); font-size: 13px; }
.primary, .secondary, .danger, .text-button { border: 0; white-space: nowrap; }
.primary, .secondary, .danger { min-height: 40px; border-radius: 999px; padding: 8px 18px; font-weight: 600; }
.primary { background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: #0059b2; }
.secondary { color: var(--ink); background: #ececf1; }
.secondary:hover:not(:disabled) { background: #e1e2e8; }
.danger { color: #fff; background: var(--red); }
.danger:hover:not(:disabled) { background: #9d1829; }
.text-button { color: var(--blue); background: transparent; padding: 7px 4px; }
.text-button:hover { text-decoration: underline; }
.danger-text { color: var(--red); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.topbar, .auth-nav { background: #fdfdff; }
@supports (backdrop-filter: blur(18px)) {
  .topbar, .auth-nav { background: rgb(253 253 255 / 78%); backdrop-filter: saturate(155%) blur(18px); }
}
.topbar { position: sticky; z-index: 10; top: 0; border-bottom: 1px solid #d6d6e175; }
.topbar-inner { max-width: 1320px; margin: auto; min-height: 64px; padding: 0 40px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; }
.nav { display: flex; align-items: center; gap: 5px; }
.nav-item { background: transparent; border: 0; color: var(--muted); padding: 8px 13px; border-radius: 999px; white-space: nowrap; font-size: 13px; }
.nav-item:hover { background: #ededf1; color: var(--ink); }
.nav-item[aria-current="page"] { background: #e9eaf0; color: var(--ink); font-weight: 700; }
.profile { justify-self: end; display: flex; gap: 14px; align-items: center; }
.profile-info { display: grid; justify-items: end; max-width: 160px; line-height: 1.3; }
.profile-info strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile-info small { color: var(--muted); font-size: 11px; }
.profile .text-button { font-size: 13px; }

.main-content { max-width: 1320px; margin: auto; padding: 28px 40px 0; display: grid; gap: 20px; }
.overview-hero {
  min-height: 282px; display: grid; grid-template-columns: 1fr 40%; align-items: center; gap: 24px;
  padding: 35px 48px; border-radius: 30px; overflow: hidden;
  background: radial-gradient(ellipse at 86% 88%, #c5d8fc 0%, transparent 55%), linear-gradient(115deg, #edf3ff 10%, #e3eafa 98%);
  border: 1px solid #dce5f5;
}
.hero-copy { z-index: 1; }
.hero-kicker { font-weight: 700; color: #315685; font-size: 14px; margin-bottom: 4px; }
.hero-copy h1 { font-size: clamp(44px, 5vw, 72px); line-height: 1.14; letter-spacing: -.055em; font-weight: 750; }
.hero-scope { color: #465471; margin: 10px 0 20px; }
.hero-copy .secondary { background: #ffffffb8; color: #205493; }
.hero-copy .secondary:hover { background: #fff; }
.hero-figure {
  justify-self: center; width: min(100%, 270px); min-height: 194px; text-align: center;
  display: grid; justify-items: center; align-content: center; border-radius: 32px;
  background: linear-gradient(145deg, #ffffffe3, #f1f6ff91); border: 1px solid #fff;
  box-shadow: 0 18px 45px #486aa61c;
}
.hero-indicator { color: #254367; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.hero-figure strong { font-size: clamp(60px, 7vw, 88px); line-height: 1.02; letter-spacing: -.07em; color: #16365e; font-variant-numeric: tabular-nums; }
.hero-figure p { color: #435779; margin-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #228660; flex: 0 0 auto; }
.page-heading { display: flex; align-items: end; justify-content: space-between; padding: 14px 1px 8px; gap: 16px; }
.page-heading h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.12; letter-spacing: -.04em; }
.page-heading p { margin-top: 8px; }
.page-actions, .dialog-actions { display: flex; gap: 8px; align-items: center; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric, .panel { background: var(--paper); border: 1px solid #e8e8ed; border-radius: var(--radius); min-width: 0; }
.metric { padding: 18px 23px; }
.metric h2 { font-size: 13px; font-weight: 650; color: #4e4e58; }
.metric strong { display: block; margin: 3px 0; font-size: clamp(29px, 4vw, 46px); line-height: 1.2; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.metric strong small { font-size: 13px; color: var(--muted); letter-spacing: 0; font-weight: 500; }
.metric p { font-size: 12px; color: var(--muted); }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.56fr) minmax(0, 1fr); gap: 16px; }
.panel-title { min-height: 64px; padding: 20px 23px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.panel-title h2 { font-size: 20px; letter-spacing: -.02em; }
.panel-title p { margin-top: 2px; }
.quiet-tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--muted); background: #f3f3f6; white-space: nowrap; }
.chart { margin: 10px 23px 21px; display: grid; gap: 7px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bar-group { display: grid; grid-template-rows: 22px 122px 22px; justify-items: center; align-items: center; min-width: 0; }
.bar-value, .bar-label { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { position: relative; width: min(65%, 39px); height: 100%; background: #f0f3fa; border-radius: 7px; overflow: hidden; }
.bar { position: absolute; bottom: 0; width: 100%; background: #77a5ea; border-radius: 7px; }
.bar-group:last-child .bar { background: #0066cc; }
.server-list { display: grid; grid-template-columns: 1fr 1fr; margin: 4px 23px 22px; gap: 8px; }
.server-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; padding: 9px 10px; background: #f5f5f8; border-radius: 10px; font-size: 12px; }
.server-row strong { white-space: nowrap; }
.server-status { font-size: 11px; white-space: nowrap; color: var(--muted); }
.server-status.online { color: var(--green); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 15px; border-bottom: 1px solid #eeeef1; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 23px; }
th:last-child, td:last-child { padding-right: 23px; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9f9fc; }
#auditRows td:last-child { white-space: normal; overflow-wrap: anywhere; min-width: 160px; }
.member-identity { display: flex; align-items: center; gap: 9px; }
.member-identity small { display: block; color: var(--muted); font-size: 11px; }
.steam-name { overflow-wrap: anywhere; }
.member-identity .steam-name { max-width: 220px; color: var(--ink); font-size: 12px; }
.avatar { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; background: #eef1f8; color: #425575; font-weight: 650; }
.role-tag { color: #484854; background: #f1f1f4; border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.role-tag.owner { background: #e9f1ff; color: #21518b; }
.role-tag.admin { background: #e9f4ef; color: #225d45; }
.online-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 12px; }
.online-badge.off { color: var(--muted); }
.online-badge.off .dot { background: #83838c; }
.filters { display: flex; align-items: center; gap: 8px; }
.filters input, .filters select { background: #f7f7fa; padding: 8px 10px; font-size: 13px; }
.filters input { width: 206px; }
.table-footer { padding: 12px 23px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.ranking-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 23px 0; }
.ranking-tabs { display: flex; gap: 6px; }
.ranking-controls select { margin-left: auto; }
.ranking-controls label { display: inline; font-size: 12px; color: var(--muted); }
.ranking-controls [aria-pressed="true"] { background: #e9f1ff; color: #21518b; border-color: #b8cef1; }
.rank-position { width: 1%; }
.rank-member { white-space: normal; overflow-wrap: anywhere; }
.rank-duration { text-align: right; font-weight: 650; }
.empty { color: var(--muted); text-align: center; padding: 25px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0 22px; color: var(--muted); font-size: 12px; }
#memberTable.account-table .time-column { display: none; }
#archiveDetails summary { cursor: pointer; padding: 15px 23px; font-weight: 650; }
#archiveDetails summary .quiet-tag { margin-left: 9px; }
.archive-note { margin: 0 23px 9px; }

.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: radial-gradient(ellipse at 50% 44%, #e1eaff 0%, #f5f5f7 58%); }
.auth-nav { border-bottom: 1px solid #d6d6e175; padding: 14px max(24px, calc((100vw - 1240px) / 2)); }
.auth-content { display: grid; place-items: center; padding: 36px 16px; }
.auth-card { width: min(100%, 430px); padding: 33px 36px; border: 1px solid #fff; border-radius: 30px; background: #ffffffeb; box-shadow: 0 18px 56px #243d7320; text-align: center; }
.auth-mark { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 12px; }
.auth-card h1 { font-size: 32px; letter-spacing: -.035em; }
.auth-card p { margin-top: 5px; }
.auth-card form { display: grid; gap: 13px; text-align: left; margin-top: 22px; }
.auth-card button { margin-top: 4px; }
.auth-footer { color: var(--muted); text-align: center; padding: 10px 16px 22px; font-size: 12px; }

dialog { width: 540px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 28px); padding: 0; color: var(--ink); background: #fafafd; border: 1px solid #fff; border-radius: 24px; box-shadow: 0 25px 90px #19213d40; }
dialog::backdrop { background: #25273755; backdrop-filter: blur(7px); }
@supports (backdrop-filter: blur(18px)) {
  dialog { background: rgb(250 250 253 / 95%); backdrop-filter: saturate(150%) blur(18px); }
}
.dialog-header { padding: 23px 23px 16px; display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.dialog-header h2 { font-size: 23px; margin-bottom: 3px; }
.icon-button { border: 0; border-radius: 50%; width: 30px; height: 30px; color: #51515d; background: #eeeef2; font-size: 22px; line-height: 1; flex: 0 0 auto; }
.icon-button:hover { background: #e0e0e8; }
.form-grid { padding: 0 23px 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.full { grid-column: 1/-1; }
.form-note { display: grid; gap: 7px; background: #eef3fb; border-radius: 12px; padding: 10px 12px; color: #355074; font-size: 13px; }
.check-label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check-label input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.warning-text, .error { color: var(--red); font-size: 13px; }
.error:empty { display: none; }
.dialog-error { padding: 0 23px 12px; }
.dialog-footer { display: flex; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 13px 23px; }
.dialog-actions { margin-left: auto; }
.delete-body { display: grid; gap: 15px; padding: 0 23px 16px; }
.delete-body fieldset { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0; }
.delete-body legend { font-weight: 600; padding: 0 4px; }
#detailDialog { width: 870px; }
#detailDialog .table-wrap { padding-bottom: 12px; }
.detail-section { padding: 0 23px 12px; }
.detail-section h3 { margin: 0 0 4px; font-size: 15px; }
.server-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 12px 0 6px; }
.server-total { padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.server-total dt { font-size: 12px; color: var(--muted); }
.server-total dt small { display: block; }
.server-total dd { margin: 3px 0 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
#toast { position: fixed; z-index: 20; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); padding: 10px 18px; color: #fff; background: #26262b; border-radius: 20px; box-shadow: 0 6px 24px #1d1d1f30; }

@media (max-width: 950px) {
  .topbar-inner, .main-content { padding-left: 22px; padding-right: 22px; }
  .server-list { grid-template-columns: 1fr; }
  .bar-group { grid-template-rows: 22px 210px 22px; }
}
@media (max-width: 680px) {
  .topbar-inner { grid-template-columns: 1fr auto; gap: 3px 12px; padding: 10px 14px 7px; }
  .nav { grid-column: 1/-1; grid-row: 2; overflow-x: auto; padding: 5px 3px 3px; }
  .nav-item { padding: 6px 9px; }
  .profile { grid-column: 2; grid-row: 1; }
  .profile-info { max-width: 110px; }
  .main-content { padding: 15px 14px 0; gap: 13px; }
  .overview-hero { min-height: 218px; grid-template-columns: 1fr 38%; gap: 8px; border-radius: 23px; padding: 20px 16px; }
  .hero-copy h1 { font-size: clamp(31px, 8vw, 43px); }
  .hero-scope { font-size: 12px; margin-bottom: 14px; }
  .hero-figure { min-height: 130px; border-radius: 20px; }
  .hero-figure strong { font-size: 56px; }
  .hero-figure p, .hero-indicator { font-size: 11px; }
  .metric { padding: 12px 9px; border-radius: 15px; }
  .metrics { gap: 7px; }
  .metric strong { font-size: clamp(20px, 5vw, 30px); }
  .metric strong small, .metric p { font-size: 10px; }
  .overview-grid { grid-template-columns: 1fr; gap: 13px; }
  .server-list { grid-template-columns: 1fr 1fr; }
  .bar-group { grid-template-rows: 22px 108px 22px; }
  .panel-title { padding-left: 14px; padding-right: 14px; }
  .member-panel .panel-title { align-items: stretch; flex-direction: column; }
  .ranking-controls { padding-left: 14px; padding-right: 14px; }
  .filters input { flex: 1; width: 0; }
  th:first-child, td:first-child, .table-footer { padding-left: 14px; }
  .page-heading { flex-wrap: wrap; }
  .page-heading p { max-width: 32ch; }
  .form-grid > label:nth-child(-n+2) { grid-column: 1/-1; }
  .dialog-footer { position: sticky; bottom: 0; background: #fafafd; }
  .form-grid, .dialog-header, .dialog-footer, .dialog-error, .delete-body { padding-left: 16px; padding-right: 16px; }
  .detail-section { padding-left: 16px; padding-right: 16px; }
  .auth-card { padding: 26px 22px; }
}
