:root {
  --bg: #070b14;
  --panel: #0d1524;
  --panel-2: #111c31;
  --line: rgba(120, 170, 255, 0.14);
  --line-strong: rgba(120, 170, 255, 0.28);
  --text: #e8f0ff;
  --muted: #8ea3c4;
  --accent: #37d6c4;
  --accent-2: #4c8dff;
  --danger: #ff6b81;
  --warn: #ffc45c;
  --ok: #3ddc97;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 登录页 ---------- */
.login-page { overflow: hidden; }
.login-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 18% 18%, rgba(55, 214, 196, 0.16), transparent 60%),
    radial-gradient(760px 480px at 85% 78%, rgba(76, 141, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #05080f 0%, #0a1120 55%, #060a13 100%);
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 170, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 78%);
}
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 60px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 40px;
}
.login-brand h1 {
  margin: 18px 0 8px;
  font-size: 34px;
  letter-spacing: 1px;
}
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 700;
  font-size: 20px;
  color: #04120f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px rgba(55, 214, 196, 0.32);
}
.brand-sub { color: var(--muted); margin: 0 0 30px; letter-spacing: 2px; }
.brand-list { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 14px; }
.brand-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #c6d6f2;
  font-size: 14px;
}
.brand-list li span {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(55, 214, 196, 0.35);
  border-radius: 999px;
  padding: 3px 8px;
  letter-spacing: 1px;
}
.brand-foot { color: var(--muted); font-size: 13px; }
.brand-foot a { color: var(--accent); }

.login-card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.92), rgba(10, 17, 30, 0.96));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px 36px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.login-card h2 { margin: 0 0 8px; font-size: 22px; }
.login-tip { color: var(--muted); font-size: 13px; margin: 0 0 26px; line-height: 1.7; }
.field { display: block; margin-bottom: 18px; }
.field span { display: block; font-size: 13px; color: #a9bcdb; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(7, 12, 22, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 214, 196, 0.12);
}
.login-error { min-height: 20px; color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.login-note { color: #6d80a0; font-size: 12px; margin: 18px 0 0; text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: rgba(120, 170, 255, 0.08);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.18s;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 107, 129, 0.4); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px 16px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 布局 ---------- */
.admin-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.admin-side {
  background: linear-gradient(180deg, #0a1220 0%, #070c16 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 26px; }
.side-brand strong { display: block; font-size: 16px; letter-spacing: 1px; }
.side-brand span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: 2px; }
.side-nav { display: grid; gap: 4px; }
.nav-item {
  padding: 11px 14px;
  border-radius: 10px;
  color: #a9bcdb;
  font-size: 14px;
  border: 1px solid transparent;
  transition: 0.18s;
}
.nav-item:hover { background: rgba(120, 170, 255, 0.08); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(55, 214, 196, 0.16), rgba(76, 141, 255, 0.08));
  border-color: rgba(55, 214, 196, 0.28);
  color: #fff;
}
.side-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.side-user .avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(55, 214, 196, 0.16);
  border: 1px solid rgba(55, 214, 196, 0.3);
  color: var(--accent);
  font-weight: 600;
}
.side-user strong { display: block; font-size: 13px; }
.side-user span { display: block; font-size: 11px; color: var(--muted); }

.admin-main { min-width: 0; padding: 26px 32px 48px; }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.admin-top h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: 0.5px; }
.admin-top p { margin: 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.14);
}

