/* ═══════════════════════════════════════════════════════════ */
/* Crown AI v7.0.0 — Complete Stylesheet           */
/* Dark Theme • Purple Accents • No Tailwind Dependency        */
/* ═══════════════════════════════════════════════════════════ */

/* ═══ CSS VARIABLES ═══ */
:root {
  --bg-dark: #0a0a0f;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a28;
  --bg-input: #1a1a28;
  --bg-sidebar: #0e0e16;
  --purple: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-dark: #6d28d9;
  --purple-glow: rgba(139, 92, 246, 0.3);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #1e1e2e;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

/* ═══ RESET ═══ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body, .c-body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg-dark); color: var(--text); min-height: 100vh; line-height: 1.6; }
a { color: var(--purple-light); text-decoration: none; cursor: pointer; transition: color var(--transition); }
a:hover { color: #fff; }
img { max-width: 100%; height: auto; }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-dark); }

/* ═══ UTILITY CLASSES (replacing Tailwind) ═══ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.self-end { align-self: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.text-center, .center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-700 { color: #374151; }
.text-green-400 { color: #34d399; }
.text-red-400 { color: #f87171; }
.text-purple-400 { color: var(--purple-light); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ═══ TOAST ═══ */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); color: #fff; font-size: 14px; display: flex; align-items: center; gap: 8px; transform: translateX(120%); transition: transform 0.3s ease; max-width: 400px; backdrop-filter: blur(10px); pointer-events: auto; }
.toast.show { transform: translateX(0); }
.toast-success { background: rgba(16, 185, 129, 0.9); }
.toast-error { background: rgba(239, 68, 68, 0.9); }
.toast-info { background: rgba(59, 130, 246, 0.9); }

/* ═══ BUTTONS ═══ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 14px; font-weight: 500; transition: all var(--transition); white-space: nowrap; font-family: inherit; text-decoration: none; line-height: 1.4; }
.btn:focus-visible { outline: 2px solid var(--purple-light); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); color: #fff; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 20px var(--purple-glow); transform: translateY(-1px); filter: brightness(1.1); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(0.97); filter: brightness(0.95); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--purple); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.15); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.15); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-outline { background: transparent; color: var(--purple-light); border: 2px solid var(--purple); }
.btn-outline:hover:not(:disabled) { background: var(--purple); color: #fff; box-shadow: 0 0 20px var(--purple-glow); }
.btn-xl { padding: 16px 36px; font-size: 18px; font-weight: 600; border-radius: var(--radius); }
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }

/* ═══ INPUTS ═══ */
.input { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; transition: border-color var(--transition), box-shadow var(--transition); font-family: inherit; }
.input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-glow); }
.input::placeholder { color: var(--text-dim); }
.input-sm { padding: 6px 10px; font-size: 13px; }
.input-label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
select.input { cursor: pointer; appearance: auto; }
textarea.input { resize: vertical; }

/* ═══ CARDS ═══ */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-sm { padding: 14px; }

/* ═══ LOADING ═══ */
.loading-spinner { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; gap: 12px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--purple); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-lg { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--purple); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 16px; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: var(--radius-sm); color: #fca5a5; }

/* ═══════════════════════════════════════════════════════════ */
/* PUBLIC PAGE STYLES (SSR homepage + pricing)                */
/* ═══════════════════════════════════════════════════════════ */

