:root {
  --sidebar-width: 250px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --topbar-bg: #ffffff;
  --content-bg: #f1f5f9;
  --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --card-hover-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --gradient-primary: linear-gradient(135deg, #2563eb, #1d4ed8);
  --gradient-success: linear-gradient(135deg, #10b981, #059669);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --gradient-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --gradient-info: linear-gradient(135deg, #06b6d4, #0891b2);
  --profit-color: #10b981;
  --loss-color: #ef4444;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--content-bg);
  min-height: 100vh;
}

.wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.sidebar-nav {
  flex: 1;
  padding: .75rem 0;
  overflow-y: auto;
}

.sidebar-nav .nav-section {
  padding: .5rem 1.5rem .25rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  font-weight: 600;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  padding: .625rem 1.5rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: all .2s;
  gap: .75rem;
  font-size: .875rem;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav .nav-item.active {
  background: rgba(37,99,235,.15);
  color: #60a5fa;
  border-left-color: var(--sidebar-active);
}

.sidebar-nav .nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255,255,255,.8);
  font-size: .875rem;
}

.sidebar-footer .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
}

.sidebar-footer .mode-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.mode-badge.live {
  background: rgba(16,185,129,.2);
  color: #34d399;
}

.mode-badge.paper {
  background: rgba(245,158,11,.2);
  color: #fbbf24;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--topbar-bg);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  position: sticky;
  top: 0;
  z-index: 999;
}

.topbar .page-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}

.topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.page-content {
  padding: 1.5rem;
  flex: 1;
}

.stat-card {
  border: none;
  border-radius: 12px;
  transition: all .3s ease;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  position: relative;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-hover-shadow);
}

.stat-card .card-body {
  padding: 1.25rem;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .75rem;
}

.stat-card .stat-label {
  font-size: .8rem;
  color: rgba(255,255,255,.75);
  margin-bottom: .25rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.stat-card .stat-footer {
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  margin-top: .25rem;
}

.stat-card.primary {
  background: var(--gradient-primary);
}

.stat-card.success {
  background: var(--gradient-success);
}

.stat-card.warning {
  background: var(--gradient-warning);
}

.stat-card.danger {
  background: var(--gradient-danger);
}

.stat-card.info {
  background: var(--gradient-info);
}

.content-card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.content-card .card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.content-card .card-body {
  padding: 1.25rem;
}

.table-custom {
  margin-bottom: 0;
}

.table-custom thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
  padding: .75rem 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.table-custom tbody td {
  padding: .75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: .875rem;
}

.table-custom tbody tr:hover {
  background: #f8fafc;
}

.table-custom tbody tr:last-child td {
  border-bottom: none;
}

.badge-status {
  padding: .3rem .65rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-radius: 6px;
}

.badge-buy {
  background: rgba(16,185,129,.12);
  color: #059669;
}

.badge-sell {
  background: rgba(239,68,68,.12);
  color: #dc2626;
}

.badge-active {
  background: rgba(16,185,129,.12);
  color: #059669;
}

.badge-inactive {
  background: rgba(100,116,139,.12);
  color: #475569;
}

.badge-filled {
  background: rgba(16,185,129,.12);
  color: #059669;
}

.badge-pending {
  background: rgba(245,158,11,.12);
  color: #d97706;
}

.badge-cancelled {
  background: rgba(239,68,68,.12);
  color: #dc2626;
}

.profit-text {
  color: var(--profit-color);
  font-weight: 600;
}

.loss-text {
  color: var(--loss-color);
  font-weight: 600;
}

.btn-gradient {
  border: none;
  color: #fff;
  padding: .5rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: .875rem;
  transition: all .2s;
}

.btn-gradient-primary {
  background: var(--gradient-primary);
}

.btn-gradient-primary:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}

.btn-gradient-success {
  background: var(--gradient-success);
}

.btn-gradient-success:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,.4);
}

.btn-gradient-danger {
  background: var(--gradient-danger);
}

.btn-gradient-danger:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239,68,68,.4);
}

.btn-gradient-warning {
  background: var(--gradient-warning);
  color: #fff;
}

.btn-gradient-warning:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,158,11,.4);
}

.btn-gradient-info {
  background: var(--gradient-info);
}

.btn-gradient-info:hover {
  opacity: .9;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6,182,212,.4);
}

.btn-outline-custom {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  padding: .5rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: .875rem;
  transition: all .2s;
}

.btn-outline-custom:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0;
}

.alert-custom {
  border: none;
  border-radius: 10px;
  padding: .875rem 1.25rem;
  font-size: .875rem;
}

.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  padding: .5rem .875rem;
  font-size: .875rem;
  transition: all .2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--sidebar-active);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-label {
  font-weight: 600;
  font-size: .8rem;
  color: #475569;
  margin-bottom: .35rem;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
  overflow: hidden;
}

.auth-card .auth-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}

.auth-card .auth-header .auth-logo {
  width: 56px;
  height: 56px;
  background: var(--gradient-primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  margin: 0 auto 1rem;
}

.auth-card .auth-header h3 {
  font-weight: 700;
  color: #1e293b;
  margin-bottom: .25rem;
}

.auth-card .auth-header p {
  color: #94a3b8;
  font-size: .875rem;
}

.auth-card .auth-body {
  padding: 1rem 2rem 2rem;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp .4s ease forwards;
}
