:root {
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1c1f23;
}

.login {
  width: min(420px, 92vw);
  padding: 40px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  text-align: center;
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.hint {
  margin: 0 0 24px;
  color: #6b7280;
  font-size: 14px;
}

.providers {
  display: grid;
  gap: 12px;
}

.btn {
  display: block;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #111827;
  text-decoration: none;
  font-size: 15px;
}

.btn:hover {
  border-color: #111827;
  background: #f9fafb;
}

.footer {
  margin: 28px 0 0;
  color: #9ca3af;
  font-size: 12px;
}

.notice {
  margin: 0;
  padding: 12px 16px;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  color: #6b7280;
  font-size: 14px;
}

.card {
  width: min(460px, 92vw);
  padding: 36px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
}

.card h1 {
  margin: 0 0 16px;
  font-size: 20px;
}

.hint {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.hint.small {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 16px;
}

.error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
}

.field:focus-within {
  border-color: #111827;
}

.field input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: inherit;
  min-width: 0;
}

.suffix {
  color: #6b7280;
  font-size: 14px;
  white-space: nowrap;
}

.btn.primary {
  width: 100%;
  background: #111827;
  color: #fff;
  border-color: #111827;
  cursor: pointer;
}

.btn.primary:hover {
  background: #1f2937;
}

.info {
  margin: 0 0 20px;
  display: grid;
  grid-template-columns: 84px 1fr;
  row-gap: 10px;
  font-size: 14px;
}

.info dt {
  color: #6b7280;
}

.info dd {
  margin: 0;
  word-break: break-all;
}

.actions {
  display: grid;
  gap: 10px;
}

.actions form {
  margin: 0;
}

.actions .btn,
.actions button {
  width: 100%;
  text-align: center;
  cursor: pointer;
  font: inherit;
  background: transparent;
}

.confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.confirm input[type="checkbox"] {
  flex: none;
}

/* ===== 管理后台 ===== */
body.admin {
  display: block;
  background: #f5f6f8;
  color: #1c1f23;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: #111827;
  color: #fff;
}

.topbar .brand {
  font-weight: 600;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar nav a {
  color: #d1d5db;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.topbar nav a.on {
  color: #fff;
  border-bottom-color: #fff;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right .muted {
  color: #9ca3af;
  font-size: 13px;
}

.linkbtn {
  background: none;
  border: 0;
  color: #9ca3af;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.linkbtn:hover {
  color: #fff;
}

.linkbtn.danger {
  color: #ef4444;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.container.narrow {
  max-width: 640px;
}

.container h1 {
  font-size: 22px;
  margin: 0 0 20px;
}

.container h2 {
  font-size: 16px;
  margin: 28px 0 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat span {
  font-size: 26px;
  font-weight: 600;
}

.stat label {
  color: #6b7280;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #6b7280;
  font-weight: 500;
}

tr:last-child td {
  border-bottom: 0;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: #6b7280;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.pill.ok {
  background: #ecfdf5;
  color: #047857;
}

.pill.bad {
  background: #fef2f2;
  color: #b91c1c;
}

.searchbar {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}

.searchbar input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  background: #fff;
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline {
  display: inline;
}

.btn.small {
  padding: 8px 12px;
  font-size: 13px;
  display: inline-block;
  width: auto;
}

.btn.danger {
  border-color: #b91c1c;
  color: #b91c1c;
}

.btn.danger:hover {
  background: #fef2f2;
}

.field-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: #6b7280;
}

textarea,
.container input:not([type="hidden"]):not([type="checkbox"]) {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
}

textarea {
  resize: vertical;
}

.container form .btn.primary {
  margin-top: 16px;
  width: 100%;
}

.tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.tabs a {
  color: #6b7280;
  text-decoration: none;
  font-size: 14px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.tabs a.on {
  color: #111827;
  border-bottom-color: #111827;
}

.info.wide {
  grid-template-columns: 130px 1fr;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #0f1115;
    color: #e5e7eb;
  }

  .login {
    background: #171a21;
    box-shadow: none;
  }

  .btn {
    color: #e5e7eb;
    border-color: #374151;
  }

  .btn:hover {
    border-color: #9ca3af;
    background: #1f242d;
  }
}
