/* ============================================================
   CFDNS Manager Pro — Modern Design System
   ============================================================ */
:root {
  /* 中性色（zinc 系） */
  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f4f4f5;
  --bg-subtle: #fafafa;
  --border: #e6e7ea;
  --border-light: #d8dade;
  --text: #101014;
  --text-secondary: #55585f;
  --text-muted: #9b9ea6;

  /* 品牌色（indigo） */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #6366f1;
  --primary-glow: rgba(79, 70, 229, 0.12);
  --primary-soft: rgba(79, 70, 229, 0.08);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.09);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.09);
  --info: #0891b2;

  /* 深色侧边栏 */
  --sidebar-bg: #0e1014;
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --sidebar-text: #8b8f98;
  --sidebar-text-active: #c7d2fe;
  --sidebar-hover: rgba(255, 255, 255, 0.06);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px -4px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px -6px rgba(16, 24, 40, 0.12), 0 32px 72px -16px rgba(16, 24, 40, 0.16);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(79, 70, 229, 0.18); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; background-clip: content-box; border: 2px solid transparent; }

.hidden { display: none !important; }
.mt-3 { margin-top: 20px; }
.mono { font-family: 'SF Mono', 'JetBrains Mono', Monaco, Consolas, monospace; font-size: 12px; }

/* ==================== 登录页 ==================== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0e1014;
  position: relative; overflow: hidden;
}
.login-page::before, .login-page::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(100px); pointer-events: none;
}
.login-page::before {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, transparent 70%);
  top: -160px; right: -120px; animation: float1 10s ease-in-out infinite alternate;
}
.login-page::after {
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.20) 0%, transparent 70%);
  bottom: -140px; left: -100px; animation: float2 12s ease-in-out infinite alternate;
}
@keyframes float1 { from { transform: translate(0, 0); } to { transform: translate(-30px, 30px); } }
@keyframes float2 { from { transform: translate(0, 0); } to { transform: translate(30px, -20px); } }

.login-glass {
  background: rgba(20, 22, 28, 0.72); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 20px;
  padding: 44px; width: 100%; max-width: 400px; position: relative; z-index: 1;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  animation: glassIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes glassIn { from { opacity: 0; transform: scale(0.96) translateY(16px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 60px; height: 60px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
  animation: logoPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}
@keyframes logoPop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }

.login-brand h1 { font-size: 21px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.4px; color: #fafafa; }
.login-brand p { color: #8b8f98; font-size: 13px; }
.login-error { color: #f87171; text-align: center; margin-top: 14px; font-size: 13px; min-height: 18px; }

.login-options { display: flex; justify-content: flex-start; margin-bottom: 18px; }
.login-options .checkbox-label { font-size: 12px; color: #8b8f98; }
.login-options .checkbox-label:hover { color: #c4c7cd; }

/* 登录页 Input（深色） */
.login-glass .input-wrap label { color: #9b9ea6; }
.login-glass .input-wrap input {
  background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); color: #fafafa;
}
.login-glass .input-wrap input::placeholder { color: #5f636b; }
.login-glass .input-wrap input:focus {
  border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

/* Input（通用浅色） */
.input-wrap { margin-bottom: 18px; }
.input-wrap label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.input-wrap input {
  width: 100%; padding: 11px 14px; background: #fff;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; transition: var(--transition); outline: none;
  box-shadow: var(--shadow-xs);
}
.input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }

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

/* 侧边栏（深色） */
.sidebar {
  width: 248px; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; position: fixed; height: 100vh; left: 0; top: 0; z-index: 50;
}
.sidebar-brand {
  padding: 20px 22px; display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-icon {
  width: 34px; height: 34px; border-radius: 10px; font-size: 17px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.brand-text {
  font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: #fafafa;
}
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); background-clip: content-box; border: 2px solid transparent; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-radius: 9px; transition: var(--transition); cursor: pointer; border: none; background: none; width: 100%; position: relative;
}
.nav-item::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; background: var(--primary-light); border-radius: 0 4px 4px 0;
  transition: height 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item:hover { background: var(--sidebar-hover); color: #e4e5e9; }
.nav-item.active { background: rgba(99, 102, 241, 0.15); color: var(--sidebar-text-active); font-weight: 600; }
.nav-item.active::before { height: 18px; box-shadow: 0 0 12px rgba(99, 102, 241, 0.8); }
.nav-icon { font-size: 15px; width: 22px; text-align: center; transition: transform 0.2s; }
.nav-item:hover .nav-icon { transform: scale(1.12); }

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--sidebar-border); display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}
.user-name { font-size: 13px; font-weight: 700; color: #e4e5e9; }
.user-role { font-size: 11px; color: #6b6f78; }
.sidebar-footer .btn-ghost { color: #8b8f98; border-color: rgba(255, 255, 255, 0.1); background: transparent; box-shadow: none; }
.sidebar-footer .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fafafa; border-color: rgba(255, 255, 255, 0.16); }

/* 主内容 */
.main-content {
  flex: 1; margin-left: 248px; padding: 0 32px 40px;
  max-width: calc(100vw - 248px); min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 -32px 26px; padding: 18px 32px;
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 247, 249, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: baseline; }
.topbar-left h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; }
.page-sub { color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; position: relative; }
.status-dot.online { background: var(--success); box-shadow: 0 0 10px rgba(22, 163, 74, 0.45); }
.status-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid var(--success); opacity: 0.4; animation: pulseRing 2s infinite;
}
@keyframes pulseRing { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.7); opacity: 0; } }

