/* ========================================
   白色简约 UI — White Minimalist Design System
   用于前台公开页面、用户后台、管理员后台
   设计原则：
     - 纯白背景，无毛玻璃，无渐变
     - 细线边框、柔和阴影、克制留白
     - 主色黑 #111827，辅助色灰 #6b7280
     - 圆角 8px / 12px，按钮胶囊形
   ======================================== */

:root {
  /* —— 颜色 —— */
  --bg:           #ffffff;
  --bg-soft:      #f9fafb;
  --bg-muted:     #f3f4f6;
  --border:       #e5e7eb;
  --border-strong:#d1d5db;

  --text-main:    #111827;
  --text-sub:     #6b7280;
  --text-faint:   #9ca3af;

  --accent:       #111827;          /* 主操作色：黑 */
  --accent-hover: #000000;
  --accent-soft:  #f3f4f6;
  --accent-text:  #ffffff;

  --blue:         #2563eb;
  --blue-soft:    #eff6ff;
  --green:        #16a34a;
  --green-soft:   #f0fdf4;
  --orange:       #ea580c;
  --orange-soft:  #fff7ed;
  --red:          #dc2626;
  --red-soft:     #fef2f2;
  --purple:       #7c3aed;
  --purple-soft:  #f5f3ff;

  /* —— 圆角 —— */
  --radius-capsule: 999px;
  --radius-card:    12px;
  --radius-small:   8px;
  --radius-xs:      6px;

  /* —— 阴影 —— */
  --shadow-sm:  0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md:  0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-lg:  0 10px 25px -5px rgba(17, 24, 39, 0.08), 0 8px 10px -6px rgba(17, 24, 39, 0.04);

  /* —— 字体 —— */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:   ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:focus { outline: none; }
:focus-visible { outline: none; }

html { scroll-behavior: smooth; }

/* —— 短文字单行显示 (whiteSpace=nowrap) ——
   仅对短文本元素（标签、IP、#编号、蜘蛛类型、方法名、ID、价格、时间戳等）
   强制单行；长文字（标题、描述、段落、表单 label、卡片内容等）保持换行。 */
.tag,
.badge,
.text-nowrap,
.text-mono,
.code,
code,
kbd,
samp,
.stat-value,
.stat-sub,
.price-tag,
.sb-brand,
.sb-sub,
.sb-un,
.sb-em,
.app-header nav a,
.app-header .brand,
.tb-title,
.btn,
input,
select,
button {
  white-space: nowrap;
}

/* alert / toast 内部允许换行（长 URL、长 API key、长错误消息等不能撑出屏幕）。
   外层容器约束宽度，内部长字串按字符断行。 */
.alert {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  overflow-x: auto;
}
.alert code,
.alert .inline {
  word-break: break-all;
}
.toast {
  max-width: calc(100vw - 48px);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* 表格中的短文字单元格（IP、#编号、方法、状态、ID、调用次数、扣费、时间戳、
   蜘蛛类型等）单行显示；长内容单元格（名称、描述、URI、备注等）保持换行 */
.data-table th,
.data-table td.text-nowrap,
.data-table td.text-mono,
.data-table td.text-right,
.data-table td.text-center {
  white-space: nowrap;
}

body {
  font-family: var(--font-family);
  color: var(--text-main);
  background: var(--bg);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--accent-hover); }

/* —— 容器 —— */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* —— 顶部导航 —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 20px;
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text-main);
  flex-shrink: 0;
}
.app-header .brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  object-fit: cover;
}
.app-header nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.app-header nav a {
  padding: 7px 14px;
  border-radius: var(--radius-capsule);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s ease;
  position: relative;
}
.app-header nav a:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}
.app-header nav a.active {
  color: var(--accent-text);
  background: var(--accent);
  font-weight: 600;
}
.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* —— 卡片（替代 glass-card） —— */
.glass-card,
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.glass-card:hover,
.card:hover {
  box-shadow: var(--shadow-md);
}