/* ---------- 视图 ---------- */
.admin-view { display: grid; gap: 18px; }
.loading, .empty {
  padding: 46px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(13, 21, 36, 0.5);
}
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.86), rgba(10, 17, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.card .k { color: var(--muted); font-size: 12px; letter-spacing: 0.5px; }
.card .v { font-size: 26px; font-weight: 600; margin-top: 10px; letter-spacing: 0.5px; }
.card .v small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.card .h { margin-top: 8px; color: var(--muted); font-size: 12px; }
.card.accent .v { color: var(--accent); }
.card.warn .v { color: var(--warn); }
.card.danger .v { color: var(--danger); }

.panel {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.86), rgba(10, 17, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-head .hint { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px 20px; }
.panel-body.tight { padding: 0; }

.table-wrap { width: 100%; overflow: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 12, 22, 0.42);
}
table.table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.08);
  vertical-align: middle;
}
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: rgba(120, 170, 255, 0.04); }
td.name { font-weight: 600; }
td.num, th.num { text-align: right; }
td.muted, .muted { color: var(--muted); }
td .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.row-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0; font-size: 12px;
}
.link-btn.danger { color: var(--danger); }
.link-btn:hover { text-decoration: underline; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  color: #c6d6f2;
  white-space: nowrap;
}
.badge.success { color: var(--ok); border-color: rgba(61, 220, 151, 0.35); background: rgba(61, 220, 151, 0.08); }
.badge.warn { color: var(--warn); border-color: rgba(255, 196, 92, 0.35); background: rgba(255, 196, 92, 0.08); }
.badge.danger { color: var(--danger); border-color: rgba(255, 107, 129, 0.35); background: rgba(255, 107, 129, 0.08); }
.badge.info { color: var(--accent-2); border-color: rgba(76, 141, 255, 0.35); background: rgba(76, 141, 255, 0.08); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); color: var(--muted); background: transparent;
}
.tab.active { color: #04121a; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- 抽屉 / 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 24px;
}
.modal-mask[hidden] { display: none; }
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: linear-gradient(180deg, #101b2e, #0a1220);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.modal.wide { width: min(820px, 100%); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { color: var(--muted); font-size: 12px; margin: 0 0 18px; }
.modal .close-x {
  float: right; background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; line-height: 1;
}

.detail-list { display: grid; gap: 10px; margin: 0; }
.detail-list .row { display: flex; gap: 12px; font-size: 13px; }
.detail-list .row span:first-child { color: var(--muted); width: 84px; flex: none; }
.follow-list { display: grid; gap: 10px; max-height: 240px; overflow: auto; }
.follow-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: rgba(7, 12, 22, 0.42); font-size: 12px;
}
.follow-item .meta { color: var(--muted); margin-bottom: 6px; }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: grid; gap: 10px; }
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  background: #12203a;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
}
.toast.error { border-color: rgba(255, 107, 129, 0.5); color: #ffd7dd; }
.toast.success { border-color: rgba(61, 220, 151, 0.5); color: #d6ffec; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 顶部图标按钮 ---------- */
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(120, 170, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  transition: 0.18s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 设置：主题选择 ---------- */
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-option {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  background: rgba(120, 170, 255, 0.04);
  transition: 0.18s;
}
.theme-option:hover { border-color: var(--accent); }
.theme-option.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.16);
}
.theme-preview {
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  margin-bottom: 9px;
  border: 1px solid rgba(120, 170, 255, 0.22);
}
.tp-side { width: 34%; padding: 9px 7px; display: grid; align-content: start; gap: 5px; }
.tp-side i { display: block; height: 6px; border-radius: 3px; opacity: 0.65; }
.tp-main { flex: 1; padding: 9px 8px; display: grid; align-content: start; gap: 6px; }
.tp-row { height: 7px; border-radius: 3px; }
.tp-card { height: 20px; border-radius: 5px; }
.theme-preview.dark { background: #0b1322; }
.theme-preview.dark .tp-side { background: #0a1220; border-right: 1px solid rgba(120, 170, 255, 0.14); }
.theme-preview.dark .tp-side i { background: #4c6b9c; }
.theme-preview.dark .tp-row { background: rgba(120, 170, 255, 0.18); }
.theme-preview.dark .tp-card { background: #111c31; border: 1px solid rgba(120, 170, 255, 0.18); }
.theme-preview.light { background: #f5f6f7; }
.theme-preview.light .tp-side { background: #ffffff; border-right: 1px solid #e5e6eb; }
.theme-preview.light .tp-side i { background: #c9cdd4; }
.theme-preview.light .tp-row { background: #e5e6eb; }
.theme-preview.light .tp-card { background: #ffffff; border: 1px solid #e5e6eb; }
.theme-name { font-size: 13px; font-weight: 600; }
.theme-desc { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ================= 浅色主题：飞书蓝 + 白 ================= */
html.theme-light {
  color-scheme: light;
  --bg: #f5f6f7;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #e5e6eb;
  --line-strong: #d0d3d9;
  --text: #1f2329;
  --muted: #646a73;
  --accent: #3370ff;
  --accent-2: #245bdb;
  --danger: #f53f3f;
  --warn: #ff7d00;
  --ok: #00b42a;
  --shadow: 0 10px 30px rgba(31, 35, 41, 0.1);
}
html.theme-light body { background: var(--bg); color: var(--text); }
html.theme-light .admin-side {
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(31, 35, 41, 0.02);
}
html.theme-light .side-brand strong { color: #1f2329; }
html.theme-light .nav-item { color: #4e5969; border-color: transparent; }
html.theme-light .nav-item:hover { background: #f2f3f5; color: #1f2329; }
html.theme-light .nav-item.active {
  background: #e8f0ff;
  border-color: #bed3ff;
  color: #3370ff;
  font-weight: 600;
}
html.theme-light .side-foot { border-top-color: var(--line); }
html.theme-light .side-user .avatar {
  background: #e8f0ff;
  border-color: #bed3ff;
  color: #3370ff;
}
html.theme-light .btn { background: #ffffff; color: #1f2329; border-color: #d0d3d9; }
html.theme-light .btn:hover { border-color: #3370ff; color: #3370ff; }
html.theme-light .btn.primary {
  background: #3370ff;
  color: #ffffff;
  border: none;
}
html.theme-light .btn.primary:hover { background: #245bdb; color: #ffffff; }
html.theme-light .btn.ghost { background: transparent; }
html.theme-light .btn.danger { background: #fff; color: #f53f3f; border-color: #f7b3b3; }
html.theme-light .icon-btn { background: #ffffff; border-color: #d0d3d9; color: #646a73; }
html.theme-light .icon-btn:hover { color: #3370ff; border-color: #3370ff; }
html.theme-light .card,
html.theme-light .panel {
  background: #ffffff;
  border-color: #e5e6eb;
  box-shadow: 0 1px 3px rgba(31, 35, 41, 0.04);
}
html.theme-light .card .v { color: #1f2329; }
html.theme-light .card.accent .v { color: #3370ff; }
html.theme-light .card.warn .v { color: #ff7d00; }
html.theme-light .card.danger .v { color: #f53f3f; }
html.theme-light .panel-head { border-bottom-color: #e5e6eb; }
html.theme-light .panel-head h2 { color: #1f2329; }
html.theme-light table.table th {
  background: #f7f8fa;
  color: #646a73;
  border-bottom-color: #e5e6eb;
}
html.theme-light table.table td { border-bottom-color: #f0f1f2; }
html.theme-light table.table tbody tr:hover { background: #f7f8fa; }
html.theme-light .badge { color: #4e5969; border-color: #d0d3d9; }
html.theme-light .badge.success { color: #00b42a; border-color: #aff0b5; background: #e8ffea; }
html.theme-light .badge.warn { color: #ff7d00; border-color: #ffcf8b; background: #fff7e8; }
html.theme-light .badge.danger { color: #f53f3f; border-color: #fbaca3; background: #ffece8; }
html.theme-light .badge.info { color: #3370ff; border-color: #bed3ff; background: #e8f0ff; }
html.theme-light .tab { background: #ffffff; color: #646a73; border-color: #d0d3d9; }
html.theme-light .tab.active {
  background: #3370ff;
  border-color: #3370ff;
  color: #ffffff;
}
html.theme-light .field input,
html.theme-light .field select,
html.theme-light .field textarea {
  background: #ffffff;
  border-color: #d0d3d9;
  color: #1f2329;
}
html.theme-light .field input:focus,
html.theme-light .field select:focus,
html.theme-light .field textarea:focus {
  border-color: #3370ff;
  box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.12);
}
html.theme-light .field input::placeholder,
html.theme-light .field textarea::placeholder { color: #a9aeb8; }
html.theme-light .modal-mask { background: rgba(31, 35, 41, 0.35); }
html.theme-light .modal {
  background: #ffffff;
  border-color: #e5e6eb;
  box-shadow: 0 18px 48px rgba(31, 35, 41, 0.16);
}
html.theme-light .modal .close-x { color: #86909c; }
html.theme-light .follow-item { background: #f7f8fa; border-color: #e5e6eb; }
html.theme-light .theme-option { background: #f7f8fa; border-color: #e5e6eb; }
html.theme-light .theme-option.active { border-color: #3370ff; box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.14); }
html.theme-light .empty,
html.theme-light .loading { background: #ffffff; border-color: #d0d3d9; }
html.theme-light .toast {
  background: #ffffff;
  color: #1f2329;
  border-color: #e5e6eb;
  box-shadow: 0 10px 28px rgba(31, 35, 41, 0.14);
}
html.theme-light .toast.error { border-color: #fbaca3; color: #cb2634; }
html.theme-light .toast.success { border-color: #aff0b5; color: #009a29; }
html.theme-light .live-dot { box-shadow: 0 0 0 4px rgba(0, 180, 42, 0.12); }
html.theme-light .row-ops .link-btn { color: #3370ff; }
html.theme-light .row-ops .link-btn.danger { color: #f53f3f; }

@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; gap: 32px; padding: 32px 22px; }
  .login-brand .brand-list { display: none; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: relative; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-main { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
}
