/* ===================== RESET & BASE ===================== */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --purple: #a855f7;
  --dark: #0f172a;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e6e9f2;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(30, 41, 59, 0.06);
  --shadow-hover: 0 16px 40px rgba(30, 41, 59, 0.12);
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

/* ===================== AUTH PAGES ===================== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.auth-bg-shapes { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.shape { position: absolute; border-radius: 50%; opacity: .18; background: #fff; filter: blur(2px); animation: float 8s ease-in-out infinite; }
.shape1 { width: 260px; height: 260px; top: -60px; left: -60px; }
.shape2 { width: 180px; height: 180px; bottom: -40px; right: 10%; animation-delay: 1.5s; }
.shape3 { width: 130px; height: 130px; top: 30%; right: -40px; animation-delay: 3s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-25px) scale(1.05); }
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

.auth-logo { display:flex; align-items:center; gap:10px; justify-content:center; margin-bottom: 6px; }
.logo-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff; display:flex; align-items:center; justify-content:center;
  font-weight: 800; font-size: 20px;
  box-shadow: 0 6px 16px rgba(99,102,241,0.4);
}
.auth-logo h1 { font-size: 26px; font-weight: 800; color: var(--dark); }
.auth-logo h1 span { color: var(--primary); }

.auth-subtitle { text-align:center; color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }

.auth-form .form-group { margin-bottom: 16px; }
.form-group label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-main); }
.form-group input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); font-family: inherit; font-size: 14px;
  transition: all .2s ease; background: #fbfbfe;
}
.form-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.12); background: #fff; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: all .2s ease; box-shadow: 0 6px 16px rgba(99,102,241,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(99,102,241,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; margin-top: 6px; }

.auth-footer { text-align:center; margin-top: 22px; font-size: 13.5px; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration:none; }
.auth-footer a:hover { text-decoration: underline; }

.alert-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px;
}

.fade-in-up { animation: fadeInUp .5s ease both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== APP SHELL ===================== */
.app-body { background: var(--bg); }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; background: linear-gradient(180deg, #1e1b4b, #0f172a);
  color: #fff; display: flex; flex-direction: column; padding: 26px 18px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo { display:flex; align-items:center; gap:10px; margin-bottom: 34px; padding: 0 8px; }
.sidebar-logo h1 { font-size: 22px; font-weight: 800; color: #fff; }
.sidebar-logo h1 span { color: #818cf8; }

.sidebar-nav { display:flex; flex-direction:column; gap: 4px; flex: 1; }
.nav-item {
  display:flex; align-items:center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; color: #cbd5e1; text-decoration:none; font-size: 14.5px;
  font-weight: 500; transition: all .2s ease; cursor:pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), #818cf8); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,0.35); }
.nav-icon { font-size: 17px; }

.sidebar-footer { margin-top: auto; padding-top: 20px; }
.logout-btn {
  display:block; text-align:center; padding: 11px; border-radius: 10px;
  background: rgba(239,68,68,0.15); color: #fca5a5; text-decoration:none;
  font-weight: 600; font-size: 13.5px; transition: all .2s ease;
}
.logout-btn:hover { background: rgba(239,68,68,0.28); color: #fff; }

.main-content { flex: 1; padding: 28px 34px; max-width: 100%; overflow-x: hidden; }

.topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.topbar h2 { font-size: 24px; font-weight: 700; }
.muted { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }

.topbar-networth {
  background: linear-gradient(135deg, var(--dark), #312e81);
  color: #fff; padding: 14px 26px; border-radius: var(--radius);
  display:flex; flex-direction:column; align-items:flex-end;
  box-shadow: var(--shadow);
}
.topbar-networth .label { font-size: 12px; opacity:.75; }
.topbar-networth .value { font-size: 24px; font-weight: 800; margin-top:2px; transition: all .3s ease; }
.topbar-networth .value.positive { color: #6ee7b7; }
.topbar-networth .value.negative { color: #fca5a5; }

/* ===================== TABS ===================== */
.tab-content { display: none; animation: fadeIn .35s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ===================== STAT CARDS ===================== */
.stats-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
  border-radius: var(--radius); padding: 22px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease; cursor:default;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.stat-icon { font-size: 26px; margin-bottom: 10px; opacity: .95; }
.stat-label { font-size: 13px; opacity: .9; font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 6px; }

.gradient-green  { background: linear-gradient(135deg, #10b981, #059669); }
.gradient-red     { background: linear-gradient(135deg, #ef4444, #dc2626); }
.gradient-blue    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.gradient-purple  { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.gradient-orange  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.gradient-dark    { background: linear-gradient(135deg, #334155, #0f172a); }

/* ===================== CHARTS ===================== */
.charts-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.chart-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.chart-card h3 { font-size: 15px; margin-bottom: 14px; color: var(--text-main); }

/* ===================== SECTION / TABLE ===================== */
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 18px; }
.section-header h3 { font-size: 19px; font-weight:700; }

.table-card { background: var(--card-bg); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); overflow-x:auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th {
  text-align:left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 14px 16px; border-bottom: 2px solid var(--border);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #f8f9fd; }
.data-table tbody tr:last-child td { border-bottom: none; }

.tag { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-green  { background:#d1fae5; color:#065f46; }
.tag-red    { background:#fee2e2; color:#991b1b; }
.tag-blue   { background:#dbeafe; color:#1e40af; }
.tag-orange { background:#fef3c7; color:#92400e; }
.tag-purple { background:#f3e8ff; color:#6b21a8; }

.text-green { color: var(--green); font-weight: 700; }
.text-red   { color: var(--red); font-weight: 700; }

.icon-btn {
  background: #f1f5f9; border:none; width: 32px; height: 32px; border-radius: 8px;
  cursor:pointer; font-size: 14px; margin-right: 6px; transition: all .15s ease;
}
.icon-btn:hover { background: #e2e8f0; transform: scale(1.08); }
.icon-btn.danger:hover { background: #fee2e2; }

/* ===================== MODALS ===================== */
.modal-overlay {
  display:none; position: fixed; inset:0; background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px); align-items:center; justify-content:center; z-index: 999;
  animation: fadeIn .2s ease;
}
.modal-overlay.show { display:flex; }
.modal-box {
  background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 420px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.3); animation: fadeInUp .25s ease; max-height: 90vh; overflow-y:auto;
}
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom: 18px; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background:none; border:none; font-size: 24px; cursor:pointer; color: var(--text-muted); line-height:1; }
.modal-close:hover { color: var(--text-main); }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--dark); color:#fff;
  padding: 14px 20px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25); transform: translateY(120%); opacity:0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1); z-index: 1200;
}
.toast.show { transform: translateY(0); opacity:1; }
.toast.error { background: #b91c1c; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width:100%; height:auto; position:relative; flex-direction:row; align-items:center; padding: 14px 16px; }
  .sidebar-logo { margin-bottom:0; }
  .sidebar-nav { flex-direction:row; overflow-x:auto; flex:none; }
  .sidebar-footer { margin-top:0; margin-left:auto; padding-top:0; }
  .nav-item span.nav-icon { font-size: 16px; }
  .nav-item { white-space:nowrap; padding: 9px 12px; }
  .main-content { padding: 20px; }
}