/* ═══ PUBLIC NAV ═══ */
.pub-nav { background: rgba(10, 10, 15, 0.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.pub-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.pub-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; color: #fff !important; text-decoration: none; }
.pub-brand:hover { color: var(--purple-light) !important; }
.crown-ico { font-size: 28px; }
.pub-nav-links { display: flex; align-items: center; gap: 20px; }
.pub-nav-links a { color: var(--text-muted); font-size: 14px; font-weight: 500; transition: color var(--transition); }
.pub-nav-links a:hover { color: #fff; }

/* ═══ PUBLIC HERO ═══ */
.hero-public { padding: 80px 24px 60px; background: radial-gradient(ellipse at top center, rgba(139, 92, 246, 0.12) 0%, transparent 60%); }
.hero-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.hero-badge-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.hero-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.3); border-radius: 20px; font-size: 13px; color: var(--purple-light); font-weight: 500; }
.hero-h1 { font-size: 48px; font-weight: 800; line-height: 1.15; background: linear-gradient(135deg, #fff 30%, var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 16px; }
.hero-sub { font-size: 20px; color: var(--text-muted); letter-spacing: 2px; font-weight: 500; margin-bottom: 32px; }
.hero-ctas { display: flex; justify-content: center; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }
.trust-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.trust-badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px; font-size: 13px; color: var(--text-muted); }

/* ═══ PRICING HERO ═══ */
.pricing-hero { padding: 60px 24px 40px; background: radial-gradient(ellipse at top center, rgba(139, 92, 246, 0.1) 0%, transparent 60%); }
.pricing-h1 { font-size: 40px; font-weight: 800; background: linear-gradient(135deg, #fff 30%, var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 12px; }

/* ═══ PUBLIC SECTIONS ═══ */
.pub-section { padding: 60px 24px; }
.pub-section-alt { background: var(--bg-card); }
.pub-inner { max-width: 1000px; margin: 0 auto; }
.sec-title { font-size: 28px; font-weight: 700; margin-bottom: 12px; color: #fff; }
.sec-sub { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; }

/* Value cards (3-column) */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 32px; }
.val-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; transition: border-color var(--transition), transform var(--transition); }
.val-card:hover { border-color: var(--purple); transform: translateY(-3px); }
.val-ico { font-size: 36px; margin-bottom: 12px; }
.val-card h3 { font-size: 18px; margin-bottom: 8px; }
.val-card p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.pub-section-alt .val-card { background: var(--bg-dark); }

/* Free highlights */
.free-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 20px; }
.free-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(16, 185, 129, 0.06); border: 1px solid rgba(16, 185, 129, 0.15); border-radius: var(--radius-sm); font-size: 14px; color: var(--text); }
.free-item i { color: var(--green); font-size: 12px; }

/* Model grid */
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.model-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; transition: border-color var(--transition); }
.model-card:hover { border-color: var(--purple); }
.model-card h4 { font-size: 15px; margin-bottom: 4px; color: #fff; }
.model-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.model-tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; background: rgba(16, 185, 129, 0.15); color: var(--green); }
.model-premium { border-color: rgba(139, 92, 246, 0.3); }
.model-premium:hover { border-color: var(--purple); }
.tag-prem { background: rgba(139, 92, 246, 0.2); color: var(--purple-light); }
.pub-section-alt .model-card { background: var(--bg-dark); }

/* Plans row */
.plans-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.plan-card-pub { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; transition: all var(--transition); display: flex; flex-direction: column; }
.plan-card-pub:hover { border-color: var(--purple); transform: translateY(-3px); box-shadow: 0 8px 30px var(--purple-glow); }
.plan-free { }
.plan-premium { border-color: var(--purple); background: linear-gradient(180deg, rgba(139, 92, 246, 0.08) 0%, var(--bg-card) 100%); position: relative; }
.plan-label { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.plan-label-prem { color: var(--purple-light); }
.plan-price-pub { font-size: 32px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.plan-price-pub span { font-size: 16px; font-weight: 400; color: var(--text-muted); }
.plan-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.plan-features { list-style: none; text-align: left; margin-bottom: 24px; flex: 1; }
.plan-features li { padding: 6px 0; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.plan-features li i { font-size: 11px; color: var(--green); flex-shrink: 0; }
.plan-features li strong { color: var(--purple-light); }
.pub-section-alt .plan-card-pub { background: var(--bg-dark); }
.pub-section-alt .plan-premium { background: linear-gradient(180deg, rgba(139, 92, 246, 0.08) 0%, var(--bg-dark) 100%); }

/* Coin packages (public) */
.coins-pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.coin-pub-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; transition: all var(--transition); }
.coin-pub-card:hover { border-color: var(--yellow); transform: translateY(-2px); }
.coin-amt { font-size: 24px; font-weight: 700; color: #fbbf24; margin-bottom: 4px; }
.coin-price { font-size: 16px; font-weight: 600; color: var(--text); }
.coin-bonus { display: block; font-size: 12px; color: var(--green); margin-top: 4px; }

/* CTA section */
.pub-cta-section { background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%); padding: 80px 24px; }

/* Public footer */
.pub-footer { padding: 24px; border-top: 1px solid var(--border); }
.footer-row { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-muted); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; }

/* ═══════════════════════════════════════════════════════════ */
/* SPA STYLES (authenticated app)                             */
/* ═══════════════════════════════════════════════════════════ */

/* ═══ NAVIGATION ═══ */
.main-nav { display: flex; align-items: center; padding: 0 20px; height: 60px; background: var(--bg-sidebar); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px); }
.nav-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; cursor: pointer; margin-right: 24px; color: #fff; }
.nav-brand:hover { color: var(--purple-light); }
.crown-icon { font-size: 24px; }
.nav-links { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-link { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; cursor: pointer; white-space: nowrap; transition: all var(--transition); text-decoration: none; }
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-admin { color: var(--purple-light); }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.coin-badge { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1)); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: 20px; color: #fbbf24; font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.coin-badge:hover { background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.2)); }
.user-menu-wrap { position: relative; }
.user-avatar-btn { background: none; border: none; color: var(--text); font-size: 24px; cursor: pointer; display: flex; align-items: center; padding: 4px; border-radius: 50%; transition: background var(--transition); }
.user-avatar-btn:hover { background: var(--bg-card); }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-dropdown { display: none; position: absolute; right: 0; top: 100%; margin-top: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); min-width: 200px; padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 200; }
.user-menu-wrap.open .user-dropdown { display: block; }
.dropdown-header { padding: 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 500; }
.user-dropdown a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all var(--transition); }
.user-dropdown a:hover { background: var(--bg-card-hover); color: var(--text); }

