:root {
  --bg: #0a0e14;
  --panel: #111823;
  --panel-2: #16202d;
  --line: #1f2b3a;
  --text: #e6edf6;
  --muted: #8797a9;
  --accent: #35d0ba;
  --accent-2: #4f8cff;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 15% -10%, #16243a 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #10302c 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

.shell { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 232px;
  flex: 0 0 232px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: 11px; align-items: center; }
.logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06121a; font-weight: 800; font-size: 18px;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: .2px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-size: 13px;
  cursor: pointer; text-align: left; transition: .16s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(53, 208, 186, .14), rgba(79, 140, 255, .08));
  border-color: rgba(53, 208, 186, .28);
  color: var(--text);
  font-weight: 600;
}
.nav-item em {
  font-style: normal; font-size: 11px; color: var(--accent);
  background: rgba(53, 208, 186, .12); padding: 1px 7px; border-radius: 20px;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.login-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; color: var(--muted);
}
.login-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.login-chip.ok .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.login-chip.bad .dot { background: var(--danger); }
.foot-note { font-size: 11px; color: #55637a; text-align: center; }

/* 主区 */
.main { flex: 1; min-width: 0; padding: 26px 30px 46px; max-width: 1180px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; gap: 16px; }
.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.auto-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 30px; background: var(--panel); font-size: 13px;
}
.switch { position: relative; width: 40px; height: 22px; display: inline-block; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #263242; border-radius: 30px; transition: .2s;
}
.switch i::after {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #8296ad; border-radius: 50%; transition: .2s;
}
.switch input:checked + i { background: rgba(53, 208, 186, .25); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent); }

.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* 卡片 */
.card {
  background: linear-gradient(180deg, rgba(22, 32, 45, .92), rgba(15, 22, 31, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-head h2 { font-size: 14px; font-weight: 650; }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2.tight { gap: 10px; }
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 190px; flex: 0 0 190px; padding: 18px 12px; }
  .main { padding: 20px 20px 40px; }
}

/* 窄屏：侧边栏变成顶部横向导航，保证菜单不会被藏起来 */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: static; width: 100%; flex: 0 0 auto; height: auto;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand-sub, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 6px; flex: 1; overflow-x: auto; }
  .nav-item { white-space: nowrap; padding: 8px 10px; }
  .main { padding: 14px 12px 32px; }
}

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 15px 16px;
}
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { display: block; font-size: 26px; margin-top: 6px; font-weight: 700; color: var(--accent); }
.stat.danger strong { color: var(--danger); }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12px; color: var(--muted); }
input, select, textarea {
  background: #0d141d; border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; font-family: inherit;
  outline: none; transition: .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(53, 208, 186, .55);
  box-shadow: 0 0 0 3px rgba(53, 208, 186, .08);
}
textarea { resize: vertical; line-height: 1.7; }
select { cursor: pointer; }

.check { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-size: 12.5px; color: #b6c4d4; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.spacer { flex: 1; }

.btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 15px; border-radius: 9px; font-size: 12.5px; cursor: pointer;
  transition: .16s; font-family: inherit;
}
.btn:hover { border-color: #33475f; background: #1a2736; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #2aa895);
  color: #04191a; border: none; font-weight: 650;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); border-color: rgba(255, 107, 107, .3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  background: transparent; border: none; color: var(--muted); font-size: 22px;
  cursor: pointer; line-height: 1; padding: 0 4px;
}

