:root {
  --bg: #0c0c12;
  --bg-elev: #15151f;
  --card: rgba(28, 28, 42, 0.6);
  --card-border: rgba(142, 123, 239, 0.18);
  --text: #ECECF4;
  --text-muted: #8b8ba3;
  --grad-a: #8E7BEF;
  --grad-b: #AFB2F8;
  --gradient: linear-gradient(135deg, #8E7BEF 0%, #AFB2F8 100%);
  --danger: #f87171;
  --success: #4ade80;
  --radius: 12px;
  --radius-lg: 18px;
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(142, 123, 239, 0.12), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(175, 178, 248, 0.1), transparent 45%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* Nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(12, 12, 18, 0.7);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 30px; width: auto; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.nav-actions { display: flex; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gradient {
  background: var(--gradient);
  color: #14101f;
  box-shadow: 0 6px 20px rgba(142, 123, 239, 0.3);
}
.btn-gradient:hover { box-shadow: 0 8px 26px rgba(142, 123, 239, 0.45); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
}
.btn-outline:hover { border-color: var(--grad-a); }
.btn-ghost { background: rgba(255,255,255,0.04); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-small { padding: 6px 12px; font-size: 0.82rem; }
.btn-large { padding: 14px 26px; font-size: 1rem; }
.btn-block { width: 100%; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  padding: 24px;
}

/* Hero */
.hero { position: relative; text-align: center; padding: 70px 0 50px; }
.hero-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(142,123,239,0.25), transparent 60%);
  filter: blur(30px);
  z-index: -1;
}
.hero-title {
  font-size: 4.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc { color: var(--text-muted); font-size: 1.2rem; margin-top: 14px; }

/* Pricing */
.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.price-card { text-align: center; position: relative; }
.price-card-feature { border-color: var(--grad-a); box-shadow: 0 0 0 1px rgba(142,123,239,0.25); }
.price-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); color: #14101f; font-size: 0.72rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.price-label { color: var(--text-muted); font-size: 0.95rem; }
.price-value { font-size: 2.4rem; font-weight: 800; margin: 8px 0 18px; }
.buy-btn { width: 100%; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  background: rgba(6,6,12,0.65); backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal { position: relative; max-width: 440px; width: 100%; text-align: center; }
.modal-close {
  position: absolute; top: 14px; right: 14px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.3rem;
}
.modal-title { margin-bottom: 12px; }
.modal-text { color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.modal-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }

/* Auth */
.auth-container { display: flex; justify-content: center; }
.auth-card { max-width: 420px; width: 100%; }
.auth-title { margin-bottom: 20px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-muted); }
.auth-switch a { color: var(--grad-b); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 0.85rem; color: var(--text-muted); }
.field input, .field textarea, .content-editor textarea, .price-edit input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--grad-a); }

.alert { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }
.alert-error { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.3); color: #fca5a5; }

/* Dashboard */
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.dash-header-actions { display: flex; gap: 10px; }
.inline-form { display: inline; }
.user-card { margin-bottom: 18px; }
.user-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.user-name { font-size: 1.5rem; font-weight: 700; }
.user-id { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; }
.user-email-row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-border); flex-wrap: wrap; gap: 10px; }
.user-email-row span { color: var(--text-muted); }