/* ═══ AUTH PAGES ═══ */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 460px; text-align: center; }
.auth-logo { font-size: 48px; margin-bottom: 12px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-links { margin-top: 16px; display: flex; justify-content: center; gap: 16px; font-size: 13px; }
.version-tag { margin-top: 20px; font-size: 11px; color: var(--text-dim); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; color: var(--text-dim); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
/* Free tier benefits box on signup */
.auth-benefits { text-align: left; background: rgba(16, 185, 129, 0.05); border: 1px solid rgba(16, 185, 129, 0.15); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 4px; }
.auth-benefits h4 { font-size: 13px; font-weight: 600; color: var(--green); margin-bottom: 8px; }
.auth-benefits ul { list-style: none; }
.auth-benefits li { font-size: 12px; color: var(--text-muted); padding: 2px 0; display: flex; align-items: center; gap: 6px; }
.auth-benefits li::before { content: '✓'; color: var(--green); font-weight: 700; font-size: 11px; }
/* Auth form states */
.auth-msg { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px; }
.auth-msg-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
.auth-msg-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* ═══ HOME PAGE (SPA internal) ═══ */
.page-content { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }
.page-title { font-size: 22px; font-weight: 600; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.hero { text-align: center; padding: 60px 20px; }
.hero-title { font-size: 40px; font-weight: 800; background: linear-gradient(135deg, #fff, var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 12px; }
/* .hero-sub defined in public section above */
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.hero-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; color: var(--text-muted); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.feature-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; cursor: pointer; transition: all var(--transition); text-align: center; }
.feature-card:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: 0 5px 20px var(--purple-glow); }
.feature-icon { font-size: 36px; margin-bottom: 12px; }
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { color: var(--text-muted); font-size: 14px; }

/* ═══ STATS ═══ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-icon { font-size: 20px; color: var(--purple-light); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ═══ PROFILE ═══ */
.profile-header { display: flex; align-items: center; gap: 16px; }
.profile-avatar img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.premium-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; background: linear-gradient(135deg, var(--purple), var(--purple-dark)); border-radius: 12px; font-size: 11px; color: #fff; margin-top: 4px; }

/* ═══ TX LIST ═══ */
.tx-list { display: flex; flex-direction: column; gap: 6px; }
.tx-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--bg-input); border-radius: 6px; font-size: 13px; }

/* ═══ PLANS (SPA) ═══ */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-align: center; transition: all var(--transition); }
.plan-card:hover { border-color: var(--purple); }
.plan-price { font-size: 28px; font-weight: 700; color: var(--purple-light); margin: 8px 0; }
.plan-bonus { color: var(--yellow); font-size: 14px; margin: 8px 0 16px; }
.bank-card { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; font-size: 14px; }
.bank-card code { color: var(--purple-light); font-size: 15px; }

