/* ===========================================================
   管理后台样式
   =========================================================== */
[v-cloak] { display: none; }

:root {
  --a-primary: #2f6fed;
  --a-primary-d: #2559c4;
  --a-bg: #f4f6fa;
  --a-panel: #fff;
  --a-line: #e6e9f0;
  --a-text: #1f2430;
  --a-sub: #79808f;
  --a-side: #1d2433;
  --a-side-hover: #28324a;
  --a-danger: #e5484d;
  --a-ok: #16a34a;
  --a-run: #d97706;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--a-bg);
  color: var(--a-text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d2433 0%, #2b3a55 55%, #3f5182 100%);
}

.login-card {
  width: 380px;
  background: #fff;
  border-radius: 10px;
  padding: 38px 36px 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.login-title { margin: 0 0 4px; font-size: 22px; letter-spacing: 1px; }
.login-sub { margin: 0 0 28px; font-size: 12px; color: var(--a-sub); letter-spacing: 1px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: #4a5160; margin-bottom: 7px; }
.field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus { border-color: var(--a-primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }

.login-err { color: var(--a-danger); font-size: 13px; margin-bottom: 12px; }
.login-tip { margin: 18px 0 0; font-size: 12px; color: #a0a6b3; text-align: center; }

.btn {
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--a-line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #333;
  transition: all .16s;
}
.btn:hover { border-color: #c3cbdc; background: #fafbfe; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--a-primary); border-color: var(--a-primary); color: #fff; }
.btn-primary:hover { background: var(--a-primary-d); border-color: var(--a-primary-d); }
.btn-block { width: 100%; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  background: var(--a-side);
  color: #c7cdda;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, #57a5ff, #2f6fed);
  box-shadow: 0 0 10px rgba(87,165,255,.8);
}

.menu { padding: 14px 10px; flex: 1; }
.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 14px;
  color: #b6becd;
  cursor: pointer;
  transition: all .16s;
}
.menu a:hover { background: var(--a-side-hover); color: #fff; }
.menu a.on { background: var(--a-primary); color: #fff; box-shadow: 0 6px 16px rgba(47,111,237,.35); }
.mi { font-size: 15px; width: 18px; text-align: center; }

.sidebar-foot {
  padding: 16px 22px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 13px;
  display: flex;
  gap: 16px;
}
.sidebar-foot a { color: #8b93a3; cursor: pointer; transition: color .16s; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  background: #fff;
  border-bottom: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  flex-shrink: 0;
}
.tb-left { display: flex; align-items: baseline; gap: 16px; }
.tb-left h2 { margin: 0; font-size: 17px; font-weight: 600; }
.tb-hint { font-size: 13px; color: var(--a-sub); }
.tb-hint b { color: var(--a-text); }
.tb-right { display: flex; align-items: center; gap: 14px; }

.site-select {
  height: 34px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  outline: none;
  cursor: pointer;
}
.preview-link { font-size: 13px; color: var(--a-primary); }
.preview-link:hover { text-decoration: underline; }

.pane { padding: 24px 26px 60px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: 10px;
  margin-bottom: 18px;
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  font-weight: 600;
  font-size: 14.5px;
  border-bottom: 1px solid var(--a-line);
  background: #fbfcfe;
}
.card-body { padding: 20px; }
.card-body.quick { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- 统计 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.stat {
  background: #fff;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-label { font-size: 13px; color: var(--a-sub); }
.stat b { font-size: 26px; font-weight: 700; letter-spacing: .5px; }

/* ---------------- 工具条 ---------------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.inp {
  height: 38px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 0 12px;
  width: 240px;
  outline: none;
}
.inp:focus { border-color: var(--a-primary); }

/* ---------------- 表格 ---------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--a-sub);
  padding: 12px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--a-line);
  white-space: nowrap;
}
.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f8;
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fafcff; }
.td-title a { color: #1f2430; }
.td-title a:hover { color: var(--a-primary); }
.td-visit { font-weight: 600; color: var(--a-primary); }
.td-time { color: var(--a-sub); font-size: 13px; white-space: nowrap; }
.td-empty { text-align: center; color: var(--a-sub); padding: 40px 0; }

.link {
  border: 0;
  background: transparent;
  color: var(--a-primary);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--a-danger); }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
}
.tag-on { background: #e8f7ee; color: var(--a-ok); }
.tag-off { background: #f1f2f5; color: #8b93a3; }
.tag-run { background: #fef3e2; color: var(--a-run); }

/* ---------------- 站点配置 ---------------- */
.site-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.stab {
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--a-line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all .16s;
}
.stab:hover { border-color: #c3cbdc; }
.stab.on { background: var(--a-primary); border-color: var(--a-primary); color: #fff; }
.stab.add { border-style: dashed; color: var(--a-primary); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }
.span2 { grid-column: span 2; }

.cfg-form label, .modal-body label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: #4a5160;
}
.cfg-form input:not([type="checkbox"]):not([type="color"]):not([type="file"]),
.cfg-form select,
.cfg-form textarea,
.modal-body input:not([type="checkbox"]):not([type="file"]),
.modal-body select,
.modal-body textarea {
  height: 38px;
  border: 1px solid var(--a-line);
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.modal-body textarea { height: auto; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.cfg-form input:focus, .cfg-form select:focus,
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
  border-color: var(--a-primary);
  box-shadow: 0 0 0 3px rgba(47,111,237,.1);
}
.cfg-form input[type="color"] { height: 38px; padding: 3px; border: 1px solid var(--a-line); border-radius: 6px; background: #fff; }
.cfg-form label.chk, .modal-body label.chk {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}

.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-row input[type="text"], .upload-row input:not([type="file"]) { flex: 1; }
.upload-row input[type="file"] { font-size: 12px; max-width: 190px; }

.nav-editor { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.nav-row { display: flex; align-items: center; gap: 10px; }
.nav-idx {
  width: 22px; height: 22px; border-radius: 50%;
  background: #eef2fb; color: var(--a-primary);
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-row input { flex: 1; height: 36px; border: 1px solid var(--a-line); border-radius: 6px; padding: 0 12px; outline: none; }

.admgr { display: flex; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--a-line); }
.ad-item { position: relative; width: 140px; }
.ad-item img { width: 140px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--a-line); }
.ad-item .link { display: block; margin-top: 4px; }
.ad-add {
  width: 140px; height: 70px;
  border: 1px dashed #c8d0e0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--a-primary);
  cursor: pointer;
  transition: all .16s;
}
.ad-add:hover { border-color: var(--a-primary); background: #f5f8ff; }

.save-bar {
  position: sticky;
  bottom: 0;
  background: rgba(244,246,250,.94);
  backdrop-filter: blur(6px);
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--a-line);
}
.save-msg { font-size: 13px; color: var(--a-ok); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(16,20,30,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  width: 760px;
  max-width: 100%;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--a-line);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  border: 0; background: transparent;
  font-size: 24px; line-height: 1; color: #98a0b0; cursor: pointer;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--a-line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
  .pane { padding: 16px; }
}
