/* ==========================================================================
   Infinity AI Global — Dashboard
   Design tokens
   ========================================================================== */
:root{
  --bg-deep: #0A1220;
  --bg-deep-alt: #0D1728;
  --bg-panel: #101B2D;
  --bg-panel-alt: #16233A;
  --bg-panel-raised: #1B2A42;

  --accent-gold: #E8A63D;
  --accent-gold-soft: rgba(232,166,61,0.14);
  --accent-cyan: #35D0C4;
  --accent-cyan-soft: rgba(53,208,196,0.14);
  --accent-rose: #E8677A;
  --accent-rose-soft: rgba(232,103,122,0.14);

  --text-primary: #EDF1F7;
  --text-muted: #8592A9;
  --text-faint: #5B6B85;

  --border-soft: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --sidebar-w: 250px;
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin:0;
  background:
    radial-gradient(1100px 560px at 85% -10%, rgba(232,166,61,0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(53,208,196,0.06), transparent 55%),
    var(--bg-deep);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,h2,h3,h4, .brand-name, .num-value, .hero-value{
  font-family: "Space Grotesk", "Inter", sans-serif;
}

a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }

::selection{ background: var(--accent-gold); color:#111; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.app-shell{
  display:flex;
  min-height: 100vh;
}

.sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-deep-alt), var(--bg-deep) 85%);
  border-right: 1px solid var(--border-soft);
  padding: 24px 16px 20px;
  position: fixed;
  top:0; left:0; bottom:0;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .32s cubic-bezier(.4,0,.2,1);
}

.sidebar::-webkit-scrollbar{ width:6px; }
.sidebar::-webkit-scrollbar-thumb{ background: var(--border-strong); border-radius:6px; }

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 4px 10px 22px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark{
  width:36px; height:36px;
  border-radius: 10px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--accent-gold), #C97F1F);
  box-shadow: 0 4px 16px rgba(232,166,61,0.35);
  flex-shrink:0;
}
.brand-mark svg{ width:20px; height:20px; }
.brand-name{
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .2px;
}
.brand-name small{
  display:block;
  font-family: "Inter", sans-serif;
  font-size: .68rem;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: .3px;
}

.nav-group{ margin-top: 18px; }
.nav-group-label{
  font-size: .7rem;
  color: var(--text-faint);
  padding: 0 10px 8px;
  font-weight: 600;
}

.nav-link{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  position: relative;
  transition: background .18s ease, color .18s ease;
}
.nav-link svg{ width:18px; height:18px; opacity:.85; flex-shrink:0; }
.nav-link:hover{
  background: var(--bg-panel-alt);
  color: var(--text-primary);
}
.nav-link.active{
  background: linear-gradient(90deg, var(--accent-gold-soft), transparent);
  color: var(--accent-gold);
}
.nav-link.active::before{
  content:"";
  position:absolute;
  left:-16px; top:50%; transform: translateY(-50%);
  width:4px; height:20px;
  border-radius: 0 4px 4px 0;
  background: var(--accent-gold);
}
.nav-link.active svg{ opacity:1; }

.sidebar-overlay{
  position: fixed; inset:0;
  background: rgba(4,8,16,.6);
  backdrop-filter: blur(2px);
  z-index: 1030;
  opacity:0; pointer-events:none;
  transition: opacity .25s ease;
}
.sidebar-overlay.show{ opacity:1; pointer-events:auto; }

/* ==========================================================================
   Main column
   ========================================================================== */
.main-col{
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 60px;
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(120deg, var(--bg-panel), var(--bg-panel-alt));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
}
.topbar-left{ display:flex; align-items:center; gap:14px; }
.menu-btn{
  display:none;
  width:38px; height:38px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  align-items:center; justify-content:center;
  flex-shrink:0;
}
.greeting-eyebrow{
  color: var(--text-muted);
  font-size: .8rem;
  margin: 0 0 2px;
  display:flex; align-items:center; gap:6px;
}
.greeting-title{
  margin:0;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 600;
}
.greeting-title span{ color: var(--accent-gold); }