/* 列表 */
.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  border: 1px solid var(--line); border-radius: 11px; padding: 13px 15px;
  background: rgba(13, 20, 29, .6); transition: .16s;
}
.item:hover { border-color: #2c3d52; }
.item-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.item-title { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.item-meta { display: flex; gap: 10px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.item-meta span { font-size: 11.5px; color: var(--muted); }
.item-preview {
  margin-top: 9px; color: #9fb0c3; font-size: 12px; line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-actions { display: flex; gap: 7px; flex: 0 0 auto; }
.item-actions .btn { padding: 6px 11px; font-size: 11.5px; }

.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; border: 1px solid transparent; }
.badge.draft { color: var(--warn); background: rgba(255, 180, 84, .1); border-color: rgba(255, 180, 84, .25); }
.badge.published { color: var(--accent); background: rgba(53, 208, 186, .1); border-color: rgba(53, 208, 186, .25); }
.badge.failed { color: var(--danger); background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .25); }
.badge.publishing { color: var(--accent-2); background: rgba(79, 140, 255, .1); border-color: rgba(79, 140, 255, .25); }
.badge.topic { color: #a4b8cc; background: rgba(255, 255, 255, .04); }

.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 160px; }

.kv { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.kv li { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.kv li b { color: var(--text); font-weight: 600; }

.account-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.account-state {
  padding: 7px 13px; border-radius: 9px; font-size: 12.5px;
  background: rgba(255, 180, 84, .1); color: var(--warn); border: 1px solid rgba(255, 180, 84, .22);
}
.account-state.ok { background: rgba(53, 208, 186, .1); color: var(--accent); border-color: rgba(53, 208, 186, .25); }
.account-state.bad { background: rgba(255, 107, 107, .1); color: var(--danger); border-color: rgba(255, 107, 107, .25); }

.topic-rows { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.topic-row {
  display: grid; grid-template-columns: 22px 128px 1fr 1fr 112px 56px 34px; gap: 9px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: rgba(13, 20, 29, .6);
}
.topic-count { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; }
@media (max-width: 860px) {
  .topic-row { grid-template-columns: 22px 1fr; }
  .topic-row .icon-btn { justify-self: end; }
}
.topic-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.topic-row input[type="text"], .topic-row input[type="number"] { padding: 7px 9px; font-size: 12.5px; }
.topic-row input[type="number"] {
  padding: 7px 6px; text-align: center; font-weight: 600;
  -moz-appearance: textfield; appearance: textfield;
}
/* 去掉数字框的上下箭头，否则会挤占宽度，填的数字看不全 */
.topic-row input[type="number"]::-webkit-outer-spin-button,
.topic-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

.logs { display: flex; flex-direction: column; gap: 3px; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.log-line { padding: 6px 10px; border-radius: 7px; display: flex; gap: 10px; border: 1px solid transparent; }

/* 管理员：站点头像与图片预览 */
.logo { background-size: cover; background-position: center; }
#avatarPreview { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; margin-top: 10px; }
.log-line time { color: #5d6d82; flex: 0 0 132px; }
.log-line.error { color: #ffb3b3; background: rgba(255, 107, 107, .07); }
.log-line.warn { color: #ffd39b; }
.log-line.info { color: #a9bacd; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(3, 6, 10, .72);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal.show { display: flex; }
.modal-box {
  width: 100%; max-width: 720px; max-height: 88vh; overflow: auto;
  background: #101823; border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 15px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: #17222f; border: 1px solid var(--line); color: var(--text);
  padding: 11px 20px; border-radius: 10px; font-size: 13px; opacity: 0;
  pointer-events: none; transition: .24s; z-index: 80; max-width: 80vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 107, 107, .4); color: #ffc4c4; }
.toast.ok { border-color: rgba(53, 208, 186, .4); }

.empty { color: var(--muted); font-size: 12.5px; padding: 26px; text-align: center; border: 1px dashed var(--line); border-radius: 11px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.18); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes rot { to { transform: rotate(360deg); } }

.ai-panel {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px;
  background: rgba(79, 140, 255, .05); margin-bottom: 12px;
}
.ai-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.ai-head b { font-size: 16px; color: var(--accent); }
.ai-head b.bad { color: var(--danger); }
.issues { margin: 8px 0 0 16px; padding: 0; color: #e2b3b3; font-size: 12px; line-height: 1.8; }
.issues:empty { display: none; }

