:root {
  --bg: #0c0c0e; --surface: rgba(255,255,255,0.035); --surface-solid: #141416;
  --border: rgba(255,255,255,0.06); --border-hover: rgba(255,255,255,0.12);
  --accent: #c8f542; --accent-dim: rgba(200,245,66,0.12); --accent2: #42d9c5;
  --accent2-dim: rgba(66,217,197,0.1);
  --text: #ffffff; --text-secondary: rgba(255,255,255,0.88);
  --text-muted: rgba(255,255,255,0.5); --danger: #ff5c5c;
  --radius: 14px; --radius-sm: 8px; --radius-xs: 6px;
  --font-display: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --transition: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; }
body { background: var(--bg); color: var(--text); font-family: var(--font-mono); min-height: 100vh; -webkit-font-smoothing: antialiased; }
body::before { content: ''; position: fixed; top: -40%; left: -20%; width: 80vw; height: 80vw; background: radial-gradient(circle, rgba(200,245,66,0.04) 0%, transparent 70%); pointer-events: none; z-index: 0; animation: drift 20s ease-in-out infinite alternate; }
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(40px,-30px) scale(1.08); } }

header {
  position: sticky; top: 0; z-index: 100; padding: 0 36px; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(12,12,14,0.8); backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.logo { cursor: pointer; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-badge { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--accent); background: var(--accent-dim); border: 1px solid rgba(200,245,66,0.2); padding: 5px 10px; border-radius: 6px; transition: all 0.35s var(--transition); }
.logo:hover .logo-badge { background: var(--accent); color: #0c0c0e; }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.04em; color: var(--text); opacity: 0.85; }
.header-right { display: flex; align-items: center; gap: 14px; }
.header-link { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-secondary); text-decoration: none; padding: 7px 14px; transition: all 0.25s var(--transition); }
.header-link:hover { color: var(--accent); }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.74rem;
  padding: 7px 14px; border-radius: 100px; cursor: pointer;
  transition: all 0.25s var(--transition);
}
.user-btn:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.06); }
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-dim); display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 600; color: var(--accent);
}
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 200px; background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 12px 40px rgba(0,0,0,0.5); overflow: hidden;
}
.user-dropdown.show { display: block; }
.user-dropdown-item {
  display: block; width: 100%; padding: 10px 14px; background: none;
  border: none; border-bottom: 1px solid var(--border); color: var(--text-secondary);
  font-family: var(--font-mono); font-size: 0.68rem; cursor: pointer;
  text-align: left; text-decoration: none; transition: background 0.15s;
}
.user-dropdown-item:hover { background: rgba(255,255,255,0.04); }
.user-dropdown-item:last-child { border-bottom: none; }
.user-dropdown-item.danger { color: var(--danger); }

.dash-container { max-width: 900px; margin: 0 auto; padding: 32px 24px; position: relative; z-index: 1; }
.dash-welcome { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -0.03em; margin-bottom: 4px; }
.dash-plan { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 32px; }
.dash-plan #plan-badge { color: var(--accent); background: var(--accent-dim); padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.dash-plan #plan-badge.admin { color: #0c0c0e; background: var(--accent2); font-weight: 700; }
.dash-plan .billing { color: var(--text-muted); background: none; padding: 0; font-size: 0.6rem; margin-left: 6px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat-card { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 16px; }
.stat-label { font-size: 0.58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; letter-spacing: -0.02em; }
.stat-value.accent { color: var(--accent); }
.stat-value.warn { color: #f59e0b; }
.stat-value.danger { color: var(--danger); }
.stat-value.admin { color: var(--accent2); font-size: 2rem; }
.stat-sub { font-size: 0.58rem; color: var(--text-muted); margin-top: 4px; }

/* Credits bar */
.credits-section { margin-bottom: 32px; }
.credits-title { font-family: var(--font-display); font-weight: 600; font-size: 0.88rem; margin-bottom: 16px; letter-spacing: -0.01em; }
.credits-bar-container { margin-bottom: 16px; }
.credits-bar-label { display: flex; justify-content: space-between; font-size: 0.62rem; color: var(--text-muted); margin-bottom: 6px; }
.credits-bar-bg { width: 100%; height: 12px; background: var(--surface); border-radius: 6px; overflow: hidden; }
.credits-bar { height: 100%; border-radius: 6px; transition: width 0.6s var(--transition); }
.credits-bar.ok { background: var(--accent); }
.credits-bar.warn { background: #f59e0b; }
.credits-bar.full { background: var(--danger); }

/* Usage by feature */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 24px; }
.usage-chip {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-xs); font-size: 0.6rem;
}
.usage-chip-label { color: var(--text-secondary); }
.usage-chip-value { color: var(--accent); font-weight: 500; }
.usage-empty { font-size: 0.6rem; color: var(--text-muted); }

/* Action buttons */
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.action-btn {
  padding: 10px 18px; font-family: var(--font-mono); font-size: 0.68rem;
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.25s var(--transition);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.action-btn--primary {
  background: var(--accent); color: #0c0c0e; border: none; font-weight: 600;
}
.action-btn--primary:hover { box-shadow: 0 0 20px rgba(200,245,66,0.35); transform: translateY(-1px); }
.action-btn--secondary {
  background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border);
}
.action-btn--secondary:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.06); }

/* Upgrade banner */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(200,245,66,0.08) 0%, rgba(66,217,197,0.06) 100%);
  border: 1px solid rgba(200,245,66,0.15); border-radius: var(--radius);
  padding: 24px; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 32px;
}
.upgrade-text {}
.upgrade-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.upgrade-desc { font-size: 0.68rem; color: var(--text-secondary); line-height: 1.5; }
.upgrade-btn {
  flex-shrink: 0; padding: 12px 24px;
  background: var(--accent); color: #0c0c0e; border: none;
  border-radius: var(--radius-sm); font-family: var(--font-display);
  font-weight: 600; font-size: 0.82rem; cursor: pointer;
  transition: all 0.25s var(--transition);
}
.upgrade-btn:hover { box-shadow: 0 0 20px rgba(200,245,66,0.35); transform: translateY(-1px); }

/* Quick actions */
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 32px; }
.action-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: all 0.25s var(--transition);
}
.action-card:hover { border-color: var(--accent); background: rgba(200,245,66,0.03); transform: translateY(-2px); }
.action-icon { width: 36px; height: 36px; border-radius: var(--radius-xs); background: var(--accent-dim); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.action-title { font-family: var(--font-display); font-weight: 600; font-size: 0.78rem; }
.action-desc { font-size: 0.58rem; color: var(--text-muted); margin-top: 2px; }

/* Toast notifications */
.toast {
  position: fixed; top: 80px; right: 20px; z-index: 200;
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.7rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: slideIn 0.3s var(--transition);
  display: none;
}
.toast.success { background: rgba(200,245,66,0.15); border: 1px solid rgba(200,245,66,0.3); color: var(--accent); display: block; }
.toast.error { background: rgba(255,92,92,0.15); border: 1px solid rgba(255,92,92,0.3); color: var(--danger); display: block; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

@media (max-width: 600px) {
  .upgrade-banner { flex-direction: column; text-align: center; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .action-row { flex-direction: column; }
}
