/* ===== CSS Variables ===== */
:root {
  --bg: #0d0d0f;
  --bg-card: #1a1a1f;
  --bg-hover: #2a2a33;
  --text: #ffffff;
  --text-dim: #a0a0b0;
  --text-dimmer: #6a6a78;
  --border: #2a2a35;
  --accent: #3094ec;
  --accent-hover: #4aa8ff;
  --success: #30d158;
  --danger: #e34040;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 15, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 24px; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
}

/* ===== Navigation ===== */
.nav-links { display: flex; gap: 16px; }

.nav-link {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  position: relative;
  transition: color 0.2s;
  text-decoration: none;
}

.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* ===== Controls ===== */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.search-box input:focus { border-color: var(--accent); }

.category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar { display: none; }

.category-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.category-chip:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.category-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== App Grid ===== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 0 40px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.app-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.card-screenshot {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  background: var(--bg-hover);
}

.card-screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  opacity: 0.3;
}

.card-body {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-category {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== Detail Page ===== */
.detail-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 40px;
}

.detail-app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.detail-app-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-hover);
}

.detail-app-icon img { width: 100%; height: 100%; object-fit: cover; }

.detail-app-info h1 { font-size: 24px; font-weight: 700; margin: 0; }
.detail-app-info p { font-size: 14px; color: var(--text-dim); margin-top: 4px; }

.detail-header { margin-bottom: 16px; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.2s;
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.category-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(48, 148, 236, 0.12);
  color: var(--accent);
  margin-top: 6px;
}