.role-badge { padding: 5px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.role-user { background: rgba(139,139,163,0.18); color: #c5c5d6; }
.role-beta { background: rgba(96,165,250,0.18); color: #93c5fd; }
.role-media { background: rgba(244,114,182,0.18); color: #f9a8d4; }
.role-tester { background: rgba(74,222,128,0.18); color: #86efac; }
.role-admin { background: var(--gradient); color: #14101f; }

.info-card { margin-bottom: 22px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--card-border); gap: 16px; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-size: 0.9rem; }
.info-value { display: flex; align-items: center; gap: 12px; text-align: right; flex-wrap: wrap; justify-content: flex-end; }
.info-row-features { align-items: flex-start; }
.feature-tags { justify-content: flex-end; }
.tag { background: rgba(142,123,239,0.16); border: 1px solid rgba(142,123,239,0.3); color: var(--grad-b); padding: 4px 12px; border-radius: 999px; font-size: 0.82rem; }
.tag-muted { background: rgba(139,139,163,0.12); border-color: transparent; color: var(--text-muted); }
.dash-actions { text-align: center; }

/* Toast */
.toast-zone { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: var(--radius); font-size: 0.9rem; backdrop-filter: blur(14px); animation: toastIn 0.25s ease; min-width: 220px; }
.toast-success { background: rgba(74,222,128,0.16); border: 1px solid rgba(74,222,128,0.35); color: #bbf7d0; }
.toast-error { background: rgba(248,113,113,0.16); border: 1px solid rgba(248,113,113,0.35); color: #fecaca; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Error page */
.error-card { text-align: center; max-width: 460px; margin: 60px auto; }
.error-icon { font-size: 3rem; color: var(--grad-a); display: block; margin-bottom: 14px; }
.error-card h2 { margin-bottom: 10px; }
.error-card p { color: var(--text-muted); margin-bottom: 22px; }

/* Admin */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.admin-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.admin-sub { color: var(--text-muted); margin-top: 4px; font-size: 0.92rem; }
.admin-tabs { display: flex; gap: 8px; background: rgba(255,255,255,0.03); padding: 5px; border-radius: 14px; border: 1px solid var(--card-border); }
.tab-btn { display: inline-flex; align-items: center; gap: 7px; background: transparent; border: none; color: var(--text-muted); padding: 9px 18px; border-radius: 10px; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.9rem; transition: all 0.18s ease; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--gradient); color: #14101f; box-shadow: 0 4px 14px rgba(142,123,239,0.3); }
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.search-wrap { display: flex; justify-content: center; transition: all 0.45s cubic-bezier(0.4,0,0.2,1); margin-top: 50px; }
.search-wrap.lifted { margin-top: 0; margin-bottom: 28px; }
.search-bar { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 580px; padding: 9px 9px 9px 20px; position: relative; }
.search-bar > i { color: var(--text-muted); font-size: 1.2rem; }
.search-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 1.02rem; }
.search-bar input::placeholder { color: var(--text-muted); }
.search-go { background: var(--gradient); border: none; color: #14101f; width: 42px; height: 42px; border-radius: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; transition: transform 0.15s ease, box-shadow 0.2s ease; flex-shrink: 0; }
.search-go:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(142,123,239,0.4); }
.search-dropdown { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--bg-elev); border: 1px solid var(--card-border); border-radius: 14px; overflow: hidden; display: none; z-index: 50; box-shadow: 0 16px 40px rgba(0,0,0,0.5); }
.search-dropdown.open { display: block; }
.search-item { padding: 13px 18px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.12s ease; }
.search-item:hover { background: rgba(142,123,239,0.14); }
.si-name { font-weight: 600; }
.si-email { color: var(--text-muted); font-size: 0.82rem; }

.editor-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.editor-empty i { font-size: 2.6rem; display: block; margin-bottom: 14px; opacity: 0.5; }

.editor-card { padding: 28px; animation: fadeIn 0.3s ease; }
.editor-card-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--card-border); }
.editor-identity { display: flex; align-items: center; gap: 14px; }
.editor-avatar { width: 48px; height: 48px; border-radius: 14px; background: var(--gradient); color: #14101f; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; }
.editor-username { font-size: 1.25rem; font-weight: 700; }
.editor-uid { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.role-pill { padding: 6px 16px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; background: var(--gradient); color: #14101f; }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field-wide { grid-column: 1 / -1; }

.hwid-input { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding-right: 8px; transition: border-color 0.15s ease; }
.hwid-input:focus-within { border-color: var(--grad-a); }
.hwid-input input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 0.95rem; padding: 11px 14px; }
.hwid-clear { background: rgba(255,255,255,0.06); border: none; color: var(--text-muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease; }
.hwid-clear:hover { background: rgba(248,113,113,0.18); color: #fca5a5; }

.dropdown { position: relative; }
.dropdown-toggle { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 11px 14px; color: var(--text); cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-family: inherit; font-size: 0.95rem; transition: border-color 0.15s ease; }
.dropdown-toggle:hover { border-color: var(--grad-a); }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-elev); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; display: none; z-index: 40; box-shadow: 0 14px 34px rgba(0,0,0,0.5); }
.dropdown-menu.open { display: block; }
.dropdown-option { padding: 11px 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.12s ease; }
.dropdown-option:hover { background: rgba(142,123,239,0.14); }
.dropdown-option.active { color: var(--grad-b); }

.modules-picker { position: relative; }
.modules-field { min-height: 46px; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 8px 12px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; transition: border-color 0.15s ease; }
.modules-field:hover, .modules-field:focus { border-color: var(--grad-a); outline: none; }
.modules-placeholder { color: var(--text-muted); font-size: 0.92rem; }
.module-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(142,123,239,0.18); border: 1px solid rgba(142,123,239,0.35); color: var(--grad-b); padding: 5px 6px 5px 12px; border-radius: 999px; font-size: 0.84rem; }
.module-chip-all { background: var(--gradient); color: #14101f; border-color: transparent; padding: 5px 14px; font-weight: 600; }
.module-chip button { background: rgba(0,0,0,0.18); border: none; color: inherit; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.module-chip button:hover { background: rgba(0,0,0,0.35); }
.modules-popover { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-elev); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; display: none; z-index: 40; box-shadow: 0 14px 34px rgba(0,0,0,0.5); max-height: 260px; overflow-y: auto; }
.modules-popover.open { display: block; }
.popover-option { padding: 11px 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background 0.12s ease; }
.popover-option:hover { background: rgba(142,123,239,0.14); }
.popover-option.selected { color: var(--grad-b); }
.popover-option.disabled { opacity: 0.4; pointer-events: none; }
.popover-all { border-bottom: 1px solid var(--card-border); font-weight: 600; }
.popover-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.editor-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--card-border); flex-wrap: wrap; }

.btn-danger { background: rgba(248,113,113,0.14); border: 1px solid rgba(248,113,113,0.3); color: #fca5a5; }
.btn-danger:hover { background: rgba(248,113,113,0.22); }

.modal-wide { max-width: 480px; text-align: left; }
.sub-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sub-modal-header .modal-close { position: static; }
.sub-current { margin-bottom: 22px; padding: 10px 14px; background: rgba(255,255,255,0.04); border-radius: 10px; }
.sub-section { margin-bottom: 18px; }
.sub-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: 0.92rem; }
.sub-section-head i { color: var(--grad-b); font-size: 1.1rem; }
.sub-row { display: flex; gap: 10px; align-items: center; }
.sub-row input[type="number"] { flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 11px 14px; color: var(--text); font-family: inherit; font-size: 0.95rem; outline: none; transition: border-color 0.15s ease; }
.sub-row input[type="number"]:focus { border-color: var(--grad-a); }
.date-inputs { display: flex; gap: 8px; flex: 1; }
.date-inputs input { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 11px 10px; color: var(--text); font-family: inherit; font-size: 0.95rem; outline: none; text-align: center; transition: border-color 0.15s ease; }
.date-inputs input:focus { border-color: var(--grad-a); }
.sub-modal-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--card-border); }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.content-block { padding: 22px; }
.block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.block-head i { color: var(--grad-b); font-size: 1.25rem; }
.block-head h3 { font-size: 1.05rem; font-weight: 700; }
.content-block textarea { width: 100%; }
.price-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.price-edit { display: flex; flex-direction: column; gap: 8px; background: rgba(255,255,255,0.03); padding: 14px; border-radius: var(--radius); }
.price-edit-key { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.hint { color: var(--text-muted); font-size: 0.85rem; }
.feature-editor { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.feature-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(142,123,239,0.14); border: 1px solid rgba(142,123,239,0.3); padding: 6px 8px 6px 14px; border-radius: 999px; font-size: 0.88rem; }
.feature-chip button { background: rgba(0,0,0,0.18); border: none; color: var(--text-muted); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.feature-chip button:hover { background: rgba(248,113,113,0.22); color: #fca5a5; }
.feature-add { display: flex; gap: 10px; }
.feature-add input { flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 10px 14px; color: var(--text); font-family: inherit; outline: none; transition: border-color 0.15s ease; }
.feature-add input:focus { border-color: var(--grad-a); }
.content-footer { display: flex; justify-content: flex-end; margin-top: 20px; }

.pw-result { font-family: monospace; font-size: 1.35rem; background: rgba(255,255,255,0.05); padding: 16px; border-radius: var(--radius); letter-spacing: 0.06em; user-select: all; text-align: center; }

.toast { display: flex; align-items: center; gap: 9px; }
.toast i { font-size: 1.1rem; }

@media (max-width: 640px) {
  .hero-title { font-size: 2.8rem; }
  .editor-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .admin-head { align-items: flex-start; }
  .admin-tabs { width: 100%; }
  .tab-btn { flex: 1; justify-content: center; }
}
