* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0d13;
  --surface: #111720;
  --surface2: #1a2333;
  --border: #1e2d40;
  --accent: #00aaff;
  --accent2: #00d4aa;
  --danger: #ff4444;
  --warn: #ffaa00;
  --text: #e2e8f0;
  --muted: #64748b;
  --green: #22c55e;
  --red: #ef4444;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* AUTH */
.auth-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 400px;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo h1 {
  font-size: 2rem; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo p { color: var(--muted); font-size: 0.875rem; margin-top: 0.25rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.65rem 0.9rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.btn {
  width: 100%; padding: 0.75rem;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.error-msg {
  background: rgba(255,68,68,0.12); border: 1px solid var(--danger);
  color: var(--red); border-radius: 8px; padding: 0.65rem 0.9rem;
  font-size: 0.875rem; margin-bottom: 1rem;
}
.success-msg {
  background: rgba(34,197,94,0.12); border: 1px solid var(--green);
  color: var(--green); border-radius: 8px; padding: 0.65rem 0.9rem;
  font-size: 0.875rem; margin-bottom: 1rem;
}
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }

/* MOBILE NAV TOGGLE */
.hamburger {
  display: none;
  position: fixed; top: 0.9rem; left: 0.9rem; z-index: 1001;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 0.45rem 0.65rem; font-size: 1.1rem; cursor: pointer;
  line-height: 1;
}
.nav-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 998;
}
body.nav-open .nav-overlay { display: block; }

/* DASHBOARD LAYOUT */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem; flex-shrink: 0;
  display: flex; flex-direction: column;
}
.sidebar .logo {
  font-size: 1.4rem; font-weight: 700; margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar nav a {
  display: block; padding: 0.6rem 0.75rem;
  border-radius: 8px; color: var(--muted);
  font-size: 0.9rem; margin-bottom: 0.25rem;
  transition: all 0.15s;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--surface2); color: var(--text); text-decoration: none;
}
.sidebar .spacer { flex: 1; }
.sidebar .user-info { font-size: 0.8rem; color: var(--muted); padding: 0.5rem 0; }
.main { flex: 1; padding: 2rem; overflow-y: auto; min-width: 0; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* CARDS */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem;
}
.card .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.card .value { font-size: 1.75rem; font-weight: 700; }
.card .value.green { color: var(--green); }
.card .value.red { color: var(--red); }
.card .change { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* TABLES */
.section { margin-bottom: 2rem; }
.section h2 { font-size: 1rem; font-weight: 600; color: var(--muted); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 400px; }
th { text-align: left; padding: 0.75rem 1rem; font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 0.75rem 1rem; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* PROGRESS BAR */
.progress-bar { background: var(--border); border-radius: 99px; height: 6px; margin-top: 4px; }
.progress-fill { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }

/* EMPTY STATE */
.empty { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.9rem; }

/* BADGE */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
}
.badge-bank { background: rgba(0,170,255,0.15); color: var(--accent); }
.badge-trading_bot { background: rgba(0,212,170,0.15); color: var(--accent2); }
.badge-sportsbook { background: rgba(255,170,0,0.15); color: var(--warn); }
.badge-investment { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-cash { background: rgba(100,116,139,0.15); color: var(--muted); }
.badge-credit_card { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-other { background: rgba(100,116,139,0.15); color: var(--muted); }

/* ACTION BUTTONS */
.btn-action {
  padding: 0.5rem 1rem;
  border: none; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-action:hover { opacity: 0.82; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-teal { background: var(--accent2); color: #0a0d13; }
.btn-green { background: var(--green); color: #0a0d13; }
.btn-cancel { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

/* SMALL BUTTONS */
.btn-xs {
  padding: 0.25rem 0.6rem;
  border: none; border-radius: 6px;
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-xs:hover { opacity: 0.82; }
.btn-xs.btn-accent { background: rgba(0,170,255,0.2); color: var(--accent); }
.btn-xs.btn-green { background: rgba(34,197,94,0.2); color: var(--green); }
.btn-xs.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn-xs.btn-cancel { background: var(--surface2); color: var(--muted); }

/* FORM CARD */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.form-card-title {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 1rem; color: var(--text);
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 1rem; }

/* ─── MOBILE RESPONSIVE ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    position: fixed; top: 0; left: -250px; height: 100vh;
    z-index: 999; width: 230px;
    transition: left 0.25s ease;
    overflow-y: auto;
  }
  body.nav-open .sidebar { left: 0; }

  .main {
    padding: 1rem;
    padding-top: 3.75rem;
  }

  /* Single column on small screens */
  .cards { grid-template-columns: 1fr 1fr; }

  /* Stack form rows */
  .form-row { flex-direction: column; gap: 0; }

  /* Full-width tables with horizontal scroll */
  .table-wrap { border-radius: 8px; }

  /* Hero sections — stack vertically */
  .opp-hero, .explains-hero {
    flex-direction: column; align-items: flex-start; gap: 1rem;
    padding: 1.25rem;
  }
  .opp-hero-stats { gap: 1rem; }

  /* Opportunity grid — single column */
  .opp-grid { grid-template-columns: 1fr !important; }

  /* Profile grid — 2 cols on mobile */
  .profile-grid { grid-template-columns: 1fr 1fr !important; }

  /* Freedom page */
  .freedom-hero { padding: 1.5rem; }
  .freedom-number { font-size: 3.5rem; }
  .freedom-grid { grid-template-columns: 1fr !important; }

  /* Page title */
  .page-title { font-size: 1.25rem; }

  /* Ensure inputs are full width and touch-friendly */
  input, select, textarea, button {
    font-size: 16px !important; /* prevents iOS zoom */
  }
  .btn-action { padding: 0.65rem 1rem; }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr !important; }
  .main { padding: 0.75rem; padding-top: 3.5rem; }
}