/* Metrics Bar */
.metrics-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric-item {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.metric-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Screenshot gallery items */
.screenshot-item {
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.screenshot-item:hover {
  transform: scale(1.02);
}

.screenshot-item img {
  width: 100%;
  display: block;
}

.detail-section { margin-bottom: 32px; }

.detail-section h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* Info table (App Information) */
.info-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.info-table th,
.info-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.info-table th { font-weight: 600; color: var(--text); background: var(--bg-hover); }
.info-table td:first-child { color: var(--text-dim); width: 180px; }
.info-table td:last-child { color: var(--text); }

/* Offers / Pricing table */
.offers-container { overflow-x: auto; }
.offers-container .info-table { min-width: 300px; }

.screenshot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.screenshot-gallery img {
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s;
}

.screenshot-gallery img:hover { transform: scale(1.02); }

/* ===== Lightbox ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox img { max-width: 90%; max-height: 90%; object-fit: contain; }

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  color: #fff;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover { opacity: 1; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dimmer);
  font-size: 13px;
}

/* ===== Admin ===== */
.admin-container { max-width: 900px; margin: 0 auto; padding: 32px 40px; }

.admin-section {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-section h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.admin-section .desc { font-size: 14px; color: var(--text-dim); margin: 0 0 16px; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover { border-color: var(--accent); background: var(--bg-hover); }
.upload-area .icon { font-size: 36px; margin-bottom: 8px; }
.upload-area .text { font-size: 16px; font-weight: 500; }
.upload-area .hint { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.upload-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-dim); }
.btn-danger { background: rgba(227,64,64,0.15); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px !important; font-size: 12px !important; border-radius: 6px !important; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-card .num { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* History table */
.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th,
.history-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.history-table th { font-weight: 600; color: var(--text-dim); font-size: 12px; text-transform: uppercase; }
.history-table tr:last-child td { border-bottom: none; }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge.success { background: rgba(48,209,88,0.15); color: var(--success); }
.status-badge.error { background: rgba(227,64,64,0.15); color: var(--danger); }
.status-badge.published { background: rgba(48,209,88,0.15); color: var(--success); }
.status-badge.unpublished { background: rgba(255,159,10,0.15); color: #ff9f0a; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }

/* Loading */
.loading { text-align: center; padding: 60px; color: var(--text-dim); font-size: 16px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px; color: var(--text-dimmer); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* ===== Case Studies ===== */
.case-studies-hero {
  padding: 40px 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.case-studies-hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.case-studies-hero p {
  font-size: 16px;
  color: var(--text-dim);
  margin: 0;
}

.case-studies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px 40px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.case-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.case-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-hover);
}

.case-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: var(--bg-hover);
}

.case-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.case-body { padding: 16px; }

.case-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.4;
}

.case-summary {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dimmer);
}

/* Case Study Detail */
.case-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 40px;
}

.case-detail-cover {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.case-detail-cover img { width: 100%; display: block; }

.case-detail-header { margin-bottom: 32px; }

.case-detail-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.case-detail-meta {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.case-detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(48, 148, 236, 0.12);
  color: var(--accent);
}

.case-detail-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.case-detail-content p { margin-bottom: 16px; }
.case-detail-content h2 { font-size: 24px; font-weight: 600; color: var(--text); margin: 32px 0 16px; }
.case-detail-content h3 { font-size: 20px; font-weight: 600; color: var(--text); margin: 24px 0 12px; }
.case-detail-content ul, .case-detail-content ol { margin-bottom: 16px; padding-left: 24px; }
.case-detail-content li { margin-bottom: 8px; }
.case-detail-content strong { color: var(--text); }
.case-detail-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 24px 0;
  color: var(--text-dim);
  font-style: italic;
}

.case-detail-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.case-detail-nav a {
  color: var(--text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.case-detail-nav a .label {
  font-size: 12px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.case-detail-nav a .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.case-detail-nav a.next { text-align: right; }

.case-detail-nav .back {
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
}

.case-detail-nav .back:hover { border-color: var(--text-dim); color: var(--text); }

/* Pagination for case studies */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 0 40px 40px;
}

.pagination button {
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.pagination button:hover:not(:disabled) { border-color: var(--text-dim); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pagination span { color: var(--text-dimmer); padding: 4px 8px; }

/* Admin case study form */
.admin-form { display: grid; gap: 12px; }

.admin-form input,
.admin-form textarea {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.admin-form textarea { resize: vertical; min-height: 80px; }
.admin-form label { font-size: 13px; color: var(--text-dim); margin-bottom: -8px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Error page */
.error-container {
  max-width: 600px;
  margin: 100px auto;
  text-align: center;
  padding: 40px;
}
.error-container h1 { font-size: 72px; font-weight: 700; color: var(--text-dimmer); margin-bottom: 16px; }
.error-container h2 { font-size: 24px; margin-bottom: 16px; }
.error-container p { color: var(--text-dim); margin-bottom: 24px; }

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 0 16px; }
  .header-left { gap: 16px; }
  .nav-links { gap: 12px; }
  .controls { padding: 16px; flex-direction: column; }
  .search-box { max-width: 100%; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); padding: 0 16px 24px; gap: 12px; }
  .detail-container { padding: 16px; }
  .detail-app-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .screenshot-gallery { grid-template-columns: 1fr 1fr; }
  .case-studies-hero { padding: 24px 16px 16px; }
  .case-studies-grid { grid-template-columns: 1fr; padding: 16px; }
  .case-detail { padding: 16px; }
  .case-detail-header h1 { font-size: 24px; }
  .case-detail-nav { grid-template-columns: 1fr; gap: 12px; }
  .case-detail-nav a.next { text-align: left; }
  .form-row { grid-template-columns: 1fr; }
  #subStatsGrid { grid-template-columns: repeat(2, 1fr) !important; }
  .user-menu { flex-wrap: wrap; gap: 8px; }
  .user-email { display: none; }
}

/* ===== Header Right (Auth) ===== */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-badge.free {
  background: rgba(255,159,10,0.15);
  color: #ff9f0a;
}

.user-badge.subscribed {
  background: rgba(48,209,88,0.15);
  color: var(--success);
}

.user-email {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Auth Page ===== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 40px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-form-wrap {
  display: none;
}

.auth-form-wrap.active {
  display: block;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 20px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-dim);
}

.form-group input {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}

.auth-msg {
  min-height: 20px;
}

.auth-error-text {
  color: var(--danger);
  font-size: 13px;
}

.auth-error {
  background: rgba(227,64,64,0.1);
  border: 1px solid rgba(227,64,64,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-divider {
  text-align: center;
  margin: 24px 0;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  background: var(--bg-card);
  padding: 0 12px;
  color: var(--text-dim);
  font-size: 12px;
  position: relative;
  z-index: 1;
}

.google-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
}

.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-dimmer);
  margin-top: 20px;
}

/* ===== Access Gate ===== */
.access-gate {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 15, 0.95);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.access-gate-card {
  text-align: center;
  padding: 48px;
  max-width: 400px;
}

.gate-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.access-gate-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.access-gate-card p {
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.6;
}

.gate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ===== Subscription Modal ===== */
.sub-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
}

.sub-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
}

.sub-modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin: 20px;
}

.sub-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.sub-modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.sub-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.sub-modal-close:hover {
  color: var(--text);
}

.sub-modal-body {
  padding: 24px;
}

.sub-price {
  text-align: center;
  margin-bottom: 24px;
}

.sub-amount {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
}

.sub-period {
  font-size: 16px;
  color: var(--text-dim);
}

.sub-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.sub-features li {
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  color: var(--text);
  font-size: 14px;
}

.sub-features li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
  font-size: 16px;
}