/* 页面 */
.page { display: none; animation: pageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== 统计卡片 ==================== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 15px;
  transition: transform 0.25s, box-shadow 0.25s; position: relative; overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; font-size: 21px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-value { font-size: 27px; font-weight: 800; line-height: 1.1; margin-bottom: 3px; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-secondary); font-size: 12.5px; font-weight: 500; }

.gradient-1 .stat-icon { background: rgba(79, 70, 229, 0.10); }
.gradient-1 .stat-value { color: var(--primary); }
.gradient-2 .stat-icon { background: rgba(22, 163, 74, 0.10); }
.gradient-2 .stat-value { color: var(--success); }
.gradient-3 .stat-icon { background: rgba(217, 119, 6, 0.10); }
.gradient-3 .stat-value { color: var(--warning); }
.gradient-4 .stat-icon { background: rgba(219, 39, 119, 0.09); }
.gradient-4 .stat-value { color: #db2777; }

/* ==================== 卡片 ==================== */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow 0.25s; box-shadow: var(--shadow-xs);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.1px;
}
.card-body { padding: 22px; }

/* ==================== 工具栏 ==================== */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.search-box { position: relative; }
.search-box input {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 14px 9px 36px; color: var(--text); width: 250px; font-size: 13px;
  transition: var(--transition); box-shadow: var(--shadow-xs); outline: none;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: 0.45; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: var(--text);
  border: 1px solid var(--border-light); padding: 8px 15px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 600; transition: var(--transition);
  white-space: nowrap; position: relative; overflow: hidden;
  box-shadow: var(--shadow-xs); font-family: inherit;
}
.btn:hover { background: var(--bg-hover); border-color: #c3c5cb; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--primary); border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 4px 14px -2px rgba(79, 70, 229, 0.4);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 4px rgba(16, 24, 40, 0.12), 0 8px 20px -4px rgba(79, 70, 229, 0.5); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 4px 14px -2px rgba(220, 38, 38, 0.35); }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 2px 4px rgba(16, 24, 40, 0.12), 0 8px 20px -4px rgba(220, 38, 38, 0.45); }
.btn-warning { background: var(--warning); border-color: transparent; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 4px 14px -2px rgba(217, 119, 6, 0.35); }
.btn-warning:hover { background: #b45309; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); box-shadow: none; }
.btn-icon { padding: 7px 9px; }
.btn-block { width: 100%; }
.btn-glow { box-shadow: 0 4px 24px rgba(79, 70, 229, 0.35); }
.btn-small { padding: 5px 11px; font-size: 12px; border-radius: 8px; font-weight: 600; }

.btn-loader {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 13px; background: #fff;
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; transition: var(--transition); font-family: inherit; outline: none;
  box-shadow: var(--shadow-xs);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b9ea6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group small { color: var(--text-muted); font-size: 11px; display: block; margin-top: 4px; }
.form-group code { background: var(--primary-soft); padding: 1px 6px; border-radius: 5px; font-size: 12px; color: var(--primary); }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-size: 13px; }
.checkbox-label input { width: auto; accent-color: var(--primary); }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 12px 18px; text-align: left; }
.data-table th {
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.7px; white-space: nowrap;
  border-bottom: 1px solid var(--border); background: var(--bg-subtle);
}
.data-table td { color: var(--text); vertical-align: middle; border-bottom: 1px solid var(--border); }
.data-table tbody tr { transition: background 0.15s; animation: rowIn 0.3s ease both; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-soft); }
.data-table td .mono { color: var(--text-secondary); }
.data-table input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