/* —— 页面标题 —— */
.page-head {
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}
.page-head p {
  color: var(--text-sub);
  font-size: 14px;
}

/* —— 表单 —— */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 6px;
}
.form-input,
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  transition: all .15s ease;
}
.form-input:focus,
.input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}
textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}
.form-hint {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-small);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}
.btn-primary,
.btn-primary:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-muted);
}
.btn-danger {
  background: var(--bg);
  color: var(--red);
  border-color: var(--border);
}
.btn-danger:hover {
  background: var(--red-soft);
  border-color: var(--red);
}
.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-success:hover {
  background: #15803d;
}
.btn-warning {
  background: var(--bg);
  color: var(--orange);
  border-color: var(--border);
}
.btn-warning:hover {
  background: var(--orange-soft);
  border-color: var(--orange);
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn:disabled,
.btn.disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* —— 搜索框 —— */
.search-input,
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input input,
.search-bar input {
  padding-left: 36px;
}
.search-input::before,
.search-bar::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  background: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") center/contain no-repeat;
  pointer-events: none;
}

/* —— 网格布局 —— */
.grid {
  display: grid;
  gap: 16px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
/* v2.9.2 修复：长内容（如 QUOTA_EXCEEDED）会把 auto-fit/minmax 列撑爆，
   导致手机端统计卡横向超出屏幕 —— 网格子项必须允许收缩 */
.stats-grid > .stat-card {
  min-width: 0;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  /* v2.9.8：最后调用时间等长内容（如 2026-09-28 11:49:54）允许在卡内折行，
     覆盖全局 .stat-value nowrap——nowrap 会让时间戳顶出卡片与屏幕右缘 */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  overflow-wrap: anywhere; /* v2.9.2：QUOTA_EXCEEDED 等长 token 允许断行，不再撑破卡片 */
  white-space: normal; /* v2.9.7：覆盖全局 .stat-sub nowrap（否则 anywhere 被压制） */
}

/* —— 横向滚动容器（统计卡片 / 窄屏内容超出时左右滑动） —— */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.scroll-x > .stats-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  margin-bottom: 0;
  min-width: max-content;
}
.scroll-x > .stats-grid > .stat-card {
  min-width: 180px;
  flex-shrink: 0;
}
/* IP / 等宽内容强制不换行，配合表格 overflow-x:auto 左右滑动 */
.text-nowrap {
  white-space: nowrap;
}

/* —— API 卡片 —— */
.api-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  transition: all .15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}
.api-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.api-card .api-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.api-card .api-desc {
  font-size: 13px;
  color: var(--text-sub);
  flex: 1;
}
.api-card .api-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

/* —— 标签 / 徽章 —— */
.tag,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-capsule);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-sub);
  border: 1px solid transparent;
}
.tag-method-get    { background: var(--blue-soft);   color: var(--blue);   }
.tag-method-post   { background: var(--green-soft);  color: var(--green);  }
.tag-method-put    { background: var(--orange-soft); color: var(--orange); }
.tag-method-delete { background: var(--red-soft);    color: var(--red);    }
.tag-public  { background: var(--blue-soft);   color: var(--blue);   }
.tag-free    { background: var(--green-soft);  color: var(--green);  }
.tag-paid    { background: var(--orange-soft); color: var(--orange); }
.tag-active  { background: var(--green-soft);  color: var(--green);  }
.tag-inactive,
.tag-pending { background: var(--orange-soft); color: var(--orange); }
.tag-rejected,
.tag-disabled,
.tag-unread  { background: var(--red-soft);    color: var(--red);    }
.tag-read,
.tag-approved{ background: var(--bg-muted);     color: var(--text-sub); }

