:root {
  color-scheme: light dark;
  font: 100%/1.5 "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  --ground: #f1f4f5;
  --paper: #fff;
  --text: #191d20;
  --muted: #565f64;
  --edge: #e0e5e7;
  --rule: #edf0f1;
  --control: #c6cfd3;
  --accent: #21635e;
  --action: #164d65;
  --action-hover: #20637e;
  --action-ink: #fff;
  --error: #a32a2a;
  --overlay: rgb(21 29 31 / 36%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17191b;
    --paper: #211f20;
    --text: #f3f1f1;
    --muted: #bdb8bb;
    --edge: #343133;
    --rule: #353337;
    --control: #635e61;
    --accent: #89c7bd;
    --action: #e8efed;
    --action-hover: #cadfd9;
    --action-ink: #1b2726;
    --error: #ff9b99;
    --overlay: rgb(0 0 0 / 58%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--ground); color: var(--text); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 64px; max-width: 1240px; margin: auto; padding: 8px 24px; font-weight: 600; }
.brand img { display: block; flex: none; }
.brand button { margin-inline-start: auto; }
.sheet { padding: 24px; background: var(--paper); border: 1px solid var(--edge); border-radius: 16px; }
.account-sheet { max-width: 1192px; margin: 0 auto 12px; min-height: calc(100vh - 76px); }
.login-view { display: grid; place-items: start center; padding: clamp(32px, 10vh, 96px) 16px 32px; }
.login-sheet { width: min(100%, 428px); padding: clamp(22px, 5vw, 36px); }
.login-sheet h1 { font-size: 1.75rem; }
.login-intro { margin: 8px 0 24px; color: var(--muted); }
#login-form { border-top: 1px solid var(--edge); padding-top: 8px; }
#login-submit { width: 100%; margin-top: 8px; }
#login-status:empty { display: none; }
.captcha-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.captcha-heading button { min-height: 30px; padding: 3px 8px; border-color: transparent; font-size: 14px; }
.captcha-picture { position: relative; overflow: hidden; aspect-ratio: 300 / 104; border-radius: 8px; background: var(--ground); }
.captcha-picture img { display: block; width: 100%; }
.captcha-picture .captcha-piece { position: absolute; width: 14%; }
.captcha input[type="range"] { min-height: 24px; padding: 0; margin: 0; accent-color: var(--accent); cursor: ew-resize; }
.captcha p { min-height: 18px; }
.heading, .toolbar, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1 { margin: 0; font-size: 24px; font-weight: 500; line-height: 1.3; }
h2 { margin: 0; font-size: 20px; font-weight: 500; }
.toolbar { margin: 22px 0 12px; }
.toolbar form { display: flex; gap: 6px; min-width: 0; }
.toolbar input { width: min(31vw, 300px); min-width: 110px; }
#account-count, .pagination > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
input, button { font: inherit; color: var(--text); background: var(--paper); border: 1px solid var(--control); border-radius: 8px; }
input { min-height: 42px; padding: 5px 10px; min-width: 0; }
button { min-height: 42px; padding: 4px 12px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--ground); }
button:disabled { cursor: default; opacity: .58; }
button.primary { background: var(--action); color: var(--action-ink); border-color: transparent; }
button.primary:hover:not(:disabled) { background: var(--action-hover); }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--error); }

.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: .875rem; padding: 7px 12px 7px 0; white-space: nowrap; }
td { padding: 8px 12px 8px 0; height: 48px; border-top: 1px solid var(--rule); }
td:first-child { width: 34%; font-weight: 500; overflow-wrap: anywhere; }
td:last-child, th:last-child { text-align: right; padding-inline-end: 0; }
td.status-cell { white-space: nowrap; }
.state-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--control); }
.state-dot[data-enabled="true"] { background: var(--accent); }
.last-login { font-variant-numeric: tabular-nums; color: var(--muted); }
.row-actions, .pagination-actions, .dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-actions button { min-height: 32px; border-color: transparent; }
.row-actions button:hover:not(:disabled) { border-color: var(--edge); }
.protected { color: var(--muted); font-size: 13px; }
.feedback { min-height: 20px; color: var(--muted); margin: 12px 0 0; }
.feedback[data-error="true"] { color: var(--error); }
.pagination { margin-top: 8px; }

dialog { width: min(420px, calc(100% - 28px)); padding: 24px; border-radius: 16px; border: 1px solid var(--edge); background: var(--paper); color: var(--text); }
dialog::backdrop { background: var(--overlay); }
.dialog-detail { color: var(--muted); margin: 8px 0 16px; overflow-wrap: anywhere; }
.form-field { display: grid; gap: 6px; margin: 12px 0; }
.form-field label { font-weight: 500; }
.form-field p { margin: 0; color: var(--muted); font-size: 13px; }
.dialog-actions { margin-top: 20px; gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1240px) {
  .account-sheet { margin-inline: 12px; }
}

@media (max-width: 620px) {
  .sheet { padding: 18px 14px; }
  .login-view { padding-block-start: 32px; }
  .login-sheet { padding: 24px; }
  .brand { padding-inline: 14px; font-size: .875rem; gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .brand button { min-height: 36px; padding-inline: 8px; }
  td.last-login, th.last-login { display: none; }
  .row-actions { flex-wrap: wrap; }
  .row-actions button { padding-inline: 6px; font-size: .875rem; min-height: 40px; }
}

@media (max-width: 465px) {
  .toolbar { flex-wrap: wrap; gap: 7px; }
  .toolbar form { width: 100%; }
  .toolbar input { flex: 1; width: 0; }
  .heading { gap: 8px; }
  .dialog-actions { flex-wrap: wrap; }
}
