* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f2f4f8; color: #1c2733; min-height: 100vh;
  color-scheme: light;
  accent-color: #2f80ed;
}
.mono { font-family: "SF Mono", Consolas, monospace; }
.muted { color: #7b8794; font-size: 13px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px 72px; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
header h1 { font-size: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
.card { background: #fff; border-radius: 12px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(16,36,64,.08); }
.grid .card { margin-bottom: 0; }
.card h2 { font-size: 14px; color: #5a6b7d; font-weight: 600; margin-bottom: 16px; }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 12px; }
.bar { height: 10px; background: #e8edf3; border-radius: 6px; overflow: hidden; }
.bar.slim { height: 8px; }
.fill { height: 100%; background: #2f80ed; border-radius: 6px; transition: width .4s; }
.fill.orange { background: #f2994a; }
.fill.red { background: #eb5757; }
.row { display: flex; justify-content: space-between; margin-top: 8px; }
.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.alert.red { background: #fdecec; color: #c0392b; border: 1px solid #f5c6c6; }
.alert.orange { background: #fef5e7; color: #b9770e; border: 1px solid #fad7a0; }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 7px 0; font-size: 14px; border-bottom: 1px solid #f0f3f7; }
.kv td:first-child { color: #7b8794; width: 84px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: #7b8794; font-weight: 600; padding: 6px 0; border-bottom: 1px solid #e8edf3; }
.tbl td { padding: 8px 0; border-bottom: 1px solid #f0f3f7; vertical-align: middle; }
footer { margin-top: 8px; text-align: center; }
.btn { display: inline-block; background: #2f80ed; color: #fff; border: 0; border-radius: 8px;
  padding: 10px 22px; font-size: 15px; cursor: pointer; margin-top: 14px; }
.btn:hover { background: #2568c4; }
.btn.small { padding: 5px 14px; font-size: 13px; margin: 0 0 0 10px; text-decoration: none; }
.login-wrap { display: flex; justify-content: center; padding: 12vh 20px 40px; }
.login-card { width: 100%; max-width: 360px; margin-bottom: 0; padding: 28px 26px; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card form { margin-top: 20px; }
.login-card .btn { width: 100%; margin-top: 18px; }
label { display: block; font-size: 12.5px; color: #5a6b7d; font-weight: 500; letter-spacing: .01em; margin: 12px 0 6px; }
input[type=text],
input[type=password],
input[type=number],
input[type=search],
input[type=email],
textarea,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background-color: #f6f8fb;
  color: #1c2733;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
textarea {
  height: auto;
  min-height: 180px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  tab-size: 4;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235a6b7d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  cursor: pointer;
}
input::placeholder,
textarea::placeholder { color: #93a0ae; }
input[type=number] { font-variant-numeric: tabular-nums; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
textarea:-webkit-autofill {
  -webkit-text-fill-color: #1c2733;
  caret-color: #1c2733;
  box-shadow: 0 0 0 1000px #f6f8fb inset, inset 0 1px 0 rgba(255,255,255,.7);
  transition: background-color 99999s ease-out;
}
input:-webkit-autofill:focus {
  box-shadow: 0 0 0 1000px #fff inset, 0 0 0 3px rgba(47,128,237,.18);
}
input:hover, textarea:hover, select:hover { border-color: #b7c5d4; background-color: #f3f6fa; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #2f80ed;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(47,128,237,.18), inset 0 1px 0 rgba(255,255,255,.8);
}
input:user-invalid, textarea:user-invalid {
  border-color: #d96565;
  box-shadow: 0 0 0 3px rgba(235,87,87,.14);
}
input:disabled, textarea:disabled, select:disabled,
input[readonly], textarea[readonly] {
  background-color: #eef1f5;
  color: #5a6b7d;
  cursor: default;
  box-shadow: none;
}
.input-compact,
.inline input[type=number],
.ops input[type=number] {
  width: 4.85rem;
  min-width: 4.85rem;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 8px;
}
.wrap.wide { max-width: 1100px; }
.nav a { margin-left: 12px; color: #2f80ed; text-decoration: none; font-size: 14px; }
.nav a.on { font-weight: 700; color: #1c2733; }
.alert.ok { background: #eaf7ee; color: #1e7a3a; border: 1px solid #b7e0c2; }
.btn.tiny { padding: 0 10px; height: 32px; font-size: 12px; margin: 0 4px 0 0; border-radius: 8px; vertical-align: middle; }
.btn.ghost { background: #fff; color: #2f80ed; border: 1px solid #c5d8f5; }
.btn.ghost:hover { background: #f3f8ff; }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; vertical-align: middle; }
.ops { white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; align-items: end; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  input[type=text], input[type=password], input[type=number], input[type=search],
  input[type=email], textarea, select { font-size: 16px; }
}
.form-grid label { margin-top: 0; }
.form-grid .btn { margin-top: 0; height: 42px; padding-top: 0; padding-bottom: 0; }
h3 { font-size: 14px; color: #1c2733; margin: 22px 0 10px; }
.codebox { position: relative; margin-bottom: 4px; }
.codebox pre {
  background: #0f1c2e; color: #d7e3f4; border-radius: 10px; padding: 14px 16px;
  font-size: 13px; line-height: 1.6; overflow-x: auto; margin: 0; padding-right: 84px; }
.codebox .copy { position: absolute; top: 10px; right: 10px; background: #2f80ed; }
.alert.info { background: #eaf2fd; color: #1f5aa8; border: 1px solid #c5d8f5; }

/* 右上角用户菜单 */
.usermenu { position: relative; }
.usermenu-btn { background: none; border: 0; cursor: pointer; font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 2px; border-radius: 8px; }
.usermenu-btn:hover .muted { color: #2f80ed; }
.caret { font-size: 10px; color: #7b8794; transition: transform .15s; }
.usermenu.open .caret { transform: rotate(180deg); }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(16,36,64,.14); border: 1px solid #eef2f7; min-width: 140px;
  padding: 6px; display: none; z-index: 50; }
.usermenu.open .dropdown { display: block; }
.dropdown button, .dropdown a { display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 9px 12px; font-size: 14px; color: #1c2733; border-radius: 7px; cursor: pointer; text-decoration: none; }
.dropdown button:hover, .dropdown a:hover { background: #f0f5fc; color: #2f80ed; }
.dropdown .sep { height: 1px; background: #eef2f7; margin: 4px 6px; }
.dropdown a.logout:hover { background: #fdecec; color: #c0392b; }

/* 修改密码弹窗 (原生 <dialog>) */
/* * { margin:0 } 会打掉 UA 的 margin:auto 居中，必须重新声明 */
dialog {
  border: 0; border-radius: 14px; padding: 0;
  width: min(92vw, 380px); max-width: calc(100vw - 32px);
  max-height: min(90vh, 720px); overflow: auto;
  background: #fff; color: inherit;
  box-shadow: 0 12px 40px rgba(16,36,64,.22);
  position: fixed; inset: 0; margin: auto; height: fit-content;
}
dialog::backdrop { background: rgba(15,28,46,.45); }
dialog form { padding: 22px; }
dialog h2 { font-size: 15px; color: #1c2733; margin-bottom: 2px; }
.dlg-alert { border-radius: 10px; padding: 10px 14px; margin: 10px 0 2px; font-size: 13px;
  background: #fdecec; color: #c0392b; border: 1px solid #f5c6c6; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dlg-actions .btn { margin-top: 0; }
dialog .btn[disabled] { opacity: .6; cursor: default; }

/* 改密成功 toast */
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100;
  margin: 0; max-width: 90vw; box-shadow: 0 4px 14px rgba(16,36,64,.12);
  opacity: 1; transition: opacity .6s; }
.toast.fade { opacity: 0; }

/* 管理后台壳 */
.admin-body { min-height: 100vh; }
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
  background: #162234; color: #d7e3f4;
  display: flex; flex-direction: column; z-index: 40;
}
.admin-brand { padding: 22px 20px 14px; font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.admin-nav { flex: 1; padding: 6px 10px; }
.admin-nav a {
  display: block; padding: 10px 12px; margin-bottom: 4px;
  color: #c5d4e8; text-decoration: none; border-radius: 8px; font-size: 14px;
}
.admin-nav a:hover { background: #1e334d; color: #fff; }
.admin-nav a.on { background: #2f80ed; color: #fff; font-weight: 600; }
.admin-side-foot {
  padding: 14px 16px 18px; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(255,255,255,.08);
}
.admin-side-foot .muted { color: #8ea0b5; }
.admin-side-foot a { color: #9eb6d4; text-decoration: none; font-size: 13px; }
.admin-side-foot a:hover { color: #fff; }
.admin-main { margin-left: 220px; padding: 28px 32px 72px; max-width: 1180px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.admin-top h1 { font-size: 20px; }
.admin-top .btn { margin-top: 0; }
.admin-main .card { margin-bottom: 20px; }
.admin-main .card:last-child { margin-bottom: 0; }
.admin-menu-btn {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 60;
  background: #162234; color: #fff; border: 0; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
}
.admin-scrim { display: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin-bottom: 0; }
.card-head .btn { margin-top: 0; padding: 8px 16px; }
.tbl-wrap { overflow-x: auto; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 18px; font-size: 13px; }
.pager a { color: #2f80ed; text-decoration: none; }
.dlg-actions.left { justify-content: flex-start; flex-wrap: wrap; }
dialog.wide { width: min(92vw, 520px); }
.sticky-bar .muted { margin-bottom: 4px; }
.sticky-bar .form-grid { margin-top: 14px; }
.card > p.muted { margin-bottom: 12px; }
.card > p.muted:last-child { margin-bottom: 0; }
@media (max-width: 768px) {
  .admin-menu-btn { display: inline-block; }
  .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .admin-body.nav-open .admin-sidebar { transform: translateX(0); }
  .admin-scrim {
    display: block; position: fixed; inset: 0; background: rgba(15,28,46,.45); z-index: 30;
  }
  .admin-scrim[hidden] { display: none; }
  .admin-main { margin-left: 0; padding: 56px 16px 40px; }
}