/* ═══ COINS (SPA) ═══ */
.coins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.coin-pack-card { background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; transition: all var(--transition); cursor: pointer; }
.coin-pack-card.selected, .coin-pack-card:hover { border-color: var(--purple); box-shadow: 0 0 20px var(--purple-glow); }
.pack-coins { font-size: 22px; font-weight: 700; color: #fbbf24; }
.pack-bonus { color: var(--green); font-size: 12px; margin: 4px 0; }
.pack-price { font-size: 16px; font-weight: 600; color: var(--text); margin: 8px 0 12px; }

/* ═══ ADMIN ═══ */
.admin-page { max-width: 1400px; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn { padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-muted); font-size: 13px; cursor: pointer; white-space: nowrap; transition: all var(--transition); font-family: inherit; }
.tab-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.tab-btn:hover:not(.active) { background: var(--bg-card); color: var(--text); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { padding: 10px 12px; text-align: left; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 500; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.admin-table tr:hover { background: var(--bg-card-hover); }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.admin-msg-list { display: flex; flex-direction: column; gap: 8px; }
.role-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.role-owner { background: rgba(139, 92, 246, 0.2); color: var(--purple-light); }
.role-user { background: rgba(59, 130, 246, 0.2); color: var(--blue); }
.status-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.status-active { color: var(--green); }
.status-pending { color: var(--yellow); }
.status-banned, .status-rejected { color: var(--red); }
.api-key-row { margin-bottom: 12px; }
.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 22px; transition: 0.3s; }
.toggle-slider:before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--purple); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* ═══ CHAT LAYOUT ═══ */
.chat-layout { display: flex; height: calc(100vh - 60px); overflow: hidden; }
.chat-sidebar { width: 280px; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; transition: left 0.3s ease; }
.sidebar-header { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; position: relative; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-list-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); position: relative; margin-bottom: 2px; }
.chat-list-item:hover, .chat-list-item.active { background: var(--bg-card); }
.chat-list-item.active { border-left: 3px solid var(--purple); }
.chat-item-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 50px; }
.chat-item-date { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.chat-item-actions { position: absolute; top: 10px; right: 8px; display: none; gap: 4px; }
.chat-list-item:hover .chat-item-actions { display: flex; }
.chat-item-actions button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.chat-item-actions button:hover { color: var(--text); }

/* Sidebar toggle + close */
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); transition: background var(--transition); }
.sidebar-toggle:hover { background: var(--bg-card); }
.sidebar-close-btn { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all var(--transition); z-index: 10; }
.sidebar-close-btn:hover { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.sidebar-close-btn:active { transform: scale(0.9); }
/* Sidebar overlay for mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; top: 60px; background: rgba(0,0,0,0.5); z-index: 40; }
.sidebar-overlay.active { display: block; }

/* ═══ CHAT MAIN ═══ */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar); }
.chat-model-info { display: flex; align-items: center; gap: 10px; flex: 1; }
.model-dropdown { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 6px 10px; font-size: 13px; max-width: 300px; font-family: inherit; }
.chat-status { font-size: 12px; color: var(--text-dim); }
.status-thinking { color: var(--yellow); }
.status-switching { color: var(--purple-light); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ═══ CHAT MESSAGES ═══ */
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--text-muted); }
.chat-empty-icon { font-size: 48px; margin-bottom: 12px; }
.chat-empty h3 { margin-bottom: 6px; font-size: 20px; color: #fff; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; justify-content: center; }
.chat-suggestions button { padding: 8px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.chat-suggestions button:hover { border-color: var(--purple); color: var(--text); }
.chat-msg { display: flex; gap: 12px; max-width: 850px; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-card); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.msg-user .msg-avatar { background: var(--purple-dark); }
.msg-content { max-width: 700px; }
.msg-text { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.65; word-break: break-word; }
.msg-user .msg-text { background: var(--purple-dark); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai .msg-text { background: var(--bg-card); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.msg-text pre { background: var(--bg-dark); border-radius: 8px; padding: 12px; margin: 8px 0; overflow-x: auto; font-size: 13px; }
.msg-text code { background: rgba(139, 92, 246, 0.15); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.msg-text pre code { background: none; padding: 0; }
.msg-text h2, .msg-text h3, .msg-text h4 { margin: 8px 0 4px; }
.msg-text strong { color: var(--purple-light); }

/* ═══ FALLBACK BANNER ═══ */
.fallback-banner { padding: 8px 16px; background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1)); border-top: 1px solid var(--purple-dark); color: var(--purple-light); font-size: 13px; display: flex; align-items: center; gap: 8px; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ═══ CHAT INPUT ═══ */
.chat-input-area { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-sidebar); }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 16px; padding: 4px 4px 4px 16px; transition: border-color var(--transition); }
.chat-input-wrap:focus-within { border-color: var(--purple); }
.chat-textarea { flex: 1; border: none; background: transparent; color: var(--text); font-size: 14px; padding: 8px 0; resize: none; max-height: 150px; outline: none; line-height: 1.5; font-family: inherit; }
.chat-textarea::placeholder { color: var(--text-dim); }
.chat-send-btn, .chat-stop-btn { width: 40px; height: 40px; border-radius: 12px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: all var(--transition); flex-shrink: 0; font-family: inherit; }
.chat-send-btn { background: var(--purple); color: #fff; }
.chat-send-btn:hover { background: var(--purple-dark); }
.chat-stop-btn { background: var(--red); color: #fff; gap: 4px; font-size: 12px; width: auto; padding: 0 14px; }
.chat-input-info { margin-top: 6px; text-align: center; }

/* ═══ CHARACTERS ═══ */
.characters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.character-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: all var(--transition); }
.character-card:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: 0 5px 20px var(--purple-glow); }
.char-icon { font-size: 40px; margin-bottom: 8px; }

/* ═══ IMAGE GENERATION ═══ */
.image-gen-page { max-width: 1400px; }
.uncensored-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2)); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 20px; font-size: 12px; font-weight: 500; color: #fbbf24; }
.image-gen-layout { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; }
.image-controls-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; position: sticky; top: 80px; }
.img-tabs { display: flex; border-bottom: 1px solid var(--border); }
.img-tab { flex: 1; padding: 12px 8px; background: transparent; border: none; color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: center; gap: 6px; border-bottom: 2px solid transparent; font-family: inherit; }
.img-tab.active { color: var(--purple-light); border-bottom-color: var(--purple); background: rgba(139, 92, 246, 0.05); }
.img-tab:hover:not(.active) { background: var(--bg-card-hover); }
.img-tab-content { display: none; padding: 16px; }
.img-tab-content.active { display: block; }
.form-group { margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; }
.advanced-settings { margin-top: 12px; }
.advanced-settings summary { padding: 8px 12px; background: var(--bg-input); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; list-style: none; }
.advanced-settings summary::-webkit-details-marker { display: none; }
.advanced-settings summary::before { content: '▸'; transition: transform 0.2s; }
.advanced-settings[open] summary::before { transform: rotate(90deg); }
.advanced-settings summary:hover { color: var(--text); }