.sub-limit-notice {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 12px;
  background: rgba(255,159,10,0.1);
  border-radius: 8px;
}

.sub-modal-footer {
  display: flex;
  gap: 8px;
  padding: 0 24px 24px;
}

.sub-apply-btn {
  flex: 1;
}

.sub-success-msg {
  margin: 0 24px 24px;
  padding: 16px;
  background: rgba(48,209,88,0.1);
  border: 1px solid rgba(48,209,88,0.3);
  border-radius: 8px;
  color: var(--success);
  font-size: 14px;
  text-align: center;
}

/* ===== Quota Badge (detail page) ===== */
.quota-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255,159,10,0.12);
  border: 1px solid rgba(255,159,10,0.3);
  border-radius: 6px;
  font-size: 12px;
  color: #ff9f0a;
  margin-left: 8px;
}

.quota-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #ff9f0a;
  color: #000;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

/* Status badge: pending */
.status-badge.pending {
  background: rgba(255,159,10,0.15);
  color: #ff9f0a;
}

/* ===== Homepage Styles ===== */

/* Hero Section */
.home-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  text-align: center;
  padding: 80px 40px;
  position: relative;
  overflow: hidden;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.4;
}

.home-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.home-hero-content {
  position: relative;
  max-width: 800px;
  z-index: 1;
}

