/* ============================================================
   SaaS 建站系统 · 后台设计系统
   1. 设计令牌   2. 基础元素   3. 布局壳   4. 页面头
   5. 卡片/统计  6. 面板      7. 表格     8. 标签
   9. 按钮      10. 表单     11. 弹窗    12. 提示与空状态
   13. 公告/订阅 14. 登录页   15. 响应式
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e6eaf2;
  --border-strong: #d7dee9;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8a94a6;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef4ff;
  --primary-ring: rgba(37, 99, 235, .16);

  --success: #16a34a;
  --success-soft: #e9f8ef;
  --warning: #d97706;
  --warning-soft: #fff4e5;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --purple: #7c3aed;
  --purple-soft: #f3edff;

  --sidebar: #0f172a;
  --sidebar-hi: #17213a;
  --sidebar-text: #a7b2c6;
  --sidebar-muted: #64748b;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .10);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .22);

  --sidebar-w: 248px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- 2. 基础元素 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { cursor: pointer; font-family: inherit; }
button:disabled { cursor: not-allowed; }
a { color: var(--primary); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
  color: #334155;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

::selection { background: rgba(37, 99, 235, .18); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfd8e6; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6c2d6; background-clip: content-box; }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.65; resize: vertical; }
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input::placeholder, textarea::placeholder { color: #a9b3c2; }
input:hover, textarea:hover, select:hover { border-color: #c4cddb; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; accent-color: var(--primary); }

label { font-size: 13px; color: var(--text-2); }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar) 0%, #111c33 100%);
  color: var(--sidebar-text);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .2px;
  flex-shrink: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .40);
  font-size: 14px;
  font-weight: 700;
}
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 2px 12px 14px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); background-clip: content-box; }

.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 4px; }
.nav-title {
  padding: 0 10px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .8; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .34), rgba(37, 99, 235, .10));
  color: #fff;
  font-weight: 500;
}
.nav-item.active svg { opacity: 1; color: #93c5fd; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: #60a5fa;
}

.sidebar-foot { flex-shrink: 0; padding: 10px 12px 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
}
.user-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.user-name { color: #fff; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--sidebar-muted); font-size: 11px; }
.btn-logout {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: rgba(255, 255, 255, .10); color: #fff; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: #c3cbd8; }
.topbar-spacer { flex: 1; }

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.plan-chip.warn { background: var(--warning-soft); color: var(--warning); }
.plan-chip.muted { background: var(--surface-3); color: var(--text-2); }

.nav-toggle { display: none !important; }

.page { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 28px 56px; }

/* ---------- 4. 页面头 ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { margin-top: 5px; color: var(--text-2); font-size: 13px; line-height: 1.6; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 兼容旧页面写法 */
.main h2 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 4px; }
.main .desc { color: var(--text-2); font-size: 13px; margin-bottom: 20px; line-height: 1.6; }