/* Edit mode */
.edit-source-area { margin-bottom: 0; }
.edit-source-preview { width: 100%; max-height: 250px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.edit-upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 20px; text-align: center; cursor: pointer; transition: border-color var(--transition); color: var(--text-dim); }
.edit-upload-zone:hover { border-color: var(--purple); color: var(--text-muted); }
.edit-examples { margin-top: 12px; }
.edit-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-chips button { padding: 4px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 16px; color: var(--text-muted); font-size: 12px; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.edit-chips button:hover { border-color: var(--purple); color: var(--text); }

/* Image results */
.image-results-panel { min-height: 300px; }
.img-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.img-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; }
.img-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; gap: 12px; color: var(--text-muted); }
.img-result-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all var(--transition); }
.img-result-card:hover { border-color: var(--purple); box-shadow: 0 5px 20px var(--purple-glow); }
.img-result-wrapper { position: relative; min-height: 200px; display: flex; align-items: center; justify-content: center; background: var(--bg-dark); }
.img-result-wrapper img { width: 100%; height: auto; display: block; }
.img-result-actions { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.img-result-meta { padding: 6px 12px 10px; display: flex; gap: 12px; font-size: 11px; color: var(--text-dim); flex-wrap: wrap; }

/* Image history */
.history-item { display: flex; gap: 10px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition); border-bottom: 1px solid var(--border); }
.history-item:hover { background: var(--bg-card-hover); }
.history-thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.history-info { flex: 1; min-width: 0; }
.history-info p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════════════════════ */
/* RESPONSIVE                                                 */
/* ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .image-gen-layout { grid-template-columns: 1fr; }
  .image-controls-panel { position: static; }
}

@media (max-width: 768px) {
  /* SPA nav */
  .main-nav { padding: 0 12px; }
  .nav-links { display: none; }
  .nav-brand { font-size: 15px; }
  .sidebar-toggle { display: block; }
  /* Chat sidebar mobile */
  .chat-sidebar { position: fixed; left: -280px; top: 60px; bottom: 0; z-index: 50; transition: left 0.3s ease; }
  .chat-sidebar.open { left: 0; box-shadow: 0 0 30px rgba(0,0,0,0.5); }
  /* Public pages */
  .hero-h1 { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .hero-ctas { flex-direction: column; align-items: center; }
  .hero-ctas .btn-xl { width: 100%; max-width: 360px; }
  .hero-public { padding: 50px 16px 40px; }
  .pricing-hero { padding: 40px 16px 30px; }
  .pricing-h1 { font-size: 28px; }
  .pub-section { padding: 40px 16px; }
  .plans-row { grid-template-columns: 1fr 1fr; }
  .sec-title { font-size: 22px; }
  .trust-row { gap: 8px; }
  .trust-badge { font-size: 11px; padding: 6px 12px; }
  /* Other */
  .hero-title { font-size: 28px; }
  .plans-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .admin-tabs { flex-wrap: nowrap; }
  .img-results-grid { grid-template-columns: 1fr; }
  .chat-msg { max-width: 100%; }
  .msg-content { max-width: calc(100% - 44px); }
}