/* —— 表格 —— */
.table-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table.data-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table thead,
.table thead {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
table.data-table th,
.table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  color: var(--text-sub);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
table.data-table td,
.table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
table.data-table tr:hover td,
.table tbody tr:hover td {
  background: var(--bg-soft);
}
.table-overflow {
  overflow-x: auto;
}

/* —— 侧边导航栏（替代 FAB） —— */
/* 桌面：固定在左侧的竖向快速导航；移动端：抽屉式（默认隐藏，点击汉堡按钮显示） */
.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-xs);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}
.sidebar-toggle svg { width: 20px; height: 20px; }

.sidebar {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
}
.sidebar a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  color: var(--text-sub);
  position: relative;
  transition: all .15s ease;
}
.sidebar a:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.sidebar a .tip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.sidebar a:hover .tip { opacity: 1; }
.sidebar .sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  z-index: 49;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 768px) {
  /* 移动端：隐藏侧边栏，改用顶部汉堡按钮触发抽屉 */
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    display: none;
    left: 0;
    top: 0;
    transform: none;
    width: 240px;
    height: 100vh;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    align-items: stretch;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  .sidebar.open { display: flex; }
  .sidebar a {
    width: 100%;
    height: 44px;
    justify-content: flex-start;
    padding: 0 12px;
    gap: 12px;
    color: var(--text-main);
    font-size: 14px;
  }
  .sidebar a .tip {
    position: static;
    transform: none;
    background: transparent;
    color: inherit;
    opacity: 1;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
  }
  .sidebar .sidebar-divider {
    margin: 8px 0;
  }
}

/* —— 模态框 —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text-main); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* —— 提示条 —— */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-text);
  padding: 10px 18px;
  border-radius: var(--radius-small);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: opacity .25s ease, top .25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  top: 32px;
}
.toast.toast-success { background: var(--green); color: #fff; }
.toast.toast-error   { background: var(--red);   color: #fff; }
.toast.toast-info    { background: var(--blue); color: #fff; }

/* —— 警告/提示框 —— */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-small);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-main);
  margin-bottom: 16px;
}
.alert-info    { background: var(--blue-soft);   border-color: #bfdbfe; color: var(--blue); }
.alert-success { background: var(--green-soft);  border-color: #bbf7d0; color: var(--green); }
.alert-warning { background: var(--orange-soft); border-color: #fed7aa; color: var(--orange); }
.alert-danger  { background: var(--red-soft);    border-color: #fecaca; color: var(--red); }

/* —— 空状态 —— */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-sub);
}
.empty-state svg,
.empty-state .empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.empty-state h3 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 4px;
  font-weight: 500;
}
.empty-state p {
  font-size: 13px;
  color: var(--text-sub);
}

/* —— 页脚 —— */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 24px 0;
  margin-top: 48px;
  color: var(--text-sub);
  font-size: 13px;
}
/* v2.9.3 修复：带侧边栏的页面中页脚是全宽渲染的，其左侧内容（RSS/站点地图/免责声明等）
   会被 248px 固定侧边栏永久遮挡 —— 用相邻兄弟选择器精确命中"有侧边栏"的页脚并避让；
   登录/注册等无侧边栏页面不匹配此选择器，不受影响 */
.app-main + .app-footer {
  padding-left: 248px;
}
@media (min-width: 1600px) {
  .app-main + .app-footer .container {
    max-width: 1520px; /* 与 v2.9.2 放宽后的主内容列保持同宽对齐 */
  }
}
.app-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.app-footer a { color: var(--text-sub); }
.app-footer a:hover { color: var(--text-main); }

/* —— 主内容区 —— */
main,
.main-content {
  padding: 32px 0;
  min-height: calc(100vh - 64px - 100px);
}