/* ---------- 5. 卡片 / 统计 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card .label { color: var(--text-2); font-size: 12.5px; }
.card .num { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; color: var(--text); }

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.stat:hover { box-shadow: 0 4px 16px rgba(15, 23, 42, .07); }
.stat-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-ico svg { width: 19px; height: 19px; }
.stat-ico.green { background: var(--success-soft); color: var(--success); }
.stat-ico.orange { background: var(--warning-soft); color: var(--warning); }
.stat-ico.red { background: var(--danger-soft); color: var(--danger); }
.stat-ico.purple { background: var(--purple-soft); color: var(--purple); }
.stat-body { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-num { font-size: 23px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.stat-num.green { color: var(--success); }
.stat-num.red { color: var(--danger); }
.stat-num.orange { color: var(--warning); }

/* ---------- 6. 面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel > h3, .panel > h2 { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.panel .panel-sub { font-size: 12.5px; color: var(--text-3); margin: -8px 0 14px; line-height: 1.65; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.panel-head .hint { font-size: 12.5px; color: var(--text-3); }
.panel-head .panel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h3 { padding: 16px 20px 0; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

/* 键值信息块 */
.kv { display: grid; gap: 10px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.kv-row .k { color: var(--text-2); }
.kv-row .v { color: var(--text); font-weight: 500; text-align: right; }

/* ---------- 7. 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap table { min-width: 100%; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
thead th:first-child { border-top-left-radius: var(--radius-xs); border-bottom-left-radius: var(--radius-xs); }
thead th:last-child { border-top-right-radius: var(--radius-xs); border-bottom-right-radius: var(--radius-xs); }
tbody td { padding: 12px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafcff; }
td .actions, .cell-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.td-strong { font-weight: 500; }
.td-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.td-num { font-variant-numeric: tabular-nums; }
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 2px 0;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ---------- 8. 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--primary-soft);
  color: var(--primary);
}
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warning-soft); color: var(--warning); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: var(--surface-3); color: var(--text-2); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.tag.sm { height: 20px; padding: 0 7px; font-size: 11px; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 9. 按钮 ---------- */
.btn, .btn-small, .btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover, .btn-small:hover, .btn-sm:hover { background: var(--primary-dark); text-decoration: none; }
.btn svg, .btn-small svg, .btn-sm svg { width: 16px; height: 16px; }

.btn.ghost, .btn-small.ghost, .btn-sm.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn.ghost:hover, .btn-small.ghost:hover, .btn-sm.ghost:hover { background: var(--surface-2); color: var(--text); border-color: #c4cddb; }

.btn.soft, .btn-small.soft, .btn-sm.soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn.soft:hover, .btn-small.soft:hover, .btn-sm.soft:hover { background: #e2ebff; color: var(--primary-dark); }

.btn.warn, .btn-small.warn, .btn-sm.warn { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.warn:hover, .btn-small.warn:hover, .btn-sm.warn:hover { background: #fbdada; }

.btn.danger, .btn-sm.danger { background: var(--danger); color: #fff; }
.btn.danger:hover, .btn-sm.danger:hover { background: #b91c1c; }
.btn.danger:disabled, .btn.danger:disabled:hover, .btn-sm.danger:disabled { background: var(--danger); }

.btn.ok, .btn-small.ok, .btn-sm.ok { background: var(--success); color: #fff; }
.btn.ok:hover, .btn-small.ok:hover, .btn-sm.ok:hover { background: #128a3e; }

.btn.purple, .btn-small.purple, .btn-sm.purple { background: var(--purple); color: #fff; }
.btn.purple:hover, .btn-small.purple:hover, .btn-sm.purple:hover { background: #6b28d9; }

.btn.gray, .btn-small.gray, .btn-sm.gray { background: var(--surface-3); color: var(--text-2); }
.btn.gray:hover, .btn-small.gray:hover, .btn-sm.gray:hover { background: #e6ecf5; }

.btn-sm, .btn-small { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg, .btn-small svg { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn:disabled, .btn-small:disabled, .btn-sm:disabled { opacity: .45; pointer-events: none; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* 旧写法兜底：.row 里的裸按钮按主按钮渲染 */
.row > button:not(.btn):not(.btn-small) {
  height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.row > button:not(.btn):not(.btn-small):hover { background: var(--primary-dark); }

/* ---------- 10. 表单 / 工具栏 ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.row:last-child { margin-bottom: 0; }
.row input, .row select { flex: 1 1 170px; min-width: 120px; width: auto; }
.row textarea { flex: 1 1 100%; }
.row .row-note { font-size: 12.5px; color: var(--text-3); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.toolbar input, .toolbar select { flex: 0 1 220px; width: auto; height: 36px; }
.toolbar .grow { flex: 1; }
.toolbar .spacer { flex: 1; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint, .hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.65; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }

/* 进度条 */
.progress { height: 5px; border-radius: 99px; background: #e9eef6; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--success); transition: width .3s; }
.progress.warn > i { background: var(--warning); }
.progress.danger > i { background: var(--danger); }

/* ---------- 11. 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: maskIn .16s ease-out;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 22px 24px;
  width: 90%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease-out;
}
.modal h2 { font-size: 17px; font-weight: 650; margin-bottom: 4px; }
.modal h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 6px; }
.modal .modal-sub, .modal > p { color: var(--text-2); font-size: 13px; line-height: 1.65; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  display: grid;
  place-items: center;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- 12. 提示与空状态 ---------- */
.msg { margin-top: 12px; font-size: 13px; color: var(--success); }
.msg.err { color: var(--danger); }
.msg.info { color: var(--text-2); }

.empty, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty-state .empty-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: #9aa6b8;
  margin-bottom: 4px;
}
.empty-state .empty-ico svg { width: 20px; height: 20px; }
.empty-state strong { color: var(--text-2); font-weight: 500; font-size: 13.5px; }

.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  background: var(--primary-soft);
  color: #1e40af;
  border: 1px solid #dbe6ff;
}
.alert.warn { background: var(--warning-soft); color: #92400e; border-color: #fde4bf; }
.alert.danger { background: var(--danger-soft); color: #991b1b; border-color: #fbd5d5; }
.alert .alert-title { font-weight: 600; }

/* ---------- 13. 公告 / 订阅 ---------- */
.ann-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.6;
  border-bottom: 1px solid transparent;
}
.ann-banner svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.ann-banner.normal { background: var(--primary-soft); border-color: #dbe6ff; color: #1e40af; }
.ann-banner.important { background: var(--warning-soft); border-color: #fde4bf; color: #92400e; }
.ann-banner.urgent { background: var(--danger-soft); border-color: #fbd5d5; color: #991b1b; }
.ann-banner .ann-text { flex: 1; min-width: 0; }
.ann-banner .ann-content { margin-top: 2px; font-size: 12.5px; opacity: .88; white-space: pre-wrap; }
.ann-banner b { font-weight: 600; }
.ann-close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  opacity: .55;
}
.ann-close:hover { opacity: 1; }

.sub-banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .22);
}
.sub-banner::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.sub-banner h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.sub-banner p { font-size: 13px; opacity: .9; }
.sub-banner > * { position: relative; z-index: 1; }
.sub-banner .cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .34);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.sub-banner .cta:hover { background: rgba(255, 255, 255, .26); text-decoration: none; }

/* 留言卡片 */
.msg-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 11px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color .15s, background .15s;
}
.msg-card:last-child { margin-bottom: 0; }
.msg-card:hover { border-color: var(--border-strong); }
.msg-card.unread { border-color: #bfd5ff; background: #f8fbff; }
.msg-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.msg-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 20px; }
.msg-fields .k { color: var(--text-2); font-weight: 500; }

.codes-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 300px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  letter-spacing: .3px;
}

/* ---------- 14. 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(59, 130, 246, .45), transparent 60%),
    radial-gradient(800px 500px at 85% 85%, rgba(124, 58, 237, .40), transparent 60%),
    linear-gradient(135deg, #1e3a8a, #312e81);
}
.login-card {
  width: 100%;
  max-width: 392px;
  background: var(--surface);
  border-radius: 16px;
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, .40);
}
.login-card h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.login-card .sub { color: var(--text-2); margin: 6px 0 22px; font-size: 13px; }
.login-card label { display: block; margin: 14px 0 6px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.login-card button {
  width: 100%;
  height: 42px;
  margin-top: 22px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s;
}
.login-card button:hover { background: var(--primary-dark); }
.login-card .switch { text-align: center; margin-top: 18px; color: var(--text-3); font-size: 13px; }
.err { color: var(--danger); margin-top: 12px; font-size: 13px; }
.tip {
  background: var(--primary-soft);
  color: #1e40af;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  margin-top: 16px;
}

/* 功能入口磁贴 */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tile:hover { border-color: #c9d6ea; box-shadow: 0 6px 18px rgba(15, 23, 42, .06); transform: translateY(-1px); }
.tile-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 8px; }
.tile-ico svg { width: 18px; height: 18px; }
.tile-title { font-weight: 600; font-size: 14px; }
.tile-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.tile .btn { margin-top: auto; }

/* 步骤说明 */
.steps { padding-left: 18px; color: var(--text-2); font-size: 13px; line-height: 2; }
.steps li::marker { color: var(--text-3); }

/* 圆点列表 */
.bullets { list-style: none; padding-left: 0; color: var(--text-2); font-size: 13px; line-height: 2; }
.bullets li { position: relative; padding-left: 16px; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .82em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}

/* 媒体网格（图库 / 选图弹窗） */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.media-item {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.media-item:hover { border-color: #bfd0ea; }
.media-item.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.media-item .thumb { height: 110px; background: var(--surface-3); overflow: hidden; }
.media-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .name { padding: 6px 8px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.media-item .check svg { width: 13px; height: 13px; }

/* 图库卡片 */
.media-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.media-card:hover { border-color: #c9d6ea; box-shadow: 0 6px 18px rgba(15, 23, 42, .06); }
.media-card .thumb { height: 120px; background: var(--surface-3); overflow: hidden; cursor: zoom-in; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.media-card .info { padding: 8px 10px; }
.media-card .file-name { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-card .acts { display: flex; gap: 6px; margin-top: 8px; }
.media-card .acts button {
  flex: 1;
  height: 26px;
  border: 0;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--primary-soft);
  color: var(--primary);
  transition: background .15s;
}
.media-card .acts button:hover { background: #e2ebff; }
.media-card .acts button.del { flex: 0 0 auto; padding: 0 10px; background: var(--danger-soft); color: var(--danger); }
.media-card .acts button.del:hover { background: #fbdada; }

/* 帮助中心：渐变引导区 */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  color: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, .22);
}
.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero > * { position: relative; z-index: 1; }
.hero-title { font-size: 18px; font-weight: 650; margin-bottom: 16px; }
.hero-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hero-step {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hero-step .n {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.hero-step b { font-size: 13.5px; font-weight: 600; }
.hero-step p { font-size: 12.5px; opacity: .85; margin-top: 3px; line-height: 1.65; }

/* 折叠面板 */
.accordion { border-top: 1px solid var(--border); }
.acc { border-bottom: 1px solid var(--border); }
.acc:last-child { border-bottom: 0; }
.acc summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.8px solid var(--text-3);
  border-bottom: 1.8px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform .2s;
  flex: 0 0 8px;
}
.acc[open] summary::after { transform: rotate(-135deg); }
.acc summary:hover { color: var(--primary); }
.acc-body { padding: 0 4px 16px; color: var(--text-2); font-size: 13.5px; line-height: 1.95; }
.acc-body p { margin: 0 0 12px; }
.acc-body p:last-child { margin-bottom: 0; }
.acc-body b { color: var(--text); font-weight: 600; }

/* 常见问题 */
.faq-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.faq-item:first-child { padding-top: 0; }
.faq-item:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-item .q { font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.faq-item .q::before {
  content: "Q";
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.faq-item .a { color: var(--text-2); font-size: 13px; line-height: 1.85; margin-top: 6px; padding-left: 26px; }

/* 网站设置：两栏布局 + 控件 */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 16px; align-items: start; }
.settings-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.settings-col .panel { margin-bottom: 0; }

.logo-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.logo-box {
  width: 160px;
  height: 100px;
  flex: 0 0 160px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-side { flex: 1; min-width: 200px; }
.logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-actions label.btn { display: inline-flex; }

.swatch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preset-color {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  transition: transform .12s;
}
.preset-color:hover { transform: scale(1.08); }
.color-input { width: 44px; height: 32px; padding: 2px; flex: 0 0 44px; border-radius: 8px; cursor: pointer; }
.color-text { width: 92px; flex: 0 0 92px; height: 34px; font-size: 12.5px; }

.social-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.social-row input:first-child { flex: 0 0 130px; }

.save-bar {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.save-bar .msg { margin: 0; }

@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .logo-box { width: 100%; flex: 1 1 100%; }
  .social-row { flex-wrap: wrap; }
  .social-row input:first-child { flex: 1 1 100%; }
}

/* 页面编辑器 */
.editor { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--bg); }
.editor-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.editor-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.editor-title b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.editor-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.editor-head-spacer { flex: 1; }
.editor-body { flex: 1; display: flex; min-height: 0; }

.editor-left { width: 300px; flex: 0 0 300px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); padding: 16px; }
.ed-section + .ed-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.ed-title { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .07em; text-transform: uppercase; margin-bottom: 10px; }
.ed-sub { font-size: 12px; color: var(--text-3); margin: 14px 0 8px; }
.add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.add-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  text-align: left;
  transition: border-color .15s, background .15s, color .15s;
}
.add-btn svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--text-3); }
.add-btn:hover { border-color: #c3d4f0; background: var(--primary-soft); color: var(--primary); }
.add-btn:hover svg { color: var(--primary); }
.add-btn.center { justify-content: center; }
.editor-left .field { margin-bottom: 12px; }
.editor-left .field > label { font-size: 12px; }
.editor-left .field .hint { margin-top: 5px; }

.editor-canvas { flex: 1; min-width: 0; overflow-y: auto; padding: 18px; }
.canvas-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.canvas-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.canvas-inner { padding: 22px; min-height: 520px; }

/* 画布里的区块 */
.block-wrap { position: relative; border: 2px solid transparent; border-radius: 10px; margin: 8px 0; padding: 8px 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.block-wrap:hover { border-color: #c7d7f5; background: #fafcff; }
.block-wrap.selected { border-color: var(--primary); background: var(--primary-soft); }
.block-tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; z-index: 2; opacity: 0; transition: opacity .12s; }
.block-wrap:hover .block-tools, .block-wrap.selected .block-tools { opacity: 1; }
.block-tool { height: 24px; min-width: 26px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text-2); font-size: 12px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.block-tool:hover { background: var(--primary-soft); color: var(--primary); border-color: #c7d7f5; }
.block-tool.danger { color: var(--danger); }
.block-tool.danger:hover { background: var(--danger-soft); border-color: #f3c7c7; color: var(--danger); }
.block-width { position: absolute; left: 8px; top: -9px; z-index: 2; display: inline-flex; align-items: center; background: var(--purple); color: #fff; padding: 0 7px; border-radius: 5px; font-size: 11px; line-height: 17px; box-shadow: 0 1px 3px rgba(15, 23, 42, .18); }

/* 区块编辑弹窗 */
.modal-scroll { max-height: 56vh; overflow-y: auto; margin: 12px 0 4px; padding-right: 2px; }
.modal-foot.column { flex-direction: column; align-items: stretch; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ep-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.editor-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px; margin-bottom: 8px; }

@media (max-width: 980px) {
  .editor-body { flex-direction: column; }
  .editor-left { width: 100%; flex: 0 0 auto; max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .editor-canvas { padding: 12px; }
  .canvas-inner { padding: 14px; min-height: 320px; }
  .editor-title b { max-width: 160px; }
  .editor-head { gap: 8px; }
}

@media (max-width: 700px) {
  .editor-head { flex-wrap: wrap; row-gap: 8px; padding: 8px 12px; }
  .editor-head-spacer { display: none; }
  .editor-title { order: 9; flex: 1 0 100%; }
  .editor-title b { max-width: 60vw; }
  .editor-head .btn-sm { padding: 0 10px; }
}

@media (max-width: 480px) {
  .editor-head .tag { display: none; }
}

/* 图标默认尺寸（各组件内的 .btn svg / .nav-item svg 等会覆盖） */
.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }

/* ---------- 15. 工具类 / 响应式 ---------- */
.muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; gap: 14px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.scrim { display: none; }

@media (max-width: 1080px) {
  .page { padding: 20px 20px 48px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 24px 0 60px rgba(2, 6, 23, .28);
  }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    z-index: 45;
  }
  .nav-toggle { display: inline-flex !important; }
  .page { padding: 16px 14px 40px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 19px; }
  .panel { padding: 16px; border-radius: 11px; }
  .modal { padding: 18px; width: 100%; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; gap: 11px; }
  .stat-ico { width: 34px; height: 34px; flex-basis: 34px; border-radius: 9px; }
  .stat-num { font-size: 19px; }
  .card .num { font-size: 21px; }
  .toolbar input, .toolbar select { flex: 1 1 100%; }
  .table-wrap table { min-width: 680px; }
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  .table-wrap td .actions { flex-wrap: nowrap; }
}

@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .tile-ico { width: 30px; height: 30px; border-radius: 8px; margin-bottom: 6px; }
  .tile-title { font-size: 13px; }
  .tile-desc { font-size: 11.5px; margin-bottom: 0; }
  .crumbs .crumb-group { display: none; }
  .crumbs .sep { display: none; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