@media (max-width: 480px) {
  .hero-h1 { font-size: 26px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .hero-ctas .btn-xl { font-size: 15px; padding: 14px 20px; }
  .plans-row { grid-template-columns: 1fr; }
  .coins-pub-grid { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .coins-grid { grid-template-columns: repeat(2, 1fr); }
  .characters-grid { grid-template-columns: repeat(2, 1fr); }
  .pub-nav-inner { padding: 0 16px; }
  .pub-nav-links { gap: 12px; }
  .free-highlights { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .char-edit-btns { flex-direction: row; }
}

/* ═══ v7.0.0 — Profile Card ═══ */
.profile-card { background: var(--bg-card); border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.profile-banner { height: 120px; background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark, #6a3de8) 50%, #1a1a2e 100%); position: relative; }
.profile-body { padding: 0 24px 24px; text-align: center; position: relative; }
.profile-avatar-lg { width: 90px; height: 90px; border-radius: 50%; background: var(--bg-card); border: 4px solid var(--bg-card); display: flex; align-items: center; justify-content: center; margin: -45px auto 12px; overflow: hidden; font-size: 48px; color: var(--purple-light); }
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-name { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.profile-handle { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; }
.profile-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.profile-prem-exp { font-size: 13px; color: var(--purple-light); margin: 0 0 16px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.prof-stat { text-align: center; }
.prof-stat-val { font-size: 22px; font-weight: 700; color: var(--text); }
.prof-stat-lbl { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-joined { font-size: 13px; color: var(--text-dim); margin: 0; }

/* ═══ Badges ═══ */
.badge-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--bg-card-hover); color: var(--text-muted); }
.badge-premium { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.badge-admin { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
.badge-free { background: var(--bg-card-hover); color: var(--text-muted); }

/* ═══ Premium Active Card ═══ */
.prem-active-card { background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(168,85,247,0.08)); border: 1px solid rgba(124,58,237,0.3); border-radius: 16px; padding: 24px; text-align: center; margin-bottom: 20px; }
.prem-active-icon { font-size: 48px; color: var(--purple-light); margin-bottom: 8px; }
.prem-active-card h3 { font-size: 24px; font-weight: 700; color: #a855f7; margin: 0 0 12px; }
.prem-active-card p { color: var(--text-muted); margin: 4px 0; }
.prem-active-card p strong { color: var(--text); }
.prem-active-perks { display: grid; gap: 8px; margin-top: 16px; text-align: left; max-width: 340px; margin-left: auto; margin-right: auto; }
.prem-active-perks div { color: var(--text-muted); font-size: 14px; }
.prem-active-perks i { color: #22c55e; margin-right: 6px; }

/* ═══ Characters Enhancements ═══ */
.char-desc { font-size: 13px; color: var(--text-muted); margin: 4px 0 8px; line-height: 1.4; min-height: 36px; }
.char-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
.char-custom-badge { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.char-builtin-badge { background: var(--bg-card-hover); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.char-actions { margin-top: auto; }
.char-edit-btns { display: flex; gap: 4px; margin-top: 6px; }
.char-create-form { border: 1px solid var(--purple); border-radius: 12px; }
.form-row { display: flex; gap: 12px; }

/* ═══ v7.0 Additions ═══ */
.card-title { font-size: 16px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card-sm { padding: 16px; }
.admin-msg-list { display: flex; flex-direction: column; gap: 8px; }
.mb-2 { margin-bottom: 8px; }