/* —— 实用工具类 —— */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-sub); }
.text-faint  { color: var(--text-faint); }
.text-bold   { font-weight: 600; }
.text-mono   { font-family: var(--font-mono); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-lg     { font-size: 16px; }
.text-xl     { font-size: 20px; }
.text-2xl    { font-size: 24px; font-weight: 600; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-orange { color: var(--orange); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* —— 公告 —— */
.announcement {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-small);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
}
.announcement.top {
  border-left-color: var(--orange);
  background: var(--orange-soft);
}

/* 公告 Markdown 排版（紧凑版，适用于公告卡片/弹窗） */
.ann-md { line-height: 1.7; color: var(--text-main); overflow-wrap: break-word; }
.ann-md p { margin: 4px 0; font-size: 13px; color: var(--text-sub); }
.ann-md p:first-child { margin-top: 0; }
.ann-md p:last-child { margin-bottom: 0; }
.ann-md h1, .ann-md h2, .ann-md h3, .ann-md h4 { font-size: 13.5px; font-weight: 600; color: var(--text-main); margin: 10px 0 4px; }
.ann-md h1:first-child, .ann-md h2:first-child, .ann-md h3:first-child { margin-top: 0; }
.ann-md strong { color: var(--text-main); font-weight: 600; }
.ann-md a { color: var(--blue); text-decoration: none; }
.ann-md a:hover { text-decoration: underline; }
.ann-md ul, .ann-md ol { padding-left: 20px; margin: 4px 0; }
.ann-md li { font-size: 13px; color: var(--text-sub); margin: 2px 0; }
.ann-md blockquote { margin: 6px 0; padding: 4px 10px; border-left: 3px solid var(--blue); background: var(--bg-muted); border-radius: 0 6px 6px 0; color: var(--text-sub); font-size: 12.5px; }
.ann-md code { background: var(--bg-muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-family: var(--font-mono); font-size: 12px; color: var(--text-main); }
.ann-md pre { background: var(--bg-muted); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; overflow-x: auto; margin: 6px 0; }
.ann-md pre code { background: none; border: none; padding: 0; }
.ann-md table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.ann-md th, .ann-md td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; color: var(--text-sub); }
.ann-md th { background: var(--bg-muted); color: var(--text-main); font-weight: 600; }
.ann-md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.ann-md img { max-width: 100%; border-radius: 6px; }

/* —— 首页公告紧凑列表（单行标题，全文在弹窗查看，避免占屏） —— */
.ann-compact-card { padding-bottom: 6px; }
.ann-compact-list { display: flex; flex-direction: column; }
.ann-compact-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; background: none; border: none; cursor: pointer;
  border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 10px 4px; font-size: 13.5px; color: var(--text-main);
  font-family: inherit; line-height: 1.5; transition: background .12s ease;
}
.ann-compact-item:last-child { border-bottom: none; }
.ann-compact-item:hover { background: var(--bg-muted); }
.ann-compact-item svg { flex: none; color: var(--text-faint); }
.ann-count-badge {
  font-size: 11px; font-weight: 600; color: var(--text-sub);
  background: var(--bg-muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 7px; line-height: 17px;
}
.ann-top-badge {
  flex: none; font-size: 10.5px; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 4px; background: var(--orange, #f97316); color: #fff;
}
.ann-compact-title {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ann-compact-date {
  flex: none; font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono);
}
.ann-compact-more { padding: 8px 4px 10px; }
@media (max-width: 640px) {
  .ann-compact-item { padding: 9px 2px; font-size: 13px; }
  .ann-compact-date { display: none; }
}

/* —— 友链 —— */
.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transition: all .15s ease;
}
.link-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.link-card img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
}
.link-card .link-info {
  flex: 1;
  min-width: 0;
}
.link-card .link-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}
.link-card .link-desc {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* —— 登录注册页 —— */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-soft);
}
.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
}
.auth-card .auth-sub {
  font-size: 13px;
  color: var(--text-sub);
  text-align: center;
  margin-bottom: 24px;
}
.auth-card .auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
}

