.admin-body { background: #f4f6fb; color: var(--text); }
.admin-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* Sidebar */
.admin-side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, #0b1f52, #0a1740 60%, #071031);
  color: rgba(255, 255, 255, .72); padding: 22px 16px;
}
.admin-side .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; margin-bottom: 26px; padding: 0 8px; }
.admin-side .brand .logo-mark { box-shadow: none; }
.admin-side .side-label { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 0 10px; margin: 18px 0 8px; }
.admin-side a.menu {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  font-size: 14.5px; font-weight: 600; color: rgba(255, 255, 255, .74); margin-bottom: 2px;
  transition: background .2s ease, color .2s ease;
}
.admin-side a.menu:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-side a.menu.is-active { background: linear-gradient(135deg, var(--brand), #1738d8); color: #fff; box-shadow: 0 8px 20px rgba(43, 92, 255, .32); }
.admin-side a.menu .dot { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.admin-user { margin-top: 20px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .07); }
.admin-user b { display: block; color: #fff; font-size: 14px; }
.admin-user span { font-size: 12px; color: rgba(255, 255, 255, .5); }

/* Main */
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px 26px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.admin-top h1 { font-size: 18px; margin: 0; }
.admin-top .sub { font-size: 12.5px; color: var(--muted-2); }
.admin-top .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.admin-content { padding: 24px 26px 40px; }

/* Cards & stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-s); position: relative; overflow: hidden; }
.stat-card .label { font-size: 13px; color: var(--muted-2); }
.stat-card .value { font-size: 27px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.stat-card .hint { font-size: 12px; color: var(--muted-2); }
.stat-card .spark { position: absolute; right: 14px; top: 16px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(43, 92, 255, .1); color: var(--brand); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); margin-bottom: 20px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15.5px; }
.panel-head .head-actions { margin-left: auto; display: flex; gap: 8px; }
.panel-body { padding: 18px; }
.panel-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; gap: 10px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
table.data tbody tr:hover { background: #f9fbff; }
table.data td.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; align-items: center; }
/* 行内操作按钮：不随列宽压缩；纯图标按钮固定为 32px 圆钮 */
.row-actions .btn { flex: none; }
.row-actions .btn svg { width: 15px; height: 15px; flex: none; }
.row-actions .btn-icon { width: 32px; height: 32px; padding: 0; }
.row-actions .btn-icon svg { width: 16px; height: 16px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label.lbl { font-size: 13.5px; font-weight: 600; color: #334155; }
label.lbl .req { color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid #d5dde9; border-radius: 11px; background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease; font-size: 14.5px; color: var(--text);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 92, 255, .14);
}
textarea.input { min-height: 120px; resize: vertical; }
textarea.tall { min-height: 260px; }
.hint { font-size: 12.5px; color: var(--muted-2); }
.switch-row { display: flex; align-items: center; gap: 10px; }
input[type=checkbox].box { width: 18px; height: 18px; accent-color: var(--brand); }
.file-drop {
  border: 2px dashed #cdd7e6; border-radius: 14px; padding: 18px; text-align: center; background: var(--surface-2);
  transition: border-color .2s ease, background .2s ease;
}
.file-drop:hover { border-color: var(--brand); background: #f5f8ff; }
.file-drop input[type=file] { margin: 8px auto 0; }
.preview-img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.preview-row { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-ok { background: rgba(22, 163, 74, .12); color: #15803d; }
.badge-draft { background: rgba(100, 116, 139, .14); color: #475569; }
.badge-warn { background: rgba(245, 158, 11, .16); color: #b45309; }
.badge-info { background: rgba(43, 92, 255, .12); color: var(--brand); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-side {
  position: relative; overflow: hidden; color: #fff; padding: 60px 56px; display: flex; flex-direction: column; justify-content: center;
  background: radial-gradient(900px 500px at 20% 10%, #2440c8, transparent 60%), linear-gradient(150deg, #0b1f52, #0a1740);
}
.login-side::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-side > * { position: relative; z-index: 1; }
.login-side h2 { font-size: 30px; margin: 16px 0 12px; }
.login-side p { color: rgba(255, 255, 255, .7); max-width: 440px; }
.login-features { margin-top: 30px; display: grid; gap: 12px; }
.login-features li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .78); }
.login-features i { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font-style: normal; }
.login-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(430px, 100%); }
.login-card h1 { font-size: 25px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-card .field { margin-bottom: 15px; }
.captcha-note { font-size: 12.5px; color: var(--muted-2); margin-top: 14px; }

/* Misc admin */
.two-col-form { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.totp-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.totp-box .qr-img { margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.secret-box { font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: .5px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px; word-break: break-all; }
.log-list { max-height: 380px; overflow: auto; }
.log-row { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--muted-2); font-size: 12px; min-width: 108px; }
.spacer-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; width: 250px; }
  .admin-side.is-open { transform: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col-form { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- 轻量富文本编辑器（richtext.js） ---------- */
.rt-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.rt-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 92, 255, .12); }
.rt-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 7px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.rt-btn {
  border: 1px solid transparent; background: transparent; border-radius: 7px;
  padding: 4px 9px; font-size: 13px; line-height: 1.4; color: var(--text); cursor: pointer;
}
.rt-btn:hover { background: #fff; border-color: var(--line); }
.rt-btn:active { background: var(--bg-soft); }
.rt-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rt-editor {
  min-height: 220px; max-height: 520px; overflow-y: auto;
  padding: 14px 16px; font-size: 14.5px; line-height: 1.85; outline: none;
}
.rt-editor:empty::before { content: attr(data-placeholder); color: var(--muted-2); }
.rt-editor h2 { font-size: 20px; margin: 18px 0 10px; }
.rt-editor h3 { font-size: 17px; margin: 14px 0 8px; }
.rt-editor p { margin: 0 0 10px; }
.rt-editor ul, .rt-editor ol { padding-left: 22px; margin: 0 0 10px; }
.rt-editor ul { list-style: disc; }
.rt-editor ol { list-style: decimal; }
.rt-editor blockquote { margin: 12px 0; padding: 10px 16px; background: var(--surface-2); border-left: 3px solid var(--brand); color: var(--muted); border-radius: 0 8px 8px 0; }
.rt-editor img { max-width: 100%; border-radius: 10px; margin: 10px 0; }
.rt-editor a { color: var(--brand); text-decoration: underline; }
