:root {
  --accent: #2563eb;
  --accent-hover: #6b86f9;
  --accent-light: rgba(79, 110, 247, 0.08);
  --accent-glow: rgba(79, 110, 247, 0.15);
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.12);
  --error: #ef4444;
  --error-light: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f2f2f5;
  --bg-elevated: #ffffff;
  --code-bg: #f2f2f5;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #aeaeb2;
  --border: #d2d2d7;
  --border-light: #e5e5ea;
  --btn-bg: rgba(0, 0, 0, 0.04);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0a0a14;
  --bg-secondary: #14141f;
  --bg-card: #1a1a2b;
  --bg-hover: #222238;
  --bg-elevated: #1e1e32;
  --code-bg: #0d0d18;
  --text-primary: #f1f1f6;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c80;
  --border: #2a2a3e;
  --border-light: #222235;
  --btn-bg: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.35);
  --accent-light: rgba(79, 110, 247, 0.1);
  --accent-glow: rgba(79, 110, 247, 0.25);
}

/* ---- 基础重置 ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition-base), color var(--transition-base);
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: #fff; }

/* ---- 排版 ---- */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
h3 { font-size: 17px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

/* ---- 布局 ---- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 247, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: background var(--transition-base), border-color var(--transition-base);
}
[data-theme="dark"] .header { background: rgba(10, 10, 20, 0.85); }
.header-fixed { top: 0; left: 0; width: 100%; }
.header h1 { font-size: 18px; font-weight: 600; }
.header-content { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex: 1; gap: 16px; }
.flex-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flex-row > span:not(.hide) { display: flex; align-items: center; gap: 8px; }
.user-menu { border: none; outline: none; }
.fw-normal { font-weight: 400; }
.container { max-width: 1200px; margin: 0 auto; padding: 30px 24px 40px; }
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ---- 侧边栏 ---- */
.sidebar {
  position: fixed; left: 0; top: 60px; width: 220px; height: calc(100vh - 60px);
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  padding: 16px 0; overflow-y: auto; z-index: 99;
}
.sidebar a, .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: var(--text-secondary); text-decoration: none; border-left: 3px solid transparent;
  font-size: 14px; font-weight: 500; transition: all var(--transition-fast);
}
.sidebar a:hover, .nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar a.active, .nav-link.active { background: var(--accent-light); border-left-color: var(--accent); color: var(--accent); }
.admin-main { margin-left: 220px; padding: 24px 32px; min-height: calc(100vh - 60px); }
.section { display: none; scroll-margin-top: 100px; }
.section.active { display: block; animation: fadeIn 0.25s ease; }

/* ---- 页脚 ---- */
.footer { text-align: center; padding: 20px 24px; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 48px; }

/* ---- 卡片 ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2 { color: var(--accent); margin-bottom: 20px; font-size: 18px; }
.card-mb { margin-bottom: 20px; }
.hide { display: none !important; }

/* ---- Toast ---- */
#toast-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  border-radius: var(--radius-lg); font-size: 14px; font-weight: 500;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg); transform: scale(0.9); opacity: 0;
  transition: all var(--transition-slow); pointer-events: auto; max-width: 420px;
}
.toast.toast-show { transform: scale(1); opacity: 1; }
.toast.toast-out { transform: scale(0.9); opacity: 0; }
.toast.toast-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.toast.toast-error { background: var(--error-light); color: var(--error); border: 1px solid rgba(239,68,68,0.25); }
.toast.toast-info { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(79,110,247,0.25); }
.toast-icon { font-size: 16px; font-weight: 700; flex-shrink: 0; }
.toast-text { flex: 1; }