.home-hero-title {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero-subtitle {
  font-size: 20px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 400;
}

.home-hero-desc {
  font-size: 16px;
  color: var(--text-dimmer);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* Hero proposition cards */
.home-hero-props {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin: 24px 0 40px;
  flex-wrap: wrap;
}

.hero-prop-card {
  position: relative;
  background: rgba(26, 26, 31, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 360px;
  text-align: center;
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: transform 0.3s, border-color 0.3s;
}

.hero-prop-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.hero-prop-card:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.hero-prop-card:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.hero-prop-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.hero-prop-text {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.hero-prop-glow {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 80px;
  background: radial-gradient(ellipse, rgba(48,148,236,0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-prop-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.hero-prop-divider span {
  display: block;
  width: 2px;
  height: 60px;
  background: linear-gradient(180deg, transparent 0%, var(--accent) 50%, transparent 100%);
}

.home-hero-cta {
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
}

/* Features Section */
.home-features {
  padding: 80px 40px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.home-features-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.home-section-title {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--text);
}

.home-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.home-feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.home-feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.home-feature-card.has-image {
  padding: 0;
  overflow: hidden;
}

.home-feature-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-hover);
}

.home-feature-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.home-feature-card:hover .home-feature-img img {
  transform: scale(1.05);
}

.home-feature-card.has-image h3 {
  margin-top: 24px;
  padding: 0 24px;
}

.home-feature-card.has-image p {
  padding: 0 24px 24px;
}

.home-feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.home-feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.home-feature-card p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* Audience Section */
.home-audience {
  padding: 80px 40px;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.home-audience-desc {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 48px;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Avatar cards for audience */
.home-avatars-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.home-avatar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}

.home-avatar-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.home-avatar-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.home-avatar-card:hover::after {
  opacity: 1;
}

.home-avatar-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.home-avatar-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.home-avatar-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* CTA Section */
.home-cta {
  padding: 80px 40px;
  background: linear-gradient(135deg, rgba(48,148,236,0.08) 0%, rgba(74,168,255,0.04) 100%);
  text-align: center;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.home-cta-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(48,148,236,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.home-cta-inner {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.home-cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(48,148,236,0.12);
  border: 1px solid rgba(48,148,236,0.3);
  border-radius: 24px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
}

.home-cta h2 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.home-cta p {
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.home-cta-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 40px;
}

.home-cta-actions .btn-lg {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
}

.home-cta-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-stat {
  text-align: center;
}

.cta-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.cta-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* FAQ Section */
.home-faq {
  padding: 80px 40px;
  max-width: 800px;
  margin: 0 auto;
}

.home-faq-list {
  display: grid;
  gap: 16px;
}

.home-faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s;
}

.home-faq-item:hover {
  border-color: var(--accent-hover);
}

.home-faq-item h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
}

.home-faq-item p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .home-avatars-grid { grid-template-columns: 1fr; }
  .home-hero-title { font-size: 26px; }
  .home-cta-stats { flex-direction: column; gap: 16px; }
}

/* Pricing Section */
.home-pricing {
  padding: 80px 40px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.home-pricing-inner {
  max-width: 800px;
  margin: 0 auto;
}
.home-pricing-desc {
  font-size: 18px;
  color: var(--text-dim);
  margin-bottom: 40px;
}
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: left;
  position: relative;
  transition: transform 0.2s;
}
.pricing-card:hover {
  transform: translateY(-4px);
}
.pricing-card.pro {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(48,148,236,0.05) 0%, transparent 100%);
}
.pricing-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(48,148,236,0.12);
  border: 1px solid rgba(48,148,236,0.3);
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.pricing-badge.pro-badge {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.pricing-price {
  font-size: 42px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 24px;
}
.pricing-price .period {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-dim);
}
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
}
.pricing-features li {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pricing-features li:last-child {
  border-bottom: none;
}
.pricing-features li.no {
  color: var(--text-dim);
}
.pricing-features .check {
  color: #30d158;
  font-weight: 700;
  font-size: 16px;
}
.pricing-features .x {
  color: #ff3b30;
  font-size: 14px;
}
.pricing-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
  padding: 14px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; gap: 16px; }
  .home-pricing { padding: 40px 20px; }
  .pricing-price { font-size: 32px; }
}
  text-align: center;
  padding: 32px;
  color: var(--text-dimmer);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* Button sizes */
.btn-lg { font-size: 16px; padding: 14px 32px; }
.btn-sm { font-size: 12px; padding: 6px 14px; }

/* Responsive for homepage */
@media (max-width: 768px) {
  .home-hero { padding: 40px 20px; }
  .home-hero-title { font-size: 32px; }
  .home-hero-subtitle { font-size: 16px; }
  .home-hero-props { flex-direction: column; gap: 16px; }
  .hero-prop-card { border-radius: 16px !important; max-width: 100%; }
  .hero-prop-divider { display: none; }
  .home-features { padding: 40px 20px; }
  .home-features-grid { grid-template-columns: 1fr; gap: 16px; }
  .home-feature-card { padding: 24px; }
  .home-audience { padding: 40px 20px; }
  .home-avatars-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .home-avatar-card { padding: 20px 12px; }
  .home-avatar-icon { width: 48px; height: 48px; font-size: 22px; }
  .home-avatar-name { font-size: 13px; }
  .home-avatar-desc { font-size: 11px; }
  .home-cta { padding: 40px 20px; }
  .home-cta h2 { font-size: 28px; }
  .home-cta p { font-size: 16px; }
  .home-cta-actions { flex-direction: column; }
  .home-cta-actions .btn-lg { width: 100%; }
  .home-cta-stats { gap: 20px; }
  .cta-stat-num { font-size: 22px; }
  .home-faq { padding: 40px 20px; }
}
