/* ========== Login Gate ========== */
.login-gate {
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; background: #0f172a;
}
.login-box {
  text-align: center; background: #1e293b; border: 1px solid #334155;
  border-radius: 16px; padding: 48px 40px; width: 360px;
}
.login-box h2 { color: #f1f5f9; font-size: 22px; margin-bottom: 8px; }
.login-box p { color: #64748b; font-size: 14px; margin-bottom: 20px; }
.login-box input {
  width: 100%; background: #0f172a; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 8px; padding: 12px 16px; font-size: 15px; outline: none;
  margin-bottom: 12px;
}
.login-box input:focus { border-color: #3b82f6; }
.login-box button {
  width: 100%; padding: 12px; background: #3b82f6; color: #fff; border: none;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { background: #2563eb; }

/* ========== Dashboard CSS ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0f172a; color: #e2e8f0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Header */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0 24px; border-bottom: 1px solid #1e293b;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 22px; font-weight: 700; color: #f1f5f9; }
.badge {
  background: #1e293b; color: #94a3b8; font-size: 13px; font-weight: 500;
  padding: 4px 12px; border-radius: 20px;
}

.btn {
  padding: 8px 20px; border-radius: 8px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 6px; }
.btn-outline { background: transparent; border: 1px solid #334155; color: #94a3b8; }
.btn-outline:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-success { background: #22c55e; color: #fff; }

/* Stats Bar */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 20px 0;
}
.stat-item {
  background: #1e293b; border-radius: 12px; padding: 16px 20px;
  text-align: center; border: 1px solid #334155;
}
.stat-value { display: block; font-size: 28px; font-weight: 700; color: #f1f5f9; }
.stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }

/* Filters */
.filters {
  display: flex; gap: 10px; padding: 12px 0 20px;
}
.filters select {
  background: #1e293b; color: #94a3b8; border: 1px solid #334155;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  cursor: pointer; outline: none;
}
.filters select:focus { border-color: #3b82f6; }

/* Page Cards */
.page-list { display: flex; flex-direction: column; gap: 10px; }

.page-card {
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  padding: 18px 20px; cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
}
.page-card:hover { border-color: #3b82f6; transform: translateY(-1px); }

.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-name { font-size: 16px; font-weight: 600; color: #f1f5f9; }
.card-id { font-size: 12px; color: #64748b; font-family: monospace; }

.card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
/* Tabs */
.tabs {
  display: flex; gap: 4px; padding: 16px 0 0;
  border-bottom: 1px solid #1e293b;
}
.tab {
  padding: 10px 20px; background: none; border: none;
  color: #64748b; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab.active { color: #f1f5f9; border-bottom-color: #3b82f6; }
.tab:hover { color: #94a3b8; }

/* Links Tab */
.links-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0;
}
.links-desc { font-size: 13px; color: #64748b; max-width: 500px; }
.link-list { display: flex; flex-direction: column; gap: 10px; }

.link-card {
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  padding: 18px 20px; cursor: pointer; transition: border-color 0.2s;
}
.link-card:hover { border-color: #3b82f6; }
.link-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.link-card-id { font-size: 18px; font-weight: 600; color: #f1f5f9; }
.link-card-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.link-card-status.active { background: rgba(34,197,94,0.15); color: #22c55e; }
.link-card-status.inactive { background: rgba(239,68,68,0.15); color: #ef4444; }
.link-card-url {
  font-size: 13px; color: #94a3b8; word-break: break-all;
  padding: 8px 12px; background: #0f172a; border-radius: 8px; margin-top: 6px;
}
.link-card-url.primary-label::before { content: '主链接: '; color: #64748b; }
.link-card-url.backup-label::before { content: '备用链接: '; color: #64748b; }
.link-card-note { font-size: 12px; color: #475569; margin-top: 8px; }
.link-card-updated { font-size: 11px; color: #334155; margin-top: 4px; }

.tag-active { background: rgba(34,197,94,0.15); color: #22c55e; }
.tag-testing { background: rgba(234,179,8,0.15); color: #eab308; }
.tag-paused { background: rgba(249,115,22,0.15); color: #f97316; }
.tag-stopped { background: rgba(239,68,68,0.15); color: #ef4444; }
.tag-template { background: rgba(59,130,246,0.15); color: #3b82f6; }
.tag-lang { background: rgba(168,85,247,0.15); color: #a855f7; }
.tag-platform { background: rgba(20,184,166,0.15); color: #14b8a6; }

.card-bottom { display: flex; justify-content: space-between; align-items: center; }
.card-domain {
  font-size: 13px; color: #3b82f6; text-decoration: none;
}
.card-domain:hover { text-decoration: underline; }
.card-date { font-size: 11px; color: #475569; }

.card-pixels {
  display: flex; gap: 6px; margin-top: 8px;
}
.pixel-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 4px;
  background: #334155; color: #94a3b8;
}
.pixel-badge.set { background: rgba(34,197,94,0.2); color: #22c55e; }

/* Loading */
.loading { text-align: center; color: #64748b; padding: 60px; font-size: 14px; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 1000;
  justify-content: center; align-items: flex-start; padding-top: 60px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #1e293b; border: 1px solid #334155; border-radius: 16px;
  width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid #334155;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: #64748b; font-size: 24px; cursor: pointer;
}
.modal-body { padding: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; color: #94a3b8; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select {
  width: 100%; background: #0f172a; color: #e2e8f0;
  border: 1px solid #334155; border-radius: 8px;
  padding: 10px 14px; font-size: 14px; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: #3b82f6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 12px; border-top: 1px solid #334155; margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-wrap: wrap; }
  .card-meta { gap: 6px; }
  .form-row { grid-template-columns: 1fr; }
}