@keyframes rowIn { from { opacity: 0; } to { opacity: 1; } }

/* 空状态 */
.empty-state { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 38px; margin-bottom: 12px; opacity: 0.4; filter: grayscale(0.3); }
.empty-state p { font-size: 13px; }

/* ==================== 分页 ==================== */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 14px; border-top: 1px solid var(--border);
}
.pagination button {
  min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-secondary); cursor: pointer; font-size: 12.5px; font-weight: 500;
  transition: var(--transition); font-family: inherit; font-variant-numeric: tabular-nums;
}
.pagination button:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.pagination button.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35); font-weight: 700; }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .page-info { color: var(--text-muted); font-size: 12px; margin: 0 10px; }

/* ==================== Zone卡片（旧版保留） ==================== */
.zones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.zone-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.zone-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-light); }
.zone-card h4 { color: var(--primary); font-size: 16px; margin-bottom: 12px; word-break: break-all; font-weight: 700; }
.zone-card .meta { color: var(--text-secondary); font-size: 12px; margin-bottom: 6px; display: flex; gap: 6px; }
.zone-card .meta .label { color: var(--text-muted); min-width: 50px; }
.zone-status {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600; margin-top: 12px; text-transform: capitalize; letter-spacing: 0.2px;
}
.zone-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { background: var(--success-soft); color: #15803d; }
.status-pending { background: var(--warning-soft); color: #b45309; }
.status-inactive { background: var(--danger-soft); color: #b91c1c; }

/* 域名表格 */
.zones-summary {
  padding: 10px 16px; margin-bottom: 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 12.5px; box-shadow: var(--shadow-xs);
}
.zones-summary .cache-hint { color: var(--text-muted); }
.zone-row { cursor: pointer; }
.zone-row .zone-status { margin-top: 0; }

/* SSL/TLS 设置 */
.ssl-settings { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 10px; }
.ssl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 15px; transition: var(--transition);
}
.ssl-row:hover { border-color: var(--border-light); }
.ssl-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.ssl-value { font-size: 13px; font-weight: 600; }
.form-select-sm { width: auto; min-width: 180px; padding: 7px 32px 7px 11px; font-size: 12.5px; box-shadow: none; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #d8dade; border-radius: 22px; transition: 0.2s; }
.switch .slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(16px); }

/* ==================== 弹窗 ==================== */
.modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(16, 17, 20, 0.5); z-index: 100; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity 0.22s ease;
}
.modal.active { display: flex; opacity: 1; }
.modal-content {
  background: var(--bg-card); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 18px;
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); transform: scale(0.97) translateY(10px); transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.active .modal-content { transform: scale(1) translateY(0); }
.modal-lg { max-width: 960px; }
.modal-sm { max-width: 380px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 2;
  border-radius: 18px 18px 0 0;
}
.modal-header h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -0.2px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; line-height: 1; transition: var(--transition); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.modal-close:hover { color: var(--text); background: var(--bg-hover); }
.modal-body { padding: 20px 22px; }
.modal-desc { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 16px; }
.modal form { padding: 20px 22px; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; padding: 15px 22px;
  border-top: 1px solid var(--border); position: sticky; bottom: 0;
  background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 2;
  border-radius: 0 0 18px 18px;
}

/* Zone详情 */
.zone-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 20px 22px; }
.zone-meta-item { background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 13px 15px; border: 1px solid var(--border); transition: var(--transition); }
.zone-meta-item:hover { border-color: var(--border-light); }
.zone-meta-item .label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 5px; font-weight: 600; }
.zone-meta-item .value { font-size: 13px; color: var(--text); word-break: break-all; font-weight: 500; }
.section-title {
  font-size: 11.5px; font-weight: 700; padding: 0 22px 13px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.9px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ==================== 批量解析布局 ==================== */
.batch-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
.batch-left .card { position: sticky; top: 90px; }

/* ==================== Alert & Loading ==================== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; border: 1px solid transparent; font-weight: 500; }
.alert-error { background: var(--danger-soft); border-color: rgba(220, 38, 38, 0.18); color: #991b1b; }
.loading { text-align: center; padding: 48px; color: var(--text-secondary); font-size: 14px; }

/* 全局 loading */
.global-loading {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(246, 247, 249, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.25s;
}
.global-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 38px; height: 38px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.global-loading p { color: var(--text-secondary); font-size: 13.5px; font-weight: 500; }

/* ==================== Toast ==================== */
.toast {
  position: fixed; bottom: 26px; right: 26px; padding: 13px 18px; border-radius: 12px;
  background: #18181b; color: #fafafa; font-size: 13px; display: none; z-index: 200;
  box-shadow: var(--shadow-lg); font-weight: 500; border: 1px solid rgba(255, 255, 255, 0.09);
  max-width: 380px; line-height: 1.5; align-items: center; gap: 9px;
}
.toast::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.toast.error::before { background: #f87171; box-shadow: 0 0 8px rgba(248, 113, 113, 0.7); }
.toast.show { display: flex; animation: toastSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes toastSlide { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ==================== 标签 ==================== */
.proxy-badge { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 11px; font-weight: 600; background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(79, 70, 229, 0.14); }
.proxy-socks5 { background: rgba(124, 58, 237, 0.08); color: #7c3aed; border-color: rgba(124, 58, 237, 0.14); }
.proxy-socks4 { background: var(--warning-soft); color: #b45309; border-color: rgba(217, 119, 6, 0.14); }
.proxy-http { background: var(--success-soft); color: #15803d; border-color: rgba(22, 163, 74, 0.14); }
.proxy-https { background: rgba(8, 145, 178, 0.08); color: #0e7490; border-color: rgba(8, 145, 178, 0.14); }
.proxy-custom { background: rgba(219, 39, 119, 0.08); color: #be185d; border-color: rgba(219, 39, 119, 0.14); }

.batch-tabs { display: flex; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--border); position: relative; }
.batch-tab {
  background: transparent; border: none; color: var(--text-secondary); padding: 10px 18px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; transition: var(--transition);
  position: relative; margin-bottom: -1px; border-bottom: 2px solid transparent; font-family: inherit;
}
.batch-tab:hover { color: var(--text); }
.batch-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.batch-panel { display: none; }
.batch-panel.active { display: block; animation: pageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

.badge-type {
  display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 11px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary); text-transform: uppercase;
  letter-spacing: 0.5px; border: 1px solid rgba(79, 70, 229, 0.14); font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ==================== 结果列表 ==================== */
.result-list { max-height: 300px; overflow-y: auto; }
.result-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.result-item:last-child { border-bottom: none; }
.result-ok { color: var(--success); font-weight: 700; }
.result-fail { color: var(--danger); font-weight: 700; }

/* ==================== 骨架屏 ==================== */
.skeleton { background: linear-gradient(90deg, #f1f1f3 25%, #e7e7ea 50%, #f1f1f3 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; border-radius: 6px; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==================== 设置页 ==================== */
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .form-input { flex: 1; }
.copy-row .btn { flex-shrink: 0; }
.code-block {
  background: #0e1014; color: #d4d4d8; border-radius: var(--radius-sm);
  padding: 16px 18px; font-family: 'SF Mono', 'JetBrains Mono', Monaco, Consolas, monospace;
  font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tool-chip {
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; transition: var(--transition);
}
.tool-chip:hover { border-color: var(--border-light); box-shadow: var(--shadow-xs); }
.tool-chip .tool-name { color: var(--primary); font-weight: 700; display: block; margin-bottom: 3px; }
.tool-chip .tool-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .batch-layout { grid-template-columns: 1fr; }
  .batch-left .card { position: static; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .main-content { margin-left: 0; max-width: 100vw; padding: 0 16px 32px; }
  .topbar { margin: 0 -16px 20px; padding: 14px 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { margin-left: 0; }
  .search-box input { width: 100%; }
  .zone-meta-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .modal-content { max-width: 95vw; }
}
