* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0A0A0F;
  --bg2: #0E0E15;
  --surface: #111118;
  --surface2: #1A1A24;
  --border: #2A2A3A;
  --text: #F0FDF4;
  --text2: #9CA3AF;
  --accent: #10B981;
  --accent2: #34D399;
  --accent-glow: #6EE7B7;
  --red: #EF4444;
  --yellow: #F59E0B;
  --blue: #3B82F6;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 1100px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-glow); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ═══ TOPBAR ═══ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 56px; display: flex; align-items: center;
}

.topbar-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
  width: 100%; display: flex; align-items: center; justify-content: space-between;
}

.topbar-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }

.topbar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; color: var(--bg);
}

.topbar-logo-text { font-size: .9rem; font-weight: 400; }
.topbar-logo-text strong { font-weight: 800; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-plan {
  font-size: .75rem; font-weight: 600; color: var(--accent);
  background: rgba(16,185,129,.1); padding: 4px 12px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: .5px;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  color: var(--text2); font-size: .85rem; position: relative;
}

.topbar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: var(--accent);
}

.topbar-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); min-width: 180px; padding: 6px 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.5); display: none;
}

.topbar-dropdown.open { display: block; }

.topbar-dropdown a, .topbar-dropdown button {
  display: block; width: 100%; text-align: left; padding: 10px 16px;
  font-size: .85rem; color: var(--text2); background: none; border: none;
  cursor: pointer; font-family: var(--font);
}
.topbar-dropdown a:hover, .topbar-dropdown button:hover { background: var(--surface2); color: var(--text); }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 700;
  text-decoration: none; transition: all var(--transition); border: none; cursor: pointer;
  font-family: var(--font); line-height: 1;
}

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent2); box-shadow: 0 0 24px rgba(16,185,129,.3); color: var(--bg); }

.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent2); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }

.btn-sm { padding: 8px 16px; font-size: .8rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block; font-size: .8rem; font-weight: 600; color: var(--text2);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: .9rem;
  font-family: var(--font); transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
}

.form-textarea { min-height: 120px; resize: vertical; }
.form-input::placeholder { color: var(--text2); opacity: .6; }

.form-error { color: var(--red); font-size: .8rem; margin-top: 4px; }
.form-help { color: var(--text2); font-size: .78rem; margin-top: 4px; }

/* ═══ CARDS ═══ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; transition: border-color .3s;
}
.card:hover { border-color: rgba(16,185,129,.3); }

.card-grid { display: grid; gap: 20px; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ═══ TOKEN BAR ═══ */
.token-bar { margin-top: 12px; }

.token-bar-track {
  height: 8px; background: var(--surface2); border-radius: 100px;
  overflow: hidden;
}

.token-bar-fill {
  height: 100%; border-radius: 100px; transition: width .5s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.token-bar-fill.warning { background: linear-gradient(90deg, var(--yellow), #D97706); }
.token-bar-fill.danger { background: linear-gradient(90deg, var(--red), #DC2626); }

.token-bar-labels {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: .75rem; color: var(--text2);
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center; padding: 80px 24px;
}

.empty-state-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  background: rgba(16,185,129,.1); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}

.empty-state-icon svg { width: 32px; height: 32px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.empty-state h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.empty-state p { color: var(--text2); font-size: .9rem; margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* ═══ ALERTS ═══ */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start;
}

.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2); color: #FCA5A5; }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); color: var(--accent2); }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); color: #FCD34D; }

/* ═══ LOADING ═══ */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .6s linear infinite; display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(10,10,15,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; flex-direction: column; gap: 16px;
}

.loading-text { color: var(--text2); font-size: .9rem; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,10,15,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 480px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.modal h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--text2); font-size: .9rem; margin-bottom: 24px; }

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ═══ BADGE ═══ */
.badge {
  display: inline-flex; padding: 3px 10px; border-radius: 100px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}

.badge-green { background: rgba(16,185,129,.15); color: var(--accent2); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-red { background: rgba(239,68,68,.15); color: #FCA5A5; }
.badge-blue { background: rgba(59,130,246,.15); color: #93C5FD; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .card-grid-2, .card-grid-3 { grid-template-columns: 1fr; }
  .topbar-plan { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .btn { padding: 10px 18px; font-size: .85rem; }
}
