/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --bg-base: #07090d;
  --bg-surface: #0f1620;
  --bg-elevated: #161e2c;
  --bg-input: #0a1018;
  --border: #1f2733;
  --border-strong: #2a3445;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #5d6675;
  --accent: #f0b90b;
  --accent-dim: rgba(240, 185, 11, 0.12);
  --accent-glow: rgba(240, 185, 11, 0.35);
  --green: #3fb950;
  --green-dim: rgba(63, 185, 80, 0.12);
  --red: #f85149;
  --red-dim: rgba(248, 81, 73, 0.12);
  --blue: #58a6ff;
  --purple: #a371f7;
  --gradient-card: linear-gradient(135deg, rgba(240,185,11,0.05) 0%, rgba(88,166,255,0.03) 100%);
  --shadow-glow: 0 0 24px rgba(240, 185, 11, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* ─── Animated background gradient orbs ─────────────────────────────────── */
.bg-orbs::before, .bg-orbs::after {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.bg-orbs::before { background: rgba(240,185,11,0.07); top: -200px; left: -200px; }
.bg-orbs::after { background: rgba(88,166,255,0.05); bottom: -200px; right: -200px; animation-delay: -9s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(60px, -40px); }
  66% { transform: translate(-40px, 60px); }
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  background: rgba(15,22,32,0.7);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 32px;
  padding: 4px 8px;
}
.sidebar-brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #ff8c00);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #0d1117; font-weight: 900; font-size: 18px;
  box-shadow: var(--shadow-glow);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 4px;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item .icon { width: 18px; height: 18px; display: inline-flex; }
.nav-section { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; padding: 16px 12px 6px; }

.main { padding: 32px; overflow-x: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar .user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 999px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; color: #07090d; font-weight: 700; font-size: 13px; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.card-glow {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
}
.card-glow::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}
.card-title { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; margin-bottom: 8px; }
.card-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.card-value.green { color: var(--green); }
.card-value.red { color: var(--red); }
.card-meta { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }

/* ─── Grid layouts ──────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } .app-shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  background: var(--accent); color: #0d1117;
  padding: 10px 16px; border-radius: 8px; border: none;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: all 0.18s; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn.danger { background: var(--red); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); }
.btn.outline:hover { border-color: var(--accent); color: var(--accent); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.full { width: 100%; justify-content: center; }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.helper { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: var(--bg-input); border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.check-row:hover { border-color: var(--accent); }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: auto; margin-top: 3px; accent-color: var(--accent); }
.check-row strong { display: block; color: var(--text-primary); font-size: 14px; }
.check-row small { color: var(--text-muted); font-size: 12px; }

/* ─── Pills / chips / badges ────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.pill.green { background: var(--green-dim); color: var(--green); border-color: rgba(63,185,80,0.3); }
.pill.red { background: var(--red-dim); color: var(--red); border-color: rgba(248,81,73,0.3); }
.pill.accent { background: var(--accent-dim); color: var(--accent); border-color: rgba(240,185,11,0.3); }
.pill.blue { background: rgba(88,166,255,0.12); color: var(--blue); border-color: rgba(88,166,255,0.3); }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; letter-spacing: 0.05em; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.table tr:hover { background: var(--bg-elevated); }
.table tr:last-child td { border-bottom: none; }

/* ─── Animations ────────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.4s ease both; }
.slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > * { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 2s ease-in-out infinite; }

/* ─── Auth / centered pages ─────────────────────────────────────────────── */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 440px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px; box-shadow: var(--shadow-card); }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-secondary); margin-bottom: 24px; font-size: 14px; }

/* ─── Onboarding stepper ────────────────────────────────────────────────── */
.stepper { display: flex; gap: 8px; margin-bottom: 24px; }
.stepper .dot { flex: 1; height: 4px; background: var(--border); border-radius: 2px; transition: background 0.3s; }
.stepper .dot.done { background: var(--accent); }
.step { display: none; }
.step.active { display: block; animation: slideUp 0.4s ease; }

/* ─── Plan cards ────────────────────────────────────────────────────────── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; padding: 24px; cursor: pointer; transition: all 0.2s; position: relative; }
.plan-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.plan-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow); }
.plan-card .price { font-size: 32px; font-weight: 800; color: var(--accent); margin: 8px 0; }
.plan-card .price small { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.plan-card ul { list-style: none; margin-top: 16px; }
.plan-card ul li { padding: 4px 0; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.plan-card ul li::before { content: '✓'; color: var(--green); font-weight: 700; }

/* ─── Toast / alerts ────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.alert.info { background: rgba(88,166,255,0.12); color: var(--blue); border: 1px solid rgba(88,166,255,0.3); }
.alert.warn { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(240,185,11,0.3); }
.alert.danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,81,73,0.3); }
.alert.success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(63,185,80,0.3); }

/* ─── Chat ──────────────────────────────────────────────────────────────── */
.chat-window { display: flex; flex-direction: column; height: 70vh; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 78%; padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.55; animation: slideUp 0.3s; }
.chat-msg.user { background: var(--accent-dim); color: var(--text-primary); align-self: flex-end; border: 1px solid rgba(240,185,11,0.2); }
.chat-msg.assistant { background: var(--bg-elevated); color: var(--text-primary); align-self: flex-start; border: 1px solid var(--border); }
.chat-msg pre { background: #07090d; padding: 12px; border-radius: 6px; margin: 8px 0; font-size: 12px; overflow-x: auto; border: 1px solid var(--border); }
.chat-input-row { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--border); background: var(--bg-surface); }
.chat-input-row input { flex: 1; }