/* —— 侧边栏布局（管理后台/用户后台） —— */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}
.layout-with-sidebar > .main-content,
.layout-with-sidebar > main,
.layout-with-sidebar > div:last-child {
  min-width: 0;
}
.sidebar {
  position: sticky;
  top: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar a:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.sidebar a.active {
  background: var(--accent);
  color: var(--accent-text);
}
.sidebar .sidebar-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  padding: 12px 12px 6px;
  font-weight: 600;
}
.sidebar .sidebar-section:first-child { padding-top: 4px; }
.sidebar .sidebar-front-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-muted);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  transition: all .15s ease;
}
.sidebar .sidebar-front-link:hover {
  background: var(--accent);
  color: var(--accent-text);
}

/* —— 代码块 —— */
pre.code,
.code-block {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}
code.inline {
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text-main);
  /* v2.9.7：覆盖全局 code nowrap（大组规则），长 URL/密钥串允许任意断行，
     否则 white-space:nowrap 会压制 overflow-wrap 导致手机版撑破屏幕 */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

/* —— 复制按钮 —— */
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 11px;
  transition: all .15s ease;
}
.copy-btn:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.copy-btn.copied {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green);
}

/* —— 分页 —— */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-sub);
}
.pagination a:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.pagination .current {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* —— 头像 —— */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-capsule);
  background: var(--bg-muted);
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

/* —— 计费显示 —— */
.price-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-capsule);
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
}
.free-tag {
  background: var(--green-soft);
  color: var(--green);
}

/* ========================================
   应用侧边栏
   用于前台、用户中心、管理后台
   ======================================== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 248px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}
.app-sidebar .sb-hd {
  padding: 28px 24px 22px;
}
.app-sidebar .sb-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sidebar .sb-brand img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
}
.app-sidebar .sb-sub {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 6px;
  display: block;
}
.app-sidebar .sb-usr {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 8px;
}
.app-sidebar .sb-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.app-sidebar .sb-av.guest {
  background: var(--bg-muted);
  color: var(--text-sub);
}
.app-sidebar .sb-un {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}
.app-sidebar .sb-em {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}
.app-sidebar .sb-au {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.app-sidebar .sb-au a {
  flex: 1;
  text-align: center;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  transition: all .2s ease;
  text-decoration: none;
}
.app-sidebar .sb-au .login-btn {
  background: var(--bg-muted);
  color: var(--text-sub);
}
.app-sidebar .sb-au .login-btn:hover {
  background: var(--border);
  color: var(--text-main);
}
.app-sidebar .sb-au .register-btn {
  background: var(--text-main);
  color: var(--bg);
}
.app-sidebar .sb-au .register-btn:hover {
  background: var(--accent-hover);
}
.app-sidebar .sb-nav {
  padding: 18px 14px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-sidebar .sb-nav-lbl {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px;
  margin-bottom: 10px;
  display: block;
}
.app-sidebar .sb-nav-lbl:not(:first-child) {
  margin-top: 20px;
}
.app-sidebar .sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
  transition: all .2s ease;
  margin-bottom: 1px;
  text-decoration: none;
  overflow: hidden;
}
.app-sidebar .sb-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sidebar .sb-link:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.app-sidebar .sb-link.active {
  background: var(--bg-muted);
  color: var(--text-main);
  font-weight: 600;
}
.app-sidebar .sb-link svg {
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity .2s;
  width: 16px;
  height: 16px;
}
.app-sidebar .sb-link:hover svg,
.app-sidebar .sb-link.active svg {
  opacity: 0.9;
}
.app-sidebar .sb-ft {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.app-sidebar .sb-ft .sb-link {
  color: var(--red);
}
.app-sidebar .sb-ft .sb-link:hover {
  background: var(--red-soft);
}

/* 主内容区（与侧边栏配合） */
.app-main {
  margin-left: 248px;
  min-height: 100vh;
}
/* v2.9.2：大屏放宽后台/用户中心内容区，宽表格（密钥/用户/兑换码）在 1920 宽屏下
   不再截断操作列 —— 仅作用于 app-main 作用域，前台页面维持 1200px 不变 */