/* ---- Confirm Dialog ---- */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); z-index: 99999; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.25s;
}
.confirm-overlay.confirm-show { opacity: 1; }
.confirm-dialog {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 24px; max-width: 400px; width: 90%; box-shadow: var(--shadow-xl);
  transform: scale(0.9); transition: transform 0.25s;
}
.confirm-overlay.confirm-show .confirm-dialog { transform: scale(1); }
.confirm-danger { border-color: rgba(239,68,68,0.35); }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.confirm-danger .confirm-title { color: var(--error); }
.confirm-message { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-danger { background: var(--error) !important; color: #fff !important; }
.btn-danger:hover { opacity: 0.9; }

/* ---- 按钮系统 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-md); cursor: pointer; font-size: 13px; font-weight: 600;
  font-family: var(--font-sans); transition: all var(--transition-fast);
  text-decoration: none; line-height: 1.4; user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn:active { transform: translateY(0); }
.btn-sec { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-sec:hover { background: var(--bg-hover); transform: none; box-shadow: none; }
.btn-err { background: var(--error); }
.btn-err:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); transform: none; box-shadow: none; }
.btn-hdr {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: var(--btn-bg); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-weight: 500; cursor: pointer; font-size: 13px;
  font-family: var(--font-sans); text-decoration: none; transition: all var(--transition-fast); line-height: 1.4;
}
.btn-hdr:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.oauth-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: var(--btn-bg); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-weight: 500; cursor: pointer;
  transition: all var(--transition-fast); font-size: 13px; text-decoration: none; line-height: 1.4;
}
.oauth-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.oauth-btn.dark { background: #1a1a2e; color: #eaeaea; border-color: #333; }
.oauth-btn.dark:hover { background: #222; border-color: var(--accent); }

/* 工具页按钮 */
.bt-green, .bt-blue, .bt-grey, .bt-copy {
  display: inline-flex; align-items: center; justify-content: center; padding: 7px 18px;
  font-size: 13px; font-weight: 600; border: none; border-radius: var(--radius-md);
  cursor: pointer; font-family: var(--font-sans); transition: all var(--transition-fast);
  line-height: 1.5; margin: 3px; outline: none;
}
.bt-green { background: var(--success); color: #fff; }
.bt-green:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(34,197,94,0.3); }
.bt-blue { background: var(--accent); color: #fff; }
.bt-blue:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.bt-grey { background: var(--btn-bg); color: var(--text-secondary); border: 1px solid var(--border); }
.bt-grey:hover { background: var(--bg-hover); color: var(--text-primary); }
.bt-copy { background: var(--accent); color: #fff; }
.bt-copy:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.btn-primary { background: var(--success); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary { background: var(--accent); color: #fff; }
.btn-secondary:hover { opacity: 0.9; }

/* ---- 表格 ---- */
.table, .logs-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.table th, .table td, .logs-table th, .logs-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th, .logs-table th { background: var(--bg-hover); font-weight: 600; color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; }
.table tr:hover, .logs-table tr:hover { background: var(--bg-hover); }
.table tr:last-child td, .logs-table tr:last-child td { border-bottom: none; }

/* ---- 统计网格 ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-box { background: var(--bg-card); padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--border); text-align: center; transition: all var(--transition-fast); }
.stat-box:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-box .num { font-size: 28px; font-weight: 700; color: var(--accent); margin: 8px 0; font-variant-numeric: tabular-nums; }
.stat-box .lbl { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }

/* ---- 消息提示 ---- */
.message { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.message.success { background: var(--success-light); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.message.error { background: var(--error-light); color: var(--error); border: 1px solid rgba(239,68,68,0.2); }

/* ---- 加载状态 ---- */
.loading { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---- 工具类 ---- */
.hdr-email { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); font-size: 14px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-20 { margin-top: 20px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.pad-20 { padding: 20px; }

/* ---- 主题切换 ---- */
.theme-toggle {
  width: 44px; height: 24px; background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; position: relative; transition: background var(--transition-base), border-color var(--transition-base); flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle-slider {
  width: 18px; height: 18px; background: var(--accent); border-radius: 50%;
  position: absolute; top: 2px; left: 2px; transition: transform var(--transition-base);
  display: flex; align-items: center; justify-content: center; font-size: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.2);color: white;
  transform: translateX(20px);
}
[data-theme="dark"] .theme-toggle-slider { transform: none; }
.status-code { display: inline-block; padding: 3px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.status-code.success { background: var(--success-light); color: var(--success); }
.status-code.error { background: var(--error-light); color: var(--error); }

/* ============================================================
   页面: index（首页）
   ============================================================ */
.page-index .logo { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.page-index .logo-icon { width: 30px; height: 30px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; font-weight: 700; }
.page-index .api-key-input {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 10px 16px; color: var(--text-primary); font-size: 14px; width: 360px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none; font-family: var(--font-sans);
}
.page-index .api-key-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.page-index .api-key-input::placeholder { color: var(--text-muted); }
.page-index .status-indicator { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.page-index .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: background var(--transition-base); }
.page-index .status-dot.ready { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* 首页搜索 */
.page-index .tool-search-wrapper { position: relative; max-width: 560px; margin: 0 auto 32px; }
.page-index .tool-search-wrapper .search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 16px; pointer-events: none; opacity: 0.5;
}
.page-index .tool-search-input {
  width: 100%; padding: 14px 18px 14px 46px; font-size: 15px;
  border: 2px solid var(--border); border-radius: var(--radius-xl);
  outline: none; transition: all var(--transition-fast);
  background: var(--bg-card); color: var(--text-primary); font-family: var(--font-sans);
}
.page-index .tool-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.page-index .tool-search-input::placeholder { color: var(--text-muted); }

/* 首页分类标题 */
.page-index .section-title { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; letter-spacing: -0.3px; }
.page-index .section-title-icon { font-size: 22px; }
.page-index .section-title .section-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* 工具网格 */
.page-index .tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 40px; }
.page-index .tool-chip {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 500; color: var(--text-primary); text-decoration: none;
  transition: all var(--transition-fast); box-shadow: var(--shadow-sm);
}
.page-index .tool-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.page-index .tool-chip .tool-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.page-index .tool-chip .tool-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-index .tool-chip.active { border-color: var(--accent); color: #fff; background: var(--accent); }

/* API 网格 */
.page-index .api-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 40px; }
.page-index .api-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all var(--transition-fast);
  position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
}
.page-index .api-card:hover { background: var(--bg-hover); transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.page-index .api-card:active { transform: translateY(-1px); }
.page-index .api-card.active { border-color: var(--accent); background: var(--accent-light); }
.page-index .api-card h4 { color: var(--accent); margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.page-index .api-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* 详情面板 */
.page-index .detail-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 28px; display: none; animation: slideUp 0.3s ease; box-shadow: var(--shadow-md);
}
.page-index .detail-panel.active { display: block; margin-top: 24px; }
.page-index .detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-index .detail-title { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.page-index .detail-actions { display: flex; gap: 10px; }
.page-index .url-display {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 18px; margin-bottom: 20px; font-family: var(--font-mono);
  font-size: 13px; color: var(--accent); word-break: break-all; line-height: 1.5;
}
.page-index .params-section { margin-bottom: 20px; }
.page-index .section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.page-index .params-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.page-index .params-table th, .page-index .params-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.page-index .params-table th { color: var(--text-muted); font-weight: 500; width: 120px; font-size: 13px; }
.page-index .params-table code { background: var(--code-bg); padding: 2px 6px; border-radius: var(--radius-sm); color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.page-index .param-required { color: var(--accent); font-size: 11px; margin-left: 4px; font-weight: 600; }
.page-index .response-section { margin-top: 20px; }
.page-index .response-preview {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px; font-family: var(--font-mono); font-size: 13px; max-height: 400px;
  overflow: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6;
}
.page-index .response-preview.loading { color: var(--text-muted); }
.page-index .response-preview.error { color: var(--error); }
.page-index .response-preview.success { color: var(--success); }

/* ============================================================
   页面: dashboard（用户面板）
   ============================================================ */
.page-dashboard .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.page-dashboard .stat-box { padding: 24px 20px; }
.page-dashboard .stat-box .num { font-size: 32px; }
.page-dashboard .api-key-display { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-dashboard .api-key-val { flex: 1; min-width: 280px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; font-family: var(--font-mono); font-size: 13px; color: var(--accent); word-break: break-all; }
.page-dashboard .header h1,
.page-admin .header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: normal;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-dashboard .header h1 .title-icon,
.page-admin .header h1 .title-icon {
  font-size: 22px;
}

/* ============================================================
   页面: admin（管理后台）
   ============================================================ */
.page-admin .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.page-admin .search-box { width: 100%; padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-primary); font-size: 14px; outline: none; margin-bottom: 16px; box-sizing: border-box; transition: border-color var(--transition-fast); font-family: var(--font-sans); }
.page-admin .search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.page-admin .btn { padding: 8px 16px; font-size: 13px; }

/* ============================================================
   页面: tool（工具页）
   ============================================================ */
.page-tool .logo { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.page-tool .logo-icon { width: 30px; height: 30px; background: var(--accent); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; font-weight: 700; }
.page-tool .api-key-input { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 14px; color: var(--text-primary); font-size: 13px; width: 300px; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); outline: none; font-family: var(--font-sans); }
.page-tool .api-key-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.page-tool .api-key-input::placeholder { color: var(--text-muted); }
.page-tool .status-indicator { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.page-tool .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: background var(--transition-base); }
.page-tool .status-dot.ready { background: var(--success); box-shadow: 0 0 8px var(--success); }
.page-tool .main { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* ============================================================
   工具页容器（data/*.html 共用）
   ============================================================ */
#root { min-height: calc(100vh - 60px); }
#tool_regex, #tool_index { max-width: 1040px; margin: 32px auto; padding: 0 24px; }
#tool_regex h3 { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 24px; letter-spacing: -0.3px; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
#tool_regex h2 { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin: 20px 0 10px; }
#tool_regex h2 a { font-size: 14px; font-weight: 500; }
.tools_left { width: 100%; float: none; }
.fl { float: none; }
#quickref { overflow: hidden; padding: 0; }
#quickref > div { float: none; margin-left: 0 !important; }
.tool-page { max-width: 960px; margin: 40px auto; padding: 0 24px; }
.tool-page-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--accent); letter-spacing: -0.3px; }
.tool-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tool-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: 13px; color: var(--text-primary); text-decoration: none; transition: all var(--transition-fast); white-space: nowrap; font-weight: 500; }
.tool-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); transform: translateY(-1px); }
.tool-chip.active { border-color: var(--accent); color: #fff; background: var(--accent); }
.tool-search-input { width: 100%; max-width: 600px; padding: 12px 18px; font-size: 15px; border: 2px solid var(--border); border-radius: var(--radius-xl); outline: none; transition: all var(--transition-fast); margin-bottom: 24px; background: var(--bg-card); color: var(--text-primary); font-family: var(--font-sans); }
.tool-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.tool-search-input::placeholder { color: var(--text-muted); }

/* 工具页输入框 */
.tooltext, .toolarea { width: 100%; max-width: 720px; padding: 10px 14px; font-size: 14px; color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); background: var(--bg-card); display: block; margin: 8px 0; font-family: var(--font-sans); }
.tooltext { height: 42px; }
.toolarea { min-height: 200px; resize: vertical; font-family: var(--font-mono); line-height: 1.6; }
.tooltext:focus, .toolarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select { padding: 8px 12px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-primary); outline: none; cursor: pointer; margin: 4px 0; transition: border-color var(--transition-fast); font-family: var(--font-sans); }
select:focus { border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { cursor: pointer; margin-right: 6px; accent-color: var(--accent); }
input[type="number"] { padding: 8px 12px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; background: var(--bg-card); color: var(--text-primary); transition: border-color var(--transition-fast); font-family: var(--font-sans); }
input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
code, pre { font-family: var(--font-mono); font-size: 13px; }
pre { background: var(--code-bg); padding: 16px 20px; border-radius: var(--radius-md); overflow-x: auto; border: 1px solid var(--border); line-height: 1.6; color: var(--text-primary); }
code { background: var(--code-bg); padding: 2px 6px; border-radius: var(--radius-sm); color: var(--accent); }
.num { font-size: 20px; font-weight: 700; color: var(--accent); padding: 0 4px; font-variant-numeric: tabular-nums; }
.WStxt { width: 100%; max-width: 720px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 14px; resize: vertical; background: var(--bg-card); color: var(--text-primary); outline: none; transition: border-color var(--transition-fast); }
.WStxt:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* 密码生成器 */
#passwd input[type="checkbox"] { float: right; margin-top: 10px; margin-right: 420px; }
#passwd label { display: block; overflow: hidden; margin: 0; }
#passwd ul { margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); list-style: none; font-size: 14px; overflow: hidden; }
#passwd li { clear: both; overflow: hidden; padding: 0.6em 16px; border-bottom: 1px solid var(--border); }
#passwd li:last-child { border-bottom: none; }
#passwd ul li label span { display: inline-block; width: 100px; font-size: 14px; font-weight: 500; }
#passwd textarea { width: 100%; max-width: 720px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 14px; margin: 12px 0; background: var(--bg-card); color: var(--text-primary); outline: none; transition: border-color var(--transition-fast); }
#passwd textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* 计算器 */
#container * { box-sizing: border-box; }
#container { width: 100%; max-width: 630px; display: block; float: left; margin: 16px 0; }
#the-calculator { font-size: 1.1em; display: block; width: 58%; float: left; margin: 0; padding: 20px; border: 1px solid var(--border); background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); max-width: 360px; }
#the-calculator button { font-size: 1em; display: inline-block; position: relative; padding: 12px; }
#the-calculator #the-display { width: 100%; background: var(--bg-primary); border-radius: var(--radius-md); padding: 12px; margin-bottom: 12px; text-align: right; }
#the-calculator #the-display #total { width: 98%; margin: 0 auto 8px; display: block; border-radius: var(--radius-md); font-size: 28px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); background: var(--bg-card); text-align: right; border: none; padding: 12px; outline: none; }
#the-calculator #the-buttons { width: 100%; }
#the-calculator #the-buttons #extra-buttons { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
#the-calculator #the-buttons .button-row { width: 100%; display: flex; gap: 6px; margin-bottom: 6px; }
#the-calculator #the-buttons .button-row button { flex: 1; padding: 12px 0; font-size: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-primary); cursor: pointer; transition: all var(--transition-fast); font-family: var(--font-sans); }
#the-calculator #the-buttons .button-row button:hover { background: var(--bg-hover); }
#the-calculator #the-buttons .button-row button.calc_op { background: var(--btn-bg); font-weight: 600; }
#the-calculator #the-buttons .button-row button.calc_op:hover { opacity: 0.8; }
#the-calculator #the-buttons #calc_zero { width: 48%; }
#the-calculator #the-buttons #calc_clear { background: var(--error); color: #fff; border-color: var(--error); }
#the-calculator #the-buttons #calc_clear:hover { opacity: 0.9; }
#the-calculator #the-buttons #calc_back { background: var(--bg-hover); color: var(--text-primary); }
#the-calculator #the-buttons #calc_eval { background: var(--success); color: #fff; border-color: var(--success); }
#the-calculator #the-buttons #calc_eval:hover { opacity: 0.9; }
#the-results { width: 40%; float: right; margin: 0; padding: 12px; border: 1px solid var(--border); background: var(--bg-primary); border-radius: var(--radius-lg); box-sizing: border-box; position: relative; }
#the-results #result_clear { position: absolute; right: 8px; top: -35px; width: 50px; height: 30px; text-align: center; line-height: 30px; background: var(--success); color: #fff; font-size: 13px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
#the-results #result_clear:hover { background: var(--error); }
#the-results ul { height: 420px; overflow-y: scroll; list-style: none; padding: 0; margin: 0; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
#the-results ul li#result_default { text-align: center; color: var(--text-muted); font-style: italic; font-size: 0.8em; height: 40px; line-height: 40px; }
#the-results ul li.result { display: flex; align-items: center; font-size: 0.85em; color: var(--text-primary); background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0; min-height: 42px; }
#the-results ul li.result:nth-child(even) { background: var(--bg-hover); }
#the-results ul li.result .equation { flex: 1; padding: 8px 12px; font-style: italic; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#the-results ul li.result .answer { padding: 8px 12px; background: var(--code-bg); color: var(--text-primary); font-weight: 600; white-space: nowrap; border-left: 1px solid var(--border); }
#the-results ul li.result .use a { display: flex; align-items: center; justify-content: center; padding: 0 12px; height: 100%; min-height: 42px; background: var(--accent); color: #fff; text-decoration: none; flex-shrink: 0; }
#the-results ul li.result .use a:hover { opacity: 0.9; }
.exponent { font-size: 0.7em; vertical-align: super; }
.denominator { display: inline-block; text-align: center; }
.denom-top { display: block; border-bottom: 1px solid currentColor; }
.denom-slash { display: none; }
.denom-btm { display: block; }

/* Tab 导航 */
.tab-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; padding: 4px; background: var(--bg-primary); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.tab-btn { padding: 8px 16px; border: none; border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition-fast); font-family: var(--font-sans); white-space: nowrap; }
.tab-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tab-btn.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.2s ease; }

/* KMS 页面 */
.kms-notice { background: var(--code-bg); border-left: 3px solid var(--accent); border-radius: var(--radius-md); padding: 16px 20px; margin: 16px 0 24px; }
.kms-notice ol { padding-left: 20px; }
.kms-notice li { font-size: 14px; line-height: 2; color: var(--text-secondary); }
.kms-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.kms-option { display: inline-flex; align-items: center; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; font-size: 13px; font-weight: 500; transition: all var(--transition-fast); color: var(--text-primary); background: var(--bg-card); }
.kms-option:hover { border-color: var(--accent); background: var(--bg-hover); }
.kms-option input { display: none; }
.kms-option:has(input:checked) { border-color: var(--accent); background: var(--accent); color: #fff; }

/* MSDN 下载页 */
.dl-item { margin-bottom: 16px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
.dl-meta { padding: 10px 16px; background: var(--bg-hover); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; }
.tag-default { background: var(--accent); color: #fff; }
.tag-success { background: var(--success); color: #fff; }
.tag-info { background: var(--code-bg); color: var(--text-muted); }
details { background: var(--bg-card); }
summary { padding: 12px 16px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; transition: color var(--transition-fast); }
summary::-webkit-details-marker { display: none; }
summary::before { content: '▶'; font-size: 10px; transition: transform 0.2s; color: var(--text-muted); }
details[open] summary::before { transform: rotate(90deg); }
summary:hover { color: var(--accent-hover); }
.dl-body { padding: 16px; border-top: 1px solid var(--border); }
.dl-links { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.btn-dl { display: inline-flex; align-items: center; padding: 6px 16px; border-radius: var(--radius-md); color: #fff; font-size: 13px; font-weight: 600; transition: opacity var(--transition-fast), transform var(--transition-fast); text-decoration: none; }
.btn-dl:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }
.btn-ed2k { background: #2d89ef; }
.btn-bt { background: #22c55e; }
.dl-info { background: var(--code-bg); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--text-secondary); line-height: 1.8; white-space: pre-line; font-family: var(--font-mono); }

/* htmljs 页面 */
.mono, textarea.mono { font-family: var(--font-mono); font-size: 13px; }
.arrow-row { text-align: center; padding: 4px 0 2px; }
.arrow-label { font-size: 12px; color: var(--text-muted); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 12px 0 4px; }
.tab-desc { margin: -8px 0 16px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.tab-desc code { background: var(--code-bg); padding: 1px 5px; border-radius: var(--radius-sm); font-size: 12px; }
#tab-h2j, #tab-j2h { display: none; }
#tab-h2j.active, #tab-j2h.active { display: block; }
.tab-pane textarea[readonly] { background: var(--code-bg); color: var(--text-primary); cursor: default; }

/* 表单列表 */
form ul { list-style: none; margin: 16px 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
form ul li { padding: 12px 16px; border-bottom: 1px solid var(--border); overflow: hidden; font-size: 14px; color: var(--text-primary); }
form ul li:last-child { border-bottom: none; }
form ul li label { display: flex; align-items: center; gap: 8px; }

/* 通用表格（工具页） */
table { margin: 0 auto; border-collapse: separate; border-spacing: 0; width: 100%; background-color: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
table td { border-top: 1px solid var(--border); padding: 12px 15px; text-align: left; border-right: 1px solid var(--border); color: var(--text-primary); font-size: 14px; }
table td:last-child { border-right: 0; }

/* QR码 */
#qrcode_url a { color: var(--accent); font-size: 16px; }
#qrcode_url span { font-size: 16px; }
.clearfix::after { content: ''; display: table; clear: both; }

/* 管理后台登录页 */
.page-admin-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg-primary); }
.page-admin-login .login-card { width: 100%; max-width: 420px; }
.page-admin-login .security-notice { background: var(--warning-light); border: 1px solid rgba(245,158,11,0.25); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: var(--warning); line-height: 1.5; }
.page-admin-login .login-inner { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 40px; box-shadow: var(--shadow-lg); }
.page-admin-login .login-header { text-align: center; margin-bottom: 32px; }
.page-admin-login .login-header h1 { font-size: 24px; margin-bottom: 8px; color: var(--accent); }
.page-admin-login .login-header p { color: var(--text-muted); font-size: 14px; }
.page-admin-login .form-group { margin-bottom: 20px; }
.page-admin-login .form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: var(--text-primary); }
.page-admin-login .form-group input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-primary); color: var(--text-primary); font-size: 14px; outline: none; font-family: var(--font-sans); transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.page-admin-login .form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.page-admin-login .login-btn { width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-md); font-weight: 600; cursor: pointer; font-size: 15px; font-family: var(--font-sans); transition: all var(--transition-fast); }
.page-admin-login .login-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.page-admin-login .login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.page-admin-login .login-footer { text-align: center; margin-top: 20px; }
.page-admin-login .login-footer a { color: var(--accent); text-decoration: none; font-size: 14px; }
.page-admin-login .login-footer a:hover { color: var(--accent-hover); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .btn-label { display: none; }
  .header { padding: 0 16px; height: 56px; }
  .page-index .header-content { flex-direction: column; align-items: center; gap: 12px; }
  .page-index .api-key-input { width: 100%; }
  .page-index .section-title { flex-wrap: wrap; }
  .page-index .section-title .section-controls { width: 100%; }
  .page-index .main { padding: 16px; }
  .page-index .tool-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
  .page-index .tool-chip { padding: 10px 14px; font-size: 13px; }
  .page-index .api-grid { grid-template-columns: 1fr; }
  .page-index .detail-panel { padding: 20px; }
  .page-index .detail-header { flex-direction: column; }
  .page-index .detail-actions { width: 100%; }
  .page-index .btn { flex: 1; justify-content: center; }
  .page-tool .header-content { flex-direction: column; align-items: center; gap: 12px; }
  .page-tool .api-key-input { width: 100%; }
  .page-tool .header-controls { width: 100%; justify-content: space-between; }
  .page-tool .main { padding: 16px; }
  .page-dashboard .stats-grid { grid-template-columns: 1fr; }
  .page-dashboard .api-key-display { flex-wrap: wrap; justify-content: center; }
  .page-dashboard .api-key-val { width: 100%; }
  .page-dashboard header { flex-direction: column; gap: 15px; }
  .page-admin header { flex-direction: column; gap: 15px; }
  .page-admin .sidebar { display: none; }
  .page-admin .admin-main { margin-left: 0; }
  .page-2index .api-key-input { width: 100%; box-sizing: border-box; }
  #tool_regex, #tool_index, .tool-page { margin: 20px auto; padding: 0 16px; }
  #tool_regex h3, .tool-page-title { font-size: 20px; }
  .tooltext, .toolarea, .WStxt { max-width: 100%; }
  .bt-green, .bt-blue, .bt-grey, .bt-copy { padding: 6px 14px; font-size: 13px; }
  #the-calculator { max-width: 100%; }
  #the-calculator #the-buttons button { font-size: 14px; padding: 10px 0; }
  #the-calculator #the-display #total { font-size: 22px; }
  h1 { font-size: 1.5em; }
  table td { padding: 8px; }
  .tool-chip { padding: 8px 12px; font-size: 13px; }
}