.bell-btn{
  position:relative;
  width:42px; height:42px;
  border-radius: 50%;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-soft);
  display:grid; place-items:center;
  flex-shrink:0;
}
.bell-btn svg{ width:18px; height:18px; color: var(--text-muted); }
.bell-dot{
  position:absolute; top:9px; right:10px;
  width:8px; height:8px; border-radius:50%;
  background: var(--accent-rose);
  box-shadow: 0 0 0 3px var(--bg-panel-raised);
}
.bell-dot.pulse::after{
  content:"";
  position:absolute; inset:0;
  border-radius:50%;
  background: var(--accent-rose);
  animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing{
  0%{ transform: scale(1); opacity:.6; }
  100%{ transform: scale(2.6); opacity:0; }
}

/* ==========================================================================
   Hero row
   ========================================================================== */
.hero-row{
  display:grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
@media (max-width: 900px){
  .hero-row{ grid-template-columns: 1fr; }
}

.hero-card{
  position:relative;
  border-radius: var(--radius-lg);
  padding: 26px 26px 20px;
  overflow:hidden;
  background: linear-gradient(150deg, #16233F, #101A2C 65%);
  border: 1px solid var(--border-soft);
  isolation: isolate;
}
.hero-card::before{
  content:"";
  position:absolute; inset:-1px;
  padding:1px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(232,166,61,.55), rgba(53,208,196,0), rgba(232,166,61,0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index:1;
}
.hero-label{
  color: var(--text-muted);
  font-size: .82rem;
  margin: 0 0 6px;
}
.hero-value{
  font-size: clamp(2.1rem, 4vw, 2.7rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -.5px;
}
.hero-delta{
  display:inline-flex; align-items:center; gap:5px;
  margin-top:10px;
  font-size:.78rem;
  color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.hero-sparkline{ width:100%; height:64px; margin-top:16px; display:block; }
.hero-sparkline path.line{
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawLine 1.4s .3s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes drawLine{ to{ stroke-dashoffset: 0; } }

.mini-card{
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  display:flex;
  flex-direction: column;
  justify-content:center;
  gap: 10px;
}
.mini-card .icon-badge{ margin-bottom: 2px; }
.mini-card .num-label{ margin:0; }
.mini-card .num-value{ font-size: 1.5rem; }

.badge-status{
  display:inline-flex; align-items:center; gap:7px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-gold);
}
.badge-status svg{ width:20px; height:20px; }

/* ==========================================================================
   Stat groups
   ========================================================================== */
.section-heading{
  display:flex; align-items:center; gap:10px;
  margin: 26px 0 12px;
}
.section-heading .bar{
  width:4px; height:16px; border-radius:3px;
}
.section-heading h2{
  font-size: .95rem;
  font-weight: 600;
  margin:0;
  color: var(--text-primary);
}
.section-heading .count{
  color: var(--text-faint);
  font-size: .8rem;
  margin-left: 2px;
}

.stat-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px){ .stat-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px){ .stat-grid{ grid-template-columns: 1fr; } }

.stat-card{
  position:relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 18px 18px 20px;
  overflow:hidden;
  transition: transform .22s ease, border-color .22s ease, background .22s ease;
}
.stat-card::before{
  content:"";
  position:absolute; left:0; top:0; bottom:0;
  width:3px;
}
.stat-card.gold::before{ background: var(--accent-gold); }
.stat-card.cyan::before{ background: var(--accent-cyan); }
.stat-card.rose::before{ background: var(--accent-rose); }

.stat-card:hover{
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--bg-panel-alt);
}

.icon-badge{
  width:38px; height:38px;
  border-radius: 10px;
  display:grid; place-items:center;
  margin-bottom: 12px;
}
.icon-badge svg{ width:19px; height:19px; }
.icon-badge.gold{ background: var(--accent-gold-soft); color: var(--accent-gold); }
.icon-badge.cyan{ background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.icon-badge.rose{ background: var(--accent-rose-soft); color: var(--accent-rose); }

.num-label{
  color: var(--text-muted);
  font-size: .78rem;
  margin: 0 0 4px;
}
.num-value{
  font-size: 1.4rem;
  font-weight: 700;
  margin:0;
  letter-spacing: -.3px;
}
.num-value.negative{ color: var(--accent-rose); }

/* ==========================================================================
   Referral bar
   ========================================================================== */
.referral-bar{
  margin-top: 26px;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  background: linear-gradient(120deg, var(--bg-panel), var(--bg-panel-alt));
  border: 1px solid var(--border-soft);
  display:flex;
  align-items:center;
  gap: 18px;
  flex-wrap: wrap;
}
.referral-copy{ flex-shrink:0; min-width: 160px; }
.referral-copy p{ margin:0; color: var(--text-muted); font-size: .78rem; }
.referral-copy h3{ margin: 2px 0 0; font-size: 1.02rem; font-weight: 600; }

.referral-input-wrap{
  flex:1;
  min-width: 240px;
  display:flex;
  align-items:center;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 4px 4px 4px 14px;
  gap: 10px;
}
.referral-input-wrap input{
  flex:1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: .85rem;
  padding: 10px 0;
  min-width: 0;
}
.copy-btn{
  flex-shrink:0;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: .82rem;
  color: #111;
  background: linear-gradient(120deg, var(--accent-gold), #F2C069);
  transition: filter .15s ease, transform .1s ease;
}
.copy-btn:active{ transform: scale(.97); }
.copy-btn:hover{ filter: brightness(1.08); }
.copy-btn.copied{ background: linear-gradient(120deg, var(--accent-cyan), #6EE7DA); }

/* ==========================================================================
   Load-in stagger (single orchestrated sequence)
   ========================================================================== */
.reveal{
  opacity:0;
  transform: translateY(10px);
  animation: revealUp .5s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes revealUp{ to{ opacity:1; transform: translateY(0); } }

/* ==========================================================================
   Inner page: Team table
   ========================================================================== */
.page-head{
  display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:14px;
  margin-bottom: 18px;
}
.page-head h1{ font-size: 1.3rem; margin:0; font-weight:600; }
.page-head p{ margin: 4px 0 0; color: var(--text-muted); font-size:.85rem; }

.filter-pills{ display:flex; gap:8px; flex-wrap:wrap; }
.pill{
  padding: 7px 14px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  background: var(--bg-panel);
}
.pill.active{
  color: #111;
  background: var(--accent-gold);
  border-color: transparent;
}

.team-table-wrap{
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.team-table{
  width:100%;
  border-collapse: collapse;
}
.team-table thead th{
  text-align:left;
  font-size: .72rem;
  color: var(--text-faint);
  font-weight: 600;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.team-table tbody td{
  padding: 14px 20px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  vertical-align: middle;
}
.team-table tbody tr:last-child td{ border-bottom:none; }
.team-table tbody tr{ transition: background .15s ease; }
.team-table tbody tr:hover{ background: var(--bg-panel-alt); }

.member-cell{ display:flex; align-items:center; gap:12px; }
.avatar-chip{
  width:34px; height:34px;
  border-radius: 50%;
  display:grid; place-items:center;
  font-size: .75rem;
  font-weight:700;
  color:#111;
  background: linear-gradient(135deg, var(--accent-gold), #F2C069);
  flex-shrink:0;
}
.member-name{ font-weight:600; font-size:.85rem; }
.member-id{ color: var(--text-faint); font-size:.72rem; }

.status-chip{
  display:inline-flex; align-items:center; gap:6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.status-chip.active{ background: var(--accent-cyan-soft); color: var(--accent-cyan); }
.status-chip.pending{ background: var(--accent-gold-soft); color: var(--accent-gold); }
.status-chip::before{ content:""; width:6px; height:6px; border-radius:50%; background: currentColor; }

/* mobile card fallback for team table */
@media (max-width: 720px){
  .team-table thead{ display:none; }
  .team-table, .team-table tbody, .team-table tr, .team-table td{ display:block; width:100%; }
  .team-table tbody tr{
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
  }
  .team-table tbody td{
    border:none;
    padding: 6px 4px;
    display:flex;
    justify-content: space-between;
    align-items:center;
  }
  .team-table tbody td::before{
    content: attr(data-label);
    color: var(--text-faint);
    font-size: .72rem;
    font-weight:600;
  }
  .team-table tbody td.member-td::before{ display:none; }
}

/* ==========================================================================
   Responsive: sidebar collapse
   ========================================================================== */
@media (max-width: 991px){
  .sidebar{ transform: translateX(-100%); }
  .sidebar.show{ transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.4); }
  .main-col{ margin-left: 0; padding-left: 16px; padding-right:16px; }
  .menu-btn{ display:inline-flex; }
}

@media (max-width: 600px){
  .topbar{ padding: 16px 18px; border-radius: var(--radius-md); }
  .referral-bar{ padding: 18px; }
}
