* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Header ===== */
header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  padding: 14px 0;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-link-vip {
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
  font-weight: 600;
}

.nav-link-vip:hover {
  background: rgba(251, 191, 36, 0.35);
  color: #fef3c7;
}

.nav-user {
  color: #fff;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===== Search Page ===== */
.search-section {
  text-align: center;
  margin-bottom: 48px;
  padding-top: 20px;
}

.search-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-subtitle {
  color: #64748b;
  margin-bottom: 28px;
  font-size: 14px;
}

.search-box {
  display: flex;
  max-width: 580px;
  margin: 0 auto;
  gap: 10px;
}

.search-box input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
  background: #fff;
}

.search-box input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-box button {
  padding: 14px 32px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.search-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.search-box button:active {
  transform: translateY(0);
}

/* ===== Results Grid ===== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.book-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: rgba(99, 102, 241, 0.15);
}

.book-cover {
  width: 80px;
  height: 107px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}

.book-name {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-author {
  font-size: 13px;
  color: #64748b;
}

.book-meta {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.book-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-free { background: #dcfce7; color: #166534; }
.badge-paid { background: #fef2f2; color: #991b1b; }
.badge-category { background: #f3e8ff; color: #6b21a8; }
.badge-vip { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; padding: 3px 10px; border-radius: 8px; }
.badge-normal { background: #f1f5f9; color: #475569; }

/* ===== Detail Page ===== */
.detail-page {
  max-width: 800px;
  margin: 0 auto;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6366f1;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
  font-weight: 500;
}

.back-btn:hover {
  text-decoration: underline;
}

.detail-header {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  display: flex;
  gap: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.detail-cover {
  width: 150px;
  height: 200px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-title { font-size: 22px; font-weight: 800; color: #1e293b; }
.detail-author { font-size: 14px; color: #64748b; }
.detail-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; }
.stat-item { text-align: center; }
.stat-value { font-size: 18px; font-weight: 700; color: #1e293b; }
.stat-label { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.detail-latest { font-size: 13px; color: #64748b; margin-top: auto; }
.update-time { font-size: 12px; color: #94a3b8; }

.detail-desc-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.detail-desc-box p {
  color: #475569;
  line-height: 1.8;
  font-size: 14px;
}

.detail-actions {
  background: #fff;
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.detail-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #eef2ff, #faf5ff);
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #4338ca;
}

.detail-balance strong { font-size: 18px; }
.balance-icon { font-size: 18px; }

.detail-vip-link {
  margin-left: auto;
  font-size: 12px;
  color: #f59e0b;
  text-decoration: none;
  font-weight: 600;
  padding: 4px 10px;
  background: #fffbeb;
  border-radius: 6px;
}

.detail-vip-link:hover { background: #fef3c7; }

.detail-vip-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  padding: 3px 10px;
  border-radius: 6px;
}

.cutoff-info {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.8;
}

.cutoff-title {
  font-size: 14px;
  font-weight: 700;
  color: #78350f;
  margin-bottom: 8px;
}

.cutoff-row { padding: 3px 0; }
.cutoff-label { font-weight: 600; margin-right: 6px; }
.vip-label { color: #b45309; }
.cutoff-explain { font-size: 12px; color: #b8860b; font-weight: 400; margin-left: 6px; opacity: 0.8; }

.perm-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.perm-expiry { font-size: 13px; color: #64748b; }
.perm-ok { color: #166534; font-size: 13px; font-weight: 600; }
.perm-used { color: #dc2626; font-size: 13px; }

.purchase-section { margin-bottom: 16px; }
.purchase-hint { font-size: 14px; color: #475569; margin-bottom: 12px; }

.purchase-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.purchase-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.purchase-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.purchase-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.original-price {
  text-decoration: line-through;
  opacity: 0.7;
  margin-right: 4px;
  font-weight: 400;
}

.login-hint { font-size: 14px; color: #64748b; }
.login-hint a { color: #6366f1; font-weight: 600; }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.download-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35); }
.download-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.progress-wrap { margin-top: 16px; }
.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #10b981, #059669); border-radius: 4px; transition: width 0.3s ease; }
.progress-text { margin-top: 8px; font-size: 13px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.download-status { margin-top: 16px; padding: 12px 16px; border-radius: 10px; font-size: 14px; display: none; }
.download-status.show { display: block; }
.download-status.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.download-status.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.download-status.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== VIP / Membership Page ===== */
.vip-page {
  max-width: 900px;
  margin: 0 auto;
}

.vip-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
  border-radius: 24px;
  padding: 48px 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.vip-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.vip-hero-content {
  position: relative;
  z-index: 1;
}

.vip-hero-title {
  font-size: 36px;
  font-weight: 800;
  color: #fbbf24;
  margin-bottom: 8px;
}

.vip-hero-desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  max-width: 500px;
}

.vip-current-badge {
  margin-top: 16px;
  display: inline-block;
  padding: 8px 16px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 10px;
  color: #fde68a;
  font-size: 13px;
  font-weight: 600;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 20px;
  text-align: center;
}

.vip-plans-section {
  margin-bottom: 40px;
}

.vip-plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.vip-plan-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  border: 2px solid #e2e8f0;
  transition: all 0.3s;
  position: relative;
}

.vip-plan-card:hover {
  border-color: #6366f1;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.15);
}

.vip-plan-card.plan-popular {
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
}

.vip-plan-card.plan-premium {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 40%);
}

.plan-popular-tag,
.plan-premium-tag {
  position: absolute;
  top: -1px;
  right: -1px;
  padding: 4px 12px;
  border-radius: 0 18px 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.plan-popular-tag { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.plan-premium-tag { background: linear-gradient(135deg, #f59e0b, #d97706); }

.plan-name {
  font-size: 15px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 16px;
}

.plan-price {
  margin-bottom: 6px;
}

.price-num {
  font-size: 36px;
  font-weight: 800;
  color: #6366f1;
}

.plan-premium .price-num { color: #d97706; }

.price-unit {
  font-size: 14px;
  color: #64748b;
  margin-left: 4px;
}

.plan-duration {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.plan-save {
  font-size: 12px;
  color: #059669;
  font-weight: 600;
  margin-bottom: 12px;
  padding: 2px 8px;
  background: #ecfdf5;
  border-radius: 4px;
  display: inline-block;
}

.plan-buy-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.plan-buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.plan-buy-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.plan-premium .plan-buy-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Compare Table */
.vip-compare-section {
  margin-bottom: 40px;
}

.compare-table-wrap {
  background: #fff;
  border-radius: 20px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.compare-table th,
.compare-table td {
  padding: 14px 20px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
}

.compare-table th {
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  font-size: 14px;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
}

.compare-vip-col {
  background: linear-gradient(180deg, #fefce8 0%, #fff 100%);
  color: #92400e;
}

.compare-table th.compare-vip-col {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  font-weight: 700;
}

.compare-label { font-weight: 600; color: #374151; }
.compare-disabled { color: #cbd5e1; }

/* FAQ */
.vip-faq-section {
  margin-bottom: 40px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: #fff;
  border-radius: 14px;
  padding: 18px 24px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.faq-q {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
  font-size: 14px;
}

.faq-a {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

/* ===== Auth Pages ===== */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: #1e293b;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.auth-tab.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}

.form-group input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-error {
  color: #dc2626;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}

.auth-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #64748b;
}

.auth-switch a { color: #6366f1; text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.auth-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: #94a3b8;
}

/* ===== Profile Page ===== */
.profile-page {
  max-width: 700px;
  margin: 0 auto;
}

.profile-header {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  display: flex;
  gap: 20px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h2 { font-size: 18px; color: #1e293b; margin-bottom: 4px; }
.profile-email { font-size: 13px; color: #64748b; margin-bottom: 8px; }
.profile-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vip-expiry { font-size: 12px; color: #b45309; }
.upgrade-link { font-size: 12px; color: #6366f1; text-decoration: none; font-weight: 600; }
.upgrade-link:hover { text-decoration: underline; }

.profile-section {
  background: #fff;
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.profile-section h3 {
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 700;
}

.balance-display {
  text-align: center;
  padding: 16px;
}

.balance-amount {
  font-size: 40px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-label {
  font-size: 14px;
  color: #94a3b8;
  margin-left: 8px;
}

.redeem-section {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.redeem-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.redeem-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

.redeem-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.redeem-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(99, 102, 241, 0.25); }
.redeem-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.tx-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: #6366f1;
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.tx-link:hover { text-decoration: underline; }

.tx-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

.tx-table th, .tx-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.tx-table th { color: #64748b; font-weight: 600; }
.tx-plus { color: #059669; font-weight: 600; }
.tx-minus { color: #dc2626; font-weight: 600; }

/* Exchange Section */
.exchange-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}

.exchange-info {
  font-size: 13px;
  color: #475569;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.exchange-info strong { color: #6366f1; }

.exchange-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.exchange-row input {
  width: 140px;
  padding: 9px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.exchange-row input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

.exchange-row button {
  padding: 9px 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.exchange-row button:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3); }
.exchange-row button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Sign In */
.sign-streak {
  text-align: center;
  font-size: 15px;
  color: #475569;
  margin-bottom: 14px;
}
.sign-streak strong { color: #10b981; font-size: 20px; }

.sign-in-week {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.sign-day {
  width: 56px;
  text-align: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  transition: all 0.2s;
}

.sign-day.signed {
  background: #ecfdf5;
  border-color: #10b981;
}

.sign-day.current {
  border-color: #6366f1;
  background: #eef2ff;
}

.sign-day.current.signed {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.sign-day-label {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.sign-day-reward {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
}

.sign-day.signed .sign-day-reward { color: #059669; }
.sign-day.current .sign-day-label { color: #6366f1; font-weight: 600; }

.sign-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.sign-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.sign-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.sign-done { text-align: center; color: #059669; font-weight: 600; font-size: 14px; margin-top: 8px; }

/* Permissions List */
.perm-list { display: flex; flex-direction: column; gap: 8px; }

.perm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.perm-item:hover { background: #f1f5f9; border-color: #6366f1; }
.perm-item.expired { opacity: 0.5; }
.perm-novel { font-weight: 600; color: #1e293b; flex: 1; }
.perm-type { color: #6366f1; font-weight: 600; }
.perm-status { font-size: 12px; }
.perm-date { font-size: 12px; color: #94a3b8; }

/* ===== Rank Section ===== */
.rank-section {
  margin-top: 32px;
}

.rank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.rank-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.rank-tab {
  padding: 6px 14px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.rank-tab:hover { background: #e2e8f0; color: #334155; }
.rank-tab.active { background: #6366f1; color: #fff; }

.rank-gender {
  display: flex;
  gap: 4px;
}

.rank-gender-btn {
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.rank-gender-btn:hover { border-color: #6366f1; color: #6366f1; }
.rank-gender-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.rank-item:hover { background: #f8fafc; }

.rank-num {
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  border-radius: 6px;
  flex-shrink: 0;
}

.rank-num.rank-top {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 13px;
}

.rank-cover {
  width: 40px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-book-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-book-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.rank-book-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.rank-pager-btn {
  padding: 6px 16px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #475569;
  transition: all 0.2s;
}

.rank-pager-btn:hover:not(:disabled) { border-color: #6366f1; color: #6366f1; }
.rank-pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.rank-pager-info { font-size: 13px; color: #94a3b8; }

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}

.cat-tab {
  padding: 4px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.cat-tab:hover { border-color: #a78bfa; color: #7c3aed; }
.cat-tab.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }

/* ===== Admin Page ===== */
.admin-page {
  max-width: 900px;
  margin: 0 auto;
}

.admin-page h2 {
  font-size: 22px;
  color: #1e293b;
  margin-bottom: 24px;
  font-weight: 700;
}

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
}

.admin-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.admin-tab:hover { background: #f8fafc; }

.admin-tab.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
}

.admin-sub-title {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e2e8f0;
}

.row-inactive { opacity: 0.5; }

.admin-section {
  background: #fff;
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.admin-section h3 {
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 700;
}

.admin-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-row label {
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}

.admin-input {
  padding: 8px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  width: 100px;
  transition: all 0.2s;
}

.admin-input-wide { width: 240px; }
.admin-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

.admin-btn {
  padding: 8px 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-btn:hover { transform: translateY(-1px); }
.admin-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.admin-btn-sm {
  padding: 4px 10px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
  transition: background 0.2s;
}

.admin-btn-sm:hover { background: #4f46e5; }

.codes-textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: monospace;
  font-size: 13px;
  margin: 8px 0;
  resize: vertical;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th, .admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.admin-table th { color: #64748b; font-weight: 600; background: #f8fafc; }

.empty-hint {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 20px;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 15px;
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.empty-state p {
  font-size: 15px;
  margin-top: 8px;
}

/* ===== Admin Enhancements ===== */
.admin-btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.admin-btn-danger:hover { background: #dc2626; }

.admin-btn-primary {
  background: #6366f1;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.admin-btn-primary:hover { background: #4f46e5; }

.batch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f1f5f9;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

.check-all-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
}

.selected-count {
  font-size: 12px;
  color: #6366f1;
  font-weight: 600;
  white-space: nowrap;
}

.admin-stats {
  margin-top: 8px;
  font-size: 12px;
  color: #94a3b8;
}

.code-checkbox, .user-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #6366f1;
}

/* ===== Settings Toggle ===== */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}
.setting-info { display: flex; flex-direction: column; gap: 4px; }
.setting-label { font-size: 15px; font-weight: 600; color: #1e293b; }
.setting-desc { font-size: 12px; color: #94a3b8; }
.setting-status { font-size: 13px; color: #64748b; margin-top: 8px; }
.status-on { color: #10b981; font-weight: 600; }
.status-off { color: #ef4444; font-weight: 600; }

.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 26px; transition: 0.3s;
}
.toggle-slider:before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: #6366f1; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

.reg-closed-msg {
  text-align: center;
  color: #64748b;
  font-size: 15px;
  margin: 16px 0;
  line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .results-grid { grid-template-columns: 1fr; }

  .detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .detail-stats { justify-content: center; }
  .search-box { flex-direction: column; }
  .search-box button { width: 100%; }

  .header-inner { flex-direction: column; gap: 10px; }
  .header-nav { flex-wrap: wrap; justify-content: center; gap: 2px; }

  .profile-header { flex-direction: column; text-align: center; }
  .sign-in-week { flex-wrap: wrap; }
  .sign-day { width: 44px; }

  .purchase-options { flex-direction: column; }
  .purchase-btn { width: 100%; }

  .admin-row { flex-direction: column; align-items: stretch; }
  .admin-input, .admin-input-wide { width: 100%; }
  .admin-table { font-size: 11px; }
  .admin-table th, .admin-table td { padding: 6px 4px; }
  .admin-tabs { flex-direction: column; }
  .admin-tab { text-align: center; }
  .rank-section { margin-top: 24px; }
  .rank-header { flex-direction: column; align-items: flex-start; }
  .rank-tab { padding: 5px 10px; font-size: 12px; }
  .rank-item { padding: 10px 12px; }

  .vip-plans-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .vip-hero { padding: 32px 24px; }
  .vip-hero-title { font-size: 28px; }

  .compare-table { font-size: 12px; }
  .compare-table th, .compare-table td { padding: 10px 8px; }

  .exchange-row { flex-direction: column; align-items: stretch; }
  .exchange-row input { width: 100%; }
  .exchange-row button { width: 100%; }

  .detail-balance { flex-direction: column; align-items: flex-start; gap: 6px; }
  .detail-vip-link { margin-left: 0; }
}

@media (max-width: 480px) {
  .vip-plans-grid { grid-template-columns: 1fr; }
  .price-num { font-size: 28px; }
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.admin-pagination .pagination-info {
  font-size: 13px;
  color: #666;
  margin-right: 12px;
}
.admin-pagination button {
  min-width: 32px;
  padding: 4px 8px;
}
.admin-pagination button.active {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}
.admin-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
