﻿:root {
  --bg: #0f172a; --bg2: #1e293b; --bg3: #334155;
  --card: rgba(30,41,59,.85); --card-border: rgba(99,102,241,.15);
  --primary: #6366f1; --primary-hover: #818cf8; --accent: #8b5cf6;
  --green: #22c55e; --red: #ef4444; --yellow: #eab308; --orange: #f97316;
  --text: #f1f5f9; --text2: #94a3b8; --text3: #64748b;
  --radius: 12px; --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow: 0 4px 24px rgba(0,0,0,.3);
  --glow: 0 0 30px rgba(99,102,241,.15);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* NAV */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(15,23,42,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--card-border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 1.25rem; font-weight: 800; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-icon { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; font-weight: 700; }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { color: var(--text2); font-size: .9rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.user-email { color: var(--text2); font-size: .85rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; border: none; cursor: pointer; transition: all .15s ease; text-decoration: none; font-family: var(--font); }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 2px 12px rgba(99,102,241,.3); }
.btn-primary:hover { box-shadow: 0 4px 20px rgba(99,102,241,.45); }
.btn-outline { background: transparent; color: var(--text2); border: 1px solid var(--bg3); }
.btn-outline:hover { color: var(--text); border-color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }

/* HERO */
.hero { padding: 100px 0 80px; text-align: center; background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99,102,241,.15), transparent); }
.badge { display: inline-block; padding: 6px 16px; border-radius: 20px; background: rgba(99,102,241,.12); color: var(--primary-hover); font-size: .8rem; font-weight: 600; border: 1px solid rgba(99,102,241,.2); margin-bottom: 24px; }
.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.15; margin-bottom: 20px; }
.gradient-text { background: linear-gradient(135deg, var(--primary-hover), var(--accent), #c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { color: var(--text2); font-size: 1.15rem; max-width: 600px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; margin-bottom: 48px; }
.hero-code { max-width: 640px; margin: 0 auto; text-align: left; background: var(--bg2); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.code-header { display: flex; align-items: center; gap: 6px; padding: 10px 16px; background: rgba(0,0,0,.2); border-bottom: 1px solid var(--card-border); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ef4444; } .dot.yellow { background: #eab308; } .dot.green { background: #22c55e; }
.code-title { margin-left: 8px; font-size: .75rem; color: var(--text3); }
.hero-code pre { padding: 16px; overflow-x: auto; }
.hero-code code, .doc-card code { font-family: var(--mono); font-size: .82rem; color: #c4b5fd; line-height: 1.7; }

/* SECTIONS */
section { padding: 80px 0; }
section h2 { font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: 12px; }
.section-sub { text-align: center; color: var(--text2); margin-bottom: 40px; }

/* FEATURES */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.feature-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 28px; transition: all .2s ease; }
.feature-card:hover { border-color: var(--primary); box-shadow: var(--glow); transform: translateY(-2px); }
.feature-icon { font-size: 1.8rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.feature-card p { color: var(--text2); font-size: .9rem; }

/* PRICING */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
.pricing-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 28px; position: relative; transition: all .2s ease; }
.pricing-card:hover { border-color: var(--primary); box-shadow: var(--glow); }
.pricing-card.featured { border-color: var(--primary); box-shadow: var(--glow); }
.popular-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; padding: 4px 16px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.pricing-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; font-family: var(--mono); }
.model-desc { color: var(--text3); font-size: .82rem; margin-bottom: 16px; }
.price-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: .88rem; }
.price-label { color: var(--text2); }
.price-value { font-weight: 600; font-family: var(--mono); }
.price-value small { color: var(--text3); font-weight: 400; }
.peak-badge { display: inline-block; background: rgba(249,115,22,.15); color: var(--orange); font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; margin-left: 6px; }
.credit-packages { text-align: center; }
.credit-packages h3 { margin-bottom: 16px; }
.pkg-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pkg { display: inline-block; padding: 10px 24px; background: var(--bg2); border: 1px solid var(--card-border); border-radius: var(--radius-sm); font-weight: 700; font-size: 1.1rem; }

/* DOCS */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.doc-card { background: var(--bg2); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.doc-card h3 { padding: 14px 20px; border-bottom: 1px solid var(--card-border); font-size: .95rem; }
.doc-card pre { padding: 16px 20px; overflow-x: auto; }

/* FOOTER */
.footer { padding: 40px 0; text-align: center; border-top: 1px solid var(--card-border); color: var(--text2); font-size: .9rem; }
.footer-sub { color: var(--text3); font-size: .8rem; margin-top: 6px; }

/* AUTH */
.auth-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.auth-card h2 { text-align: center; margin-bottom: 24px; font-size: 1.4rem; }
.auth-card input, .modal input { width: 100%; padding: 12px 16px; background: var(--bg); border: 1px solid var(--bg3); border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; margin-bottom: 14px; font-family: var(--font); outline: none; transition: border-color .15s; }
.auth-card input:focus, .modal input:focus { border-color: var(--primary); }
.auth-toggle { text-align: center; margin-top: 16px; font-size: .88rem; color: var(--text2); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 14px; }
.alert-error { background: rgba(239,68,68,.1); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.alert-success { background: rgba(34,197,94,.1); color: #86efac; border: 1px solid rgba(34,197,94,.2); }
.alert-info { background: rgba(99,102,241,.1); color: #a5b4fc; border: 1px solid rgba(99,102,241,.2); }

/* DASHBOARD */
.dash-header { display: flex; align-items: center; justify-content: space-between; margin: 32px 0 24px; flex-wrap: wrap; gap: 16px; }
.dash-header h1 { font-size: 1.6rem; }
.balance-card { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px 24px; }
.balance-label { color: var(--text2); font-size: .85rem; }
.balance-value { font-size: 1.5rem; font-weight: 800; font-family: var(--mono); color: var(--green); }
.dash-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.dash-card h2 { font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { margin-bottom: 0; }

/* KEYS */
.keys-list { display: flex; flex-direction: column; gap: 10px; }
.key-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,.05); gap: 12px; flex-wrap: wrap; }
.key-text { font-family: var(--mono); font-size: .82rem; color: var(--text2); word-break: break-all; flex: 1; min-width: 200px; }
.key-actions { display: flex; gap: 8px; }
.empty-state { text-align: center; padding: 32px; color: var(--text3); font-size: .9rem; }

/* USAGE */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.usage-card { background: var(--bg); border-radius: var(--radius-sm); padding: 16px; border: 1px solid rgba(255,255,255,.05); }
.usage-card h4 { font-family: var(--mono); font-size: .88rem; margin-bottom: 10px; color: var(--primary-hover); }
.usage-stat { display: flex; justify-content: space-between; font-size: .82rem; padding: 3px 0; }
.usage-stat span:first-child { color: var(--text3); }
.usage-stat span:last-child { font-family: var(--mono); font-weight: 500; }

/* TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 10px 12px; color: var(--text3); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--bg3); }
td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
tr:hover td { background: rgba(99,102,241,.04); }
.model-badge { display: inline-block; padding: 2px 10px; background: rgba(99,102,241,.12); color: var(--primary-hover); border-radius: 4px; font-size: .78rem; font-family: var(--mono); }

/* PACKAGES */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pkg-card { background: var(--bg); border: 1px solid var(--bg3); border-radius: var(--radius-sm); padding: 20px 16px; text-align: center; cursor: pointer; transition: all .15s ease; }
.pkg-card:hover { border-color: var(--primary); box-shadow: var(--glow); transform: translateY(-2px); }
.pkg-card .amount { font-size: 1.4rem; font-weight: 800; font-family: var(--mono); }
.pkg-card .label { color: var(--text3); font-size: .78rem; margin-top: 4px; }

/* REFERRAL */
.referral-box { background: var(--bg); border: 1px solid rgba(139,92,246,.2); border-radius: var(--radius-sm); padding: 20px; }
.referral-code { font-family: var(--mono); font-size: 1.3rem; font-weight: 700; color: var(--accent); letter-spacing: 3px; }
.referral-link { font-family: var(--mono); font-size: .8rem; color: var(--text2); word-break: break-all; margin: 8px 0; }
.referral-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.ref-stat { text-align: center; padding: 12px; background: rgba(139,92,246,.06); border-radius: var(--radius-sm); }
.ref-stat .v { font-size: 1.3rem; font-weight: 700; font-family: var(--mono); }
.ref-stat .l { font-size: .75rem; color: var(--text3); margin-top: 2px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg2); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 32px; max-width: 420px; width: 90%; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 16px; font-size: 1.2rem; }
.modal p { color: var(--text2); font-size: .9rem; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }

/* TOAST */
.toast-msg { position: fixed; bottom: 24px; right: 24px; padding: 14px 24px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; z-index: 300; transform: translateY(20px); opacity: 0; transition: all .3s ease; box-shadow: var(--shadow); max-width: 400px; }
.toast-msg.show { transform: translateY(0); opacity: 1; }
.toast-success { background: #166534; color: #bbf7d0; border: 1px solid #22c55e; }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid #ef4444; }
.toast-info { background: #1e3a5f; color: #bfdbfe; border: 1px solid #3b82f6; }

/* ADMIN */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 18px; text-align: center; }
.kpi .v { font-size: 1.4rem; font-weight: 800; font-family: var(--mono); }
.kpi .l { font-size: .75rem; color: var(--text3); margin-top: 4px; }
.kpi.green .v { color: var(--green); } .kpi.red .v { color: var(--red); }
.kpi.purple .v { color: var(--accent); } .kpi.orange .v { color: var(--orange); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab { padding: 8px 20px; background: transparent; border: 1px solid var(--bg3); border-radius: var(--radius-sm); color: var(--text2); cursor: pointer; font-size: .85rem; font-weight: 500; font-family: var(--font); transition: all .15s; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab:hover:not(.active) { border-color: var(--primary); color: var(--text); }
.pane { display: none; } .pane.active { display: block; }
.note { padding: 12px 16px; background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.2); border-radius: var(--radius-sm); color: #fde68a; font-size: .85rem; margin-bottom: 16px; }
.peak-indicator { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 12px; font-size: .78rem; font-weight: 600; }
.peak-on { background: rgba(249,115,22,.15); color: var(--orange); }
.peak-off { background: rgba(34,197,94,.1); color: var(--green); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .docs-grid { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .referral-stats { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
