/* ===== 全局设计系统 v3 ===== */
:root {
  --bg: #0a0f1e;
  --bg-elevated: #131a2e;
  --bg-surface: #1a2240;
  --card: rgba(26, 34, 64, 0.8);
  --card-hover: rgba(26, 34, 64, 1);
  --line: rgba(99, 117, 171, 0.12);
  --line-strong: rgba(99, 117, 171, 0.22);
  --text: #eef2ff;
  --text-strong: #ffffff;
  --muted: #8b9cc7;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent: #06b6d4;
  --accent-soft: rgba(6, 182, 212, 0.12);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.12);
  --shadow: 0 4px 12px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.25), 0 4px 8px rgba(0,0,0,0.15);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --max: 1320px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --anim: cubic-bezier(0.4, 0, 0.2, 1);
  --anim-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(6, 182, 212, 0.05), transparent);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--primary); color: #fff; }

/* ===== 通用组件 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 22px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; border: 1px solid transparent;
  cursor: pointer; transition: all 0.2s var(--anim);
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
  pointer-events: none;
}
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: rgba(255,255,255,0.06); border-color: var(--muted); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-danger { background: var(--danger-soft); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-success { background: var(--success-soft); color: #34d399; border-color: rgba(16, 185, 129, 0.2); }
.btn-success:hover { background: rgba(16, 185, 129, 0.2); }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.pill-green { background: var(--success-soft); color: #34d399; }
.pill-blue { background: var(--primary-soft); color: #818cf8; }
.pill-yellow { background: var(--warning-soft); color: #fbbf24; }
.pill-red { background: var(--danger-soft); color: #f87171; }
.pill-gray { background: rgba(139, 156, 199, 0.1); color: var(--muted); }
.pill-cyan { background: var(--accent-soft); color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: all 0.2s var(--anim);
}
.card:hover { border-color: var(--line-strong); }

.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}
.brand-meta { display: flex; flex-direction: column; }
.brand-meta span { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--text-strong); }
.brand-meta small { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links a.active { color: var(--text-strong); background: var(--primary-soft); }

/* ===== 首页 ===== */
.page-shell { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

.hero {
  padding: 48px 0 32px;
  display: grid; gap: 24px;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: stretch;
}
.hero-copy {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 44px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.hero-copy::before {
  content: ''; position: absolute; top: -50%; right: -30%;
  width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.08), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  display: inline-flex; padding: 6px 14px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--primary-soft); color: var(--primary-light);
  margin-bottom: 20px; width: fit-content;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.hero-copy h1 {
  font-size: clamp(28px, 4vw, 44px); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-strong), var(--muted));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-copy p { font-size: 16px; color: var(--muted); line-height: 1.7; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px;
  display: flex; flex-direction: column; gap: 20px;
}
.status-row { display: flex; align-items: center; justify-content: space-between; }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--success-soft); color: #34d399;
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
.metric {
  padding: 18px; border-radius: var(--radius);
  background: rgba(255,255,255,0.02); border: 1px solid var(--line);
  transition: all 0.2s var(--anim);
}
.metric:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.04); }
.metric .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.metric .value { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }

.section { padding: 24px 0 40px; }
.section h2 { font-size: clamp(20px, 3vw, 28px); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; color: var(--text-strong); }
.section .lead { color: var(--muted); font-size: 15px; margin-bottom: 20px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; color: var(--text-strong); }
.card p, .card li { color: var(--muted); font-size: 14px; line-height: 1.7; }
.card ul { padding-left: 16px; }
.card { padding: 24px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dash-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  transition: all 0.25s var(--anim);
  position: relative; overflow: hidden;
}
.dash-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0; transition: opacity 0.25s;
}
.dash-card:hover {
  border-color: var(--primary-glow);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.dash-card:hover::before { opacity: 1; }
.dash-card .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.dash-card .value { font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -0.02em; color: var(--text-strong); }

.quick-links { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  background: var(--bg-surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: all 0.2s var(--anim);
}
.quick-links a:hover {
  color: var(--text); border-color: var(--primary);
  background: var(--primary-soft); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.footer { padding: 32px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== 表格 ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px; text-align: left; font-size: 11px;
  font-weight: 700; color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase; border-bottom: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.2);
}
.data-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.data-table tr { transition: background 0.15s; }
.data-table tr:hover td { background: rgba(99, 102, 241, 0.04); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }

.action-btn {
  padding: 5px 12px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: rgba(255,255,255,0.03);
  color: var(--muted); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  margin-right: 4px;
}
.action-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); border-color: var(--line-strong); }
.action-btn.primary { background: var(--primary-soft); color: var(--primary-light); border-color: rgba(99, 102, 241, 0.2); }
.action-btn.primary:hover { background: rgba(99, 102, 241, 0.2); }
.btn-link {
  background: none; border: none; padding: 4px 8px; font-size: 13px;
  color: var(--primary-light); cursor: pointer; font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

.table-card { overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.search-box input, .filter-bar input, .filter-bar select {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 9px 14px; font-size: 14px; outline: none;
  transition: all 0.2s;
}
.search-box input { width: 260px; }
.search-box input:focus, .filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar select { min-width: 120px; }
.empty-state {
  padding: 56px; text-align: center; color: var(--muted); font-size: 14px;
  border-radius: var(--radius); background: rgba(255,255,255,0.015);
  border: 1px dashed var(--line);
}
.empty-state::before { content: '📭'; display: block; font-size: 32px; margin-bottom: 12px; }
.loading-text { color: var(--muted); font-size: 14px; }

/* ===== 弹窗样式 ===== */
.modal { position: fixed; inset: 0; z-index: 200; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.6); backdrop-filter:blur(6px); }
.modal.hidden { display: none !important; }
.modal-content {
  background: var(--bg-elevated); border-radius: var(--radius-lg);
  width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.25s ease; overflow: hidden;
}
@keyframes modalIn { from { transform: scale(0.95) translateY(20px); opacity:0; } to { transform: scale(1) translateY(0); opacity:1; } }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px);
}
.modal-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated); border-top: 1px solid var(--line-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s var(--anim-spring);
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-handle {
  width: 36px; height: 4px; border-radius: 99px;
  background: rgba(255,255,255,0.15); margin: 12px auto 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--text-strong); }
.modal-close, .close-btn {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 6px 10px;
  border-radius: var(--radius-xs); transition: all 0.15s;
}
.modal-close:hover, .close-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 28px;
  display: flex; gap: 12px; justify-content: flex-end; border-top: 1px solid var(--line);
}
.modal-body label {
  display: block; font-size: 13px; font-weight: 600; color: var(--muted);
  margin-bottom: 6px;
}
.modal-body .input, .modal-content .input {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.modal-body .input:focus, .modal-content .input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.modal-body .input::placeholder { color: var(--muted); opacity: 0.6; }

/* ===== 表单 ===== */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.form-grid.single { grid-template-columns: 1fr; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: all 0.2s;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: all 0.2s; color-scheme: dark;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ===== 分页 ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 18px 0;
}
.pagination button {
  padding: 7px 13px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: var(--bg-surface);
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: all 0.15s; font-weight: 500;
}
.pagination button:hover:not(:disabled) {
  color: var(--text); border-color: var(--primary); background: var(--primary-soft);
}
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination button.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.pagination .page-info { font-size: 13px; color: var(--muted); }

/* ===== 图表容器 ===== */
.chart-container {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: 16px;
}
.chart-container h4 {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  color: var(--text-strong);
}
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero-copy { padding: 28px; }
  .hero-copy h1 { font-size: 28px; }
  .topbar-inner { height: 56px; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box input { width: 180px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .nav-links a { padding: 6px 10px; font-size: 13px; }
  .topbar-inner { padding: 0 12px; }
}

/* ===== Toast 通知 ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 14px 22px; border-radius: var(--radius-sm);
  background: var(--bg-surface); border: 1px solid var(--line);
  color: var(--text); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toastIn 0.3s var(--anim-spring), toastOut 0.3s var(--anim) 2.7s forwards;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ===== Loading Skeleton ===== */
.skeleton { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Enhanced Table ===== */
.data-table tbody tr { transition: background 0.15s, transform 0.1s; }
.data-table tbody tr:hover { background: rgba(99, 102, 241, 0.06); }
.data-table tbody tr:active { transform: scale(0.998); }

/* ===== Card Entrance Animation ===== */
.card { animation: cardIn 0.3s var(--anim) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Status Dot ===== */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--danger); }
.status-dot.warning { background: var(--warning); }

/* ===== Empty State Enhancement ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); font-size: 14px; }
.empty-state::before { content: '📭'; display: block; font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

/* ===== Better Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 117, 171, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 117, 171, 0.35); }

/* ===== Stat Number Animation ===== */
.stat-number { font-variant-numeric: tabular-nums; transition: color 0.3s; }

/* ===== Responsive Admin (see pages.css for full responsive) ===== */

/* ===== Ticker Scroll ===== */
@keyframes tickerScroll { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

/* ===== Clock Success Animation ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
