/* ==========================================================
   HSC Crackers — Call Center
   Token system
   ========================================================== */
:root{
  --bg-void:      #0a0c09;
  --bg-surface:   #131610;
  --bg-elevated:  #1a1e15;
  --bg-elevated-2:#20251a;
  --border:       #262c1e;
  --border-soft:  #1d2216;

  --lime:         #cbff3d;
  --lime-dim:     #8fcb1f;
  --lime-glow:    rgba(203,255,61,0.16);

  --text-primary: #f2f5ec;
  --text-muted:   #929a86;
  --text-faint:   #5d6455;

  --danger:       #ff5c5c;
  --danger-bg:    rgba(255,92,92,0.12);
  --amber:        #ffc857;
  --amber-bg:     rgba(255,200,87,0.12);
  --ok-bg:        rgba(203,255,61,0.12);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --sidebar-w: 248px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

::selection{ background: var(--lime); color:#0a0c09; }

.hidden{ display:none !important; }

button{ font-family: inherit; cursor:pointer; }
input{ font-family: inherit; }

/* ---------- decorative chevron field ---------- */
.signal-field{
  position: fixed;
  inset: 0;
  color: var(--lime);
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================
   LOGIN VIEW
   ========================================================== */
.login-view{
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
}

.login-card{
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  position: relative;
  overflow: hidden;
}

.login-card::before{
  content:"";
  position:absolute;
  top:-60px; right:-60px;
  width:180px; height:180px;
  background: radial-gradient(circle, var(--lime-glow) 0%, transparent 70%);
  pointer-events:none;
}

.login-brand{ display:flex; justify-content:center; margin-bottom: 20px; }
.login-logo{ height: 44px; width:auto; filter: drop-shadow(0 0 24px var(--lime-glow)); }

.login-eyebrow{
  text-align:center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lime-dim);
  margin: 0 0 10px;
}

.login-title{
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  text-align:center;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.login-sub{
  text-align:center;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height:1.5;
  margin: 0 0 28px;
}

.login-form{ display:flex; flex-direction:column; gap:16px; }

.field{ display:flex; flex-direction:column; gap:7px; }
.field-label{
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.field-input{
  background: var(--bg-void);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field-input::placeholder{ color: var(--text-faint); }
.field-input:focus{
  border-color: var(--lime-dim);
  box-shadow: 0 0 0 3px var(--lime-glow);
}

.login-error{
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--danger);
  min-height: 0;
}
.login-error:empty{ display:none; }

.btn-primary{
  margin-top: 6px;
  background: var(--lime);
  color: #0a0c09;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  transition: transform .1s ease, box-shadow .15s ease, opacity .15s ease;
  box-shadow: 0 12px 30px -10px var(--lime-glow);
}
.btn-primary:hover{ transform: translateY(-1px); }
.btn-primary:active{ transform: translateY(0); }
.btn-primary:disabled{ opacity:0.7; cursor:not-allowed; transform:none; }

.btn-spinner{
  width:14px; height:14px;
  border-radius:50%;
  border: 2px solid rgba(10,12,9,0.25);
  border-top-color: #0a0c09;
  display:none;
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading .btn-spinner{ display:inline-block; }
.btn-primary.is-loading .btn-label{ opacity: 0.85; }

@keyframes spin{ to{ transform: rotate(360deg); } }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app-shell{
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display:flex;
}

/* ---------- sidebar (desktop) ---------- */
.sidebar{
  width: var(--sidebar-w);
  flex-shrink:0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding: 22px 16px;
  position: sticky;
  top:0;
  height:100vh;
}

.sidebar-top{ padding: 6px 8px 26px; }
.sidebar-logo{ height: 30px; width:auto; }

.nav-list{ display:flex; flex-direction:column; gap:4px; flex:1; }

.nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  background:none;
  border:none;
  color: var(--text-muted);
  text-align:left;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover{ background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.is-active{ background: var(--bg-elevated-2); color: var(--lime); }

.nav-chevron{
  font-size: 11px;
  transform: scaleX(-1);
  color: var(--text-faint);
  transition: color .15s ease, transform .15s ease;
}
.nav-item.is-active .nav-chevron{ color: var(--lime); transform: scaleX(-1) translateX(-2px); }

.sidebar-bottom{ display:flex; flex-direction:column; gap:10px; padding-top: 14px; border-top: 1px solid var(--border-soft); }

.user-card{ display:flex; align-items:center; gap:10px; padding: 6px 4px; }
.user-avatar{
  width:36px; height:36px; border-radius:50%;
  background: var(--lime);
  color:#0a0c09;
  font-family: var(--font-display);
  font-weight:700;
  font-size:14px;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.user-meta{ display:flex; flex-direction:column; min-width:0; }
.user-name{ font-size:13px; font-weight:600; color: var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-email{ font-size:11.5px; color: var(--text-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.btn-ghost{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight:600;
  transition: border-color .15s ease, color .15s ease;
}
.btn-ghost:hover{ border-color: var(--danger); color: var(--danger); }

/* ---------- mobile top bar / bottom tabs (hidden on desktop) ---------- */
.mobile-topbar, .mobile-tabs{ display:none; }

/* ---------- content ---------- */
.content{
  flex:1;
  min-width:0;
  padding: 40px 44px 60px;
}

.view{ display:none; animation: fadein .25s ease; }
.view.is-active{ display:block; }
@keyframes fadein{ from{ opacity:0; transform: translateY(6px); } to{ opacity:1; transform:none; } }

.view-header{ margin-bottom: 28px; }
.view-eyebrow{
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing:0.14em;
  text-transform: uppercase;
  color: var(--lime-dim);
  margin: 0 0 6px;
}
.view-title{
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---------- state blocks (loading / error / empty) ---------- */
.state-block{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  text-align:center;
}
.state-error{ color: var(--danger); }
.loader{
  width: 26px; height:26px;
  border-radius:50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--lime);
  animation: spin .8s linear infinite;
}
.link-btn{
  background:none; border:none; padding:0;
  color: var(--lime); font-weight:600; text-decoration: underline;
  font-size: inherit;
}

.empty-note{ padding: 26px; text-align:center; color: var(--text-faint); font-size: 13px; }

/* ---------- stat grid ---------- */
.stat-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card{
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.stat-featured{
  grid-column: span 2;
  background: linear-gradient(135deg, var(--bg-elevated-2), var(--bg-surface));
  border-color: var(--lime-dim);
  position: relative;
  overflow:hidden;
}
.stat-featured::after{
  content:"";
  position:absolute; right:-30px; top:-30px;
  width:120px; height:120px;
  background: radial-gradient(circle, var(--lime-glow), transparent 70%);
}
.stat-wide{ grid-column: span 4; }

.stat-label{ font-size: 12px; color: var(--text-muted); font-weight:600; letter-spacing:0.01em; }
.stat-value{ font-family: var(--font-display); font-size: 26px; font-weight:600; letter-spacing:-0.01em; }
.stat-featured .stat-value{ color: var(--lime); font-size: 32px; }
.stat-foot{ font-size:11.5px; color: var(--text-faint); }

/* ---------- profile card ---------- */
.profile-card{
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
}
.profile-eyebrow{
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
}
.profile-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.profile-grid > div{ display:flex; flex-direction:column; gap:4px; }
.profile-span{ grid-column: span 2; }
.profile-k{ font-size:11.5px; color: var(--text-faint); }
.profile-v{ font-size: 14px; color: var(--text-primary); font-weight:500; }

/* ---------- table blocks ---------- */
.table-block{ margin-bottom: 30px; }
.table-block-head{ display:flex; align-items:center; gap:10px; margin-bottom: 12px; }
.table-block-head h3{ font-family: var(--font-display); font-size:16px; font-weight:600; margin:0; }
.count-pill{
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight:700;
  padding: 2px 9px;
  border-radius: 999px;
}

.table-scroll{
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.data-table{
  width:100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 640px;
}
.data-table thead th{
  text-align:left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space:nowrap;
}
.data-table tbody td{
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  vertical-align: middle;
  white-space:nowrap;
}
.data-table tbody tr:last-child td{ border-bottom:none; }
.data-table tbody tr:hover{ background: var(--bg-elevated); }

.code-chip{
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--lime);
  padding: 4px 9px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.mono{ font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }
.num{ font-variant-numeric: tabular-nums; }
.earn{ color: var(--lime); font-weight:600; }

.badge{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size: 11px;
  font-weight:700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}
.badge::before{ content:""; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge-active, .badge-paid{ background: var(--ok-bg); color: var(--lime); }
.badge-expired, .badge-failed{ background: var(--danger-bg); color: var(--danger); }
.badge-pending{ background: var(--amber-bg); color: var(--amber); }

/* ==========================================================
   RESPONSIVE — MOBILE
   ========================================================== */
@media (max-width: 860px){
  .sidebar{ display:none; }

  .mobile-topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    position: sticky;
    top:0;
    z-index: 5;
    background: rgba(10,12,9,0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
  }
  .mobile-logo{ height:24px; }
  .icon-btn{
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 34px; height:34px;
    border-radius: 999px;
    font-size: 16px;
    display:flex; align-items:center; justify-content:center;
  }

  .app-shell{ flex-direction:column; }
  .content{ padding: 22px 16px 90px; }

  .stat-grid{ grid-template-columns: repeat(2, 1fr); }
  .stat-featured{ grid-column: span 2; }
  .stat-wide{ grid-column: span 2; }
  .profile-grid{ grid-template-columns: 1fr; }
  .profile-span{ grid-column: span 1; }

  .mobile-tabs{
    display:flex;
    position: fixed;
    bottom:0; left:0; right:0;
    z-index: 5;
    background: rgba(19,22,16,0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  .tab-item{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
    background:none;
    border:none;
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight:600;
    padding: 6px 0;
    border-radius: var(--radius-sm);
  }
  .tab-item.is-active{ color: var(--lime); }
  .tab-chevron{ font-size: 13px; transform: rotate(-90deg); }
  .tab-item.is-active .tab-chevron{ transform: rotate(-90deg) translateX(-2px); }
}

@media (max-width: 480px){
  .login-card{ padding: 32px 22px 26px; }
  .view-title{ font-size: 23px; }
  .stat-value{ font-size: 21px; }
  .stat-featured .stat-value{ font-size: 26px; }
}