@media (min-width: 1600px) {
  .app-main > .container {
    max-width: 1520px;
  }
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.app-topbar.scrolled {
  border-bottom-color: var(--border);
  background: rgba(255, 255, 255, 0.95);
}
.app-topbar .tb-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-topbar .tb-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}
.app-topbar .tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-topbar .menu-toggle {
  display: none;
  padding: 8px;
  color: var(--text-sub);
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
  background: none;
  border: none;
  align-items: center;
  justify-content: center;
}
.app-topbar .menu-toggle:hover {
  background: var(--bg-muted);
}
.app-topbar .menu-toggle svg {
  width: 20px;
  height: 20px;
}
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}
.sb-backdrop.open {
  display: block;
}

/* —— 响应式 —— */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  /* v2.9.3：移动端侧边栏变为抽屉（默认隐藏），页脚不再需要避让 */
  .app-main + .app-footer { padding-left: 0; }
  .app-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .app-header .container { flex-wrap: wrap; gap: 8px; }
  .app-header .brand { font-size: 15px; }
  .app-header .brand img { width: 26px; height: 26px; }
  .app-header nav { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; gap: 4px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .app-header nav a { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
  .app-header .header-actions .btn { padding: 6px 10px; font-size: 12px; }
  .layout-with-sidebar {
    grid-template-columns: 1fr;
  }
  .layout-with-sidebar > * { min-width: 0; }
  .sidebar {
    position: static;
    margin-bottom: 16px;
    width: auto;
    max-width: 100%;
  }
  /* 新侧边栏移动端 */
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .app-topbar {
    padding: 0 16px;
  }
  .app-topbar .menu-toggle {
    display: flex;
  }
  .page-head.flex,
  .page-head[class*="flex"] {
    flex-wrap: wrap;
    gap: 8px;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .grid-auto {
    grid-template-columns: 1fr;
  }
  main, .main-content {
    padding: 16px 0;
  }
  /* 移动端：侧边栏抽屉打开时禁止背景滚动 */
  body.sidebar-open { overflow: hidden; }
  .auth-card {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  /* v2.9.2：运营统计卡（第二排）内容较长，窄屏改单列避免拥挤换行错乱 */
  .stats-grid-ops { grid-template-columns: 1fr; }
  .stats-grid-ops .stat-card { padding: 14px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 22px; }
  .glass-card, .card { padding: 16px; }
}

/* —— 加载动画 —— */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* —— 滚动条美化 —— */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-capsule);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ===================== 广告幻灯片 ===================== */
.ad-slider {
  position: relative;
  padding: 0 !important;
  overflow: hidden;
  min-height: 100px;
}
.ad-slider-track {
  position: relative;
  width: 100%;
  min-height: 100px;
}
.ad-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  overflow: hidden;
}
.ad-slide.active {
  opacity: 1;
  pointer-events: auto;
}
.ad-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  height: auto;
}
.ad-image-link {
  display: block;
  width: 100%;
}
.ad-text-slide {
  padding: 24px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.ad-text-slide h4 {
  margin: 0;
  font-size: 18px;
}
.ad-text-slide p {
  margin: 0;
  color: var(--text-muted);
}
/* script/html 类型广告：让其内部内容居中并占据全宽 */
.ad-slide > script,
.ad-slide > iframe,
.ad-slide > ins,
.ad-slide > div {
  display: block;
  width: 100%;
  text-align: center;
}
.ad-slide iframe {
  max-width: 100%;
  border: 0;
}
.ad-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background .2s;
}
.ad-nav:hover {
  background: rgba(0, 0, 0, .55);
}
.ad-prev { left: 12px; }
.ad-next { right: 12px; }
.ad-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 5;
}
.ad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.ad-dot.active {
  background: var(--accent, #4f46e5);
  transform: scale(1.25);
}
.ad-label {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  border-radius: 4px;
  letter-spacing: .5px;
  z-index: 5;
  pointer-events: none;
}
@media (max-width: 768px) {
  .ad-image { max-height: 140px; }
  .ad-nav { width: 30px; height: 30px; }
}

